mirror of https://github.com/OpenTTD/OpenTTD
Change: [NewGRF] Increase the textstack for all callbacks to 16 registers.
parent
c6fa5022cb
commit
a277cb2b4c
|
@ -796,7 +796,7 @@ static int DrawAircraftPurchaseInfo(int left, int right, int y, EngineID engine_
|
|||
*/
|
||||
static std::optional<std::string> GetNewGRFAdditionalText(EngineID engine)
|
||||
{
|
||||
std::array<int32_t, 6> regs100;
|
||||
std::array<int32_t, 16> 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();
|
||||
|
|
|
@ -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<int32_t, 6> regs100;
|
||||
std::array<int32_t, 16> regs100;
|
||||
uint16_t callback = GetIndustryCallback(CBID_INDUSTRY_CARGO_SUFFIX, 0, (cst << 8) | cargo, const_cast<Industry *>(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<int32_t, 6> regs100;
|
||||
std::array<int32_t, 16> 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<int32_t, 6> regs100;
|
||||
std::array<int32_t, 16> 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;
|
||||
|
|
|
@ -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<int32_t, 4> regs100;
|
||||
std::array<int32_t, 16> regs100;
|
||||
uint16_t result = object.ResolveCallback(regs100);
|
||||
|
||||
/* Unlike the "normal" cases, not having a valid result means we allow
|
||||
|
|
|
@ -239,7 +239,7 @@ CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind
|
|||
ind.random = initial_random_bits;
|
||||
ind.founder = founder;
|
||||
|
||||
std::array<int32_t, 4> regs100;
|
||||
std::array<int32_t, 16> regs100;
|
||||
uint16_t callback_res = GetIndustryTileCallback(CBID_INDTILE_SHAPE_CHECK, 0, creation_type << 8 | static_cast<uint32_t>(layout_index), gfx, &ind, ind_tile, regs100);
|
||||
if (callback_res == CALLBACK_FAILED) {
|
||||
if (!IsSlopeRefused(GetTileSlope(ind_tile), its->slopes_refused)) return CommandCost();
|
||||
|
|
|
@ -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<int32_t, 4> regs100;
|
||||
std::array<int32_t, 16> regs100;
|
||||
uint16_t cb_res = object.ResolveCallback(regs100);
|
||||
|
||||
/* Failed callback means success. */
|
||||
|
|
|
@ -276,7 +276,7 @@ CommandCost CmdBuildObject(DoCommandFlags flags, TileIndex tile, ObjectType type
|
|||
|
||||
for (TileIndex t : ta) {
|
||||
uint16_t callback = CALLBACK_FAILED;
|
||||
std::array<int32_t, 4> regs100;
|
||||
std::array<int32_t, 16> 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);
|
||||
|
|
|
@ -237,7 +237,7 @@ public:
|
|||
|
||||
/* Get the extra message for the GUI */
|
||||
if (spec->callback_mask.Test(ObjectCallbackMask::FundMoreText)) {
|
||||
std::array<int32_t, 6> regs100;
|
||||
std::array<int32_t, 16> 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;
|
||||
|
|
|
@ -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<int32_t, 6> regs100;
|
||||
std::array<int32_t, 16> regs100;
|
||||
uint16_t callback = GetVehicleCallback(CBID_VEHICLE_NAME, static_cast<uint32_t>(arg >> 32), 0, e->index, nullptr, regs100);
|
||||
/* Not calling ErrorUnknownCallbackResult due to being inside string processing. */
|
||||
if (callback == 0x40F) {
|
||||
|
|
Loading…
Reference in New Issue