Temporary workaround for the NULLDROID issue (bug#8723). Incl. asserts so debug builds can investigate.
Slightly modified wscript. config.h was probably not included in all sourcefiles: I got an assert in release build. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1235 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
332aae2402
commit
9f7b5488e5
11
src/ai.c
11
src/ai.c
|
@ -306,7 +306,18 @@ SDWORD targetAttackWeight(BASE_OBJECT *psTarget, BASE_OBJECT *psAttacker, SDWORD
|
|||
targetDroid = (DROID *)psTarget;
|
||||
|
||||
/* Calculate damage this target suffered */
|
||||
if (targetDroid->originalBody == 0) // FIXME Somewhere we get 0HP droids from
|
||||
{
|
||||
damageRatio = 0;
|
||||
debug(LOG_ERROR, "targetAttackWeight: 0HP droid detected!");
|
||||
debug(LOG_ERROR, " Type: %i Name: \"%s\" Owner: %i \"%s\")",
|
||||
targetDroid->droidType, targetDroid->aName, targetDroid->player, getPlayerName(targetDroid->player));
|
||||
}
|
||||
else
|
||||
{
|
||||
damageRatio = 1 - targetDroid->body / targetDroid->originalBody;
|
||||
}
|
||||
assert(targetDroid->originalBody != 0); // Assert later so we get the info from above
|
||||
|
||||
/* See if this type of a droid should be prioritized */
|
||||
switch (targetDroid->droidType)
|
||||
|
|
4
wscript
4
wscript
|
@ -92,14 +92,14 @@ def configure(conf):
|
|||
conf.set_env_name('debug', conf.env.deepcopy())
|
||||
|
||||
# Configure non debug variant
|
||||
conf.env['CCFLAGS'] += ['-g0', '-O2']
|
||||
conf.env['CCFLAGS'] += ['-DNDEBUG', '-g', '-O2']
|
||||
conf.add_define('NDEBUG', 1)
|
||||
conf.write_config_header()
|
||||
|
||||
# Configure debug variant
|
||||
conf.setenv('debug')
|
||||
conf.env.set_variant('debug')
|
||||
conf.env['CCFLAGS'] += ['-g2', '-O0', '-Wall', '-Wextra', '-Wwrite-strings', '-Wcast-qual', '-Wmissing-declarations', '-Wstrict-prototypes', '-Wold-style-definition']
|
||||
conf.env['CCFLAGS'] += ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra']
|
||||
conf.add_define('DEBUG', 1)
|
||||
conf.write_config_header()
|
||||
|
||||
|
|
Loading…
Reference in New Issue