mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-15 15:19:52 +00:00
Codechange: make GrfSpecFeature a scoped enum (#15487)
This commit is contained in:
+1
-1
@@ -451,7 +451,7 @@ public:
|
||||
}
|
||||
|
||||
/* strings such as 'Size' and 'Coverage Area' */
|
||||
r.top = DrawBadgeNameList(r, as->badges, GSF_AIRPORTS) + WidgetDimensions::scaled.vsep_normal;
|
||||
r.top = DrawBadgeNameList(r, as->badges, GrfSpecFeature::Airports) + WidgetDimensions::scaled.vsep_normal;
|
||||
r.top = DrawStationCoverageAreaText(r, SCT_ALL, rad, false) + WidgetDimensions::scaled.vsep_normal;
|
||||
r.top = DrawStationCoverageAreaText(r, SCT_ALL, rad, true);
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ public:
|
||||
|
||||
void OnInit() override
|
||||
{
|
||||
this->badge_classes = GUIBadgeClasses(static_cast<GrfSpecFeature>(GSF_TRAINS + this->vehicle_type));
|
||||
this->badge_classes = GUIBadgeClasses(static_cast<GrfSpecFeature>(GrfSpecFeature::Trains + this->vehicle_type));
|
||||
}
|
||||
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
|
||||
|
||||
@@ -859,7 +859,7 @@ int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number,
|
||||
|
||||
if (refittable) y = ShowRefitOptionsList(left, right, y, engine_number);
|
||||
|
||||
y = DrawBadgeNameList({left, y, right, INT16_MAX}, e->badges, static_cast<GrfSpecFeature>(GSF_TRAINS + e->type));
|
||||
y = DrawBadgeNameList({left, y, right, INT16_MAX}, e->badges, static_cast<GrfSpecFeature>(GrfSpecFeature::Trains + e->type));
|
||||
|
||||
/* Additional text from NewGRF */
|
||||
y = ShowAdditionalText(left, right, y, engine_number);
|
||||
@@ -877,7 +877,7 @@ int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number,
|
||||
|
||||
static void DrawEngineBadgeColumn(const Rect &r, int column_group, const GUIBadgeClasses &badge_classes, const Engine *e, PaletteID remap)
|
||||
{
|
||||
DrawBadgeColumn(r, column_group, badge_classes, e->badges, static_cast<GrfSpecFeature>(GSF_TRAINS + e->type), e->info.base_intro, remap);
|
||||
DrawBadgeColumn(r, column_group, badge_classes, e->badges, static_cast<GrfSpecFeature>(GrfSpecFeature::Trains + e->type), e->info.base_intro, remap);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1363,10 +1363,10 @@ struct BuildVehicleWindow : Window {
|
||||
|
||||
void OnInit() override
|
||||
{
|
||||
this->badge_classes = GUIBadgeClasses(static_cast<GrfSpecFeature>(GSF_TRAINS + this->vehicle_type));
|
||||
this->badge_classes = GUIBadgeClasses(static_cast<GrfSpecFeature>(GrfSpecFeature::Trains + this->vehicle_type));
|
||||
this->SetCargoFilterArray();
|
||||
|
||||
this->badge_filters = AddBadgeDropdownFilters(this, WID_BV_BADGE_FILTER, WID_BV_BADGE_FILTER, COLOUR_GREY, static_cast<GrfSpecFeature>(GSF_TRAINS + this->vehicle_type));
|
||||
this->badge_filters = AddBadgeDropdownFilters(this, WID_BV_BADGE_FILTER, WID_BV_BADGE_FILTER, COLOUR_GREY, static_cast<GrfSpecFeature>(GrfSpecFeature::Trains + this->vehicle_type));
|
||||
|
||||
this->widget_lookup.clear();
|
||||
this->nested_root->FillWidgetLookup(this->widget_lookup);
|
||||
@@ -1424,7 +1424,7 @@ struct BuildVehicleWindow : Window {
|
||||
|
||||
list.clear();
|
||||
|
||||
BadgeTextFilter btf(this->string_filter, GSF_TRAINS);
|
||||
BadgeTextFilter btf(this->string_filter, GrfSpecFeature::Trains);
|
||||
BadgeDropdownFilter bdf(this->badge_filter_choices);
|
||||
|
||||
/* Make list of all available train engines and wagons.
|
||||
@@ -1493,7 +1493,7 @@ struct BuildVehicleWindow : Window {
|
||||
|
||||
this->eng_list.clear();
|
||||
|
||||
BadgeTextFilter btf(this->string_filter, GSF_ROADVEHICLES);
|
||||
BadgeTextFilter btf(this->string_filter, GrfSpecFeature::RoadVehicles);
|
||||
BadgeDropdownFilter bdf(this->badge_filter_choices);
|
||||
|
||||
for (const Engine *e : Engine::IterateType(VEH_ROAD)) {
|
||||
@@ -1519,7 +1519,7 @@ struct BuildVehicleWindow : Window {
|
||||
EngineID sel_id = EngineID::Invalid();
|
||||
this->eng_list.clear();
|
||||
|
||||
BadgeTextFilter btf(this->string_filter, GSF_SHIPS);
|
||||
BadgeTextFilter btf(this->string_filter, GrfSpecFeature::Ships);
|
||||
BadgeDropdownFilter bdf(this->badge_filter_choices);
|
||||
|
||||
for (const Engine *e : Engine::IterateType(VEH_SHIP)) {
|
||||
@@ -1547,7 +1547,7 @@ struct BuildVehicleWindow : Window {
|
||||
|
||||
const Station *st = this->listview_mode ? nullptr : Station::GetByTile(TileIndex(this->window_number));
|
||||
|
||||
BadgeTextFilter btf(this->string_filter, GSF_AIRCRAFT);
|
||||
BadgeTextFilter btf(this->string_filter, GrfSpecFeature::Aircraft);
|
||||
BadgeDropdownFilter bdf(this->badge_filter_choices);
|
||||
|
||||
/* Make list of all available planes.
|
||||
@@ -1962,7 +1962,7 @@ struct BuildVehicleWindow : Window {
|
||||
break;
|
||||
|
||||
case WID_BV_CONFIGURE_BADGES: {
|
||||
bool reopen = HandleBadgeConfigurationDropDownClick(static_cast<GrfSpecFeature>(GSF_TRAINS + this->vehicle_type), BADGE_COLUMNS, index, click_result, this->badge_filter_choices);
|
||||
bool reopen = HandleBadgeConfigurationDropDownClick(static_cast<GrfSpecFeature>(GrfSpecFeature::Trains + this->vehicle_type), BADGE_COLUMNS, index, click_result, this->badge_filter_choices);
|
||||
|
||||
this->ReInit();
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ Industry::~Industry()
|
||||
for (TileIndex tile_cur : this->location) {
|
||||
if (IsTileType(tile_cur, TileType::Industry)) {
|
||||
if (GetIndustryIndex(tile_cur) == this->index) {
|
||||
DeleteNewGRFInspectWindow(GSF_INDUSTRYTILES, tile_cur.base());
|
||||
DeleteNewGRFInspectWindow(GrfSpecFeature::IndustryTiles, tile_cur.base());
|
||||
|
||||
/* MakeWaterKeepingClass() can also handle 'land' */
|
||||
MakeWaterKeepingClass(tile_cur, OWNER_NONE);
|
||||
@@ -199,7 +199,7 @@ Industry::~Industry()
|
||||
DeleteIndustryNews(this->index);
|
||||
CloseWindowById(WC_INDUSTRY_VIEW, this->index);
|
||||
CloseWindowById(WC_INDUSTRY_PRODUCTION, this->index);
|
||||
DeleteNewGRFInspectWindow(GSF_INDUSTRIES, this->index);
|
||||
DeleteNewGRFInspectWindow(GrfSpecFeature::Industries, this->index);
|
||||
|
||||
Source src{this->index, SourceType::Industry};
|
||||
DeleteSubsidyWith(src);
|
||||
|
||||
@@ -398,7 +398,7 @@ public:
|
||||
|
||||
void OnInit() override
|
||||
{
|
||||
this->badge_classes = GUIBadgeClasses{GSF_INDUSTRIES};
|
||||
this->badge_classes = GUIBadgeClasses{GrfSpecFeature::Industries};
|
||||
|
||||
/* Width of the legend blob -- slightly larger than the smallmap legend blob. */
|
||||
this->legend.height = GetCharacterHeight(FontSize::Small);
|
||||
@@ -524,11 +524,11 @@ public:
|
||||
|
||||
Rect tr = text;
|
||||
if (badge_column_widths.size() >= 1 && badge_column_widths[0] > 0) {
|
||||
DrawBadgeColumn(tr.WithWidth(badge_column_widths[0], rtl), 0, this->badge_classes, indsp->badges, GSF_INDUSTRIES, std::nullopt, PAL_NONE);
|
||||
DrawBadgeColumn(tr.WithWidth(badge_column_widths[0], rtl), 0, this->badge_classes, indsp->badges, GrfSpecFeature::Industries, std::nullopt, PAL_NONE);
|
||||
tr = tr.Indent(badge_column_widths[0], rtl);
|
||||
}
|
||||
if (badge_column_widths.size() >= 2 && badge_column_widths[1] > 0) {
|
||||
DrawBadgeColumn(tr.WithWidth(badge_column_widths[1], !rtl), 0, this->badge_classes, indsp->badges, GSF_INDUSTRIES, std::nullopt, PAL_NONE);
|
||||
DrawBadgeColumn(tr.WithWidth(badge_column_widths[1], !rtl), 0, this->badge_classes, indsp->badges, GrfSpecFeature::Industries, std::nullopt, PAL_NONE);
|
||||
tr = tr.Indent(badge_column_widths[1], !rtl);
|
||||
}
|
||||
|
||||
@@ -571,7 +571,7 @@ public:
|
||||
cargostring = this->MakeCargoListString(indsp->produced_cargo, cargo_suffix, STR_INDUSTRY_VIEW_PRODUCES_N_CARGO);
|
||||
ir.top = DrawStringMultiLine(ir, cargostring);
|
||||
|
||||
ir.top = DrawBadgeNameList(ir, indsp->badges, GSF_INDUSTRIES);
|
||||
ir.top = DrawBadgeNameList(ir, indsp->badges, GrfSpecFeature::Industries);
|
||||
|
||||
/* Get the additional purchase info text, if it has not already been queried. */
|
||||
if (indsp->callback_mask.Test(IndustryCallbackMask::FundMoreText)) {
|
||||
@@ -1173,12 +1173,12 @@ public:
|
||||
|
||||
bool IsNewGRFInspectable() const override
|
||||
{
|
||||
return ::IsNewGRFInspectable(GSF_INDUSTRIES, this->window_number);
|
||||
return ::IsNewGRFInspectable(GrfSpecFeature::Industries, this->window_number);
|
||||
}
|
||||
|
||||
void ShowNewGRFInspectWindow() const override
|
||||
{
|
||||
::ShowNewGRFInspectWindow(GSF_INDUSTRIES, this->window_number);
|
||||
::ShowNewGRFInspectWindow(GrfSpecFeature::Industries, this->window_number);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+12
-12
@@ -877,10 +877,10 @@ static void FinaliseEngineArray()
|
||||
switch (e->type) {
|
||||
case VEH_TRAIN:
|
||||
for (RailType rt : e->VehInfo<RailVehicleInfo>().railtypes) {
|
||||
AppendCopyableBadgeList(e->badges, GetRailTypeInfo(rt)->badges, GSF_TRAINS);
|
||||
AppendCopyableBadgeList(e->badges, GetRailTypeInfo(rt)->badges, GrfSpecFeature::Trains);
|
||||
}
|
||||
break;
|
||||
case VEH_ROAD: AppendCopyableBadgeList(e->badges, GetRoadTypeInfo(e->VehInfo<RoadVehicleInfo>().roadtype)->badges, GSF_ROADVEHICLES); break;
|
||||
case VEH_ROAD: AppendCopyableBadgeList(e->badges, GetRoadTypeInfo(e->VehInfo<RoadVehicleInfo>().roadtype)->badges, GrfSpecFeature::RoadVehicles); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
@@ -1485,7 +1485,7 @@ static void ActivateOldTramDepot()
|
||||
static void FinalisePriceBaseMultipliers()
|
||||
{
|
||||
/** Features, to which '_grf_id_overrides' applies. Currently vehicle features only. */
|
||||
static constexpr GrfSpecFeatures override_features{GSF_TRAINS, GSF_ROADVEHICLES, GSF_SHIPS, GSF_AIRCRAFT};
|
||||
static constexpr GrfSpecFeatures override_features{GrfSpecFeature::Trains, GrfSpecFeature::RoadVehicles, GrfSpecFeature::Ships, GrfSpecFeature::Aircraft};
|
||||
|
||||
/* Evaluate grf overrides */
|
||||
int num_grfs = (uint)_grf_files.size();
|
||||
@@ -1614,17 +1614,17 @@ static void FinaliseBadges()
|
||||
for (Engine *e : Engine::Iterate()) {
|
||||
if (e->grf_prop.grffile != &file) continue;
|
||||
e->badges.push_back(badge->index);
|
||||
badge->features.Set(static_cast<GrfSpecFeature>(GSF_TRAINS + e->type));
|
||||
badge->features.Set(static_cast<GrfSpecFeature>(GrfSpecFeature::Trains + e->type));
|
||||
}
|
||||
|
||||
AddBadgeToSpecs(file.stations, GSF_STATIONS, *badge);
|
||||
AddBadgeToSpecs(file.housespec, GSF_HOUSES, *badge);
|
||||
AddBadgeToSpecs(file.industryspec, GSF_INDUSTRIES, *badge);
|
||||
AddBadgeToSpecs(file.indtspec, GSF_INDUSTRYTILES, *badge);
|
||||
AddBadgeToSpecs(file.objectspec, GSF_OBJECTS, *badge);
|
||||
AddBadgeToSpecs(file.airportspec, GSF_AIRPORTS, *badge);
|
||||
AddBadgeToSpecs(file.airtspec, GSF_AIRPORTTILES, *badge);
|
||||
AddBadgeToSpecs(file.roadstops, GSF_ROADSTOPS, *badge);
|
||||
AddBadgeToSpecs(file.stations, GrfSpecFeature::Stations, *badge);
|
||||
AddBadgeToSpecs(file.housespec, GrfSpecFeature::Houses, *badge);
|
||||
AddBadgeToSpecs(file.industryspec, GrfSpecFeature::Industries, *badge);
|
||||
AddBadgeToSpecs(file.indtspec, GrfSpecFeature::IndustryTiles, *badge);
|
||||
AddBadgeToSpecs(file.objectspec, GrfSpecFeature::Objects, *badge);
|
||||
AddBadgeToSpecs(file.airportspec, GrfSpecFeature::Airports, *badge);
|
||||
AddBadgeToSpecs(file.airtspec, GrfSpecFeature::AirportTiles, *badge);
|
||||
AddBadgeToSpecs(file.roadstops, GrfSpecFeature::RoadStops, *badge);
|
||||
}
|
||||
|
||||
ApplyBadgeFeaturesToClassBadges();
|
||||
|
||||
+31
-31
@@ -68,40 +68,40 @@ enum class GrfMiscBit : uint8_t {
|
||||
|
||||
using GrfMiscBits = EnumBitSet<GrfMiscBit, uint8_t>;
|
||||
|
||||
enum GrfSpecFeature : uint8_t {
|
||||
GSF_TRAINS,
|
||||
GSF_ROADVEHICLES,
|
||||
GSF_SHIPS,
|
||||
GSF_AIRCRAFT,
|
||||
GSF_STATIONS,
|
||||
GSF_CANALS,
|
||||
GSF_BRIDGES,
|
||||
GSF_HOUSES,
|
||||
GSF_GLOBALVAR,
|
||||
GSF_INDUSTRYTILES,
|
||||
GSF_INDUSTRIES,
|
||||
GSF_CARGOES,
|
||||
GSF_SOUNDFX,
|
||||
GSF_AIRPORTS,
|
||||
GSF_SIGNALS,
|
||||
GSF_OBJECTS,
|
||||
GSF_RAILTYPES,
|
||||
GSF_AIRPORTTILES,
|
||||
GSF_ROADTYPES,
|
||||
GSF_TRAMTYPES,
|
||||
GSF_ROADSTOPS,
|
||||
GSF_BADGES,
|
||||
GSF_END,
|
||||
enum class GrfSpecFeature : uint8_t {
|
||||
Trains, ///< Trains feature
|
||||
RoadVehicles, ///< Road vehicles feature
|
||||
Ships, ///< Ships feature
|
||||
Aircraft, ///< Aircraft feature
|
||||
Stations, ///< Stations feature
|
||||
Canals, ///< Canals feature
|
||||
Bridges, ///< Bridges feature
|
||||
Houses, ///< Houses feature
|
||||
GlobalVar, ///< Global variables feature
|
||||
IndustryTiles, ///< Industry tiles feature
|
||||
Industries, ///< Industries feature
|
||||
Cargoes, ///< Cargoes feature
|
||||
SoundEffects, ///< Sound effects feature
|
||||
Airports, ///< Airports feature
|
||||
Signals, ///< Signals feature
|
||||
Objects, ///< Objects feature
|
||||
RailTypes, ///< Rail types feature
|
||||
AirportTiles, ///< Airport tiles feature
|
||||
RoadTypes, ///< Road types feature
|
||||
TramTypes, ///< Tram types feature
|
||||
RoadStops, ///< Road stops feature
|
||||
Badges, ///< Badges feature
|
||||
End, ///< End marker
|
||||
|
||||
GSF_DEFAULT = GSF_END, ///< Unspecified feature, default badge
|
||||
GSF_FAKE_TOWNS = GSF_END, ///< Fake town GrfSpecFeature for NewGRF debugging (parent scope)
|
||||
GSF_FAKE_END, ///< End of the fake features
|
||||
Default = End, ///< Unspecified feature, default badge
|
||||
FakeTowns = End, ///< Fake town GrfSpecFeature for NewGRF debugging (parent scope)
|
||||
FakeEnd, ///< End of the fake features
|
||||
|
||||
GSF_ORIGINAL_STRINGS = 0x48,
|
||||
OriginalStrings = 0x48, ///< Pseudo unsupported 'feature' for replacing original strings
|
||||
|
||||
GSF_INVALID = 0xFF, ///< An invalid spec feature
|
||||
Invalid = 0xFF, ///< An invalid spec feature
|
||||
};
|
||||
using GrfSpecFeatures = EnumBitSet<GrfSpecFeature, uint32_t, GrfSpecFeature::GSF_END>;
|
||||
using GrfSpecFeatures = EnumBitSet<GrfSpecFeature, uint32_t, GrfSpecFeature::End>;
|
||||
|
||||
static const uint32_t INVALID_GRFID = 0xFFFFFFFF;
|
||||
|
||||
@@ -208,7 +208,7 @@ struct GRFLoadedFeatures {
|
||||
struct PriceBaseSpec {
|
||||
Money start_price; ///< Default value at game start, before adding multipliers.
|
||||
PriceCategory category; ///< Price is affected by certain difficulty settings.
|
||||
GrfSpecFeature grf_feature; ///< GRF Feature that decides whether price multipliers apply locally or globally, #GSF_END if none.
|
||||
GrfSpecFeature grf_feature; ///< GRF Feature that decides whether price multipliers apply locally or globally, #GrfSpecFeature::End if none.
|
||||
Price fallback_price; ///< Fallback price multiplier for new prices but old grfs.
|
||||
};
|
||||
|
||||
|
||||
+34
-11
@@ -140,6 +140,16 @@ bool HandleChangeInfoResult(std::string_view caller, ChangeInfoResult cir, GrfSp
|
||||
|
||||
/** Helper class to invoke a GrfChangeInfoHandler. */
|
||||
struct InvokeGrfChangeInfoHandler {
|
||||
/**
|
||||
* Invoke the change info handler for a specific feature.
|
||||
* @tparam TFeature The feature.
|
||||
* @param first The first id of the feature instance (engine, station, ...) to activate for.
|
||||
* @param last The id to stop iterating at (exclusive).
|
||||
* @param prop The property to activate for.
|
||||
* @param buf The buffer containing the sprite data.
|
||||
* @param stage The current loading stage.
|
||||
* @return Whether it was successful, or why it wasn't.
|
||||
*/
|
||||
template <GrfSpecFeature TFeature>
|
||||
static ChangeInfoResult Invoke(uint first, uint last, int prop, ByteReader &buf, GrfLoadingStage stage)
|
||||
{
|
||||
@@ -150,19 +160,32 @@ struct InvokeGrfChangeInfoHandler {
|
||||
}
|
||||
}
|
||||
|
||||
/** The function prototype for a change info handler. */
|
||||
using Invoker = ChangeInfoResult(*)(uint first, uint last, int prop, ByteReader &buf, GrfLoadingStage stage);
|
||||
static constexpr Invoker funcs[] { // Must be listed in feature order.
|
||||
Invoke<GSF_TRAINS>, Invoke<GSF_ROADVEHICLES>, Invoke<GSF_SHIPS>, Invoke<GSF_AIRCRAFT>,
|
||||
Invoke<GSF_STATIONS>, Invoke<GSF_CANALS>, Invoke<GSF_BRIDGES>, Invoke<GSF_HOUSES>,
|
||||
Invoke<GSF_GLOBALVAR>, Invoke<GSF_INDUSTRYTILES>, Invoke<GSF_INDUSTRIES>, Invoke<GSF_CARGOES>,
|
||||
Invoke<GSF_SOUNDFX>, Invoke<GSF_AIRPORTS>, nullptr /* GSF_SIGNALS */, Invoke<GSF_OBJECTS>,
|
||||
Invoke<GSF_RAILTYPES>, Invoke<GSF_AIRPORTTILES>, Invoke<GSF_ROADTYPES>, Invoke<GSF_TRAMTYPES>,
|
||||
Invoke<GSF_ROADSTOPS>, Invoke<GSF_BADGES>,
|
||||
|
||||
/** List of invoke handlers for each feature. */
|
||||
static constexpr EnumClassIndexContainer<std::array<Invoker, to_underlying(GrfSpecFeature::End)>, GrfSpecFeature> funcs { // Must be listed in feature order.
|
||||
Invoke<GrfSpecFeature::Trains>, Invoke<GrfSpecFeature::RoadVehicles>, Invoke<GrfSpecFeature::Ships>, Invoke<GrfSpecFeature::Aircraft>,
|
||||
Invoke<GrfSpecFeature::Stations>, Invoke<GrfSpecFeature::Canals>, Invoke<GrfSpecFeature::Bridges>, Invoke<GrfSpecFeature::Houses>,
|
||||
Invoke<GrfSpecFeature::GlobalVar>, Invoke<GrfSpecFeature::IndustryTiles>, Invoke<GrfSpecFeature::Industries>, Invoke<GrfSpecFeature::Cargoes>,
|
||||
Invoke<GrfSpecFeature::SoundEffects>, Invoke<GrfSpecFeature::Airports>, nullptr /* GrfSpecFeature::Signals */, Invoke<GrfSpecFeature::Objects>,
|
||||
Invoke<GrfSpecFeature::RailTypes>, Invoke<GrfSpecFeature::AirportTiles>, Invoke<GrfSpecFeature::RoadTypes>, Invoke<GrfSpecFeature::TramTypes>,
|
||||
Invoke<GrfSpecFeature::RoadStops>, Invoke<GrfSpecFeature::Badges>,
|
||||
};
|
||||
|
||||
/**
|
||||
* Invoke the change info handler for a specific feature.
|
||||
* @param feature The feature.
|
||||
* @param first The first id of the feature instance (engine, station, ...) to activate for.
|
||||
* @param last The id to stop iterating at (exclusive).
|
||||
* @param prop The property to activate for.
|
||||
* @param buf The buffer containing the sprite data.
|
||||
* @param stage The current loading stage.
|
||||
* @return Whether it was successful, or why it wasn't.
|
||||
*/
|
||||
static ChangeInfoResult Invoke(GrfSpecFeature feature, uint first, uint last, int prop, ByteReader &buf, GrfLoadingStage stage)
|
||||
{
|
||||
Invoker func = feature < std::size(funcs) ? funcs[feature] : nullptr;
|
||||
Invoker func = to_underlying(feature) < std::size(funcs) ? funcs[feature] : nullptr;
|
||||
if (func == nullptr) return ChangeInfoResult::Unknown;
|
||||
return func(first, last, prop, buf, stage);
|
||||
}
|
||||
@@ -187,7 +210,7 @@ static void FeatureChangeInfo(ByteReader &buf)
|
||||
uint numinfo = buf.ReadByte();
|
||||
uint engine = buf.ReadExtendedByte();
|
||||
|
||||
if (feature >= GSF_END) {
|
||||
if (feature >= GrfSpecFeature::End) {
|
||||
GrfMsg(1, "FeatureChangeInfo: Unsupported feature 0x{:02X}, skipping", feature);
|
||||
return;
|
||||
}
|
||||
@@ -222,12 +245,12 @@ static void SafeChangeInfo(ByteReader &buf)
|
||||
uint numinfo = buf.ReadByte();
|
||||
buf.ReadExtendedByte(); // id
|
||||
|
||||
if (feature == GSF_BRIDGES && numprops == 1) {
|
||||
if (feature == GrfSpecFeature::Bridges && numprops == 1) {
|
||||
uint8_t prop = buf.ReadByte();
|
||||
/* Bridge property 0x0D is redefinition of sprite layout tables, which
|
||||
* is considered safe. */
|
||||
if (prop == 0x0D) return;
|
||||
} else if (feature == GSF_GLOBALVAR && numprops == 1) {
|
||||
} else if (feature == GrfSpecFeature::GlobalVar && numprops == 1) {
|
||||
uint8_t prop = buf.ReadByte();
|
||||
/* Engine ID Mappings are safe, if the source is static */
|
||||
if (prop == 0x11) {
|
||||
|
||||
@@ -185,7 +185,7 @@ static ChangeInfoResult AircraftVehicleChangeInfo(uint first, uint last, int pro
|
||||
break;
|
||||
|
||||
case 0x24: // Badge list
|
||||
e->badges = ReadBadgeList(buf, GSF_AIRCRAFT);
|
||||
e->badges = ReadBadgeList(buf, GrfSpecFeature::Aircraft);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -198,6 +198,6 @@ static ChangeInfoResult AircraftVehicleChangeInfo(uint first, uint last, int pro
|
||||
}
|
||||
|
||||
/** @copybrief GrfChangeInfoHandler::Reserve @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_AIRCRAFT>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Aircraft>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_AIRCRAFT>::Activation(uint first, uint last, int prop, ByteReader &buf) { return AircraftVehicleChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Aircraft>::Activation(uint first, uint last, int prop, ByteReader &buf) { return AircraftVehicleChangeInfo(first, last, prop, buf); }
|
||||
|
||||
@@ -161,7 +161,7 @@ static ChangeInfoResult AirportChangeInfo(uint first, uint last, int prop, ByteR
|
||||
break;
|
||||
|
||||
case 0x12: // Badge list
|
||||
as->badges = ReadBadgeList(buf, GSF_AIRPORTS);
|
||||
as->badges = ReadBadgeList(buf, GrfSpecFeature::Airports);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -249,7 +249,7 @@ static ChangeInfoResult AirportTilesChangeInfo(uint first, uint last, int prop,
|
||||
break;
|
||||
|
||||
case 0x12: // Badge list
|
||||
tsp->badges = ReadBadgeList(buf, GSF_TRAMTYPES);
|
||||
tsp->badges = ReadBadgeList(buf, GrfSpecFeature::TramTypes);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -262,11 +262,11 @@ static ChangeInfoResult AirportTilesChangeInfo(uint first, uint last, int prop,
|
||||
}
|
||||
|
||||
/** @copybrief GrfChangeInfoHandler::Reserve @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_AIRPORTS>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Airports>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_AIRPORTS>::Activation(uint first, uint last, int prop, ByteReader &buf) { return AirportChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Airports>::Activation(uint first, uint last, int prop, ByteReader &buf) { return AirportChangeInfo(first, last, prop, buf); }
|
||||
|
||||
/** @copybrief GrfChangeInfoHandler::Reserve @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_AIRPORTTILES>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::AirportTiles>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_AIRPORTTILES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return AirportTilesChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::AirportTiles>::Activation(uint first, uint last, int prop, ByteReader &buf) { return AirportTilesChangeInfo(first, last, prop, buf); }
|
||||
|
||||
@@ -56,6 +56,6 @@ static ChangeInfoResult BadgeChangeInfo(uint first, uint last, int prop, ByteRea
|
||||
}
|
||||
|
||||
/** @copybrief GrfChangeInfoHandler::Reserve @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_BADGES>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Badges>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_BADGES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return BadgeChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Badges>::Activation(uint first, uint last, int prop, ByteReader &buf) { return BadgeChangeInfo(first, last, prop, buf); }
|
||||
|
||||
@@ -146,6 +146,6 @@ static ChangeInfoResult BridgeChangeInfo(uint first, uint last, int prop, ByteRe
|
||||
}
|
||||
|
||||
/** @copybrief GrfChangeInfoHandler::Reserve @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_BRIDGES>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Bridges>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_BRIDGES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return BridgeChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Bridges>::Activation(uint first, uint last, int prop, ByteReader &buf) { return BridgeChangeInfo(first, last, prop, buf); }
|
||||
|
||||
@@ -53,6 +53,6 @@ static ChangeInfoResult CanalChangeInfo(uint first, uint last, int prop, ByteRea
|
||||
}
|
||||
|
||||
/** @copybrief GrfChangeInfoHandler::Reserve @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_CANALS>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Canals>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_CANALS>::Activation(uint first, uint last, int prop, ByteReader &buf) { return CanalChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Canals>::Activation(uint first, uint last, int prop, ByteReader &buf) { return CanalChangeInfo(first, last, prop, buf); }
|
||||
|
||||
@@ -198,6 +198,6 @@ static ChangeInfoResult CargoReserveInfo(uint first, uint last, int prop, ByteRe
|
||||
}
|
||||
|
||||
/** @copydoc GrfChangeInfoHandler::Reserve */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_CARGOES>::Reserve(uint first, uint last, int prop, ByteReader &buf) { return CargoReserveInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Cargoes>::Reserve(uint first, uint last, int prop, ByteReader &buf) { return CargoReserveInfo(first, last, prop, buf); }
|
||||
/** @copybrief GrfChangeInfoHandler::Activation @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_CARGOES>::Activation(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Cargoes>::Activation(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
|
||||
@@ -554,6 +554,6 @@ bool GetGlobalVariable(uint8_t param, uint32_t *value, const GRFFile *grffile)
|
||||
}
|
||||
|
||||
/** @copydoc GrfChangeInfoHandler::Reserve */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_GLOBALVAR>::Reserve(uint first, uint last, int prop, ByteReader &buf) { return GlobalVarReserveInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::GlobalVar>::Reserve(uint first, uint last, int prop, ByteReader &buf) { return GlobalVarReserveInfo(first, last, prop, buf); }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_GLOBALVAR>::Activation(uint first, uint last, int prop, ByteReader &buf) { return GlobalVarChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::GlobalVar>::Activation(uint first, uint last, int prop, ByteReader &buf) { return GlobalVarChangeInfo(first, last, prop, buf); }
|
||||
|
||||
@@ -343,7 +343,7 @@ static ChangeInfoResult TownHouseChangeInfo(uint first, uint last, int prop, Byt
|
||||
}
|
||||
|
||||
case 0x24: // Badge list
|
||||
housespec->badges = ReadBadgeList(buf, GSF_HOUSES);
|
||||
housespec->badges = ReadBadgeList(buf, GrfSpecFeature::Houses);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -356,6 +356,6 @@ static ChangeInfoResult TownHouseChangeInfo(uint first, uint last, int prop, Byt
|
||||
}
|
||||
|
||||
/** @copybrief GrfChangeInfoHandler::Reserve @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_HOUSES>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Houses>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_HOUSES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return TownHouseChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Houses>::Activation(uint first, uint last, int prop, ByteReader &buf) { return TownHouseChangeInfo(first, last, prop, buf); }
|
||||
|
||||
@@ -191,7 +191,7 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint first, uint last, int prop,
|
||||
}
|
||||
|
||||
case 0x14: // Badge list
|
||||
tsp->badges = ReadBadgeList(buf, GSF_INDUSTRYTILES);
|
||||
tsp->badges = ReadBadgeList(buf, GrfSpecFeature::IndustryTiles);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -691,7 +691,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint first, uint last, int prop, By
|
||||
}
|
||||
|
||||
case 0x29: // Badge list
|
||||
indsp->badges = ReadBadgeList(buf, GSF_INDUSTRIES);
|
||||
indsp->badges = ReadBadgeList(buf, GrfSpecFeature::Industries);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -704,11 +704,11 @@ static ChangeInfoResult IndustriesChangeInfo(uint first, uint last, int prop, By
|
||||
}
|
||||
|
||||
/** @copybrief GrfChangeInfoHandler::Reserve @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_INDUSTRYTILES>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::IndustryTiles>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_INDUSTRYTILES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return IndustrytilesChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::IndustryTiles>::Activation(uint first, uint last, int prop, ByteReader &buf) { return IndustrytilesChangeInfo(first, last, prop, buf); }
|
||||
|
||||
/** @copybrief GrfChangeInfoHandler::Reserve @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_INDUSTRIES>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Industries>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_INDUSTRIES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return IndustriesChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Industries>::Activation(uint first, uint last, int prop, ByteReader &buf) { return IndustriesChangeInfo(first, last, prop, buf); }
|
||||
|
||||
@@ -187,7 +187,7 @@ static ChangeInfoResult ObjectChangeInfo(uint first, uint last, int prop, ByteRe
|
||||
break;
|
||||
|
||||
case 0x19: // Badge list
|
||||
spec->badges = ReadBadgeList(buf, GSF_OBJECTS);
|
||||
spec->badges = ReadBadgeList(buf, GrfSpecFeature::Objects);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -200,6 +200,6 @@ static ChangeInfoResult ObjectChangeInfo(uint first, uint last, int prop, ByteRe
|
||||
}
|
||||
|
||||
/** @copybrief GrfChangeInfoHandler::Reserve @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_OBJECTS>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Objects>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_OBJECTS>::Activation(uint first, uint last, int prop, ByteReader &buf) { return ObjectChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Objects>::Activation(uint first, uint last, int prop, ByteReader &buf) { return ObjectChangeInfo(first, last, prop, buf); }
|
||||
|
||||
@@ -147,7 +147,7 @@ static ChangeInfoResult RailTypeChangeInfo(uint first, uint last, int prop, Byte
|
||||
break;
|
||||
|
||||
case 0x1E: // Badge list
|
||||
rti->badges = ReadBadgeList(buf, GSF_RAILTYPES);
|
||||
rti->badges = ReadBadgeList(buf, GrfSpecFeature::RailTypes);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -245,6 +245,6 @@ static ChangeInfoResult RailTypeReserveInfo(uint first, uint last, int prop, Byt
|
||||
}
|
||||
|
||||
/** @copydoc GrfChangeInfoHandler::Reserve */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_RAILTYPES>::Reserve(uint first, uint last, int prop, ByteReader &buf) { return RailTypeReserveInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::RailTypes>::Reserve(uint first, uint last, int prop, ByteReader &buf) { return RailTypeReserveInfo(first, last, prop, buf); }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_RAILTYPES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return RailTypeChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::RailTypes>::Activation(uint first, uint last, int prop, ByteReader &buf) { return RailTypeChangeInfo(first, last, prop, buf); }
|
||||
|
||||
@@ -169,7 +169,7 @@ static ChangeInfoResult RoadStopChangeInfo(uint first, uint last, int prop, Byte
|
||||
break;
|
||||
|
||||
case 0x16: // Badge list
|
||||
rs->badges = ReadBadgeList(buf, GSF_ROADSTOPS);
|
||||
rs->badges = ReadBadgeList(buf, GrfSpecFeature::RoadStops);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -182,6 +182,6 @@ static ChangeInfoResult RoadStopChangeInfo(uint first, uint last, int prop, Byte
|
||||
}
|
||||
|
||||
/** @copybrief GrfChangeInfoHandler::Reserve @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_ROADSTOPS>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::RoadStops>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_ROADSTOPS>::Activation(uint first, uint last, int prop, ByteReader &buf) { return RoadStopChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::RoadStops>::Activation(uint first, uint last, int prop, ByteReader &buf) { return RoadStopChangeInfo(first, last, prop, buf); }
|
||||
|
||||
@@ -134,7 +134,7 @@ static ChangeInfoResult RoadTypeChangeInfo(uint first, uint last, int prop, Byte
|
||||
break;
|
||||
|
||||
case 0x1E: // Badge list
|
||||
rti->badges = ReadBadgeList(buf, GSF_ROADTYPES);
|
||||
rti->badges = ReadBadgeList(buf, GrfSpecFeature::RoadTypes);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -229,11 +229,11 @@ static ChangeInfoResult RoadTypeReserveInfo(uint first, uint last, int prop, Byt
|
||||
}
|
||||
|
||||
/** @copydoc GrfChangeInfoHandler::Reserve */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_ROADTYPES>::Reserve(uint first, uint last, int prop, ByteReader &buf) { return RoadTypeReserveInfo(first, last, prop, buf, RoadTramType::Road); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::RoadTypes>::Reserve(uint first, uint last, int prop, ByteReader &buf) { return RoadTypeReserveInfo(first, last, prop, buf, RoadTramType::Road); }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_ROADTYPES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return RoadTypeChangeInfo(first, last, prop, buf, RoadTramType::Road); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::RoadTypes>::Activation(uint first, uint last, int prop, ByteReader &buf) { return RoadTypeChangeInfo(first, last, prop, buf, RoadTramType::Road); }
|
||||
|
||||
/** @copydoc GrfChangeInfoHandler::Reserve */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_TRAMTYPES>::Reserve(uint first, uint last, int prop, ByteReader &buf) { return RoadTypeReserveInfo(first, last, prop, buf, RoadTramType::Tram); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::TramTypes>::Reserve(uint first, uint last, int prop, ByteReader &buf) { return RoadTypeReserveInfo(first, last, prop, buf, RoadTramType::Tram); }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_TRAMTYPES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return RoadTypeChangeInfo(first, last, prop, buf, RoadTramType::Tram); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::TramTypes>::Activation(uint first, uint last, int prop, ByteReader &buf) { return RoadTypeChangeInfo(first, last, prop, buf, RoadTramType::Tram); }
|
||||
|
||||
@@ -222,7 +222,7 @@ static ChangeInfoResult RoadVehicleChangeInfo(uint first, uint last, int prop, B
|
||||
break;
|
||||
|
||||
case 0x2A: // Badge list
|
||||
e->badges = ReadBadgeList(buf, GSF_ROADVEHICLES);
|
||||
e->badges = ReadBadgeList(buf, GrfSpecFeature::RoadVehicles);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -235,6 +235,6 @@ static ChangeInfoResult RoadVehicleChangeInfo(uint first, uint last, int prop, B
|
||||
}
|
||||
|
||||
/** @copybrief GrfChangeInfoHandler::Reserve @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_ROADVEHICLES>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::RoadVehicles>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_ROADVEHICLES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return RoadVehicleChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::RoadVehicles>::Activation(uint first, uint last, int prop, ByteReader &buf) { return RoadVehicleChangeInfo(first, last, prop, buf); }
|
||||
|
||||
@@ -209,7 +209,7 @@ static ChangeInfoResult ShipVehicleChangeInfo(uint first, uint last, int prop, B
|
||||
break;
|
||||
|
||||
case 0x26: // Badge list
|
||||
e->badges = ReadBadgeList(buf, GSF_SHIPS);
|
||||
e->badges = ReadBadgeList(buf, GrfSpecFeature::Ships);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -222,6 +222,6 @@ static ChangeInfoResult ShipVehicleChangeInfo(uint first, uint last, int prop, B
|
||||
}
|
||||
|
||||
/** @copybrief GrfChangeInfoHandler::Reserve @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_SHIPS>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Ships>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_SHIPS>::Activation(uint first, uint last, int prop, ByteReader &buf) { return ShipVehicleChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Ships>::Activation(uint first, uint last, int prop, ByteReader &buf) { return ShipVehicleChangeInfo(first, last, prop, buf); }
|
||||
|
||||
@@ -74,6 +74,6 @@ static ChangeInfoResult SoundEffectChangeInfo(uint first, uint last, int prop, B
|
||||
}
|
||||
|
||||
/** @copybrief GrfChangeInfoHandler::Reserve @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_SOUNDFX>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::SoundEffects>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_SOUNDFX>::Activation(uint first, uint last, int prop, ByteReader &buf) { return SoundEffectChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::SoundEffects>::Activation(uint first, uint last, int prop, ByteReader &buf) { return SoundEffectChangeInfo(first, last, prop, buf); }
|
||||
|
||||
@@ -79,7 +79,7 @@ static ChangeInfoResult StationChangeInfo(uint first, uint last, int prop, ByteR
|
||||
continue;
|
||||
}
|
||||
|
||||
ReadSpriteLayoutSprite(buf, false, false, false, GSF_STATIONS, &dts->ground);
|
||||
ReadSpriteLayoutSprite(buf, false, false, false, GrfSpecFeature::Stations, &dts->ground);
|
||||
/* On error, bail out immediately. Temporary GRF data was already freed */
|
||||
if (_cur_gps.skip_sprites < 0) return ChangeInfoResult::Disabled;
|
||||
|
||||
@@ -97,7 +97,7 @@ static ChangeInfoResult StationChangeInfo(uint first, uint last, int prop, ByteR
|
||||
dtss.extent.y = buf.ReadByte();
|
||||
dtss.extent.z = buf.ReadByte();
|
||||
|
||||
ReadSpriteLayoutSprite(buf, false, true, false, GSF_STATIONS, &dtss.image);
|
||||
ReadSpriteLayoutSprite(buf, false, true, false, GrfSpecFeature::Stations, &dtss.image);
|
||||
/* On error, bail out immediately. Temporary GRF data was already freed */
|
||||
if (_cur_gps.skip_sprites < 0) return ChangeInfoResult::Disabled;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ static ChangeInfoResult StationChangeInfo(uint first, uint last, int prop, ByteR
|
||||
NewGRFSpriteLayout *dts = &statspec->renderdata.emplace_back();
|
||||
uint num_building_sprites = buf.ReadByte();
|
||||
/* On error, bail out immediately. Temporary GRF data was already freed */
|
||||
if (ReadSpriteLayout(buf, num_building_sprites, false, GSF_STATIONS, true, false, dts)) return ChangeInfoResult::Disabled;
|
||||
if (ReadSpriteLayout(buf, num_building_sprites, false, GrfSpecFeature::Stations, true, false, dts)) return ChangeInfoResult::Disabled;
|
||||
}
|
||||
|
||||
/* Number of layouts must be even, alternating X and Y */
|
||||
@@ -291,7 +291,7 @@ static ChangeInfoResult StationChangeInfo(uint first, uint last, int prop, ByteR
|
||||
}
|
||||
|
||||
case 0x1F: // Badge list
|
||||
statspec->badges = ReadBadgeList(buf, GSF_STATIONS);
|
||||
statspec->badges = ReadBadgeList(buf, GrfSpecFeature::Stations);
|
||||
break;
|
||||
|
||||
case 0x20: { // Minimum bridge height (extended)
|
||||
@@ -322,6 +322,6 @@ static ChangeInfoResult StationChangeInfo(uint first, uint last, int prop, ByteR
|
||||
}
|
||||
|
||||
/** @copybrief GrfChangeInfoHandler::Reserve @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_STATIONS>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Stations>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_STATIONS>::Activation(uint first, uint last, int prop, ByteReader &buf) { return StationChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Stations>::Activation(uint first, uint last, int prop, ByteReader &buf) { return StationChangeInfo(first, last, prop, buf); }
|
||||
|
||||
@@ -325,7 +325,7 @@ ChangeInfoResult RailVehicleChangeInfo(uint first, uint last, int prop, ByteRead
|
||||
break;
|
||||
|
||||
case 0x33: // Badge list
|
||||
e->badges = ReadBadgeList(buf, GSF_TRAINS);
|
||||
e->badges = ReadBadgeList(buf, GrfSpecFeature::Trains);
|
||||
break;
|
||||
|
||||
case 0x34: { // List of track types
|
||||
@@ -354,6 +354,6 @@ ChangeInfoResult RailVehicleChangeInfo(uint first, uint last, int prop, ByteRead
|
||||
}
|
||||
|
||||
/** @copybrief GrfChangeInfoHandler::Reserve @return Always ChangeInfoResult::Unhandled. */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_TRAINS>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Trains>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
|
||||
/** @copydoc GrfChangeInfoHandler::Activation */
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_TRAINS>::Activation(uint first, uint last, int prop, ByteReader &buf) { return RailVehicleChangeInfo(first, last, prop, buf); }
|
||||
template <> ChangeInfoResult GrfChangeInfoHandler<GrfSpecFeature::Trains>::Activation(uint first, uint last, int prop, ByteReader &buf) { return RailVehicleChangeInfo(first, last, prop, buf); }
|
||||
|
||||
@@ -44,7 +44,7 @@ static void NewSpriteSet(ByteReader &buf)
|
||||
}
|
||||
uint16_t num_ents = buf.ReadExtendedByte();
|
||||
|
||||
if (feature >= GSF_END) {
|
||||
if (feature >= GrfSpecFeature::End) {
|
||||
_cur_gps.skip_sprites = num_sets * num_ents;
|
||||
GrfMsg(1, "NewSpriteSet: Unsupported feature 0x{:02X}, skipping {} sprites", feature, _cur_gps.skip_sprites);
|
||||
return;
|
||||
|
||||
+20
-20
@@ -349,7 +349,7 @@ static void NewSpriteGroup(ByteReader &buf)
|
||||
const SpriteGroup *act_group = nullptr;
|
||||
|
||||
GrfSpecFeature feature{buf.ReadByte()};
|
||||
if (feature >= GSF_END) {
|
||||
if (feature >= GrfSpecFeature::End) {
|
||||
GrfMsg(1, "NewSpriteGroup: Unsupported feature 0x{:02X}, skipping", feature);
|
||||
return;
|
||||
}
|
||||
@@ -500,7 +500,7 @@ static void NewSpriteGroup(ByteReader &buf)
|
||||
group->var_scope = HasBit(type, 1) ? VSG_SCOPE_PARENT : VSG_SCOPE_SELF;
|
||||
|
||||
if (HasBit(type, 2)) {
|
||||
if (feature <= GSF_AIRCRAFT) group->var_scope = VSG_SCOPE_RELATIVE;
|
||||
if (feature <= GrfSpecFeature::Aircraft) group->var_scope = VSG_SCOPE_RELATIVE;
|
||||
group->count = buf.ReadByte();
|
||||
}
|
||||
|
||||
@@ -531,18 +531,18 @@ static void NewSpriteGroup(ByteReader &buf)
|
||||
}
|
||||
|
||||
switch (feature) {
|
||||
case GSF_TRAINS:
|
||||
case GSF_ROADVEHICLES:
|
||||
case GSF_SHIPS:
|
||||
case GSF_AIRCRAFT:
|
||||
case GSF_STATIONS:
|
||||
case GSF_CANALS:
|
||||
case GSF_CARGOES:
|
||||
case GSF_AIRPORTS:
|
||||
case GSF_RAILTYPES:
|
||||
case GSF_ROADTYPES:
|
||||
case GSF_TRAMTYPES:
|
||||
case GSF_BADGES:
|
||||
case GrfSpecFeature::Trains:
|
||||
case GrfSpecFeature::RoadVehicles:
|
||||
case GrfSpecFeature::Ships:
|
||||
case GrfSpecFeature::Aircraft:
|
||||
case GrfSpecFeature::Stations:
|
||||
case GrfSpecFeature::Canals:
|
||||
case GrfSpecFeature::Cargoes:
|
||||
case GrfSpecFeature::Airports:
|
||||
case GrfSpecFeature::RailTypes:
|
||||
case GrfSpecFeature::RoadTypes:
|
||||
case GrfSpecFeature::TramTypes:
|
||||
case GrfSpecFeature::Badges:
|
||||
{
|
||||
uint8_t num_loaded = type;
|
||||
uint8_t num_loading = buf.ReadByte();
|
||||
@@ -614,11 +614,11 @@ static void NewSpriteGroup(ByteReader &buf)
|
||||
break;
|
||||
}
|
||||
|
||||
case GSF_HOUSES:
|
||||
case GSF_AIRPORTTILES:
|
||||
case GSF_OBJECTS:
|
||||
case GSF_INDUSTRYTILES:
|
||||
case GSF_ROADSTOPS: {
|
||||
case GrfSpecFeature::Houses:
|
||||
case GrfSpecFeature::AirportTiles:
|
||||
case GrfSpecFeature::Objects:
|
||||
case GrfSpecFeature::IndustryTiles:
|
||||
case GrfSpecFeature::RoadStops: {
|
||||
uint8_t num_building_sprites = std::max((uint8_t)1, type);
|
||||
|
||||
assert(TileLayoutSpriteGroup::CanAllocateItem());
|
||||
@@ -631,7 +631,7 @@ static void NewSpriteGroup(ByteReader &buf)
|
||||
break;
|
||||
}
|
||||
|
||||
case GSF_INDUSTRIES: {
|
||||
case GrfSpecFeature::Industries: {
|
||||
if (type > 2) {
|
||||
GrfMsg(1, "NewSpriteGroup: Unsupported industry production version {}, skipping", type);
|
||||
break;
|
||||
|
||||
+23
-23
@@ -36,7 +36,7 @@
|
||||
static CargoType TranslateCargo(GrfSpecFeature feature, uint8_t ctype)
|
||||
{
|
||||
/* Special cargo types for purchase list and stations */
|
||||
if ((feature == GSF_STATIONS || feature == GSF_ROADSTOPS) && ctype == 0xFE) return CargoGRFFileProps::SG_DEFAULT_NA;
|
||||
if ((feature == GrfSpecFeature::Stations || feature == GrfSpecFeature::RoadStops) && ctype == 0xFE) return CargoGRFFileProps::SG_DEFAULT_NA;
|
||||
if (ctype == 0xFF) return CargoGRFFileProps::SG_PURCHASE;
|
||||
|
||||
auto cargo_list = GetCargoTranslationTable(*_cur_gps.grffile);
|
||||
@@ -213,7 +213,7 @@ template <typename T, typename Tclass>
|
||||
struct CargoTypeMapSpriteGroupHandler : MapSpriteGroupHandler {
|
||||
void MapSpecific(uint16_t local_id, uint8_t cid, const SpriteGroup *group) override
|
||||
{
|
||||
CargoType cargo_type = TranslateCargo(GSF_STATIONS, cid);
|
||||
CargoType cargo_type = TranslateCargo(GrfSpecFeature::Stations, cid);
|
||||
if (!IsValidCargoType(cargo_type)) return;
|
||||
|
||||
if (T *spec = GetSpec<T>(_cur_gps.grffile, local_id); spec == nullptr) {
|
||||
@@ -333,7 +333,7 @@ struct RoadStopMapSpriteGroupHandler : CargoTypeMapSpriteGroupHandler<RoadStopSp
|
||||
struct BadgeMapSpriteGroupHandler : MapSpriteGroupHandler {
|
||||
void MapSpecific(uint16_t local_id, uint8_t cid, const SpriteGroup *group) override
|
||||
{
|
||||
if (cid >= GSF_END) return;
|
||||
if (cid >= to_underlying(GrfSpecFeature::End)) return;
|
||||
|
||||
auto found = _cur_gps.grffile->badge_map.find(local_id);
|
||||
if (found == std::end(_cur_gps.grffile->badge_map)) {
|
||||
@@ -351,7 +351,7 @@ struct BadgeMapSpriteGroupHandler : MapSpriteGroupHandler {
|
||||
GrfMsg(1, "BadgeMapSpriteGroup: Badge {} undefined, skipping", local_id);
|
||||
} else {
|
||||
auto &badge = *GetBadge(found->second);
|
||||
badge.grf_prop.SetSpriteGroup(GSF_DEFAULT, group);
|
||||
badge.grf_prop.SetSpriteGroup(GrfSpecFeature::Default, group);
|
||||
badge.grf_prop.SetGRFFile(_cur_gps.grffile);
|
||||
badge.grf_prop.local_id = local_id;
|
||||
}
|
||||
@@ -406,7 +406,7 @@ static void FeatureMapSpriteGroup(ByteReader &buf)
|
||||
GrfSpecFeature feature{buf.ReadByte()};
|
||||
uint8_t idcount = buf.ReadByte();
|
||||
|
||||
if (feature >= GSF_END) {
|
||||
if (feature >= GrfSpecFeature::End) {
|
||||
GrfMsg(1, "FeatureMapSpriteGroup: Unsupported feature 0x{:02X}, skipping", feature);
|
||||
return;
|
||||
}
|
||||
@@ -430,24 +430,24 @@ static void FeatureMapSpriteGroup(ByteReader &buf)
|
||||
GrfMsg(6, "FeatureMapSpriteGroup: Feature 0x{:02X}, {} ids", feature, idcount);
|
||||
|
||||
switch (feature) {
|
||||
case GSF_TRAINS:
|
||||
case GSF_ROADVEHICLES:
|
||||
case GSF_SHIPS:
|
||||
case GSF_AIRCRAFT: VehicleMapSpriteGroup(buf, feature, idcount); return;
|
||||
case GSF_CANALS: MapSpriteGroup(buf, idcount, CanalMapSpriteGroupHandler{}); return;
|
||||
case GSF_STATIONS: MapSpriteGroup(buf, idcount, StationMapSpriteGroupHandler{}); return;
|
||||
case GSF_HOUSES: MapSpriteGroup(buf, idcount, TownHouseMapSpriteGroupHandler{}); return;
|
||||
case GSF_INDUSTRIES: MapSpriteGroup(buf, idcount, IndustryMapSpriteGroupHandler{}); return;
|
||||
case GSF_INDUSTRYTILES: MapSpriteGroup(buf, idcount, IndustryTileMapSpriteGroupHandler{}); return;
|
||||
case GSF_CARGOES: MapSpriteGroup(buf, idcount, CargoMapSpriteGroupHandler{}); return;
|
||||
case GSF_AIRPORTS: MapSpriteGroup(buf, idcount, AirportMapSpriteGroupHandler{}); return;
|
||||
case GSF_OBJECTS: MapSpriteGroup(buf, idcount, ObjectMapSpriteGroupHandler{}); return;
|
||||
case GSF_RAILTYPES: MapSpriteGroup(buf, idcount, RailTypeMapSpriteGroupHandler{}); return;
|
||||
case GSF_ROADTYPES: MapSpriteGroup(buf, idcount, RoadTypeMapSpriteGroupHandler<RoadTramType::Road>{}); return;
|
||||
case GSF_TRAMTYPES: MapSpriteGroup(buf, idcount, RoadTypeMapSpriteGroupHandler<RoadTramType::Tram>{}); return;
|
||||
case GSF_AIRPORTTILES: MapSpriteGroup(buf, idcount, AirportTileMapSpriteGroupHandler{}); return;
|
||||
case GSF_ROADSTOPS: MapSpriteGroup(buf, idcount, RoadStopMapSpriteGroupHandler{}); return;
|
||||
case GSF_BADGES: MapSpriteGroup(buf, idcount, BadgeMapSpriteGroupHandler{}); return;
|
||||
case GrfSpecFeature::Trains:
|
||||
case GrfSpecFeature::RoadVehicles:
|
||||
case GrfSpecFeature::Ships:
|
||||
case GrfSpecFeature::Aircraft: VehicleMapSpriteGroup(buf, feature, idcount); return;
|
||||
case GrfSpecFeature::Canals: MapSpriteGroup(buf, idcount, CanalMapSpriteGroupHandler{}); return;
|
||||
case GrfSpecFeature::Stations: MapSpriteGroup(buf, idcount, StationMapSpriteGroupHandler{}); return;
|
||||
case GrfSpecFeature::Houses: MapSpriteGroup(buf, idcount, TownHouseMapSpriteGroupHandler{}); return;
|
||||
case GrfSpecFeature::Industries: MapSpriteGroup(buf, idcount, IndustryMapSpriteGroupHandler{}); return;
|
||||
case GrfSpecFeature::IndustryTiles: MapSpriteGroup(buf, idcount, IndustryTileMapSpriteGroupHandler{}); return;
|
||||
case GrfSpecFeature::Cargoes: MapSpriteGroup(buf, idcount, CargoMapSpriteGroupHandler{}); return;
|
||||
case GrfSpecFeature::Airports: MapSpriteGroup(buf, idcount, AirportMapSpriteGroupHandler{}); return;
|
||||
case GrfSpecFeature::Objects: MapSpriteGroup(buf, idcount, ObjectMapSpriteGroupHandler{}); return;
|
||||
case GrfSpecFeature::RailTypes: MapSpriteGroup(buf, idcount, RailTypeMapSpriteGroupHandler{}); return;
|
||||
case GrfSpecFeature::RoadTypes: MapSpriteGroup(buf, idcount, RoadTypeMapSpriteGroupHandler<RoadTramType::Road>{}); return;
|
||||
case GrfSpecFeature::TramTypes: MapSpriteGroup(buf, idcount, RoadTypeMapSpriteGroupHandler<RoadTramType::Tram>{}); return;
|
||||
case GrfSpecFeature::AirportTiles: MapSpriteGroup(buf, idcount, AirportTileMapSpriteGroupHandler{}); return;
|
||||
case GrfSpecFeature::RoadStops: MapSpriteGroup(buf, idcount, RoadStopMapSpriteGroupHandler{}); return;
|
||||
case GrfSpecFeature::Badges: MapSpriteGroup(buf, idcount, BadgeMapSpriteGroupHandler{}); return;
|
||||
|
||||
default:
|
||||
GrfMsg(1, "FeatureMapSpriteGroup: Unsupported feature 0x{:02X}, skipping", feature);
|
||||
|
||||
@@ -49,7 +49,7 @@ static void FeatureNewName(ByteReader &buf)
|
||||
bool new_scheme = _cur_gps.grffile->grf_version >= 7;
|
||||
|
||||
GrfSpecFeature feature{buf.ReadByte()};
|
||||
if (feature >= GSF_END && feature != GSF_ORIGINAL_STRINGS) {
|
||||
if (feature >= GrfSpecFeature::End && feature != GrfSpecFeature::OriginalStrings) {
|
||||
GrfMsg(1, "FeatureNewName: Unsupported feature 0x{:02X}, skipping", feature);
|
||||
return;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ static void FeatureNewName(ByteReader &buf)
|
||||
uint16_t id;
|
||||
if (generic) {
|
||||
id = buf.ReadWord();
|
||||
} else if (feature <= GSF_AIRCRAFT || feature == GSF_BADGES) {
|
||||
} else if (feature <= GrfSpecFeature::Aircraft || feature == GrfSpecFeature::Badges) {
|
||||
id = buf.ReadExtendedByte();
|
||||
} else {
|
||||
id = buf.ReadByte();
|
||||
@@ -74,17 +74,17 @@ static void FeatureNewName(ByteReader &buf)
|
||||
id, endid, feature, lang);
|
||||
|
||||
/* Feature overlay to make non-generic strings unique in their feature. We use feature + 1 so that generic strings stay as they are. */
|
||||
uint32_t feature_overlay = generic ? 0 : ((feature + 1) << 16);
|
||||
uint32_t feature_overlay = generic ? 0 : ((to_underlying(feature) + 1) << 16);
|
||||
|
||||
for (; id < endid && buf.HasData(); id++) {
|
||||
std::string_view name = buf.ReadString();
|
||||
GrfMsg(8, "FeatureNewName: 0x{:04X} <- {}", id, StrMakeValid(name));
|
||||
|
||||
switch (feature) {
|
||||
case GSF_TRAINS:
|
||||
case GSF_ROADVEHICLES:
|
||||
case GSF_SHIPS:
|
||||
case GSF_AIRCRAFT:
|
||||
case GrfSpecFeature::Trains:
|
||||
case GrfSpecFeature::RoadVehicles:
|
||||
case GrfSpecFeature::Ships:
|
||||
case GrfSpecFeature::Aircraft:
|
||||
if (!generic) {
|
||||
Engine *e = GetNewEngine(_cur_gps.grffile, (VehicleType)feature, id, _cur_gps.grfconfig->flags.Test(GRFConfigFlag::Static));
|
||||
if (e == nullptr) break;
|
||||
@@ -95,7 +95,7 @@ static void FeatureNewName(ByteReader &buf)
|
||||
}
|
||||
break;
|
||||
|
||||
case GSF_BADGES: {
|
||||
case GrfSpecFeature::Badges: {
|
||||
if (!generic) {
|
||||
auto found = _cur_gps.grffile->badge_map.find(id);
|
||||
if (found == std::end(_cur_gps.grffile->badge_map)) {
|
||||
|
||||
@@ -241,7 +241,7 @@ static void ParamSet(ByteReader &buf)
|
||||
uint16_t count = GB(data, 16, 16);
|
||||
|
||||
if (_cur_gps.stage == GrfLoadingStage::Reserve) {
|
||||
if (feature == GSF_GLOBALVAR) {
|
||||
if (feature == GrfSpecFeature::GlobalVar) {
|
||||
/* General sprites */
|
||||
if (op == 0) {
|
||||
/* Check if the allocated sprites will fit below the original sprite limit */
|
||||
@@ -261,12 +261,12 @@ static void ParamSet(ByteReader &buf)
|
||||
src1 = 0;
|
||||
} else if (_cur_gps.stage == GrfLoadingStage::Activation) {
|
||||
switch (feature) {
|
||||
case GSF_TRAINS:
|
||||
case GSF_ROADVEHICLES:
|
||||
case GSF_SHIPS:
|
||||
case GSF_AIRCRAFT:
|
||||
case GrfSpecFeature::Trains:
|
||||
case GrfSpecFeature::RoadVehicles:
|
||||
case GrfSpecFeature::Ships:
|
||||
case GrfSpecFeature::Aircraft:
|
||||
if (!_settings_game.vehicle.dynamic_engines) {
|
||||
src1 = PerformGRM({std::begin(_grm_engines) + _engine_offsets[feature], _engine_counts[feature]}, count, op, target, "vehicles");
|
||||
src1 = PerformGRM({std::begin(_grm_engines) + _engine_offsets[to_underlying(feature)], _engine_counts[to_underlying(feature)]}, count, op, target, "vehicles");
|
||||
if (_cur_gps.skip_sprites == -1) return;
|
||||
} else {
|
||||
/* GRM does not apply for dynamic engine allocation. */
|
||||
@@ -283,7 +283,7 @@ static void ParamSet(ByteReader &buf)
|
||||
}
|
||||
break;
|
||||
|
||||
case GSF_GLOBALVAR: // General sprites
|
||||
case GrfSpecFeature::GlobalVar: // General sprites
|
||||
switch (op) {
|
||||
case 0:
|
||||
/* Return space reserved during reservation stage */
|
||||
@@ -301,7 +301,7 @@ static void ParamSet(ByteReader &buf)
|
||||
}
|
||||
break;
|
||||
|
||||
case GSF_CARGOES: // Cargo
|
||||
case GrfSpecFeature::Cargoes: // Cargo
|
||||
/* There are two ranges: one for cargo IDs and one for cargo bitmasks */
|
||||
src1 = PerformGRM(_grm_cargoes, count, op, target, "cargoes");
|
||||
if (_cur_gps.skip_sprites == -1) return;
|
||||
|
||||
@@ -95,7 +95,7 @@ private:
|
||||
};
|
||||
|
||||
/** Currently referenceable spritesets */
|
||||
std::map<uint, SpriteSet> spritesets[GSF_END];
|
||||
std::array<std::map<uint, SpriteSet>, to_underlying(GrfSpecFeature::End)> spritesets{};
|
||||
|
||||
public:
|
||||
/* Global state */
|
||||
@@ -120,8 +120,8 @@ public:
|
||||
this->nfo_line = 0;
|
||||
this->skip_sprites = 0;
|
||||
|
||||
for (uint i = 0; i < GSF_END; i++) {
|
||||
this->spritesets[i].clear();
|
||||
for (auto &s : this->spritesets) {
|
||||
s.clear();
|
||||
}
|
||||
|
||||
this->spritegroups = {};
|
||||
@@ -137,9 +137,9 @@ public:
|
||||
*/
|
||||
void AddSpriteSets(GrfSpecFeature feature, SpriteID first_sprite, uint first_set, uint numsets, uint numents)
|
||||
{
|
||||
assert(feature < GSF_END);
|
||||
assert(feature < GrfSpecFeature::End);
|
||||
for (uint i = 0; i < numsets; i++) {
|
||||
SpriteSet &set = this->spritesets[feature][first_set + i];
|
||||
SpriteSet &set = this->spritesets[to_underlying(feature)][first_set + i];
|
||||
set.sprite = first_sprite + i * numents;
|
||||
set.num_sprites = numents;
|
||||
}
|
||||
@@ -153,8 +153,8 @@ public:
|
||||
*/
|
||||
bool HasValidSpriteSets(GrfSpecFeature feature) const
|
||||
{
|
||||
assert(feature < GSF_END);
|
||||
return !this->spritesets[feature].empty();
|
||||
assert(feature < GrfSpecFeature::End);
|
||||
return !this->spritesets[to_underlying(feature)].empty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,8 +166,8 @@ public:
|
||||
*/
|
||||
bool IsValidSpriteSet(GrfSpecFeature feature, uint set) const
|
||||
{
|
||||
assert(feature < GSF_END);
|
||||
return this->spritesets[feature].find(set) != this->spritesets[feature].end();
|
||||
assert(feature < GrfSpecFeature::End);
|
||||
return this->spritesets[to_underlying(feature)].find(set) != this->spritesets[to_underlying(feature)].end();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -179,7 +179,7 @@ public:
|
||||
SpriteID GetSprite(GrfSpecFeature feature, uint set) const
|
||||
{
|
||||
assert(IsValidSpriteSet(feature, set));
|
||||
return this->spritesets[feature].find(set)->second.sprite;
|
||||
return this->spritesets[to_underlying(feature)].find(set)->second.sprite;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
uint GetNumEnts(GrfSpecFeature feature, uint set) const
|
||||
{
|
||||
assert(IsValidSpriteSet(feature, set));
|
||||
return this->spritesets[feature].find(set)->second.num_sprites;
|
||||
return this->spritesets[to_underlying(feature)].find(set)->second.num_sprites;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ void AirportOverrideManager::SetEntitySpec(AirportSpec &&as)
|
||||
|
||||
GrfSpecFeature AirportResolverObject::GetFeature() const
|
||||
{
|
||||
return GSF_AIRPORTS;
|
||||
return GrfSpecFeature::Airports;
|
||||
}
|
||||
|
||||
uint32_t AirportResolverObject::GetDebugID() const
|
||||
@@ -216,7 +216,7 @@ uint32_t AirportResolverObject::GetDebugID() const
|
||||
/* Create storage on first modification. */
|
||||
uint32_t grfid = (this->ro.grffile != nullptr) ? this->ro.grffile->grfid : 0;
|
||||
assert(PersistentStorage::CanAllocateItem());
|
||||
this->st->airport.psa = PersistentStorage::Create(grfid, GSF_AIRPORTS, this->st->airport.tile);
|
||||
this->st->airport.psa = PersistentStorage::Create(grfid, GrfSpecFeature::Airports, this->st->airport.tile);
|
||||
}
|
||||
this->st->airport.psa->StoreValue(pos, value);
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ AirportTileResolverObject::AirportTileResolverObject(const AirportTileSpec *ats,
|
||||
|
||||
GrfSpecFeature AirportTileResolverObject::GetFeature() const
|
||||
{
|
||||
return GSF_AIRPORTTILES;
|
||||
return GrfSpecFeature::AirportTiles;
|
||||
}
|
||||
|
||||
uint32_t AirportTileResolverObject::GetDebugID() const
|
||||
|
||||
@@ -191,7 +191,7 @@ struct BadgeResolverObject : public ResolverObject {
|
||||
|
||||
GrfSpecFeature BadgeResolverObject::GetFeature() const
|
||||
{
|
||||
return GSF_BADGES;
|
||||
return GrfSpecFeature::Badges;
|
||||
}
|
||||
|
||||
uint32_t BadgeResolverObject::GetDebugID() const
|
||||
@@ -211,8 +211,8 @@ uint32_t BadgeResolverObject::GetDebugID() const
|
||||
BadgeResolverObject::BadgeResolverObject(const Badge &badge, GrfSpecFeature feature, std::optional<TimerGameCalendar::Date> introduction_date, CallbackID callback, uint32_t callback_param1, uint32_t callback_param2)
|
||||
: ResolverObject(badge.grf_prop.grffile, callback, callback_param1, callback_param2), self_scope(*this, badge, introduction_date)
|
||||
{
|
||||
assert(feature <= GSF_END);
|
||||
this->root_spritegroup = this->self_scope.badge.grf_prop.GetFirstSpriteGroupOf({feature, GSF_DEFAULT});
|
||||
assert(feature <= GrfSpecFeature::End);
|
||||
this->root_spritegroup = this->self_scope.badge.grf_prop.GetFirstSpriteGroupOf({feature, GrfSpecFeature::Default});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+29
-29
@@ -24,35 +24,35 @@ class BadgeClassConfig {
|
||||
public:
|
||||
static inline const BadgeClassConfigItem EMPTY_CONFIG_ITEM{};
|
||||
|
||||
std::array<std::vector<BadgeClassConfigItem>, GrfSpecFeature::GSF_END> features = {};
|
||||
EnumClassIndexContainer<std::array<std::vector<BadgeClassConfigItem>, to_underlying(GrfSpecFeature::End)>, GrfSpecFeature> features = {};
|
||||
|
||||
static constexpr GrfSpecFeatures CONFIGURABLE_FEATURES = {
|
||||
GSF_TRAINS, GSF_ROADVEHICLES, GSF_SHIPS, GSF_AIRCRAFT, GSF_STATIONS, GSF_HOUSES, GSF_OBJECTS, GSF_ROADSTOPS,
|
||||
GrfSpecFeature::Trains, GrfSpecFeature::RoadVehicles, GrfSpecFeature::Ships, GrfSpecFeature::Aircraft, GrfSpecFeature::Stations, GrfSpecFeature::Houses, GrfSpecFeature::Objects, GrfSpecFeature::RoadStops,
|
||||
};
|
||||
|
||||
static inline const std::array<std::string_view, GrfSpecFeature::GSF_END> sections = {
|
||||
"badges_trains", // GSF_TRAINS
|
||||
"badges_roadvehicles", // GSF_ROADVEHICLES
|
||||
"badges_ships", // GSF_SHIPS
|
||||
"badges_aircraft", // GSF_AIRCRAFT
|
||||
"badges_stations", // GSF_STATIONS
|
||||
{}, // GSF_CANALS
|
||||
{}, // GSF_BRIDGES
|
||||
"badges_houses", // GSF_HOUSES
|
||||
{}, // GSF_GLOBALVAR
|
||||
{}, // GSF_INDUSTRYTILES
|
||||
{}, // GSF_INDUSTRIES
|
||||
{}, // GSF_CARGOES
|
||||
{}, // GSF_SOUNDFX
|
||||
{}, // GSF_AIRPORTS
|
||||
{}, // GSF_SIGNALS
|
||||
"badges_objects", // GSF_OBJECTS
|
||||
{}, // GSF_RAILTYPES
|
||||
{}, // GSF_AIRPORTTILES
|
||||
{}, // GSF_ROADTYPES
|
||||
{}, // GSF_TRAMTYPES
|
||||
"badges_roadstops", // GSF_ROADSTOPS
|
||||
{}, // GSF_BADGES
|
||||
static inline const EnumClassIndexContainer<std::array<std::string_view, to_underlying(GrfSpecFeature::End)>, GrfSpecFeature> sections = {
|
||||
"badges_trains", // GrfSpecFeature::Trains
|
||||
"badges_roadvehicles", // GrfSpecFeature::RoadVehicles
|
||||
"badges_ships", // GrfSpecFeature::Ships
|
||||
"badges_aircraft", // GrfSpecFeature::Aircraft
|
||||
"badges_stations", // GrfSpecFeature::Stations
|
||||
{}, // GrfSpecFeature::Canals
|
||||
{}, // GrfSpecFeature::Bridges
|
||||
"badges_houses", // GrfSpecFeature::Houses
|
||||
{}, // GrfSpecFeature::GlobalVar
|
||||
{}, // GrfSpecFeature::IndustryTiles
|
||||
{}, // GrfSpecFeature::Industries
|
||||
{}, // GrfSpecFeature::Cargoes
|
||||
{}, // GrfSpecFeature::SoundEffects
|
||||
{}, // GrfSpecFeature::Airports
|
||||
{}, // GrfSpecFeature::Signals
|
||||
"badges_objects", // GrfSpecFeature::Objects
|
||||
{}, // GrfSpecFeature::RailTypes
|
||||
{}, // GrfSpecFeature::AirportTiles
|
||||
{}, // GrfSpecFeature::RoadTypes
|
||||
{}, // GrfSpecFeature::TramTypes
|
||||
"badges_roadstops", // GrfSpecFeature::RoadStops
|
||||
{}, // GrfSpecFeature::Badges
|
||||
};
|
||||
};
|
||||
|
||||
@@ -67,8 +67,8 @@ static BadgeClassConfig _badge_config;
|
||||
std::span<BadgeClassConfigItem> GetBadgeClassConfiguration(GrfSpecFeature feature)
|
||||
{
|
||||
assert(BadgeClassConfig::CONFIGURABLE_FEATURES.Test(feature));
|
||||
assert(feature < std::size(_badge_config.features));
|
||||
return _badge_config.features[to_underlying(feature)];
|
||||
assert(to_underlying(feature) < std::size(_badge_config.features));
|
||||
return _badge_config.features[feature];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,7 +99,7 @@ void AddBadgeClassesToConfiguration()
|
||||
*/
|
||||
void ResetBadgeClassConfiguration(GrfSpecFeature feature)
|
||||
{
|
||||
assert(feature < GrfSpecFeature::GSF_END);
|
||||
assert(feature < GrfSpecFeature::End);
|
||||
|
||||
auto &config = _badge_config.features[feature];
|
||||
config.clear();
|
||||
@@ -187,7 +187,7 @@ static void BadgeClassSaveConfigFeature(IniFile &ini, GrfSpecFeature feature)
|
||||
IniGroup &group = ini.GetOrCreateGroup(BadgeClassConfig::sections[feature]);
|
||||
group.Clear();
|
||||
|
||||
for (const auto &item : _badge_config.features[to_underlying(feature)]) {
|
||||
for (const auto &item : _badge_config.features[feature]) {
|
||||
group.CreateItem(item.label).SetValue(fmt::format("{}{}{}", item.show_filter ? "?" : "", item.show_icon ? "" : "!", item.column));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ struct CanalResolverObject : public ResolverObject {
|
||||
|
||||
GrfSpecFeature CanalResolverObject::GetFeature() const
|
||||
{
|
||||
return GSF_CANALS;
|
||||
return GrfSpecFeature::Canals;
|
||||
}
|
||||
|
||||
uint32_t CanalResolverObject::GetDebugID() const
|
||||
|
||||
@@ -26,7 +26,7 @@ struct CargoResolverObject : public ResolverObject {
|
||||
|
||||
GrfSpecFeature CargoResolverObject::GetFeature() const
|
||||
{
|
||||
return GSF_CARGOES;
|
||||
return GrfSpecFeature::Cargoes;
|
||||
}
|
||||
|
||||
uint32_t CargoResolverObject::GetDebugID() const
|
||||
|
||||
+41
-31
@@ -72,7 +72,7 @@ static inline uint GetFeatureIndex(uint window_number)
|
||||
static inline uint GetInspectWindowNumber(GrfSpecFeature feature, uint index)
|
||||
{
|
||||
assert((index >> 24) == 0);
|
||||
return (feature << 24) | index;
|
||||
return (to_underlying(feature) << 24) | index;
|
||||
}
|
||||
|
||||
static inline uint GetInspectWindowNumber(GrfSpecFeature feature, ConvertibleThroughBase auto index) { return GetInspectWindowNumber(feature, index.base()); }
|
||||
@@ -241,7 +241,7 @@ static inline GrfSpecFeature GetFeatureNum(uint window_number)
|
||||
static inline const NIFeature *GetFeature(uint window_number)
|
||||
{
|
||||
GrfSpecFeature idx = GetFeatureNum(window_number);
|
||||
return idx < GSF_FAKE_END ? _nifeatures[idx] : nullptr;
|
||||
return idx < GrfSpecFeature::FakeEnd ? _nifeatures[idx] : nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,7 +258,7 @@ static inline const NIHelper &GetFeatureHelper(uint window_number)
|
||||
/** Window used for inspecting NewGRFs. */
|
||||
struct NewGRFInspectWindow : Window {
|
||||
/** The value for the variable 60 parameters. */
|
||||
static uint32_t var60params[GSF_FAKE_END][0x20];
|
||||
static inline EnumClassIndexContainer<std::array<std::array<uint32_t, 0x20>, to_underlying(GrfSpecFeature::FakeEnd)>, GrfSpecFeature> var60params{};
|
||||
|
||||
/** GRFID of the caller of this window, 0 if it has no caller. */
|
||||
uint32_t caller_grfid = 0;
|
||||
@@ -298,7 +298,22 @@ struct NewGRFInspectWindow : Window {
|
||||
bool HasChainIndex() const
|
||||
{
|
||||
GrfSpecFeature f = GetFeatureNum(this->window_number);
|
||||
return f == GSF_TRAINS || f == GSF_ROADVEHICLES;
|
||||
return f == GrfSpecFeature::Trains || f == GrfSpecFeature::RoadVehicles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the vehicle type corresponding to the grf feature for this window.
|
||||
* @return vehicle type for this window.
|
||||
*/
|
||||
VehicleType GetVehicleTypeForWindow() const
|
||||
{
|
||||
switch (GetFeatureNum(this->window_number)) {
|
||||
case GrfSpecFeature::Trains: return VEH_TRAIN;
|
||||
case GrfSpecFeature::RoadVehicles: return VEH_ROAD;
|
||||
case GrfSpecFeature::Ships: return VEH_SHIP;
|
||||
case GrfSpecFeature::Aircraft: return VEH_AIRCRAFT;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -353,12 +368,10 @@ struct NewGRFInspectWindow : Window {
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_NGRFI_VEH_CHAIN: {
|
||||
case WID_NGRFI_VEH_CHAIN:
|
||||
assert(this->HasChainIndex());
|
||||
GrfSpecFeature f = GetFeatureNum(this->window_number);
|
||||
size.height = std::max(size.height, GetVehicleImageCellSize((VehicleType)(VEH_TRAIN + (f - GSF_TRAINS)), EIT_IN_DEPOT).height + 2 + WidgetDimensions::scaled.bevel.Vertical());
|
||||
size.height = std::max(size.height, GetVehicleImageCellSize(this->GetVehicleTypeForWindow(), EIT_IN_DEPOT).height + 2 + WidgetDimensions::scaled.bevel.Vertical());
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_NGRFI_MAINPANEL:
|
||||
fill.height = resize.height = std::max(11, GetCharacterHeight(FontSize::Normal) + WidgetDimensions::scaled.vsep_normal);
|
||||
@@ -411,8 +424,7 @@ struct NewGRFInspectWindow : Window {
|
||||
if (sel_center > width / 2) skip = std::min(total_width - width, sel_center - width / 2);
|
||||
}
|
||||
|
||||
GrfSpecFeature f = GetFeatureNum(this->window_number);
|
||||
int h = GetVehicleImageCellSize((VehicleType)(VEH_TRAIN + (f - GSF_TRAINS)), EIT_IN_DEPOT).height;
|
||||
int h = GetVehicleImageCellSize(this->GetVehicleTypeForWindow(), EIT_IN_DEPOT).height;
|
||||
int y = CentreBounds(br.top, br.bottom, h);
|
||||
DrawVehicleImage(v->First(), br, VehicleID::Invalid(), EIT_IN_DETAILS, skip);
|
||||
|
||||
@@ -624,8 +636,6 @@ struct NewGRFInspectWindow : Window {
|
||||
}
|
||||
};
|
||||
|
||||
/* static */ uint32_t NewGRFInspectWindow::var60params[GSF_FAKE_END][0x20] = { {0} }; // Use spec to have 0s in whole array
|
||||
|
||||
static constexpr std::initializer_list<NWidgetPart> _nested_newgrf_inspect_chain_widgets = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
@@ -696,7 +706,7 @@ void ShowNewGRFInspectWindow(GrfSpecFeature feature, uint index, const uint32_t
|
||||
if (!IsNewGRFInspectable(feature, index)) return;
|
||||
|
||||
WindowNumber wno = GetInspectWindowNumber(feature, index);
|
||||
WindowDesc &desc = (feature == GSF_TRAINS || feature == GSF_ROADVEHICLES) ? _newgrf_inspect_chain_desc : _newgrf_inspect_desc;
|
||||
WindowDesc &desc = (feature == GrfSpecFeature::Trains || feature == GrfSpecFeature::RoadVehicles) ? _newgrf_inspect_chain_desc : _newgrf_inspect_desc;
|
||||
NewGRFInspectWindow *w = AllocateWindowDescFront<NewGRFInspectWindow, true>(desc, wno);
|
||||
w->SetCallerGRFID(grfid);
|
||||
}
|
||||
@@ -711,7 +721,7 @@ void ShowNewGRFInspectWindow(GrfSpecFeature feature, uint index, const uint32_t
|
||||
*/
|
||||
void InvalidateNewGRFInspectWindow(GrfSpecFeature feature, uint index)
|
||||
{
|
||||
if (feature == GSF_INVALID) return;
|
||||
if (feature == GrfSpecFeature::Invalid) return;
|
||||
|
||||
WindowNumber wno = GetInspectWindowNumber(feature, index);
|
||||
InvalidateWindowData(WC_NEWGRF_INSPECT, wno);
|
||||
@@ -727,7 +737,7 @@ void InvalidateNewGRFInspectWindow(GrfSpecFeature feature, uint index)
|
||||
*/
|
||||
void DeleteNewGRFInspectWindow(GrfSpecFeature feature, uint index)
|
||||
{
|
||||
if (feature == GSF_INVALID) return;
|
||||
if (feature == GrfSpecFeature::Invalid) return;
|
||||
|
||||
WindowNumber wno = GetInspectWindowNumber(feature, index);
|
||||
CloseWindowById(WC_NEWGRF_INSPECT, wno);
|
||||
@@ -762,20 +772,20 @@ bool IsNewGRFInspectable(GrfSpecFeature feature, uint index)
|
||||
GrfSpecFeature GetGrfSpecFeature(TileIndex tile)
|
||||
{
|
||||
switch (GetTileType(tile)) {
|
||||
default: return GSF_INVALID;
|
||||
case TileType::Railway: return GSF_RAILTYPES;
|
||||
case TileType::Road: return IsLevelCrossing(tile) ? GSF_RAILTYPES : GSF_ROADTYPES;
|
||||
case TileType::House: return GSF_HOUSES;
|
||||
case TileType::Industry: return GSF_INDUSTRYTILES;
|
||||
case TileType::Object: return GSF_OBJECTS;
|
||||
default: return GrfSpecFeature::Invalid;
|
||||
case TileType::Railway: return GrfSpecFeature::RailTypes;
|
||||
case TileType::Road: return IsLevelCrossing(tile) ? GrfSpecFeature::RailTypes : GrfSpecFeature::RoadTypes;
|
||||
case TileType::House: return GrfSpecFeature::Houses;
|
||||
case TileType::Industry: return GrfSpecFeature::IndustryTiles;
|
||||
case TileType::Object: return GrfSpecFeature::Objects;
|
||||
|
||||
case TileType::Station:
|
||||
switch (GetStationType(tile)) {
|
||||
case StationType::Rail: return GSF_STATIONS;
|
||||
case StationType::Airport: return GSF_AIRPORTTILES;
|
||||
case StationType::Bus: return GSF_ROADSTOPS;
|
||||
case StationType::Truck: return GSF_ROADSTOPS;
|
||||
default: return GSF_INVALID;
|
||||
case StationType::Rail: return GrfSpecFeature::Stations;
|
||||
case StationType::Airport: return GrfSpecFeature::AirportTiles;
|
||||
case StationType::Bus: return GrfSpecFeature::RoadStops;
|
||||
case StationType::Truck: return GrfSpecFeature::RoadStops;
|
||||
default: return GrfSpecFeature::Invalid;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -788,11 +798,11 @@ GrfSpecFeature GetGrfSpecFeature(TileIndex tile)
|
||||
GrfSpecFeature GetGrfSpecFeature(VehicleType type)
|
||||
{
|
||||
switch (type) {
|
||||
case VEH_TRAIN: return GSF_TRAINS;
|
||||
case VEH_ROAD: return GSF_ROADVEHICLES;
|
||||
case VEH_SHIP: return GSF_SHIPS;
|
||||
case VEH_AIRCRAFT: return GSF_AIRCRAFT;
|
||||
default: return GSF_INVALID;
|
||||
case VEH_TRAIN: return GrfSpecFeature::Trains;
|
||||
case VEH_ROAD: return GrfSpecFeature::RoadVehicles;
|
||||
case VEH_SHIP: return GrfSpecFeature::Ships;
|
||||
case VEH_AIRCRAFT: return GrfSpecFeature::Aircraft;
|
||||
default: return GrfSpecFeature::Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1041,11 +1041,11 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec
|
||||
GrfSpecFeature VehicleResolverObject::GetFeature() const
|
||||
{
|
||||
switch (Engine::Get(this->self_scope.self_type)->type) {
|
||||
case VEH_TRAIN: return GSF_TRAINS;
|
||||
case VEH_ROAD: return GSF_ROADVEHICLES;
|
||||
case VEH_SHIP: return GSF_SHIPS;
|
||||
case VEH_AIRCRAFT: return GSF_AIRCRAFT;
|
||||
default: return GSF_INVALID;
|
||||
case VEH_TRAIN: return GrfSpecFeature::Trains;
|
||||
case VEH_ROAD: return GrfSpecFeature::RoadVehicles;
|
||||
case VEH_SHIP: return GrfSpecFeature::Ships;
|
||||
case VEH_AIRCRAFT: return GrfSpecFeature::Aircraft;
|
||||
default: return GrfSpecFeature::Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ struct GenericScopeResolver : public ScopeResolver {
|
||||
*/
|
||||
GenericScopeResolver(ResolverObject &ro, bool ai_callback)
|
||||
: ScopeResolver(ro), cargo_type(0), default_selection(0), src_industry(0), dst_industry(0), distance(0),
|
||||
event(), count(0), station_size(0), feature(GSF_INVALID), ai_callback(ai_callback)
|
||||
event(), count(0), station_size(0), feature(GrfSpecFeature::Invalid), ai_callback(ai_callback)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -85,7 +85,8 @@ struct GenericCallback {
|
||||
|
||||
typedef std::list<GenericCallback> GenericCallbackList;
|
||||
|
||||
static GenericCallbackList _gcl[GSF_END];
|
||||
/** Generic callbacks for each feature. */
|
||||
static EnumClassIndexContainer<std::array<GenericCallbackList, to_underlying(GrfSpecFeature::End)>, GrfSpecFeature> _gcl{};
|
||||
|
||||
|
||||
/**
|
||||
@@ -107,7 +108,7 @@ void ResetGenericCallbacks()
|
||||
*/
|
||||
void AddGenericCallback(GrfSpecFeature feature, const GRFFile *file, const SpriteGroup *group)
|
||||
{
|
||||
if (feature >= lengthof(_gcl)) {
|
||||
if (to_underlying(feature) >= std::size(_gcl)) {
|
||||
GrfMsg(5, "AddGenericCallback: Unsupported feature 0x{:02X}", feature);
|
||||
return;
|
||||
}
|
||||
@@ -166,7 +167,7 @@ GenericResolverObject::GenericResolverObject(bool ai_callback, CallbackID callba
|
||||
*/
|
||||
static std::pair<const GRFFile *, uint16_t> GetGenericCallbackResult(GrfSpecFeature feature, ResolverObject &object, uint32_t param1_grfv7, uint32_t param1_grfv8, std::span<int32_t> regs100 = {})
|
||||
{
|
||||
assert(feature < lengthof(_gcl));
|
||||
assert(to_underlying(feature) < std::size(_gcl));
|
||||
|
||||
/* Test each feature callback sprite group. */
|
||||
for (const auto &it : _gcl[feature]) {
|
||||
@@ -245,13 +246,13 @@ void AmbientSoundEffectCallback(TileIndex tile)
|
||||
|
||||
/* Prepare resolver object. */
|
||||
GenericResolverObject object(false, CBID_SOUNDS_AMBIENT_EFFECT);
|
||||
object.generic_scope.feature = GSF_SOUNDFX;
|
||||
object.generic_scope.feature = GrfSpecFeature::SoundEffects;
|
||||
|
||||
uint32_t param1_v7 = to_underlying(GetTileType(tile)) << 28 | Clamp(TileHeight(tile), 0, 15) << 24 | GB(r, 16, 8) << 16 | GetTerrainType(tile);
|
||||
uint32_t param1_v8 = to_underlying(GetTileType(tile)) << 24 | GetTileZ(tile) << 16 | GB(r, 16, 8) << 8 | (HasTileWaterClass(tile) ? to_underlying(GetWaterClass(tile)) : 0) << 3 | GetTerrainType(tile);
|
||||
|
||||
/* Run callback. */
|
||||
auto callback = GetGenericCallbackResult(GSF_SOUNDFX, object, param1_v7, param1_v8);
|
||||
auto callback = GetGenericCallbackResult(GrfSpecFeature::SoundEffects, object, param1_v7, param1_v8);
|
||||
|
||||
if (callback.second != CALLBACK_FAILED) PlayTileSound(callback.first, callback.second, tile);
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ HouseResolverObject::HouseResolverObject(HouseID house_id, TileIndex tile, Town
|
||||
|
||||
GrfSpecFeature HouseResolverObject::GetFeature() const
|
||||
{
|
||||
return GSF_HOUSES;
|
||||
return GrfSpecFeature::Houses;
|
||||
}
|
||||
|
||||
uint32_t HouseResolverObject::GetDebugID() const
|
||||
|
||||
@@ -448,7 +448,7 @@ static uint32_t GetCountAndDistanceOfClosestInstance(const ResolverObject &objec
|
||||
/* Create storage on first modification. */
|
||||
const IndustrySpec *indsp = GetIndustrySpec(this->industry->type);
|
||||
assert(PersistentStorage::CanAllocateItem());
|
||||
this->industry->psa = PersistentStorage::Create(indsp->grf_prop.grfid, GSF_INDUSTRIES, this->industry->location.tile);
|
||||
this->industry->psa = PersistentStorage::Create(indsp->grf_prop.grfid, GrfSpecFeature::Industries, this->industry->location.tile);
|
||||
}
|
||||
|
||||
this->industry->psa->StoreValue(pos, value);
|
||||
@@ -506,7 +506,7 @@ TownScopeResolver *IndustriesResolverObject::GetTown()
|
||||
|
||||
GrfSpecFeature IndustriesResolverObject::GetFeature() const
|
||||
{
|
||||
return GSF_INDUSTRIES;
|
||||
return GrfSpecFeature::Industries;
|
||||
}
|
||||
|
||||
uint32_t IndustriesResolverObject::GetDebugID() const
|
||||
|
||||
@@ -151,7 +151,7 @@ IndustryTileResolverObject::IndustryTileResolverObject(IndustryGfx gfx, TileInde
|
||||
|
||||
GrfSpecFeature IndustryTileResolverObject::GetFeature() const
|
||||
{
|
||||
return GSF_INDUSTRYTILES;
|
||||
return GrfSpecFeature::IndustryTiles;
|
||||
}
|
||||
|
||||
uint32_t IndustryTileResolverObject::GetDebugID() const
|
||||
|
||||
@@ -415,7 +415,7 @@ TownScopeResolver *ObjectResolverObject::GetTown()
|
||||
|
||||
GrfSpecFeature ObjectResolverObject::GetFeature() const
|
||||
{
|
||||
return GSF_OBJECTS;
|
||||
return GrfSpecFeature::Objects;
|
||||
}
|
||||
|
||||
uint32_t ObjectResolverObject::GetDebugID() const
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
GrfSpecFeature RailTypeResolverObject::GetFeature() const
|
||||
{
|
||||
return GSF_RAILTYPES;
|
||||
return GrfSpecFeature::RailTypes;
|
||||
}
|
||||
|
||||
uint32_t RailTypeResolverObject::GetDebugID() const
|
||||
|
||||
@@ -114,9 +114,9 @@ GrfSpecFeature RoadTypeResolverObject::GetFeature() const
|
||||
{
|
||||
RoadType rt = GetRoadTypeByLabel(this->roadtype_scope.rti->label, false);
|
||||
switch (GetRoadTramType(rt)) {
|
||||
case RoadTramType::Road: return GSF_ROADTYPES;
|
||||
case RoadTramType::Tram: return GSF_TRAMTYPES;
|
||||
default: return GSF_INVALID;
|
||||
case RoadTramType::Road: return GrfSpecFeature::RoadTypes;
|
||||
case RoadTramType::Tram: return GrfSpecFeature::TramTypes;
|
||||
default: return GrfSpecFeature::Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -474,7 +474,7 @@ public:
|
||||
* This function is mainly intended for the callback profiling feature.
|
||||
* @return The feature.
|
||||
*/
|
||||
virtual GrfSpecFeature GetFeature() const { return GSF_INVALID; }
|
||||
virtual GrfSpecFeature GetFeature() const { return GrfSpecFeature::Invalid; }
|
||||
/**
|
||||
* Get an identifier for the item being resolved.
|
||||
* This function is mainly intended for the callback profiling feature,
|
||||
|
||||
@@ -575,7 +575,7 @@ uint32_t Waypoint::GetNewGRFVariable(const ResolverObject &, uint8_t variable, [
|
||||
|
||||
GrfSpecFeature StationResolverObject::GetFeature() const
|
||||
{
|
||||
return GSF_STATIONS;
|
||||
return GrfSpecFeature::Stations;
|
||||
}
|
||||
|
||||
uint32_t StationResolverObject::GetDebugID() const
|
||||
|
||||
@@ -32,7 +32,7 @@ enum PersistentStorageMode : uint8_t {
|
||||
*/
|
||||
struct BasePersistentStorageArray {
|
||||
uint32_t grfid = 0; ///< GRFID associated to this persistent storage. A value of zero means "default".
|
||||
GrfSpecFeature feature = GSF_INVALID; ///< NOSAVE: Used to identify in the owner of the array in debug output.
|
||||
GrfSpecFeature feature = GrfSpecFeature::Invalid; ///< NOSAVE: Used to identify in the owner of the array in debug output.
|
||||
TileIndex tile = INVALID_TILE; ///< NOSAVE: Used to identify in the owner of the array in debug output.
|
||||
|
||||
virtual ~BasePersistentStorageArray();
|
||||
|
||||
+1
-1
@@ -156,7 +156,7 @@ static uint16_t TownHistoryHelper(const Town *t, CargoLabel label, uint period,
|
||||
|
||||
/* Create a new storage. */
|
||||
assert(PersistentStorage::CanAllocateItem());
|
||||
PersistentStorage *psa = PersistentStorage::Create(grfid, GSF_FAKE_TOWNS, this->t->xy);
|
||||
PersistentStorage *psa = PersistentStorage::Create(grfid, GrfSpecFeature::FakeTowns, this->t->xy);
|
||||
psa->StoreValue(pos, value);
|
||||
t->psa_list.push_back(psa);
|
||||
}
|
||||
|
||||
+1
-1
@@ -515,7 +515,7 @@ static void ReallyClearObjectTile(Object *o)
|
||||
{
|
||||
Object::DecTypeCount(o->type);
|
||||
for (TileIndex tile_cur : o->location) {
|
||||
DeleteNewGRFInspectWindow(GSF_OBJECTS, tile_cur.base());
|
||||
DeleteNewGRFInspectWindow(GrfSpecFeature::Objects, tile_cur.base());
|
||||
|
||||
MakeWaterKeepingClass(tile_cur, GetTileOwner(tile_cur));
|
||||
}
|
||||
|
||||
+2
-2
@@ -46,7 +46,7 @@ class ObjectPickerCallbacks : public PickerCallbacksNewGRFClass<ObjectClass> {
|
||||
public:
|
||||
ObjectPickerCallbacks() : PickerCallbacksNewGRFClass<ObjectClass>("fav_objects") {}
|
||||
|
||||
GrfSpecFeature GetFeature() const override { return GSF_OBJECTS; }
|
||||
GrfSpecFeature GetFeature() const override { return GrfSpecFeature::Objects; }
|
||||
|
||||
StringID GetClassTooltip() const override { return STR_PICKER_OBJECT_CLASS_TOOLTIP; }
|
||||
StringID GetTypeTooltip() const override { return STR_PICKER_OBJECT_TYPE_TOOLTIP; }
|
||||
@@ -236,7 +236,7 @@ public:
|
||||
const int bottom = tr.bottom;
|
||||
/* Use all the available space past the rect, so that we can enlarge the window if needed. */
|
||||
tr.bottom = INT16_MAX;
|
||||
tr.top = DrawBadgeNameList(tr, spec->badges, GSF_OBJECTS);
|
||||
tr.top = DrawBadgeNameList(tr, spec->badges, GrfSpecFeature::Objects);
|
||||
|
||||
/* Get the extra message for the GUI */
|
||||
if (spec->callback_mask.Test(ObjectCallbackMask::FundMoreText)) {
|
||||
|
||||
+2
-2
@@ -400,7 +400,7 @@ void PickerWindow::DrawWidget(const Rect &r, WidgetID widget) const
|
||||
|
||||
GrfSpecFeature feature = this->callbacks.GetFeature();
|
||||
/* Houses have recolours but not related to the company colour and other items depend on gamemode. */
|
||||
PaletteID palette = _game_mode != GM_NORMAL || feature == GSF_HOUSES ? PAL_NONE : GetCompanyPalette(_local_company);
|
||||
PaletteID palette = _game_mode != GM_NORMAL || feature == GrfSpecFeature::Houses ? PAL_NONE : GetCompanyPalette(_local_company);
|
||||
DrawBadgeColumn({0, by, ir.Width() - 1, ir.Height() - 1}, 0, this->badge_classes, this->callbacks.GetTypeBadges(item.class_index, item.index), feature, std::nullopt, palette);
|
||||
|
||||
if (this->callbacks.saved.contains(this->callbacks.sel_collection)) {
|
||||
@@ -565,7 +565,7 @@ void PickerWindow::OnClick(Point pt, WidgetID widget, int)
|
||||
default:
|
||||
if (IsInsideMM(widget, this->badge_filters.first, this->badge_filters.second)) {
|
||||
/* Houses have recolours but not related to the company colour and other items depend on gamemode. */
|
||||
PaletteID palette = _game_mode != GM_NORMAL || this->callbacks.GetFeature() == GSF_HOUSES ? PAL_NONE : GetCompanyPalette(_local_company);
|
||||
PaletteID palette = _game_mode != GM_NORMAL || this->callbacks.GetFeature() == GrfSpecFeature::Houses ? PAL_NONE : GetCompanyPalette(_local_company);
|
||||
ShowDropDownList(this, this->GetWidget<NWidgetBadgeFilter>(widget)->GetDropDownList(palette), -1, widget, 0, DropDownOption::Filterable);
|
||||
}
|
||||
break;
|
||||
|
||||
+2
-2
@@ -655,7 +655,7 @@ CommandCost CmdRemoveSingleRail(DoCommandFlags flags, TileIndex tile, Track trac
|
||||
Company::Get(owner)->infrastructure.rail[GetRailType(tile)] -= LEVELCROSSING_TRACKBIT_FACTOR;
|
||||
DirtyCompanyInfrastructureWindows(owner);
|
||||
MakeRoadNormal(tile, GetCrossingRoadBits(tile), GetRoadTypeRoad(tile), GetRoadTypeTram(tile), GetTownIndex(tile), GetRoadOwner(tile, RoadTramType::Road), GetRoadOwner(tile, RoadTramType::Tram));
|
||||
DeleteNewGRFInspectWindow(GSF_RAILTYPES, tile.base());
|
||||
DeleteNewGRFInspectWindow(GrfSpecFeature::RailTypes, tile.base());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -713,7 +713,7 @@ CommandCost CmdRemoveSingleRail(DoCommandFlags flags, TileIndex tile, Track trac
|
||||
} else {
|
||||
DoClearSquare(tile);
|
||||
}
|
||||
DeleteNewGRFInspectWindow(GSF_RAILTYPES, tile.base());
|
||||
DeleteNewGRFInspectWindow(GrfSpecFeature::RailTypes, tile.base());
|
||||
} else {
|
||||
SetTrackBits(tile, present);
|
||||
SetTrackReservation(tile, GetRailReservationTrackBits(tile) & present);
|
||||
|
||||
+6
-6
@@ -1013,7 +1013,7 @@ class StationPickerCallbacks : public PickerCallbacksNewGRFClass<StationClass> {
|
||||
public:
|
||||
StationPickerCallbacks() : PickerCallbacksNewGRFClass<StationClass>("fav_stations") {}
|
||||
|
||||
GrfSpecFeature GetFeature() const override { return GSF_STATIONS; }
|
||||
GrfSpecFeature GetFeature() const override { return GrfSpecFeature::Stations; }
|
||||
|
||||
StringID GetClassTooltip() const override { return STR_PICKER_STATION_CLASS_TOOLTIP; }
|
||||
StringID GetTypeTooltip() const override { return STR_PICKER_STATION_TYPE_TOOLTIP; }
|
||||
@@ -1205,7 +1205,7 @@ public:
|
||||
Rect r = this->GetWidget<NWidgetBase>(WID_BRAS_COVERAGE_TEXTS)->GetCurrentRect();
|
||||
const int bottom = r.bottom;
|
||||
r.bottom = INT_MAX; // Allow overflow as we want to know the required height.
|
||||
if (statspec != nullptr) r.top = DrawBadgeNameList(r, statspec->badges, GSF_STATIONS);
|
||||
if (statspec != nullptr) r.top = DrawBadgeNameList(r, statspec->badges, GrfSpecFeature::Stations);
|
||||
r.top = DrawStationCoverageAreaText(r, SCT_ALL, rad, false) + WidgetDimensions::scaled.vsep_normal;
|
||||
r.top = DrawStationCoverageAreaText(r, SCT_ALL, rad, true);
|
||||
/* Resize background if the window is too small.
|
||||
@@ -1838,7 +1838,7 @@ class WaypointPickerCallbacks : public PickerCallbacksNewGRFClass<StationClass>
|
||||
public:
|
||||
WaypointPickerCallbacks() : PickerCallbacksNewGRFClass<StationClass>("fav_waypoints") {}
|
||||
|
||||
GrfSpecFeature GetFeature() const override { return GSF_STATIONS; }
|
||||
GrfSpecFeature GetFeature() const override { return GrfSpecFeature::Stations; }
|
||||
|
||||
StringID GetClassTooltip() const override { return STR_PICKER_WAYPOINT_CLASS_TOOLTIP; }
|
||||
StringID GetTypeTooltip() const override { return STR_PICKER_WAYPOINT_TYPE_TOOLTIP; }
|
||||
@@ -2107,7 +2107,7 @@ DropDownList GetRailTypeDropDownList(bool for_replacement, bool all_option)
|
||||
}
|
||||
|
||||
/* Shared list so that each item can take ownership. */
|
||||
auto badge_class_list = std::make_shared<GUIBadgeClasses>(GSF_RAILTYPES);
|
||||
auto badge_class_list = std::make_shared<GUIBadgeClasses>(GrfSpecFeature::RailTypes);
|
||||
|
||||
for (const auto &rt : _sorted_railtypes) {
|
||||
/* If it's not used ever, don't show it to the user. */
|
||||
@@ -2116,12 +2116,12 @@ DropDownList GetRailTypeDropDownList(bool for_replacement, bool all_option)
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(rt);
|
||||
|
||||
if (for_replacement) {
|
||||
list.push_back(MakeDropDownListBadgeItem(badge_class_list, rti->badges, GSF_RAILTYPES, rti->introduction_date, GetString(rti->strings.replace_text), rt, !avail_railtypes.Test(rt)));
|
||||
list.push_back(MakeDropDownListBadgeItem(badge_class_list, rti->badges, GrfSpecFeature::RailTypes, rti->introduction_date, GetString(rti->strings.replace_text), rt, !avail_railtypes.Test(rt)));
|
||||
} else {
|
||||
std::string str = rti->max_speed > 0
|
||||
? GetString(STR_TOOLBAR_RAILTYPE_VELOCITY, rti->strings.menu_text, rti->max_speed)
|
||||
: GetString(rti->strings.menu_text);
|
||||
list.push_back(MakeDropDownListBadgeIconItem(badge_class_list, rti->badges, GSF_RAILTYPES, rti->introduction_date, RailBuildCost(rt), d, rti->gui_sprites.build_x_rail, PAL_NONE, std::move(str), rt, !avail_railtypes.Test(rt)));
|
||||
list.push_back(MakeDropDownListBadgeIconItem(badge_class_list, rti->badges, GrfSpecFeature::RailTypes, rti->introduction_date, RailBuildCost(rt), d, rti->gui_sprites.build_x_rail, PAL_NONE, std::move(str), rt, !avail_railtypes.Test(rt)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -1249,7 +1249,7 @@ class RoadStopPickerCallbacks : public PickerCallbacksNewGRFClass<RoadStopClass>
|
||||
public:
|
||||
RoadStopPickerCallbacks(const std::string &ini_group) : PickerCallbacksNewGRFClass<RoadStopClass>(ini_group) {}
|
||||
|
||||
GrfSpecFeature GetFeature() const override { return GSF_ROADSTOPS; }
|
||||
GrfSpecFeature GetFeature() const override { return GrfSpecFeature::RoadStops; }
|
||||
|
||||
StringID GetClassTooltip() const override;
|
||||
StringID GetTypeTooltip() const override;
|
||||
@@ -1443,7 +1443,7 @@ public:
|
||||
Rect r = this->GetWidget<NWidgetBase>(WID_BROS_ACCEPTANCE)->GetCurrentRect();
|
||||
const int bottom = r.bottom;
|
||||
r.bottom = INT_MAX; // Allow overflow as we want to know the required height.
|
||||
if (spec != nullptr) r.top = DrawBadgeNameList(r, spec->badges, GSF_ROADSTOPS);
|
||||
if (spec != nullptr) r.top = DrawBadgeNameList(r, spec->badges, GrfSpecFeature::RoadStops);
|
||||
r.top = DrawStationCoverageAreaText(r, sct, rad, false) + WidgetDimensions::scaled.vsep_normal;
|
||||
r.top = DrawStationCoverageAreaText(r, sct, rad, true);
|
||||
/* Resize background if the window is too small.
|
||||
@@ -1686,7 +1686,7 @@ class RoadWaypointPickerCallbacks : public PickerCallbacksNewGRFClass<RoadStopCl
|
||||
public:
|
||||
RoadWaypointPickerCallbacks() : PickerCallbacksNewGRFClass<RoadStopClass>("fav_road_waypoints") {}
|
||||
|
||||
GrfSpecFeature GetFeature() const override { return GSF_ROADSTOPS; }
|
||||
GrfSpecFeature GetFeature() const override { return GrfSpecFeature::RoadStops; }
|
||||
|
||||
StringID GetClassTooltip() const override { return STR_PICKER_WAYPOINT_CLASS_TOOLTIP; }
|
||||
StringID GetTypeTooltip() const override { return STR_PICKER_WAYPOINT_TYPE_TOOLTIP; }
|
||||
@@ -1860,7 +1860,7 @@ DropDownList GetRoadTypeDropDownList(RoadTramTypes rtts, bool for_replacement, b
|
||||
}
|
||||
|
||||
/* Shared list so that each item can take ownership. */
|
||||
auto badge_class_list = std::make_shared<GUIBadgeClasses>(GSF_ROADTYPES);
|
||||
auto badge_class_list = std::make_shared<GUIBadgeClasses>(GrfSpecFeature::RoadTypes);
|
||||
|
||||
for (const auto &rt : _sorted_roadtypes) {
|
||||
/* If it's not used ever, don't show it to the user. */
|
||||
@@ -1869,12 +1869,12 @@ DropDownList GetRoadTypeDropDownList(RoadTramTypes rtts, bool for_replacement, b
|
||||
const RoadTypeInfo *rti = GetRoadTypeInfo(rt);
|
||||
|
||||
if (for_replacement) {
|
||||
list.push_back(MakeDropDownListBadgeItem(badge_class_list, rti->badges, GSF_ROADTYPES, rti->introduction_date, GetString(rti->strings.replace_text), rt, !avail_roadtypes.Test(rt)));
|
||||
list.push_back(MakeDropDownListBadgeItem(badge_class_list, rti->badges, GrfSpecFeature::RoadTypes, rti->introduction_date, GetString(rti->strings.replace_text), rt, !avail_roadtypes.Test(rt)));
|
||||
} else {
|
||||
std::string str = rti->max_speed > 0
|
||||
? GetString(STR_TOOLBAR_ROADTYPE_VELOCITY, rti->strings.menu_text, rti->max_speed / 2)
|
||||
: GetString(rti->strings.menu_text);
|
||||
list.push_back(MakeDropDownListBadgeIconItem(badge_class_list, rti->badges, GSF_ROADTYPES, rti->introduction_date, RoadBuildCost(rt), d, rti->gui_sprites.build_x_road, PAL_NONE, std::move(str), rt, !avail_roadtypes.Test(rt)));
|
||||
list.push_back(MakeDropDownListBadgeIconItem(badge_class_list, rti->badges, GrfSpecFeature::RoadTypes, rti->introduction_date, RoadBuildCost(rt), d, rti->gui_sprites.build_x_road, PAL_NONE, std::move(str), rt, !avail_roadtypes.Test(rt)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1908,7 +1908,7 @@ DropDownList GetScenRoadTypeDropDownList(RoadTramTypes rtts)
|
||||
}
|
||||
|
||||
/* Shared list so that each item can take ownership. */
|
||||
auto badge_class_list = std::make_shared<GUIBadgeClasses>(GSF_ROADTYPES);
|
||||
auto badge_class_list = std::make_shared<GUIBadgeClasses>(GrfSpecFeature::RoadTypes);
|
||||
|
||||
for (const auto &rt : _sorted_roadtypes) {
|
||||
if (!used_roadtypes.Test(rt)) continue;
|
||||
@@ -1918,7 +1918,7 @@ DropDownList GetScenRoadTypeDropDownList(RoadTramTypes rtts)
|
||||
std::string str = rti->max_speed > 0
|
||||
? GetString(STR_TOOLBAR_ROADTYPE_VELOCITY, rti->strings.menu_text, rti->max_speed / 2)
|
||||
: GetString(rti->strings.menu_text);
|
||||
list.push_back(MakeDropDownListBadgeIconItem(badge_class_list, rti->badges, GSF_ROADTYPES, rti->introduction_date, RoadBuildCost(rt), d, rti->gui_sprites.build_x_road, PAL_NONE, std::move(str), rt, !avail_roadtypes.Test(rt)));
|
||||
list.push_back(MakeDropDownListBadgeIconItem(badge_class_list, rti->badges, GrfSpecFeature::RoadTypes, rti->introduction_date, RoadBuildCost(rt), d, rti->gui_sprites.build_x_road, PAL_NONE, std::move(str), rt, !avail_roadtypes.Test(rt)));
|
||||
}
|
||||
|
||||
if (list.empty()) {
|
||||
|
||||
@@ -271,19 +271,19 @@ static void InitializeWindowsAndCaches()
|
||||
/* Identify owners of persistent storage arrays */
|
||||
for (Industry *i : Industry::Iterate()) {
|
||||
if (i->psa != nullptr) {
|
||||
i->psa->feature = GSF_INDUSTRIES;
|
||||
i->psa->feature = GrfSpecFeature::Industries;
|
||||
i->psa->tile = i->location.tile;
|
||||
}
|
||||
}
|
||||
for (Station *s : Station::Iterate()) {
|
||||
if (s->airport.psa != nullptr) {
|
||||
s->airport.psa->feature = GSF_AIRPORTS;
|
||||
s->airport.psa->feature = GrfSpecFeature::Airports;
|
||||
s->airport.psa->tile = s->airport.tile;
|
||||
}
|
||||
}
|
||||
for (Town *t : Town::Iterate()) {
|
||||
for (auto &it : t->psa_list) {
|
||||
it->feature = GSF_FAKE_TOWNS;
|
||||
it->feature = GrfSpecFeature::FakeTowns;
|
||||
it->tile = t->xy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ struct INDYChunkHandler : ChunkHandler {
|
||||
if (IsSavegameVersionBefore(SLV_161) && !IsSavegameVersionBefore(SLV_76)) {
|
||||
/* Store the old persistent storage. The GRFID will be added later. */
|
||||
assert(PersistentStorage::CanAllocateItem());
|
||||
i->psa = PersistentStorage::Create(0, GSF_INVALID, TileIndex{});
|
||||
i->psa = PersistentStorage::Create(0, GrfSpecFeature::Invalid, TileIndex{});
|
||||
std::copy(std::begin(_old_ind_persistent_storage.storage), std::end(_old_ind_persistent_storage.storage), std::begin(i->psa->storage));
|
||||
}
|
||||
if (IsSavegameVersionBefore(SLV_EXTEND_INDUSTRY_CARGO_SLOTS)) {
|
||||
|
||||
@@ -430,7 +430,7 @@ public:
|
||||
if (IsSavegameVersionBefore(SLV_161) && !IsSavegameVersionBefore(SLV_145) && st->facilities.Test(StationFacility::Airport)) {
|
||||
/* Store the old persistent storage. The GRFID will be added later. */
|
||||
assert(PersistentStorage::CanAllocateItem());
|
||||
st->airport.psa = PersistentStorage::Create(0, GSF_INVALID, TileIndex{});
|
||||
st->airport.psa = PersistentStorage::Create(0, GrfSpecFeature::Invalid, TileIndex{});
|
||||
std::copy(std::begin(_old_st_persistent_storage.storage), std::end(_old_st_persistent_storage.storage), std::begin(st->airport.psa->storage));
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ struct PSACChunkHandler : ChunkHandler {
|
||||
|
||||
while ((index = SlIterateArray()) != -1) {
|
||||
assert(PersistentStorage::CanAllocateItem());
|
||||
PersistentStorage *ps = PersistentStorage::CreateAtIndex(PersistentStorageID(index), 0, GSF_INVALID, TileIndex{});
|
||||
PersistentStorage *ps = PersistentStorage::CreateAtIndex(PersistentStorageID(index), 0, GrfSpecFeature::Invalid, TileIndex{});
|
||||
SlObject(ps, slt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
EnforcePrecondition(false, goal_industry == ScriptIndustryType::INDUSTRYTYPE_UNKNOWN || goal_industry == ScriptIndustryType::INDUSTRYTYPE_TOWN || ScriptIndustryType::IsValidIndustryType(goal_industry));
|
||||
|
||||
auto res = GetAiPurchaseCallbackResult(
|
||||
GSF_STATIONS,
|
||||
GrfSpecFeature::Stations,
|
||||
cargo_type,
|
||||
0,
|
||||
source_industry,
|
||||
|
||||
+6
-6
@@ -1591,7 +1591,7 @@ CommandCost CmdBuildRailStation(DoCommandFlags flags, TileIndex tile_org, RailTy
|
||||
MakeRailStation(tile, st->owner, st->index, axis, *it, rt);
|
||||
/* Free the spec if we overbuild something */
|
||||
DeallocateSpecFromStation(st, old_specindex);
|
||||
if (statspec == nullptr) DeleteNewGRFInspectWindow(GSF_STATIONS, tile);
|
||||
if (statspec == nullptr) DeleteNewGRFInspectWindow(GrfSpecFeature::Stations, tile);
|
||||
|
||||
SetCustomStationSpecIndex(tile, *specindex);
|
||||
SetStationTileRandomBits(tile, GB(Random(), 0, 4));
|
||||
@@ -1820,7 +1820,7 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, std::vector<T *> &affected_st
|
||||
if (!build_rail && !IsStationTileBlocked(tile)) Company::Get(owner)->infrastructure.rail[rt]--;
|
||||
|
||||
DoClearSquare(tile);
|
||||
DeleteNewGRFInspectWindow(GSF_STATIONS, tile.base());
|
||||
DeleteNewGRFInspectWindow(GrfSpecFeature::Stations, tile.base());
|
||||
if (build_rail) MakeRailNormal(tile, owner, TrackToTrackBits(track), rt);
|
||||
Company::Get(owner)->infrastructure.station--;
|
||||
DirtyCompanyInfrastructureWindows(owner);
|
||||
@@ -2320,7 +2320,7 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlags flags, int repl
|
||||
|
||||
uint specindex = GetCustomRoadStopSpecIndex(tile);
|
||||
|
||||
DeleteNewGRFInspectWindow(GSF_ROADSTOPS, tile.base());
|
||||
DeleteNewGRFInspectWindow(GrfSpecFeature::RoadStops, tile.base());
|
||||
|
||||
if (IsDriveThroughStopTile(tile)) {
|
||||
/* Clears the tile for us */
|
||||
@@ -2403,7 +2403,7 @@ CommandCost RemoveRoadWaypointStop(TileIndex tile, DoCommandFlags flags, int rep
|
||||
|
||||
uint specindex = GetCustomRoadStopSpecIndex(tile);
|
||||
|
||||
DeleteNewGRFInspectWindow(GSF_ROADSTOPS, tile.base());
|
||||
DeleteNewGRFInspectWindow(GrfSpecFeature::RoadStops, tile.base());
|
||||
|
||||
DoClearSquare(tile);
|
||||
|
||||
@@ -2823,7 +2823,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlags flags)
|
||||
|
||||
if (flags.Test(DoCommandFlag::Execute)) {
|
||||
DoClearSquare(tile_cur);
|
||||
DeleteNewGRFInspectWindow(GSF_AIRPORTTILES, tile_cur.base());
|
||||
DeleteNewGRFInspectWindow(GrfSpecFeature::AirportTiles, tile_cur.base());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2843,7 +2843,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlags flags)
|
||||
|
||||
st->AfterStationTileSetChange(false, StationType::Airport);
|
||||
|
||||
DeleteNewGRFInspectWindow(GSF_AIRPORTS, st->index);
|
||||
DeleteNewGRFInspectWindow(GrfSpecFeature::Airports, st->index);
|
||||
}
|
||||
|
||||
return cost;
|
||||
|
||||
@@ -131,7 +131,7 @@ static const NIVariable _niv_stations[] = {
|
||||
|
||||
class NIHStation : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return GetStationSpec(TileIndex{index}) != nullptr; }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::GetByTile(TileIndex{index})->town->index); }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GrfSpecFeature::FakeTowns, Station::GetByTile(TileIndex{index})->town->index); }
|
||||
const void *GetInstance(uint ) const override { return nullptr; }
|
||||
const void *GetSpec(uint index) const override { return GetStationSpec(TileIndex{index}); }
|
||||
std::string GetName(uint index) const override { return GetString(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT, STR_STATION_NAME, GetStationIndex(index), index); }
|
||||
@@ -196,7 +196,7 @@ static const NIVariable _niv_house[] = {
|
||||
|
||||
class NIHHouse : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return HouseSpec::Get(GetHouseType(index))->grf_prop.HasGrfFile(); }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, GetTownIndex(index)); }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GrfSpecFeature::FakeTowns, GetTownIndex(index)); }
|
||||
const void *GetInstance(uint)const override { return nullptr; }
|
||||
const void *GetSpec(uint index) const override { return HouseSpec::Get(GetHouseType(index)); }
|
||||
std::string GetName(uint index) const override { return GetString(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT, STR_TOWN_NAME, GetTownIndex(index), index); }
|
||||
@@ -246,7 +246,7 @@ static const NIVariable _niv_industrytiles[] = {
|
||||
|
||||
class NIHIndustryTile : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.HasGrfFile(); }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_INDUSTRIES, GetIndustryIndex(index)); }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GrfSpecFeature::Industries, GetIndustryIndex(index)); }
|
||||
const void *GetInstance(uint)const override { return nullptr; }
|
||||
const void *GetSpec(uint index) const override { return GetIndustryTileSpec(GetIndustryGfx(index)); }
|
||||
std::string GetName(uint index) const override { return GetString(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT, STR_INDUSTRY_NAME, GetIndustryIndex(index), index); }
|
||||
@@ -358,7 +358,7 @@ static const NIVariable _niv_industries[] = {
|
||||
|
||||
class NIHIndustry : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return GetIndustrySpec(Industry::Get(index)->type)->grf_prop.HasGrfFile(); }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Industry::Get(index)->town->index); }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GrfSpecFeature::FakeTowns, Industry::Get(index)->town->index); }
|
||||
const void *GetInstance(uint index)const override { return Industry::Get(index); }
|
||||
const void *GetSpec(uint index) const override { return GetIndustrySpec(Industry::Get(index)->type); }
|
||||
std::string GetName(uint index) const override { return GetString(STR_INDUSTRY_NAME, index); }
|
||||
@@ -420,7 +420,7 @@ static const NIVariable _niv_objects[] = {
|
||||
|
||||
class NIHObject : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return ObjectSpec::GetByTile(TileIndex{index})->grf_prop.HasGrfFile(); }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Object::GetByTile(TileIndex{index})->town->index); }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GrfSpecFeature::FakeTowns, Object::GetByTile(TileIndex{index})->town->index); }
|
||||
const void *GetInstance(uint index)const override { return Object::GetByTile(TileIndex{index}); }
|
||||
const void *GetSpec(uint index) const override { return ObjectSpec::GetByTile(TileIndex{index}); }
|
||||
std::string GetName(uint index) const override { return GetString(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT, STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT, INVALID_STRING_ID, index); }
|
||||
@@ -492,7 +492,7 @@ static const NICallback _nic_airporttiles[] = {
|
||||
|
||||
class NIHAirportTile : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return AirportTileSpec::Get(GetAirportGfx(index))->grf_prop.HasGrfFile(); }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_AIRPORTS, GetStationIndex(index)); }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GrfSpecFeature::Airports, GetStationIndex(index)); }
|
||||
const void *GetInstance(uint)const override { return nullptr; }
|
||||
const void *GetSpec(uint index) const override { return AirportTileSpec::Get(GetAirportGfx(index)); }
|
||||
std::string GetName(uint index) const override { return GetString(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT, STR_STATION_NAME, GetStationIndex(index), index); }
|
||||
@@ -534,7 +534,7 @@ static const NIVariable _niv_airports[] = {
|
||||
|
||||
class NIHAirport : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return AirportSpec::Get(Station::Get(index)->airport.type)->grf_prop.HasGrfFile(); }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::Get(index)->town->index); }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GrfSpecFeature::FakeTowns, Station::Get(index)->town->index); }
|
||||
const void *GetInstance(uint index)const override { return Station::Get(index); }
|
||||
const void *GetSpec(uint index) const override { return AirportSpec::Get(Station::Get(index)->airport.type); }
|
||||
std::string GetName(uint index) const override { return GetString(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT, STR_STATION_NAME, index, Station::Get(index)->airport.tile); }
|
||||
@@ -697,7 +697,7 @@ static const NIVariable _nif_roadstops[] = {
|
||||
|
||||
class NIHRoadStop : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return GetRoadStopSpec(TileIndex{index}) != nullptr; }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, BaseStation::GetByTile(TileIndex{index})->town->index); }
|
||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GrfSpecFeature::FakeTowns, BaseStation::GetByTile(TileIndex{index})->town->index); }
|
||||
const void *GetInstance(uint)const override { return nullptr; }
|
||||
const void *GetSpec(uint index) const override { return GetRoadStopSpec(TileIndex{index}); }
|
||||
std::string GetName(uint index) const override { return GetString(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT, STR_STATION_NAME, GetStationIndex(index), index); }
|
||||
@@ -721,30 +721,29 @@ static const NIFeature _nif_roadstop = {
|
||||
};
|
||||
|
||||
/** Table with all NIFeatures. */
|
||||
static const NIFeature * const _nifeatures[] = {
|
||||
&_nif_vehicle, // GSF_TRAINS
|
||||
&_nif_vehicle, // GSF_ROADVEHICLES
|
||||
&_nif_vehicle, // GSF_SHIPS
|
||||
&_nif_vehicle, // GSF_AIRCRAFT
|
||||
&_nif_station, // GSF_STATIONS
|
||||
nullptr, // GSF_CANALS (no callbacks/action2 implemented)
|
||||
nullptr, // GSF_BRIDGES (no callbacks/action2)
|
||||
&_nif_house, // GSF_HOUSES
|
||||
nullptr, // GSF_GLOBALVAR (has no "physical" objects)
|
||||
&_nif_industrytile, // GSF_INDUSTRYTILES
|
||||
&_nif_industry, // GSF_INDUSTRIES
|
||||
nullptr, // GSF_CARGOES (has no "physical" objects)
|
||||
nullptr, // GSF_SOUNDFX (has no "physical" objects)
|
||||
&_nif_airport, // GSF_AIRPORTS
|
||||
nullptr, // GSF_SIGNALS (feature not implemented)
|
||||
&_nif_object, // GSF_OBJECTS
|
||||
&_nif_railtype, // GSF_RAILTYPES
|
||||
&_nif_airporttile, // GSF_AIRPORTTILES
|
||||
&_nif_roadtype, // GSF_ROADTYPES
|
||||
&_nif_tramtype, // GSF_TRAMTYPES
|
||||
&_nif_roadstop, // GSF_ROADSTOPS
|
||||
nullptr, // GSF_BADGES
|
||||
static const EnumClassIndexContainer<std::array<const NIFeature *, to_underlying(GrfSpecFeature::FakeEnd)>, GrfSpecFeature> _nifeatures{
|
||||
&_nif_vehicle, // GrfSpecFeature::Trains
|
||||
&_nif_vehicle, // GrfSpecFeature::RoadVehicles
|
||||
&_nif_vehicle, // GrfSpecFeature::Ships
|
||||
&_nif_vehicle, // GrfSpecFeature::Aircraft
|
||||
&_nif_station, // GrfSpecFeature::Stations
|
||||
nullptr, // GrfSpecFeature::Canals (no callbacks/action2 implemented)
|
||||
nullptr, // GrfSpecFeature::Bridges (no callbacks/action2)
|
||||
&_nif_house, // GrfSpecFeature::Houses
|
||||
nullptr, // GrfSpecFeature::GlobalVar (has no "physical" objects)
|
||||
&_nif_industrytile, // GrfSpecFeature::IndustryTiles
|
||||
&_nif_industry, // GrfSpecFeature::Industries
|
||||
nullptr, // GrfSpecFeature::Cargoes (has no "physical" objects)
|
||||
nullptr, // GrfSpecFeature::SoundEffects (has no "physical" objects)
|
||||
&_nif_airport, // GrfSpecFeature::Airports
|
||||
nullptr, // GrfSpecFeature::Signals (feature not implemented)
|
||||
&_nif_object, // GrfSpecFeature::Objects
|
||||
&_nif_railtype, // GrfSpecFeature::RailTypes
|
||||
&_nif_airporttile, // GrfSpecFeature::AirportTiles
|
||||
&_nif_roadtype, // GrfSpecFeature::RoadTypes
|
||||
&_nif_tramtype, // GrfSpecFeature::TramTypes
|
||||
&_nif_roadstop, // GrfSpecFeature::RoadStops
|
||||
nullptr, // GrfSpecFeature::Badges
|
||||
|
||||
&_nif_town, // GSF_FAKE_TOWNS
|
||||
&_nif_town, // GrfSpecFeature::FakeTowns
|
||||
};
|
||||
static_assert(lengthof(_nifeatures) == GSF_FAKE_END);
|
||||
|
||||
+71
-71
@@ -8,75 +8,75 @@
|
||||
/** @file pricebase.h Table of all default price bases. */
|
||||
|
||||
static const EnumClassIndexContainer<std::array<PriceBaseSpec, to_underlying(Price::End)>, Price> _price_base_specs = {
|
||||
PriceBaseSpec(100, PCAT_NONE, GSF_END, Price::Invalid), ///< Price::StationValue
|
||||
PriceBaseSpec(100, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::BuildRail
|
||||
PriceBaseSpec(95, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::BuildRoad
|
||||
PriceBaseSpec(65, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::BuildSignals
|
||||
PriceBaseSpec(275, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::BuildBridge
|
||||
PriceBaseSpec(600, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::BuildDepotTrain
|
||||
PriceBaseSpec(500, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::BuildDepotRoad
|
||||
PriceBaseSpec(700, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::BuildDepotShip
|
||||
PriceBaseSpec(450, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::BuildTunnel
|
||||
PriceBaseSpec(200, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::BuildStationRail
|
||||
PriceBaseSpec(180, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::BuildStationRailLength
|
||||
PriceBaseSpec(600, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::BuildStationAirport
|
||||
PriceBaseSpec(200, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::BuildStationBus
|
||||
PriceBaseSpec(200, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::BuildStationTruck
|
||||
PriceBaseSpec(350, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::BuildStationDock
|
||||
PriceBaseSpec(400000, PCAT_CONSTRUCTION, GSF_TRAINS, Price::Invalid), ///< Price::BuildVehicleTrain
|
||||
PriceBaseSpec(2000, PCAT_CONSTRUCTION, GSF_TRAINS, Price::Invalid), ///< Price::BuildVehicleWagon
|
||||
PriceBaseSpec(700000, PCAT_CONSTRUCTION, GSF_AIRCRAFT, Price::Invalid), ///< Price::BuildVehicleAircraft
|
||||
PriceBaseSpec(14000, PCAT_CONSTRUCTION, GSF_ROADVEHICLES, Price::Invalid), ///< Price::BuildVehicleRoad
|
||||
PriceBaseSpec(65000, PCAT_CONSTRUCTION, GSF_SHIPS, Price::Invalid), ///< Price::BuildVehicleShip
|
||||
PriceBaseSpec(20, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::BuildTrees
|
||||
PriceBaseSpec(250, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::Terraform
|
||||
PriceBaseSpec(20, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearGrass
|
||||
PriceBaseSpec(40, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearRough
|
||||
PriceBaseSpec(200, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearRocks
|
||||
PriceBaseSpec(500, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearFields
|
||||
PriceBaseSpec(20, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearTrees
|
||||
PriceBaseSpec(-70, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearRail
|
||||
PriceBaseSpec(10, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearSignals
|
||||
PriceBaseSpec(50, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearBridge
|
||||
PriceBaseSpec(80, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearDepotTrain
|
||||
PriceBaseSpec(80, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearDepotRoad
|
||||
PriceBaseSpec(90, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearDepotShip
|
||||
PriceBaseSpec(30, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearTunnel
|
||||
PriceBaseSpec(10000, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearWater
|
||||
PriceBaseSpec(50, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearStationRail
|
||||
PriceBaseSpec(30, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearStationAirport
|
||||
PriceBaseSpec(50, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearStationBus
|
||||
PriceBaseSpec(50, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearStationTruck
|
||||
PriceBaseSpec(55, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearStationDock
|
||||
PriceBaseSpec(1600, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearHouse
|
||||
PriceBaseSpec(40, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::ClearRoad
|
||||
PriceBaseSpec(5600, PCAT_RUNNING, GSF_TRAINS, Price::Invalid), ///< Price::RunningTrainSteam
|
||||
PriceBaseSpec(5200, PCAT_RUNNING, GSF_TRAINS, Price::Invalid), ///< Price::RunningTrainDiesel
|
||||
PriceBaseSpec(4800, PCAT_RUNNING, GSF_TRAINS, Price::Invalid), ///< Price::RunningTrainElectric
|
||||
PriceBaseSpec(9600, PCAT_RUNNING, GSF_AIRCRAFT, Price::Invalid), ///< Price::RunningAircraft
|
||||
PriceBaseSpec(1600, PCAT_RUNNING, GSF_ROADVEHICLES, Price::Invalid), ///< Price::RunningRoadveh
|
||||
PriceBaseSpec(5600, PCAT_RUNNING, GSF_SHIPS, Price::Invalid), ///< Price::RunningShip
|
||||
PriceBaseSpec(1000000, PCAT_CONSTRUCTION, GSF_END, Price::Invalid), ///< Price::BuildIndustry
|
||||
PriceBaseSpec(1600, PCAT_CONSTRUCTION, GSF_END, Price::ClearHouse), ///< Price::ClearIndustry
|
||||
PriceBaseSpec(40, PCAT_CONSTRUCTION, GSF_OBJECTS, Price::ClearRough), ///< Price::BuildObject
|
||||
PriceBaseSpec(40, PCAT_CONSTRUCTION, GSF_OBJECTS, Price::ClearRough), ///< Price::ClearObject
|
||||
PriceBaseSpec(600, PCAT_CONSTRUCTION, GSF_END, Price::BuildDepotTrain), ///< Price::BuildWaypointRail
|
||||
PriceBaseSpec(80, PCAT_CONSTRUCTION, GSF_END, Price::ClearDepotTrain), ///< Price::ClearWaypointRail
|
||||
PriceBaseSpec(350, PCAT_CONSTRUCTION, GSF_END, Price::BuildStationDock), ///< Price::BuildWaypointBuoy
|
||||
PriceBaseSpec(50, PCAT_CONSTRUCTION, GSF_END, Price::ClearStationTruck), ///< Price::ClearWaypointBuoy
|
||||
PriceBaseSpec(1000000, PCAT_CONSTRUCTION, GSF_END, Price::BuildIndustry), ///< Price::TownAction
|
||||
PriceBaseSpec(250, PCAT_CONSTRUCTION, GSF_END, Price::Terraform), ///< Price::BuildFoundation
|
||||
PriceBaseSpec(8000000, PCAT_CONSTRUCTION, GSF_END, Price::BuildIndustry), ///< Price::BuildIndustryRaw
|
||||
PriceBaseSpec(1000000, PCAT_CONSTRUCTION, GSF_END, Price::BuildIndustry), ///< Price::BuildTown
|
||||
PriceBaseSpec(5000, PCAT_CONSTRUCTION, GSF_END, Price::ClearWater), ///< Price::BuildCanal
|
||||
PriceBaseSpec(5000, PCAT_CONSTRUCTION, GSF_END, Price::ClearWater), ///< Price::ClearCanal
|
||||
PriceBaseSpec(10000, PCAT_CONSTRUCTION, GSF_END, Price::ClearWater), ///< Price::BuildAqueduct
|
||||
PriceBaseSpec(2000, PCAT_CONSTRUCTION, GSF_END, Price::ClearBridge), ///< Price::ClearAqueduct
|
||||
PriceBaseSpec(7500, PCAT_CONSTRUCTION, GSF_END, Price::ClearWater), ///< Price::BuildLock
|
||||
PriceBaseSpec(2000, PCAT_CONSTRUCTION, GSF_END, Price::ClearWater), ///< Price::ClearLock
|
||||
PriceBaseSpec(10, PCAT_RUNNING, GSF_END, Price::BuildRail), ///< Price::InfrastructureRail
|
||||
PriceBaseSpec(10, PCAT_RUNNING, GSF_END, Price::BuildRoad), ///< Price::InfrastructureRoad
|
||||
PriceBaseSpec(8, PCAT_RUNNING, GSF_END, Price::BuildCanal), ///< Price::InfrastructureWater
|
||||
PriceBaseSpec(100, PCAT_RUNNING, GSF_END, Price::StationValue), ///< Price::InfrastructureStation
|
||||
PriceBaseSpec(5000, PCAT_RUNNING, GSF_END, Price::BuildStationAirport), ///< Price::InfrastructureAirport
|
||||
PriceBaseSpec(100, PCAT_NONE, GrfSpecFeature::End, Price::Invalid), // Price::StationValue
|
||||
PriceBaseSpec(100, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildRail
|
||||
PriceBaseSpec(95, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildRoad
|
||||
PriceBaseSpec(65, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildSignals
|
||||
PriceBaseSpec(275, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildBridge
|
||||
PriceBaseSpec(600, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildDepotTrain
|
||||
PriceBaseSpec(500, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildDepotRoad
|
||||
PriceBaseSpec(700, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildDepotShip
|
||||
PriceBaseSpec(450, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildTunnel
|
||||
PriceBaseSpec(200, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildStationRail
|
||||
PriceBaseSpec(180, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildStationRailLength
|
||||
PriceBaseSpec(600, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildStationAirport
|
||||
PriceBaseSpec(200, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildStationBus
|
||||
PriceBaseSpec(200, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildStationTruck
|
||||
PriceBaseSpec(350, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildStationDock
|
||||
PriceBaseSpec(400000, PCAT_CONSTRUCTION, GrfSpecFeature::Trains, Price::Invalid), // Price::BuildVehicleTrain
|
||||
PriceBaseSpec(2000, PCAT_CONSTRUCTION, GrfSpecFeature::Trains, Price::Invalid), // Price::BuildVehicleWagon
|
||||
PriceBaseSpec(700000, PCAT_CONSTRUCTION, GrfSpecFeature::Aircraft, Price::Invalid), // Price::BuildVehicleAircraft
|
||||
PriceBaseSpec(14000, PCAT_CONSTRUCTION, GrfSpecFeature::RoadVehicles, Price::Invalid), // Price::BuildVehicleRoad
|
||||
PriceBaseSpec(65000, PCAT_CONSTRUCTION, GrfSpecFeature::Ships, Price::Invalid), // Price::BuildVehicleShip
|
||||
PriceBaseSpec(20, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildTrees
|
||||
PriceBaseSpec(250, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::Terraform
|
||||
PriceBaseSpec(20, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearGrass
|
||||
PriceBaseSpec(40, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearRough
|
||||
PriceBaseSpec(200, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearRocks
|
||||
PriceBaseSpec(500, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearFields
|
||||
PriceBaseSpec(20, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearTrees
|
||||
PriceBaseSpec(-70, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearRail
|
||||
PriceBaseSpec(10, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearSignals
|
||||
PriceBaseSpec(50, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearBridge
|
||||
PriceBaseSpec(80, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearDepotTrain
|
||||
PriceBaseSpec(80, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearDepotRoad
|
||||
PriceBaseSpec(90, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearDepotShip
|
||||
PriceBaseSpec(30, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearTunnel
|
||||
PriceBaseSpec(10000, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearWater
|
||||
PriceBaseSpec(50, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearStationRail
|
||||
PriceBaseSpec(30, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearStationAirport
|
||||
PriceBaseSpec(50, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearStationBus
|
||||
PriceBaseSpec(50, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearStationTruck
|
||||
PriceBaseSpec(55, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearStationDock
|
||||
PriceBaseSpec(1600, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearHouse
|
||||
PriceBaseSpec(40, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::ClearRoad
|
||||
PriceBaseSpec(5600, PCAT_RUNNING, GrfSpecFeature::Trains, Price::Invalid), // Price::RunningTrainSteam
|
||||
PriceBaseSpec(5200, PCAT_RUNNING, GrfSpecFeature::Trains, Price::Invalid), // Price::RunningTrainDiesel
|
||||
PriceBaseSpec(4800, PCAT_RUNNING, GrfSpecFeature::Trains, Price::Invalid), // Price::RunningTrainElectric
|
||||
PriceBaseSpec(9600, PCAT_RUNNING, GrfSpecFeature::Aircraft, Price::Invalid), // Price::RunningAircraft
|
||||
PriceBaseSpec(1600, PCAT_RUNNING, GrfSpecFeature::RoadVehicles, Price::Invalid), // Price::RunningRoadveh
|
||||
PriceBaseSpec(5600, PCAT_RUNNING, GrfSpecFeature::Ships, Price::Invalid), // Price::RunningShip
|
||||
PriceBaseSpec(1000000, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Invalid), // Price::BuildIndustry
|
||||
PriceBaseSpec(1600, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::ClearHouse), // Price::ClearIndustry
|
||||
PriceBaseSpec(40, PCAT_CONSTRUCTION, GrfSpecFeature::Objects, Price::ClearRough), // Price::BuildObject
|
||||
PriceBaseSpec(40, PCAT_CONSTRUCTION, GrfSpecFeature::Objects, Price::ClearRough), // Price::ClearObject
|
||||
PriceBaseSpec(600, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::BuildDepotTrain), // Price::BuildWaypointRail
|
||||
PriceBaseSpec(80, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::ClearDepotTrain), // Price::ClearWaypointRail
|
||||
PriceBaseSpec(350, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::BuildStationDock), // Price::BuildWaypointBuoy
|
||||
PriceBaseSpec(50, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::ClearStationTruck), // Price::ClearWaypointBuoy
|
||||
PriceBaseSpec(1000000, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::BuildIndustry), // Price::TownAction
|
||||
PriceBaseSpec(250, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::Terraform), // Price::BuildFoundation
|
||||
PriceBaseSpec(8000000, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::BuildIndustry), // Price::BuildIndustryRaw
|
||||
PriceBaseSpec(1000000, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::BuildIndustry), // Price::BuildTown
|
||||
PriceBaseSpec(5000, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::ClearWater), // Price::BuildCanal
|
||||
PriceBaseSpec(5000, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::ClearWater), // Price::ClearCanal
|
||||
PriceBaseSpec(10000, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::ClearWater), // Price::BuildAqueduct
|
||||
PriceBaseSpec(2000, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::ClearBridge), // Price::ClearAqueduct
|
||||
PriceBaseSpec(7500, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::ClearWater), // Price::BuildLock
|
||||
PriceBaseSpec(2000, PCAT_CONSTRUCTION, GrfSpecFeature::End, Price::ClearWater), // Price::ClearLock
|
||||
PriceBaseSpec(10, PCAT_RUNNING, GrfSpecFeature::End, Price::BuildRail), // Price::InfrastructureRail
|
||||
PriceBaseSpec(10, PCAT_RUNNING, GrfSpecFeature::End, Price::BuildRoad), // Price::InfrastructureRoad
|
||||
PriceBaseSpec(8, PCAT_RUNNING, GrfSpecFeature::End, Price::BuildCanal), // Price::InfrastructureWater
|
||||
PriceBaseSpec(100, PCAT_RUNNING, GrfSpecFeature::End, Price::StationValue), // Price::InfrastructureStation
|
||||
PriceBaseSpec(5000, PCAT_RUNNING, GrfSpecFeature::End, Price::BuildStationAirport), // Price::InfrastructureAirport
|
||||
};
|
||||
|
||||
+2
-2
@@ -161,7 +161,7 @@ Town::~Town()
|
||||
|
||||
Source src{this->index, SourceType::Town};
|
||||
DeleteSubsidyWith(src);
|
||||
DeleteNewGRFInspectWindow(GSF_FAKE_TOWNS, this->index);
|
||||
DeleteNewGRFInspectWindow(GrfSpecFeature::FakeTowns, this->index);
|
||||
CargoPacket::InvalidateAllFrom(src);
|
||||
MarkWholeScreenDirty();
|
||||
}
|
||||
@@ -3050,7 +3050,7 @@ static void DoClearTownHouseHelper(TileIndex tile, Town *t, HouseID house)
|
||||
DecreaseBuildingCount(t, house);
|
||||
DoClearSquare(tile);
|
||||
|
||||
DeleteNewGRFInspectWindow(GSF_HOUSES, tile.base());
|
||||
DeleteNewGRFInspectWindow(GrfSpecFeature::Houses, tile.base());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1488,7 +1488,7 @@ public:
|
||||
STR_HOUSE_PICKER_CLASS_ZONE5,
|
||||
};
|
||||
|
||||
GrfSpecFeature GetFeature() const override { return GSF_HOUSES; }
|
||||
GrfSpecFeature GetFeature() const override { return GrfSpecFeature::Houses; }
|
||||
|
||||
StringID GetClassTooltip() const override { return STR_PICKER_HOUSE_CLASS_TOOLTIP; }
|
||||
StringID GetTypeTooltip() const override { return STR_PICKER_HOUSE_TYPE_TOOLTIP; }
|
||||
|
||||
+2
-2
@@ -244,7 +244,7 @@ void Train::ConsistChanged(ConsistChangeFlags allowed_changes)
|
||||
SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
|
||||
InvalidateWindowData(WC_VEHICLE_REFIT, this->index, VIWD_CONSIST_CHANGED);
|
||||
InvalidateWindowData(WC_VEHICLE_ORDERS, this->index, VIWD_CONSIST_CHANGED);
|
||||
InvalidateNewGRFInspectWindow(GSF_TRAINS, this->index);
|
||||
InvalidateNewGRFInspectWindow(GrfSpecFeature::Trains, this->index);
|
||||
|
||||
/* If the consist is changed while in a depot, the vehicle view window must be invalidated to update the availability of refitting. */
|
||||
InvalidateWindowData(WC_VEHICLE_VIEW, this->index, VIWD_CONSIST_CHANGED);
|
||||
@@ -1380,7 +1380,7 @@ CommandCost CmdMoveRailVehicle(DoCommandFlags flags, VehicleID src_veh, VehicleI
|
||||
CloseWindowById(WC_VEHICLE_REFIT, src->index);
|
||||
CloseWindowById(WC_VEHICLE_DETAILS, src->index);
|
||||
CloseWindowById(WC_VEHICLE_TIMETABLE, src->index);
|
||||
DeleteNewGRFInspectWindow(GSF_TRAINS, src->index);
|
||||
DeleteNewGRFInspectWindow(GrfSpecFeature::Trains, src->index);
|
||||
SetWindowDirty(WC_COMPANY, _current_company);
|
||||
|
||||
if (src_head != nullptr && src_head->IsFrontEngine()) {
|
||||
|
||||
@@ -318,7 +318,7 @@ CommandCost CmdBuildRailWaypoint(DoCommandFlags flags, TileIndex start_tile, Axi
|
||||
MarkTileDirtyByTile(tile);
|
||||
|
||||
DeallocateSpecFromStation(wp, old_specindex);
|
||||
if (spec == nullptr) DeleteNewGRFInspectWindow(GSF_STATIONS, tile);
|
||||
if (spec == nullptr) DeleteNewGRFInspectWindow(GrfSpecFeature::Stations, tile);
|
||||
YapfNotifyTrackLayoutChange(tile, AxisToTrack(axis));
|
||||
}
|
||||
DirtyCompanyInfrastructureWindows(wp->owner);
|
||||
|
||||
Reference in New Issue
Block a user