diff --git a/src/alien.c b/src/alien.c index a11f9ed..8e1f360 100644 --- a/src/alien.c +++ b/src/alien.c @@ -1187,7 +1187,7 @@ int alien_add() int *alienArray; int numberOfAliens = 1; - alienArray = (int*)malloc(8 * sizeof(int)); + alienArray = malloc(8 * sizeof(int)); if (alienArray == NULL) { engine_warn("WARNING: Failed to allocate memory for aliens"); diff --git a/src/bullet.c b/src/bullet.c index 273a8ba..dbc939e 100644 --- a/src/bullet.c +++ b/src/bullet.c @@ -34,7 +34,7 @@ void bullet_add(Object *theWeapon, Object *attacker, int y, int dy) int imageIndex; int tempX, tempY, steps; - bullet = (Object*)malloc(sizeof(Object)); + bullet = malloc(sizeof(Object)); if (bullet == NULL) return; diff --git a/src/collectable.c b/src/collectable.c index 95656f7..bca1c91 100644 --- a/src/collectable.c +++ b/src/collectable.c @@ -143,7 +143,7 @@ void collectable_add(float x, float y, int type, int value, int life) } } - Collectable *collectable = (Collectable*)malloc(sizeof(Collectable)); + Collectable *collectable = malloc(sizeof(Collectable)); if (collectable == NULL) { engine_warn("Failed to allocate memory for collectable"); diff --git a/src/defs.h b/src/defs.h index eaf0191..fdaed24 100644 --- a/src/defs.h +++ b/src/defs.h @@ -759,9 +759,7 @@ enum { }; extern const char * const systemNames[]; - extern const char * const systemBackground[]; - extern const int rate2reload[6]; #endif diff --git a/src/engine.c b/src/engine.c index 5521e6b..c1eefd7 100644 --- a/src/engine.c +++ b/src/engine.c @@ -60,7 +60,7 @@ void engine_init() engine.smx = 0; engine.smy = 0; - engine.bulletHead = (Object*)malloc(sizeof(Object)); + engine.bulletHead = malloc(sizeof(Object)); if (engine.bulletHead == NULL) { engine_error("Failed to allocate memory for bullet head."); @@ -68,7 +68,7 @@ void engine_init() engine.bulletHead->next = NULL; engine.bulletTail = engine.bulletHead; - engine.explosionHead = (Object*)malloc(sizeof(Object)); + engine.explosionHead = malloc(sizeof(Object)); if (engine.explosionHead == NULL) { engine_error("Failed to allocate memory for explosion head."); @@ -76,7 +76,7 @@ void engine_init() engine.explosionHead->next = NULL; engine.explosionTail = engine.explosionHead; - engine.collectableHead = (Collectable*)malloc(sizeof(Collectable)); + engine.collectableHead = malloc(sizeof(Collectable)); if (engine.collectableHead == NULL) { engine_error("Failed to allocate memory for collectable head."); @@ -84,7 +84,7 @@ void engine_init() engine.collectableHead->next = NULL; engine.collectableTail = engine.collectableHead; - engine.debrisHead = (Object*)malloc(sizeof(Object)); + engine.debrisHead = malloc(sizeof(Object)); if (engine.debrisHead == NULL) { engine_error("Failed to allocate memory for debris head."); diff --git a/src/explosion.c b/src/explosion.c index 993e4c8..1273eaf 100644 --- a/src/explosion.c +++ b/src/explosion.c @@ -33,7 +33,7 @@ to change frames on a 21, 14, 7 basis. */ void explosion_add(float x, float y, int type) { - Object *explosion = (Object*)malloc(sizeof(Object)); + Object *explosion = malloc(sizeof(Object)); if (explosion == NULL) { engine_warn("Failed to allocate memory for explosion."); diff --git a/src/game.c b/src/game.c index 9c75515..9061334 100644 --- a/src/game.c +++ b/src/game.c @@ -233,7 +233,7 @@ static void game_addDebris(int x, int y, int amount) for (int i = 0 ; i < amount ; i++) { - debris = (Object*)malloc(sizeof(Object)); + debris = malloc(sizeof(Object)); debris->next = NULL; debris->x = x; diff --git a/src/gfx.c b/src/gfx.c index b658a3f..8c85fe8 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -44,7 +44,7 @@ SDL_Surface *gfx_messageBox; void gfx_init() { - screen_bufferHead = (LinkedRect*)malloc(sizeof(LinkedRect)); + screen_bufferHead = malloc(sizeof(LinkedRect)); if (screen_bufferHead == NULL) { engine_error("Failed to allocate memory for buffer head."); diff --git a/src/screen.c b/src/screen.c index 0e38fdb..98f6d9e 100644 --- a/src/screen.c +++ b/src/screen.c @@ -56,7 +56,7 @@ void screen_drawBackground() void screen_addBuffer(int x, int y, int w, int h) { - LinkedRect *rect = (LinkedRect*)malloc(sizeof(LinkedRect)); + LinkedRect *rect = malloc(sizeof(LinkedRect)); rect->next = NULL; rect->x = x; diff --git a/src/title.c b/src/title.c index 8920aaf..7071285 100644 --- a/src/title.c +++ b/src/title.c @@ -663,7 +663,7 @@ void title_showCredits() // FIXME: It would be nice for the size of this array to be determined // by the number of lines in the text file. I'm not sure how to do // that at the moment, so just giving it a very large number for now. - credit = (TextObject*) malloc(sizeof(TextObject) * 300); + credit = malloc(sizeof(TextObject) * 300); while (fscanf(fp, "%d %[^\n]%*c", &yPos, text) == 2) {