From 5d6ddb25b9a65f5b7179464b26a71c51b1300e71 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 24 Apr 2016 19:02:36 +0100 Subject: [PATCH] Fixed -O2 compile options (ignoring unused result) --- makefile | 1 + src/battle/bullets.c | 7 ++++++- src/battle/entities.c | 2 +- src/defs.h | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/makefile b/makefile index e1453c8..af4fac0 100644 --- a/makefile +++ b/makefile @@ -14,6 +14,7 @@ include common.mk CXXFLAGS += `sdl2-config --cflags` -DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDATA_DIR=\"$(DATA_DIR)\" -DLOCALE_DIR=\"$(LOCALE_DIR)\" CXXFLAGS += -Wall -Wempty-body -ansi -pedantic -Werror -Wstrict-prototypes CXXFLAGS += -g -lefence +#CXXFLAGS += -O2 -Wno-unused-result LFLAGS := `sdl2-config --libs` -lSDL2_mixer -lSDL2_image -lSDL2_ttf -lm diff --git a/src/battle/bullets.c b/src/battle/bullets.c index b080181..c36fa39 100644 --- a/src/battle/bullets.c +++ b/src/battle/bullets.c @@ -335,6 +335,8 @@ void fireGuns(Entity *owner) int i; float x, y; float c, s; + + b = NULL; for (i = 0 ; i < MAX_FIGHTER_GUNS ; i++) { @@ -360,7 +362,10 @@ void fireGuns(Entity *owner) owner->reload = owner->reloadTime; - playBattleSound(b->sound, owner->x, owner->y); + if (b) + { + playBattleSound(b->sound, owner->x, owner->y); + } } void fireRocket(Entity *owner) diff --git a/src/battle/entities.c b/src/battle/entities.c index 3c0fe86..6309bad 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -67,7 +67,7 @@ void doEntities(void) prev = &battle.entityHead; - numAllies = numEnemies = numActiveAllies = numActiveEnemies = 0; + numAllies = numEnemies = numActiveAllies = numActiveEnemies = numSpawnedEnemies = 0; if (dev.playerImmortal) { diff --git a/src/defs.h b/src/defs.h index 2d2616a..8478b76 100644 --- a/src/defs.h +++ b/src/defs.h @@ -46,7 +46,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SCREEN_HEIGHT 720 #define MAX_KEYBOARD_KEYS 350 -#define MAX_MOUSE_BUTTONS 5 +#define MAX_MOUSE_BUTTONS 6 #define FPS 60 #define LOGIC_RATE (1000 / FPS)