Merge lp:~widelands-dev/widelands/reed-compatibility into lp:widelands
- reed-compatibility
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 9146 |
Proposed branch: | lp:~widelands-dev/widelands/reed-compatibility |
Merge into: | lp:widelands |
Diff against target: |
823 lines (+122/-91) 19 files modified
src/economy/expedition_bootstrap.cc (+3/-3) src/economy/expedition_bootstrap.h (+1/-1) src/economy/input_queue.cc (+7/-6) src/economy/input_queue.h (+1/-1) src/economy/request.cc (+3/-3) src/economy/request.h (+2/-1) src/game_io/game_player_info_packet.cc (+2/-2) src/map_io/map_buildingdata_packet.cc (+42/-38) src/map_io/map_buildingdata_packet.h (+9/-8) src/map_io/map_flagdata_packet.cc (+2/-2) src/map_io/map_flagdata_packet.h (+8/-1) src/map_io/map_object_packet.cc (+4/-4) src/map_io/map_object_packet.h (+1/-1) src/map_io/map_players_view_packet.cc (+9/-9) src/map_io/map_players_view_packet.h (+10/-1) src/map_io/map_roaddata_packet.cc (+2/-2) src/map_io/map_roaddata_packet.h (+8/-1) src/map_io/tribes_legacy_lookup_table.cc (+2/-1) src/map_io/widelands_map_loader.cc (+6/-6) |
To merge this branch: | bzr merge lp:~widelands-dev/widelands/reed-compatibility |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
hessenfarmer | Approve | ||
Review via email: mp+367935@code.launchpad.net |
Commit message
Fix savegame compatibility for reed, buildings, players view and economy requests.
Description of the change
bunnybot (widelandsofficial) wrote : | # |
Notabilis (notabilis27) wrote : | # |
So ... you created a diff of 800 lines by passing objects around so you can call a method in only a handful of places?? I like it! :)
The changes are mostly looking good to me. Replacing the GOTO might be broken, though, see my diff comment below.
I haven't tested the changes, mostly because I have no sensible idea how to do so. But based on the code I guess it shouldn't break anything.
GunChleoc (gunchleoc) wrote : | # |
> So ... you created a diff of 800 lines by passing objects around so you can call a method in only a handful of places?? I like it! :)
Lol yep. It will save a bit of memory though if the objects are created only once.
For triggering the bug, you need a savegame created with bzr9118 or older that has reed or wheat fields on it.
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 5154. State: errored. Details: https:/
Appveyor build 4936. State: success. Details: https:/
GunChleoc (gunchleoc) wrote : | # |
I have added a second if statement for the test variable to simulate the effect of the goto and break out of the outer loop. Thanks for the review!
@bunybot merge
Notabilis (notabilis27) wrote : | # |
Sorry, I am having second thoughts about the goto-part. Actually, I am not only unsure about the goto-replacement but over the whole code part independent of your changes. :-/
If I understand it right, the code iterates over the possible jobs in the production site. If there is a job the loaded worker can work on, we iterate over all working positions of the site and check if *any* of these is empty, so we can assign the worker. Shouldn't we only check the working positions that are for the required job? Otherwise, the code could break with production sites which have multiple types of worker positions (Mines probably? These need a miner and a master miner).
Maybe I am just confused and the code is fine, but it would be good if someone could check it.
GunChleoc (gunchleoc) wrote : | # |
This code is pretty old, so I'm sure we would have had bug reports for it in the past if it was broken. It should be fine if iterating starts with the most advanced working position, because then we won't put a master miner i a miner's slot and end up stumped when we have to put a miner in a master miner's slot, which is not allowed.
I'll reinstate the goto to make sure we can't possibly have any accidental semantic changes, so that we can get this bugfix in.
GunChleoc (gunchleoc) wrote : | # |
Done. Thanks for the review!
@bunnybot merge
GunChleoc (gunchleoc) wrote : | # |
Inputqueues again
@bunnybot merge force
bunnybot (widelandsofficial) wrote : | # |
Refusing to merge, since Travis is not green. Use @bunnybot merge force for merging anyways.
Travis build 5164. State: errored. Details: https:/
hessenfarmer (stephan-lutz) wrote : | # |
@bunnybot merge force
hessenfarmer (stephan-lutz) : | # |
Preview Diff
1 | === modified file 'src/economy/expedition_bootstrap.cc' | |||
2 | --- src/economy/expedition_bootstrap.cc 2019-02-23 11:00:49 +0000 | |||
3 | +++ src/economy/expedition_bootstrap.cc 2019-06-08 16:55:17 +0000 | |||
4 | @@ -203,7 +203,7 @@ | |||
5 | 203 | } | 203 | } |
6 | 204 | 204 | ||
7 | 205 | void ExpeditionBootstrap::load( | 205 | void ExpeditionBootstrap::load( |
9 | 206 | Warehouse& warehouse, FileRead& fr, Game& game, MapObjectLoader& mol, uint16_t packet_version) { | 206 | Warehouse& warehouse, FileRead& fr, Game& game, MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table, uint16_t packet_version) { |
10 | 207 | 207 | ||
11 | 208 | static const uint16_t kCurrentPacketVersion = 7; | 208 | static const uint16_t kCurrentPacketVersion = 7; |
12 | 209 | assert(queues_.empty()); | 209 | assert(queues_.empty()); |
13 | @@ -214,7 +214,7 @@ | |||
14 | 214 | uint8_t num_queues = fr.unsigned_8(); | 214 | uint8_t num_queues = fr.unsigned_8(); |
15 | 215 | for (uint8_t i = 0; i < num_queues; ++i) { | 215 | for (uint8_t i = 0; i < num_queues; ++i) { |
16 | 216 | WorkersQueue* wq = new WorkersQueue(warehouse, INVALID_INDEX, 0); | 216 | WorkersQueue* wq = new WorkersQueue(warehouse, INVALID_INDEX, 0); |
18 | 217 | wq->read(fr, game, mol); | 217 | wq->read(fr, game, mol, tribes_lookup_table); |
19 | 218 | wq->set_callback(input_callback, this); | 218 | wq->set_callback(input_callback, this); |
20 | 219 | 219 | ||
21 | 220 | if (wq->get_index() == INVALID_INDEX) { | 220 | if (wq->get_index() == INVALID_INDEX) { |
22 | @@ -232,7 +232,7 @@ | |||
23 | 232 | uint8_t num_queues = fr.unsigned_8(); | 232 | uint8_t num_queues = fr.unsigned_8(); |
24 | 233 | for (uint8_t i = 0; i < num_queues; ++i) { | 233 | for (uint8_t i = 0; i < num_queues; ++i) { |
25 | 234 | WaresQueue* wq = new WaresQueue(warehouse, INVALID_INDEX, 0); | 234 | WaresQueue* wq = new WaresQueue(warehouse, INVALID_INDEX, 0); |
27 | 235 | wq->read(fr, game, mol); | 235 | wq->read(fr, game, mol, tribes_lookup_table); |
28 | 236 | wq->set_callback(input_callback, this); | 236 | wq->set_callback(input_callback, this); |
29 | 237 | 237 | ||
30 | 238 | if (wq->get_index() == INVALID_INDEX) { | 238 | if (wq->get_index() == INVALID_INDEX) { |
31 | 239 | 239 | ||
32 | === modified file 'src/economy/expedition_bootstrap.h' | |||
33 | --- src/economy/expedition_bootstrap.h 2019-02-23 11:00:49 +0000 | |||
34 | +++ src/economy/expedition_bootstrap.h 2019-06-08 16:55:17 +0000 | |||
35 | @@ -88,7 +88,7 @@ | |||
36 | 88 | * packet, and there in the warehouse data packet. | 88 | * packet, and there in the warehouse data packet. |
37 | 89 | */ | 89 | */ |
38 | 90 | void | 90 | void |
40 | 91 | load(Warehouse& warehouse, FileRead& fr, Game& game, MapObjectLoader& mol, uint16_t version); | 91 | load(Warehouse& warehouse, FileRead& fr, Game& game, MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table, uint16_t version); |
41 | 92 | 92 | ||
42 | 93 | /** Save this into a file. | 93 | /** Save this into a file. |
43 | 94 | * | 94 | * |
44 | 95 | 95 | ||
45 | === modified file 'src/economy/input_queue.cc' | |||
46 | --- src/economy/input_queue.cc 2019-02-23 11:00:49 +0000 | |||
47 | +++ src/economy/input_queue.cc 2019-06-08 16:55:17 +0000 | |||
48 | @@ -130,7 +130,7 @@ | |||
49 | 130 | 130 | ||
50 | 131 | constexpr uint16_t kCurrentPacketVersion = 3; | 131 | constexpr uint16_t kCurrentPacketVersion = 3; |
51 | 132 | 132 | ||
53 | 133 | void InputQueue::read(FileRead& fr, Game& game, MapObjectLoader& mol) { | 133 | void InputQueue::read(FileRead& fr, Game& game, MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table) { |
54 | 134 | 134 | ||
55 | 135 | uint16_t const packet_version = fr.unsigned_16(); | 135 | uint16_t const packet_version = fr.unsigned_16(); |
56 | 136 | try { | 136 | try { |
57 | @@ -140,25 +140,26 @@ | |||
58 | 140 | if (packet_version == 1 || packet_version == kCurrentPacketVersion) { | 140 | if (packet_version == 1 || packet_version == kCurrentPacketVersion) { |
59 | 141 | if (fr.unsigned_8() == 0) { | 141 | if (fr.unsigned_8() == 0) { |
60 | 142 | assert(type_ == wwWARE); | 142 | assert(type_ == wwWARE); |
62 | 143 | index_ = owner().tribe().ware_index(fr.c_string()); | 143 | index_ = owner().tribe().ware_index(tribes_lookup_table.lookup_ware(fr.c_string())); |
63 | 144 | } else { | 144 | } else { |
64 | 145 | assert(type_ == wwWORKER); | 145 | assert(type_ == wwWORKER); |
66 | 146 | index_ = owner().tribe().worker_index(fr.c_string()); | 146 | index_ = owner().tribe().worker_index(tribes_lookup_table.lookup_worker(fr.c_string())); |
67 | 147 | } | 147 | } |
68 | 148 | max_size_ = fr.unsigned_32(); | 148 | max_size_ = fr.unsigned_32(); |
69 | 149 | max_fill_ = fr.signed_32(); | 149 | max_fill_ = fr.signed_32(); |
70 | 150 | consume_interval_ = fr.unsigned_32(); | 150 | consume_interval_ = fr.unsigned_32(); |
71 | 151 | if (fr.unsigned_8()) { | 151 | if (fr.unsigned_8()) { |
72 | 152 | request_.reset(new Request(owner_, 0, InputQueue::request_callback, type_)); | 152 | request_.reset(new Request(owner_, 0, InputQueue::request_callback, type_)); |
74 | 153 | request_->read(fr, game, mol); | 153 | request_->read(fr, game, mol, tribes_lookup_table); |
75 | 154 | } else { | 154 | } else { |
76 | 155 | request_.reset(); | 155 | request_.reset(); |
77 | 156 | } | 156 | } |
78 | 157 | 157 | ||
79 | 158 | read_child(fr, game, mol); | 158 | read_child(fr, game, mol); |
80 | 159 | } else if (packet_version == 2) { | 159 | } else if (packet_version == 2) { |
81 | 160 | // TODO(GunChleoc): Savegame compatibility, get rid after Build 21 | ||
82 | 160 | assert(type_ == wwWARE); | 161 | assert(type_ == wwWARE); |
84 | 161 | index_ = owner().tribe().ware_index(fr.c_string()); | 162 | index_ = owner().tribe().ware_index(tribes_lookup_table.lookup_ware(fr.c_string())); |
85 | 162 | max_size_ = fr.unsigned_32(); | 163 | max_size_ = fr.unsigned_32(); |
86 | 163 | max_fill_ = fr.signed_32(); | 164 | max_fill_ = fr.signed_32(); |
87 | 164 | // No read_child() call here, doing it manually since there is no child-version number | 165 | // No read_child() call here, doing it manually since there is no child-version number |
88 | @@ -166,7 +167,7 @@ | |||
89 | 166 | consume_interval_ = fr.unsigned_32(); | 167 | consume_interval_ = fr.unsigned_32(); |
90 | 167 | if (fr.unsigned_8()) { | 168 | if (fr.unsigned_8()) { |
91 | 168 | request_.reset(new Request(owner_, 0, InputQueue::request_callback, type_)); | 169 | request_.reset(new Request(owner_, 0, InputQueue::request_callback, type_)); |
93 | 169 | request_->read(fr, game, mol); | 170 | request_->read(fr, game, mol, tribes_lookup_table); |
94 | 170 | } else { | 171 | } else { |
95 | 171 | request_.reset(); | 172 | request_.reset(); |
96 | 172 | } | 173 | } |
97 | 173 | 174 | ||
98 | === modified file 'src/economy/input_queue.h' | |||
99 | --- src/economy/input_queue.h 2019-02-27 19:00:36 +0000 | |||
100 | +++ src/economy/input_queue.h 2019-06-08 16:55:17 +0000 | |||
101 | @@ -184,7 +184,7 @@ | |||
102 | 184 | * @param game The game this queue will be part of. | 184 | * @param game The game this queue will be part of. |
103 | 185 | * @param mol The game/map loader that handles the lading. Required to pass to Request::read(). | 185 | * @param mol The game/map loader that handles the lading. Required to pass to Request::read(). |
104 | 186 | */ | 186 | */ |
106 | 187 | void read(FileRead& f, Game& g, MapObjectLoader& mol); | 187 | void read(FileRead& f, Game& g, MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table); |
107 | 188 | 188 | ||
108 | 189 | /** | 189 | /** |
109 | 190 | * Writes the state of this class. | 190 | * Writes the state of this class. |
110 | 191 | 191 | ||
111 | === modified file 'src/economy/request.cc' | |||
112 | --- src/economy/request.cc 2019-02-23 11:00:49 +0000 | |||
113 | +++ src/economy/request.cc 2019-06-08 16:55:17 +0000 | |||
114 | @@ -98,18 +98,18 @@ | |||
115 | 98 | * might have been initialized. We have to kill them and replace | 98 | * might have been initialized. We have to kill them and replace |
116 | 99 | * them through the data in the file | 99 | * them through the data in the file |
117 | 100 | */ | 100 | */ |
119 | 101 | void Request::read(FileRead& fr, Game& game, MapObjectLoader& mol) { | 101 | void Request::read(FileRead& fr, Game& game, MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table) { |
120 | 102 | try { | 102 | try { |
121 | 103 | uint16_t const packet_version = fr.unsigned_16(); | 103 | uint16_t const packet_version = fr.unsigned_16(); |
122 | 104 | if (packet_version == kCurrentPacketVersion) { | 104 | if (packet_version == kCurrentPacketVersion) { |
123 | 105 | const TribeDescr& tribe = target_.owner().tribe(); | 105 | const TribeDescr& tribe = target_.owner().tribe(); |
124 | 106 | char const* const type_name = fr.c_string(); | 106 | char const* const type_name = fr.c_string(); |
126 | 107 | DescriptionIndex const wai = tribe.ware_index(type_name); | 107 | DescriptionIndex const wai = tribe.ware_index(tribes_lookup_table.lookup_ware(type_name)); |
127 | 108 | if (tribe.has_ware(wai)) { | 108 | if (tribe.has_ware(wai)) { |
128 | 109 | type_ = wwWARE; | 109 | type_ = wwWARE; |
129 | 110 | index_ = wai; | 110 | index_ = wai; |
130 | 111 | } else { | 111 | } else { |
132 | 112 | DescriptionIndex const woi = tribe.worker_index(type_name); | 112 | DescriptionIndex const woi = tribe.worker_index(tribes_lookup_table.lookup_worker(type_name)); |
133 | 113 | if (tribe.has_worker(woi)) { | 113 | if (tribe.has_worker(woi)) { |
134 | 114 | type_ = wwWORKER; | 114 | type_ = wwWORKER; |
135 | 115 | index_ = woi; | 115 | index_ = woi; |
136 | 116 | 116 | ||
137 | === modified file 'src/economy/request.h' | |||
138 | --- src/economy/request.h 2019-02-23 11:00:49 +0000 | |||
139 | +++ src/economy/request.h 2019-06-08 16:55:17 +0000 | |||
140 | @@ -24,6 +24,7 @@ | |||
141 | 24 | #include "logic/map_objects/tribes/requirements.h" | 24 | #include "logic/map_objects/tribes/requirements.h" |
142 | 25 | #include "logic/map_objects/tribes/wareworker.h" | 25 | #include "logic/map_objects/tribes/wareworker.h" |
143 | 26 | #include "logic/widelands.h" | 26 | #include "logic/widelands.h" |
144 | 27 | #include "map_io/tribes_legacy_lookup_table.h" | ||
145 | 27 | 28 | ||
146 | 28 | class FileRead; | 29 | class FileRead; |
147 | 29 | class FileWrite; | 30 | class FileWrite; |
148 | @@ -116,7 +117,7 @@ | |||
149 | 116 | 117 | ||
150 | 117 | void start_transfer(Game&, Supply&); | 118 | void start_transfer(Game&, Supply&); |
151 | 118 | 119 | ||
153 | 119 | void read(FileRead&, Game&, MapObjectLoader&); | 120 | void read(FileRead&, Game&, MapObjectLoader&, const TribesLegacyLookupTable& tribes_lookup_table); |
154 | 120 | void write(FileWrite&, Game&, MapObjectSaver&) const; | 121 | void write(FileWrite&, Game&, MapObjectSaver&) const; |
155 | 121 | Worker* get_transfer_worker(); | 122 | Worker* get_transfer_worker(); |
156 | 122 | 123 | ||
157 | 123 | 124 | ||
158 | === modified file 'src/game_io/game_player_info_packet.cc' | |||
159 | --- src/game_io/game_player_info_packet.cc 2019-05-19 12:25:24 +0000 | |||
160 | +++ src/game_io/game_player_info_packet.cc 2019-06-08 16:55:17 +0000 | |||
161 | @@ -37,7 +37,7 @@ | |||
162 | 37 | 37 | ||
163 | 38 | void GamePlayerInfoPacket::read(FileSystem& fs, Game& game, MapObjectLoader*) { | 38 | void GamePlayerInfoPacket::read(FileSystem& fs, Game& game, MapObjectLoader*) { |
164 | 39 | try { | 39 | try { |
166 | 40 | std::unique_ptr<TribesLegacyLookupTable> tribe_lookup_table(new TribesLegacyLookupTable()); | 40 | std::unique_ptr<TribesLegacyLookupTable> tribes_lookup_table(new TribesLegacyLookupTable()); |
167 | 41 | FileRead fr; | 41 | FileRead fr; |
168 | 42 | fr.open(fs, "binary/player_info"); | 42 | fr.open(fs, "binary/player_info"); |
169 | 43 | uint16_t const packet_version = fr.unsigned_16(); | 43 | uint16_t const packet_version = fr.unsigned_16(); |
170 | @@ -72,7 +72,7 @@ | |||
171 | 72 | } | 72 | } |
172 | 73 | } | 73 | } |
173 | 74 | 74 | ||
175 | 75 | player->read_statistics(fr, packet_version, *tribe_lookup_table.get()); | 75 | player->read_statistics(fr, packet_version, *tribes_lookup_table.get()); |
176 | 76 | player->read_remaining_shipnames(fr); | 76 | player->read_remaining_shipnames(fr); |
177 | 77 | 77 | ||
178 | 78 | player->casualties_ = fr.unsigned_32(); | 78 | player->casualties_ = fr.unsigned_32(); |
179 | 79 | 79 | ||
180 | === modified file 'src/map_io/map_buildingdata_packet.cc' | |||
181 | --- src/map_io/map_buildingdata_packet.cc 2019-05-28 21:04:36 +0000 | |||
182 | +++ src/map_io/map_buildingdata_packet.cc 2019-06-08 16:55:17 +0000 | |||
183 | @@ -71,7 +71,7 @@ | |||
184 | 71 | void MapBuildingdataPacket::read(FileSystem& fs, | 71 | void MapBuildingdataPacket::read(FileSystem& fs, |
185 | 72 | EditorGameBase& egbase, | 72 | EditorGameBase& egbase, |
186 | 73 | bool const skip, | 73 | bool const skip, |
188 | 74 | MapObjectLoader& mol) { | 74 | MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table) { |
189 | 75 | if (skip) | 75 | if (skip) |
190 | 76 | return; | 76 | return; |
191 | 77 | 77 | ||
192 | @@ -180,18 +180,18 @@ | |||
193 | 180 | Game& game = dynamic_cast<Game&>(egbase); | 180 | Game& game = dynamic_cast<Game&>(egbase); |
194 | 181 | 181 | ||
195 | 182 | if (upcast(ConstructionSite, constructionsite, &building)) { | 182 | if (upcast(ConstructionSite, constructionsite, &building)) { |
197 | 183 | read_constructionsite(*constructionsite, fr, game, mol); | 183 | read_constructionsite(*constructionsite, fr, game, mol, tribes_lookup_table); |
198 | 184 | } else if (upcast(DismantleSite, dms, &building)) { | 184 | } else if (upcast(DismantleSite, dms, &building)) { |
200 | 185 | read_dismantlesite(*dms, fr, game, mol); | 185 | read_dismantlesite(*dms, fr, game, mol, tribes_lookup_table); |
201 | 186 | } else if (upcast(MilitarySite, militarysite, &building)) { | 186 | } else if (upcast(MilitarySite, militarysite, &building)) { |
203 | 187 | read_militarysite(*militarysite, fr, game, mol); | 187 | read_militarysite(*militarysite, fr, game, mol, tribes_lookup_table); |
204 | 188 | } else if (upcast(Warehouse, warehouse, &building)) { | 188 | } else if (upcast(Warehouse, warehouse, &building)) { |
206 | 189 | read_warehouse(*warehouse, fr, game, mol); | 189 | read_warehouse(*warehouse, fr, game, mol, tribes_lookup_table); |
207 | 190 | } else if (upcast(ProductionSite, productionsite, &building)) { | 190 | } else if (upcast(ProductionSite, productionsite, &building)) { |
208 | 191 | if (upcast(TrainingSite, trainingsite, productionsite)) { | 191 | if (upcast(TrainingSite, trainingsite, productionsite)) { |
210 | 192 | read_trainingsite(*trainingsite, fr, game, mol); | 192 | read_trainingsite(*trainingsite, fr, game, mol, tribes_lookup_table); |
211 | 193 | } else { | 193 | } else { |
213 | 194 | read_productionsite(*productionsite, fr, game, mol); | 194 | read_productionsite(*productionsite, fr, game, mol, tribes_lookup_table); |
214 | 195 | } | 195 | } |
215 | 196 | } else { | 196 | } else { |
216 | 197 | // type of building is not one of (or derived from) | 197 | // type of building is not one of (or derived from) |
217 | @@ -215,7 +215,7 @@ | |||
218 | 215 | void MapBuildingdataPacket::read_partially_finished_building(PartiallyFinishedBuilding& pfb, | 215 | void MapBuildingdataPacket::read_partially_finished_building(PartiallyFinishedBuilding& pfb, |
219 | 216 | FileRead& fr, | 216 | FileRead& fr, |
220 | 217 | Game& game, | 217 | Game& game, |
222 | 218 | MapObjectLoader& mol) { | 218 | MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table) { |
223 | 219 | try { | 219 | try { |
224 | 220 | uint16_t const packet_version = fr.unsigned_16(); | 220 | uint16_t const packet_version = fr.unsigned_16(); |
225 | 221 | if (packet_version == kCurrentPacketPFBuilding) { | 221 | if (packet_version == kCurrentPacketPFBuilding) { |
226 | @@ -226,7 +226,7 @@ | |||
227 | 226 | if (fr.unsigned_8()) { | 226 | if (fr.unsigned_8()) { |
228 | 227 | pfb.builder_request_ = | 227 | pfb.builder_request_ = |
229 | 228 | new Request(pfb, 0, PartiallyFinishedBuilding::request_builder_callback, wwWORKER); | 228 | new Request(pfb, 0, PartiallyFinishedBuilding::request_builder_callback, wwWORKER); |
231 | 229 | pfb.builder_request_->read(fr, game, mol); | 229 | pfb.builder_request_->read(fr, game, mol, tribes_lookup_table); |
232 | 230 | } else | 230 | } else |
233 | 231 | pfb.builder_request_ = nullptr; | 231 | pfb.builder_request_ = nullptr; |
234 | 232 | 232 | ||
235 | @@ -244,7 +244,7 @@ | |||
236 | 244 | pfb.wares_.resize(size); | 244 | pfb.wares_.resize(size); |
237 | 245 | for (uint16_t i = 0; i < pfb.wares_.size(); ++i) { | 245 | for (uint16_t i = 0; i < pfb.wares_.size(); ++i) { |
238 | 246 | pfb.wares_[i] = new WaresQueue(pfb, INVALID_INDEX, 0); | 246 | pfb.wares_[i] = new WaresQueue(pfb, INVALID_INDEX, 0); |
240 | 247 | pfb.wares_[i]->read(fr, game, mol); | 247 | pfb.wares_[i]->read(fr, game, mol, tribes_lookup_table); |
241 | 248 | } | 248 | } |
242 | 249 | } catch (const WException& e) { | 249 | } catch (const WException& e) { |
243 | 250 | throw GameDataError("wares: %s", e.what()); | 250 | throw GameDataError("wares: %s", e.what()); |
244 | @@ -266,11 +266,11 @@ | |||
245 | 266 | void MapBuildingdataPacket::read_constructionsite(ConstructionSite& constructionsite, | 266 | void MapBuildingdataPacket::read_constructionsite(ConstructionSite& constructionsite, |
246 | 267 | FileRead& fr, | 267 | FileRead& fr, |
247 | 268 | Game& game, | 268 | Game& game, |
249 | 269 | MapObjectLoader& mol) { | 269 | MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table) { |
250 | 270 | try { | 270 | try { |
251 | 271 | uint16_t const packet_version = fr.unsigned_16(); | 271 | uint16_t const packet_version = fr.unsigned_16(); |
252 | 272 | if (packet_version >= kCurrentPacketVersionConstructionsite) { | 272 | if (packet_version >= kCurrentPacketVersionConstructionsite) { |
254 | 273 | read_partially_finished_building(constructionsite, fr, game, mol); | 273 | read_partially_finished_building(constructionsite, fr, game, mol, tribes_lookup_table); |
255 | 274 | 274 | ||
256 | 275 | for (ConstructionSite::Wares::iterator wares_iter = constructionsite.wares_.begin(); | 275 | for (ConstructionSite::Wares::iterator wares_iter = constructionsite.wares_.begin(); |
257 | 276 | wares_iter != constructionsite.wares_.end(); ++wares_iter) { | 276 | wares_iter != constructionsite.wares_.end(); ++wares_iter) { |
258 | @@ -291,11 +291,11 @@ | |||
259 | 291 | void MapBuildingdataPacket::read_dismantlesite(DismantleSite& dms, | 291 | void MapBuildingdataPacket::read_dismantlesite(DismantleSite& dms, |
260 | 292 | FileRead& fr, | 292 | FileRead& fr, |
261 | 293 | Game& game, | 293 | Game& game, |
263 | 294 | MapObjectLoader& mol) { | 294 | MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table) { |
264 | 295 | try { | 295 | try { |
265 | 296 | uint16_t const packet_version = fr.unsigned_16(); | 296 | uint16_t const packet_version = fr.unsigned_16(); |
266 | 297 | if (packet_version == kCurrentPacketVersionDismantlesite) { | 297 | if (packet_version == kCurrentPacketVersionDismantlesite) { |
268 | 298 | read_partially_finished_building(dms, fr, game, mol); | 298 | read_partially_finished_building(dms, fr, game, mol, tribes_lookup_table); |
269 | 299 | 299 | ||
270 | 300 | // Nothing to do | 300 | // Nothing to do |
271 | 301 | } else { | 301 | } else { |
272 | @@ -310,7 +310,7 @@ | |||
273 | 310 | void MapBuildingdataPacket::read_warehouse(Warehouse& warehouse, | 310 | void MapBuildingdataPacket::read_warehouse(Warehouse& warehouse, |
274 | 311 | FileRead& fr, | 311 | FileRead& fr, |
275 | 312 | Game& game, | 312 | Game& game, |
277 | 313 | MapObjectLoader& mol) { | 313 | MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table) { |
278 | 314 | try { | 314 | try { |
279 | 315 | uint16_t const packet_version = fr.unsigned_16(); | 315 | uint16_t const packet_version = fr.unsigned_16(); |
280 | 316 | if (packet_version >= 6) { | 316 | if (packet_version >= 6) { |
281 | @@ -319,7 +319,7 @@ | |||
282 | 319 | const TribeDescr& tribe = player->tribe(); | 319 | const TribeDescr& tribe = player->tribe(); |
283 | 320 | 320 | ||
284 | 321 | while (fr.unsigned_8()) { | 321 | while (fr.unsigned_8()) { |
286 | 322 | const DescriptionIndex& id = tribe.ware_index(fr.c_string()); | 322 | const DescriptionIndex& id = tribe.ware_index(tribes_lookup_table.lookup_ware(fr.c_string())); |
287 | 323 | Quantity amount = fr.unsigned_32(); | 323 | Quantity amount = fr.unsigned_32(); |
288 | 324 | Warehouse::StockPolicy policy = static_cast<Warehouse::StockPolicy>(fr.unsigned_8()); | 324 | Warehouse::StockPolicy policy = static_cast<Warehouse::StockPolicy>(fr.unsigned_8()); |
289 | 325 | 325 | ||
290 | @@ -329,7 +329,7 @@ | |||
291 | 329 | } | 329 | } |
292 | 330 | } | 330 | } |
293 | 331 | while (fr.unsigned_8()) { | 331 | while (fr.unsigned_8()) { |
295 | 332 | const DescriptionIndex& id = tribe.worker_index(fr.c_string()); | 332 | const DescriptionIndex& id = tribe.worker_index(tribes_lookup_table.lookup_worker(fr.c_string())); |
296 | 333 | uint32_t amount = fr.unsigned_32(); | 333 | uint32_t amount = fr.unsigned_32(); |
297 | 334 | Warehouse::StockPolicy policy = static_cast<Warehouse::StockPolicy>(fr.unsigned_8()); | 334 | Warehouse::StockPolicy policy = static_cast<Warehouse::StockPolicy>(fr.unsigned_8()); |
298 | 335 | 335 | ||
299 | @@ -364,15 +364,16 @@ | |||
300 | 364 | tribe.worker_types_without_cost(); | 364 | tribe.worker_types_without_cost(); |
301 | 365 | 365 | ||
302 | 366 | for (;;) { | 366 | for (;;) { |
305 | 367 | char const* const worker_typename = fr.c_string(); | 367 | const std::string worker_typename = tribes_lookup_table.lookup_worker(fr.c_string()); |
306 | 368 | if (!*worker_typename) // encountered the terminator ("") | 368 | if (worker_typename.empty()) { // No more workers found |
307 | 369 | break; | 369 | break; |
308 | 370 | } | ||
309 | 370 | uint32_t const next_spawn = fr.unsigned_32(); | 371 | uint32_t const next_spawn = fr.unsigned_32(); |
310 | 371 | DescriptionIndex const worker_index = tribe.safe_worker_index(worker_typename); | 372 | DescriptionIndex const worker_index = tribe.safe_worker_index(worker_typename); |
311 | 372 | if (!game.tribes().worker_exists(worker_index)) { | 373 | if (!game.tribes().worker_exists(worker_index)) { |
312 | 373 | log("WARNING: %s %u has a next_spawn time for nonexistent " | 374 | log("WARNING: %s %u has a next_spawn time for nonexistent " |
313 | 374 | "worker type \"%s\" set to %u, ignoring\n", | 375 | "worker type \"%s\" set to %u, ignoring\n", |
315 | 375 | warehouse.descr().name().c_str(), warehouse.serial(), worker_typename, | 376 | warehouse.descr().name().c_str(), warehouse.serial(), worker_typename.c_str(), |
316 | 376 | next_spawn); | 377 | next_spawn); |
317 | 377 | continue; | 378 | continue; |
318 | 378 | } | 379 | } |
319 | @@ -380,7 +381,7 @@ | |||
320 | 380 | log("WARNING: %s %u has a next_spawn time for worker type " | 381 | log("WARNING: %s %u has a next_spawn time for worker type " |
321 | 381 | "\"%s\", that costs something to build, set to %u, " | 382 | "\"%s\", that costs something to build, set to %u, " |
322 | 382 | "ignoring\n", | 383 | "ignoring\n", |
324 | 383 | warehouse.descr().name().c_str(), warehouse.serial(), worker_typename, | 384 | warehouse.descr().name().c_str(), warehouse.serial(), worker_typename.c_str(), |
325 | 384 | next_spawn); | 385 | next_spawn); |
326 | 385 | continue; | 386 | continue; |
327 | 386 | } | 387 | } |
328 | @@ -392,7 +393,7 @@ | |||
329 | 392 | "\"%s\" set to %u, but it was previously set " | 393 | "\"%s\" set to %u, but it was previously set " |
330 | 393 | "to %u\n", | 394 | "to %u\n", |
331 | 394 | warehouse.descr().name().c_str(), warehouse.serial(), | 395 | warehouse.descr().name().c_str(), warehouse.serial(), |
333 | 395 | worker_typename, next_spawn, | 396 | worker_typename.c_str(), next_spawn, |
334 | 396 | warehouse.next_worker_without_cost_spawn_[i]); | 397 | warehouse.next_worker_without_cost_spawn_[i]); |
335 | 397 | warehouse.next_worker_without_cost_spawn_[i] = next_spawn; | 398 | warehouse.next_worker_without_cost_spawn_[i] = next_spawn; |
336 | 398 | break; | 399 | break; |
337 | @@ -409,13 +410,13 @@ | |||
338 | 409 | while (nr_planned_workers--) { | 410 | while (nr_planned_workers--) { |
339 | 410 | warehouse.planned_workers_.push_back(Warehouse::PlannedWorkers()); | 411 | warehouse.planned_workers_.push_back(Warehouse::PlannedWorkers()); |
340 | 411 | Warehouse::PlannedWorkers& pw = warehouse.planned_workers_.back(); | 412 | Warehouse::PlannedWorkers& pw = warehouse.planned_workers_.back(); |
342 | 412 | pw.index = tribe.worker_index(fr.c_string()); | 413 | pw.index = tribe.worker_index(tribes_lookup_table.lookup_worker(fr.c_string())); |
343 | 413 | pw.amount = fr.unsigned_32(); | 414 | pw.amount = fr.unsigned_32(); |
344 | 414 | 415 | ||
345 | 415 | uint32_t nr_requests = fr.unsigned_32(); | 416 | uint32_t nr_requests = fr.unsigned_32(); |
346 | 416 | while (nr_requests--) { | 417 | while (nr_requests--) { |
347 | 417 | pw.requests.push_back(new Request(warehouse, 0, &Warehouse::request_cb, wwWORKER)); | 418 | pw.requests.push_back(new Request(warehouse, 0, &Warehouse::request_cb, wwWORKER)); |
349 | 418 | pw.requests.back()->read(fr, game, mol); | 419 | pw.requests.back()->read(fr, game, mol, tribes_lookup_table); |
350 | 419 | } | 420 | } |
351 | 420 | } | 421 | } |
352 | 421 | 422 | ||
353 | @@ -430,7 +431,7 @@ | |||
354 | 430 | // doesn't lend itself to request and other stuff. | 431 | // doesn't lend itself to request and other stuff. |
355 | 431 | if (warehouse.portdock_->expedition_started()) { | 432 | if (warehouse.portdock_->expedition_started()) { |
356 | 432 | warehouse.portdock_->expedition_bootstrap()->load( | 433 | warehouse.portdock_->expedition_bootstrap()->load( |
358 | 433 | warehouse, fr, game, mol, packet_version); | 434 | warehouse, fr, game, mol, tribes_lookup_table, packet_version); |
359 | 434 | } | 435 | } |
360 | 435 | } | 436 | } |
361 | 436 | } | 437 | } |
362 | @@ -463,7 +464,7 @@ | |||
363 | 463 | void MapBuildingdataPacket::read_militarysite(MilitarySite& militarysite, | 464 | void MapBuildingdataPacket::read_militarysite(MilitarySite& militarysite, |
364 | 464 | FileRead& fr, | 465 | FileRead& fr, |
365 | 465 | Game& game, | 466 | Game& game, |
367 | 466 | MapObjectLoader& mol) { | 467 | MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table) { |
368 | 467 | try { | 468 | try { |
369 | 468 | uint16_t const packet_version = fr.unsigned_16(); | 469 | uint16_t const packet_version = fr.unsigned_16(); |
370 | 469 | if (packet_version >= 5 && packet_version <= kCurrentPacketVersionMilitarysite) { | 470 | if (packet_version >= 5 && packet_version <= kCurrentPacketVersionMilitarysite) { |
371 | @@ -472,18 +473,20 @@ | |||
372 | 472 | if (fr.unsigned_8()) { | 473 | if (fr.unsigned_8()) { |
373 | 473 | militarysite.normal_soldier_request_.reset( | 474 | militarysite.normal_soldier_request_.reset( |
374 | 474 | new Request(militarysite, 0, MilitarySite::request_soldier_callback, wwWORKER)); | 475 | new Request(militarysite, 0, MilitarySite::request_soldier_callback, wwWORKER)); |
377 | 475 | militarysite.normal_soldier_request_->read(fr, game, mol); | 476 | militarysite.normal_soldier_request_->read(fr, game, mol, tribes_lookup_table); |
378 | 476 | } else | 477 | } else { |
379 | 477 | militarysite.normal_soldier_request_.reset(); | 478 | militarysite.normal_soldier_request_.reset(); |
380 | 479 | } | ||
381 | 478 | 480 | ||
382 | 479 | if (fr.unsigned_8()) { | 481 | if (fr.unsigned_8()) { |
383 | 480 | militarysite.upgrade_soldier_request_.reset(new Request( | 482 | militarysite.upgrade_soldier_request_.reset(new Request( |
384 | 481 | militarysite, | 483 | militarysite, |
385 | 482 | (!militarysite.normal_soldier_request_) ? 0 : militarysite.owner().tribe().soldier(), | 484 | (!militarysite.normal_soldier_request_) ? 0 : militarysite.owner().tribe().soldier(), |
386 | 483 | MilitarySite::request_soldier_callback, wwWORKER)); | 485 | MilitarySite::request_soldier_callback, wwWORKER)); |
389 | 484 | militarysite.upgrade_soldier_request_->read(fr, game, mol); | 486 | militarysite.upgrade_soldier_request_->read(fr, game, mol, tribes_lookup_table); |
390 | 485 | } else | 487 | } else { |
391 | 486 | militarysite.upgrade_soldier_request_.reset(); | 488 | militarysite.upgrade_soldier_request_.reset(); |
392 | 489 | } | ||
393 | 487 | 490 | ||
394 | 488 | if ((militarysite.didconquer_ = fr.unsigned_8())) { | 491 | if ((militarysite.didconquer_ = fr.unsigned_8())) { |
395 | 489 | // Add to map of military influence. | 492 | // Add to map of military influence. |
396 | @@ -549,7 +552,7 @@ | |||
397 | 549 | void MapBuildingdataPacket::read_productionsite(ProductionSite& productionsite, | 552 | void MapBuildingdataPacket::read_productionsite(ProductionSite& productionsite, |
398 | 550 | FileRead& fr, | 553 | FileRead& fr, |
399 | 551 | Game& game, | 554 | Game& game, |
401 | 552 | MapObjectLoader& mol) { | 555 | MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table) { |
402 | 553 | try { | 556 | try { |
403 | 554 | uint16_t const packet_version = fr.unsigned_16(); | 557 | uint16_t const packet_version = fr.unsigned_16(); |
404 | 555 | // TODO(GunChleoc): Savegame compatibility, remove after Build 21. | 558 | // TODO(GunChleoc): Savegame compatibility, remove after Build 21. |
405 | @@ -562,7 +565,7 @@ | |||
406 | 562 | for (uint16_t i = nr_worker_requests; i; --i) { | 565 | for (uint16_t i = nr_worker_requests; i; --i) { |
407 | 563 | Request& req = | 566 | Request& req = |
408 | 564 | *new Request(productionsite, 0, ProductionSite::request_worker_callback, wwWORKER); | 567 | *new Request(productionsite, 0, ProductionSite::request_worker_callback, wwWORKER); |
410 | 565 | req.read(fr, game, mol); | 568 | req.read(fr, game, mol, tribes_lookup_table); |
411 | 566 | const DescriptionIndex& worker_index = req.get_index(); | 569 | const DescriptionIndex& worker_index = req.get_index(); |
412 | 567 | 570 | ||
413 | 568 | // Find a working position that matches this request. | 571 | // Find a working position that matches this request. |
414 | @@ -587,8 +590,9 @@ | |||
415 | 587 | } | 590 | } |
416 | 588 | found_working_position = true; | 591 | found_working_position = true; |
417 | 589 | break; | 592 | break; |
419 | 590 | } else | 593 | } else { |
420 | 591 | wp += count; | 594 | wp += count; |
421 | 595 | } | ||
422 | 592 | } | 596 | } |
423 | 593 | 597 | ||
424 | 594 | if (!found_working_position) | 598 | if (!found_working_position) |
425 | @@ -682,7 +686,7 @@ | |||
426 | 682 | assert(!productionsite.input_queues_.size()); | 686 | assert(!productionsite.input_queues_.size()); |
427 | 683 | for (uint16_t i = 0; i < nr_queues; ++i) { | 687 | for (uint16_t i = 0; i < nr_queues; ++i) { |
428 | 684 | WaresQueue* wq = new WaresQueue(productionsite, INVALID_INDEX, 0); | 688 | WaresQueue* wq = new WaresQueue(productionsite, INVALID_INDEX, 0); |
430 | 685 | wq->read(fr, game, mol); | 689 | wq->read(fr, game, mol, tribes_lookup_table); |
431 | 686 | 690 | ||
432 | 687 | if (!game.tribes().ware_exists(wq->get_index())) { | 691 | if (!game.tribes().ware_exists(wq->get_index())) { |
433 | 688 | delete wq; | 692 | delete wq; |
434 | @@ -695,7 +699,7 @@ | |||
435 | 695 | nr_queues = fr.unsigned_16(); | 699 | nr_queues = fr.unsigned_16(); |
436 | 696 | for (uint16_t i = 0; i < nr_queues; ++i) { | 700 | for (uint16_t i = 0; i < nr_queues; ++i) { |
437 | 697 | WorkersQueue* wq = new WorkersQueue(productionsite, INVALID_INDEX, 0); | 701 | WorkersQueue* wq = new WorkersQueue(productionsite, INVALID_INDEX, 0); |
439 | 698 | wq->read(fr, game, mol); | 702 | wq->read(fr, game, mol, tribes_lookup_table); |
440 | 699 | 703 | ||
441 | 700 | if (!game.tribes().worker_exists(wq->get_index())) { | 704 | if (!game.tribes().worker_exists(wq->get_index())) { |
442 | 701 | delete wq; | 705 | delete wq; |
443 | @@ -732,18 +736,18 @@ | |||
444 | 732 | void MapBuildingdataPacket::read_trainingsite(TrainingSite& trainingsite, | 736 | void MapBuildingdataPacket::read_trainingsite(TrainingSite& trainingsite, |
445 | 733 | FileRead& fr, | 737 | FileRead& fr, |
446 | 734 | Game& game, | 738 | Game& game, |
448 | 735 | MapObjectLoader& mol) { | 739 | MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table) { |
449 | 736 | try { | 740 | try { |
450 | 737 | uint16_t const packet_version = fr.unsigned_16(); | 741 | uint16_t const packet_version = fr.unsigned_16(); |
451 | 738 | if (packet_version == kCurrentPacketVersionTrainingsite) { | 742 | if (packet_version == kCurrentPacketVersionTrainingsite) { |
453 | 739 | read_productionsite(trainingsite, fr, game, mol); | 743 | read_productionsite(trainingsite, fr, game, mol, tribes_lookup_table); |
454 | 740 | 744 | ||
455 | 741 | delete trainingsite.soldier_request_; | 745 | delete trainingsite.soldier_request_; |
456 | 742 | trainingsite.soldier_request_ = nullptr; | 746 | trainingsite.soldier_request_ = nullptr; |
457 | 743 | if (fr.unsigned_8()) { | 747 | if (fr.unsigned_8()) { |
458 | 744 | trainingsite.soldier_request_ = | 748 | trainingsite.soldier_request_ = |
459 | 745 | new Request(trainingsite, 0, TrainingSite::request_soldier_callback, wwWORKER); | 749 | new Request(trainingsite, 0, TrainingSite::request_soldier_callback, wwWORKER); |
461 | 746 | trainingsite.soldier_request_->read(fr, game, mol); | 750 | trainingsite.soldier_request_->read(fr, game, mol, tribes_lookup_table); |
462 | 747 | } | 751 | } |
463 | 748 | 752 | ||
464 | 749 | trainingsite.capacity_ = fr.unsigned_8(); | 753 | trainingsite.capacity_ = fr.unsigned_8(); |
465 | 750 | 754 | ||
466 | === modified file 'src/map_io/map_buildingdata_packet.h' | |||
467 | --- src/map_io/map_buildingdata_packet.h 2019-02-23 11:00:49 +0000 | |||
468 | +++ src/map_io/map_buildingdata_packet.h 2019-06-08 16:55:17 +0000 | |||
469 | @@ -21,6 +21,7 @@ | |||
470 | 21 | #define WL_MAP_IO_MAP_BUILDINGDATA_PACKET_H | 21 | #define WL_MAP_IO_MAP_BUILDINGDATA_PACKET_H |
471 | 22 | 22 | ||
472 | 23 | #include "map_io/map_data_packet.h" | 23 | #include "map_io/map_data_packet.h" |
473 | 24 | #include "map_io/tribes_legacy_lookup_table.h" | ||
474 | 24 | 25 | ||
475 | 25 | class FileRead; | 26 | class FileRead; |
476 | 26 | class FileWrite; | 27 | class FileWrite; |
477 | @@ -42,18 +43,18 @@ | |||
478 | 42 | */ | 43 | */ |
479 | 43 | class MapBuildingdataPacket { | 44 | class MapBuildingdataPacket { |
480 | 44 | public: | 45 | public: |
482 | 45 | void read(FileSystem&, EditorGameBase&, bool, MapObjectLoader&); | 46 | void read(FileSystem&, EditorGameBase&, bool, MapObjectLoader&, const TribesLegacyLookupTable& tribes_lookup_table); |
483 | 46 | void write(FileSystem&, EditorGameBase&, MapObjectSaver&); | 47 | void write(FileSystem&, EditorGameBase&, MapObjectSaver&); |
484 | 47 | 48 | ||
485 | 48 | private: | 49 | private: |
488 | 49 | void read_constructionsite(ConstructionSite&, FileRead&, Game&, MapObjectLoader&); | 50 | void read_constructionsite(ConstructionSite&, FileRead&, Game&, MapObjectLoader&, const TribesLegacyLookupTable& tribes_lookup_table); |
489 | 50 | void read_dismantlesite(DismantleSite&, FileRead&, Game&, MapObjectLoader&); | 51 | void read_dismantlesite(DismantleSite&, FileRead&, Game&, MapObjectLoader&, const TribesLegacyLookupTable& tribes_lookup_table); |
490 | 51 | void | 52 | void |
496 | 52 | read_partially_finished_building(PartiallyFinishedBuilding&, FileRead&, Game&, MapObjectLoader&); | 53 | read_partially_finished_building(PartiallyFinishedBuilding&, FileRead&, Game&, MapObjectLoader&, const TribesLegacyLookupTable& tribes_lookup_table); |
497 | 53 | void read_warehouse(Warehouse&, FileRead&, Game&, MapObjectLoader&); | 54 | void read_warehouse(Warehouse&, FileRead&, Game&, MapObjectLoader&, const TribesLegacyLookupTable& tribes_lookup_table); |
498 | 54 | void read_militarysite(MilitarySite&, FileRead&, Game&, MapObjectLoader&); | 55 | void read_militarysite(MilitarySite&, FileRead&, Game&, MapObjectLoader&, const TribesLegacyLookupTable& tribes_lookup_table); |
499 | 55 | void read_trainingsite(TrainingSite&, FileRead&, Game&, MapObjectLoader&); | 56 | void read_trainingsite(TrainingSite&, FileRead&, Game&, MapObjectLoader&, const TribesLegacyLookupTable& tribes_lookup_table); |
500 | 56 | void read_productionsite(ProductionSite&, FileRead&, Game&, MapObjectLoader&); | 57 | void read_productionsite(ProductionSite&, FileRead&, Game&, MapObjectLoader&, const TribesLegacyLookupTable& tribes_lookup_table); |
501 | 57 | 58 | ||
502 | 58 | void write_constructionsite(const ConstructionSite&, FileWrite&, Game&, MapObjectSaver&); | 59 | void write_constructionsite(const ConstructionSite&, FileWrite&, Game&, MapObjectSaver&); |
503 | 59 | void write_dismantlesite(const DismantleSite&, FileWrite&, Game&, MapObjectSaver&); | 60 | void write_dismantlesite(const DismantleSite&, FileWrite&, Game&, MapObjectSaver&); |
504 | 60 | 61 | ||
505 | === modified file 'src/map_io/map_flagdata_packet.cc' | |||
506 | --- src/map_io/map_flagdata_packet.cc 2019-02-23 11:00:49 +0000 | |||
507 | +++ src/map_io/map_flagdata_packet.cc 2019-06-08 16:55:17 +0000 | |||
508 | @@ -43,7 +43,7 @@ | |||
509 | 43 | void MapFlagdataPacket::read(FileSystem& fs, | 43 | void MapFlagdataPacket::read(FileSystem& fs, |
510 | 44 | EditorGameBase& egbase, | 44 | EditorGameBase& egbase, |
511 | 45 | bool const skip, | 45 | bool const skip, |
513 | 46 | MapObjectLoader& mol) { | 46 | MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table) { |
514 | 47 | if (skip) | 47 | if (skip) |
515 | 48 | return; | 48 | return; |
516 | 49 | 49 | ||
517 | @@ -131,7 +131,7 @@ | |||
518 | 131 | Flag::FlagJob f; | 131 | Flag::FlagJob f; |
519 | 132 | if (fr.unsigned_8()) { | 132 | if (fr.unsigned_8()) { |
520 | 133 | f.request = new Request(flag, 0, Flag::flag_job_request_callback, wwWORKER); | 133 | f.request = new Request(flag, 0, Flag::flag_job_request_callback, wwWORKER); |
522 | 134 | f.request->read(fr, dynamic_cast<Game&>(egbase), mol); | 134 | f.request->read(fr, dynamic_cast<Game&>(egbase), mol, tribes_lookup_table); |
523 | 135 | } else { | 135 | } else { |
524 | 136 | f.request = nullptr; | 136 | f.request = nullptr; |
525 | 137 | } | 137 | } |
526 | 138 | 138 | ||
527 | === modified file 'src/map_io/map_flagdata_packet.h' | |||
528 | --- src/map_io/map_flagdata_packet.h 2019-02-23 11:00:49 +0000 | |||
529 | +++ src/map_io/map_flagdata_packet.h 2019-06-08 16:55:17 +0000 | |||
530 | @@ -21,7 +21,14 @@ | |||
531 | 21 | #define WL_MAP_IO_MAP_FLAGDATA_PACKET_H | 21 | #define WL_MAP_IO_MAP_FLAGDATA_PACKET_H |
532 | 22 | 22 | ||
533 | 23 | #include "map_io/map_data_packet.h" | 23 | #include "map_io/map_data_packet.h" |
534 | 24 | #include "map_io/tribes_legacy_lookup_table.h" | ||
535 | 24 | 25 | ||
537 | 25 | MAP_DATA_PACKET(MapFlagdataPacket) | 26 | namespace Widelands { |
538 | 27 | class MapFlagdataPacket { | ||
539 | 28 | public: | ||
540 | 29 | void read(FileSystem&, EditorGameBase&, bool, MapObjectLoader&, const TribesLegacyLookupTable& tribes_lookup_table); | ||
541 | 30 | void write(FileSystem&, EditorGameBase&, MapObjectSaver&); | ||
542 | 31 | }; | ||
543 | 32 | } | ||
544 | 26 | 33 | ||
545 | 27 | #endif // end of include guard: WL_MAP_IO_MAP_FLAGDATA_PACKET_H | 34 | #endif // end of include guard: WL_MAP_IO_MAP_FLAGDATA_PACKET_H |
546 | 28 | 35 | ||
547 | === modified file 'src/map_io/map_object_packet.cc' | |||
548 | --- src/map_io/map_object_packet.cc 2019-02-23 11:00:49 +0000 | |||
549 | +++ src/map_io/map_object_packet.cc 2019-06-08 16:55:17 +0000 | |||
550 | @@ -49,7 +49,7 @@ | |||
551 | 49 | EditorGameBase& egbase, | 49 | EditorGameBase& egbase, |
552 | 50 | MapObjectLoader& mol, | 50 | MapObjectLoader& mol, |
553 | 51 | const WorldLegacyLookupTable& world_lookup_table, | 51 | const WorldLegacyLookupTable& world_lookup_table, |
555 | 52 | const TribesLegacyLookupTable& tribe_lookup_table) { | 52 | const TribesLegacyLookupTable& tribes_lookup_table) { |
556 | 53 | try { | 53 | try { |
557 | 54 | FileRead fr; | 54 | FileRead fr; |
558 | 55 | fr.open(fs, "binary/mapobjects"); | 55 | fr.open(fs, "binary/mapobjects"); |
559 | @@ -66,7 +66,7 @@ | |||
560 | 66 | return; | 66 | return; |
561 | 67 | case MapObject::HeaderImmovable: | 67 | case MapObject::HeaderImmovable: |
562 | 68 | loaders.insert( | 68 | loaders.insert( |
564 | 69 | Immovable::load(egbase, mol, fr, world_lookup_table, tribe_lookup_table)); | 69 | Immovable::load(egbase, mol, fr, world_lookup_table, tribes_lookup_table)); |
565 | 70 | break; | 70 | break; |
566 | 71 | 71 | ||
567 | 72 | case MapObject::HeaderBattle: | 72 | case MapObject::HeaderBattle: |
568 | @@ -81,11 +81,11 @@ | |||
569 | 81 | // We can't use the worker's savegame version, because some stuff is loaded before | 81 | // We can't use the worker's savegame version, because some stuff is loaded before |
570 | 82 | // that | 82 | // that |
571 | 83 | // packet version, and we removed the tribe name. | 83 | // packet version, and we removed the tribe name. |
573 | 84 | loaders.insert(Worker::load(egbase, mol, fr, tribe_lookup_table, packet_version)); | 84 | loaders.insert(Worker::load(egbase, mol, fr, tribes_lookup_table, packet_version)); |
574 | 85 | break; | 85 | break; |
575 | 86 | 86 | ||
576 | 87 | case MapObject::HeaderWareInstance: | 87 | case MapObject::HeaderWareInstance: |
578 | 88 | loaders.insert(WareInstance::load(egbase, mol, fr, tribe_lookup_table)); | 88 | loaders.insert(WareInstance::load(egbase, mol, fr, tribes_lookup_table)); |
579 | 89 | break; | 89 | break; |
580 | 90 | 90 | ||
581 | 91 | case MapObject::HeaderShip: | 91 | case MapObject::HeaderShip: |
582 | 92 | 92 | ||
583 | === modified file 'src/map_io/map_object_packet.h' | |||
584 | --- src/map_io/map_object_packet.h 2019-02-23 11:00:49 +0000 | |||
585 | +++ src/map_io/map_object_packet.h 2019-06-08 16:55:17 +0000 | |||
586 | @@ -57,7 +57,7 @@ | |||
587 | 57 | EditorGameBase&, | 57 | EditorGameBase&, |
588 | 58 | MapObjectLoader&, | 58 | MapObjectLoader&, |
589 | 59 | const WorldLegacyLookupTable& world_lookup_table, | 59 | const WorldLegacyLookupTable& world_lookup_table, |
591 | 60 | const TribesLegacyLookupTable& tribe_lookup_table); | 60 | const TribesLegacyLookupTable& tribes_lookup_table); |
592 | 61 | 61 | ||
593 | 62 | void load_finish(); | 62 | void load_finish(); |
594 | 63 | 63 | ||
595 | 64 | 64 | ||
596 | === modified file 'src/map_io/map_players_view_packet.cc' | |||
597 | --- src/map_io/map_players_view_packet.cc 2019-04-09 16:43:49 +0000 | |||
598 | +++ src/map_io/map_players_view_packet.cc 2019-06-08 16:55:17 +0000 | |||
599 | @@ -192,17 +192,17 @@ | |||
600 | 192 | }; | 192 | }; |
601 | 193 | 193 | ||
602 | 194 | // reads an immovable depending on whether it is a tribe or world immovable | 194 | // reads an immovable depending on whether it is a tribe or world immovable |
604 | 195 | const ImmovableDescr& read_immovable_type(StreamRead* fr, const EditorGameBase& egbase) { | 195 | const ImmovableDescr& read_immovable_type(StreamRead* fr, const EditorGameBase& egbase, const TribesLegacyLookupTable& tribes_lookup_table, const WorldLegacyLookupTable& world_lookup_table) { |
605 | 196 | uint8_t owner = fr->unsigned_8(); | 196 | uint8_t owner = fr->unsigned_8(); |
606 | 197 | char const* const name = fr->c_string(); | 197 | char const* const name = fr->c_string(); |
607 | 198 | if (owner == static_cast<uint8_t>(MapObjectDescr::OwnerType::kWorld)) { | 198 | if (owner == static_cast<uint8_t>(MapObjectDescr::OwnerType::kWorld)) { |
609 | 199 | DescriptionIndex const index = egbase.world().get_immovable_index(name); | 199 | DescriptionIndex const index = egbase.world().get_immovable_index(world_lookup_table.lookup_immovable(name)); |
610 | 200 | if (index == Widelands::INVALID_INDEX) | 200 | if (index == Widelands::INVALID_INDEX) |
611 | 201 | throw WorldImmovableNonexistent(name); | 201 | throw WorldImmovableNonexistent(name); |
612 | 202 | return *egbase.world().get_immovable_descr(index); | 202 | return *egbase.world().get_immovable_descr(index); |
613 | 203 | } else { | 203 | } else { |
614 | 204 | assert(owner == static_cast<uint8_t>(MapObjectDescr::OwnerType::kTribe)); | 204 | assert(owner == static_cast<uint8_t>(MapObjectDescr::OwnerType::kTribe)); |
616 | 205 | DescriptionIndex const index = egbase.tribes().immovable_index(name); | 205 | DescriptionIndex const index = egbase.tribes().immovable_index(tribes_lookup_table.lookup_immovable(name)); |
617 | 206 | if (index == Widelands::INVALID_INDEX) | 206 | if (index == Widelands::INVALID_INDEX) |
618 | 207 | throw TribeImmovableNonexistent(name); | 207 | throw TribeImmovableNonexistent(name); |
619 | 208 | return *egbase.tribes().get_immovable_descr(index); | 208 | return *egbase.tribes().get_immovable_descr(index); |
620 | @@ -238,7 +238,7 @@ | |||
621 | 238 | 238 | ||
622 | 239 | inline static MapObjectData read_unseen_immovable(const EditorGameBase& egbase, | 239 | inline static MapObjectData read_unseen_immovable(const EditorGameBase& egbase, |
623 | 240 | uint8_t& immovable_kind, | 240 | uint8_t& immovable_kind, |
625 | 241 | FileRead& immovables_file, | 241 | FileRead& immovables_file, const TribesLegacyLookupTable& tribes_lookup_table, const WorldLegacyLookupTable& world_lookup_table, |
626 | 242 | uint8_t& version) { | 242 | uint8_t& version) { |
627 | 243 | MapObjectData m; | 243 | MapObjectData m; |
628 | 244 | try { | 244 | try { |
629 | @@ -247,7 +247,7 @@ | |||
630 | 247 | m.map_object_descr = nullptr; | 247 | m.map_object_descr = nullptr; |
631 | 248 | break; | 248 | break; |
632 | 249 | case UNSEEN_TRIBEORWORLD: // The player sees a tribe or world immovable. | 249 | case UNSEEN_TRIBEORWORLD: // The player sees a tribe or world immovable. |
634 | 250 | m.map_object_descr = &read_immovable_type(&immovables_file, egbase); | 250 | m.map_object_descr = &read_immovable_type(&immovables_file, egbase, tribes_lookup_table, world_lookup_table); |
635 | 251 | break; | 251 | break; |
636 | 252 | case UNSEEN_FLAG: // The player sees a flag. | 252 | case UNSEEN_FLAG: // The player sees a flag. |
637 | 253 | m.map_object_descr = &g_flag_descr; | 253 | m.map_object_descr = &g_flag_descr; |
638 | @@ -284,7 +284,7 @@ | |||
639 | 284 | void MapPlayersViewPacket::read(FileSystem& fs, | 284 | void MapPlayersViewPacket::read(FileSystem& fs, |
640 | 285 | EditorGameBase& egbase, | 285 | EditorGameBase& egbase, |
641 | 286 | bool const skip, | 286 | bool const skip, |
643 | 287 | MapObjectLoader&) | 287 | MapObjectLoader&, const TribesLegacyLookupTable& tribes_lookup_table, const WorldLegacyLookupTable& world_lookup_table) |
644 | 288 | 288 | ||
645 | 289 | { | 289 | { |
646 | 290 | if (skip) | 290 | if (skip) |
647 | @@ -559,7 +559,7 @@ | |||
648 | 559 | kCurrentPacketVersionImmovableKinds); | 559 | kCurrentPacketVersionImmovableKinds); |
649 | 560 | } | 560 | } |
650 | 561 | MapObjectData mod = read_unseen_immovable( | 561 | MapObjectData mod = read_unseen_immovable( |
652 | 562 | egbase, imm_kind, node_immovables_file, node_immovables_file_version); | 562 | egbase, imm_kind, node_immovables_file, tribes_lookup_table, world_lookup_table, node_immovables_file_version); |
653 | 563 | f_player_field.map_object_descr = mod.map_object_descr; | 563 | f_player_field.map_object_descr = mod.map_object_descr; |
654 | 564 | f_player_field.constructionsite = mod.csi; | 564 | f_player_field.constructionsite = mod.csi; |
655 | 565 | 565 | ||
656 | @@ -633,7 +633,7 @@ | |||
657 | 633 | // TODO(sirver): Remove this logic the next time we break | 633 | // TODO(sirver): Remove this logic the next time we break |
658 | 634 | // savegame compatibility. | 634 | // savegame compatibility. |
659 | 635 | read_unseen_immovable( | 635 | read_unseen_immovable( |
661 | 636 | egbase, im_kind, triangle_immovables_file, triangle_immovables_file_version); | 636 | egbase, im_kind, triangle_immovables_file, tribes_lookup_table, world_lookup_table, triangle_immovables_file_version); |
662 | 637 | } | 637 | } |
663 | 638 | if (f_seen | br_seen | r_seen) { | 638 | if (f_seen | br_seen | r_seen) { |
664 | 639 | // The player currently sees the R triangle. Therefore his | 639 | // The player currently sees the R triangle. Therefore his |
665 | @@ -662,7 +662,7 @@ | |||
666 | 662 | // suporting immovables on the triangles instead as on the | 662 | // suporting immovables on the triangles instead as on the |
667 | 663 | // nodes. | 663 | // nodes. |
668 | 664 | read_unseen_immovable( | 664 | read_unseen_immovable( |
670 | 665 | egbase, im_kind, triangle_immovables_file, triangle_immovables_file_version); | 665 | egbase, im_kind, triangle_immovables_file, tribes_lookup_table, world_lookup_table, triangle_immovables_file_version); |
671 | 666 | } | 666 | } |
672 | 667 | 667 | ||
673 | 668 | { // edges | 668 | { // edges |
674 | 669 | 669 | ||
675 | === modified file 'src/map_io/map_players_view_packet.h' | |||
676 | --- src/map_io/map_players_view_packet.h 2019-02-23 11:00:49 +0000 | |||
677 | +++ src/map_io/map_players_view_packet.h 2019-06-08 16:55:17 +0000 | |||
678 | @@ -21,6 +21,10 @@ | |||
679 | 21 | #define WL_MAP_IO_MAP_PLAYERS_VIEW_PACKET_H | 21 | #define WL_MAP_IO_MAP_PLAYERS_VIEW_PACKET_H |
680 | 22 | 22 | ||
681 | 23 | #include "map_io/map_data_packet.h" | 23 | #include "map_io/map_data_packet.h" |
682 | 24 | #include "map_io/tribes_legacy_lookup_table.h" | ||
683 | 25 | #include "map_io/world_legacy_lookup_table.h" | ||
684 | 26 | |||
685 | 27 | namespace Widelands { | ||
686 | 24 | 28 | ||
687 | 25 | /// For each player, its view of each node, edge and triangle that he has seen | 29 | /// For each player, its view of each node, edge and triangle that he has seen |
688 | 26 | /// but does not see currently. Information that he currently sees is not | 30 | /// but does not see currently. Information that he currently sees is not |
689 | @@ -31,6 +35,11 @@ | |||
690 | 31 | /// This information can not be loaded before the terrains, roads, immovables | 35 | /// This information can not be loaded before the terrains, roads, immovables |
691 | 32 | /// and players' vision maps are loaded. The vision maps are completely loaded | 36 | /// and players' vision maps are loaded. The vision maps are completely loaded |
692 | 33 | /// after MapBobdataPacket has been loaded. | 37 | /// after MapBobdataPacket has been loaded. |
694 | 34 | MAP_DATA_PACKET(MapPlayersViewPacket) | 38 | class MapPlayersViewPacket { |
695 | 39 | public: | ||
696 | 40 | void read(FileSystem&, EditorGameBase&, bool, MapObjectLoader&, const TribesLegacyLookupTable& tribes_lookup_table, const WorldLegacyLookupTable& world_lookup_table); | ||
697 | 41 | void write(FileSystem&, EditorGameBase&, MapObjectSaver&); | ||
698 | 42 | }; | ||
699 | 43 | } | ||
700 | 35 | 44 | ||
701 | 36 | #endif // end of include guard: WL_MAP_IO_MAP_PLAYERS_VIEW_PACKET_H | 45 | #endif // end of include guard: WL_MAP_IO_MAP_PLAYERS_VIEW_PACKET_H |
702 | 37 | 46 | ||
703 | === modified file 'src/map_io/map_roaddata_packet.cc' | |||
704 | --- src/map_io/map_roaddata_packet.cc 2019-02-23 11:00:49 +0000 | |||
705 | +++ src/map_io/map_roaddata_packet.cc 2019-06-08 16:55:17 +0000 | |||
706 | @@ -44,7 +44,7 @@ | |||
707 | 44 | void MapRoaddataPacket::read(FileSystem& fs, | 44 | void MapRoaddataPacket::read(FileSystem& fs, |
708 | 45 | EditorGameBase& egbase, | 45 | EditorGameBase& egbase, |
709 | 46 | bool const skip, | 46 | bool const skip, |
711 | 47 | MapObjectLoader& mol) { | 47 | MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table) { |
712 | 48 | if (skip) | 48 | if (skip) |
713 | 49 | return; | 49 | return; |
714 | 50 | 50 | ||
715 | @@ -136,7 +136,7 @@ | |||
716 | 136 | if (fr.unsigned_8()) { | 136 | if (fr.unsigned_8()) { |
717 | 137 | (carrier_request = | 137 | (carrier_request = |
718 | 138 | new Request(road, 0, Road::request_carrier_callback, wwWORKER)) | 138 | new Request(road, 0, Road::request_carrier_callback, wwWORKER)) |
720 | 139 | ->read(fr, game, mol); | 139 | ->read(fr, game, mol, tribes_lookup_table); |
721 | 140 | } else { | 140 | } else { |
722 | 141 | carrier_request = nullptr; | 141 | carrier_request = nullptr; |
723 | 142 | } | 142 | } |
724 | 143 | 143 | ||
725 | === modified file 'src/map_io/map_roaddata_packet.h' | |||
726 | --- src/map_io/map_roaddata_packet.h 2019-02-23 11:00:49 +0000 | |||
727 | +++ src/map_io/map_roaddata_packet.h 2019-06-08 16:55:17 +0000 | |||
728 | @@ -21,11 +21,18 @@ | |||
729 | 21 | #define WL_MAP_IO_MAP_ROADDATA_PACKET_H | 21 | #define WL_MAP_IO_MAP_ROADDATA_PACKET_H |
730 | 22 | 22 | ||
731 | 23 | #include "map_io/map_data_packet.h" | 23 | #include "map_io/map_data_packet.h" |
732 | 24 | #include "map_io/tribes_legacy_lookup_table.h" | ||
733 | 24 | 25 | ||
734 | 25 | /* | 26 | /* |
735 | 26 | * This parses the roads data (where it is, where it belongs to | 27 | * This parses the roads data (where it is, where it belongs to |
736 | 27 | * and so on) | 28 | * and so on) |
737 | 28 | */ | 29 | */ |
739 | 29 | MAP_DATA_PACKET(MapRoaddataPacket) | 30 | namespace Widelands { |
740 | 31 | class MapRoaddataPacket { | ||
741 | 32 | public: | ||
742 | 33 | void read(FileSystem&, EditorGameBase&, bool, MapObjectLoader&, const TribesLegacyLookupTable& tribes_lookup_table); | ||
743 | 34 | void write(FileSystem&, EditorGameBase&, MapObjectSaver&); | ||
744 | 35 | }; | ||
745 | 36 | } | ||
746 | 30 | 37 | ||
747 | 31 | #endif // end of include guard: WL_MAP_IO_MAP_ROADDATA_PACKET_H | 38 | #endif // end of include guard: WL_MAP_IO_MAP_ROADDATA_PACKET_H |
748 | 32 | 39 | ||
749 | === modified file 'src/map_io/tribes_legacy_lookup_table.cc' | |||
750 | --- src/map_io/tribes_legacy_lookup_table.cc 2019-05-25 10:47:18 +0000 | |||
751 | +++ src/map_io/tribes_legacy_lookup_table.cc 2019-06-08 16:55:17 +0000 | |||
752 | @@ -18,6 +18,7 @@ | |||
753 | 18 | */ | 18 | */ |
754 | 19 | 19 | ||
755 | 20 | #include "map_io/tribes_legacy_lookup_table.h" | 20 | #include "map_io/tribes_legacy_lookup_table.h" |
756 | 21 | |||
757 | 21 | // Whenever we break savegame compatibility, we can empty these maps | 22 | // Whenever we break savegame compatibility, we can empty these maps |
758 | 22 | TribesLegacyLookupTable::TribesLegacyLookupTable() | 23 | TribesLegacyLookupTable::TribesLegacyLookupTable() |
759 | 23 | : // Workers | 24 | : // Workers |
760 | @@ -36,7 +37,7 @@ | |||
761 | 36 | {"reed_medium", "reedfield_medium"}, | 37 | {"reed_medium", "reedfield_medium"}, |
762 | 37 | {"reed_small", "reedfield_small"}, | 38 | {"reed_small", "reedfield_small"}, |
763 | 38 | {"reed_tiny", "reedfield_tiny"}, | 39 | {"reed_tiny", "reedfield_tiny"}, |
765 | 39 | {"reed_tiny", "reedfield_ripe"}, | 40 | {"reed_ripe", "reedfield_ripe"}, |
766 | 40 | } { | 41 | } { |
767 | 41 | } | 42 | } |
768 | 42 | 43 | ||
769 | 43 | 44 | ||
770 | === modified file 'src/map_io/widelands_map_loader.cc' | |||
771 | --- src/map_io/widelands_map_loader.cc 2019-03-09 10:01:09 +0000 | |||
772 | +++ src/map_io/widelands_map_loader.cc 2019-06-08 16:55:17 +0000 | |||
773 | @@ -152,7 +152,7 @@ | |||
774 | 152 | 152 | ||
775 | 153 | std::unique_ptr<WorldLegacyLookupTable> world_lookup_table( | 153 | std::unique_ptr<WorldLegacyLookupTable> world_lookup_table( |
776 | 154 | create_world_legacy_lookup_table(old_world_name_)); | 154 | create_world_legacy_lookup_table(old_world_name_)); |
778 | 155 | std::unique_ptr<TribesLegacyLookupTable> tribe_lookup_table(new TribesLegacyLookupTable()); | 155 | std::unique_ptr<TribesLegacyLookupTable> tribes_lookup_table(new TribesLegacyLookupTable()); |
779 | 156 | log("Reading Terrain Data ... "); | 156 | log("Reading Terrain Data ... "); |
780 | 157 | { | 157 | { |
781 | 158 | MapTerrainPacket p; | 158 | MapTerrainPacket p; |
782 | @@ -163,7 +163,7 @@ | |||
783 | 163 | MapObjectPacket mapobjects; | 163 | MapObjectPacket mapobjects; |
784 | 164 | 164 | ||
785 | 165 | log("Reading Map Objects ... "); | 165 | log("Reading Map Objects ... "); |
787 | 166 | mapobjects.read(*fs_, egbase, *mol_, *world_lookup_table, *tribe_lookup_table); | 166 | mapobjects.read(*fs_, egbase, *mol_, *world_lookup_table, *tribes_lookup_table); |
788 | 167 | log("took %ums\n ", timer.ms_since_last_query()); | 167 | log("took %ums\n ", timer.ms_since_last_query()); |
789 | 168 | 168 | ||
790 | 169 | log("Reading Player Start Position Data ... "); | 169 | log("Reading Player Start Position Data ... "); |
791 | @@ -259,21 +259,21 @@ | |||
792 | 259 | log("Reading Flagdata Data ... "); | 259 | log("Reading Flagdata Data ... "); |
793 | 260 | { | 260 | { |
794 | 261 | MapFlagdataPacket p; | 261 | MapFlagdataPacket p; |
796 | 262 | p.read(*fs_, egbase, is_game, *mol_); | 262 | p.read(*fs_, egbase, is_game, *mol_, *tribes_lookup_table); |
797 | 263 | } | 263 | } |
798 | 264 | log("took %ums\n ", timer.ms_since_last_query()); | 264 | log("took %ums\n ", timer.ms_since_last_query()); |
799 | 265 | 265 | ||
800 | 266 | log("Reading Roaddata Data ... "); | 266 | log("Reading Roaddata Data ... "); |
801 | 267 | { | 267 | { |
802 | 268 | MapRoaddataPacket p; | 268 | MapRoaddataPacket p; |
804 | 269 | p.read(*fs_, egbase, is_game, *mol_); | 269 | p.read(*fs_, egbase, is_game, *mol_, *tribes_lookup_table); |
805 | 270 | } | 270 | } |
806 | 271 | log("took %ums\n ", timer.ms_since_last_query()); | 271 | log("took %ums\n ", timer.ms_since_last_query()); |
807 | 272 | 272 | ||
808 | 273 | log("Reading Buildingdata Data ... "); | 273 | log("Reading Buildingdata Data ... "); |
809 | 274 | { | 274 | { |
810 | 275 | MapBuildingdataPacket p; | 275 | MapBuildingdataPacket p; |
812 | 276 | p.read(*fs_, egbase, is_game, *mol_); | 276 | p.read(*fs_, egbase, is_game, *mol_, *tribes_lookup_table); |
813 | 277 | } | 277 | } |
814 | 278 | log("took %ums\n ", timer.ms_since_last_query()); | 278 | log("took %ums\n ", timer.ms_since_last_query()); |
815 | 279 | 279 | ||
816 | @@ -297,7 +297,7 @@ | |||
817 | 297 | log("Reading Players View Data ... "); | 297 | log("Reading Players View Data ... "); |
818 | 298 | { | 298 | { |
819 | 299 | MapPlayersViewPacket p; | 299 | MapPlayersViewPacket p; |
821 | 300 | p.read(*fs_, egbase, is_game, *mol_); | 300 | p.read(*fs_, egbase, is_game, *mol_, *tribes_lookup_table, *world_lookup_table); |
822 | 301 | } | 301 | } |
823 | 302 | log("took %ums\n ", timer.ms_since_last_query()); | 302 | log("took %ums\n ", timer.ms_since_last_query()); |
824 | 303 | 303 |
Continuous integration builds have changed state:
Travis build 5058. State: passed. Details: https:/ /travis- ci.org/ widelands/ widelands/ builds/ 537337141. /ci.appveyor. com/project/ widelands- dev/widelands/ build/_ widelands_ dev_widelands_ reed_compatibil ity-4838.
Appveyor build 4838. State: success. Details: https:/