merging town-potential
--HG-- branch : novattd-v14
This commit is contained in:
@@ -5043,8 +5043,8 @@ STR_TOWN_DIRECTORY_TOWN_COLOUR :{TOWN}{BLACK} (
|
||||
STR_OLD_DEPOT_TRAINT_LENGTH :Old depot length format: {STRING2}
|
||||
STR_TOWN_DIRECTORY_CAPTION_EXTRA :{WHITE}Towns ({YELLOW}{COMMA}{WHITE} / {ORANGE}{COMMA}{WHITE})
|
||||
STR_SMALLMAP_TOWN_LARGE :{TINY_FONT}{YELLOW}{TOWN}
|
||||
STR_TOWN_VIEW_TOWN_CAPTION_EXTRA :{WHITE}{TOWN} [{COMMA}]
|
||||
STR_TOWN_VIEW_CITY_CAPTION_EXTRA :{WHITE}{TOWN} (City) [{COMMA}]
|
||||
STR_TOWN_VIEW_TOWN_CAPTION_EXTRA :{WHITE}{TOWN} {COMMA} [{COMMA}]
|
||||
STR_TOWN_VIEW_CITY_CAPTION_EXTRA :{WHITE}{TOWN} (City) {COMMA} [{COMMA}]
|
||||
|
||||
STR_ORDER_DIST :{NUM}, {NUM}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ void RebuildTownCaches()
|
||||
FOR_ALL_TOWNS(town) {
|
||||
town->cache.population = 0;
|
||||
town->cache.num_houses = 0;
|
||||
town->cache.potential_pop = 0;
|
||||
}
|
||||
|
||||
for (TileIndex t = 0; t < MapSize(); t++) {
|
||||
@@ -39,6 +40,7 @@ void RebuildTownCaches()
|
||||
town = Town::GetByTile(t);
|
||||
IncreaseBuildingCount(town, house_id);
|
||||
if (IsHouseCompleted(t)) town->cache.population += HouseSpec::Get(house_id)->population;
|
||||
town->cache.potential_pop += HouseSpec::Get(house_id)->population;
|
||||
|
||||
/* Increase the number of houses for every house, but only once. */
|
||||
if (GetHouseNorthPart(house_id) == 0) town->cache.num_houses++;
|
||||
|
||||
@@ -49,6 +49,7 @@ extern TownPool _town_pool;
|
||||
struct TownCache {
|
||||
uint32 num_houses; ///< Amount of houses
|
||||
uint32 population; ///< Current population of people
|
||||
uint32 potential_pop; ///< Potential population (if all houses are finished)
|
||||
ViewportSign sign; ///< Location of name sign, UpdateVirtCoord updates this
|
||||
PartOfSubsidyByte part_of_subsidy; ///< Is this town a source/destination of a subsidy?
|
||||
uint32 squared_town_zone_radius[HZB_END]; ///< UpdateTownRadius updates this given the house count
|
||||
|
||||
@@ -2487,6 +2487,7 @@ static bool BuildTownHouse(Town *t, TileIndex tile)
|
||||
|
||||
/* build the house */
|
||||
t->cache.num_houses++;
|
||||
t->cache.potential_pop += hs->population;
|
||||
|
||||
/* Special houses that there can be only one of. */
|
||||
t->flags |= oneof;
|
||||
@@ -2578,6 +2579,7 @@ void ClearTownHouse(Town *t, TileIndex tile)
|
||||
}
|
||||
|
||||
t->cache.num_houses--;
|
||||
t->cache.potential_pop -= hs->population;
|
||||
|
||||
/* Clear flags for houses that only may exist once/town. */
|
||||
if (hs->building_flags & BUILDING_IS_CHURCH) {
|
||||
|
||||
@@ -354,7 +354,8 @@ public:
|
||||
{
|
||||
if (widget == WID_TV_CAPTION){
|
||||
SetDParam(0, this->town->index);
|
||||
SetDParam(1, this->town->ratings[_current_company]);
|
||||
SetDParam(1, this->town->cache.potential_pop);
|
||||
SetDParam(2, this->town->ratings[_current_company]);
|
||||
}
|
||||
if (widget == WID_TV_CB){
|
||||
extern bool _novahost;
|
||||
|
||||
Reference in New Issue
Block a user