diff options
author | truelight <truelight@openttd.org> | 2006-08-22 20:41:26 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2006-08-22 20:41:26 +0000 |
commit | 5fd9aeb12b75a3971e86e5b7d1701115f57fbc12 (patch) | |
tree | c177232d70dec4fb6d7cd2dbac79206e86ee2daa /economy.c | |
parent | 2e0d16026b77d0ef2ed233f16beb25bbaf836941 (diff) | |
download | openttd-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.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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) || |