You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tested on 20190723-master-g2e686ad5d5, but bug exists since many versions ago.
Expected result
Game Script can completely clear custom text of a town, allowing town windows to shrink back to the original size (without the custom text).
dbg: [script] [18] [I] GSTown.SetText with a test string: true
dbg: [script] [18] [I] GSTown.SetText with NULL: true
dbg: [script] [18] [I] GSTown.SetText with a test string: true
dbg: [script] [18] [I] GSTown.SetText with empty raw string: true
dbg: [script] [18] [I] GSTown.SetText with a test string: true
dbg: [script] [18] [I] GSTown.SetText with empty GSText string: true
Actual result
Game Script is unable to completely clear custom text of a town after setting it. Attempting to clear the custom town text via passing NULL and an empty string both fail (as indicated by the output). Clearing the custom text with an empty GSText string works, but leaves an empty line at the bottom of the town window that may be undesirable for some. Clearing the custom town name via NULL succeeds and resets the town's name to the default.
dbg: [script] [18] [I] GSTown.SetText with a test string: true
dbg: [script] [18] [I] GSTown.SetText with NULL: false
dbg: [script] [18] [I] GSTown.SetText with a test string: true
dbg: [script] [18] [I] GSTown.SetText with empty raw string: false
dbg: [script] [18] [I] GSTown.SetText with a test string: true
dbg: [script] [18] [I] GSTown.SetText with empty GSText string: true
Steps to reproduce
Put the following code in a Game Script and run it (ignore the [headings]).
[main.nut]
GSLog.Info("GSTown.SetText with a test string: "+GSTown.SetText(0, "test"));
GSLog.Info("GSTown.SetText with NULL: "+GSTown.SetText(0, null));
GSLog.Info("GSTown.SetText with a test string: "+GSTown.SetText(0, "test"));
GSLog.Info("GSTown.SetText with empty raw string: "+GSTown.SetText(0, ""));
GSLog.Info("GSTown.SetText with a test string: "+GSTown.SetText(0, "test"));
GSLog.Info("GSTown.SetText with empty GSText string: "+GSTown.SetText(0, GSText(GSText.STR_NONE)));
[lang\english.txt]
STR_NONE:
The text was updated successfully, but these errors were encountered:
Same happens for other XXX.SetName() where the text is in theory resettable by using empty strings. I think adding GSTown.ResetText(townid) would be a better option.
glx22
added a commit
to glx22/OpenTTD
that referenced
this issue
Nov 14, 2019
Version of OpenTTD
Tested on 20190723-master-g2e686ad5d5, but bug exists since many versions ago.
Expected result
Game Script can completely clear custom text of a town, allowing town windows to shrink back to the original size (without the custom text).
Actual result
Game Script is unable to completely clear custom text of a town after setting it. Attempting to clear the custom town text via passing
NULL
and an empty string both fail (as indicated by the output). Clearing the custom text with an empty GSText string works, but leaves an empty line at the bottom of the town window that may be undesirable for some. Clearing the custom town name viaNULL
succeeds and resets the town's name to the default.Steps to reproduce
Put the following code in a Game Script and run it (ignore the
[headings]
).The text was updated successfully, but these errors were encountered: