summaryrefslogtreecommitdiff
path: root/src/industry.h
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-05-22 15:23:47 +0000
committersmatz <smatz@openttd.org>2009-05-22 15:23:47 +0000
commit10d1ef5447b94d17024dc0f4bdd1b7b017431a23 (patch)
treea9563d19933124547ccd3d6c0e53c44876bdc144 /src/industry.h
parent62a7948af0ca9eb3b190a54918201e1075edcbbc (diff)
downloadopenttd-10d1ef5447b94d17024dc0f4bdd1b7b017431a23.tar.xz
(svn r16379) -Codechange: remove GetNumTowns(), GetNumIndustries() and GetActiveCompanyCount(), use PoolItem::GetNumItems() instead
Diffstat (limited to 'src/industry.h')
-rw-r--r--src/industry.h11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/industry.h b/src/industry.h
index e3a4292e6..5508b73a0 100644
--- a/src/industry.h
+++ b/src/industry.h
@@ -266,11 +266,6 @@ void SetIndustryDailyChanges();
extern uint16 _industry_counts[NUM_INDUSTRYTYPES]; // Number of industries per type ingame
-static inline uint GetNumIndustries()
-{
- return (uint)Industry::GetNumItems();
-}
-
/** Increment the count of industries for this type
* @param type IndustryType to increment
* @pre type < INVALID_INDUSTRYTYPE */
@@ -310,10 +305,10 @@ static inline void ResetIndustryCounts()
*/
static inline Industry *GetRandomIndustry()
{
- int num = RandomRange(GetNumIndustries());
- IndustryID index = INVALID_INDUSTRY;
+ if (Industry::GetNumItems() == 0) return NULL;
- if (GetNumIndustries() == 0) return NULL;
+ int num = RandomRange((uint16)Industry::GetNumItems());
+ IndustryID index = INVALID_INDUSTRY;
while (num >= 0) {
num--;