Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow referencing DCxx texts via textstack #4758

Closed
DorpsGek opened this issue Sep 3, 2011 · 7 comments
Closed

Allow referencing DCxx texts via textstack #4758

DorpsGek opened this issue Sep 3, 2011 · 7 comments
Labels
component: NewGRF This issue is related to NewGRFs flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Sep 3, 2011

George opened the ticket and wrote:

R22804

when a GRF returns a DCxx string in reference stack for error message for CB 28/2F, OTTD crashes

Steps to reproduce:
Start a new game, give yourself some money and try to build vehicles factory on the sloped land. Game crashes.

The change I did to the factory is changing the String to return
D0xx string, returned as D4xx works fine
48xx string works well without a change
00e7 string does not work both as 00E7 and 04E7 (the name is not displayed)

P.S. In some old version of OTTD (before 10000 AFAIR) DCxx strings were working. I just did not use them because of TTDP

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/4758
@DorpsGek
Copy link
Member Author

DorpsGek commented Sep 3, 2011

michi_cc wrote:

Quoting the NewGRF specs (which apply to OpenTTD as well): "[...] but DCxx textIDs won't work correctly. When you need to choose from your own texts dynamically, you must use D0xx IDs, and add 400h to them [...]"

OpenTTD still shouldn't crash though but handle the error gracefully.


This comment was imported from FlySpray: https://bugs.openttd.org/task/4758#comment10297

@DorpsGek
Copy link
Member Author

DorpsGek commented Sep 3, 2011

planetmaker wrote:

backtrace:

