Skip to content

Commit 51f87b8

Browse files
Fix mothballed supply posts not processing food
2 parents ffa4c5e + f681f44 commit 51f87b8

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/building/building.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,16 @@ int building_find(building_type type)
117117
return 0;
118118
}
119119

120+
int building_find_with_mothballed(building_type type)
121+
{
122+
for (building *b = data.first_of_type[type]; b; b = b->next_of_type) {
123+
if (b->state == BUILDING_STATE_IN_USE || b->state == BUILDING_STATE_MOTHBALLED) {
124+
return b->id;
125+
}
126+
}
127+
return 0;
128+
}
129+
120130
building *building_first_of_type(building_type type)
121131
{
122132
return data.first_of_type[type];

src/building/building.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ int building_count(void);
216216

217217
int building_find(building_type type);
218218

219+
int building_find_with_mothballed(building_type type);
220+
219221
int building_can_repair_type(building_type type);
220222

221223
building *building_first_of_type(building_type type);

src/city/resource.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ static int house_consume_food(void)
543543
static int mess_hall_consume_food(void)
544544
{
545545
int total_consumed = 0;
546-
building *b = building_get(building_find(BUILDING_MESS_HALL));
546+
building *b = building_get(building_find_with_mothballed(BUILDING_MESS_HALL));
547547
if (!b || (b->state != BUILDING_STATE_IN_USE && b->state != BUILDING_STATE_MOTHBALLED)) {
548548
return 0;
549549
}

0 commit comments

Comments
 (0)