PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Crash: null m_Backdrop at lostalife state (?)

When I use

Code:

ChangeState( GAME_STATE_LOSTALIFE );


the game crashes inside LostALifeImpl.cpp:

Code:

void LostALifeImpl::Initialize()
{
ScopedPtr< IniFile > ini( GetFactory()->NewIniFile( "ini/game.ini" ) );
CIString s;
ini->GetStringValue( "lostalife", "backdrop", s );
if (s != "") m_Backdrop.Reset( GetFactory()->NewSurface( s.c_str() ) );

// CRASHES HERE (m_Backdrop is null)
m_Backdrop->CopyTo( GetApi()->GetSecondary() );

ini->GetStringValue( "lostalife", "font", s );
if (s != "") m_Font.Reset( GetFactory()->NewFont( GetFactory()->NewSurface( s.c_str() ), "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) );
ini->GetStringValue( "lostalife", "text", s );
int texty = ini->GetIntValue( "lostalife", "texty" );
if (s != "") m_Font->Centre( s.c_str(), 120, texty );
while (GetApi()->Clicked());
}


I am trying to find why it is happening. The backdrop file exists at the specified directory ("graphics/lostalife.tga"). Any ideas?

Thanks
hmm weird. The only thing I can come up with is that the location in the inifile is not correct. But as I understand you coreectly you have checked that right?

R
Yes, I checked. "s" contains "graphics/lostalife.tga" and the file is there. I even replaced the file with the original that comes with the library.

The snippet:

Code:

.
.
.
[lostalife]
backdrop = "graphics/lostalife.tga"
font = "graphics/smallfont.tga"
text = "ARRRGHHH!!!"
texty = 25
.
.
.


I compared to the CaveRunner sample, I don't see any difference.

I still can't understand the reason for the crash, but anyways, I won't use the default lostalife for the final game, so that's ok. For now it would be nice to use the default one, because I'm working on other things, but well, fine. 8)

Thanks