diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -39,6 +39,7 @@ ObjectPool _object_pool("Object"); INSTANTIATE_POOL_METHODS(Object) +uint16 Object::counts[NUM_OBJECTS]; /* static */ Object *Object::GetByTile(TileIndex tile) { @@ -49,6 +50,7 @@ INSTANTIATE_POOL_METHODS(Object) void InitializeObjects() { _object_pool.CleanPool(); + Object::ResetTypeCounts(); } void BuildObject(ObjectType type, TileIndex tile, CompanyID owner, Town *town) @@ -68,6 +70,8 @@ void BuildObject(ObjectType type, TileIn MakeObject(t, type, owner, o->index, wc, Random()); MarkTileDirtyByTile(t); } + + Object::IncTypeCount(type); } /** @@ -317,6 +321,7 @@ static CommandCost ClearTile_Object(Tile } if (flags & DC_EXEC) { + Object::DecTypeCount(type); TILE_AREA_LOOP(tile_cur, ta) MakeWaterKeepingClass(tile_cur, GetTileOwner(tile_cur)); delete o; }