Merge lp:~widelands-dev/widelands/fh1-maps-multiplayer into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 8607
Proposed branch: lp:~widelands-dev/widelands/fh1-maps-multiplayer
Merge into: lp:widelands
Diff against target: 248 lines (+53/-63)
6 files modified
data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/first_island.lua (+4/-4)
data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/multiplayer_init.lua (+3/-14)
data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/texts.lua (+11/-14)
data/maps/MP_Scenarios/Smugglers.wmf/scripting/multiplayer_init.lua (+2/-15)
data/maps/MP_Scenarios/Smugglers.wmf/scripting/texts.lua (+11/-16)
data/scripting/messages.lua (+22/-0)
To merge this branch: bzr merge lp:~widelands-dev/widelands/fh1-maps-multiplayer
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+337506@code.launchpad.net

Commit message

Converted MP scenarios to new font renderer.

This concludes the conversion to the new font renderer.

Thanks to Charly Ghislain (cghislai) who worked on the original branch (lp:~widelands-dev/widelands/fh1), which has now become unmergeable.

Description of the change

I have playtested Smugglers until the first smuggling report, but have done no testing on Island Hopping yet apart from loading the scenario.

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3160. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/339824814.
Appveyor build 2967. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_fh1_maps_multiplayer-2967.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Uhmm, to test hese we must do a realo multiplayer game, no bots.
As my son has a Visitor I am not user I have time for some real testing.

Code LGTM.

Revision history for this message
GunChleoc (gunchleoc) wrote :

I have tested Island Hopping now. Smugglers still needs a full test.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Gun: how did you test this on your own?
I assume you need a real multiplayer setup to see all the messages?

Revision history for this message
GunChleoc (gunchleoc) wrote :

I can 4 copies of Widelands on the same machine. If you start it with

   ./widelands &

you don't even need separate terminals.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

So you know the magic of cloning yourself as well ;-)
So you must play ound robn and check all the possible outcomes?

Will try this later. Now started with bug1749586

Revision history for this message
GunChleoc (gunchleoc) wrote :

Yes, pretty much.

for Island Hopping, I just payed with 1 player with some soldier training until I reached the last island. Then I played the other 2 players round robin until they reached the last island too, and then I did a bit of fighting over the hill to make sure to trigger all messages.

Still need to do the same with Smugglers, but playing 2 allies and leaving the other 2 players idle should do.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Smugglers is impossible to test now because of https://bugs.launchpad.net/widelands/+bug/1751440

I'll try to get that fixed.

Revision history for this message
GunChleoc (gunchleoc) wrote :

