@@ -83,7 +83,7 @@ int building_storage_yard::get_space_info() const {
8383 return 0 ;
8484 }
8585
86- if (space->subtype . warehouse_resource_id ) {
86+ if (space->data . warehouse . resource_id ) {
8787 total_amounts += space->stored_amount_first ;
8888 } else {
8989 empty_spaces++;
@@ -106,7 +106,7 @@ int building_storage_yard::amount(e_resource resource) const {
106106 if (space->id <= 0 )
107107 return 0 ;
108108
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) {
110110 total += space->stored_amount_first ;
111111 }
112112 }
@@ -126,9 +126,9 @@ int building_storage_yard::freespace(e_resource resource) {
126126 int freespace = 0 ;
127127 building_storage_room* space = room ();
128128 while (space) {
129- if (!space->base . subtype . warehouse_resource_id ) {
129+ if (!space->data . warehouse . resource_id ) {
130130 freespace += 400 ;
131- } else if (space->base . subtype . warehouse_resource_id == resource) {
131+ } else if (space->data . warehouse . resource_id == resource) {
132132 freespace += (400 - space->base .stored_amount_first );
133133 }
134134 space = space->next_room ();
@@ -140,7 +140,7 @@ int building_storage_yard::freespace() const {
140140 int freespace = 0 ;
141141 const building_storage_room* space = room ();
142142 while (space) {
143- if (!space->base . subtype . warehouse_resource_id ) {
143+ if (!space->data . warehouse . resource_id ) {
144144 freespace += 400 ;
145145 }
146146 space = space->next_room ();
@@ -158,7 +158,7 @@ int building_storage_yard::add_resource(e_resource resource, bool is_produced, i
158158
159159 // check the initial provided space itself, first
160160 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) {
162162 look_for_space = true ;
163163 } else if (base.stored_amount_first >= 400 ) {
164164 look_for_space = true ;
@@ -174,7 +174,7 @@ int building_storage_yard::add_resource(e_resource resource, bool is_produced, i
174174 if (look_for_space) {
175175 bool space_found = false ;
176176 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) {
178178 if (space->base .stored_amount_first < 400 ) {
179179 space_found = true ;
180180 break ;
@@ -189,7 +189,7 @@ int building_storage_yard::add_resource(e_resource resource, bool is_produced, i
189189 }
190190
191191 city_resource_add_to_storageyard (resource, 1 );
192- space->base . subtype . warehouse_resource_id = resource;
192+ space->data . warehouse . resource_id = resource;
193193 int space_on_tile = 400 - space->base .stored_amount_first ;
194194 int unloading_amount = std::min<int >(space_on_tile, amount_left);
195195 space->base .stored_amount_first += unloading_amount;
@@ -214,7 +214,7 @@ int building_storage_yard::remove_resource(e_resource resource, int amount) {
214214 if (amount <= 0 )
215215 return 0 ;
216216
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 ) {
218218 space = space->next_room ();
219219 continue ;
220220 }
@@ -228,7 +228,7 @@ int building_storage_yard::remove_resource(e_resource resource, int amount) {
228228 city_resource_remove_from_storageyard (resource, space->base .stored_amount_first );
229229 amount -= space->base .stored_amount_first ;
230230 space->base .stored_amount_first = 0 ;
231- space->base . subtype . warehouse_resource_id = RESOURCE_NONE ;
231+ space->data . warehouse . resource_id = RESOURCE_NONE ;
232232 }
233233 space->set_image (resource);
234234 space = space->next_room ();
@@ -248,7 +248,7 @@ void building_storageyard_remove_resource_curse(building* b, int amount) {
248248 continue ;
249249 }
250250
251- e_resource resource = space->base . subtype . warehouse_resource_id ;
251+ e_resource resource = space->data . warehouse . resource_id ;
252252 if (space->base .stored_amount_first > amount) {
253253 city_resource_remove_from_storageyard (resource, amount);
254254 space->base .stored_amount_first -= amount;
@@ -257,7 +257,7 @@ void building_storageyard_remove_resource_curse(building* b, int amount) {
257257 city_resource_remove_from_storageyard (resource, space->base .stored_amount_first );
258258 amount -= space->base .stored_amount_first ;
259259 space->base .stored_amount_first = 0 ;
260- space->base . subtype . warehouse_resource_id = RESOURCE_NONE ;
260+ space->data . warehouse . resource_id = RESOURCE_NONE ;
261261 }
262262 space->set_image (resource);
263263 space = space->next_room ();
@@ -392,7 +392,7 @@ int building_storage_yard::for_getting(e_resource resource, tile2i* dst) {
392392 const storage_t * s = space->storage ();
393393 while (space) {
394394 if (space->base .stored_amount_first > 0 ) {
395- if (space->base . subtype . warehouse_resource_id == resource)
395+ if (space->data . warehouse . resource_id == resource)
396396 amounts_stored += space->base .stored_amount_first ;
397397 }
398398 space = space->next_room ();
@@ -463,7 +463,7 @@ static bool contains_non_stockpiled_food(building* space, const resource_list &f
463463 return false ;
464464 }
465465
466- e_resource resource = space->subtype . warehouse_resource_id ;
466+ e_resource resource = space->data . warehouse . resource_id ;
467467 if (city_resource_is_stockpiled (resource)) {
468468 return false ;
469469 }
@@ -490,7 +490,7 @@ storage_worker_task building_storage_yard_determine_getting_up_resources(buildin
490490 room += 4 ;
491491 }
492492
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!
494494 total_stored += space->base .stored_amount_first ; // add loads to total, if any!
495495 room += 400 - space->base .stored_amount_first ; // add room to total, if any!
496496 }
@@ -533,7 +533,7 @@ storage_worker_task building_storageyard_deliver_weapons(building *warehouse) {
533533 for (int i = 0 ; i < 8 ; i++) {
534534 space = space->next ();
535535 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 ) {
537537 available += space->stored_amount_first ;
538538 }
539539 }
@@ -564,7 +564,7 @@ storage_worker_task building_storageyard_deliver_timber_to_shipyard_school(build
564564 for (int i = 0 ; i < 8 ; i++) {
565565 space = space->next ();
566566 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 ) {
568568 available += space->stored_amount_first ;
569569 }
570570 }
@@ -594,7 +594,7 @@ storage_worker_task building_storageyard_deliver_papyrus_to_scribal_school(build
594594 for (int i = 0 ; i < 8 ; i++) {
595595 space = space->next ();
596596 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 ) {
598598 available += space->stored_amount_first ;
599599 }
600600 }
@@ -616,17 +616,17 @@ storage_worker_task building_storageyard_deliver_resource_to_workshop(building *
616616 continue ;
617617 }
618618
619- e_resource check_resource = space->subtype . warehouse_resource_id ;
619+ e_resource check_resource = space->data . warehouse . resource_id ;
620620 if (city_resource_is_stockpiled (check_resource)) {
621621 continue ;
622622 }
623623
624624 storage_worker_task task = {STORAGEYARD_TASK_NONE };
625625 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 ) {
627627 return ;
628628 }
629- task = {STORAGEYARD_TASK_DELIVERING , space, 100 , space->subtype . warehouse_resource_id };
629+ task = {STORAGEYARD_TASK_DELIVERING , space, 100 , space->data . warehouse . resource_id };
630630 });
631631
632632 if (task.result == STORAGEYARD_TASK_DELIVERING ) {
@@ -648,7 +648,7 @@ storage_worker_task building_storage_yard::deliver_food_to_gettingup_granary(bui
648648 space = space->next ();
649649 if (contains_non_stockpiled_food (space, granary_resources)) {
650650 // 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 };
652652 }
653653 }
654654
@@ -666,7 +666,7 @@ storage_worker_task building_storageyard_deliver_food_to_accepting_granary(build
666666 space = space->next ();
667667 if (contains_non_stockpiled_food (space, granary_resources)) {
668668 // 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 };
670670 }
671671 }
672672 }
@@ -691,11 +691,11 @@ storage_worker_task building_storageyard_deliver_to_monuments(building *warehous
691691 for (int i = 0 ; i < 8 ; i++) {
692692 space = space->next ();
693693 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 ) {
695695 continue ;
696696 }
697697
698- e_resource resource = space->subtype . warehouse_resource_id ;
698+ e_resource resource = space->data . warehouse . resource_id ;
699699 if (city_resource_is_stockpiled (resource)) {
700700 continue ;
701701 }
@@ -764,7 +764,7 @@ storage_worker_task building_storage_yard::determine_worker_task() {
764764 for (int i = 0 ; i < 8 ; i++) {
765765 space = space->next ();
766766 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 };
768768 }
769769 }
770770 }
0 commit comments