forked from mirror/OpenTTD
(svn r6149) -Codechange: DeleteTown removes a town from the pool
-Codechange: DestroyTown is called by DeleteTown to remove all things where a town depends on. Last 2 changes to prepare for new pool system. Not pretty now, will be soon.
This commit is contained in:
9
town.h
9
town.h
@@ -81,7 +81,6 @@ uint32 GetWorldPopulation(void);
|
||||
void UpdateTownVirtCoord(Town *t);
|
||||
void InitializeTown(void);
|
||||
void ShowTownViewWindow(TownID town);
|
||||
void DeleteTown(Town *t);
|
||||
void ExpandTown(Town *t);
|
||||
Town *CreateRandomTown(uint attempts, uint size_mode);
|
||||
|
||||
@@ -218,6 +217,14 @@ static inline bool IsValidTownID(uint index)
|
||||
return index < GetTownPoolSize() && IsValidTown(GetTown(index));
|
||||
}
|
||||
|
||||
void DestroyTown(Town *t);
|
||||
|
||||
static inline void DeleteTown(Town *t)
|
||||
{
|
||||
DestroyTown(t);
|
||||
t->xy = 0;
|
||||
}
|
||||
|
||||
#define FOR_ALL_TOWNS_FROM(t, start) for (t = GetTown(start); t != NULL; t = (t->index + 1 < GetTownPoolSize()) ? GetTown(t->index + 1) : NULL) if (IsValidTown(t))
|
||||
#define FOR_ALL_TOWNS(t) FOR_ALL_TOWNS_FROM(t, 0)
|
||||
|
||||
|
Reference in New Issue
Block a user