summaryrefslogtreecommitdiff
path: root/industry_cmd.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2006-08-22 21:14:45 +0000
committertruelight <truelight@openttd.org>2006-08-22 21:14:45 +0000
commitceb523c29f364f24b5e6b68b13249187ff6ac371 (patch)
tree3b5390c9adf2806b379ecf5be65b211d1a2e8b4d /industry_cmd.c
parent3cdabcbbac5ae64c132f0162090079d8c5cf3f90 (diff)
downloadopenttd-ceb523c29f364f24b5e6b68b13249187ff6ac371.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 'industry_cmd.c')
-rw-r--r--industry_cmd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/industry_cmd.c b/industry_cmd.c
index b36f01ff5..215033e13 100644
--- a/industry_cmd.c
+++ b/industry_cmd.c
@@ -3,11 +3,11 @@
#include "stdafx.h"
#include "openttd.h"
#include "clear_map.h"
+#include "functions.h"
#include "industry_map.h"
#include "station_map.h"
#include "table/strings.h"
#include "table/sprites.h"
-#include "functions.h"
#include "map.h"
#include "tile.h"
#include "viewport.h"
@@ -1879,8 +1879,8 @@ void IndustryMonthlyLoop(void)
if (CHANCE16(3, 100)) {
MaybeNewIndustry(Random());
} else if (!_patches.smooth_economy && GetIndustryArraySize() > 0) {
- i = GetIndustry(RandomRange(GetIndustryArraySize()));
- if (IsValidIndustry(i)) ChangeIndustryProduction(i);
+ i = GetRandomIndustry();
+ if (i != NULL) ChangeIndustryProduction(i);
}
_current_player = old_player;