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
1=== modified file 'data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/first_island.lua'
2--- data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/first_island.lua 2016-01-29 16:36:12 +0000
3+++ data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/first_island.lua 2018-02-10 11:55:22 +0000
4@@ -21,10 +21,10 @@
5 _nplayers_finished_island[island_idx] = rank
6
7 local rewards = _finish_rewards[island_idx][rank]
8- send_to_all(rt(
9- p(msgs_finished_island[rank]:bformat(plr.name, island_idx + 1)) ..
10- p(finished_island_continues:format(format_rewards(rewards)))
11- ))
12+ send_to_all(
13+ msgs_finished_island[rank]:bformat(plr.name, island_idx + 1) ..
14+ finished_island_continues:format(format_rewards(rewards))
15+ )
16
17 local new_hq = hop_to_next_island(plr, island_idx)
18 add_wares(new_hq, rewards)
19
20=== modified file 'data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/multiplayer_init.lua'
21--- data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/multiplayer_init.lua 2016-01-28 05:24:34 +0000
22+++ data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/multiplayer_init.lua 2018-02-10 11:55:22 +0000
23@@ -2,10 +2,10 @@
24 -- Island Hopping Fun Map Scripting
25 -- =================================
26 include "scripting/coroutine.lua"
27-include "scripting/formatting.lua"
28 include "scripting/infrastructure.lua"
29 include "scripting/messages.lua"
30 include "scripting/objective_utils.lua"
31+include "scripting/richtext_scenarios.lua"
32
33 -- ==========
34 -- Constants
35@@ -92,24 +92,13 @@
36 -- Utility functions
37 -- ==================
38
39--- Sends a game status message to all players
40-function send_to_all(text, long_title)
41- for idx,plr in ipairs(game.players) do
42- if (long_title ~= nil and long_title ~= "") then
43- send_message(plr, _"Status", text, {popup=true, heading=long_title})
44- else
45- send_message(plr, _"Status", text, {popup=true})
46- end
47- end
48-end
49-
50 -- Returns a list of rewards from _finish_rewards, formatted with getplural(count, resource)
51 function format_rewards(r)
52 rv = {}
53 for name,count in pairs(r) do
54 local ware_description = wl.Game():get_ware_description(name)
55 -- TRANSLATORS: number + resource name, e.g. '1x Log'
56- rv[#rv + 1] = _"%1$dx %2$s":bformat(count, ware_description.descname) .. "<br>\n"
57+ rv[#rv + 1] = li(_"%1$dx %2$s":bformat(count, ware_description.descname))
58 end
59 return table.concat(rv)
60 end
61@@ -220,7 +209,7 @@
62 send_to_all(welcome_msg.body, welcome_msg.heading)
63 -- set the objective with the game type for all players
64 -- TODO change this to a broadcast once individual game objectives have been implemented
65- game.players[1]:add_objective("win_conditions", _"Rules", welcome_msg.body)
66+ game.players[1]:add_objective("win_conditions", _"Rules", rt(welcome_msg.body))
67
68 for idx,plr in ipairs(game.players) do
69 run(function() run_island(plr, 1) end)
70
71=== modified file 'data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/texts.lua'
72--- data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/texts.lua 2016-02-03 09:18:52 +0000
73+++ data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/texts.lua 2018-02-10 11:55:22 +0000
74@@ -3,7 +3,7 @@
75 -- =======================================================================
76 welcome_msg = {
77 heading = _"Welcome to Island Hopping",
78- body = rt(
79+ body =
80 h2(_"Rules") ..
81 p(_(
82 [[Island Hopping is a traditional tournament in Atlantean culture. ]] ..
83@@ -37,22 +37,19 @@
84 h4(_"2nd to finish") .. p(format_rewards(_finish_rewards[2][2])) ..
85 h4(_"3rd to finish") .. p(format_rewards(_finish_rewards[2][3])) ..
86 h4(_"4th to finish") .. p(format_rewards(_finish_rewards[2][4]))
87- )
88 }
89
90 msgs_finished_island = {
91- _"%1$s was the first to reach Island number %2$i.",
92- _"%1$s was the second to reach Island number %2$i.",
93- _"%1$s was the third to reach Island number %2$i.",
94- _"%1$s was the fourth to reach Island number %2$i."
95+ li(_"%1$s was the first to reach Island number %2$i."),
96+ li(_"%1$s was the second to reach Island number %2$i."),
97+ li(_"%1$s was the third to reach Island number %2$i."),
98+ li(_"%1$s was the fourth to reach Island number %2$i.")
99 }
100-finished_island_continues = _ "The reward for this feat amounts to:" .. "<br>%s"
101+finished_island_continues = p(_"The reward for this feat amounts to:") .. p("%s")
102
103-player_claims_hill = rt(p(_
104+player_claims_hill = p(_
105 [[%s is now King of the Hill and will win the game in 20 minutes, if nobody takes over the hill before then.]]
106-))
107-lost_control = rt(p(_
108-[[%s lost control of the hill.]]
109-))
110-had_control_for = rt(p(_[[%1$s has been King of the Hill for %2$s!]]))
111-player_won = rt(p(_[[%s has won the game. Congratulations!]]))
112+)
113+lost_control = p(_[[%s lost control of the hill.]])
114+had_control_for = p(_[[%1$s has been King of the Hill for %2$s!]])
115+player_won = p(_[[%s has won the game. Congratulations!]])
116
117=== modified file 'data/maps/MP_Scenarios/Smugglers.wmf/scripting/multiplayer_init.lua'
118--- data/maps/MP_Scenarios/Smugglers.wmf/scripting/multiplayer_init.lua 2016-01-28 05:24:34 +0000
119+++ data/maps/MP_Scenarios/Smugglers.wmf/scripting/multiplayer_init.lua 2018-02-10 11:55:22 +0000
120@@ -3,8 +3,8 @@
121 -- =================================
122 include "scripting/coroutine.lua"
123 include "scripting/infrastructure.lua"
124-include "scripting/formatting.lua"
125 include "scripting/objective_utils.lua"
126+include "scripting/richtext_scenarios.lua"
127 include "scripting/set.lua"
128
129 -- ==========
130@@ -35,19 +35,6 @@
131 -- =================
132 points = { 0, 0 }
133
134--- =================
135--- Utility functions
136--- =================
137-function send_to_all(text, long_title)
138- for idx,plr in ipairs(game.players) do
139- if (long_title ~= nil and long_title ~= "") then
140- send_message(plr, _"Status", text, {popup=true, heading=long_title})
141- else
142- send_message(plr, _"Status", text, {popup=true})
143- end
144- end
145-end
146-
147 include "map:scripting/texts.lua"
148 include "map:scripting/smuggling.lua"
149
150@@ -145,7 +132,7 @@
151 send_to_all(welcome_msg.body:format((ngettext("%i point", "%i points", points_to_win)):format(points_to_win)), welcome_msg.heading)
152 -- set the objective with the game type for all players
153 -- TODO change this to a broadcast once individual game objectives have been implementes
154- game.players[1]:add_objective("win_conditions", _"Rules", welcome_msg.body:format((ngettext("%i point", "%i points", points_to_win)):format(points_to_win)))
155+ 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))))
156
157 for idx,descr in ipairs(route_descrs) do
158 run(wait_for_established_route, descr)
159
160=== modified file 'data/maps/MP_Scenarios/Smugglers.wmf/scripting/texts.lua'
161--- data/maps/MP_Scenarios/Smugglers.wmf/scripting/texts.lua 2015-12-03 09:56:01 +0000
162+++ data/maps/MP_Scenarios/Smugglers.wmf/scripting/texts.lua 2018-02-10 11:55:22 +0000
163@@ -4,41 +4,36 @@
164
165 welcome_msg = {
166 heading = _"Smugglers",
167- body = rt(
168+ body =
169 h2(_"Rules") ..
170 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.]])) ..
171 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.]])) ..
172 -- TRANSLATORS: %s = '<number> points'
173 p(_([[For harder to defend smuggling routes, you get 2 or 3 points per ware smuggled. The first team to collect %s wins.]])) ..
174- rt(h2(_"A sending spot")) .. rt("image=map:send_spot.png", p(" ")) ..
175- rt(h2(_"A receiving spot")) .. rt("image=map:recv_spot.png", p(" ")) ..
176- rt(h2(_"Notes") ..
177- 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.]]))) ..
178- p(_([[You can see the number of wares traded at any time in the general statistics menu. Good luck!]])))
179+ h2(_"A sending spot") .. p(img("map:send_spot.png")) ..
180+ h2(_"A receiving spot") .. p(img("map:recv_spot.png")) ..
181+ h2(_"Notes") ..
182+ 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.]])) ..
183+ p(_([[You can see the number of wares traded at any time in the general statistics menu. Good luck!]]))
184 }
185
186-smuggling_route_established_other_team = rt(
187+smuggling_route_established_other_team =
188 -- TRANSLATORS: the first 2 parameters are player names, the last parameter is '<number> points'
189 p(_([[A new smuggling route from %1$s to %2$s has been established! Every ware they smuggle there is worth %3$s.]]))
190- )
191
192-smuggling_route_established_sender = rt(
193+smuggling_route_established_sender =
194 -- TRANSLATORS: %s = '<number> points'
195 p(_([[Your team has established a new smuggling route. You have the sending warehouse. Every ware smuggled here is worth %s.]]))
196- )
197
198-smuggling_route_established_receiver = rt(
199+smuggling_route_established_receiver =
200 -- TRANSLATORS: %s = '<number> points'
201 p(_([[Your team has established a new smuggling route. You have the receiving warehouse. Every ware smuggled here is worth %s.]]))
202- )
203
204-smuggling_route_broken = rt(
205+smuggling_route_broken =
206 -- TRANSLATORS: the first parameter is '<number> points', the last 2 parameters are player names
207 p(_[[The smuggling route worth %1$s from %2$s to %3$s has been broken!]])
208- )
209
210-game_over = rt(
211+game_over =
212 h1(_"Game over!") ..
213 -- TRANSLATORS: the first 4 parameters are player names, the last parameter is '<number> points'
214 p(_[[Game over! %1$s and %2$s have won the game! %3$s and %4$s only managed to collect %5$s.]])
215- )
216
217=== modified file 'data/scripting/messages.lua'
218--- data/scripting/messages.lua 2017-12-09 06:29:26 +0000
219+++ data/scripting/messages.lua 2018-02-10 11:55:22 +0000
220@@ -33,6 +33,28 @@
221 player:send_message(title, body, parameters)
222 end
223
224+
225+-- RST
226+-- .. function:: send_to_all(text[, heading])
227+--
228+-- Sends a game status message to all players.
229+--
230+-- :arg text: the localized body of the message. You can use rt functions here.
231+-- :type text: :class:`string`
232+-- :arg heading: the localized title of the message (optional)
233+-- :type heading: :class:`string`
234+--
235+function send_to_all(text, heading)
236+ for idx,plr in ipairs(game.players) do
237+ if (heading ~= nil and heading ~= "") then
238+ send_message(plr, _"Status", text, {popup=true, heading=heading})
239+ else
240+ send_message(plr, _"Status", text, {popup=true})
241+ end
242+ end
243+end
244+
245+
246 -- RST
247 -- .. function:: message_box(player, title, message, parameters)
248 --

Subscribers

People subscribed via source and target branches

to status/vote changes: