Codechange: make ChangeInfoResult a scoped enum

This commit is contained in:
Rubidium
2026-04-11 10:26:33 +02:00
committed by rubidium42
parent 042facf96c
commit 7016d2bee3
21 changed files with 134 additions and 134 deletions
+14 -14
View File
@@ -59,10 +59,10 @@ ChangeInfoResult CommonVehicleChangeInfo(EngineInfo *ei, int prop, ByteReader &b
break;
default:
return CIR_UNKNOWN;
return ChangeInfoResult::Unknown;
}
return CIR_SUCCESS;
return ChangeInfoResult::Success;
}
/**
@@ -114,25 +114,25 @@ bool HandleChangeInfoResult(std::string_view caller, ChangeInfoResult cir, GrfSp
switch (cir) {
default: NOT_REACHED();
case CIR_DISABLED:
case ChangeInfoResult::Disabled:
/* Error has already been printed; just stop parsing */
return true;
case CIR_SUCCESS:
case ChangeInfoResult::Success:
return false;
case CIR_UNHANDLED:
case ChangeInfoResult::Unhandled:
GrfMsg(1, "{}: Ignoring property 0x{:02X} of feature 0x{:02X} (not implemented)", caller, property, feature);
return false;
case CIR_UNKNOWN:
case ChangeInfoResult::Unknown:
GrfMsg(0, "{}: Unknown property 0x{:02X} of feature 0x{:02X}, disabling", caller, property, feature);
[[fallthrough]];
case CIR_INVALID_ID: {
case ChangeInfoResult::InvalidId: {
/* No debug message for an invalid ID, as it has already been output */
GRFError *error = DisableGrf(cir == CIR_INVALID_ID ? STR_NEWGRF_ERROR_INVALID_ID : STR_NEWGRF_ERROR_UNKNOWN_PROPERTY);
if (cir != CIR_INVALID_ID) error->param_value[1] = property;
GRFError *error = DisableGrf(cir == ChangeInfoResult::InvalidId ? STR_NEWGRF_ERROR_INVALID_ID : STR_NEWGRF_ERROR_UNKNOWN_PROPERTY);
if (cir != ChangeInfoResult::InvalidId) error->param_value[1] = property;
return true;
}
}
@@ -163,7 +163,7 @@ struct InvokeGrfChangeInfoHandler {
static ChangeInfoResult Invoke(GrfSpecFeature feature, uint first, uint last, int prop, ByteReader &buf, GrfLoadingStage stage)
{
Invoker func = feature < std::size(funcs) ? funcs[feature] : nullptr;
if (func == nullptr) return CIR_UNKNOWN;
if (func == nullptr) return ChangeInfoResult::Unknown;
return func(first, last, prop, buf, stage);
}
};
@@ -197,8 +197,8 @@ static void FeatureChangeInfo(ByteReader &buf)
/* Test if feature handles change. */
ChangeInfoResult cir_test = InvokeGrfChangeInfoHandler::Invoke(feature, 0, 0, 0, buf, GrfLoadingStage::Activation);
if (cir_test == CIR_UNHANDLED) return;
if (cir_test == CIR_UNKNOWN) {
if (cir_test == ChangeInfoResult::Unhandled) return;
if (cir_test == ChangeInfoResult::Unknown) {
GrfMsg(1, "FeatureChangeInfo: Unsupported feature 0x{:02X}, skipping", feature);
return;
}
@@ -255,8 +255,8 @@ static void ReserveChangeInfo(ByteReader &buf)
/* Test if feature handles reservation. */
ChangeInfoResult cir_test = InvokeGrfChangeInfoHandler::Invoke(feature, 0, 0, 0, buf, GrfLoadingStage::Reserve);
if (cir_test == CIR_UNHANDLED) return;
if (cir_test == CIR_UNKNOWN) {
if (cir_test == ChangeInfoResult::Unhandled) return;
if (cir_test == ChangeInfoResult::Unknown) {
GrfMsg(1, "ReserveChangeInfo: Unsupported feature 0x{:02X}, skipping", feature);
return;
}
+3 -3
View File
@@ -28,11 +28,11 @@
*/
static ChangeInfoResult AircraftVehicleChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
for (uint id = first; id < last; ++id) {
Engine *e = GetNewEngine(_cur_gps.grffile, VEH_AIRCRAFT, id);
if (e == nullptr) return CIR_INVALID_ID; // No engine could be allocated, so neither can any next vehicles
if (e == nullptr) return ChangeInfoResult::InvalidId; // No engine could be allocated, so neither can any next vehicles
EngineInfo *ei = &e->info;
AircraftVehicleInfo *avi = &e->VehInfo<AircraftVehicleInfo>();
@@ -197,5 +197,5 @@ static ChangeInfoResult AircraftVehicleChangeInfo(uint first, uint last, int pro
return ret;
}
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_AIRCRAFT>::Reserve(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_AIRCRAFT>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_AIRCRAFT>::Activation(uint first, uint last, int prop, ByteReader &buf) { return AircraftVehicleChangeInfo(first, last, prop, buf); }
+10 -10
View File
@@ -27,11 +27,11 @@
*/
static ChangeInfoResult AirportChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
if (last > NUM_AIRPORTS_PER_GRF) {
GrfMsg(1, "AirportChangeInfo: Too many airports, trying id ({}), max ({}). Ignoring.", last, NUM_AIRPORTS_PER_GRF);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
/* Allocate industry specs if they haven't been allocated already. */
@@ -42,7 +42,7 @@ static ChangeInfoResult AirportChangeInfo(uint first, uint last, int prop, ByteR
if (as == nullptr && prop != 0x08 && prop != 0x09) {
GrfMsg(2, "AirportChangeInfo: Attempt to modify undefined airport {}, ignoring", id);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
switch (prop) {
@@ -165,7 +165,7 @@ static ChangeInfoResult AirportChangeInfo(uint first, uint last, int prop, ByteR
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
@@ -175,11 +175,11 @@ static ChangeInfoResult AirportChangeInfo(uint first, uint last, int prop, ByteR
static ChangeInfoResult AirportTilesChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
if (last > NUM_AIRPORTTILES_PER_GRF) {
GrfMsg(1, "AirportTileChangeInfo: Too many airport tiles loaded ({}), max ({}). Ignoring.", last, NUM_AIRPORTTILES_PER_GRF);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
/* Allocate airport tile specs if they haven't been allocated already. */
@@ -190,7 +190,7 @@ static ChangeInfoResult AirportTilesChangeInfo(uint first, uint last, int prop,
if (prop != 0x08 && tsp == nullptr) {
GrfMsg(2, "AirportTileChangeInfo: Attempt to modify undefined airport tile {}. Ignoring.", id);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
switch (prop) {
@@ -253,7 +253,7 @@ static ChangeInfoResult AirportTilesChangeInfo(uint first, uint last, int prop,
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
@@ -261,8 +261,8 @@ static ChangeInfoResult AirportTilesChangeInfo(uint first, uint last, int prop,
return ret;
}
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_AIRPORTS>::Reserve(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_AIRPORTS>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_AIRPORTS>::Activation(uint first, uint last, int prop, ByteReader &buf) { return AirportChangeInfo(first, last, prop, buf); }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_AIRPORTTILES>::Reserve(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_AIRPORTTILES>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_AIRPORTTILES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return AirportTilesChangeInfo(first, last, prop, buf); }
+5 -5
View File
@@ -18,18 +18,18 @@
static ChangeInfoResult BadgeChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
if (last >= UINT16_MAX) {
GrfMsg(1, "BadgeChangeInfo: Tag {} is invalid, max {}, ignoring", last, UINT16_MAX - 1);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
for (uint id = first; id < last; ++id) {
auto it = _cur_gps.grffile->badge_map.find(id);
if (prop != 0x08 && it == std::end(_cur_gps.grffile->badge_map)) {
GrfMsg(1, "BadgeChangeInfo: Attempt to modify undefined tag {}, ignoring", id);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
Badge *badge = nullptr;
@@ -47,7 +47,7 @@ static ChangeInfoResult BadgeChangeInfo(uint first, uint last, int prop, ByteRea
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
@@ -55,5 +55,5 @@ static ChangeInfoResult BadgeChangeInfo(uint first, uint last, int prop, ByteRea
return ret;
}
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_BADGES>::Reserve(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_BADGES>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_BADGES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return BadgeChangeInfo(first, last, prop, buf); }
+4 -4
View File
@@ -26,11 +26,11 @@
*/
static ChangeInfoResult BridgeChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
if (last > MAX_BRIDGES) {
GrfMsg(1, "BridgeChangeInfo: Bridge {} is invalid, max {}, ignoring", last, MAX_BRIDGES);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
for (uint id = first; id < last; ++id) {
@@ -137,7 +137,7 @@ static ChangeInfoResult BridgeChangeInfo(uint first, uint last, int prop, ByteRe
}
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
@@ -145,5 +145,5 @@ static ChangeInfoResult BridgeChangeInfo(uint first, uint last, int prop, ByteRe
return ret;
}
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_BRIDGES>::Reserve(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_BRIDGES>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_BRIDGES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return BridgeChangeInfo(first, last, prop, buf); }
+4 -4
View File
@@ -24,11 +24,11 @@
*/
static ChangeInfoResult CanalChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
if (last > CF_END) {
GrfMsg(1, "CanalChangeInfo: Canal feature 0x{:02X} is invalid, max {}, ignoring", last, CF_END);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
for (uint id = first; id < last; ++id) {
@@ -44,7 +44,7 @@ static ChangeInfoResult CanalChangeInfo(uint first, uint last, int prop, ByteRea
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
@@ -52,5 +52,5 @@ static ChangeInfoResult CanalChangeInfo(uint first, uint last, int prop, ByteRea
return ret;
}
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_CANALS>::Reserve(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_CANALS>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_CANALS>::Activation(uint first, uint last, int prop, ByteReader &buf) { return CanalChangeInfo(first, last, prop, buf); }
+4 -4
View File
@@ -49,11 +49,11 @@ static void MaybeInstallFallbackCargoLabel(uint id, uint last, CargoLabel label)
*/
static ChangeInfoResult CargoReserveInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
if (last > NUM_CARGO) {
GrfMsg(2, "CargoChangeInfo: Cargo type {} out of range (max {})", last, NUM_CARGO - 1);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
for (uint id = first; id < last; ++id) {
@@ -189,7 +189,7 @@ static ChangeInfoResult CargoReserveInfo(uint first, uint last, int prop, ByteRe
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
@@ -198,4 +198,4 @@ static ChangeInfoResult CargoReserveInfo(uint first, uint last, int prop, ByteRe
}
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_CARGOES>::Reserve(uint first, uint last, int prop, ByteReader &buf) { return CargoReserveInfo(first, last, prop, buf); }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_CARGOES>::Activation(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_CARGOES>::Activation(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
+8 -8
View File
@@ -46,7 +46,7 @@ static ChangeInfoResult LoadTranslationTable(uint first, uint last, ByteReader &
{
if (first != 0) {
GrfMsg(1, "LoadTranslationTable: {} translation table must start at zero", name);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
std::vector<T> &translation_table = gettable(*_cur_gps.grffile);
@@ -64,14 +64,14 @@ static ChangeInfoResult LoadTranslationTable(uint first, uint last, ByteReader &
override_table = translation_table;
}
return CIR_SUCCESS;
return ChangeInfoResult::Success;
}
static ChangeInfoResult LoadBadgeTranslationTable(uint first, uint last, ByteReader &buf, std::vector<BadgeID> &translation_table, std::string_view name)
{
if (first != 0 && first != std::size(translation_table)) {
GrfMsg(1, "LoadBadgeTranslationTable: {} translation table must start at zero or {}", name, std::size(translation_table));
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
if (first == 0) translation_table.clear();
@@ -81,7 +81,7 @@ static ChangeInfoResult LoadBadgeTranslationTable(uint first, uint last, ByteRea
translation_table.push_back(GetOrCreateBadge(label).index);
}
return CIR_SUCCESS;
return ChangeInfoResult::Success;
}
/**
@@ -131,7 +131,7 @@ static ChangeInfoResult GlobalVarChangeInfo(uint first, uint last, int prop, Byt
}
/* Properties which are handled per item */
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
for (uint id = first; id < last; ++id) {
switch (prop) {
case 0x08: { // Cost base factor
@@ -325,7 +325,7 @@ static ChangeInfoResult GlobalVarChangeInfo(uint first, uint last, int prop, Byt
}
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
@@ -359,7 +359,7 @@ static ChangeInfoResult GlobalVarReserveInfo(uint first, uint last, int prop, By
}
/* Properties which are handled per item */
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
for (uint id = first; id < last; ++id) {
switch (prop) {
@@ -399,7 +399,7 @@ static ChangeInfoResult GlobalVarReserveInfo(uint first, uint last, int prop, By
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
+7 -7
View File
@@ -28,7 +28,7 @@
*/
static ChangeInfoResult IgnoreTownHouseProperty(int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
switch (prop) {
case 0x09:
@@ -79,7 +79,7 @@ static ChangeInfoResult IgnoreTownHouseProperty(int prop, ByteReader &buf)
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
return ret;
@@ -95,11 +95,11 @@ static ChangeInfoResult IgnoreTownHouseProperty(int prop, ByteReader &buf)
*/
static ChangeInfoResult TownHouseChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
if (last > NUM_HOUSES_PER_GRF) {
GrfMsg(1, "TownHouseChangeInfo: Too many houses loaded ({}), max ({}). Ignoring.", last, NUM_HOUSES_PER_GRF);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
/* Allocate house specs if they haven't been allocated already. */
@@ -324,7 +324,7 @@ static ChangeInfoResult TownHouseChangeInfo(uint first, uint last, int prop, Byt
if (count > lengthof(housespec->accepts_cargo)) {
GRFError *error = DisableGrf(STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG);
error->param_value[1] = prop;
return CIR_DISABLED;
return ChangeInfoResult::Disabled;
}
/* Always write the full accepts_cargo array, and check each index for being inside the
* provided data. This ensures all values are properly initialized, and also avoids
@@ -347,7 +347,7 @@ static ChangeInfoResult TownHouseChangeInfo(uint first, uint last, int prop, Byt
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
@@ -355,5 +355,5 @@ static ChangeInfoResult TownHouseChangeInfo(uint first, uint last, int prop, Byt
return ret;
}
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_HOUSES>::Reserve(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_HOUSES>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_HOUSES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return TownHouseChangeInfo(first, last, prop, buf); }
+19 -19
View File
@@ -33,7 +33,7 @@ extern const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET];
*/
static ChangeInfoResult IgnoreIndustryTileProperty(int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
switch (prop) {
case 0x09:
@@ -57,7 +57,7 @@ static ChangeInfoResult IgnoreIndustryTileProperty(int prop, ByteReader &buf)
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
return ret;
@@ -73,11 +73,11 @@ static ChangeInfoResult IgnoreIndustryTileProperty(int prop, ByteReader &buf)
*/
static ChangeInfoResult IndustrytilesChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
if (last > NUM_INDUSTRYTILES_PER_GRF) {
GrfMsg(1, "IndustryTilesChangeInfo: Too many industry tiles loaded ({}), max ({}). Ignoring.", last, NUM_INDUSTRYTILES_PER_GRF);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
/* Allocate industry tile specs if they haven't been allocated already. */
@@ -174,7 +174,7 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint first, uint last, int prop,
if (num_cargoes > std::size(tsp->acceptance)) {
GRFError *error = DisableGrf(STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG);
error->param_value[1] = prop;
return CIR_DISABLED;
return ChangeInfoResult::Disabled;
}
for (uint i = 0; i < std::size(tsp->acceptance); i++) {
if (i < num_cargoes) {
@@ -195,7 +195,7 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint first, uint last, int prop,
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
@@ -211,7 +211,7 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint first, uint last, int prop,
*/
static ChangeInfoResult IgnoreIndustryProperty(int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
switch (prop) {
case 0x09:
@@ -292,7 +292,7 @@ static ChangeInfoResult IgnoreIndustryProperty(int prop, ByteReader &buf)
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
return ret;
@@ -338,11 +338,11 @@ static bool ValidateIndustryLayout(const IndustryTileLayout &layout)
*/
static ChangeInfoResult IndustriesChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
if (last > NUM_INDUSTRYTYPES_PER_GRF) {
GrfMsg(1, "IndustriesChangeInfo: Too many industries loaded ({}), max ({}). Ignoring.", last, NUM_INDUSTRYTYPES_PER_GRF);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
/* Allocate industry specs if they haven't been allocated already. */
@@ -432,12 +432,12 @@ static ChangeInfoResult IndustriesChangeInfo(uint first, uint last, int prop, By
if (type >= lengthof(_origin_industry_specs)) {
GrfMsg(1, "IndustriesChangeInfo: Invalid original industry number for layout import, industry {}", id);
DisableGrf(STR_NEWGRF_ERROR_INVALID_ID);
return CIR_DISABLED;
return ChangeInfoResult::Disabled;
}
if (laynbr >= _origin_industry_specs[type].layouts.size()) {
GrfMsg(1, "IndustriesChangeInfo: Invalid original industry layout index for layout import, industry {}", id);
DisableGrf(STR_NEWGRF_ERROR_INVALID_ID);
return CIR_DISABLED;
return ChangeInfoResult::Disabled;
}
layout = _origin_industry_specs[type].layouts[laynbr];
break;
@@ -622,7 +622,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint first, uint last, int prop, By
if (num_cargoes > std::size(indsp->produced_cargo)) {
GRFError *error = DisableGrf(STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG);
error->param_value[1] = prop;
return CIR_DISABLED;
return ChangeInfoResult::Disabled;
}
for (size_t i = 0; i < std::size(indsp->produced_cargo); i++) {
if (i < num_cargoes) {
@@ -641,7 +641,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint first, uint last, int prop, By
if (num_cargoes > std::size(indsp->accepts_cargo)) {
GRFError *error = DisableGrf(STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG);
error->param_value[1] = prop;
return CIR_DISABLED;
return ChangeInfoResult::Disabled;
}
for (size_t i = 0; i < std::size(indsp->accepts_cargo); i++) {
if (i < num_cargoes) {
@@ -660,7 +660,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint first, uint last, int prop, By
if (num_cargoes > lengthof(indsp->production_rate)) {
GRFError *error = DisableGrf(STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG);
error->param_value[1] = prop;
return CIR_DISABLED;
return ChangeInfoResult::Disabled;
}
for (uint i = 0; i < lengthof(indsp->production_rate); i++) {
if (i < num_cargoes) {
@@ -678,7 +678,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint first, uint last, int prop, By
if (num_inputs > std::size(indsp->accepts_cargo) || num_outputs > std::size(indsp->produced_cargo)) {
GRFError *error = DisableGrf(STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG);
error->param_value[1] = prop;
return CIR_DISABLED;
return ChangeInfoResult::Disabled;
}
for (size_t i = 0; i < std::size(indsp->accepts_cargo); i++) {
for (size_t j = 0; j < std::size(indsp->produced_cargo); j++) {
@@ -695,7 +695,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint first, uint last, int prop, By
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
@@ -703,8 +703,8 @@ static ChangeInfoResult IndustriesChangeInfo(uint first, uint last, int prop, By
return ret;
}
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_INDUSTRYTILES>::Reserve(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_INDUSTRYTILES>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_INDUSTRYTILES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return IndustrytilesChangeInfo(first, last, prop, buf); }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_INDUSTRIES>::Reserve(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_INDUSTRIES>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_INDUSTRIES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return IndustriesChangeInfo(first, last, prop, buf); }
+6 -6
View File
@@ -24,7 +24,7 @@
*/
static ChangeInfoResult IgnoreObjectProperty(uint prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
switch (prop) {
case 0x0B:
@@ -58,7 +58,7 @@ static ChangeInfoResult IgnoreObjectProperty(uint prop, ByteReader &buf)
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
@@ -75,11 +75,11 @@ static ChangeInfoResult IgnoreObjectProperty(uint prop, ByteReader &buf)
*/
static ChangeInfoResult ObjectChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
if (last > NUM_OBJECTS_PER_GRF) {
GrfMsg(1, "ObjectChangeInfo: Too many objects loaded ({}), max ({}). Ignoring.", last, NUM_OBJECTS_PER_GRF);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
/* Allocate object specs if they haven't been allocated already. */
@@ -191,7 +191,7 @@ static ChangeInfoResult ObjectChangeInfo(uint first, uint last, int prop, ByteRe
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
@@ -199,5 +199,5 @@ static ChangeInfoResult ObjectChangeInfo(uint first, uint last, int prop, ByteRe
return ret;
}
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_OBJECTS>::Reserve(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_OBJECTS>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_OBJECTS>::Activation(uint first, uint last, int prop, ByteReader &buf) { return ObjectChangeInfo(first, last, prop, buf); }
+7 -7
View File
@@ -26,19 +26,19 @@
*/
static ChangeInfoResult RailTypeChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
extern RailTypeInfo _railtypes[RAILTYPE_END];
const auto &type_map = _cur_gps.grffile->railtype_map;
if (last > std::size(type_map)) {
GrfMsg(1, "RailTypeChangeInfo: Rail type {} is invalid, max {}, ignoring", last, std::size(type_map));
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
for (uint id = first; id < last; ++id) {
RailType rt = type_map[id];
if (rt == INVALID_RAILTYPE) return CIR_INVALID_ID;
if (rt == INVALID_RAILTYPE) return ChangeInfoResult::InvalidId;
RailTypeInfo *rti = &_railtypes[rt];
@@ -151,7 +151,7 @@ static ChangeInfoResult RailTypeChangeInfo(uint first, uint last, int prop, Byte
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
@@ -161,14 +161,14 @@ static ChangeInfoResult RailTypeChangeInfo(uint first, uint last, int prop, Byte
static ChangeInfoResult RailTypeReserveInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
extern RailTypeInfo _railtypes[RAILTYPE_END];
auto &type_map = _cur_gps.grffile->railtype_map;
if (last > std::size(type_map)) {
GrfMsg(1, "RailTypeReserveInfo: Rail type {} is invalid, max {}, ignoring", last, std::size(type_map));
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
for (uint id = first; id < last; ++id) {
@@ -236,7 +236,7 @@ static ChangeInfoResult RailTypeReserveInfo(uint first, uint last, int prop, Byt
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
+6 -6
View File
@@ -25,7 +25,7 @@
*/
static ChangeInfoResult IgnoreRoadStopProperty(uint prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
switch (prop) {
case 0x09:
@@ -59,7 +59,7 @@ static ChangeInfoResult IgnoreRoadStopProperty(uint prop, ByteReader &buf)
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
@@ -68,11 +68,11 @@ static ChangeInfoResult IgnoreRoadStopProperty(uint prop, ByteReader &buf)
static ChangeInfoResult RoadStopChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
if (last > NUM_ROADSTOPS_PER_GRF) {
GrfMsg(1, "RoadStopChangeInfo: RoadStop {} is invalid, max {}, ignoring", last, NUM_ROADSTOPS_PER_GRF);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
if (_cur_gps.grffile->roadstops.size() < last) _cur_gps.grffile->roadstops.resize(last);
@@ -173,7 +173,7 @@ static ChangeInfoResult RoadStopChangeInfo(uint first, uint last, int prop, Byte
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
@@ -181,5 +181,5 @@ static ChangeInfoResult RoadStopChangeInfo(uint first, uint last, int prop, Byte
return ret;
}
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_ROADSTOPS>::Reserve(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_ROADSTOPS>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_ROADSTOPS>::Activation(uint first, uint last, int prop, ByteReader &buf) { return RoadStopChangeInfo(first, last, prop, buf); }
+8 -8
View File
@@ -27,19 +27,19 @@
*/
static ChangeInfoResult RoadTypeChangeInfo(uint first, uint last, int prop, ByteReader &buf, RoadTramType rtt)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
extern RoadTypeInfo _roadtypes[ROADTYPE_END];
const auto &type_map = (rtt == RTT_TRAM) ? _cur_gps.grffile->tramtype_map : _cur_gps.grffile->roadtype_map;
if (last > std::size(type_map)) {
GrfMsg(1, "RoadTypeChangeInfo: Road type {} is invalid, max {}, ignoring", last, std::size(type_map));
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
for (uint id = first; id < last; ++id) {
RoadType rt = type_map[id];
if (rt == INVALID_ROADTYPE) return CIR_INVALID_ID;
if (rt == INVALID_ROADTYPE) return ChangeInfoResult::InvalidId;
RoadTypeInfo *rti = &_roadtypes[rt];
@@ -138,7 +138,7 @@ static ChangeInfoResult RoadTypeChangeInfo(uint first, uint last, int prop, Byte
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
@@ -148,14 +148,14 @@ static ChangeInfoResult RoadTypeChangeInfo(uint first, uint last, int prop, Byte
static ChangeInfoResult RoadTypeReserveInfo(uint first, uint last, int prop, ByteReader &buf, RoadTramType rtt)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
extern RoadTypeInfo _roadtypes[ROADTYPE_END];
auto &type_map = (rtt == RTT_TRAM) ? _cur_gps.grffile->tramtype_map : _cur_gps.grffile->roadtype_map;
if (last > std::size(type_map)) {
GrfMsg(1, "RoadTypeReserveInfo: Road type {} is invalid, max {}, ignoring", last, std::size(type_map));
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
for (uint id = first; id < last; ++id) {
@@ -170,7 +170,7 @@ static ChangeInfoResult RoadTypeReserveInfo(uint first, uint last, int prop, Byt
rt = AllocateRoadType(rtl, rtt);
} else if (GetRoadTramType(rt) != rtt) {
GrfMsg(1, "RoadTypeReserveInfo: Road type {} is invalid type (road/tram), ignoring", id);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
type_map[id] = rt;
@@ -220,7 +220,7 @@ static ChangeInfoResult RoadTypeReserveInfo(uint first, uint last, int prop, Byt
break;
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
+3 -3
View File
@@ -29,11 +29,11 @@
*/
static ChangeInfoResult RoadVehicleChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
for (uint id = first; id < last; ++id) {
Engine *e = GetNewEngine(_cur_gps.grffile, VEH_ROAD, id);
if (e == nullptr) return CIR_INVALID_ID; // No engine could be allocated, so neither can any next vehicles
if (e == nullptr) return ChangeInfoResult::InvalidId; // No engine could be allocated, so neither can any next vehicles
EngineInfo *ei = &e->info;
RoadVehicleInfo *rvi = &e->VehInfo<RoadVehicleInfo>();
@@ -234,5 +234,5 @@ static ChangeInfoResult RoadVehicleChangeInfo(uint first, uint last, int prop, B
return ret;
}
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_ROADVEHICLES>::Reserve(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_ROADVEHICLES>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_ROADVEHICLES>::Activation(uint first, uint last, int prop, ByteReader &buf) { return RoadVehicleChangeInfo(first, last, prop, buf); }
+3 -3
View File
@@ -30,11 +30,11 @@
*/
static ChangeInfoResult ShipVehicleChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
for (uint id = first; id < last; ++id) {
Engine *e = GetNewEngine(_cur_gps.grffile, VEH_SHIP, id);
if (e == nullptr) return CIR_INVALID_ID; // No engine could be allocated, so neither can any next vehicles
if (e == nullptr) return ChangeInfoResult::InvalidId; // No engine could be allocated, so neither can any next vehicles
EngineInfo *ei = &e->info;
ShipVehicleInfo *svi = &e->VehInfo<ShipVehicleInfo>();
@@ -221,5 +221,5 @@ static ChangeInfoResult ShipVehicleChangeInfo(uint first, uint last, int prop, B
return ret;
}
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_SHIPS>::Reserve(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_SHIPS>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_SHIPS>::Activation(uint first, uint last, int prop, ByteReader &buf) { return ShipVehicleChangeInfo(first, last, prop, buf); }
+5 -5
View File
@@ -25,17 +25,17 @@
*/
static ChangeInfoResult SoundEffectChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
if (first == last) return ret;
if (_cur_gps.grffile->sound_offset == 0) {
GrfMsg(1, "SoundEffectChangeInfo: No effects defined, skipping");
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
if (last - ORIGINAL_SAMPLE_COUNT > _cur_gps.grffile->num_sounds) {
GrfMsg(1, "SoundEffectChangeInfo: Attempting to change undefined sound effect ({}), max ({}). Ignoring.", last, ORIGINAL_SAMPLE_COUNT + _cur_gps.grffile->num_sounds);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
for (uint id = first; id < last; ++id) {
@@ -65,7 +65,7 @@ static ChangeInfoResult SoundEffectChangeInfo(uint first, uint last, int prop, B
}
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
@@ -73,5 +73,5 @@ static ChangeInfoResult SoundEffectChangeInfo(uint first, uint last, int prop, B
return ret;
}
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_SOUNDFX>::Reserve(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_SOUNDFX>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_SOUNDFX>::Activation(uint first, uint last, int prop, ByteReader &buf) { return SoundEffectChangeInfo(first, last, prop, buf); }
+8 -8
View File
@@ -29,11 +29,11 @@ static const uint NUM_STATIONS_PER_GRF = UINT16_MAX - 1;
*/
static ChangeInfoResult StationChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
if (last > NUM_STATIONS_PER_GRF) {
GrfMsg(1, "StationChangeInfo: Station {} is invalid, max {}, ignoring", last, NUM_STATIONS_PER_GRF);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
/* Allocate station specs if necessary */
@@ -45,7 +45,7 @@ static ChangeInfoResult StationChangeInfo(uint first, uint last, int prop, ByteR
/* Check that the station we are modifying is defined. */
if (statspec == nullptr && prop != 0x08) {
GrfMsg(2, "StationChangeInfo: Attempt to modify undefined station {}, ignoring", id);
return CIR_INVALID_ID;
return ChangeInfoResult::InvalidId;
}
switch (prop) {
@@ -81,7 +81,7 @@ static ChangeInfoResult StationChangeInfo(uint first, uint last, int prop, ByteR
ReadSpriteLayoutSprite(buf, false, false, false, GSF_STATIONS, &dts->ground);
/* On error, bail out immediately. Temporary GRF data was already freed */
if (_cur_gps.skip_sprites < 0) return CIR_DISABLED;
if (_cur_gps.skip_sprites < 0) return ChangeInfoResult::Disabled;
std::vector<DrawTileSeqStruct> tmp_layout;
for (;;) {
@@ -99,7 +99,7 @@ static ChangeInfoResult StationChangeInfo(uint first, uint last, int prop, ByteR
ReadSpriteLayoutSprite(buf, false, true, false, GSF_STATIONS, &dtss.image);
/* On error, bail out immediately. Temporary GRF data was already freed */
if (_cur_gps.skip_sprites < 0) return CIR_DISABLED;
if (_cur_gps.skip_sprites < 0) return ChangeInfoResult::Disabled;
}
dts->seq = std::move(tmp_layout);
}
@@ -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 CIR_DISABLED;
if (ReadSpriteLayout(buf, num_building_sprites, false, GSF_STATIONS, true, false, dts)) return ChangeInfoResult::Disabled;
}
/* Number of layouts must be even, alternating X and Y */
@@ -313,7 +313,7 @@ static ChangeInfoResult StationChangeInfo(uint first, uint last, int prop, ByteR
}
default:
ret = CIR_UNKNOWN;
ret = ChangeInfoResult::Unknown;
break;
}
}
@@ -321,5 +321,5 @@ static ChangeInfoResult StationChangeInfo(uint first, uint last, int prop, ByteR
return ret;
}
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_STATIONS>::Reserve(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_STATIONS>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_STATIONS>::Activation(uint first, uint last, int prop, ByteReader &buf) { return StationChangeInfo(first, last, prop, buf); }
+3 -3
View File
@@ -28,11 +28,11 @@
*/
ChangeInfoResult RailVehicleChangeInfo(uint first, uint last, int prop, ByteReader &buf)
{
ChangeInfoResult ret = CIR_SUCCESS;
ChangeInfoResult ret = ChangeInfoResult::Success;
for (uint id = first; id < last; ++id) {
Engine *e = GetNewEngine(_cur_gps.grffile, VEH_TRAIN, id);
if (e == nullptr) return CIR_INVALID_ID; // No engine could be allocated, so neither can any next vehicles
if (e == nullptr) return ChangeInfoResult::InvalidId; // No engine could be allocated, so neither can any next vehicles
EngineInfo *ei = &e->info;
RailVehicleInfo *rvi = &e->VehInfo<RailVehicleInfo>();
@@ -353,5 +353,5 @@ ChangeInfoResult RailVehicleChangeInfo(uint first, uint last, int prop, ByteRead
return ret;
}
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_TRAINS>::Reserve(uint, uint, int, ByteReader &) { return CIR_UNHANDLED; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_TRAINS>::Reserve(uint, uint, int, ByteReader &) { return ChangeInfoResult::Unhandled; }
template <> ChangeInfoResult GrfChangeInfoHandler<GSF_TRAINS>::Activation(uint first, uint last, int prop, ByteReader &buf) { return RailVehicleChangeInfo(first, last, prop, buf); }
+1 -1
View File
@@ -104,7 +104,7 @@ static void VehicleMapSpriteGroup(ByteReader &buf, GrfSpecFeature feature, uint8
/* No engine could be allocated?!? Deal with it. Okay,
* this might look bad. Also make sure this NewGRF
* gets disabled, as a half loaded one is bad. */
HandleChangeInfoResult("VehicleMapSpriteGroup", CIR_INVALID_ID, feature, 0);
HandleChangeInfoResult("VehicleMapSpriteGroup", ChangeInfoResult::InvalidId, feature, 0);
return;
}
+6 -6
View File
@@ -17,12 +17,12 @@
#include "newgrf_bytereader.h"
/** Possible return values for the GrfChangeInfoHandler functions */
enum ChangeInfoResult : uint8_t {
CIR_SUCCESS, ///< Variable was parsed and read
CIR_DISABLED, ///< GRF was disabled due to error
CIR_UNHANDLED, ///< Variable was parsed but unread
CIR_UNKNOWN, ///< Variable is unknown
CIR_INVALID_ID, ///< Attempt to modify an invalid ID
enum class ChangeInfoResult : uint8_t {
Success, ///< Variable was parsed and read
Disabled, ///< GRF was disabled due to error
Unhandled, ///< Variable was parsed but unread
Unknown, ///< Variable is unknown
InvalidId, ///< Attempt to modify an invalid ID
};
/** GRF feature handler */