Merge lp:~widelands-dev/widelands/market into lp:widelands
- market
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 8457 |
Proposed branch: | lp:~widelands-dev/widelands/market |
Merge into: | lp:widelands |
Diff against target: |
1038 lines (+562/-64) 33 files modified
data/tribes/barbarians.lua (+3/-0) data/tribes/buildings/markets/barbarians/market/helptexts.lua (+28/-0) data/tribes/buildings/markets/barbarians/market/init.lua (+56/-0) data/tribes/init.lua (+7/-0) data/tribes/scripting/starting_conditions/barbarians/fortified_village.lua (+1/-0) data/tribes/scripting/starting_conditions/barbarians/headquarters.lua (+1/-0) data/tribes/scripting/starting_conditions/barbarians/trading_outpost.lua (+1/-0) doc/sphinx/extract_rst.py (+2/-0) regression_test.py (+1/-1) src/logic/CMakeLists.txt (+2/-0) src/logic/map_objects/map_object.cc (+2/-0) src/logic/map_objects/map_object.h (+1/-0) src/logic/map_objects/tribes/market.cc (+45/-0) src/logic/map_objects/tribes/market.h (+51/-0) src/logic/map_objects/tribes/productionsite.cc (+26/-23) src/logic/map_objects/tribes/productionsite.h (+10/-1) src/logic/map_objects/tribes/tribes.cc (+7/-0) src/logic/map_objects/tribes/tribes.h (+4/-0) src/scripting/lua_map.cc (+116/-26) src/scripting/lua_map.h (+58/-0) src/scripting/lua_root.cc (+31/-6) src/scripting/lua_root.h (+7/-6) src/website/map_object_info.cc (+3/-0) src/wui/interactive_gamebase.cc (+1/-0) test/maps/lua_testsuite.wmf/scripting/tribes_descriptions.lua (+1/-1) test/maps/market_trading.wmf/elemental (+12/-0) test/maps/market_trading.wmf/objective (+4/-0) test/maps/market_trading.wmf/player_names (+16/-0) test/maps/market_trading.wmf/player_position (+6/-0) test/maps/market_trading.wmf/port_spaces (+7/-0) test/maps/market_trading.wmf/scripting/init.lua (+28/-0) test/maps/market_trading.wmf/scripting/test_market_can_be_build.lua (+13/-0) test/maps/market_trading.wmf/version (+11/-0) |
To merge this branch: | bzr merge lp:~widelands-dev/widelands/market |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
kaputtnik (community) | testing | Approve | |
SirVer | Needs Resubmitting | ||
GunChleoc | Needs Fixing | ||
Review via email: mp+330830@code.launchpad.net |
Commit message
Adds a new building type called 'Market' that will be the trading building for land-based trading. The building is only added to the barbarians and is is disabled in all barbarian scenarios and start conditions.
This merge request (MR) adds the (massive) boilerplate and a simple test that the new building can actually be build. I'd like to get this in before adding the logic, so future MRs are smaller.
The test is run with the regular regression test runs, but can be run standalone using:
./build/
Description of the change
bunnybot (widelandsofficial) wrote : | # |
GunChleoc (gunchleoc) wrote : | # |
Code LTGM, except for 1 nit that has to be fixed - there's a string that should not end up on Transifex.
Not tested yet.
GunChleoc (gunchleoc) wrote : | # |
I just started a multiplayer game with varying starting conditions on collectors and got 4 coroutine errors:
3x plr nil value
1x 'barbarians_market' was not understood as an argument
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 2674. State: passed. Details: https:/
Appveyor build 2495. State: success. Details: https:/
SirVer (sirver) wrote : | # |
> I just started a multiplayer game with varying starting conditions on collectors and got 4 coroutine errors:
Should all be fixed now, please take another look.
kaputtnik (franku) wrote : | # |
No errors anymore. Tested single player with three different tribes.
SirVer (sirver) wrote : | # |
Fixed the nit that Gun asked for. Thanks for testing and code review!
@bunnybot merge
bunnybot (widelandsofficial) wrote : | # |
Error merging this proposal:
Output:
stdout:
stderr:
bzr: ERROR: Parameter "Merged lp:~widelands-dev/widelands/market:\nAdds a new building type called 'Market' that will be the trading building for land-based trading. The building is only added to the barbarians and is is disabled in all barbarian scenarios and start conditions.\n\nThis merge request (MR) adds the (massive) boilerplate and a simple test that the new building can actually be build. I'd like to get this in before adding the logic, so future MRs are smaller.\n\nThe test is run with the regular regression test runs, but can be run standalone using:\
SirVer (sirver) wrote : | # |
removed non-breaking space from commit message.
@bunnybot merge
bunnybot (widelandsofficial) wrote : | # |
Error merging this proposal:
Output:
stdout:
stderr:
+N data/tribes/
+N data/tribes/
+N data/tribes/
+N data/tribes/
+N data/tribes/
+N data/tribes/
+N data/tribes/
+N data/tribes/
+N data/tribes/
+N src/logic/
+N src/logic/
+N test/maps/
+N test/maps/
+N test/maps/
+N test/maps/
+N test/maps/
+N test/maps/
+N test/maps/
+N test/maps/
+N test/maps/
+N test/maps/
+N test/maps/
+N test/maps/
+N test/maps/
+N test/maps/
+N test/maps/
+N test/maps/
M data/tribes/
M data/tribes/
M data/tribes/
M data/tribes/
M data/tribes/
M doc/sphinx/
M regression_test.py
M src/logic/
M src/logic/
M src/logic/
M src/logic/
M src/logic/
M src/logic/
M src/logic/
M src/scripting/
M src/scripting/
M src/scripting/
M src/scripting/
M src/website/
M src/wui/
M test/maps/
Conflict adding file src/logic/
Conflict adding file test/maps/
2 conflicts encountered.
SirVer (sirver) wrote : | # |
This was a bunnybot bug, fixed in https:/
@bunnybot merge
GunChleoc (gunchleoc) wrote : | # |
BTW I just noticed another error in a file name:
'test/maps/
'test/maps/
Yep, English is fun... feel free to fix this in a follow-up branch.
SirVer (sirver) wrote : | # |
Will fix in the next branch.
Preview Diff
1 | === modified file 'data/tribes/barbarians.lua' | |||
2 | --- data/tribes/barbarians.lua 2017-07-19 20:40:32 +0000 | |||
3 | +++ data/tribes/barbarians.lua 2017-09-18 07:21:55 +0000 | |||
4 | @@ -176,6 +176,9 @@ | |||
5 | 176 | "barbarians_warehouse", | 176 | "barbarians_warehouse", |
6 | 177 | "barbarians_port", | 177 | "barbarians_port", |
7 | 178 | 178 | ||
8 | 179 | -- Markets | ||
9 | 180 | "barbarians_market", | ||
10 | 181 | |||
11 | 179 | -- Small | 182 | -- Small |
12 | 180 | "barbarians_quarry", | 183 | "barbarians_quarry", |
13 | 181 | "barbarians_lumberjacks_hut", | 184 | "barbarians_lumberjacks_hut", |
14 | 182 | 185 | ||
15 | === added directory 'data/tribes/buildings/markets' | |||
16 | === added directory 'data/tribes/buildings/markets/barbarians' | |||
17 | === added directory 'data/tribes/buildings/markets/barbarians/market' | |||
18 | === added file 'data/tribes/buildings/markets/barbarians/market/build_00.png' | |||
19 | 183 | Binary files data/tribes/buildings/markets/barbarians/market/build_00.png 1970-01-01 00:00:00 +0000 and data/tribes/buildings/markets/barbarians/market/build_00.png 2017-09-18 07:21:55 +0000 differ | 186 | Binary files data/tribes/buildings/markets/barbarians/market/build_00.png 1970-01-01 00:00:00 +0000 and data/tribes/buildings/markets/barbarians/market/build_00.png 2017-09-18 07:21:55 +0000 differ |
20 | === added file 'data/tribes/buildings/markets/barbarians/market/helptexts.lua' | |||
21 | --- data/tribes/buildings/markets/barbarians/market/helptexts.lua 1970-01-01 00:00:00 +0000 | |||
22 | +++ data/tribes/buildings/markets/barbarians/market/helptexts.lua 2017-09-18 07:21:55 +0000 | |||
23 | @@ -0,0 +1,28 @@ | |||
24 | 1 | -- This include can be removed when all help texts have been defined. | ||
25 | 2 | include "tribes/scripting/help/global_helptexts.lua" | ||
26 | 3 | |||
27 | 4 | function building_helptext_lore() | ||
28 | 5 | -- TRANSLATORS#: Lore helptext for a building | ||
29 | 6 | return no_lore_text_yet() | ||
30 | 7 | end | ||
31 | 8 | |||
32 | 9 | function building_helptext_lore_author() | ||
33 | 10 | -- TRANSLATORS#: Lore author helptext for a building | ||
34 | 11 | return no_lore_author_text_yet() | ||
35 | 12 | end | ||
36 | 13 | |||
37 | 14 | function building_helptext_purpose() | ||
38 | 15 | -- TODO(sirver): Document market once its use stabilizes. | ||
39 | 16 | -- TRANSLATORS#: Purpose helptext for a building | ||
40 | 17 | return "" | ||
41 | 18 | end | ||
42 | 19 | |||
43 | 20 | function building_helptext_note() | ||
44 | 21 | -- TRANSLATORS#: Note helptext for a building | ||
45 | 22 | return "" | ||
46 | 23 | end | ||
47 | 24 | |||
48 | 25 | function building_helptext_performance() | ||
49 | 26 | -- TRANSLATORS#: Performance helptext for a building | ||
50 | 27 | return "" | ||
51 | 28 | end | ||
52 | 0 | 29 | ||
53 | === added file 'data/tribes/buildings/markets/barbarians/market/idle_00.png' | |||
54 | 1 | Binary files data/tribes/buildings/markets/barbarians/market/idle_00.png 1970-01-01 00:00:00 +0000 and data/tribes/buildings/markets/barbarians/market/idle_00.png 2017-09-18 07:21:55 +0000 differ | 30 | Binary files data/tribes/buildings/markets/barbarians/market/idle_00.png 1970-01-01 00:00:00 +0000 and data/tribes/buildings/markets/barbarians/market/idle_00.png 2017-09-18 07:21:55 +0000 differ |
55 | === added file 'data/tribes/buildings/markets/barbarians/market/idle_00_pc.png' | |||
56 | 2 | Binary files data/tribes/buildings/markets/barbarians/market/idle_00_pc.png 1970-01-01 00:00:00 +0000 and data/tribes/buildings/markets/barbarians/market/idle_00_pc.png 2017-09-18 07:21:55 +0000 differ | 31 | Binary files data/tribes/buildings/markets/barbarians/market/idle_00_pc.png 1970-01-01 00:00:00 +0000 and data/tribes/buildings/markets/barbarians/market/idle_00_pc.png 2017-09-18 07:21:55 +0000 differ |
57 | === added file 'data/tribes/buildings/markets/barbarians/market/init.lua' | |||
58 | --- data/tribes/buildings/markets/barbarians/market/init.lua 1970-01-01 00:00:00 +0000 | |||
59 | +++ data/tribes/buildings/markets/barbarians/market/init.lua 2017-09-18 07:21:55 +0000 | |||
60 | @@ -0,0 +1,56 @@ | |||
61 | 1 | -- RST | ||
62 | 2 | -- .. _lua_tribes_buildings_markets: | ||
63 | 3 | -- | ||
64 | 4 | -- Markets | ||
65 | 5 | -- ------- | ||
66 | 6 | -- | ||
67 | 7 | -- TODO(sirver, trading): Add useful documentation here | ||
68 | 8 | dirname = path.dirname(__file__) | ||
69 | 9 | |||
70 | 10 | tribes:new_market_type { | ||
71 | 11 | msgctxt = "barbarians_building", | ||
72 | 12 | name = "barbarians_market", | ||
73 | 13 | -- TRANSLATORS: This is a building name used in lists of buildings | ||
74 | 14 | descname = pgettext("barbarians_building", "Market"), | ||
75 | 15 | helptext_script = dirname .. "helptexts.lua", | ||
76 | 16 | icon = dirname .. "menu.png", | ||
77 | 17 | size = "medium", | ||
78 | 18 | |||
79 | 19 | buildcost = { | ||
80 | 20 | log = 8, | ||
81 | 21 | blackwood = 6, | ||
82 | 22 | granite = 4, | ||
83 | 23 | grout = 3, | ||
84 | 24 | iron = 1, | ||
85 | 25 | thatch_reed = 4, | ||
86 | 26 | gold = 2, | ||
87 | 27 | }, | ||
88 | 28 | return_on_dismantle = { | ||
89 | 29 | log = 4, | ||
90 | 30 | blackwood = 3, | ||
91 | 31 | granite = 3, | ||
92 | 32 | grout = 1, | ||
93 | 33 | iron = 1, | ||
94 | 34 | thatch_reed = 2, | ||
95 | 35 | gold = 1, | ||
96 | 36 | }, | ||
97 | 37 | |||
98 | 38 | animations = { | ||
99 | 39 | idle = { | ||
100 | 40 | pictures = path.list_files(dirname .. "idle_??.png"), | ||
101 | 41 | hotspot = { 67, 80 }, | ||
102 | 42 | }, | ||
103 | 43 | build = { | ||
104 | 44 | pictures = path.list_files(dirname .. "build_??.png"), | ||
105 | 45 | hotspot = { 67, 80 }, | ||
106 | 46 | } | ||
107 | 47 | }, | ||
108 | 48 | |||
109 | 49 | aihints = { | ||
110 | 50 | prohibited_till = 1000 | ||
111 | 51 | }, | ||
112 | 52 | |||
113 | 53 | working_positions = { | ||
114 | 54 | barbarians_ox = 10, | ||
115 | 55 | }, | ||
116 | 56 | } | ||
117 | 0 | 57 | ||
118 | === added file 'data/tribes/buildings/markets/barbarians/market/menu.png' | |||
119 | 1 | Binary files data/tribes/buildings/markets/barbarians/market/menu.png 1970-01-01 00:00:00 +0000 and data/tribes/buildings/markets/barbarians/market/menu.png 2017-09-18 07:21:55 +0000 differ | 58 | Binary files data/tribes/buildings/markets/barbarians/market/menu.png 1970-01-01 00:00:00 +0000 and data/tribes/buildings/markets/barbarians/market/menu.png 2017-09-18 07:21:55 +0000 differ |
120 | === modified file 'data/tribes/init.lua' | |||
121 | --- data/tribes/init.lua 2017-02-12 09:10:57 +0000 | |||
122 | +++ data/tribes/init.lua 2017-09-18 07:21:55 +0000 | |||
123 | @@ -290,6 +290,13 @@ | |||
124 | 290 | end) | 290 | end) |
125 | 291 | 291 | ||
126 | 292 | -- =================================== | 292 | -- =================================== |
127 | 293 | -- Markets | ||
128 | 294 | -- =================================== | ||
129 | 295 | |||
130 | 296 | print_loading_message("┃ Markets", function() | ||
131 | 297 | include "tribes/buildings/markets/barbarians/market/init.lua" | ||
132 | 298 | end) | ||
133 | 299 | -- =================================== | ||
134 | 293 | -- Productionsites | 300 | -- Productionsites |
135 | 294 | -- =================================== | 301 | -- =================================== |
136 | 295 | 302 | ||
137 | 296 | 303 | ||
138 | === modified file 'data/tribes/scripting/starting_conditions/barbarians/fortified_village.lua' | |||
139 | --- data/tribes/scripting/starting_conditions/barbarians/fortified_village.lua 2016-12-03 16:37:13 +0000 | |||
140 | +++ data/tribes/scripting/starting_conditions/barbarians/fortified_village.lua 2017-09-18 07:21:55 +0000 | |||
141 | @@ -19,6 +19,7 @@ | |||
142 | 19 | sf = shared_in_start | 19 | sf = shared_in_start |
143 | 20 | else | 20 | else |
144 | 21 | plr:allow_workers("all") | 21 | plr:allow_workers("all") |
145 | 22 | plr:forbid_buildings{"barbarians_market"} | ||
146 | 22 | end | 23 | end |
147 | 23 | 24 | ||
148 | 24 | local h = plr:place_building("barbarians_citadel", sf, false, true) | 25 | local h = plr:place_building("barbarians_citadel", sf, false, true) |
149 | 25 | 26 | ||
150 | === modified file 'data/tribes/scripting/starting_conditions/barbarians/headquarters.lua' | |||
151 | --- data/tribes/scripting/starting_conditions/barbarians/headquarters.lua 2016-03-30 07:23:59 +0000 | |||
152 | +++ data/tribes/scripting/starting_conditions/barbarians/headquarters.lua 2017-09-18 07:21:55 +0000 | |||
153 | @@ -18,6 +18,7 @@ | |||
154 | 18 | sf = shared_in_start | 18 | sf = shared_in_start |
155 | 19 | else | 19 | else |
156 | 20 | player:allow_workers("all") | 20 | player:allow_workers("all") |
157 | 21 | player:forbid_buildings{"barbarians_market"} | ||
158 | 21 | end | 22 | end |
159 | 22 | 23 | ||
160 | 23 | hq = prefilled_buildings(player, { "barbarians_headquarters", sf.x, sf.y, | 24 | hq = prefilled_buildings(player, { "barbarians_headquarters", sf.x, sf.y, |
161 | 24 | 25 | ||
162 | === modified file 'data/tribes/scripting/starting_conditions/barbarians/trading_outpost.lua' | |||
163 | --- data/tribes/scripting/starting_conditions/barbarians/trading_outpost.lua 2016-11-01 13:58:24 +0000 | |||
164 | +++ data/tribes/scripting/starting_conditions/barbarians/trading_outpost.lua 2017-09-18 07:21:55 +0000 | |||
165 | @@ -18,6 +18,7 @@ | |||
166 | 18 | sf = shared_in_start | 18 | sf = shared_in_start |
167 | 19 | else | 19 | else |
168 | 20 | player:allow_workers("all") | 20 | player:allow_workers("all") |
169 | 21 | player:forbid_buildings{"barbarians_market"} | ||
170 | 21 | end | 22 | end |
171 | 22 | 23 | ||
172 | 23 | hq = prefilled_buildings(player, { "barbarians_headquarters", sf.x, sf.y, | 24 | hq = prefilled_buildings(player, { "barbarians_headquarters", sf.x, sf.y, |
173 | 24 | 25 | ||
174 | === modified file 'doc/sphinx/extract_rst.py' | |||
175 | --- doc/sphinx/extract_rst.py 2017-09-01 07:56:47 +0000 | |||
176 | +++ doc/sphinx/extract_rst.py 2017-09-18 07:21:55 +0000 | |||
177 | @@ -44,6 +44,8 @@ | |||
178 | 44 | 'trainingsite', 'lua_tribes_buildings'), | 44 | 'trainingsite', 'lua_tribes_buildings'), |
179 | 45 | ('data/tribes/buildings/warehouses/atlanteans/headquarters', | 45 | ('data/tribes/buildings/warehouses/atlanteans/headquarters', |
180 | 46 | 'warehouse', 'lua_tribes_buildings'), | 46 | 'warehouse', 'lua_tribes_buildings'), |
181 | 47 | ('data/tribes/buildings/markets/barbarians/market', | ||
182 | 48 | 'market', 'lua_tribes_buildings'), | ||
183 | 47 | ('data/tribes/buildings/partially_finished/constructionsite', | 49 | ('data/tribes/buildings/partially_finished/constructionsite', |
184 | 48 | 'constructionsite', 'lua_tribes_buildings'), | 50 | 'constructionsite', 'lua_tribes_buildings'), |
185 | 49 | ('data/tribes/buildings/partially_finished/dismantlesite', | 51 | ('data/tribes/buildings/partially_finished/dismantlesite', |
186 | 50 | 52 | ||
187 | === modified file 'regression_test.py' | |||
188 | --- regression_test.py 2016-08-14 07:59:55 +0000 | |||
189 | +++ regression_test.py 2017-09-18 07:21:55 +0000 | |||
190 | @@ -217,7 +217,7 @@ | |||
191 | 217 | args = parse_args() | 217 | args = parse_args() |
192 | 218 | 218 | ||
193 | 219 | WidelandsTestCase.path_to_widelands_binary = args.binary | 219 | WidelandsTestCase.path_to_widelands_binary = args.binary |
195 | 220 | print("Using '{}' binary.".format(args.binary)) | 220 | print("Using '{}' binary.".format(args.binary)) |
196 | 221 | WidelandsTestCase.do_use_random_directory = not args.nonrandom | 221 | WidelandsTestCase.do_use_random_directory = not args.nonrandom |
197 | 222 | WidelandsTestCase.keep_output_around = args.keep_around | 222 | WidelandsTestCase.keep_output_around = args.keep_around |
198 | 223 | 223 | ||
199 | 224 | 224 | ||
200 | === modified file 'src/logic/CMakeLists.txt' | |||
201 | --- src/logic/CMakeLists.txt 2017-08-11 15:30:42 +0000 | |||
202 | +++ src/logic/CMakeLists.txt 2017-09-18 07:21:55 +0000 | |||
203 | @@ -166,6 +166,8 @@ | |||
204 | 166 | map_objects/tribes/constructionsite.h | 166 | map_objects/tribes/constructionsite.h |
205 | 167 | map_objects/tribes/dismantlesite.cc | 167 | map_objects/tribes/dismantlesite.cc |
206 | 168 | map_objects/tribes/dismantlesite.h | 168 | map_objects/tribes/dismantlesite.h |
207 | 169 | map_objects/tribes/market.cc | ||
208 | 170 | map_objects/tribes/market.h | ||
209 | 169 | map_objects/tribes/militarysite.cc | 171 | map_objects/tribes/militarysite.cc |
210 | 170 | map_objects/tribes/militarysite.h | 172 | map_objects/tribes/militarysite.h |
211 | 171 | map_objects/tribes/partially_finished_building.cc | 173 | map_objects/tribes/partially_finished_building.cc |
212 | 172 | 174 | ||
213 | === modified file 'src/logic/map_objects/map_object.cc' | |||
214 | --- src/logic/map_objects/map_object.cc 2017-08-16 13:23:15 +0000 | |||
215 | +++ src/logic/map_objects/map_object.cc 2017-09-18 07:21:55 +0000 | |||
216 | @@ -653,6 +653,8 @@ | |||
217 | 653 | return "dismantlesite"; | 653 | return "dismantlesite"; |
218 | 654 | case MapObjectType::WAREHOUSE: | 654 | case MapObjectType::WAREHOUSE: |
219 | 655 | return "warehouse"; | 655 | return "warehouse"; |
220 | 656 | case MapObjectType::MARKET: | ||
221 | 657 | return "market"; | ||
222 | 656 | case MapObjectType::PRODUCTIONSITE: | 658 | case MapObjectType::PRODUCTIONSITE: |
223 | 657 | return "productionsite"; | 659 | return "productionsite"; |
224 | 658 | case MapObjectType::MILITARYSITE: | 660 | case MapObjectType::MILITARYSITE: |
225 | 659 | 661 | ||
226 | === modified file 'src/logic/map_objects/map_object.h' | |||
227 | --- src/logic/map_objects/map_object.h 2017-07-03 19:24:02 +0000 | |||
228 | +++ src/logic/map_objects/map_object.h 2017-09-18 07:21:55 +0000 | |||
229 | @@ -82,6 +82,7 @@ | |||
230 | 82 | CONSTRUCTIONSITE, // Building -- Constructionsite | 82 | CONSTRUCTIONSITE, // Building -- Constructionsite |
231 | 83 | DISMANTLESITE, // Building -- Dismantlesite | 83 | DISMANTLESITE, // Building -- Dismantlesite |
232 | 84 | WAREHOUSE, // Building -- Warehouse | 84 | WAREHOUSE, // Building -- Warehouse |
233 | 85 | MARKET, // Building -- Market | ||
234 | 85 | PRODUCTIONSITE, // Building -- Productionsite | 86 | PRODUCTIONSITE, // Building -- Productionsite |
235 | 86 | MILITARYSITE, // Building -- Productionsite -- Militarysite | 87 | MILITARYSITE, // Building -- Productionsite -- Militarysite |
236 | 87 | TRAININGSITE // Building -- Productionsite -- Trainingsite | 88 | TRAININGSITE // Building -- Productionsite -- Trainingsite |
237 | 88 | 89 | ||
238 | === added file 'src/logic/map_objects/tribes/market.cc' | |||
239 | --- src/logic/map_objects/tribes/market.cc 1970-01-01 00:00:00 +0000 | |||
240 | +++ src/logic/map_objects/tribes/market.cc 2017-09-18 07:21:55 +0000 | |||
241 | @@ -0,0 +1,45 @@ | |||
242 | 1 | /* | ||
243 | 2 | * Copyright (C) 2006-2017 by the Widelands Development Team | ||
244 | 3 | * | ||
245 | 4 | * This program is free software; you can redistribute it and/or | ||
246 | 5 | * modify it under the terms of the GNU General Public License | ||
247 | 6 | * as published by the Free Software Foundation; either version 2 | ||
248 | 7 | * of the License, or (at your option) any later version. | ||
249 | 8 | * | ||
250 | 9 | * This program is distributed in the hope that it will be useful, | ||
251 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
252 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
253 | 12 | * GNU General Public License for more details. | ||
254 | 13 | * | ||
255 | 14 | * You should have received a copy of the GNU General Public License | ||
256 | 15 | * along with this program; if not, write to the Free Software | ||
257 | 16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
258 | 17 | * | ||
259 | 18 | */ | ||
260 | 19 | |||
261 | 20 | #include "logic/map_objects/tribes/market.h" | ||
262 | 21 | |||
263 | 22 | #include "base/i18n.h" | ||
264 | 23 | #include "logic/map_objects/tribes/productionsite.h" | ||
265 | 24 | |||
266 | 25 | namespace Widelands { | ||
267 | 26 | |||
268 | 27 | MarketDescr::MarketDescr(const std::string& init_descname, | ||
269 | 28 | const LuaTable& table, | ||
270 | 29 | const EditorGameBase& egbase) | ||
271 | 30 | : BuildingDescr(init_descname, MapObjectType::MARKET, table, egbase) { | ||
272 | 31 | i18n::Textdomain td("tribes"); | ||
273 | 32 | |||
274 | 33 | parse_working_positions(egbase, table.get_table("working_positions").get(), &working_positions_); | ||
275 | 34 | // TODO(sirver,trading): Add actual logic here. | ||
276 | 35 | } | ||
277 | 36 | |||
278 | 37 | Building& MarketDescr::create_object() const { | ||
279 | 38 | return *new Market(*this); | ||
280 | 39 | } | ||
281 | 40 | |||
282 | 41 | Market::Market(const MarketDescr& the_descr) : Building(the_descr) {} | ||
283 | 42 | |||
284 | 43 | Market::~Market() {} | ||
285 | 44 | |||
286 | 45 | } // namespace Widelands | ||
287 | 0 | 46 | ||
288 | === added file 'src/logic/map_objects/tribes/market.h' | |||
289 | --- src/logic/map_objects/tribes/market.h 1970-01-01 00:00:00 +0000 | |||
290 | +++ src/logic/map_objects/tribes/market.h 2017-09-18 07:21:55 +0000 | |||
291 | @@ -0,0 +1,51 @@ | |||
292 | 1 | /* | ||
293 | 2 | * Copyright (C) 2006-2017 by the Widelands Development Team | ||
294 | 3 | * | ||
295 | 4 | * This program is free software; you can redistribute it and/or | ||
296 | 5 | * modify it under the terms of the GNU General Public License | ||
297 | 6 | * as published by the Free Software Foundation; either version 2 | ||
298 | 7 | * of the License, or (at your option) any later version. | ||
299 | 8 | * | ||
300 | 9 | * This program is distributed in the hope that it will be useful, | ||
301 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
302 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
303 | 12 | * GNU General Public License for more details. | ||
304 | 13 | * | ||
305 | 14 | * You should have received a copy of the GNU General Public License | ||
306 | 15 | * along with this program; if not, write to the Free Software | ||
307 | 16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
308 | 17 | * | ||
309 | 18 | */ | ||
310 | 19 | |||
311 | 20 | #ifndef WL_LOGIC_MAP_OBJECTS_TRIBES_MARKET_H | ||
312 | 21 | #define WL_LOGIC_MAP_OBJECTS_TRIBES_MARKET_H | ||
313 | 22 | |||
314 | 23 | #include "logic/map_objects/tribes/building.h" | ||
315 | 24 | |||
316 | 25 | namespace Widelands { | ||
317 | 26 | |||
318 | 27 | class MarketDescr : public BuildingDescr { | ||
319 | 28 | public: | ||
320 | 29 | MarketDescr(const std::string& init_descname, const LuaTable& t, const EditorGameBase& egbase); | ||
321 | 30 | ~MarketDescr() override { | ||
322 | 31 | } | ||
323 | 32 | |||
324 | 33 | Building& create_object() const override; | ||
325 | 34 | |||
326 | 35 | private: | ||
327 | 36 | BillOfMaterials working_positions_; | ||
328 | 37 | }; | ||
329 | 38 | |||
330 | 39 | class Market : public Building { | ||
331 | 40 | MO_DESCR(MarketDescr) | ||
332 | 41 | public: | ||
333 | 42 | explicit Market(const MarketDescr& descr); | ||
334 | 43 | ~Market() override; | ||
335 | 44 | |||
336 | 45 | private: | ||
337 | 46 | DISALLOW_COPY_AND_ASSIGN(Market); | ||
338 | 47 | }; | ||
339 | 48 | |||
340 | 49 | } // namespace Widelands | ||
341 | 50 | |||
342 | 51 | #endif // end of include guard: WL_LOGIC_MAP_OBJECTS_TRIBES_MARKET_H | ||
343 | 0 | 52 | ||
344 | === modified file 'src/logic/map_objects/tribes/productionsite.cc' | |||
345 | --- src/logic/map_objects/tribes/productionsite.cc 2017-08-16 04:31:56 +0000 | |||
346 | +++ src/logic/map_objects/tribes/productionsite.cc 2017-09-18 07:21:55 +0000 | |||
347 | @@ -45,7 +45,31 @@ | |||
348 | 45 | 45 | ||
349 | 46 | namespace Widelands { | 46 | namespace Widelands { |
350 | 47 | 47 | ||
352 | 48 | static const size_t STATISTICS_VECTOR_LENGTH = 20; | 48 | namespace { |
353 | 49 | |||
354 | 50 | constexpr size_t STATISTICS_VECTOR_LENGTH = 20; | ||
355 | 51 | |||
356 | 52 | } // namespace | ||
357 | 53 | |||
358 | 54 | void parse_working_positions(const EditorGameBase& egbase, | ||
359 | 55 | LuaTable* items_table, | ||
360 | 56 | BillOfMaterials* working_positions) { | ||
361 | 57 | for (const std::string& worker_name : items_table->keys<std::string>()) { | ||
362 | 58 | int amount = items_table->get_int(worker_name); | ||
363 | 59 | try { | ||
364 | 60 | if (amount < 1 || 255 < amount) { | ||
365 | 61 | throw wexception("count is out of range 1 .. 255"); | ||
366 | 62 | } | ||
367 | 63 | DescriptionIndex const woi = egbase.tribes().worker_index(worker_name); | ||
368 | 64 | if (!egbase.tribes().worker_exists(woi)) { | ||
369 | 65 | throw wexception("invalid"); | ||
370 | 66 | } | ||
371 | 67 | working_positions->push_back(std::pair<DescriptionIndex, uint32_t>(woi, amount)); | ||
372 | 68 | } catch (const WException& e) { | ||
373 | 69 | throw wexception("%s=\"%d\": %s", worker_name.c_str(), amount, e.what()); | ||
374 | 70 | } | ||
375 | 71 | } | ||
376 | 72 | } | ||
377 | 49 | 73 | ||
378 | 50 | /* | 74 | /* |
379 | 51 | ============================================================================== | 75 | ============================================================================== |
380 | @@ -146,28 +170,7 @@ | |||
381 | 146 | } | 170 | } |
382 | 147 | } | 171 | } |
383 | 148 | 172 | ||
406 | 149 | items_table = table.get_table("working_positions"); | 173 | parse_working_positions(egbase, table.get_table("working_positions").get(), &working_positions_); |
385 | 150 | for (const std::string& worker_name : items_table->keys<std::string>()) { | ||
386 | 151 | int amount = items_table->get_int(worker_name); | ||
387 | 152 | try { | ||
388 | 153 | if (amount < 1 || 255 < amount) { | ||
389 | 154 | throw wexception("count is out of range 1 .. 255"); | ||
390 | 155 | } | ||
391 | 156 | DescriptionIndex const woi = egbase.tribes().worker_index(worker_name); | ||
392 | 157 | if (egbase.tribes().worker_exists(woi)) { | ||
393 | 158 | for (const auto& wp : working_positions()) { | ||
394 | 159 | if (wp.first == woi) { | ||
395 | 160 | throw wexception("duplicated"); | ||
396 | 161 | } | ||
397 | 162 | } | ||
398 | 163 | working_positions_.push_back(std::pair<DescriptionIndex, uint32_t>(woi, amount)); | ||
399 | 164 | } else { | ||
400 | 165 | throw wexception("invalid"); | ||
401 | 166 | } | ||
402 | 167 | } catch (const WException& e) { | ||
403 | 168 | throw wexception("%s=\"%d\": %s", worker_name.c_str(), amount, e.what()); | ||
404 | 169 | } | ||
405 | 170 | } | ||
407 | 171 | 174 | ||
408 | 172 | // Get programs | 175 | // Get programs |
409 | 173 | items_table = table.get_table("programs"); | 176 | items_table = table.get_table("programs"); |
410 | 174 | 177 | ||
411 | === modified file 'src/logic/map_objects/tribes/productionsite.h' | |||
412 | --- src/logic/map_objects/tribes/productionsite.h 2017-06-24 08:47:46 +0000 | |||
413 | +++ src/logic/map_objects/tribes/productionsite.h 2017-09-18 07:21:55 +0000 | |||
414 | @@ -374,6 +374,15 @@ | |||
415 | 374 | : ps(init_ps), player(init_player) { | 374 | : ps(init_ps), player(init_player) { |
416 | 375 | } | 375 | } |
417 | 376 | }; | 376 | }; |
419 | 377 | } | 377 | |
420 | 378 | // Parses the descriptions of the working positions from 'items_table' and | ||
421 | 379 | // fills in 'working_positions'. Throws an error if the table contains invalid | ||
422 | 380 | // values. | ||
423 | 381 | void parse_working_positions(const EditorGameBase& egbase, | ||
424 | 382 | LuaTable* items_table, | ||
425 | 383 | BillOfMaterials* working_positions); | ||
426 | 384 | |||
427 | 385 | } // namespace Widelands | ||
428 | 386 | |||
429 | 378 | 387 | ||
430 | 379 | #endif // end of include guard: WL_LOGIC_MAP_OBJECTS_TRIBES_PRODUCTIONSITE_H | 388 | #endif // end of include guard: WL_LOGIC_MAP_OBJECTS_TRIBES_PRODUCTIONSITE_H |
431 | 380 | 389 | ||
432 | === modified file 'src/logic/map_objects/tribes/tribes.cc' | |||
433 | --- src/logic/map_objects/tribes/tribes.cc 2017-03-23 07:36:36 +0000 | |||
434 | +++ src/logic/map_objects/tribes/tribes.cc 2017-09-18 07:21:55 +0000 | |||
435 | @@ -121,6 +121,13 @@ | |||
436 | 121 | table, egbase)); | 121 | table, egbase)); |
437 | 122 | } | 122 | } |
438 | 123 | 123 | ||
439 | 124 | void Tribes::add_market_type(const LuaTable& table, const EditorGameBase& egbase) { | ||
440 | 125 | i18n::Textdomain td("tribes"); | ||
441 | 126 | buildings_->add(new MarketDescr( | ||
442 | 127 | pgettext_expr(table.get_string("msgctxt").c_str(), table.get_string("descname").c_str()), | ||
443 | 128 | table, egbase)); | ||
444 | 129 | } | ||
445 | 130 | |||
446 | 124 | void Tribes::add_immovable_type(const LuaTable& table) { | 131 | void Tribes::add_immovable_type(const LuaTable& table) { |
447 | 125 | i18n::Textdomain td("tribes"); | 132 | i18n::Textdomain td("tribes"); |
448 | 126 | immovables_->add(new ImmovableDescr( | 133 | immovables_->add(new ImmovableDescr( |
449 | 127 | 134 | ||
450 | === modified file 'src/logic/map_objects/tribes/tribes.h' | |||
451 | --- src/logic/map_objects/tribes/tribes.h 2017-03-23 07:36:36 +0000 | |||
452 | +++ src/logic/map_objects/tribes/tribes.h 2017-09-18 07:21:55 +0000 | |||
453 | @@ -38,6 +38,7 @@ | |||
454 | 38 | #include "logic/map_objects/tribes/tribe_descr.h" | 38 | #include "logic/map_objects/tribes/tribe_descr.h" |
455 | 39 | #include "logic/map_objects/tribes/ware_descr.h" | 39 | #include "logic/map_objects/tribes/ware_descr.h" |
456 | 40 | #include "logic/map_objects/tribes/warehouse.h" | 40 | #include "logic/map_objects/tribes/warehouse.h" |
457 | 41 | #include "logic/map_objects/tribes/market.h" | ||
458 | 41 | #include "logic/map_objects/tribes/worker_descr.h" | 42 | #include "logic/map_objects/tribes/worker_descr.h" |
459 | 42 | #include "scripting/lua_table.h" | 43 | #include "scripting/lua_table.h" |
460 | 43 | 44 | ||
461 | @@ -82,6 +83,9 @@ | |||
462 | 82 | /// Adds this building type to the tribe description. | 83 | /// Adds this building type to the tribe description. |
463 | 83 | void add_warehouse_type(const LuaTable& table, const EditorGameBase& egbase); | 84 | void add_warehouse_type(const LuaTable& table, const EditorGameBase& egbase); |
464 | 84 | 85 | ||
465 | 86 | /// Adds this building type to the tribe description. | ||
466 | 87 | void add_market_type(const LuaTable& table, const EditorGameBase& egbase); | ||
467 | 88 | |||
468 | 85 | /// Adds this immovable type to the tribe description. | 89 | /// Adds this immovable type to the tribe description. |
469 | 86 | void add_immovable_type(const LuaTable& table); | 90 | void add_immovable_type(const LuaTable& table); |
470 | 87 | 91 | ||
471 | 88 | 92 | ||
472 | === modified file 'src/scripting/lua_map.cc' | |||
473 | --- src/scripting/lua_map.cc 2017-09-03 13:03:56 +0000 | |||
474 | +++ src/scripting/lua_map.cc 2017-09-18 07:21:55 +0000 | |||
475 | @@ -618,6 +618,8 @@ | |||
476 | 618 | return CAST_TO_LUA(MilitarySiteDescr, LuaMilitarySiteDescription); | 618 | return CAST_TO_LUA(MilitarySiteDescr, LuaMilitarySiteDescription); |
477 | 619 | case MapObjectType::WAREHOUSE: | 619 | case MapObjectType::WAREHOUSE: |
478 | 620 | return CAST_TO_LUA(WarehouseDescr, LuaWarehouseDescription); | 620 | return CAST_TO_LUA(WarehouseDescr, LuaWarehouseDescription); |
479 | 621 | case MapObjectType::MARKET: | ||
480 | 622 | return CAST_TO_LUA(MarketDescr, LuaMarketDescription); | ||
481 | 621 | case MapObjectType::TRAININGSITE: | 623 | case MapObjectType::TRAININGSITE: |
482 | 622 | return CAST_TO_LUA(TrainingSiteDescr, LuaTrainingSiteDescription); | 624 | return CAST_TO_LUA(TrainingSiteDescr, LuaTrainingSiteDescription); |
483 | 623 | default: | 625 | default: |
484 | @@ -684,17 +686,19 @@ | |||
485 | 684 | return CAST_TO_LUA(Building); | 686 | return CAST_TO_LUA(Building); |
486 | 685 | case MapObjectType::WAREHOUSE: | 687 | case MapObjectType::WAREHOUSE: |
487 | 686 | return CAST_TO_LUA(Warehouse); | 688 | return CAST_TO_LUA(Warehouse); |
488 | 689 | case MapObjectType::MARKET: | ||
489 | 690 | return CAST_TO_LUA(Market); | ||
490 | 687 | case MapObjectType::PRODUCTIONSITE: | 691 | case MapObjectType::PRODUCTIONSITE: |
491 | 688 | return CAST_TO_LUA(ProductionSite); | 692 | return CAST_TO_LUA(ProductionSite); |
492 | 689 | case MapObjectType::MILITARYSITE: | 693 | case MapObjectType::MILITARYSITE: |
493 | 690 | return CAST_TO_LUA(MilitarySite); | 694 | return CAST_TO_LUA(MilitarySite); |
494 | 691 | case MapObjectType::TRAININGSITE: | 695 | case MapObjectType::TRAININGSITE: |
495 | 692 | return CAST_TO_LUA(TrainingSite); | 696 | return CAST_TO_LUA(TrainingSite); |
501 | 693 | case (MapObjectType::MAPOBJECT): | 697 | case MapObjectType::MAPOBJECT: |
502 | 694 | case (MapObjectType::BATTLE): | 698 | case MapObjectType::BATTLE: |
503 | 695 | case (MapObjectType::BOB): | 699 | case MapObjectType::BOB: |
504 | 696 | case (MapObjectType::FLEET): | 700 | case MapObjectType::FLEET: |
505 | 697 | case (MapObjectType::WARE): | 701 | case MapObjectType::WARE: |
506 | 698 | throw LuaError((boost::format("upcasted_map_object_to_lua: Unknown %i") % | 702 | throw LuaError((boost::format("upcasted_map_object_to_lua: Unknown %i") % |
507 | 699 | static_cast<int>(mo->descr().type())) | 703 | static_cast<int>(mo->descr().type())) |
508 | 700 | .str()); | 704 | .str()); |
509 | @@ -2746,6 +2750,33 @@ | |||
510 | 2746 | } | 2750 | } |
511 | 2747 | 2751 | ||
512 | 2748 | /* RST | 2752 | /* RST |
513 | 2753 | MarketDescription | ||
514 | 2754 | ----------------- | ||
515 | 2755 | |||
516 | 2756 | .. class:: MarketDescription | ||
517 | 2757 | |||
518 | 2758 | Child of: :class:`MapObjectDescription`, :class:`ImmovableDescription`, :class:`BuildingDescription` | ||
519 | 2759 | |||
520 | 2760 | A static description of a tribe's market, so it can be used in help files | ||
521 | 2761 | without having to access an actual building on the map. A Market is used for | ||
522 | 2762 | trading over land with other players. See the parent classes for more | ||
523 | 2763 | properties. | ||
524 | 2764 | */ | ||
525 | 2765 | const char LuaMarketDescription::className[] = "MarketDescription"; | ||
526 | 2766 | const MethodType<LuaMarketDescription> LuaMarketDescription::Methods[] = { | ||
527 | 2767 | {nullptr, nullptr}, | ||
528 | 2768 | }; | ||
529 | 2769 | const PropertyType<LuaMarketDescription> LuaMarketDescription::Properties[] = { | ||
530 | 2770 | {nullptr, nullptr, nullptr}, | ||
531 | 2771 | }; | ||
532 | 2772 | |||
533 | 2773 | /* | ||
534 | 2774 | ========================================================== | ||
535 | 2775 | PROPERTIES | ||
536 | 2776 | ========================================================== | ||
537 | 2777 | */ | ||
538 | 2778 | |||
539 | 2779 | /* RST | ||
540 | 2749 | WareDescription | 2780 | WareDescription |
541 | 2750 | --------------- | 2781 | --------------- |
542 | 2751 | 2782 | ||
543 | @@ -3664,36 +3695,38 @@ | |||
544 | 3664 | assert(desc != nullptr); | 3695 | assert(desc != nullptr); |
545 | 3665 | 3696 | ||
546 | 3666 | switch (desc->type()) { | 3697 | switch (desc->type()) { |
548 | 3667 | case (MapObjectType::BUILDING): | 3698 | case MapObjectType::BUILDING: |
549 | 3668 | return CAST_TO_LUA(BuildingDescr, LuaBuildingDescription); | 3699 | return CAST_TO_LUA(BuildingDescr, LuaBuildingDescription); |
551 | 3669 | case (MapObjectType::CONSTRUCTIONSITE): | 3700 | case MapObjectType::CONSTRUCTIONSITE: |
552 | 3670 | return CAST_TO_LUA(ConstructionSiteDescr, LuaConstructionSiteDescription); | 3701 | return CAST_TO_LUA(ConstructionSiteDescr, LuaConstructionSiteDescription); |
554 | 3671 | case (MapObjectType::DISMANTLESITE): | 3702 | case MapObjectType::DISMANTLESITE: |
555 | 3672 | return CAST_TO_LUA(DismantleSiteDescr, LuaDismantleSiteDescription); | 3703 | return CAST_TO_LUA(DismantleSiteDescr, LuaDismantleSiteDescription); |
557 | 3673 | case (MapObjectType::PRODUCTIONSITE): | 3704 | case MapObjectType::PRODUCTIONSITE: |
558 | 3674 | return CAST_TO_LUA(ProductionSiteDescr, LuaProductionSiteDescription); | 3705 | return CAST_TO_LUA(ProductionSiteDescr, LuaProductionSiteDescription); |
560 | 3675 | case (MapObjectType::MILITARYSITE): | 3706 | case MapObjectType::MILITARYSITE: |
561 | 3676 | return CAST_TO_LUA(MilitarySiteDescr, LuaMilitarySiteDescription); | 3707 | return CAST_TO_LUA(MilitarySiteDescr, LuaMilitarySiteDescription); |
563 | 3677 | case (MapObjectType::TRAININGSITE): | 3708 | case MapObjectType::TRAININGSITE: |
564 | 3678 | return CAST_TO_LUA(TrainingSiteDescr, LuaTrainingSiteDescription); | 3709 | return CAST_TO_LUA(TrainingSiteDescr, LuaTrainingSiteDescription); |
566 | 3679 | case (MapObjectType::WAREHOUSE): | 3710 | case MapObjectType::WAREHOUSE: |
567 | 3680 | return CAST_TO_LUA(WarehouseDescr, LuaWarehouseDescription); | 3711 | return CAST_TO_LUA(WarehouseDescr, LuaWarehouseDescription); |
569 | 3681 | case (MapObjectType::IMMOVABLE): | 3712 | case MapObjectType::MARKET: |
570 | 3713 | return CAST_TO_LUA(MarketDescr, LuaMarketDescription); | ||
571 | 3714 | case MapObjectType::IMMOVABLE: | ||
572 | 3682 | return CAST_TO_LUA(ImmovableDescr, LuaImmovableDescription); | 3715 | return CAST_TO_LUA(ImmovableDescr, LuaImmovableDescription); |
576 | 3683 | case (MapObjectType::WORKER): | 3716 | case MapObjectType::WORKER: |
577 | 3684 | case (MapObjectType::CARRIER): | 3717 | case MapObjectType::CARRIER: |
578 | 3685 | case (MapObjectType::SOLDIER): | 3718 | case MapObjectType::SOLDIER: |
579 | 3686 | return CAST_TO_LUA(WorkerDescr, LuaWorkerDescription); | 3719 | return CAST_TO_LUA(WorkerDescr, LuaWorkerDescription); |
590 | 3687 | case (MapObjectType::MAPOBJECT): | 3720 | case MapObjectType::MAPOBJECT: |
591 | 3688 | case (MapObjectType::BATTLE): | 3721 | case MapObjectType::BATTLE: |
592 | 3689 | case (MapObjectType::BOB): | 3722 | case MapObjectType::BOB: |
593 | 3690 | case (MapObjectType::CRITTER): | 3723 | case MapObjectType::CRITTER: |
594 | 3691 | case (MapObjectType::FLEET): | 3724 | case MapObjectType::FLEET: |
595 | 3692 | case (MapObjectType::SHIP): | 3725 | case MapObjectType::SHIP: |
596 | 3693 | case (MapObjectType::FLAG): | 3726 | case MapObjectType::FLAG: |
597 | 3694 | case (MapObjectType::ROAD): | 3727 | case MapObjectType::ROAD: |
598 | 3695 | case (MapObjectType::PORTDOCK): | 3728 | case MapObjectType::PORTDOCK: |
599 | 3696 | case (MapObjectType::WARE): | 3729 | case MapObjectType::WARE: |
600 | 3697 | return CAST_TO_LUA(MapObjectDescr, LuaMapObjectDescription); | 3730 | return CAST_TO_LUA(MapObjectDescr, LuaMapObjectDescription); |
601 | 3698 | } | 3731 | } |
602 | 3699 | NEVER_HERE(); | 3732 | NEVER_HERE(); |
603 | @@ -5036,6 +5069,51 @@ | |||
604 | 5036 | } | 5069 | } |
605 | 5037 | 5070 | ||
606 | 5038 | /* RST | 5071 | /* RST |
607 | 5072 | Market | ||
608 | 5073 | --------- | ||
609 | 5074 | |||
610 | 5075 | .. class:: Market | ||
611 | 5076 | |||
612 | 5077 | Child of: :class:`Building`, :class:`HasWares`, :class:`HasWorkers` | ||
613 | 5078 | |||
614 | 5079 | A Market used for trading with other players. | ||
615 | 5080 | |||
616 | 5081 | More properties are available through this object's | ||
617 | 5082 | :class:`MarketDescription`, which you can access via :any:`MapObject.descr`. | ||
618 | 5083 | */ | ||
619 | 5084 | const char LuaMarket::className[] = "Market"; | ||
620 | 5085 | const MethodType<LuaMarket> LuaMarket::Methods[] = { | ||
621 | 5086 | // TODO(sirver,trading): Implement and fix documentation. | ||
622 | 5087 | // METHOD(LuaMarket, set_wares), | ||
623 | 5088 | // METHOD(LuaMarket, get_wares), | ||
624 | 5089 | // METHOD(LuaMarket, set_workers), | ||
625 | 5090 | // METHOD(LuaMarket, get_workers), | ||
626 | 5091 | {nullptr, nullptr}, | ||
627 | 5092 | }; | ||
628 | 5093 | const PropertyType<LuaMarket> LuaMarket::Properties[] = { | ||
629 | 5094 | {nullptr, nullptr, nullptr}, | ||
630 | 5095 | }; | ||
631 | 5096 | |||
632 | 5097 | /* | ||
633 | 5098 | ========================================================== | ||
634 | 5099 | PROPERTIES | ||
635 | 5100 | ========================================================== | ||
636 | 5101 | */ | ||
637 | 5102 | |||
638 | 5103 | /* | ||
639 | 5104 | ========================================================== | ||
640 | 5105 | LUA METHODS | ||
641 | 5106 | ========================================================== | ||
642 | 5107 | */ | ||
643 | 5108 | |||
644 | 5109 | /* | ||
645 | 5110 | ========================================================== | ||
646 | 5111 | C METHODS | ||
647 | 5112 | ========================================================== | ||
648 | 5113 | */ | ||
649 | 5114 | |||
650 | 5115 | |||
651 | 5116 | /* RST | ||
652 | 5039 | MilitarySite | 5117 | MilitarySite |
653 | 5040 | -------------- | 5118 | -------------- |
654 | 5041 | 5119 | ||
655 | @@ -6362,6 +6440,11 @@ | |||
656 | 6362 | add_parent<LuaWarehouseDescription, LuaMapObjectDescription>(L); | 6440 | add_parent<LuaWarehouseDescription, LuaMapObjectDescription>(L); |
657 | 6363 | lua_pop(L, 1); // Pop the meta table | 6441 | lua_pop(L, 1); // Pop the meta table |
658 | 6364 | 6442 | ||
659 | 6443 | register_class<LuaMarketDescription>(L, "map", true); | ||
660 | 6444 | add_parent<LuaMarketDescription, LuaBuildingDescription>(L); | ||
661 | 6445 | add_parent<LuaMarketDescription, LuaMapObjectDescription>(L); | ||
662 | 6446 | lua_pop(L, 1); // Pop the meta table | ||
663 | 6447 | |||
664 | 6365 | register_class<LuaWareDescription>(L, "map", true); | 6448 | register_class<LuaWareDescription>(L, "map", true); |
665 | 6366 | add_parent<LuaWareDescription, LuaMapObjectDescription>(L); | 6449 | add_parent<LuaWareDescription, LuaMapObjectDescription>(L); |
666 | 6367 | lua_pop(L, 1); // Pop the meta table | 6450 | lua_pop(L, 1); // Pop the meta table |
667 | @@ -6450,6 +6533,13 @@ | |||
668 | 6450 | add_parent<LuaWarehouse, LuaMapObject>(L); | 6533 | add_parent<LuaWarehouse, LuaMapObject>(L); |
669 | 6451 | lua_pop(L, 1); // Pop the meta table | 6534 | lua_pop(L, 1); // Pop the meta table |
670 | 6452 | 6535 | ||
671 | 6536 | register_class<LuaMarket>(L, "map", true); | ||
672 | 6537 | add_parent<LuaMarket, LuaBuilding>(L); | ||
673 | 6538 | add_parent<LuaMarket, LuaPlayerImmovable>(L); | ||
674 | 6539 | add_parent<LuaMarket, LuaBaseImmovable>(L); | ||
675 | 6540 | add_parent<LuaMarket, LuaMapObject>(L); | ||
676 | 6541 | lua_pop(L, 1); // Pop the meta table | ||
677 | 6542 | |||
678 | 6453 | register_class<LuaProductionSite>(L, "map", true); | 6543 | register_class<LuaProductionSite>(L, "map", true); |
679 | 6454 | add_parent<LuaProductionSite, LuaBuilding>(L); | 6544 | add_parent<LuaProductionSite, LuaBuilding>(L); |
680 | 6455 | add_parent<LuaProductionSite, LuaPlayerImmovable>(L); | 6545 | add_parent<LuaProductionSite, LuaPlayerImmovable>(L); |
681 | 6456 | 6546 | ||
682 | === modified file 'src/scripting/lua_map.h' | |||
683 | --- src/scripting/lua_map.h 2017-06-25 19:12:30 +0000 | |||
684 | +++ src/scripting/lua_map.h 2017-09-18 07:21:55 +0000 | |||
685 | @@ -502,6 +502,37 @@ | |||
686 | 502 | CASTED_GET_DESCRIPTION(WarehouseDescr) | 502 | CASTED_GET_DESCRIPTION(WarehouseDescr) |
687 | 503 | }; | 503 | }; |
688 | 504 | 504 | ||
689 | 505 | class LuaMarketDescription : public LuaBuildingDescription { | ||
690 | 506 | public: | ||
691 | 507 | LUNA_CLASS_HEAD(LuaMarketDescription); | ||
692 | 508 | |||
693 | 509 | virtual ~LuaMarketDescription() { | ||
694 | 510 | } | ||
695 | 511 | |||
696 | 512 | LuaMarketDescription() { | ||
697 | 513 | } | ||
698 | 514 | explicit LuaMarketDescription(const Widelands::MarketDescr* const warehousedescr) | ||
699 | 515 | : LuaBuildingDescription(warehousedescr) { | ||
700 | 516 | } | ||
701 | 517 | explicit LuaMarketDescription(lua_State* L) : LuaBuildingDescription(L) { | ||
702 | 518 | } | ||
703 | 519 | |||
704 | 520 | /* | ||
705 | 521 | * Properties | ||
706 | 522 | */ | ||
707 | 523 | |||
708 | 524 | /* | ||
709 | 525 | * Lua methods | ||
710 | 526 | */ | ||
711 | 527 | |||
712 | 528 | /* | ||
713 | 529 | * C methods | ||
714 | 530 | */ | ||
715 | 531 | |||
716 | 532 | private: | ||
717 | 533 | CASTED_GET_DESCRIPTION(MarketDescr) | ||
718 | 534 | }; | ||
719 | 535 | |||
720 | 505 | class LuaWareDescription : public LuaMapObjectDescription { | 536 | class LuaWareDescription : public LuaMapObjectDescription { |
721 | 506 | public: | 537 | public: |
722 | 507 | LUNA_CLASS_HEAD(LuaWareDescription); | 538 | LUNA_CLASS_HEAD(LuaWareDescription); |
723 | @@ -1075,6 +1106,33 @@ | |||
724 | 1075 | CASTED_GET(Warehouse) | 1106 | CASTED_GET(Warehouse) |
725 | 1076 | }; | 1107 | }; |
726 | 1077 | 1108 | ||
727 | 1109 | class LuaMarket : public LuaBuilding { | ||
728 | 1110 | public: | ||
729 | 1111 | LUNA_CLASS_HEAD(LuaMarket); | ||
730 | 1112 | |||
731 | 1113 | LuaMarket() { | ||
732 | 1114 | } | ||
733 | 1115 | explicit LuaMarket(Widelands::Market& mo) : LuaBuilding(mo) { | ||
734 | 1116 | } | ||
735 | 1117 | explicit LuaMarket(lua_State* L) : LuaBuilding(L) { | ||
736 | 1118 | } | ||
737 | 1119 | virtual ~LuaMarket() { | ||
738 | 1120 | } | ||
739 | 1121 | |||
740 | 1122 | /* | ||
741 | 1123 | * Properties | ||
742 | 1124 | */ | ||
743 | 1125 | |||
744 | 1126 | /* | ||
745 | 1127 | * Lua Methods | ||
746 | 1128 | */ | ||
747 | 1129 | |||
748 | 1130 | /* | ||
749 | 1131 | * C Methods | ||
750 | 1132 | */ | ||
751 | 1133 | CASTED_GET(Market) | ||
752 | 1134 | }; | ||
753 | 1135 | |||
754 | 1078 | class LuaProductionSite : public LuaBuilding { | 1136 | class LuaProductionSite : public LuaBuilding { |
755 | 1079 | public: | 1137 | public: |
756 | 1080 | LUNA_CLASS_HEAD(LuaProductionSite); | 1138 | LUNA_CLASS_HEAD(LuaProductionSite); |
757 | 1081 | 1139 | ||
758 | === modified file 'src/scripting/lua_root.cc' | |||
759 | --- src/scripting/lua_root.cc 2017-09-03 10:13:32 +0000 | |||
760 | +++ src/scripting/lua_root.cc 2017-09-18 07:21:55 +0000 | |||
761 | @@ -503,19 +503,20 @@ | |||
762 | 503 | 503 | ||
763 | 504 | const char LuaTribes::className[] = "Tribes"; | 504 | const char LuaTribes::className[] = "Tribes"; |
764 | 505 | const MethodType<LuaTribes> LuaTribes::Methods[] = { | 505 | const MethodType<LuaTribes> LuaTribes::Methods[] = { |
765 | 506 | METHOD(LuaTribes, new_carrier_type), | ||
766 | 506 | METHOD(LuaTribes, new_constructionsite_type), | 507 | METHOD(LuaTribes, new_constructionsite_type), |
767 | 507 | METHOD(LuaTribes, new_dismantlesite_type), | 508 | METHOD(LuaTribes, new_dismantlesite_type), |
768 | 509 | METHOD(LuaTribes, new_immovable_type), | ||
769 | 510 | METHOD(LuaTribes, new_market_type), | ||
770 | 508 | METHOD(LuaTribes, new_militarysite_type), | 511 | METHOD(LuaTribes, new_militarysite_type), |
771 | 509 | METHOD(LuaTribes, new_productionsite_type), | 512 | METHOD(LuaTribes, new_productionsite_type), |
772 | 513 | METHOD(LuaTribes, new_ship_type), | ||
773 | 514 | METHOD(LuaTribes, new_soldier_type), | ||
774 | 510 | METHOD(LuaTribes, new_trainingsite_type), | 515 | METHOD(LuaTribes, new_trainingsite_type), |
775 | 516 | METHOD(LuaTribes, new_tribe), | ||
776 | 517 | METHOD(LuaTribes, new_ware_type), | ||
777 | 511 | METHOD(LuaTribes, new_warehouse_type), | 518 | METHOD(LuaTribes, new_warehouse_type), |
778 | 512 | METHOD(LuaTribes, new_immovable_type), | ||
779 | 513 | METHOD(LuaTribes, new_ship_type), | ||
780 | 514 | METHOD(LuaTribes, new_ware_type), | ||
781 | 515 | METHOD(LuaTribes, new_carrier_type), | ||
782 | 516 | METHOD(LuaTribes, new_soldier_type), | ||
783 | 517 | METHOD(LuaTribes, new_worker_type), | 519 | METHOD(LuaTribes, new_worker_type), |
784 | 518 | METHOD(LuaTribes, new_tribe), | ||
785 | 519 | {0, 0}, | 520 | {0, 0}, |
786 | 520 | }; | 521 | }; |
787 | 521 | const PropertyType<LuaTribes> LuaTribes::Properties[] = { | 522 | const PropertyType<LuaTribes> LuaTribes::Properties[] = { |
788 | @@ -691,6 +692,30 @@ | |||
789 | 691 | } | 692 | } |
790 | 692 | 693 | ||
791 | 693 | /* RST | 694 | /* RST |
792 | 695 | .. method:: new_market_type{table} | ||
793 | 696 | |||
794 | 697 | Adds a new market building type. Takes a single argument, a table with | ||
795 | 698 | the descriptions. See :ref:`lua_tribes_buildings_markets` for detailed | ||
796 | 699 | documentation. | ||
797 | 700 | |||
798 | 701 | :returns: :const:`0` | ||
799 | 702 | */ | ||
800 | 703 | int LuaTribes::new_market_type(lua_State* L) { | ||
801 | 704 | if (lua_gettop(L) != 2) { | ||
802 | 705 | report_error(L, "Takes only one argument."); | ||
803 | 706 | } | ||
804 | 707 | |||
805 | 708 | try { | ||
806 | 709 | LuaTable table(L); // Will pop the table eventually. | ||
807 | 710 | EditorGameBase& egbase = get_egbase(L); | ||
808 | 711 | egbase.mutable_tribes()->add_market_type(table, egbase); | ||
809 | 712 | } catch (std::exception& e) { | ||
810 | 713 | report_error(L, "%s", e.what()); | ||
811 | 714 | } | ||
812 | 715 | return 0; | ||
813 | 716 | } | ||
814 | 717 | |||
815 | 718 | /* RST | ||
816 | 694 | .. method:: new_immovable_type{table} | 719 | .. method:: new_immovable_type{table} |
817 | 695 | 720 | ||
818 | 696 | Adds a new immovable type. Takes a single argument, a table with | 721 | Adds a new immovable type. Takes a single argument, a table with |
819 | 697 | 722 | ||
820 | === modified file 'src/scripting/lua_root.h' | |||
821 | --- src/scripting/lua_root.h 2017-06-24 08:47:46 +0000 | |||
822 | +++ src/scripting/lua_root.h 2017-09-18 07:21:55 +0000 | |||
823 | @@ -159,19 +159,20 @@ | |||
824 | 159 | /* | 159 | /* |
825 | 160 | * Lua methods | 160 | * Lua methods |
826 | 161 | */ | 161 | */ |
827 | 162 | int new_carrier_type(lua_State* L); | ||
828 | 162 | int new_constructionsite_type(lua_State* L); | 163 | int new_constructionsite_type(lua_State* L); |
829 | 163 | int new_dismantlesite_type(lua_State* L); | 164 | int new_dismantlesite_type(lua_State* L); |
830 | 165 | int new_immovable_type(lua_State* L); | ||
831 | 166 | int new_market_type(lua_State* L); | ||
832 | 164 | int new_militarysite_type(lua_State* L); | 167 | int new_militarysite_type(lua_State* L); |
833 | 165 | int new_productionsite_type(lua_State* L); | 168 | int new_productionsite_type(lua_State* L); |
834 | 169 | int new_ship_type(lua_State* L); | ||
835 | 170 | int new_soldier_type(lua_State* L); | ||
836 | 166 | int new_trainingsite_type(lua_State* L); | 171 | int new_trainingsite_type(lua_State* L); |
837 | 172 | int new_tribe(lua_State* L); | ||
838 | 173 | int new_ware_type(lua_State* L); | ||
839 | 167 | int new_warehouse_type(lua_State* L); | 174 | int new_warehouse_type(lua_State* L); |
840 | 168 | int new_immovable_type(lua_State* L); | ||
841 | 169 | int new_ship_type(lua_State* L); | ||
842 | 170 | int new_ware_type(lua_State* L); | ||
843 | 171 | int new_carrier_type(lua_State* L); | ||
844 | 172 | int new_soldier_type(lua_State* L); | ||
845 | 173 | int new_worker_type(lua_State* L); | 175 | int new_worker_type(lua_State* L); |
846 | 174 | int new_tribe(lua_State* L); | ||
847 | 175 | 176 | ||
848 | 176 | /* | 177 | /* |
849 | 177 | * C methods | 178 | * C methods |
850 | 178 | 179 | ||
851 | === modified file 'src/website/map_object_info.cc' | |||
852 | --- src/website/map_object_info.cc 2017-01-30 14:40:12 +0000 | |||
853 | +++ src/website/map_object_info.cc 2017-09-18 07:21:55 +0000 | |||
854 | @@ -301,6 +301,9 @@ | |||
855 | 301 | case MapObjectType::WAREHOUSE: | 301 | case MapObjectType::WAREHOUSE: |
856 | 302 | fw.write_key_value_string("type", "warehouse"); | 302 | fw.write_key_value_string("type", "warehouse"); |
857 | 303 | break; | 303 | break; |
858 | 304 | case MapObjectType::MARKET: | ||
859 | 305 | fw.write_key_value_string("type", "market"); | ||
860 | 306 | break; | ||
861 | 304 | case MapObjectType::MILITARYSITE: | 307 | case MapObjectType::MILITARYSITE: |
862 | 305 | fw.write_key_value_string("type", "militarysite"); | 308 | fw.write_key_value_string("type", "militarysite"); |
863 | 306 | break; | 309 | break; |
864 | 307 | 310 | ||
865 | === modified file 'src/wui/interactive_gamebase.cc' | |||
866 | --- src/wui/interactive_gamebase.cc 2017-09-01 15:45:59 +0000 | |||
867 | +++ src/wui/interactive_gamebase.cc 2017-09-18 07:21:55 +0000 | |||
868 | @@ -205,6 +205,7 @@ | |||
869 | 205 | *this, registry, *dynamic_cast<Widelands::Warehouse*>(building), avoid_fastclick); | 205 | *this, registry, *dynamic_cast<Widelands::Warehouse*>(building), avoid_fastclick); |
870 | 206 | }; | 206 | }; |
871 | 207 | break; | 207 | break; |
872 | 208 | // TODO(sirver,trading): Add UI for market. | ||
873 | 208 | default: | 209 | default: |
874 | 209 | log("Unable to show window for building '%s', type '%s'.\n", building->descr().name().c_str(), | 210 | log("Unable to show window for building '%s', type '%s'.\n", building->descr().name().c_str(), |
875 | 210 | to_string(building->descr().type()).c_str()); | 211 | to_string(building->descr().type()).c_str()); |
876 | 211 | 212 | ||
877 | === modified file 'test/maps/lua_testsuite.wmf/scripting/tribes_descriptions.lua' | |||
878 | --- test/maps/lua_testsuite.wmf/scripting/tribes_descriptions.lua 2016-11-12 09:13:55 +0000 | |||
879 | +++ test/maps/lua_testsuite.wmf/scripting/tribes_descriptions.lua 2017-09-18 07:21:55 +0000 | |||
880 | @@ -28,7 +28,7 @@ | |||
881 | 28 | local tribe = egbase:get_tribe_description("atlanteans") | 28 | local tribe = egbase:get_tribe_description("atlanteans") |
882 | 29 | assert_equal(42, #tribe.buildings) | 29 | assert_equal(42, #tribe.buildings) |
883 | 30 | tribe = egbase:get_tribe_description("barbarians") | 30 | tribe = egbase:get_tribe_description("barbarians") |
885 | 31 | assert_equal(51, #tribe.buildings) | 31 | assert_equal(52, #tribe.buildings) |
886 | 32 | tribe = egbase:get_tribe_description("empire") | 32 | tribe = egbase:get_tribe_description("empire") |
887 | 33 | assert_equal(52, #tribe.buildings) | 33 | assert_equal(52, #tribe.buildings) |
888 | 34 | 34 | ||
889 | 35 | 35 | ||
890 | === added directory 'test/maps/market_trading.wmf' | |||
891 | === added directory 'test/maps/market_trading.wmf/binary' | |||
892 | === added file 'test/maps/market_trading.wmf/binary/heights' | |||
893 | 36 | Binary files test/maps/market_trading.wmf/binary/heights 1970-01-01 00:00:00 +0000 and test/maps/market_trading.wmf/binary/heights 2017-09-18 07:21:55 +0000 differ | 36 | Binary files test/maps/market_trading.wmf/binary/heights 1970-01-01 00:00:00 +0000 and test/maps/market_trading.wmf/binary/heights 2017-09-18 07:21:55 +0000 differ |
894 | === added file 'test/maps/market_trading.wmf/binary/mapobjects' | |||
895 | 37 | Binary files test/maps/market_trading.wmf/binary/mapobjects 1970-01-01 00:00:00 +0000 and test/maps/market_trading.wmf/binary/mapobjects 2017-09-18 07:21:55 +0000 differ | 37 | Binary files test/maps/market_trading.wmf/binary/mapobjects 1970-01-01 00:00:00 +0000 and test/maps/market_trading.wmf/binary/mapobjects 2017-09-18 07:21:55 +0000 differ |
896 | === added file 'test/maps/market_trading.wmf/binary/resource' | |||
897 | 38 | Binary files test/maps/market_trading.wmf/binary/resource 1970-01-01 00:00:00 +0000 and test/maps/market_trading.wmf/binary/resource 2017-09-18 07:21:55 +0000 differ | 38 | Binary files test/maps/market_trading.wmf/binary/resource 1970-01-01 00:00:00 +0000 and test/maps/market_trading.wmf/binary/resource 2017-09-18 07:21:55 +0000 differ |
898 | === added file 'test/maps/market_trading.wmf/binary/terrain' | |||
899 | 39 | Binary files test/maps/market_trading.wmf/binary/terrain 1970-01-01 00:00:00 +0000 and test/maps/market_trading.wmf/binary/terrain 2017-09-18 07:21:55 +0000 differ | 39 | Binary files test/maps/market_trading.wmf/binary/terrain 1970-01-01 00:00:00 +0000 and test/maps/market_trading.wmf/binary/terrain 2017-09-18 07:21:55 +0000 differ |
900 | === added file 'test/maps/market_trading.wmf/elemental' | |||
901 | --- test/maps/market_trading.wmf/elemental 1970-01-01 00:00:00 +0000 | |||
902 | +++ test/maps/market_trading.wmf/elemental 2017-09-18 07:21:55 +0000 | |||
903 | @@ -0,0 +1,12 @@ | |||
904 | 1 | # Automatically created by Widelands (Release) | ||
905 | 2 | |||
906 | 3 | [global] | ||
907 | 4 | packet_version="1" | ||
908 | 5 | map_w="64" | ||
909 | 6 | map_h="64" | ||
910 | 7 | nr_players="2" | ||
911 | 8 | name="market_trading" | ||
912 | 9 | author="SirVer" | ||
913 | 10 | descr="no description defined" | ||
914 | 11 | hint= | ||
915 | 12 | tags= | ||
916 | 0 | 13 | ||
917 | === added file 'test/maps/market_trading.wmf/minimap.png' | |||
918 | 1 | Binary files test/maps/market_trading.wmf/minimap.png 1970-01-01 00:00:00 +0000 and test/maps/market_trading.wmf/minimap.png 2017-09-18 07:21:55 +0000 differ | 14 | Binary files test/maps/market_trading.wmf/minimap.png 1970-01-01 00:00:00 +0000 and test/maps/market_trading.wmf/minimap.png 2017-09-18 07:21:55 +0000 differ |
919 | === added file 'test/maps/market_trading.wmf/objective' | |||
920 | --- test/maps/market_trading.wmf/objective 1970-01-01 00:00:00 +0000 | |||
921 | +++ test/maps/market_trading.wmf/objective 2017-09-18 07:21:55 +0000 | |||
922 | @@ -0,0 +1,4 @@ | |||
923 | 1 | # Automatically created by Widelands (Release) | ||
924 | 2 | |||
925 | 3 | [global] | ||
926 | 4 | packet_version="2" | ||
927 | 0 | 5 | ||
928 | === added file 'test/maps/market_trading.wmf/player_names' | |||
929 | --- test/maps/market_trading.wmf/player_names 1970-01-01 00:00:00 +0000 | |||
930 | +++ test/maps/market_trading.wmf/player_names 2017-09-18 07:21:55 +0000 | |||
931 | @@ -0,0 +1,16 @@ | |||
932 | 1 | # Automatically created by Widelands (Release) | ||
933 | 2 | |||
934 | 3 | [global] | ||
935 | 4 | packet_version="2" | ||
936 | 5 | |||
937 | 6 | [player_1] | ||
938 | 7 | name="Player 1" | ||
939 | 8 | tribe="barbarians" | ||
940 | 9 | ai="empty" | ||
941 | 10 | closeable="false" | ||
942 | 11 | |||
943 | 12 | [player_2] | ||
944 | 13 | name="Player 2" | ||
945 | 14 | tribe="barbarians" | ||
946 | 15 | ai="empty" | ||
947 | 16 | closeable="false" | ||
948 | 0 | 17 | ||
949 | === added file 'test/maps/market_trading.wmf/player_position' | |||
950 | --- test/maps/market_trading.wmf/player_position 1970-01-01 00:00:00 +0000 | |||
951 | +++ test/maps/market_trading.wmf/player_position 2017-09-18 07:21:55 +0000 | |||
952 | @@ -0,0 +1,6 @@ | |||
953 | 1 | # Automatically created by Widelands (Release) | ||
954 | 2 | |||
955 | 3 | [global] | ||
956 | 4 | packet_version="2" | ||
957 | 5 | player_1="21 27" | ||
958 | 6 | player_2="45 27" | ||
959 | 0 | 7 | ||
960 | === added file 'test/maps/market_trading.wmf/port_spaces' | |||
961 | --- test/maps/market_trading.wmf/port_spaces 1970-01-01 00:00:00 +0000 | |||
962 | +++ test/maps/market_trading.wmf/port_spaces 2017-09-18 07:21:55 +0000 | |||
963 | @@ -0,0 +1,7 @@ | |||
964 | 1 | # Automatically created by Widelands (Release) | ||
965 | 2 | |||
966 | 3 | [global] | ||
967 | 4 | packet_version="1" | ||
968 | 5 | number_of_port_spaces="0" | ||
969 | 6 | |||
970 | 7 | [port_spaces] | ||
971 | 0 | 8 | ||
972 | === added directory 'test/maps/market_trading.wmf/scripting' | |||
973 | === added file 'test/maps/market_trading.wmf/scripting/init.lua' | |||
974 | --- test/maps/market_trading.wmf/scripting/init.lua 1970-01-01 00:00:00 +0000 | |||
975 | +++ test/maps/market_trading.wmf/scripting/init.lua 2017-09-18 07:21:55 +0000 | |||
976 | @@ -0,0 +1,28 @@ | |||
977 | 1 | include "scripting/lunit.lua" | ||
978 | 2 | include "scripting/coroutine.lua" | ||
979 | 3 | include "scripting/infrastructure.lua" | ||
980 | 4 | include "scripting/ui.lua" | ||
981 | 5 | |||
982 | 6 | game = wl.Game() | ||
983 | 7 | map = game.map | ||
984 | 8 | p1 = game.players[1] | ||
985 | 9 | p2 = game.players[2] | ||
986 | 10 | p1.see_all = true | ||
987 | 11 | |||
988 | 12 | p1:allow_workers("all") | ||
989 | 13 | |||
990 | 14 | function full_headquarters(player, x, y) | ||
991 | 15 | prefilled_buildings(player, { "barbarians_headquarters", x, y }) | ||
992 | 16 | hq = player:get_buildings("barbarians_headquarters")[1] | ||
993 | 17 | for idx,descr in ipairs(game:get_tribe_description("barbarians").wares) do | ||
994 | 18 | hq:set_wares(descr.name, 350) | ||
995 | 19 | end | ||
996 | 20 | for idx,descr in ipairs(game:get_tribe_description("barbarians").workers) do | ||
997 | 21 | hq:set_workers(descr.name, 50) | ||
998 | 22 | end | ||
999 | 23 | end | ||
1000 | 24 | |||
1001 | 25 | full_headquarters(p1, 22, 25) | ||
1002 | 26 | full_headquarters(p2, 32, 25) | ||
1003 | 27 | |||
1004 | 28 | game.desired_speed = 50000 | ||
1005 | 0 | 29 | ||
1006 | === added file 'test/maps/market_trading.wmf/scripting/test_market_can_be_build.lua' | |||
1007 | --- test/maps/market_trading.wmf/scripting/test_market_can_be_build.lua 1970-01-01 00:00:00 +0000 | |||
1008 | +++ test/maps/market_trading.wmf/scripting/test_market_can_be_build.lua 2017-09-18 07:21:55 +0000 | |||
1009 | @@ -0,0 +1,13 @@ | |||
1010 | 1 | run(function() | ||
1011 | 2 | sleep(2000) | ||
1012 | 3 | |||
1013 | 4 | market = p2:place_building("barbarians_market", map:get_field(35, 25), true, true) | ||
1014 | 5 | connected_road(p2, market.flag, "l,l,l|", true) | ||
1015 | 6 | |||
1016 | 7 | while #p2:get_buildings("barbarians_market") == 0 do | ||
1017 | 8 | sleep(10000) | ||
1018 | 9 | end | ||
1019 | 10 | print("# All Tests passed.") | ||
1020 | 11 | wl.ui.MapView():close() | ||
1021 | 12 | end) | ||
1022 | 13 | |||
1023 | 0 | 14 | ||
1024 | === added file 'test/maps/market_trading.wmf/version' | |||
1025 | --- test/maps/market_trading.wmf/version 1970-01-01 00:00:00 +0000 | |||
1026 | +++ test/maps/market_trading.wmf/version 2017-09-18 07:21:55 +0000 | |||
1027 | @@ -0,0 +1,11 @@ | |||
1028 | 1 | # Automatically created by Widelands (Release) | ||
1029 | 2 | |||
1030 | 3 | [global] | ||
1031 | 4 | map_source_url= | ||
1032 | 5 | map_release= | ||
1033 | 6 | map_creator_version= | ||
1034 | 7 | map_version_major="0" | ||
1035 | 8 | map_version_minor="1" | ||
1036 | 9 | map_version_timestamp="1505478312" | ||
1037 | 10 | packet_version="1" | ||
1038 | 11 | packet_compatibility="1" |
Continuous integration builds have changed state:
Travis build 2668. State: failed. Details: https:/ /travis- ci.org/ widelands/ widelands/ builds/ 275899451. /ci.appveyor. com/project/ widelands- dev/widelands/ build/_ widelands_ dev_widelands_ market- 2489.
Appveyor build 2489. State: success. Details: https:/