[solved] Crash in Release but not while Debugging

[solved] Crash in Release but not while Debugging

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
pin_
Posts: 49
Joined: 22 Jul 2006, 16:12

[solved] Crash in Release but not while Debugging

Post by pin_ »

I added random damage infliction at the start of the DoDamage function in the Unit class. Now the game crashes when I destroy an enemy building. I run the game in Debug and the game doesn't crash.

However I do get this message in Debug mode: "Delayed sync response..."

My random damage code:



srand ( time(NULL) );

int random_integer;
random_integer = (int)rand()% (int)damage/2+(int)damage/2;

*info <<"Initial Damage: " << damage << " Random Damage: " << random_integer <<"\n";

damage = random_integer;

Does anyone have an idea what Im doing wrong?

[EDIT]

The game stoped crashing after I replaced rand() with RandFloat()
Last edited by pin_ on 23 Sep 2006, 20:23, edited 1 time in total.
User avatar
ILMTitan
Spring Developer
Posts: 410
Joined: 13 Nov 2004, 08:35

Post by ILMTitan »

I would assume DoDamage is within a section of synced code. Thus it must be the same everywere, thus you need to use the synced random number generator, which you can get with gs->randInt(), gs->randFloat(), and gs->randVector().
Post Reply

Return to “Engine”