diff options
author | Pavel Stupnikov <dp@dpointer.org> | 2018-05-02 22:01:30 +0300 |
---|---|---|
committer | frosch <github@elsenhans.name> | 2018-05-02 21:01:30 +0200 |
commit | fef8b831a93a0fc772fc8a0b7799ec51cd86a967 (patch) | |
tree | 327b1463e2d0828bb5d5036370517c3abdc77709 /src/saveload/afterload.cpp | |
parent | 61515c9abd6fb31e24c5fd610a9f6b3a899c7171 (diff) | |
download | openttd-fef8b831a93a0fc772fc8a0b7799ec51cd86a967.tar.xz |
Change: Switch town growth rate and counter to actual game ticks (#6763)
Diffstat (limited to 'src/saveload/afterload.cpp')
-rw-r--r-- | src/saveload/afterload.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index f01afb425..33c49fb61 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -2969,6 +2969,19 @@ bool AfterLoadGame() #endif } + if (IsSavegameVersionBefore(198)) { + /* Convert towns growth_rate and grow_counter to ticks */ + Town *t; + FOR_ALL_TOWNS(t) { + /* 0x8000 = TOWN_GROWTH_RATE_CUSTOM previously */ + if (t->growth_rate & 0x8000) SetBit(t->flags, TOWN_CUSTOM_GROWTH); + if (t->growth_rate != TOWN_GROWTH_RATE_NONE) { + t->growth_rate = TownTicksToGameTicks(t->growth_rate & ~0x8000); + } + /* Add t->index % TOWN_GROWTH_TICKS to spread growth across ticks. */ + t->grow_counter = TownTicksToGameTicks(t->grow_counter) + t->index % TOWN_GROWTH_TICKS; + } + } /* Station acceptance is some kind of cache */ if (IsSavegameVersionBefore(127)) { |