From f9c9e465d79364ff64266aed46528ca9532deb1f Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 10 Feb 2013 16:24:27 +0000 Subject: [PATCH] engine.c: in changesprite{sect,stat}, swap second and third early-out tests. That is, first check if the sprite is in the game world and then if it already has the desired sector or status number. This doesn't change anything in our codebase, since the return values of these functions are never examined. git-svn-id: https://svn.eduke32.com/eduke32@3474 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/engine.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 738b96f0f..571113038 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -7997,12 +7997,13 @@ int32_t deletesprite(int16_t spritenum) // int32_t changespritesect(int16_t spritenum, int16_t newsectnum) { - if ((newsectnum < 0) || (newsectnum > MAXSECTORS)) + // XXX: NOTE: MAXSECTORS is allowed + if (newsectnum < 0 || newsectnum > MAXSECTORS) + return(-1); + if (sprite[spritenum].sectnum == MAXSECTORS) return(-1); if (sprite[spritenum].sectnum == newsectnum) return(0); - if (sprite[spritenum].sectnum == MAXSECTORS) - return(-1); do_deletespritesect(spritenum); do_insertsprite_at_headofsect(spritenum, newsectnum); @@ -8015,12 +8016,13 @@ int32_t changespritesect(int16_t spritenum, int16_t newsectnum) // int32_t changespritestat(int16_t spritenum, int16_t newstatnum) { - if ((newstatnum < 0) || (newstatnum > MAXSTATUS)) + // XXX: NOTE: MAXSTATUS is allowed + if (newstatnum < 0 || newstatnum > MAXSTATUS) return(-1); - if (sprite[spritenum].statnum == newstatnum) - return(0); // sprite already has desired statnum if (sprite[spritenum].statnum == MAXSTATUS) return(-1); // can't set the statnum of a sprite not in the world + if (sprite[spritenum].statnum == newstatnum) + return(0); // sprite already has desired statnum do_deletespritestat(spritenum); do_insertsprite_at_headofstat(spritenum, newstatnum);