summaryrefslogtreecommitdiff
path: root/src/town_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r--src/town_cmd.cpp47
1 files changed, 16 insertions, 31 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 8b293143f..cc66e3ae8 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -487,13 +487,13 @@ static void TileLoop_Town(TileIndex tile)
const CargoSpec *cs = CargoSpec::Get(cargo);
switch (cs->town_effect) {
case TE_PASSENGERS:
- t->new_max_pass += amt;
- t->new_act_pass += moved;
+ t->pass.new_max += amt;
+ t->pass.new_act += moved;
break;
case TE_MAIL:
- t->new_max_mail += amt;
- t->new_act_mail += moved;
+ t->mail.new_max += amt;
+ t->mail.new_act += moved;
break;
default:
@@ -505,16 +505,16 @@ static void TileLoop_Town(TileIndex tile)
uint amt = GB(r, 0, 8) / 8 + 1;
if (EconomyIsInRecession()) amt = (amt + 1) >> 1;
- t->new_max_pass += amt;
- t->new_act_pass += MoveGoodsToStation(CT_PASSENGERS, amt, ST_TOWN, t->index, stations.GetStations());
+ t->pass.new_max += amt;
+ t->pass.new_act += MoveGoodsToStation(CT_PASSENGERS, amt, ST_TOWN, t->index, stations.GetStations());
}
if (GB(r, 8, 8) < hs->mail_generation) {
uint amt = GB(r, 8, 8) / 8 + 1;
if (EconomyIsInRecession()) amt = (amt + 1) >> 1;
- t->new_max_mail += amt;
- t->new_act_mail += MoveGoodsToStation(CT_MAIL, amt, ST_TOWN, t->index, stations.GetStations());
+ t->mail.new_max += amt;
+ t->mail.new_act += MoveGoodsToStation(CT_MAIL, amt, ST_TOWN, t->index, stations.GetStations());
}
}
@@ -1401,8 +1401,8 @@ void UpdateTownRadius(Town *t)
void UpdateTownMaxPass(Town *t)
{
- t->max_pass = t->population >> 3;
- t->max_mail = t->population >> 4;
+ t->pass.old_max = t->population >> 3;
+ t->mail.old_max = t->population >> 4;
}
/**
@@ -1426,20 +1426,8 @@ static void DoCreateTown(Town *t, TileIndex tile, uint32 townnameparts, TownSize
t->population = 0;
t->grow_counter = 0;
t->growth_rate = 250;
- t->new_max_pass = 0;
- t->new_max_mail = 0;
- t->new_act_pass = 0;
- t->new_act_mail = 0;
- t->max_pass = 0;
- t->max_mail = 0;
- t->act_pass = 0;
- t->act_mail = 0;
t->fund_buildings_months = 0;
- t->new_act_food = 0;
- t->new_act_water = 0;
- t->act_food = 0;
- t->act_water = 0;
for (uint i = 0; i != MAX_COMPANIES; i++) t->ratings[i] = RATING_INITIAL;
@@ -2783,10 +2771,10 @@ static void UpdateTownGrowRate(Town *t)
}
if (_settings_game.game_creation.landscape == LT_ARCTIC) {
- if (TileHeight(t->xy) >= GetSnowLine() && t->act_food == 0 && t->population > 90) return;
+ if (TileHeight(t->xy) >= GetSnowLine() && t->food.old_act == 0 && t->population > 90) return;
} else if (_settings_game.game_creation.landscape == LT_TROPIC) {
- if (GetTropicZone(t->xy) == TROPICZONE_DESERT && (t->act_food == 0 || t->act_water == 0) && t->population > 60) return;
+ if (GetTropicZone(t->xy) == TROPICZONE_DESERT && (t->food.old_act == 0 || t->water.old_act == 0) && t->population > 60) return;
}
/* Use the normal growth rate values if new buildings have been funded in
@@ -2806,13 +2794,10 @@ static void UpdateTownGrowRate(Town *t)
static void UpdateTownAmounts(Town *t)
{
- t->max_pass = t->new_max_pass; t->new_max_pass = 0;
- t->act_pass = t->new_act_pass; t->new_act_pass = 0;
- t->act_food = t->new_act_food; t->new_act_food = 0;
- t->act_water = t->new_act_water; t->new_act_water = 0;
-
- t->max_mail = t->new_max_mail; t->new_max_mail = 0;
- t->act_mail = t->new_act_mail; t->new_act_mail = 0;
+ t->pass.NewMonth();
+ t->mail.NewMonth();
+ t->food.NewMonth();
+ t->water.NewMonth();
SetWindowDirty(WC_TOWN_VIEW, t->index);
}