(svn r16667) -Codechange: replace GetRandomTown() and GetRandomIndustry() by Town::GetRandom() and Industry::GetRandom()

This commit is contained in:
smatz
2009-06-26 15:08:54 +00:00
parent b668c24d46
commit ff33ed94ce
5 changed files with 60 additions and 52 deletions

View File

@@ -126,10 +126,10 @@ static void FindSubsidyPassengerRoute(FoundRoute *fr)
fr->distance = UINT_MAX;
fr->from = from = GetRandomTown();
fr->from = from = Town::GetRandom();
if (from == NULL || from->population < 400) return;
fr->to = to = GetRandomTown();
fr->to = to = Town::GetRandom();
if (from == to || to == NULL || to->population < 400 || to->pct_pass_transported > 42)
return;
@@ -144,7 +144,7 @@ static void FindSubsidyCargoRoute(FoundRoute *fr)
fr->distance = UINT_MAX;
fr->from = i = GetRandomIndustry();
fr->from = i = Industry::GetRandom();
if (i == NULL) return;
/* Randomize cargo type */
@@ -170,7 +170,7 @@ static void FindSubsidyCargoRoute(FoundRoute *fr)
if (cs->town_effect == TE_GOODS || cs->town_effect == TE_FOOD) {
/* The destination is a town */
Town *t = GetRandomTown();
Town *t = Town::GetRandom();
/* Only want big towns */
if (t == NULL || t->population < 900) return;
@@ -179,7 +179,7 @@ static void FindSubsidyCargoRoute(FoundRoute *fr)
fr->to = t;
} else {
/* The destination is an industry */
Industry *i2 = GetRandomIndustry();
Industry *i2 = Industry::GetRandom();
/* The industry must accept the cargo */
if (i2 == NULL || i == i2 ||