diff --git a/src/game.c b/src/game.c index 9fa9238..899dbc4 100644 --- a/src/game.c +++ b/src/game.c @@ -4,12 +4,14 @@ #include "config.h" +#include +#include #include #include #include #include "npc.h" -#include "stdlib.h" + extern bopti_image_t SignAction_img; @@ -25,7 +27,7 @@ void game_logic(Game *game) { update_npc( game ); /* we check if interactions are possible close to the player */ - for( int i=0; imap_level->nbextradata; i++ ) + for( uint32_t i=0; imap_level->nbextradata; i++ ) { /* simple distance check along X and Y axis */ /* Be careful to use world coordinates, not local (i.e.map) ones */ @@ -47,7 +49,7 @@ void game_logic(Game *game) { } } - for( int i=0; imap_level; /* Get the tile at (x, y) on layer l. Returns the tile ID or MAP_OUTSIDE if - * she's not found. */ - return (x>=0 && x < map_level->w && y>=0 && y < map_level->h) ? + * it's not found. */ + return (x>=0 && x < (int) map_level->w && y>=0 && y < (int) map_level->h) ? map_level->layers[l][y * map_level->w + x] : MAP_OUTSIDE; } @@ -209,7 +209,7 @@ short int get_walkable(Game *game, int x, int y) { Map *map_level = game->map_level; /* Get the tile at (x, y). Returns the tile ID or MAP_OUTSIDE if she's not * found. */ - return (x>=0 && x < map_level->w && y>=0 && y < map_level->h) ? + return (x>=0 && x < (int) map_level->w && y>=0 && y < (int) map_level->h) ? map_level->walkable[y * map_level->w + x] : MAP_OUTSIDE; } @@ -217,8 +217,8 @@ short int get_walkable(Game *game, int x, int y) { Map *get_map_for_coordinates( Game *game, int x, int y ) { /* check if the current map contains the point */ - if (x>=game->map_level->xmin && xmap_level->xmax && - y>=game->map_level->ymin && ymap_level->ymax) + if (x>= (int)game->map_level->xmin && x< (int)game->map_level->xmax && + y>= (int)game->map_level->ymin && y< (int)game->map_level->ymax) return game->map_level; /* else we check in worldRPG if there is a mal containing that point */ @@ -226,8 +226,8 @@ Map *get_map_for_coordinates( Game *game, int x, int y ) Map *current = worldRPG[i]; do { - if (x>=current->xmin && xxmax && - y>=current->ymin && yymax) + if (x>= (int)current->xmin && x< (int)current->xmax && + y>= (int)current->ymin && y< (int)current->ymax) return current; i++; current = worldRPG[i];