@@ -83,7 +83,7 @@ int building_storage_yard::get_space_info() const {
83
83
return 0 ;
84
84
}
85
85
86
- if (space->subtype . warehouse_resource_id ) {
86
+ if (space->data . warehouse . resource_id ) {
87
87
total_amounts += space->stored_amount_first ;
88
88
} else {
89
89
empty_spaces++;
@@ -106,7 +106,7 @@ int building_storage_yard::amount(e_resource resource) const {
106
106
if (space->id <= 0 )
107
107
return 0 ;
108
108
109
- if (space->subtype . warehouse_resource_id && space->subtype . warehouse_resource_id == resource) {
109
+ if (space->data . warehouse . resource_id && space->data . warehouse . resource_id == resource) {
110
110
total += space->stored_amount_first ;
111
111
}
112
112
}
@@ -126,9 +126,9 @@ int building_storage_yard::freespace(e_resource resource) {
126
126
int freespace = 0 ;
127
127
building_storage_room* space = room ();
128
128
while (space) {
129
- if (!space->base . subtype . warehouse_resource_id ) {
129
+ if (!space->data . warehouse . resource_id ) {
130
130
freespace += 400 ;
131
- } else if (space->base . subtype . warehouse_resource_id == resource) {
131
+ } else if (space->data . warehouse . resource_id == resource) {
132
132
freespace += (400 - space->base .stored_amount_first );
133
133
}
134
134
space = space->next_room ();
@@ -140,7 +140,7 @@ int building_storage_yard::freespace() const {
140
140
int freespace = 0 ;
141
141
const building_storage_room* space = room ();
142
142
while (space) {
143
- if (!space->base . subtype . warehouse_resource_id ) {
143
+ if (!space->data . warehouse . resource_id ) {
144
144
freespace += 400 ;
145
145
}
146
146
space = space->next_room ();
@@ -158,7 +158,7 @@ int building_storage_yard::add_resource(e_resource resource, bool is_produced, i
158
158
159
159
// check the initial provided space itself, first
160
160
bool look_for_space = false ;
161
- if (base. subtype . warehouse_resource_id && base. subtype . warehouse_resource_id != resource) {
161
+ if (data. warehouse . resource_id && data. warehouse . resource_id != resource) {
162
162
look_for_space = true ;
163
163
} else if (base.stored_amount_first >= 400 ) {
164
164
look_for_space = true ;
@@ -174,7 +174,7 @@ int building_storage_yard::add_resource(e_resource resource, bool is_produced, i
174
174
if (look_for_space) {
175
175
bool space_found = false ;
176
176
while (space) {
177
- if (!space->base . subtype . warehouse_resource_id || space->base . subtype . warehouse_resource_id == resource) {
177
+ if (!space->data . warehouse . resource_id || space->data . warehouse . resource_id == resource) {
178
178
if (space->base .stored_amount_first < 400 ) {
179
179
space_found = true ;
180
180
break ;
@@ -189,7 +189,7 @@ int building_storage_yard::add_resource(e_resource resource, bool is_produced, i
189
189
}
190
190
191
191
city_resource_add_to_storageyard (resource, 1 );
192
- space->base . subtype . warehouse_resource_id = resource;
192
+ space->data . warehouse . resource_id = resource;
193
193
int space_on_tile = 400 - space->base .stored_amount_first ;
194
194
int unloading_amount = std::min<int >(space_on_tile, amount_left);
195
195
space->base .stored_amount_first += unloading_amount;
@@ -214,7 +214,7 @@ int building_storage_yard::remove_resource(e_resource resource, int amount) {
214
214
if (amount <= 0 )
215
215
return 0 ;
216
216
217
- if (space->base . subtype . warehouse_resource_id != resource || space->base .stored_amount_first <= 0 ) {
217
+ if (space->data . warehouse . resource_id != resource || space->base .stored_amount_first <= 0 ) {
218
218
space = space->next_room ();
219
219
continue ;
220
220
}
@@ -228,7 +228,7 @@ int building_storage_yard::remove_resource(e_resource resource, int amount) {
228
228
city_resource_remove_from_storageyard (resource, space->base .stored_amount_first );
229
229
amount -= space->base .stored_amount_first ;
230
230
space->base .stored_amount_first = 0 ;
231
- space->base . subtype . warehouse_resource_id = RESOURCE_NONE;
231
+ space->data . warehouse . resource_id = RESOURCE_NONE;
232
232
}
233
233
space->set_image (resource);
234
234
space = space->next_room ();
@@ -248,7 +248,7 @@ void building_storageyard_remove_resource_curse(building* b, int amount) {
248
248
continue ;
249
249
}
250
250
251
- e_resource resource = space->base . subtype . warehouse_resource_id ;
251
+ e_resource resource = space->data . warehouse . resource_id ;
252
252
if (space->base .stored_amount_first > amount) {
253
253
city_resource_remove_from_storageyard (resource, amount);
254
254
space->base .stored_amount_first -= amount;
@@ -257,7 +257,7 @@ void building_storageyard_remove_resource_curse(building* b, int amount) {
257
257
city_resource_remove_from_storageyard (resource, space->base .stored_amount_first );
258
258
amount -= space->base .stored_amount_first ;
259
259
space->base .stored_amount_first = 0 ;
260
- space->base . subtype . warehouse_resource_id = RESOURCE_NONE;
260
+ space->data . warehouse . resource_id = RESOURCE_NONE;
261
261
}
262
262
space->set_image (resource);
263
263
space = space->next_room ();
@@ -392,7 +392,7 @@ int building_storage_yard::for_getting(e_resource resource, tile2i* dst) {
392
392
const storage_t * s = space->storage ();
393
393
while (space) {
394
394
if (space->base .stored_amount_first > 0 ) {
395
- if (space->base . subtype . warehouse_resource_id == resource)
395
+ if (space->data . warehouse . resource_id == resource)
396
396
amounts_stored += space->base .stored_amount_first ;
397
397
}
398
398
space = space->next_room ();
@@ -463,7 +463,7 @@ static bool contains_non_stockpiled_food(building* space, const resource_list &f
463
463
return false ;
464
464
}
465
465
466
- e_resource resource = space->subtype . warehouse_resource_id ;
466
+ e_resource resource = space->data . warehouse . resource_id ;
467
467
if (city_resource_is_stockpiled (resource)) {
468
468
return false ;
469
469
}
@@ -490,7 +490,7 @@ storage_worker_task building_storage_yard_determine_getting_up_resources(buildin
490
490
room += 4 ;
491
491
}
492
492
493
- if (space->base . subtype . warehouse_resource_id == check_resource) { // found a space (tile) with resource on it!
493
+ if (space->data . warehouse . resource_id == check_resource) { // found a space (tile) with resource on it!
494
494
total_stored += space->base .stored_amount_first ; // add loads to total, if any!
495
495
room += 400 - space->base .stored_amount_first ; // add room to total, if any!
496
496
}
@@ -533,7 +533,7 @@ storage_worker_task building_storageyard_deliver_weapons(building *warehouse) {
533
533
for (int i = 0 ; i < 8 ; i++) {
534
534
space = space->next ();
535
535
if (space->id > 0 && space->stored_amount_first > 0
536
- && space->subtype . warehouse_resource_id == RESOURCE_WEAPONS) {
536
+ && space->data . warehouse . resource_id == RESOURCE_WEAPONS) {
537
537
available += space->stored_amount_first ;
538
538
}
539
539
}
@@ -564,7 +564,7 @@ storage_worker_task building_storageyard_deliver_timber_to_shipyard_school(build
564
564
for (int i = 0 ; i < 8 ; i++) {
565
565
space = space->next ();
566
566
if (space->id > 0 && space->stored_amount_first > 0
567
- && space->subtype . warehouse_resource_id == RESOURCE_TIMBER) {
567
+ && space->data . warehouse . resource_id == RESOURCE_TIMBER) {
568
568
available += space->stored_amount_first ;
569
569
}
570
570
}
@@ -594,7 +594,7 @@ storage_worker_task building_storageyard_deliver_papyrus_to_scribal_school(build
594
594
for (int i = 0 ; i < 8 ; i++) {
595
595
space = space->next ();
596
596
if (space->id > 0 && space->stored_amount_first > 0
597
- && space->subtype . warehouse_resource_id == RESOURCE_PAPYRUS) {
597
+ && space->data . warehouse . resource_id == RESOURCE_PAPYRUS) {
598
598
available += space->stored_amount_first ;
599
599
}
600
600
}
@@ -616,17 +616,17 @@ storage_worker_task building_storageyard_deliver_resource_to_workshop(building *
616
616
continue ;
617
617
}
618
618
619
- e_resource check_resource = space->subtype . warehouse_resource_id ;
619
+ e_resource check_resource = space->data . warehouse . resource_id ;
620
620
if (city_resource_is_stockpiled (check_resource)) {
621
621
continue ;
622
622
}
623
623
624
624
storage_worker_task task = {STORAGEYARD_TASK_NONE};
625
625
buildings_workshop_do ([&] (building &b) {
626
- if (!b.need_resource (space->subtype . warehouse_resource_id ) || b.need_resource_amount (check_resource) < 100 ) {
626
+ if (!b.need_resource (space->data . warehouse . resource_id ) || b.need_resource_amount (check_resource) < 100 ) {
627
627
return ;
628
628
}
629
- task = {STORAGEYARD_TASK_DELIVERING, space, 100 , space->subtype . warehouse_resource_id };
629
+ task = {STORAGEYARD_TASK_DELIVERING, space, 100 , space->data . warehouse . resource_id };
630
630
});
631
631
632
632
if (task.result == STORAGEYARD_TASK_DELIVERING) {
@@ -648,7 +648,7 @@ storage_worker_task building_storage_yard::deliver_food_to_gettingup_granary(bui
648
648
space = space->next ();
649
649
if (contains_non_stockpiled_food (space, granary_resources)) {
650
650
// always one load only for granaries?
651
- return {STORAGEYARD_TASK_DELIVERING, space, 100 , space->subtype . warehouse_resource_id };
651
+ return {STORAGEYARD_TASK_DELIVERING, space, 100 , space->data . warehouse . resource_id };
652
652
}
653
653
}
654
654
@@ -666,7 +666,7 @@ storage_worker_task building_storageyard_deliver_food_to_accepting_granary(build
666
666
space = space->next ();
667
667
if (contains_non_stockpiled_food (space, granary_resources)) {
668
668
// always one load only for granaries?
669
- return {STORAGEYARD_TASK_DELIVERING, space, 100 , space->subtype . warehouse_resource_id };
669
+ return {STORAGEYARD_TASK_DELIVERING, space, 100 , space->data . warehouse . resource_id };
670
670
}
671
671
}
672
672
}
@@ -691,11 +691,11 @@ storage_worker_task building_storageyard_deliver_to_monuments(building *warehous
691
691
for (int i = 0 ; i < 8 ; i++) {
692
692
space = space->next ();
693
693
int available = space->stored_amount_first ;
694
- if (space->id <= 0 || !space->subtype . warehouse_resource_id || available <= 0 ) {
694
+ if (space->id <= 0 || !space->data . warehouse . resource_id || available <= 0 ) {
695
695
continue ;
696
696
}
697
697
698
- e_resource resource = space->subtype . warehouse_resource_id ;
698
+ e_resource resource = space->data . warehouse . resource_id ;
699
699
if (city_resource_is_stockpiled (resource)) {
700
700
continue ;
701
701
}
@@ -764,7 +764,7 @@ storage_worker_task building_storage_yard::determine_worker_task() {
764
764
for (int i = 0 ; i < 8 ; i++) {
765
765
space = space->next ();
766
766
if (space->id > 0 && space->stored_amount_first > 0 ) {
767
- return {STORAGEYARD_TASK_DELIVERING, space, space->stored_amount_first , space->subtype . warehouse_resource_id };
767
+ return {STORAGEYARD_TASK_DELIVERING, space, space->stored_amount_first , space->data . warehouse . resource_id };
768
768
}
769
769
}
770
770
}
0 commit comments