Reason: KERN_INVALID_ADDRESS at address: 0x61616368
Utf8Decode (c=0xbfffae90, s=0x61616368 <Address 0x61616368 out of bounds>) at /Users/ingo/ottd/trunk/src/string.cpp:459
459 if (!HasBit(s[0], 7)) {
(gdb) bt
# 0 Utf8Decode (c=0xbfffae90, s=0x61616368 <Address 0x61616368 out of bounds>) at /Users/ingo/ottd/trunk/src/string.cpp:459
# 1 0x00335cde in Utf8Consume [inlined] () at /Users/ingo/ottd/trunk/src/string_func.h:696
# 2 0x00335cde in FormatString (buff=0xbfffb2cf "Can't construct this industry type here...", str_arg=0x19e57b39 " requires flat land", args=0x531420, casei=0, last=0xbfffbacb "", dry_run=true) at /Users/ingo/ottd/trunk/src/strings.cpp:696
# 3 0x00336048 in FormatString (buff=0xbfffb2cc "Can't construct this industry type here...", str_arg=0x19e57b39 " requires flat land", args=0x531420, casei=0, last=0xbfffbacb "", dry_run=false) at /Users/ingo/ottd/trunk/src/strings.cpp:681
# 4 0x0033c7c5 in GetStringWithArgs (buffr=0xbfffb2cc "Can't construct this industry type here...", string=57356, args=0x531420, last=0xbfffbacb "") at /Users/ingo/ottd/trunk/src/strings.cpp:188
# 5 0x0033ce7b in OTTD_GetString (buffr=0xbfffae90 "M?", string=57356, last=0xbfffae90 "M?") at /Users/ingo/ottd/trunk/src/strings.cpp:195
# 6 0x0019c52f in GetStringHeight (str=57356, maxw=-1073762672) at /Users/ingo/ottd/trunk/src/gfx.cpp:806
# 7 0x001d9272 in ErrmsgWindow::UpdateWidgetSize (this=0x19b9fcb0, widget=2, size=0xbfffbb70, padding=@0x4183e8, fill=0xbfffbb68, resize=0xbfffbb60) at /Users/ingo/ottd/trunk/src/misc_gui.cpp:610
# 8 0x003a76c5 in NWidgetLeaf::SetupSmallestSize (this=0x19ba0050, w=0x19b9fcb0, init_array=true) at /Users/ingo/ottd/trunk/src/widget.cpp:2198
# 9 0x003a8283 in NWidgetVertical::SetupSmallestSize (this=0x19ba00b0, w=0x19b9fcb0, init_array=true) at /Users/ingo/ottd/trunk/src/widget.cpp:1208
# 10 0x003aaaa4 in NWidgetBackground::SetupSmallestSize (this=0x19b9ff80, w=0x19b9fcb0, init_array=true) at /Users/ingo/ottd/trunk/src/widget.cpp:1647
# 11 0x003a8283 in NWidgetVertical::SetupSmallestSize (this=0x19b9ff30, w=0x19b9fcb0, init_array=true) at /Users/ingo/ottd/trunk/src/widget.cpp:1208
# 12 0x003b3283 in Window::InitializeData (this=0x19b9fcb0, desc=0x549860, window_number=-1073762672) at /Users/ingo/ottd/trunk/src/window.cpp:939
# 13 0x003b3334 in Window::FinishInitNested (this=0x19b9fcb0, desc=0x549860, window_number=0) at /Users/ingo/ottd/trunk/src/window.cpp:1320
# 14 0x001d8021 in ShowErrorMessage (summary_msg=2839, detailed_msg=57356, wl=WL_INFO, x=1312, y=3744, textref_stack_size=4, textref_stack=0x51b500) at /Users/ingo/ottd/trunk/src/misc_gui.cpp:598
# 15 0x0015b457 in DoCommandP (tile=59986, p1=10, p2=2724134600, cmd=186056746, callback=0, text=0x0, my_cmd=true) at /Users/ingo/ottd/trunk/src/command.cpp:533
# 16 0x001becdd in BuildIndustryWindow::OnPlaceObject (this=0x1a2f7e30, pt={x = 1312, y = 3746}, tile=59986) at /Users/ingo/ottd/trunk/src/industry_gui.cpp:559
# 17 0x00397735 in HandleViewportClicked (vp=0x19b1b5e0, x=639, y=346) at /Users/ingo/ottd/trunk/src/viewport.cpp:1898
# 18 0x003b46fa in HandleMouseEvents () at /Users/ingo/ottd/trunk/src/window.cpp:2226
# 19 0x003b8bdc in QZ_GameLoop () at /Users/ingo/ottd/trunk/src/video/cocoa/event.mm:423
# 20 0x003b6562 in -[OTTDMain applicationDidFinishLaunching:] (self=0x2a00ea0, _cmd=0x927dd8ab, note=0x1da9aa0) at /Users/ingo/ottd/trunk/src/video/cocoa/cocoa_v.mm:71
# 21 0x94feaefc in _nsnote_callback ()
# 22 0x967c2793 in __CFXNotificationPost ()
# 23 0x967c219a in _CFXNotificationPostNotification ()
# 24 0x94fdfcf0 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
# 25 0x94fed0fd in -[NSNotificationCenter postNotificationName:object:] ()
# 26 0x90493216 in -[NSApplication _postDidFinishNotification] ()
# 27 0x90493126 in -[NSApplication _sendFinishLaunchingNotification] ()
# 28 0x905ea339 in -[NSApplication(NSAppleEventHandling) _handleAEOpen:] ()
# 29 0x905e9f59 in -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] ()
# 30 0x95020298 in -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] ()
# 31 0x9502005c in _NSAppleEventManagerGenericHandler ()
# 32 0x94782f5c in aeDispatchAppleEvent ()
# 33 0x94782e5b in dispatchEventAndSendReply ()
# 34 0x94782d65 in aeProcessAppleEvent ()
# 35 0x916ec197 in AEProcessAppleEvent ()
# 36 0x904637d2 in _DPSNextEvent ()
# 37 0x90462dd6 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
# 38 0x904251f3 in -[NSApplication run] ()
# 39 0x003b6767 in VideoDriver_Cocoa::MainLoop (this=0x1e41180) at /Users/ingo/ottd/trunk/src/video/cocoa/cocoa_v.mm:373
# 40 0x0025a806 in ttd_main (argc=1, argv=0xbffff8a4) at /Users/ingo/ottd/trunk/src/openttd.cpp:721
# 41 0x00269f34 in main (argc=1, argv=0xbffff8a4) at /Users/ingo/ottd/trunk/src/os/unix/unix.cpp:266


This comment was imported from FlySpray: https://bugs.openttd.org/task/4758#comment10298

@DorpsGek
Copy link
Member Author

DorpsGek commented Sep 3, 2011

George wrote:

http://newgrf-specs.tt-wiki.net/wiki/Action0/Industries# Industry_name_.281F.29:
Industry name (1F)
This is the text ID that will be attached to the town name when TTD texts refer to the industry.

Why the name should be DCxx, but CB 2F\28 requires D0xx string? How to use the same string in industry name and industry error?


This comment was imported from FlySpray: https://bugs.openttd.org/task/4758#comment10299

@DorpsGek
Copy link
Member Author

DorpsGek commented Sep 3, 2011

George wrote:

looks like industry name works when it is d0xx string


This comment was imported from FlySpray: https://bugs.openttd.org/task/4758#comment10301

@DorpsGek
Copy link
Member Author

DorpsGek commented Sep 3, 2011

frosch wrote:

The crash has been fixed in r22882.

Support for using such strings might actually be added in OTTD.


This comment was imported from FlySpray: https://bugs.openttd.org/task/4758#comment10306

@DorpsGek
Copy link
Member Author

andythenorth wrote:

The current status of this is pretty unclear w.r.t what works and what doesn't :P . Might be best to close it and hope it never resurfaces.


This comment was imported from FlySpray: https://bugs.openttd.org/task/4758#comment14688

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) component: NewGRF This issue is related to NewGRFs enhancement labels Apr 7, 2018
@TrueBrain
Copy link
Member

Closing ticket; debugging a 7 year old bug is sadly enough a bit silly. Sorry it never got resolved :( Please open a new ticket if this issue is reproducible on latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: NewGRF This issue is related to NewGRFs flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

2 participants