summaryrefslogtreecommitdiff
path: root/town_cmd.c
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2006-12-05 13:58:20 +0000
committermatthijs <matthijs@openttd.org>2006-12-05 13:58:20 +0000
commit9218fc16e6fff350e6209b6b90b8597fc431f00f (patch)
treee23ebc401e3e8f7037ad38701e00a6bf1fb61136 /town_cmd.c
parent681f994d16a71813144352b3a6ef05a22cb8b3ff (diff)
downloadopenttd-9218fc16e6fff350e6209b6b90b8597fc431f00f.tar.xz
(svn r7372) - CodeChange: Rename all GetXXXArraySize() functions to GetNumXXX() and add GetMaxXXXIndex() functions. This prepares for the new pool interface.
Diffstat (limited to 'town_cmd.c')
-rw-r--r--town_cmd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/town_cmd.c b/town_cmd.c
index d5c0b10b2..c56e01b98 100644
--- a/town_cmd.c
+++ b/town_cmd.c
@@ -436,12 +436,12 @@ void OnTick_Town(void)
/* Make sure each town's tickhandler invocation frequency is about the
* same - TOWN_GROWTH_FREQUENCY - independent on the number of towns. */
- for (_cur_town_iter += GetTownArraySize();
+ for (_cur_town_iter += GetMaxTownIndex() + 1;
_cur_town_iter >= TOWN_GROWTH_FREQUENCY;
_cur_town_iter -= TOWN_GROWTH_FREQUENCY) {
uint32 i = _cur_town_ctr;
- if (++_cur_town_ctr >= GetTownArraySize())
+ if (++_cur_town_ctr > GetMaxTownIndex())
_cur_town_ctr = 0;
if (IsValidTownID(i)) TownTickHandler(GetTown(i));
@@ -1093,7 +1093,7 @@ bool GenerateTowns(void)
// give it a last try, but now more aggressive
if (num == 0 && CreateRandomTown(10000, 0) == NULL) {
- if (GetTownArraySize() == 0) {
+ if (GetNumTowns() == 0) {
/* XXX - can we handle that more gracefully? */
if (_game_mode != GM_EDITOR) error("Could not generate any town");
@@ -1937,7 +1937,7 @@ static void Load_TOWN(void)
/* This is to ensure all pointers are within the limits of
* the size of the TownPool */
- if (_cur_town_ctr >= GetTownArraySize())
+ if (_cur_town_ctr > GetMaxTownIndex())
_cur_town_ctr = 0;
}