diff options
author | truelight <truelight@openttd.org> | 2006-08-22 21:14:45 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2006-08-22 21:14:45 +0000 |
commit | a21b2750bdf400c43ebf29a839428e0743086185 (patch) | |
tree | 3b5390c9adf2806b379ecf5be65b211d1a2e8b4d /ai/default/default.c | |
parent | cea8546a8663db55e9d492b68ef9836550663bbe (diff) | |
download | openttd-a21b2750bdf400c43ebf29a839428e0743086185.tar.xz |
(svn r6057) -Codechange: made a function GetRandomXXX, that _always_ returns a valid XXX, unless there are none to pick from. Then NULL is returned.
Diffstat (limited to 'ai/default/default.c')
-rw-r--r-- | ai/default/default.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/ai/default/default.c b/ai/default/default.c index 3de583bf4..08af2b119 100644 --- a/ai/default/default.c +++ b/ai/default/default.c @@ -441,14 +441,12 @@ typedef struct FoundRoute { static Town *AiFindRandomTown(void) { - Town *t = GetTown(RandomRange(GetTownArraySize())); - return IsValidTown(t) ? t : NULL; + return GetRandomTown(); } static Industry *AiFindRandomIndustry(void) { - Industry *i = GetIndustry(RandomRange(GetIndustryArraySize())); - return IsValidIndustry(i) ? i : NULL; + return GetRandomIndustry(); } static void AiFindSubsidyIndustryRoute(FoundRoute *fr) |