PDA

View Full Version : Debug and release compile differences



terrifish
07-20-2013, 11:37 PM
Hey,

Working on the Memory game (hop: http://www.rtsoft.com/forums/showthread.php?22445-Memory-Birthday-Game ) I have faced a weird problem. When compiling in Debug mode everything works fine, while when in Release mode random bricks in the game don't show up. Why could that happen?

Some probably useless code:

Rendering bricks:


for(int i=0;i<36;++i) {
if(pool[i].active || game_finished) {
pool[i].get_current_image().draw(gc,pool[i].get_x(),pool[i].get_y());
}
}


Initiating bricks:


CL_ResourceManager image_resources("image_resources.xml");
Brick::hidden_image = CL_Sprite(gc, "hidden", &image_resources);
for(int i=0;i<36;++i) {
pool[i].init(CL_Sprite(gc, CL_StringHelp::int_to_text(pool[i].index%18 + 1),&image_resources));
pool[i].set_current_image(Brick::hidden_image);
}


Thx in advance,
terrifish :cool:

rombust
07-24-2013, 09:58 PM
Sorry for the delay for approving your post. For some reason, your post was tagged as "moderated"

Anyway, errors like that are usually caused by an uninitialised variable somewhere in the code.

Maybe "active" is not set/cleared on initialisation

terrifish
07-24-2013, 10:13 PM
Maybe "active" is not set/cleared on initialisation

Good guess :) (haha, I often say: C++ is not as "idiot resistant" as some other programming languages. worked out :D )

Thanks, I'm gonna try to avoid this working on the next project (coming (not so) soon) :)