|
14 | 14 | building g_all_buildings[5000];
|
15 | 15 | custom_span<building> g_city_buildings = make_span(g_all_buildings);
|
16 | 16 |
|
17 |
| -building *building_get(int id) { |
| 17 | +building *building_get(building_id id) { |
18 | 18 | return &g_all_buildings[id];
|
19 | 19 | }
|
20 | 20 |
|
21 | 21 | custom_span<building> &city_buildings() {
|
22 | 22 | return g_city_buildings;
|
23 | 23 | }
|
24 | 24 |
|
25 |
| -building *building_next(int i, e_building_type type) { |
26 |
| - for (; i < MAX_BUILDINGS; ++i) { |
27 |
| - building *b = building_get(i); |
| 25 | +building *building_next(building_id bid, e_building_type type) { |
| 26 | + for (; bid < MAX_BUILDINGS; ++bid) { |
| 27 | + building *b = building_get(bid); |
28 | 28 | if (b->state == BUILDING_STATE_VALID && b->type == type)
|
29 | 29 | return b;
|
30 | 30 | }
|
@@ -222,29 +222,6 @@ void building_update_state(void) {
|
222 | 222 | }
|
223 | 223 | }
|
224 | 224 |
|
225 |
| -static void io_type_data(io_buffer *iob, building *b, size_t version) { |
226 |
| - auto &data = b->data; |
227 |
| - |
228 |
| - b->dcast()->bind_dynamic(iob, version); |
229 |
| - if (building_is_temple_complex(b->type) || building_is_monument(b->type)) { |
230 |
| - iob->bind____skip(38); |
231 |
| - iob->bind(BIND_SIGNATURE_UINT8, &data.monuments.orientation); |
232 |
| - for (int i = 0; i < 5; i++) { |
233 |
| - iob->bind(BIND_SIGNATURE_UINT16, &data.monuments.workers[i]); |
234 |
| - } |
235 |
| - iob->bind(BIND_SIGNATURE_UINT8, &data.monuments.phase); |
236 |
| - iob->bind(BIND_SIGNATURE_UINT8, &data.monuments.statue_offset); |
237 |
| - iob->bind(BIND_SIGNATURE_UINT8, &data.monuments.temple_complex_attachments); |
238 |
| - iob->bind(BIND_SIGNATURE_UINT8, &data.monuments.variant); |
239 |
| - |
240 |
| - for (int i = 0; i < RESOURCES_MAX; i++) { |
241 |
| - iob->bind(BIND_SIGNATURE_UINT8, &data.monuments.resources_pct[i]); |
242 |
| - } |
243 |
| - } else { |
244 |
| - ; // nothing |
245 |
| - } |
246 |
| -} |
247 |
| - |
248 | 225 | io_buffer *iob_buildings = new io_buffer([] (io_buffer *iob, size_t version) {
|
249 | 226 | for (int i = 0; i < MAX_BUILDINGS; i++) {
|
250 | 227 | // building_state_load_from_buffer(buf, &all_buildings[i]);
|
@@ -308,7 +285,7 @@ io_buffer *iob_buildings = new io_buffer([] (io_buffer *iob, size_t version) {
|
308 | 285 | iob->bind(BIND_SIGNATURE_UINT8, &b->health_proof);
|
309 | 286 | iob->bind(BIND_SIGNATURE_INT16, &b->formation_id);
|
310 | 287 |
|
311 |
| - io_type_data(iob, b, version); // 102 for PH |
| 288 | + b->dcast()->bind_dynamic(iob, version); // 102 for PH |
312 | 289 |
|
313 | 290 | int currind = iob->get_offset() - sind;
|
314 | 291 | assert(currind > 0);
|
|
0 commit comments