summaryrefslogtreecommitdiff
path: root/src/town_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-11-12 17:57:12 +0000
committerfrosch <frosch@openttd.org>2013-11-12 17:57:12 +0000
commit9a41aefcc4a75ca98dd73e022d058b52bbd2a26d (patch)
tree3629e7fd54b024dda142bd2fb2afadde9557949d /src/town_cmd.cpp
parentb1f41a0afb460071db2dbbfcb64140488f073382 (diff)
downloadopenttd-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/town_cmd.cpp')
-rw-r--r--src/town_cmd.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 38894fe76..72ef4a1a3 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -2513,14 +2513,14 @@ CommandCost CmdTownSetText(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
* @param tile Unused.
* @param flags Type of operation.
* @param p1 Town ID to cargo game of.
- * @param p2 Amount of days between growth.
+ * @param p2 Amount of days between growth, or TOWN_GROW_RATE_CUSTOM_NONE, or 0 to reset custom growth rate.
* @param text Unused.
* @return Empty cost or an error.
*/
CommandCost CmdTownGrowthRate(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (_current_company != OWNER_DEITY) return CMD_ERROR;
- if ((p2 & TOWN_GROW_RATE_CUSTOM) != 0) return CMD_ERROR;
+ if ((p2 & TOWN_GROW_RATE_CUSTOM) != 0 && p2 != TOWN_GROW_RATE_CUSTOM_NONE) return CMD_ERROR;
if (GB(p2, 16, 16) != 0) return CMD_ERROR;
Town *t = Town::GetIfValid(p1);
@@ -2826,11 +2826,12 @@ static CommandCost TownActionFundBuildings(Town *t, DoCommandFlag flags)
if (flags & DC_EXEC) {
/* Build next tick */
t->grow_counter = 1;
- /* If we were not already growing */
- SetBit(t->flags, TOWN_IS_GROWING);
/* And grow for 3 months */
t->fund_buildings_months = 3;
+ /* Enable growth (also checking GameScript's opinion) */
+ UpdateTownGrowRate(t);
+
SetWindowDirty(WC_TOWN_VIEW, t->index);
}
return CommandCost();
@@ -3048,7 +3049,7 @@ static void UpdateTownGrowRate(Town *t)
}
if ((t->growth_rate & TOWN_GROW_RATE_CUSTOM) != 0) {
- SetBit(t->flags, TOWN_IS_GROWING);
+ if (t->growth_rate != TOWN_GROW_RATE_CUSTOM_NONE) SetBit(t->flags, TOWN_IS_GROWING);
SetWindowDirty(WC_TOWN_VIEW, t->index);
return;
}