summaryrefslogtreecommitdiff
path: root/src/script/api/script_town.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-11-12 15:15:02 +0000
committerfrosch <frosch@openttd.org>2013-11-12 15:15:02 +0000
commit41184fb871c6debe23f6b2c133373b6a3261cfce (patch)
treeda13ce7c1f63e33f32aaa917d17eef9e6dd364a3 /src/script/api/script_town.cpp
parentbe4355edd3fe870cc38af1a8b4c091e3c351210b (diff)
downloadopenttd-41184fb871c6debe23f6b2c133373b6a3261cfce.tar.xz
(svn r25966) -Fix: [NoGo] Properly validate the range of the growth rate passed to GSTown::SetGrowthRate, instead of masking it to 16 bit.
Diffstat (limited to 'src/script/api/script_town.cpp')
-rw-r--r--src/script/api/script_town.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/script/api/script_town.cpp b/src/script/api/script_town.cpp
index c098039fd..9926d2277 100644
--- a/src/script/api/script_town.cpp
+++ b/src/script/api/script_town.cpp
@@ -154,12 +154,12 @@
}
}
-/* static */ bool ScriptTown::SetGrowthRate(TownID town_id, uint16 days_between_town_growth)
+/* static */ bool ScriptTown::SetGrowthRate(TownID town_id, uint32 days_between_town_growth)
{
days_between_town_growth = days_between_town_growth * DAY_TICKS / TOWN_GROWTH_TICKS;
EnforcePrecondition(false, IsValidTown(town_id));
- EnforcePrecondition(false, (days_between_town_growth & TOWN_GROW_RATE_CUSTOM) == 0);
+ EnforcePrecondition(false, days_between_town_growth < TOWN_GROW_RATE_CUSTOM);
return ScriptObject::DoCommand(::Town::Get(town_id)->xy, town_id, days_between_town_growth, CMD_TOWN_GROWTH_RATE);
}