Change: Support flipping shorter engines without NewGRF support. (#10262)

* Change: Support flipping shorter engines without NewGRF support.
* Cleanup: Remove write-only prop27_set temporary flag.
This commit is contained in:
PeterN
2022-12-23 21:02:14 +00:00
committed by GitHub
parent a971eee2e0
commit 7b5edba76c
6 changed files with 48 additions and 27 deletions

View File

@@ -328,7 +328,6 @@ struct GRFTempEngineData {
uint8 roadtramtype;
const GRFFile *defaultcargo_grf; ///< GRF defining the cargo translation table to use if the default cargo is the 'first refittable'.
Refittability refittability; ///< Did the newgrf set any refittability property? If not, default refittability will be applied.
bool prop27_set; ///< Did the NewGRF set property 27 (misc flags)?
uint8 rv_max_speed; ///< Temporary storage of RV prop 15, maximum speed in mph/0.8
CargoTypes ctt_include_mask; ///< Cargo types always included in the refit mask.
CargoTypes ctt_exclude_mask; ///< Cargo types always excluded from the refit mask.
@@ -1295,7 +1294,6 @@ static ChangeInfoResult RailVehicleChangeInfo(uint engine, int numinfo, int prop
case 0x27: // Miscellaneous flags
ei->misc_flags = buf->ReadByte();
_loaded_newgrf_features.has_2CC |= HasBit(ei->misc_flags, EF_USES_2CC);
_gted[e->index].prop27_set = true;
break;
case 0x28: // Cargo classes allowed
@@ -8985,13 +8983,6 @@ static void FinaliseEngineArray()
if (!HasBit(e->info.climates, _settings_game.game_creation.landscape)) continue;
/* When the train does not set property 27 (misc flags), but it
* is overridden by a NewGRF graphically we want to disable the
* flipping possibility. */
if (e->type == VEH_TRAIN && !_gted[e->index].prop27_set && e->GetGRF() != nullptr && is_custom_sprite(e->u.rail.image_index)) {
ClrBit(e->info.misc_flags, EF_RAIL_FLIPS);
}
/* Skip wagons, there livery is defined via the engine */
if (e->type != VEH_TRAIN || e->u.rail.railveh_type != RAILVEH_WAGON) {
LiveryScheme ls = GetEngineLiveryScheme(e->index, INVALID_ENGINE, nullptr);