Ai Crash.

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Post Reply
Happy
Engineer
Engineer
Posts: 3
Joined: 25 Jun 2004 21:17

Ai Crash.

Post by Happy »

I was linked to OpenTTD about a week ago. Quite naturally, this has made my productivity drop into the negatives. I've been happy about this turn of events, though. Heh.

That is, until this morning. My heart sank when the game crashed and continued to crash at exactly the same time after loading. I quickly visited these forums looking for any sign of a fix. But I'm impatient and only scanned the front page and a few of the search results I got.

Anyway, I recompiled with debugging enabled and watched the process with gdb. Here's what it said:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 2787)]
0x08050414 in AiGetStationIdFromAircraftBlock (tile=2239, id=2) at ai.c:3356
3356            while (p->mode != 1) p++;
So figured it was just a pointer problem. And wrote up a quick fix. Which seems to work, but I'm not sure if having the return value from AiGetStationIdFromAircraftBlock() zero by default will cause problems with the AI. However, it has kept the game from crashing in that spot. I'm posting the "fix" here so the developers can take a look at it.

Also, if needed, I can provide the save file I've been loading from.
User avatar
dominik81
OpenTTD Developer
OpenTTD Developer
Posts: 768
Joined: 16 Aug 2003 12:55
Location: Bonn, Germany

Post by dominik81 »

Thanks for the bug report. But I'm afraid that your patch probably doesn't solve the problem behind the crash, it only avoids the crash. It would be great if you could post the savegame along with a bug report on our SourceForge bug tracker (no registration required). This way the bug will get fixed asap.
"There's a readme that comes with the source. I suggest you read it."
- Korenn
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Re: Ai Crash.

Post by Darkvater »

Happy wrote:I was linked to OpenTTD about a week ago. Quite naturally, this has made my productivity drop into the negatives. I've been happy about this turn of events, though. Heh.

That is, until this morning. My heart sank when the game crashed and continued to crash at exactly the same time after loading. I quickly visited these forums looking for any sign of a fix. But I'm impatient and only scanned the front page and a few of the search results I got.

Anyway, I recompiled with debugging enabled and watched the process with gdb. Here's what it said:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 2787)]
0x08050414 in AiGetStationIdFromAircraftBlock (tile=2239, id=2) at ai.c:3356
3356            while (p->mode != 1) p++;
Are you sure you have a recent version?

Code: Select all

AiGetStationIdFromAircraftBlock()
while (p->mode != 1) p++; <<------ 3412
is a different line of code. I remember this problem, it had to do with AI airport building stuff, and I also remember that pasky has fixed it.
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."
Happy
Engineer
Engineer
Posts: 3
Joined: 25 Jun 2004 21:17

Re: Ai Crash.

Post by Happy »

Darkvater wrote:Are you sure you have a recent version?
Just the 0.3.2.1 release.

Heh; in retrospect I guess I could've gotten the source from the svn repository and tried that. But I was in too much of a hurry to do any real thinking. I'll try it a bit later, and if the game still crashes I'll report the bug properly.
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Re: Ai Crash.

Post by Darkvater »

Happy wrote:
Darkvater wrote:Are you sure you have a recent version?
Just the 0.3.2.1 release.

Heh; in retrospect I guess I could've gotten the source from the svn repository and tried that. But I was in too much of a hurry to do any real thinking. I'll try it a bit later, and if the game still crashes I'll report the bug properly.
Yes, please only report bugs based on the SVN version, especially if you are able enough to fix them :). Saves us a lot of searching for finding a bug that doesn't exist anymore.
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."
Happy
Engineer
Engineer
Posts: 3
Joined: 25 Jun 2004 21:17

Re: Ai Crash.

Post by Happy »

I tried the svn version and the bug is still there, and I've submitted it to the bug tracking system.

I wish I could help, but I'd rather not read through 3000+ lines of code to learn what exactly AiGetStationIdFromAircraftBlock() is used for. (I'm assuming it's to get the station id, but the importance of that information is lost to me. Heh.)
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: No registered users and 15 guests