summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ai/default/default.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index 20aa5d1e9..f77bd8a00 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -460,7 +460,10 @@ static Town *AiFindRandomTown()
static Industry *AiFindRandomIndustry()
{
- return GetRandomIndustry();
+ int num = RandomRange(GetMaxIndustryIndex());
+ if (IsValidIndustry(GetIndustry(num))) return GetIndustry(num);
+
+ return NULL;
}
static void AiFindSubsidyIndustryRoute(FoundRoute *fr)