From 30f778e933881837b33f891d9e8b0b109b5b2561 Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 1 Jan 2015 21:25:42 +0000 Subject: [PATCH] (svn r27105) -Fix [FS#6195]: grow_counter was not properly bounded by growth_rate, but by some other value used to calculate growth_rate. --- src/town.h | 2 +- src/town_cmd.cpp | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/town.h b/src/town.h index 42495971ec..010c7c2168 100644 --- a/src/town.h +++ b/src/town.h @@ -91,7 +91,7 @@ struct Town : TownPool::PoolItem<&_town_pool> { uint16 time_until_rebuild; ///< time until we rebuild a house - uint16 grow_counter; ///< counter to count when to grow + uint16 grow_counter; ///< counter to count when to grow, value is smaller than or equal to growth_rate uint16 growth_rate; ///< town growth rate byte fund_buildings_months; ///< fund buildings program in action? diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 76a6b36f4e..6674c905bd 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -3115,9 +3115,7 @@ static void UpdateTownGrowRate(Town *t) if (t->larger_town) m /= 2; t->growth_rate = m / (t->cache.num_houses / 50 + 1); - if (m <= t->grow_counter) { - t->grow_counter = m; - } + t->grow_counter = min(t->growth_rate, t->grow_counter); SetBit(t->flags, TOWN_IS_GROWING); SetWindowDirty(WC_TOWN_VIEW, t->index);