Fixed crash in snake movement code

This commit is contained in:
Rob Pearce 2008-11-21 06:06:22 +00:00
parent 519ea7f54d
commit cb26714a27
1 changed files with 23 additions and 20 deletions

7
rc.c
View File

@ -3545,11 +3545,13 @@ int movesprite(sprite_t *s) {
int shoot = B_FALSE;
if (player && (s->y - player->y <= (TILEH*4)) ) {
closeplayer = player;
} else {
} else if (player2 && (s->y - player2->y <= (TILEH*4))) {
closeplayer = player2;
} else {
closeplayer = NULL;
}
if (closeplayer) {
if (s->bullet == NULL) { // if we don't already have a bullet
// if we are facing the player
if ( (closeplayer->x < s->x) && (s->dir == D_LEFT) ) {
@ -3574,6 +3576,7 @@ int movesprite(sprite_t *s) {
}
}
}
}
/* either move or turn around */
if (move) {