Hi,
Before I get blasted for asking a question about code not working when it comes right from SVN, this is just to ensure I'm not doing anything wrong.
I'm a software developer, although pretty much all .net these days I remember C / C++ etc and am interested in poking around the code and possibly working on changes in the future (work and life willing )
However, I'm having a problem and I'm not sure if it's me or the code - I'm willing to bet it's me.
When I compile the network branch of OpenTTD I can get it built fine in both Debug and Release mode however when I run it I get a pile of corrupted multi-coloured text at the bottom of the screen. Also an error about a string character in the console window behind it (if running the debug build). I've grabbed the latest a few times from the networking branch and all the times I've done it I've had this problem - before and after you guys trialled playing the multiplayer - so I'm thinking it's probably just me.
Is this a common newbie setup problem? Just looking for an answer, then the thread can be locked or deleted It's just for future reference as well.
BTW, to whoever is coding the new network layer, it's looking good, certainly a lot of code has been written from what I've seen
- JD
P.S. Running on Win2k3, VS.Net 2003 [No problems with 2k3 and the normal download, just when I compile ]
Text Corruption on build
Moderator: OpenTTD Developers
Hi traskjd,
It is actually a very easy bug to fix if you know where to look. In fact, I was just shown this today and with nowhere to look fixed it in ten minutes. Here's the lowdown. You should've started ottd with debugging on (-d 1) or higher (-d 4...etc.). In the console window you could then see that all it spams is "Unknown string command character". Now find that line of code in the source (gfx.c line 562), start going back from the stacktrace (called functions) to see where it might go wrong. It is in fact called by "DrawTextMessage" (texteff.c line 168). At that moment you can see that the culprit variable i is 10. But the maximum size of _text_message_list is MAX_CHAT_MESSAGES (which is also 10). Of course accessing the 10"th" element is an invalid out of bounds access and you get garbage. The fix is straightforward now (for (i=MAX_CHAT_MESSAGES-1...).
Well that was it . The debugger is your best friend ^^ (check out the latest rev to see this bug fixed).
Cheers.
(of course this only happened on windows, where for some (weird) reason the --i didn't get applied when the loop was entered, but afterwards. GCC did it fine. Which one is right/wrong I don't know).
It is actually a very easy bug to fix if you know where to look. In fact, I was just shown this today and with nowhere to look fixed it in ten minutes. Here's the lowdown. You should've started ottd with debugging on (-d 1) or higher (-d 4...etc.). In the console window you could then see that all it spams is "Unknown string command character". Now find that line of code in the source (gfx.c line 562), start going back from the stacktrace (called functions) to see where it might go wrong. It is in fact called by "DrawTextMessage" (texteff.c line 168). At that moment you can see that the culprit variable i is 10. But the maximum size of _text_message_list is MAX_CHAT_MESSAGES (which is also 10). Of course accessing the 10"th" element is an invalid out of bounds access and you get garbage. The fix is straightforward now (for (i=MAX_CHAT_MESSAGES-1...).
Well that was it . The debugger is your best friend ^^ (check out the latest rev to see this bug fixed).
Cheers.
(of course this only happened on windows, where for some (weird) reason the --i didn't get applied when the loop was entered, but afterwards. GCC did it fine. Which one is right/wrong I don't know).
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
Who is online
Users browsing this forum: No registered users and 48 guests