(svn r6156) -Codechange: DeleteIndustry removes an industry from the pool

-Codechange: DestroyIndustry is called by DeleteIndustry to remove all things where a industry depends on.
  Last 2 changes to prepare for new pool system. Not pretty now, will be soon.
This commit is contained in:
truelight
2006-08-26 19:51:49 +00:00
parent b3cf0189a3
commit b7fcce091e
2 changed files with 43 additions and 36 deletions

View File

@@ -131,6 +131,14 @@ static inline Industry *GetRandomIndustry(void)
return GetIndustry(index);
}
void DestroyIndustry(Industry *i);
static inline void DeleteIndustry(Industry *i)
{
DestroyIndustry(i);
i->xy = 0;
}
#define FOR_ALL_INDUSTRIES_FROM(i, start) for (i = GetIndustry(start); i != NULL; i = (i->index + 1 < GetIndustryPoolSize()) ? GetIndustry(i->index + 1) : NULL) if (IsValidIndustry(i))
#define FOR_ALL_INDUSTRIES(i) FOR_ALL_INDUSTRIES_FROM(i, 0)