summaryrefslogtreecommitdiff
path: root/src/town.h
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-11-23 16:05:19 +0000
committertruebrain <truebrain@openttd.org>2011-11-23 16:05:19 +0000
commit229e572663158d8fd37cabf3c2a3cb06811ff0a1 (patch)
treee27f01fdf1de01262be29bb795b0be8d54b04f5e /src/town.h
parent4e09cde6495f35a6d56cacc0dbf636df7bc94dbd (diff)
downloadopenttd-229e572663158d8fd37cabf3c2a3cb06811ff0a1.tar.xz
(svn r23298) -Add: track statistics of all incoming and outgoing goods. Incoming based on TownEffect, outgoing based on CargoType (based on patch by Terkhen)
Diffstat (limited to 'src/town.h')
-rw-r--r--src/town.h13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/town.h b/src/town.h
index 8b7f6594b..c56b6d3de 100644
--- a/src/town.h
+++ b/src/town.h
@@ -18,6 +18,7 @@
#include "town_map.h"
#include "subsidy_type.h"
#include "newgrf_storage.h"
+#include "cargotype.h"
#include <list>
template <typename T>
@@ -66,16 +67,10 @@ struct Town : TownPool::PoolItem<&_town_pool> {
uint8 exclusive_counter; ///< months till the exclusivity expires
int16 ratings[MAX_COMPANIES]; ///< ratings of each company for this town
- TransportedCargoStat<uint32> pass; ///< Passenger cargo statistics.
- TransportedCargoStat<uint32> mail; ///< Mail cargo statistics.
- TransportedCargoStat<uint16> food; ///< Food cargo statistics.
- TransportedCargoStat<uint16> water; ///< Water cargo statistics.
+ TransportedCargoStat<uint32> supplied[NUM_CARGO]; ///< Cargo statistics about supplied cargo.
+ TransportedCargoStat<uint16> received[NUM_TE]; ///< Cargo statistics about received cargotypes.
- /** Percentage of passengers transported last month (0xFF=100%) */
- inline byte GetPercentPassTransported() const { return this->pass.old_act * 256 / (this->pass.old_max + 1); }
-
- /** Percentage of mail transported last month (0xFF=100%) */
- inline byte GetPercentMailTransported() const { return this->mail.old_act * 256 / (this->mail.old_max + 1); }
+ inline byte GetPercentTransported(CargoID cid) const { return this->supplied[cid].old_act * 256 / (this->supplied[cid].old_max + 1); }
uint16 time_until_rebuild; ///< time until we rebuild a house