diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/isogfx/asset.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/isogfx/asset.h b/include/isogfx/asset.h index cc70ee3..74063a8 100644 --- a/include/isogfx/asset.h +++ b/include/isogfx/asset.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <isogfx/types.h> | 10 | #include <isogfx/types.h> |
11 | 11 | ||
12 | #include <assert.h> | 12 | #include <assert.h> |
13 | #include <stddef.h> | ||
13 | #include <stdint.h> | 14 | #include <stdint.h> |
14 | 15 | ||
15 | // Maximum length of path strings in .TS and .TM files. | 16 | // Maximum length of path strings in .TS and .TM files. |
@@ -177,9 +178,10 @@ static inline const Tm_Layer* tm_map_get_layer( | |||
177 | assert(map); | 178 | assert(map); |
178 | assert(layer >= 0); | 179 | assert(layer >= 0); |
179 | assert(layer < map->num_layers); | 180 | assert(layer < map->num_layers); |
180 | return (const Tm_Layer*)((const uint8_t*)map->layers + | 181 | return ( |
181 | (layer * map->world_width * map->world_height * | 182 | const Tm_Layer*)((const uint8_t*)map->layers + |
182 | sizeof(Tile))); | 183 | ((size_t)(layer * map->world_width * map->world_height) * |
184 | sizeof(Tile))); | ||
183 | } | 185 | } |
184 | 186 | ||
185 | /// Return the ith layer in the tile map. | 187 | /// Return the ith layer in the tile map. |