Ran(again) into trouble while trying to code scenario parser. Basicly utilising function made earlier I try to read second line and put it into first array(and in this case only array) which is declared as char **returnText and initialised like this:
returnText=new char*[numberOfEntries];
for (int i=0; i<numberOfEntries;i++) {
returnText[i]=new char[256];
}
So far so good. In reading first file it worked like charm(easy to prove as without it working I couldn't turn the ship!) but here something weird happens.
sprintf(scenarioFile, "scenario%d.dat", scenarioNumber);
parsedText=parseLine(scenarioFile, 1,1);
dbMakeObjectSphere ( BACKGROUND, -2000 );
dbPositionObject (BACKGROUND,0,0,0 );
I have debugged problem to be around here. sprintf works, I get the scenarioFile to be what I wish. parseLine function returns and I can see in debugger parsedText[0] contains the ss2.jpg text I'm looking for. Stays there for dbMakeObjectSphere but when I then press F10 in debugger the ss2.jpg dissapears! So later here:
dbLoadImage(parsedText[0], 2);
dbTextureObject(BACKGROUND,2);
I'm trying to load "" filename which obviously results in very white background.
What could cause that dissapearing variable? If it didn't work so nicely with the other use I would suspect problem at parseLine function but here I'm out of ideas.