Skip to content

Commit

Permalink
Made next map block retrieval into a function
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamPlenty committed Aug 4, 2021
1 parent 5d848c3 commit 68fbcd3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/light_data.c
Expand Up @@ -743,8 +743,8 @@ void light_stat_light_map_clear_area(long x1, long y1, long x2, long y2)
*p = 0;
}
p++;
Mapblk1 = (struct Map *)((char *)Mapblk1 + 5);
Mapblk2 = (struct Map *)((char *)Mapblk2 + 5);
Mapblk1 = get_next_map_block(Mapblk1);
Mapblk2 = get_next_map_block(Mapblk2);
j++;
}
while ( j <= x2 );
Expand Down
5 changes: 5 additions & 0 deletions src/map_data.c
Expand Up @@ -748,6 +748,11 @@ TbBool subtile_is_diggable_for_player(PlayerNumber plyr_idx, MapSubtlCoord stl_x
}
return false;
}

struct Map *get_next_map_block(const struct Map *mapblk)
{
return (struct Map *)((char *)mapblk + sizeof(struct Map));
}
/******************************************************************************/
#ifdef __cplusplus
}
Expand Down
1 change: 1 addition & 0 deletions src/map_data.h
Expand Up @@ -79,6 +79,7 @@ extern long nav_map_initialised;
struct Map *get_map_block_at(MapSubtlCoord stl_x, MapSubtlCoord stl_y);
struct Map *get_map_block_at_pos(long stl_num);
TbBool map_block_invalid(const struct Map *mapblk);
struct Map *get_next_map_block(const struct Map *mapblk);

void reveal_map_subtile(MapSubtlCoord stl_x, MapSubtlCoord stl_y, PlayerNumber plyr_idx);
TbBool subtile_revealed(MapSubtlCoord stl_x, MapSubtlCoord stl_y, PlayerNumber plyr_idx);
Expand Down

0 comments on commit 68fbcd3

Please sign in to comment.