I have managed to test Smugglers to the end now by temporarily merging lp:~widelands-dev/widelands/bug-1751440-smugglers-desync

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/first_island.lua'
--- data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/first_island.lua 2016-01-29 16:36:12 +0000
+++ data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/first_island.lua 2018-02-10 11:55:22 +0000
@@ -21,10 +21,10 @@
21 _nplayers_finished_island[island_idx] = rank21 _nplayers_finished_island[island_idx] = rank
2222
23 local rewards = _finish_rewards[island_idx][rank]23 local rewards = _finish_rewards[island_idx][rank]
24 send_to_all(rt(24 send_to_all(
25 p(msgs_finished_island[rank]:bformat(plr.name, island_idx + 1)) ..25 msgs_finished_island[rank]:bformat(plr.name, island_idx + 1) ..
26 p(finished_island_continues:format(format_rewards(rewards)))26 finished_island_continues:format(format_rewards(rewards))
27 ))27 )
2828
29 local new_hq = hop_to_next_island(plr, island_idx)29 local new_hq = hop_to_next_island(plr, island_idx)
30 add_wares(new_hq, rewards)30 add_wares(new_hq, rewards)
3131
=== modified file 'data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/multiplayer_init.lua'
--- data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/multiplayer_init.lua 2016-01-28 05:24:34 +0000
+++ data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/multiplayer_init.lua 2018-02-10 11:55:22 +0000
@@ -2,10 +2,10 @@
2-- Island Hopping Fun Map Scripting2-- Island Hopping Fun Map Scripting
3-- =================================3-- =================================
4include "scripting/coroutine.lua"4include "scripting/coroutine.lua"
5include "scripting/formatting.lua"
6include "scripting/infrastructure.lua"5include "scripting/infrastructure.lua"
7include "scripting/messages.lua"6include "scripting/messages.lua"
8include "scripting/objective_utils.lua"7include "scripting/objective_utils.lua"
8include "scripting/richtext_scenarios.lua"
99
10-- ==========10-- ==========
11-- Constants11-- Constants
@@ -92,24 +92,13 @@
92-- Utility functions92-- Utility functions
93-- ==================93-- ==================
9494
95-- Sends a game status message to all players
96function send_to_all(text, long_title)
97 for idx,plr in ipairs(game.players) do
98 if (long_title ~= nil and long_title ~= "") then
99 send_message(plr, _"Status", text, {popup=true, heading=long_title})
100 else
101 send_message(plr, _"Status", text, {popup=true})
102 end
103 end
104end
105
106-- Returns a list of rewards from _finish_rewards, formatted with getplural(count, resource)95-- Returns a list of rewards from _finish_rewards, formatted with getplural(count, resource)
107function format_rewards(r)96function format_rewards(r)
108 rv = {}97 rv = {}
109 for name,count in pairs(r) do98 for name,count in pairs(r) do
110 local ware_description = wl.Game():get_ware_description(name)99 local ware_description = wl.Game():get_ware_description(name)
111 -- TRANSLATORS: number + resource name, e.g. '1x Log'100 -- TRANSLATORS: number + resource name, e.g. '1x Log'
112 rv[#rv + 1] = _"%1$dx %2$s":bformat(count, ware_description.descname) .. "<br>\n"101 rv[#rv + 1] = li(_"%1$dx %2$s":bformat(count, ware_description.descname))
113 end102 end
114 return table.concat(rv)103 return table.concat(rv)
115end104end
@@ -220,7 +209,7 @@
220 send_to_all(welcome_msg.body, welcome_msg.heading)209 send_to_all(welcome_msg.body, welcome_msg.heading)
221 -- set the objective with the game type for all players210 -- set the objective with the game type for all players
222 -- TODO change this to a broadcast once individual game objectives have been implemented211 -- TODO change this to a broadcast once individual game objectives have been implemented
223 game.players[1]:add_objective("win_conditions", _"Rules", welcome_msg.body)212 game.players[1]:add_objective("win_conditions", _"Rules", rt(welcome_msg.body))
224213
225 for idx,plr in ipairs(game.players) do214 for idx,plr in ipairs(game.players) do
226 run(function() run_island(plr, 1) end)215 run(function() run_island(plr, 1) end)
227216
=== modified file 'data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/texts.lua'
--- data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/texts.lua 2016-02-03 09:18:52 +0000
+++ data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/texts.lua 2018-02-10 11:55:22 +0000
@@ -3,7 +3,7 @@
3-- =======================================================================3-- =======================================================================
4welcome_msg = {4welcome_msg = {
5 heading = _"Welcome to Island Hopping",5 heading = _"Welcome to Island Hopping",
6 body = rt(6 body =
7 h2(_"Rules") ..7 h2(_"Rules") ..
8 p(_(8 p(_(
9 [[Island Hopping is a traditional tournament in Atlantean culture. ]] ..9 [[Island Hopping is a traditional tournament in Atlantean culture. ]] ..
@@ -37,22 +37,19 @@
37 h4(_"2nd to finish") .. p(format_rewards(_finish_rewards[2][2])) ..37 h4(_"2nd to finish") .. p(format_rewards(_finish_rewards[2][2])) ..
38 h4(_"3rd to finish") .. p(format_rewards(_finish_rewards[2][3])) ..38 h4(_"3rd to finish") .. p(format_rewards(_finish_rewards[2][3])) ..
39 h4(_"4th to finish") .. p(format_rewards(_finish_rewards[2][4]))39 h4(_"4th to finish") .. p(format_rewards(_finish_rewards[2][4]))
40 )
41}40}
4241
43msgs_finished_island = {42msgs_finished_island = {
44 _"%1$s was the first to reach Island number %2$i.",43 li(_"%1$s was the first to reach Island number %2$i."),
45 _"%1$s was the second to reach Island number %2$i.",44 li(_"%1$s was the second to reach Island number %2$i."),
46 _"%1$s was the third to reach Island number %2$i.",45 li(_"%1$s was the third to reach Island number %2$i."),
47 _"%1$s was the fourth to reach Island number %2$i."46 li(_"%1$s was the fourth to reach Island number %2$i.")
48}47}
49finished_island_continues = _ "The reward for this feat amounts to:" .. "<br>%s"48finished_island_continues = p(_"The reward for this feat amounts to:") .. p("%s")
5049
51player_claims_hill = rt(p(_50player_claims_hill = p(_
52[[%s is now King of the Hill and will win the game in 20 minutes, if nobody takes over the hill before then.]]51[[%s is now King of the Hill and will win the game in 20 minutes, if nobody takes over the hill before then.]]
53))52)
54lost_control = rt(p(_53lost_control = p(_[[%s lost control of the hill.]])
55[[%s lost control of the hill.]]54had_control_for = p(_[[%1$s has been King of the Hill for %2$s!]])
56))55player_won = p(_[[%s has won the game. Congratulations!]])
57had_control_for = rt(p(_[[%1$s has been King of the Hill for %2$s!]]))
58player_won = rt(p(_[[%s has won the game. Congratulations!]]))
5956
=== modified file 'data/maps/MP_Scenarios/Smugglers.wmf/scripting/multiplayer_init.lua'
--- data/maps/MP_Scenarios/Smugglers.wmf/scripting/multiplayer_init.lua 2016-01-28 05:24:34 +0000
+++ data/maps/MP_Scenarios/Smugglers.wmf/scripting/multiplayer_init.lua 2018-02-10 11:55:22 +0000
@@ -3,8 +3,8 @@
3-- =================================3-- =================================
4include "scripting/coroutine.lua"4include "scripting/coroutine.lua"
5include "scripting/infrastructure.lua"5include "scripting/infrastructure.lua"
6include "scripting/formatting.lua"
7include "scripting/objective_utils.lua"6include "scripting/objective_utils.lua"
7include "scripting/richtext_scenarios.lua"
8include "scripting/set.lua"8include "scripting/set.lua"
99
10-- ==========10-- ==========
@@ -35,19 +35,6 @@
35-- =================35-- =================
36points = { 0, 0 }36points = { 0, 0 }
3737
38-- =================
39-- Utility functions
40-- =================
41function send_to_all(text, long_title)
42 for idx,plr in ipairs(game.players) do
43 if (long_title ~= nil and long_title ~= "") then
44 send_message(plr, _"Status", text, {popup=true, heading=long_title})
45 else
46 send_message(plr, _"Status", text, {popup=true})
47 end
48 end
49end
50
51include "map:scripting/texts.lua"38include "map:scripting/texts.lua"
52include "map:scripting/smuggling.lua"39include "map:scripting/smuggling.lua"
5340
@@ -145,7 +132,7 @@
145 send_to_all(welcome_msg.body:format((ngettext("%i point", "%i points", points_to_win)):format(points_to_win)), welcome_msg.heading)132 send_to_all(welcome_msg.body:format((ngettext("%i point", "%i points", points_to_win)):format(points_to_win)), welcome_msg.heading)
146 -- set the objective with the game type for all players133 -- set the objective with the game type for all players
147 -- TODO change this to a broadcast once individual game objectives have been implementes134 -- TODO change this to a broadcast once individual game objectives have been implementes
148 game.players[1]:add_objective("win_conditions", _"Rules", welcome_msg.body:format((ngettext("%i point", "%i points", points_to_win)):format(points_to_win)))135 game.players[1]:add_objective("win_conditions", _"Rules", rt(welcome_msg.body:format((ngettext("%i point", "%i points", points_to_win)):format(points_to_win))))
149136
150 for idx,descr in ipairs(route_descrs) do137 for idx,descr in ipairs(route_descrs) do
151 run(wait_for_established_route, descr)138 run(wait_for_established_route, descr)
152139
=== modified file 'data/maps/MP_Scenarios/Smugglers.wmf/scripting/texts.lua'
--- data/maps/MP_Scenarios/Smugglers.wmf/scripting/texts.lua 2015-12-03 09:56:01 +0000
+++ data/maps/MP_Scenarios/Smugglers.wmf/scripting/texts.lua 2018-02-10 11:55:22 +0000
@@ -4,41 +4,36 @@
44
5welcome_msg = {5welcome_msg = {
6 heading = _"Smugglers",6 heading = _"Smugglers",
7 body = rt(7 body =
8 h2(_"Rules") ..8 h2(_"Rules") ..
9 p(_([[Smugglers is a fun map for 4 players. You and your partner start diagonally from each other on a point symmetric island. There are plenty of smuggling tunnels on this island, each consisting of a receiving and a sending end.]])) ..9 p(_([[Smugglers is a fun map for 4 players. You and your partner start diagonally from each other on a point symmetric island. There are plenty of smuggling tunnels on this island, each consisting of a receiving and a sending end.]])) ..
10 p(_([[To establish a smuggling route, you need to build a warehouse on a sending/receiving spot while your team mate has to build one on the corresponding receiving/sending spot. A ware is then transported every 10 seconds.]])) ..10 p(_([[To establish a smuggling route, you need to build a warehouse on a sending/receiving spot while your team mate has to build one on the corresponding receiving/sending spot. A ware is then transported every 10 seconds.]])) ..
11 -- TRANSLATORS: %s = '<number> points'11 -- TRANSLATORS: %s = '<number> points'
12 p(_([[For harder to defend smuggling routes, you get 2 or 3 points per ware smuggled. The first team to collect %s wins.]])) ..12 p(_([[For harder to defend smuggling routes, you get 2 or 3 points per ware smuggled. The first team to collect %s wins.]])) ..
13 rt(h2(_"A sending spot")) .. rt("image=map:send_spot.png", p(" ")) ..13 h2(_"A sending spot") .. p(img("map:send_spot.png")) ..
14 rt(h2(_"A receiving spot")) .. rt("image=map:recv_spot.png", p(" ")) ..14 h2(_"A receiving spot") .. p(img("map:recv_spot.png")) ..
15 rt(h2(_"Notes") ..15 h2(_"Notes") ..
16 p(_([[Remember that the map has rotational symmetry. For example, when you have found a spot to the top-left of your headquarters, the corresponding spot will be to the bottom-right of the headquarters of your team mate.]]))) ..16 p(_([[Remember that the map has rotational symmetry. For example, when you have found a spot to the top-left of your headquarters, the corresponding spot will be to the bottom-right of the headquarters of your team mate.]])) ..
17 p(_([[You can see the number of wares traded at any time in the general statistics menu. Good luck!]])))17 p(_([[You can see the number of wares traded at any time in the general statistics menu. Good luck!]]))
18}18}
1919
20smuggling_route_established_other_team = rt(20smuggling_route_established_other_team =
21-- TRANSLATORS: the first 2 parameters are player names, the last parameter is '<number> points'21-- TRANSLATORS: the first 2 parameters are player names, the last parameter is '<number> points'
22 p(_([[A new smuggling route from %1$s to %2$s has been established! Every ware they smuggle there is worth %3$s.]]))22 p(_([[A new smuggling route from %1$s to %2$s has been established! Every ware they smuggle there is worth %3$s.]]))
23 )
2423
25smuggling_route_established_sender = rt(24smuggling_route_established_sender =
26-- TRANSLATORS: %s = '<number> points'25-- TRANSLATORS: %s = '<number> points'
27 p(_([[Your team has established a new smuggling route. You have the sending warehouse. Every ware smuggled here is worth %s.]]))26 p(_([[Your team has established a new smuggling route. You have the sending warehouse. Every ware smuggled here is worth %s.]]))
28 )
2927
30smuggling_route_established_receiver = rt(28smuggling_route_established_receiver =
31-- TRANSLATORS: %s = '<number> points'29-- TRANSLATORS: %s = '<number> points'
32 p(_([[Your team has established a new smuggling route. You have the receiving warehouse. Every ware smuggled here is worth %s.]]))30 p(_([[Your team has established a new smuggling route. You have the receiving warehouse. Every ware smuggled here is worth %s.]]))
33 )
3431
35smuggling_route_broken = rt(32smuggling_route_broken =
36-- TRANSLATORS: the first parameter is '<number> points', the last 2 parameters are player names33-- TRANSLATORS: the first parameter is '<number> points', the last 2 parameters are player names
37 p(_[[The smuggling route worth %1$s from %2$s to %3$s has been broken!]])34 p(_[[The smuggling route worth %1$s from %2$s to %3$s has been broken!]])
38 )
3935
40game_over = rt(36game_over =
41 h1(_"Game over!") ..37 h1(_"Game over!") ..
42-- TRANSLATORS: the first 4 parameters are player names, the last parameter is '<number> points'38-- TRANSLATORS: the first 4 parameters are player names, the last parameter is '<number> points'
43 p(_[[Game over! %1$s and %2$s have won the game! %3$s and %4$s only managed to collect %5$s.]])39 p(_[[Game over! %1$s and %2$s have won the game! %3$s and %4$s only managed to collect %5$s.]])
44 )
4540
=== modified file 'data/scripting/messages.lua'
--- data/scripting/messages.lua 2017-12-09 06:29:26 +0000
+++ data/scripting/messages.lua 2018-02-10 11:55:22 +0000
@@ -33,6 +33,28 @@
33 player:send_message(title, body, parameters)33 player:send_message(title, body, parameters)
34end34end
3535
36
37-- RST
38-- .. function:: send_to_all(text[, heading])
39--
40-- Sends a game status message to all players.
41--
42-- :arg text: the localized body of the message. You can use rt functions here.
43-- :type text: :class:`string`
44-- :arg heading: the localized title of the message (optional)
45-- :type heading: :class:`string`
46--
47function send_to_all(text, heading)
48 for idx,plr in ipairs(game.players) do
49 if (heading ~= nil and heading ~= "") then
50 send_message(plr, _"Status", text, {popup=true, heading=heading})
51 else
52 send_message(plr, _"Status", text, {popup=true})
53 end
54 end
55end
56
57
36-- RST58-- RST
37-- .. function:: message_box(player, title, message, parameters)59-- .. function:: message_box(player, title, message, parameters)
38--60--

Subscribers

People subscribed via source and target branches

to status/vote changes: