diff options
author | rubidium <rubidium@openttd.org> | 2006-12-09 14:14:51 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2006-12-09 14:14:51 +0000 |
commit | 5b5b1d1514080cb4d1659507987681eede0a212b (patch) | |
tree | e0df6d79e90152d1b3508be213f07fe29b04698e /industry_cmd.c | |
parent | 38edab372b48c7fb5addcfab88ead01a6bb4a760 (diff) | |
download | openttd-5b5b1d1514080cb4d1659507987681eede0a212b.tar.xz |
(svn r7451) -Fix (7372): GetNum(Towns|Industries) should return the actual number of towns and industries.
-Fix (6055): GetMax(Town|Industry)Index should not return the number of towns or industries - 1, but the size of the pool - 1.
Diffstat (limited to 'industry_cmd.c')
-rw-r--r-- | industry_cmd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/industry_cmd.c b/industry_cmd.c index ec4693304..e360cad95 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -110,6 +110,7 @@ void DestroyIndustry(Industry *i) } _industry_sort_dirty = true; + _total_industries--; DeleteSubsidyWithIndustry(i->index); DeleteWindowById(WC_INDUSTRY_VIEW, i->index); InvalidateWindow(WC_INDUSTRY_DIRECTORY, 0); @@ -1361,7 +1362,7 @@ static Industry *AllocateIndustry(void) if (IsValidIndustry(i)) continue; - if (i->index >= _total_industries) _total_industries = i->index + 1; + _total_industries++; memset(i, 0, sizeof(*i)); i->index = index; @@ -1917,7 +1918,7 @@ static void Load_INDY(void) i = GetIndustry(index); SlObject(i, _industry_desc); - if (index >= _total_industries) _total_industries = index + 1; + _total_industries++; } } |