Merge pull request 'Merge' (#40) from Fcalva/Collab_RPG_Fcalva:master into master

Reviewed-on: https://gitea.planet-casio.com/Slyvtt/Collab_RPG/pulls/40
This commit is contained in:
Fcalva 2023-09-30 17:00:52 +02:00
commit 37f9eb213b
2 changed files with 12 additions and 10 deletions

View file

@ -4,12 +4,14 @@
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <gint/keyboard.h>
#include <gint/cpu.h>
#include <gint/display.h>
#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; i<game->map_level->nbextradata; i++ )
for( uint32_t i=0; i<game->map_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; i<nbNPC; i++ )
for( uint32_t i=0; i<nbNPC; i++ )
{
/* simple distance check along X and Y axis */
/* Be careful to use world coordinates, not local (i.e.map) ones */

View file

@ -199,8 +199,8 @@ short int get_tile(Game *game, int x, int y, int l) {
Map *map_level = game->map_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 && x<game->map_level->xmax &&
y>=game->map_level->ymin && y<game->map_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 && x<current->xmax &&
y>=current->ymin && y<current->ymax)
if (x>= (int)current->xmin && x< (int)current->xmax &&
y>= (int)current->ymin && y< (int)current->ymax)
return current;
i++;
current = worldRPG[i];