Use signed int for water runners

scene_man
En Yi 2023-11-11 12:06:19 +08:00
parent 15bb9c84ae
commit 2968172921
3 changed files with 6 additions and 6 deletions

View File

@ -148,9 +148,9 @@ typedef struct _BFSTile {
typedef struct _BFSTileMap {
BFSTile_t* tilemap;
uint32_t width;
uint32_t height;
uint32_t len;
int32_t width;
int32_t height;
int32_t len;
}BFSTileMap_t;
typedef enum _WaterRunnerState

View File

@ -180,7 +180,7 @@ void update_water_runner_system(Scene_t* scene)
switch (p_crunner->state)
{
case BFS_RESET:
for (size_t i = 0; i < p_crunner->bfs_tilemap.len; ++i)
for (int32_t i = 0; i < p_crunner->bfs_tilemap.len; ++i)
{
//p_crunner->bfs_tilemap.tilemap[i].to = -1;
p_crunner->bfs_tilemap.tilemap[i].from = -1;
@ -254,7 +254,7 @@ void update_water_runner_system(Scene_t* scene)
int start_tile =
(p_crunner->current_tile / p_crunner->bfs_tilemap.width) * p_crunner->bfs_tilemap.width;
for (size_t i = 0; i < p_crunner->bfs_tilemap.width; ++i)
for (int32_t i = 0; i < p_crunner->bfs_tilemap.width; ++i)
{
p_crunner->bfs_tilemap.tilemap[start_tile + i].reachable = false;
}

View File

@ -68,7 +68,7 @@ static void level_scene_render_func(Scene_t* scene)
if (
bot <= tilemap.n_tiles
(unsigned int)bot <= tilemap.n_tiles
&& tilemap.tiles[bot].water_level < MAX_WATER_LEVEL
&& tilemap.tiles[i].water_level == 0
)