From a277cb2b4ceb8d0b9068c1cdb80d9f2d92eff9be Mon Sep 17 00:00:00 2001 From: frosch Date: Tue, 6 May 2025 17:31:51 +0200 Subject: [PATCH] Change: [NewGRF] Increase the textstack for all callbacks to 16 registers. --- src/build_vehicle_gui.cpp | 2 +- src/industry_gui.cpp | 6 +++--- src/newgrf_industries.cpp | 2 +- src/newgrf_industrytiles.cpp | 2 +- src/newgrf_station.cpp | 2 +- src/object_cmd.cpp | 2 +- src/object_gui.cpp | 2 +- src/strings.cpp | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 470f6d7632..2a6abcbfa6 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -796,7 +796,7 @@ static int DrawAircraftPurchaseInfo(int left, int right, int y, EngineID engine_ */ static std::optional GetNewGRFAdditionalText(EngineID engine) { - std::array regs100; + std::array regs100; uint16_t callback = GetVehicleCallback(CBID_VEHICLE_ADDITIONAL_TEXT, 0, 0, engine, nullptr, regs100); if (callback == CALLBACK_FAILED || callback == 0x400) return std::nullopt; const GRFFile *grffile = Engine::Get(engine)->GetGRF(); diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 5b89a22f6d..dad6ad9177 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -101,7 +101,7 @@ static void GetCargoSuffix(uint cargo, CargoSuffixType cst, const Industry *ind, if (indspec->callback_mask.Test(IndustryCallbackMask::CargoSuffix)) { TileIndex t = (cst != CST_FUND) ? ind->location.tile : INVALID_TILE; - std::array regs100; + std::array regs100; uint16_t callback = GetIndustryCallback(CBID_INDUSTRY_CARGO_SUFFIX, 0, (cst << 8) | cargo, const_cast(ind), ind_type, t, regs100); if (callback == CALLBACK_FAILED) return; @@ -603,7 +603,7 @@ public: /* Get the additional purchase info text, if it has not already been queried. */ if (indsp->callback_mask.Test(IndustryCallbackMask::FundMoreText)) { - std::array regs100; + std::array regs100; uint16_t callback_res = GetIndustryCallback(CBID_INDUSTRY_FUND_MORE_TEXT, 0, 0, nullptr, this->selected_type, INVALID_TILE, regs100); if (callback_res != CALLBACK_FAILED && callback_res != 0x400) { std::string str; @@ -989,7 +989,7 @@ public: /* Get the extra message for the GUI */ if (ind->callback_mask.Test(IndustryCallbackMask::WindowMoreText)) { - std::array regs100; + std::array regs100; uint16_t callback_res = GetIndustryCallback(CBID_INDUSTRY_WINDOW_MORE_TEXT, 0, 0, i, i->type, i->location.tile, regs100); if (callback_res != CALLBACK_FAILED && callback_res != 0x400) { std::string str; diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index 31ad22f578..4f532ff1b2 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -560,7 +560,7 @@ CommandCost CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, siz ind.psa = nullptr; IndustriesResolverObject object(tile, &ind, type, seed, CBID_INDUSTRY_LOCATION, 0, creation_type); - std::array regs100; + std::array regs100; uint16_t result = object.ResolveCallback(regs100); /* Unlike the "normal" cases, not having a valid result means we allow diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp index 01c44f9865..1c73b14b62 100644 --- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -239,7 +239,7 @@ CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind ind.random = initial_random_bits; ind.founder = founder; - std::array regs100; + std::array regs100; uint16_t callback_res = GetIndustryTileCallback(CBID_INDTILE_SHAPE_CHECK, 0, creation_type << 8 | static_cast(layout_index), gfx, &ind, ind_tile, regs100); if (callback_res == CALLBACK_FAILED) { if (!IsSlopeRefused(GetTileSlope(ind_tile), its->slopes_refused)) return CommandCost(); diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index ba8ed37792..1505220baf 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -687,7 +687,7 @@ CommandCost PerformStationTileSlopeCheck(TileIndex north_tile, TileIndex cur_til (numtracks << 24) | (plat_len << 16) | (axis == AXIS_Y ? TileX(diff) << 8 | TileY(diff) : TileY(diff) << 8 | TileX(diff))); object.station_scope.axis = axis; - std::array regs100; + std::array regs100; uint16_t cb_res = object.ResolveCallback(regs100); /* Failed callback means success. */ diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index 7280b3ddf7..20c89fa6d6 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -276,7 +276,7 @@ CommandCost CmdBuildObject(DoCommandFlags flags, TileIndex tile, ObjectType type for (TileIndex t : ta) { uint16_t callback = CALLBACK_FAILED; - std::array regs100; + std::array regs100; if (spec->callback_mask.Test(ObjectCallbackMask::SlopeCheck)) { TileIndex diff = t - tile; callback = GetObjectCallback(CBID_OBJECT_LAND_SLOPE_CHECK, GetTileSlope(t), TileY(diff) << 4 | TileX(diff), spec, nullptr, t, regs100, view); diff --git a/src/object_gui.cpp b/src/object_gui.cpp index ed5701d4f0..502d8891e6 100644 --- a/src/object_gui.cpp +++ b/src/object_gui.cpp @@ -237,7 +237,7 @@ public: /* Get the extra message for the GUI */ if (spec->callback_mask.Test(ObjectCallbackMask::FundMoreText)) { - std::array regs100; + std::array regs100; uint16_t callback_res = GetObjectCallback(CBID_OBJECT_FUND_MORE_TEXT, 0, 0, spec, nullptr, INVALID_TILE, regs100, _object_gui.sel_view); if (callback_res != CALLBACK_FAILED && callback_res != 0x400) { std::string str; diff --git a/src/strings.cpp b/src/strings.cpp index c6b3d2e923..f6df675b28 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -1610,7 +1610,7 @@ static void FormatString(StringBuilder &builder, std::string_view str_arg, Strin } if (e->info.callback_mask.Test(VehicleCallbackMask::Name)) { - std::array regs100; + std::array regs100; uint16_t callback = GetVehicleCallback(CBID_VEHICLE_NAME, static_cast(arg >> 32), 0, e->index, nullptr, regs100); /* Not calling ErrorUnknownCallbackResult due to being inside string processing. */ if (callback == 0x40F) {