(svn r23233) -Codechange: Refactor maximum and actually transported cargo amount of towns into a reusable struct.

This commit is contained in:
michi_cc
2011-11-15 20:47:53 +00:00
parent 88aaeb4092
commit 6548ec6e9e
9 changed files with 110 additions and 116 deletions

View File

@@ -107,4 +107,22 @@ typedef SimpleTinyEnumT<TownFounding, byte> TownFoundingByte;
static const uint MAX_LENGTH_TOWN_NAME_CHARS = 32; ///< The maximum length of a town name in characters including '\0'
/** Store the maximum and actually transported cargo amount for the current and the last month. */
template <typename Tstorage>
struct TransportedCargoStat {
Tstorage old_max; ///< Maximum amount last month
Tstorage new_max; ///< Maximum amount this month
Tstorage old_act; ///< Actually transported last month
Tstorage new_act; ///< Actually transported this month
TransportedCargoStat() : old_max(0), new_max(0), old_act(0), new_act(0) {}
/** Update stats for a new month. */
void NewMonth()
{
this->old_max = this->new_max; this->new_max = 0;
this->old_act = this->new_act; this->new_act = 0;
}
};
#endif /* TOWN_TYPE_H */