summaryrefslogtreecommitdiff
path: root/src/town.h
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2011-12-03 22:21:27 +0000
committerterkhen <terkhen@openttd.org>2011-12-03 22:21:27 +0000
commit59d8b0204fbb6c54da18e49a72ced5d83b0141dc (patch)
tree5d471c7a07a55deaae260ae0b2d9091f5b437128 /src/town.h
parente9e62b1629e75f6a908d03ccc02033ba349eb659 (diff)
downloadopenttd-59d8b0204fbb6c54da18e49a72ced5d83b0141dc.tar.xz
(svn r23405) -Codechange: Keep a matrix of cargos accepted by houses for each town (michi_cc).
Diffstat (limited to 'src/town.h')
-rw-r--r--src/town.h10
1 files changed, 10 insertions, 0 deletions
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 <list>
template <typename T>
@@ -27,6 +28,8 @@ struct BuildingCounts {
T class_count[HOUSE_CLASS_MAX];
};
+typedef TileMatrix<uint32, 4> 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);