1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-19 02:12:37 +01:00

(svn r25966) -Fix: [NoGo] Properly validate the range of the growth rate passed to GSTown::SetGrowthRate, instead of masking it to 16 bit.

This commit is contained in:
frosch
2013-11-12 15:15:02 +00:00
parent be4355edd3
commit 41184fb871
2 changed files with 4 additions and 3 deletions

View File

@@ -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);
}