summaryrefslogtreecommitdiff
path: root/src/town.h
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-09-11 11:47:18 +0000
committeryexo <yexo@openttd.org>2011-09-11 11:47:18 +0000
commit40d5419cd209cd84e2ff28a0585bc4ec44688981 (patch)
tree8e6481ace71e161a28ac8148fff330b00f9aa6f4 /src/town.h
parent07077dc56ea335a8521bfb1953b5a883bd1d507d (diff)
downloadopenttd-40d5419cd209cd84e2ff28a0585bc4ec44688981.tar.xz
(svn r22920) -Cleanup: replace two very old town variables taht were rarely used by small functions that compute there value on-the-fly when necessary
Diffstat (limited to 'src/town.h')
-rw-r--r--src/town.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/town.h b/src/town.h
index e124e2600..f60b026bf 100644
--- a/src/town.h
+++ b/src/town.h
@@ -75,8 +75,11 @@ struct Town : TownPool::PoolItem<&_town_pool> {
uint32 new_act_pass;
uint32 new_act_mail;
- byte pct_pass_transported; ///< amount of passengers that were transported
- byte pct_mail_transported; ///< amount of mail that was transported
+ /** Percentage of passengers transported last month (0xFF=100%) */
+ inline byte GetPercentPassTransported() const { return this->act_pass * 256 / (this->max_pass + 1); }
+
+ /** Percentage of mail transported last month (0xFF=100%) */
+ inline byte GetPercentMailTransported() const { return this->act_mail * 256 / (this->max_mail + 1); }
uint16 act_food; ///< amount of food that was transported
uint16 act_water; ///< amount of water that was transported