From 59d8b0204fbb6c54da18e49a72ced5d83b0141dc Mon Sep 17 00:00:00 2001 From: terkhen Date: Sat, 3 Dec 2011 22:21:27 +0000 Subject: (svn r23405) -Codechange: Keep a matrix of cargos accepted by houses for each town (michi_cc). --- src/town.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/town.h') diff --git a/src/town.h b/src/town.h index c0c356735..c276be26b 100644 --- a/src/town.h +++ b/src/town.h @@ -19,6 +19,7 @@ #include "subsidy_type.h" #include "newgrf_storage.h" #include "cargotype.h" +#include "tilematrix_type.hpp" #include template @@ -27,6 +28,8 @@ struct BuildingCounts { T class_count[HOUSE_CLASS_MAX]; }; +typedef TileMatrix AcceptanceMatrix; + static const uint CUSTOM_TOWN_NUMBER_DIFFICULTY = 4; ///< value for custom town number in difficulty settings static const uint CUSTOM_TOWN_MAX_NUMBER = 5000; ///< this is the maximum number of towns a user can specify in customisation @@ -76,6 +79,11 @@ struct Town : TownPool::PoolItem<&_town_pool> { inline byte GetPercentTransported(CargoID cid) const { return this->supplied[cid].old_act * 256 / (this->supplied[cid].old_max + 1); } + /* Cargo production and acceptance stats. */ + uint32 cargo_produced; ///< Bitmap of all cargos produced by houses in this town. + AcceptanceMatrix cargo_accepted; ///< Bitmap of cargos accepted by houses for each 4*4 map square of the town. + uint32 cargo_accepted_total; ///< NOSAVE: Bitmap of all cargos accepted by houses in this town. + uint16 time_until_rebuild; ///< time until we rebuild a house uint16 grow_counter; ///< counter to count when to grow @@ -175,6 +183,8 @@ void ResetHouses(); void ClearTownHouse(Town *t, TileIndex tile); void UpdateTownMaxPass(Town *t); void UpdateTownRadius(Town *t); +void UpdateTownCargos(Town *t); +void UpdateTownCargoTotal(Town *t); CommandCost CheckIfAuthorityAllowsNewStation(TileIndex tile, DoCommandFlag flags); Town *ClosestTownFromTile(TileIndex tile, uint threshold); void ChangeTownRating(Town *t, int add, int max, DoCommandFlag flags); -- cgit v1.2.3-54-g00ecf