diff options
author | frosch <frosch@openttd.org> | 2013-11-12 17:57:12 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2013-11-12 17:57:12 +0000 |
commit | 9a41aefcc4a75ca98dd73e022d058b52bbd2a26d (patch) | |
tree | 3629e7fd54b024dda142bd2fb2afadde9557949d /src/script/api/script_town.cpp | |
parent | b1f41a0afb460071db2dbbfcb64140488f073382 (diff) | |
download | openttd-9a41aefcc4a75ca98dd73e022d058b52bbd2a26d.tar.xz |
(svn r25968) -Add: [Script] ScriptTown::TOWN_GROWTH_NONE to indicate no town growth via ScriptTown::SetGrowthRate and GetGrowthRate.
Diffstat (limited to 'src/script/api/script_town.cpp')
-rw-r--r-- | src/script/api/script_town.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/script/api/script_town.cpp b/src/script/api/script_town.cpp index b37d7bd1e..5d67cb76d 100644 --- a/src/script/api/script_town.cpp +++ b/src/script/api/script_town.cpp @@ -163,6 +163,10 @@ days_between_town_growth = 0; break; + case TOWN_GROWTH_NONE: + days_between_town_growth = TOWN_GROW_RATE_CUSTOM_NONE; + break; + default: days_between_town_growth = days_between_town_growth * DAY_TICKS / TOWN_GROWTH_TICKS; EnforcePrecondition(false, days_between_town_growth < TOWN_GROW_RATE_CUSTOM); @@ -179,6 +183,8 @@ const Town *t = ::Town::Get(town_id); + if (t->growth_rate == TOWN_GROW_RATE_CUSTOM_NONE) return TOWN_GROWTH_NONE; + return ((t->growth_rate & ~TOWN_GROW_RATE_CUSTOM) * TOWN_GROWTH_TICKS + DAY_TICKS) / DAY_TICKS; } |