Merge branch 'master' into jgrpp

# Conflicts:
#	src/station_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2019-03-13 18:36:36 +00:00
6 changed files with 59 additions and 54 deletions

View File

@@ -158,12 +158,11 @@ void UpdateCompanyHQ(TileIndex tile, uint score)
{ {
if (tile == INVALID_TILE) return; if (tile == INVALID_TILE) return;
byte val; byte val = 0;
(val = 0, score < 170) || if (score >= 170) val++;
(val++, score < 350) || if (score >= 350) val++;
(val++, score < 520) || if (score >= 520) val++;
(val++, score < 720) || if (score >= 720) val++;
(val++, true);
while (GetCompanyHQSize(tile) < val) { while (GetCompanyHQSize(tile) < val) {
IncreaseCompanyHQSize(tile); IncreaseCompanyHQSize(tile);

View File

@@ -989,11 +989,13 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
if (IsInfraUsageAllowed(v->type, v->owner, st->owner)) { if (IsInfraUsageAllowed(v->type, v->owner, st->owner)) {
byte facil; byte facil;
(facil = FACIL_DOCK, v->type == VEH_SHIP) || switch (v->type) {
(facil = FACIL_TRAIN, v->type == VEH_TRAIN) || case VEH_SHIP: facil = FACIL_DOCK; break;
(facil = FACIL_AIRPORT, v->type == VEH_AIRCRAFT) || case VEH_TRAIN: facil = FACIL_TRAIN; break;
(facil = FACIL_BUS_STOP, v->type == VEH_ROAD && RoadVehicle::From(v)->IsBus()) || case VEH_AIRCRAFT: facil = FACIL_AIRPORT; break;
(facil = FACIL_TRUCK_STOP, 1); case VEH_ROAD: facil = RoadVehicle::From(v)->IsBus() ? FACIL_BUS_STOP : FACIL_TRUCK_STOP; break;
default: NOT_REACHED();
}
if (st->facilities & facil) { if (st->facilities & facil) {
order.MakeGoToStation(st_index); order.MakeGoToStation(st_index);
if (_ctrl_pressed) order.SetLoadType(OLF_FULL_LOAD_ANY); if (_ctrl_pressed) order.SetLoadType(OLF_FULL_LOAD_ANY);

View File

@@ -2798,23 +2798,30 @@ void DrawTrackBits(TileInfo *ti, TrackBits track, RailType rt, RailGroundType rg
image = _track_sloped_sprites[ti->tileh - 1] + rti->base_sprites.track_y; image = _track_sloped_sprites[ti->tileh - 1] + rti->base_sprites.track_y;
} else { } else {
/* track on flat ground */ /* track on flat ground */
(image = rti->base_sprites.track_y, track == TRACK_BIT_Y) || switch (track) {
(image++, track == TRACK_BIT_X) || /* single track, select combined track + ground sprite*/
(image++, track == TRACK_BIT_UPPER) || case TRACK_BIT_Y: image = rti->base_sprites.track_y; break;
(image++, track == TRACK_BIT_LOWER) || case TRACK_BIT_X: image = rti->base_sprites.track_y + 1; break;
(image++, track == TRACK_BIT_RIGHT) || case TRACK_BIT_UPPER: image = rti->base_sprites.track_y + 2; break;
(image++, track == TRACK_BIT_LEFT) || case TRACK_BIT_LOWER: image = rti->base_sprites.track_y + 3; break;
(image++, track == TRACK_BIT_CROSS) || case TRACK_BIT_RIGHT: image = rti->base_sprites.track_y + 4; break;
case TRACK_BIT_LEFT: image = rti->base_sprites.track_y + 5; break;
case TRACK_BIT_CROSS: image = rti->base_sprites.track_y + 6; break;
(image = rti->base_sprites.track_ns, track == TRACK_BIT_HORZ) || /* double diagonal track, select combined track + ground sprite*/
(image++, track == TRACK_BIT_VERT) || case TRACK_BIT_HORZ: image = rti->base_sprites.track_ns; break;
case TRACK_BIT_VERT: image = rti->base_sprites.track_ns + 1; break;
(junction = true, false) || /* junction, select only ground sprite, handle track sprite later */
(image = rti->base_sprites.ground, (track & TRACK_BIT_3WAY_NE) == 0) || default:
(image++, (track & TRACK_BIT_3WAY_SW) == 0) || junction = true;
(image++, (track & TRACK_BIT_3WAY_NW) == 0) || if ((track & TRACK_BIT_3WAY_NE) == 0) { image = rti->base_sprites.ground; break; }
(image++, (track & TRACK_BIT_3WAY_SE) == 0) || if ((track & TRACK_BIT_3WAY_SW) == 0) { image = rti->base_sprites.ground + 1; break; }
(image++, true); if ((track & TRACK_BIT_3WAY_NW) == 0) { image = rti->base_sprites.ground + 2; break; }
if ((track & TRACK_BIT_3WAY_SE) == 0) { image = rti->base_sprites.ground + 3; break; }
image = rti->base_sprites.ground + 4;
break;
}
} }
switch (rgt) { switch (rgt) {

View File

@@ -3620,27 +3620,25 @@ static void UpdateStationRating(Station *st)
} }
} }
if (ge->last_vehicle_type == VEH_SHIP) waittime >>= 2; if (ge->last_vehicle_type == VEH_SHIP) waittime >>= 2;
(waittime > 21) || if (waittime <= 21) rating += 25;
(rating += 25, waittime > 12) || if (waittime <= 12) rating += 25;
(rating += 25, waittime > 6) || if (waittime <= 6) rating += 45;
(rating += 45, waittime > 3) || if (waittime <= 3) rating += 35;
(rating += 35, true);
(rating -= 90, ge->max_waiting_cargo > 1500) || rating -= 90;
(rating += 55, ge->max_waiting_cargo > 1000) || if (ge->max_waiting_cargo <= 1500) rating += 55;
(rating += 35, ge->max_waiting_cargo > 600) || if (ge->max_waiting_cargo <= 1000) rating += 35;
(rating += 10, ge->max_waiting_cargo > 300) || if (ge->max_waiting_cargo <= 600) rating += 10;
(rating += 20, ge->max_waiting_cargo > 100) || if (ge->max_waiting_cargo <= 300) rating += 20;
(rating += 10, true); if (ge->max_waiting_cargo <= 100) rating += 10;
} }
if (Company::IsValidID(st->owner) && HasBit(st->town->statues, st->owner)) rating += 26; if (Company::IsValidID(st->owner) && HasBit(st->town->statues, st->owner)) rating += 26;
byte age = ge->last_age; byte age = ge->last_age;
(age >= 3) || if (age < 3) rating += 10;
(rating += 10, age >= 2) || if (age < 2) rating += 10;
(rating += 10, age >= 1) || if (age < 1) rating += 13;
(rating += 13, true);
{ {
int or_ = ge->rating; // old rating int or_ = ge->rating; // old rating
@@ -4045,16 +4043,16 @@ static void AddNearbyStationsByCatchment(TileIndex tile, StationList *stations,
* Find all stations around a rectangular producer (industry, house, headquarter, ...) * Find all stations around a rectangular producer (industry, house, headquarter, ...)
* *
* @param location The location/area of the producer * @param location The location/area of the producer
* @param stations The list to store the stations in * @param[out] stations The list to store the stations in
* @param use_nearby Use nearby station list of industry/town associated with location.tile * @param use_nearby Use nearby station list of industry/town associated with location.tile
*/ */
void FindStationsAroundTiles(const TileArea &location, StationList *stations, bool use_nearby) void FindStationsAroundTiles(const TileArea &location, StationList * const stations, bool use_nearby)
{ {
if (use_nearby) { if (use_nearby) {
/* Industries and towns maintain a list of nearby stations */ /* Industries and towns maintain a list of nearby stations */
if (IsTileType(location.tile, MP_INDUSTRY)) { if (IsTileType(location.tile, MP_INDUSTRY)) {
/* Industry nearby stations are already filtered by catchment. */ /* Industry nearby stations are already filtered by catchment. */
stations = &Industry::GetByTile(location.tile)->stations_near; *stations = Industry::GetByTile(location.tile)->stations_near;
return; return;
} else if (IsTileType(location.tile, MP_HOUSE)) { } else if (IsTileType(location.tile, MP_HOUSE)) {
/* Town nearby stations need to be filtered per tile. */ /* Town nearby stations need to be filtered per tile. */

View File

@@ -531,7 +531,7 @@ static void ChangePopulation(Town *t, int mod)
{ {
t->cache.population += mod; t->cache.population += mod;
InvalidateWindowData(WC_TOWN_VIEW, t->index); // Cargo requirements may appear/vanish for small populations InvalidateWindowData(WC_TOWN_VIEW, t->index); // Cargo requirements may appear/vanish for small populations
t->UpdateVirtCoord(); if (_settings_client.gui.population_in_label) t->UpdateVirtCoord();
InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1); InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1);
} }

View File

@@ -160,15 +160,14 @@ public:
SetDParam(1, c->index); SetDParam(1, c->index);
int r = this->town->ratings[c->index]; int r = this->town->ratings[c->index];
StringID str; StringID str = STR_CARGO_RATING_APPALLING;
(str = STR_CARGO_RATING_APPALLING, r <= RATING_APPALLING) || // Apalling if (r > RATING_APPALLING) str++;
(str++, r <= RATING_VERYPOOR) || // Very Poor if (r > RATING_VERYPOOR) str++;
(str++, r <= RATING_POOR) || // Poor if (r > RATING_POOR) str++;
(str++, r <= RATING_MEDIOCRE) || // Mediocore if (r > RATING_MEDIOCRE) str++;
(str++, r <= RATING_GOOD) || // Good if (r > RATING_GOOD) str++;
(str++, r <= RATING_VERYGOOD) || // Very Good if (r > RATING_VERYGOOD) str++;
(str++, r <= RATING_EXCELLENT) || // Excellent if (r > RATING_EXCELLENT) str++;
(str++, true); // Outstanding
SetDParam(2, str); SetDParam(2, str);
if (this->town->exclusivity == c->index) { if (this->town->exclusivity == c->index) {