Codechange: NewGRF strings are not StringIDs.

Add GRFStringID type and use it when dealing with GRF-local string IDs.
This commit is contained in:
2025-01-01 18:18:29 +00:00
committed by Peter Nelson
parent a59cd8b2c0
commit 2d372fa516
17 changed files with 96 additions and 91 deletions

View File

@@ -104,7 +104,7 @@ static void GetCargoSuffix(uint cargo, CargoSuffixType cst, const Industry *ind,
if (GB(callback, 0, 8) == 0xFF) return;
if (callback < 0x400) {
StartTextRefStackUsage(indspec->grf_prop.grffile, 6);
suffix.text = GetString(GetGRFStringID(indspec->grf_prop.grfid, 0xD000 + callback));
suffix.text = GetString(GetGRFStringID(indspec->grf_prop.grfid, GRFSTR_MISC_GRF_TEXT + callback));
StopTextRefStackUsage();
suffix.display = CSD_CARGO_AMOUNT_TEXT;
return;
@@ -120,14 +120,14 @@ static void GetCargoSuffix(uint cargo, CargoSuffixType cst, const Industry *ind,
}
if (callback < 0x400) {
StartTextRefStackUsage(indspec->grf_prop.grffile, 6);
suffix.text = GetString(GetGRFStringID(indspec->grf_prop.grfid, 0xD000 + callback));
suffix.text = GetString(GetGRFStringID(indspec->grf_prop.grfid, GRFSTR_MISC_GRF_TEXT + callback));
StopTextRefStackUsage();
suffix.display = CSD_CARGO_AMOUNT_TEXT;
return;
}
if (callback >= 0x800 && callback < 0xC00) {
StartTextRefStackUsage(indspec->grf_prop.grffile, 6);
suffix.text = GetString(GetGRFStringID(indspec->grf_prop.grfid, 0xD000 - 0x800 + callback));
suffix.text = GetString(GetGRFStringID(indspec->grf_prop.grfid, GRFSTR_MISC_GRF_TEXT + callback));
StopTextRefStackUsage();
suffix.display = CSD_CARGO_TEXT;
return;
@@ -590,7 +590,7 @@ public:
if (callback_res > 0x400) {
ErrorUnknownCallbackResult(indsp->grf_prop.grfid, CBID_INDUSTRY_FUND_MORE_TEXT, callback_res);
} else {
StringID str = GetGRFStringID(indsp->grf_prop.grfid, 0xD000 + callback_res); // No. here's the new string
StringID str = GetGRFStringID(indsp->grf_prop.grfid, GRFSTR_MISC_GRF_TEXT + callback_res); // No. here's the new string
if (str != STR_UNDEFINED) {
StartTextRefStackUsage(indsp->grf_prop.grffile, 6);
DrawStringMultiLine(ir, str, TC_YELLOW);
@@ -983,7 +983,7 @@ public:
if (callback_res > 0x400) {
ErrorUnknownCallbackResult(ind->grf_prop.grfid, CBID_INDUSTRY_WINDOW_MORE_TEXT, callback_res);
} else {
StringID message = GetGRFStringID(ind->grf_prop.grfid, 0xD000 + callback_res);
StringID message = GetGRFStringID(ind->grf_prop.grfid, GRFSTR_MISC_GRF_TEXT + callback_res);
if (message != STR_NULL && message != STR_UNDEFINED) {
ir.top += WidgetDimensions::scaled.vsep_wide;