← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/bug-1322473 into lp:widelands

 

Review: Approve



Diff comments:

> === modified file 'maps/MP Scenarios/Island Hopping.wmf/scripting/multiplayer_init.lua'
> --- maps/MP Scenarios/Island Hopping.wmf/scripting/multiplayer_init.lua	2014-03-25 06:18:48 +0000
> +++ maps/MP Scenarios/Island Hopping.wmf/scripting/multiplayer_init.lua	2014-06-05 10:04:49 +0000
> @@ -239,6 +239,9 @@
>     disable_unused_buildings()
>  
>     send_to_all(welcome_msg)
> +   -- set the objective with the game type for all players
> +   -- TODO change this to a broadcast once individual game objectives have been implemented
> +   game.players[1]:add_objective("win_conditions", _"Rules", welcome_msg)
>  
>     for idx,plr in ipairs(game.players) do
>        run(function() run_island(plr, 1) end)
> 
> === modified file 'maps/MP Scenarios/Smugglers.wmf/scripting/multiplayer_init.lua'
> --- maps/MP Scenarios/Smugglers.wmf/scripting/multiplayer_init.lua	2014-03-25 06:18:48 +0000
> +++ maps/MP Scenarios/Smugglers.wmf/scripting/multiplayer_init.lua	2014-06-05 10:04:49 +0000
> @@ -140,7 +140,9 @@
>     end
>  
>     send_to_all(welcome_msg:format((ngettext("%i point", "%i points", points_to_win)):format(points_to_win)))
> -
> +   -- set the objective with the game type for all players
> +   -- TODO change this to a broadcast once individual game objectives have been implementes
> +   game.players[1]:add_objective("win_conditions", _"Rules", welcome_msg:format((ngettext("%i point", "%i points", points_to_win)):format(points_to_win)))
>  
>     for idx,descr in ipairs(route_descrs) do
>        run(wait_for_established_route, descr)
> 
> === modified file 'maps/Plateau.wmf/scripting/init.lua'
> --- maps/Plateau.wmf/scripting/init.lua	2014-03-25 06:18:48 +0000
> +++ maps/Plateau.wmf/scripting/init.lua	2014-06-05 10:04:49 +0000
> @@ -22,6 +22,7 @@
>     sleep(300)
>  
>     send_msg(briefing_1_the_forbidden_island)
> +   local o = add_obj(obj_forbidden_island)
>  
>     local map = wl.Game().map
>     while not p1:seen_field(map:get_field(5,8)) do sleep(2345) end
> @@ -47,7 +48,8 @@
>     scroll_smoothly_to(castle)
>  
>     send_msg(briefing_2_found_ancient_castle)
> -   local o = add_obj(obj_capture_ancient_castle)
> +   o.done = true
> +   o = add_obj(obj_capture_ancient_castle)
>  
>     -- Wait till we conquered the castle
>     while #p1:get_buildings"castle.atlanteans" < 1 do sleep(2345) end
> 
> === modified file 'maps/Plateau.wmf/scripting/texts.lua'
> --- maps/Plateau.wmf/scripting/texts.lua	2014-04-09 17:50:02 +0000
> +++ maps/Plateau.wmf/scripting/texts.lua	2014-06-05 10:04:49 +0000
> @@ -23,22 +23,35 @@
>     return p1:add_objective(o.name, o.title, _obj(reflow(o.body)), o)
>  end
>  
> +obj_forbidden_island = {
> +   name = "forbidden_island",
> +   title = _"The Forbidden Island",
> +   body = _(
> +[[Finally! We have just taken our first step towards victory! ]] ..
> +[[Last night, we landed on the forbidden island and defeated the few guards that were watching the ]] ..
> +[[north-western part of the island. ]] ..
> +[[I am quite sure that none of the other warlords has detected us so far, ]] ..
> +[[so we should keep quiet and build up our infrastructure. Soon we will be strong enough to raid their positions.]]),
> +}
> +
> +
> +
>  obj_capture_ancient_castle = {
>     name = "capture_ancient_castle",
> -   title =_ "Capture the Ancient Castle",
> +   title = _"Capture the Ancient Castle",
>     body = [[• ]] .. _
>  [[Defeat Lanissa and capture the ancient castle.]],
>  }
>  
>  obj_defeat_erwyn = {
>     name = "defeat_erwyn",
> -   title =_ "Defeat Erwyn",
> +   title = _"Defeat Erwyn",
>     body = [[• ]] .. _
>  [[Defeat Erwyn. He commands the strongest opposing military force left on this island.]],
>  }
>  obj_defeat_jomo = {
>     name = "defeat_jomo",
> -   title =_ "Defeat Jomo",
> +   title = _"Defeat Jomo",
>     body = [[• ]] .. _
>  [[Defeat Jomo. He is taking care of the soldiers’ food supply.]]
>     ,
> @@ -69,11 +82,11 @@
>  end
>  
>  briefing_1_the_forbidden_island = {
> -   title =_ "First Briefing",
> +   title = _"First Briefing",
>     width = 400,
>     height = 300,
>     posy = 1,
> -   body = _msg( _"The Forbidden Island", _(
> +   body = _msg(_"The Forbidden Island", _(
>  [[Finally! We have just taken our first step towards victory! ]] ..
>  [[Last night, we landed on the forbidden island and defeated the few guards that were watching the ]] ..
>  [[north-western part of the island. ]] ..
> @@ -82,7 +95,7 @@
>  }
>  
>  briefing_2_found_ancient_castle = {
> -   title =_ "Second Briefing",
> +   title = _"Second Briefing",
>     width = 400,
>     height = 300,
>     posy = 1,
> @@ -97,7 +110,7 @@
>  }
>  
>  briefing_3_captured_ancient_castle = {
> -   title = _ "Second Briefing",
> +   title = _"Second Briefing",
>     width = 400,
>     height = 300,
>     posy = 1,
> @@ -114,7 +127,7 @@
>  }
>  
>  briefing_erwyn_defeated = {
> -   title=_ "Another Briefing",
> +   title = _"Another Briefing",
>     width = 400,
>     height = 300,
>     posy = 1,
> @@ -123,19 +136,19 @@
>  }
>  
>  briefing_jomo_defeated = {
> -   title=_ "Another Briefing",
> +   title = _"Another Briefing",
>     width = 400,
>     height = 300,
>     posy = 1,
> -   body= _msg( _"Jomo Defeated", _
> +   body = _msg( _"Jomo Defeated", _
>  [[Great! Jomo gave up when he saw his last buildings burning down. That’s one less warlord on this island!]]),
>  }
>  
>  last_briefing_victory = {
> -   title=_ "Last Briefing",
> -   width=400,
> -   height=300,
> -   posy=1,
> +   title = _"Last Briefing",
> +   width = 400,
> +   height = 300,
> +   posy = 1,
>     body = _msg( _"Victory!", _
>  [[Finally! The island is completely ours. Now we just have to defend it better than the warlords did.]] .. paragraphdivider() ..
>  _"Congratulations! You have mastered this scenario. You may play on if you like!"
> 
> === modified file 'scripting/win_condition_functions.lua'
> --- scripting/win_condition_functions.lua	2013-08-07 16:58:48 +0000
> +++ scripting/win_condition_functions.lua	2014-06-05 10:04:49 +0000
> @@ -125,3 +125,19 @@
>         wl.game.report_result(p, 0, make_extra_data(p, wc_name, wc_ver, extra))
>     end
>  end
> +
> +
> +-- RST
> +-- .. function:: broadcast_objective(header, msg, body)
> +--
> +--    broadcast an objective to all players
> +--    technically, it is assigned to player1, because all players will see all objectives
> +--
> +--    :arg name:    A unique name for the objective
> +--    :arg title:   The title to be displayed for the objective
> +--    :arg body:    The content text to be displayed for the objective
> +function broadcast_objective(name, title, body)
> +	local plrs = wl.Game().players
> +	plrs[1]:add_objective(name, title, body)
> +end
> +
> 
> === modified file 'scripting/win_conditions/00_endless_game.lua'
> --- scripting/win_conditions/00_endless_game.lua	2014-03-25 06:18:48 +0000
> +++ scripting/win_conditions/00_endless_game.lua	2014-06-05 10:04:49 +0000
> @@ -18,7 +18,8 @@
>  	func = function()
>  		local plrs = wl.Game().players
>  
> -		broadcast(plrs, wc_name, wc_desc)
> +		-- set the objective with the game type for all players
> +		broadcast_objective("win_condition", wc_name, wc_desc)
>  
>  		-- Iterate all players, if one is defeated, remove him
>  		-- from the list, send him a defeated message and give him full vision
> 
> === modified file 'scripting/win_conditions/01_defeat_all.lua'
> --- scripting/win_conditions/01_defeat_all.lua	2014-03-25 06:18:48 +0000
> +++ scripting/win_conditions/01_defeat_all.lua	2014-06-05 10:04:49 +0000
> @@ -18,7 +18,8 @@
>  	func = function()
>  		local plrs = wl.Game().players
>  
> -		broadcast(plrs, wc_name, wc_desc)
> +		-- set the objective with the game type for all players
> +		broadcast_objective("win_condition", wc_name, wc_desc)
>  
>  		-- Iterate all players, if one is defeated, remove him
>  		-- from the list, send him a defeated message and give him full vision
> 
> === modified file 'scripting/win_conditions/02_collectors.lua'
> --- scripting/win_conditions/02_collectors.lua	2014-03-25 06:18:48 +0000
> +++ scripting/win_conditions/02_collectors.lua	2014-06-05 10:04:49 +0000
> @@ -22,6 +22,10 @@
>  	name = wc_name,
>  	description = wc_desc,
>  	func = function()
> +		local plrs = wl.Game().players

Move this variable closer to it's first use.

> +
> +		-- set the objective with the game type for all players
> +		broadcast_objective("win_condition", wc_name, wc_desc)
>  
>  -- Simple flowing text. One Paragraph
>  local function p(s)
> @@ -167,12 +171,6 @@
>  sleep(1000)
>  
>  local remaining_time = 60 * 4
> -local plrs = wl.Game().players
> -
> --- send a message with the game type to all players
> -for idx, p in ipairs(plrs) do
> -	p:send_message(wc_name, wc_desc)
> -end
>  
>  -- Endless loop
>  while true do
> 
> === modified file 'scripting/win_conditions/03_territorial_lord.lua'
> --- scripting/win_conditions/03_territorial_lord.lua	2014-03-25 06:18:48 +0000
> +++ scripting/win_conditions/03_territorial_lord.lua	2014-06-05 10:04:49 +0000
> @@ -21,6 +21,10 @@
>  	name = wc_name,
>  	description = wc_desc,
>  	func = function()
> +		local plrs = wl.Game().players

no longer used. i.e. keep it where you use it first.

> +
> +		-- set the objective with the game type for all players
> +		broadcast_objective("win_condition", wc_name, wc_desc)
>  
>  		-- Get all valueable fields of the map
>  		local fields = {}
> @@ -50,12 +54,6 @@
>  		local candidateisteam = false
>  		local remaining_time = 10 -- (dummy) -- time in secs, if == 0 -> victory
>  
> -		-- Find all valid players
> -      local plrs = wl.Game().players
> -
> -		-- send a message with the game type to all players
> -		broadcast(plrs, wc_name, wc_desc)
> -
>  		-- Find all valid teams
>  		local teamnumbers = {} -- array with team numbers
>  		for idx,p in ipairs(plrs) do
> 
> === modified file 'scripting/win_conditions/03_territorial_time.lua'
> --- scripting/win_conditions/03_territorial_time.lua	2014-03-25 06:18:48 +0000
> +++ scripting/win_conditions/03_territorial_time.lua	2014-06-05 10:04:49 +0000
> @@ -26,6 +26,10 @@
>  	name = wc_name,
>  	description = wc_desc,
>  	func = function()
> +		local plrs = wl.Game().players
> +
> +		-- set the objective with the game type for all players
> +		broadcast_objective("win_condition", wc_name, wc_desc)
>  
>  		-- Get all valueable fields of the map
>  		local fields = {}
> @@ -58,12 +62,6 @@
>  		local candidateisteam = false
>  		local remaining_time = 10 -- (dummy) -- time in secs, if == 0 -> victory
>  
> -		-- Find all valid players
> -      local plrs = wl.Game().players
> -
> -		-- send a message with the game type to all players
> -		broadcast(plrs, wc_name, wc_desc)
> -
>  		-- Find all valid teams
>  		local teamnumbers = {} -- array with team numbers
>  		for idx,p in ipairs(plrs) do
> 
> === modified file 'scripting/win_conditions/04_wood_gnome.lua'
> --- scripting/win_conditions/04_wood_gnome.lua	2014-03-25 06:18:48 +0000
> +++ scripting/win_conditions/04_wood_gnome.lua	2014-06-05 10:04:49 +0000
> @@ -21,10 +21,10 @@
>  	name = wc_name,
>  	description = wc_desc,
>  	func = function()
> -	local plrs = wl.Game().players
> +		local plrs = wl.Game().players
>  
> -	-- send a message with the game type to all players
> -	broadcast(plrs, wc_name, wc_desc)
> +		-- set the objective with the game type for all players
> +		broadcast_objective("win_condition", wc_name, wc_desc)
>  
>  	local remaining_time = 4 * 60 -- 4 hours
>  
> 
> === modified file 'scripting/win_conditions/05_endless_game_fogless.lua'
> --- scripting/win_conditions/05_endless_game_fogless.lua	2014-03-25 06:18:48 +0000
> +++ scripting/win_conditions/05_endless_game_fogless.lua	2014-06-05 10:04:49 +0000
> @@ -18,7 +18,8 @@
>  	func = function()
>  		local plrs = wl.Game().players
>  
> -		broadcast(plrs, wc_name, wc_desc)
> +		-- set the objective with the game type for all players
> +		broadcast_objective("win_condition", wc_name, wc_desc)
>  
>  		-- reveal the whole map for every player
>  		local game = wl.Game()
> 
> === modified file 'src/logic/cmd_queue.h'
> --- src/logic/cmd_queue.h	2014-05-31 10:31:18 +0000
> +++ src/logic/cmd_queue.h	2014-06-05 10:04:49 +0000
> @@ -22,6 +22,7 @@
>  
>  #include <memory>
>  #include <queue>
> +#include <stdint.h>
>  
>  #include <stdint.h>
>  
> 
> === modified file 'src/wui/interactive_player.cc'
> --- src/wui/interactive_player.cc	2014-05-27 11:01:15 +0000
> +++ src/wui/interactive_player.cc	2014-06-05 10:04:49 +0000
> @@ -155,10 +155,7 @@
>  	}
>  
>  	m_toolbar.add(&m_toggle_help,            UI::Box::AlignLeft);
> -	if (not scenario)
> -		m_toggle_objectives.set_visible(false);
> -	else
> -		m_toolbar.add(&m_toggle_objectives,      UI::Box::AlignLeft);
> +	m_toolbar.add(&m_toggle_objectives,      UI::Box::AlignLeft);
>  	m_toolbar.add(&m_toggle_message_menu,    UI::Box::AlignLeft);
>  
>  	set_player_number(plyn);
> 


-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1322473/+merge/221235
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1322473.


References