summaryrefslogtreecommitdiff
path: root/economy.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2006-08-22 20:41:26 +0000
committertruelight <truelight@openttd.org>2006-08-22 20:41:26 +0000
commit5fd9aeb12b75a3971e86e5b7d1701115f57fbc12 (patch)
treec177232d70dec4fb6d7cd2dbac79206e86ee2daa /economy.c
parent2e0d16026b77d0ef2ed233f16beb25bbaf836941 (diff)
downloadopenttd-5fd9aeb12b75a3971e86e5b7d1701115f57fbc12.tar.xz
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
It isn't the best name, but we couldn't find any better. This unifies the pool-system even more.
Diffstat (limited to 'economy.c')
-rw-r--r--economy.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/economy.c b/economy.c
index b2a85bdc4..19fa8952c 100644
--- a/economy.c
+++ b/economy.c
@@ -882,11 +882,11 @@ static void FindSubsidyPassengerRoute(FoundRoute *fr)
fr->distance = (uint)-1;
- fr->from = from = GetTown(RandomRange(_total_towns));
+ fr->from = from = GetTown(RandomRange(GetTownArraySize()));
if (!IsValidTown(from) || from->population < 400)
return;
- fr->to = to = GetTown(RandomRange(_total_towns));
+ fr->to = to = GetTown(RandomRange(GetTownArraySize()));
if (from == to || !IsValidTown(to) || to->population < 400 || to->pct_pass_transported > 42)
return;
@@ -901,7 +901,7 @@ static void FindSubsidyCargoRoute(FoundRoute *fr)
fr->distance = (uint)-1;
- fr->from = i = GetIndustry(RandomRange(_total_industries));
+ fr->from = i = GetIndustry(RandomRange(GetIndustryArraySize()));
if (!IsValidIndustry(i)) return;
// Randomize cargo type
@@ -925,7 +925,7 @@ static void FindSubsidyCargoRoute(FoundRoute *fr)
if (cargo == CT_GOODS || cargo == CT_FOOD) {
// The destination is a town
- Town *t = GetTown(RandomRange(_total_towns));
+ Town *t = GetTown(RandomRange(GetTownArraySize()));
// Only want big towns
if (!IsValidTown(t) || t->population < 900) return;
@@ -934,7 +934,7 @@ static void FindSubsidyCargoRoute(FoundRoute *fr)
fr->to = t;
} else {
// The destination is an industry
- Industry *i2 = GetIndustry(RandomRange(_total_industries));
+ Industry *i2 = GetIndustry(RandomRange(GetIndustryArraySize()));
// The industry must accept the cargo
if (i == i2 || !IsValidIndustry(i2) ||