Skip to content

Commit fb7b2c5

Browse files
committed
city: update house health only with people
1 parent da37ea3 commit fb7b2c5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/city/city_house_population.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void city_t::house_population_update_room() {
9090
if (b->house_population > b->house_highest_population)
9191
b->house_highest_population = b->house_population;
9292

93-
} else if (b->house_population) {
93+
} else if (b->house_population > 0) {
9494
// not connected to Rome, mark people for eviction
9595
b->house_population_room = -b->house_population;
9696
}

src/city/houses.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void city_t::houses_reset_demands() {
3636
void city_t::house_service_update_health() {
3737
OZZY_PROFILER_SECTION("Game/Update/House Service Update Health");
3838
buildings_valid_do([] (building &b) {
39-
if (!b.house_size) {
39+
if (!b.house_size || b.house_population <= 0) {
4040
return;
4141
}
4242

@@ -55,7 +55,7 @@ void city_t::house_service_update_health() {
5555
int chance_death = std::max(100 - b.common_health, 10);
5656
int randm = (random_short() % 99 + 1);
5757
bool has_death_today = (randm < chance_death);
58-
if (has_death_today) {
58+
if (has_death_today && b.house_population > 0) {
5959
--b.house_population;
6060
}
6161
}

0 commit comments

Comments
 (0)