diff options
author | rubidium <rubidium@openttd.org> | 2010-08-28 18:23:14 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-08-28 18:23:14 +0000 |
commit | bd488934787b3587ec5048db59a7dd14c164ca70 (patch) | |
tree | 548528641f87567720c66c780dddbd5a4ec7cfc0 /src/object_cmd.cpp | |
parent | c481e3b110da20085a77f55625e564a7baa772a8 (diff) | |
download | openttd-bd488934787b3587ec5048db59a7dd14c164ca70.tar.xz |
(svn r20656) -Codechange: implement counting of objects
Diffstat (limited to 'src/object_cmd.cpp')
-rw-r--r-- | src/object_cmd.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index 660d32991..87d5f7369 100644 --- 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, TileIndex tile, CompanyID owner, Town *town) MakeObject(t, type, owner, o->index, wc, Random()); MarkTileDirtyByTile(t); } + + Object::IncTypeCount(type); } /** @@ -317,6 +321,7 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags) } if (flags & DC_EXEC) { + Object::DecTypeCount(type); TILE_AREA_LOOP(tile_cur, ta) MakeWaterKeepingClass(tile_cur, GetTileOwner(tile_cur)); delete o; } |