Assertion in GetRawSprite in r11440 and later

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Post Reply
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Assertion in GetRawSprite in r11440 and later

Post by cirdan »

A few days ago I downloaded a nightly version of OpenTTD (I hadn't done this in a couple of weeks) and I came across an assertion failure during the game startup. The exact error message is:

Code: Select all

openttd: /tmp/OTTD-source-nightly-r11440/src/spritecache.cpp:476:
const void* GetRawSprite(SpriteID, bool): Assertion `sprite < _spritecache_items' failed.
It triggers as soon as the program window is mapped, while it is still blank. I debugged the program and found that, indeed, DrawFoundation was asking for sprite 5376, while _spritecache_items is only 5120.

I was surprised to see this, but, hey, nightlies are unsupported. So I thought it was a transient problem, and decided to wait for the next nightly. The next nightly didn't compile either, though, so I started to look into the problem. By simple bisection, I narrowed the problem to somewhere between nightlies r11430 and r11440, and further into the gap between r11431 and r11433. (Why isn't there an r11432 version?) It makes sense, as the changeset for r11433 touches lots of graphics-related things.

However, what puzzles me the most is that, r11440 being two weeks old, I haven't seen any similar report. Am I the only one having this problem? Am I missing something obvious? Any help would be appreciated, as I have absolutely no clue of what's going on. I'm pretty sure that I haven't changed anything in the compilation parameters because the configure-make-install process is scripted. I'm running linux-2.6.22 + glibc-2.7, and my compiler is gcc-4.2.2.

Also, I don't know if this is worth reporting on flyspray, particularly if I'm the only one struck by this...
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: Assertion in GetRawSprite in r11440 and later

Post by Rubidium »

That sounds like the NewGRF with graphics is not loaded; we changed that as it both reduced the number of files and it made DOS grahpics look nice again.

Are you using a SVN checkout, or did you just download the nightly source files and started from there? If it is the latter you should checkout the SVN repository as that supports the version checking that is needed for loading the NewGRF.

The nightly sourcefiles from the tar file will start 'supporting' them out-of-the-box when 0.6.0 is going to be released. You can work around this 'problem' by forcing the openttd revision in the configure command.
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: Assertion in GetRawSprite in r11440 and later

Post by cirdan »

Thank you very much, both for you quick reply and for the accurate information.:D Yes, it was a problem with version detection. I always download the nightly source files (I don't have SVN installed, as I've never needed it), and 'configure' has always complained about version detection, but it never had any consequences until now. Passing '--revision=rXXXXX' to configure has solved the problem.
Rubidium wrote:That sounds like the NewGRF with graphics is not loaded; we changed that as it both reduced the number of files and it made DOS grahpics look nice again.
I noted the change in the data files. However, when I debugged the assertion with gdb, the list of open file descriptors included openttdd.grf, so I assumed everything was going fine. (By the way, I've never noticed anything wrong with DOS graphics...)

Anyway, thank you again for your help.
MarkyParky
Engineer
Engineer
Posts: 89
Joined: 20 Nov 2003 15:20

Re: Assertion in GetRawSprite in r11440 and later

Post by MarkyParky »

I am having the same problem. I am a bit newbie user to Visual Studio Express, can anyone give me some hint how to pass the revision at Visual Studio?
User avatar
glx
OpenTTD Developer
OpenTTD Developer
Posts: 623
Joined: 02 Dec 2005 15:43
Location: Drancy(93) - France
Contact:

Re: Assertion in GetRawSprite in r11440 and later

Post by glx »

Set it in rev.cpp.in (can't remember which line you need to modify)
MarkyParky
Engineer
Engineer
Posts: 89
Joined: 20 Nov 2003 15:20

Re: Assertion in GetRawSprite in r11440 and later

Post by MarkyParky »

So finaly solved. Problem was probably that script filling rev.cpp on Windows Vista is not able to detect Tortoise SVN (probably OS doesnt allow it to look into registry) so fills in zeroes instead of actual revision. If you need to fill in revision by hand for any similar reason, following might help:

Look at rev.cpp.in. There are two trings @@REVISION@@ and @@VERSION@@. Than open rev.cpp. Find a place where those strings are replaced with some other (usualy @@VERSION@@ is replaced with norev0000 and @@REVISION@@ os replaced with 0). Replace those strings with apropriate corect version in following format (in following example XXXXX stays for revision number):

@@VERSION@@ replace with rXXXXX or rXXXXXN where. This will ensure multiplayer compatibility if you compile OTTD yourself.
@@REVISION@@ replace with XXXXX. This will ensure that basic grfs are loaded and error mentioned in this thread disapeares.
LordAzamath
Tycoon
Tycoon
Posts: 1656
Joined: 08 Jun 2007 08:00

Re: Assertion in GetRawSprite in r11440 and later

Post by LordAzamath »

You sure this has been solved?
I wanted to compile one patch yesterday(?) and I svn'd it in linux..And I got that error too...I managed to compile though when the address bar didn't inlcude special characters
Töölaud means Desktop in estonian... So I tried to do it in other place and it succeeded..
PS: And I stopped the propaganda to support Dave Worley since he got a nice new red hat now.[/color]
I know I have a BBCode error in my signature but I really cba to fix it.
MarkyParky
Engineer
Engineer
Posts: 89
Joined: 20 Nov 2003 15:20

Re: Assertion in GetRawSprite in r11440 and later

Post by MarkyParky »

I would say, that diferent people on different systems are facing this error for different reasons. Main reason is clear - GRF doesn't load, as compiled ottd apears to be revision 0 and that is lower than base GRFs require. On diferent systems, there is a diferent way to pass the revision to exefile ( VB script, configure script, etc.. ) and there might be several reasons why it fails. My solution works for Windows Vista and Visual Studio Express, but should probably work even on other systems, as it is not based on any script that might fail due different paths/configurations/rights.
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: No registered users and 5 guests