1
0
Fork 0

Change: [NewGRF] Use deferred string mapping for bridge and currency names.

This means that the strings can now be defined after the properties using them, as is the case with all other features.
pull/13230/head
Peter Nelson 2025-01-01 22:11:44 +00:00
parent 0464e6bd13
commit 83dfbba98a
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
1 changed files with 15 additions and 14 deletions

View File

@ -2327,18 +2327,17 @@ static ChangeInfoResult BridgeChangeInfo(uint brid, int numinfo, int prop, ByteR
bridge->avail_year = Clamp(TimerGameCalendar::Year(buf.ReadDWord()), CalendarTime::MIN_YEAR, CalendarTime::MAX_YEAR);
break;
case 0x10: { // purchase string
StringID newone = GetGRFStringID(_cur.grffile->grfid, buf.ReadWord());
if (newone != STR_UNDEFINED) bridge->material = newone;
case 0x10: // purchase string
AddStringForMapping(buf.ReadWord(), &bridge->material);
break;
}
case 0x11: // description of bridge with rails or roads
case 0x12: {
StringID newone = GetGRFStringID(_cur.grffile->grfid, buf.ReadWord());
if (newone != STR_UNDEFINED) bridge->transport_name[prop - 0x11] = newone;
case 0x11: // description of bridge with rails
AddStringForMapping(buf.ReadWord(), &bridge->transport_name[0]);
break;
case 0x12: // description of bridge with roads
AddStringForMapping(buf.ReadWord(), &bridge->transport_name[1]);
break;
}
case 0x13: // 16 bits cost multiplier
bridge->price = buf.ReadWord();
@ -2790,11 +2789,13 @@ static ChangeInfoResult GlobalVarChangeInfo(uint gvid, int numinfo, int prop, By
case 0x0A: { // Currency display names
uint curidx = GetNewgrfCurrencyIdConverted(gvid + i);
StringID newone = GetGRFStringID(_cur.grffile->grfid, buf.ReadWord());
if ((newone != STR_UNDEFINED) && (curidx < CURRENCY_END)) {
_currency_specs[curidx].name = newone;
if (curidx < CURRENCY_END) {
AddStringForMapping(buf.ReadWord(), [curidx](StringID str) {
_currency_specs[curidx].name = str;
_currency_specs[curidx].code.clear();
});
} else {
buf.ReadWord();
}
break;
}