1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 08:52:40 +01:00

Add: [NewGRF] All callbacks returning D0xx strings, have now the option to return any string id via register 0x100.

This commit is contained in:
frosch
2025-05-06 17:28:51 +02:00
committed by frosch
parent 84bc78fd8f
commit c6fa5022cb
11 changed files with 114 additions and 54 deletions

View File

@@ -1041,7 +1041,8 @@ static CommandCost CheckTrainAttachment(Train *t)
* the loop and after each callback does not need to be cleared here. */
t->InvalidateNewGRFCache();
uint16_t callback = GetVehicleCallbackParent(CBID_TRAIN_ALLOW_WAGON_ATTACH, 0, 0, head->engine_type, t, head);
std::array<int32_t, 1> regs100;
uint16_t callback = GetVehicleCallbackParent(CBID_TRAIN_ALLOW_WAGON_ATTACH, 0, 0, head->engine_type, t, head, regs100);
/* Restore original first_engine data */
t->gcache.first_engine = first_engine;
@@ -1067,6 +1068,10 @@ static CommandCost CheckTrainAttachment(Train *t)
case 0x401: // allow
break;
case 0x40F:
error = GetGRFStringID(head->GetGRFID(), static_cast<GRFStringID>(regs100[0]));
break;
default: // unknown reason -> disallow
case 0x402: // disallow attaching
error = STR_ERROR_INCOMPATIBLE_RAIL_TYPES;