diff options
author | davidovski <david@davidovski.xyz> | 2023-07-11 01:59:45 +0100 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2023-07-11 01:59:45 +0100 |
commit | e8b6b1f0ee8b825443972b99b191fd5a85437008 (patch) | |
tree | 8680b4ea5e424b72e1e044f06ab9ae5d3003ef24 /src/tiledfile.c | |
parent | 86da5bd3b0b5e0a8d9e68534297ca0446d2f735d (diff) |
make consistent variable names
Diffstat (limited to 'src/tiledfile.c')
-rw-r--r-- | src/tiledfile.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/tiledfile.c b/src/tiledfile.c index a8de9cd..d6d4b1b 100644 --- a/src/tiledfile.c +++ b/src/tiledfile.c @@ -59,37 +59,38 @@ int readb(char * out, size_t noBytes, FILE * file) { //! load tilemap data from file TiledMap loadTiledMap(char * filename) { - TiledMap tiledmap; + TiledMap tiledMap; FILE * file; if (!(file = fopen(filename, "rb"))) { fprintf(stderr, "Failed to load %s\n", filename); - return tiledmap; + return tiledMap; } // skip header fseek(file, 10, SEEK_CUR); // 4 bytes for int width - readb((char *)&tiledmap.width, 4, file); + readb((char *)&tiledMap.width, 4, file); // 4 bytes for int height - readb((char *)&tiledmap.height, 4, file); + readb((char *)&tiledMap.height, 4, file); - size_t layoutSize = tiledmap.width*tiledmap.height; - tiledmap.tilelayout = malloc(layoutSize); - fread(tiledmap.tilelayout, layoutSize, 1, file); + size_t layoutSize = tiledMap.width*tiledMap.height; + tiledMap.tilelayout = malloc(layoutSize); + fread(tiledMap.tilelayout, layoutSize, 1, file); // read the pixel size of each tile - readb((char *)&tiledmap.tilesize, 4, file); + readb((char *)&tiledMap.tileSize, 4, file); // read the atlas size - readb((char *)&tiledmap.atlasSize[0], 4, file); - readb((char *)&tiledmap.atlasSize[1], 4, file); + readb((char *)&tiledMap.atlasSize[0], 4, file); + readb((char *)&tiledMap.atlasSize[1], 4, file); // read the atlas itself - size_t atlasSizeBytes = tiledmap.atlasSize[0]*tiledmap.tilesize*tiledmap.atlasSize[1]*tiledmap.tilesize*4; - tiledmap.atlasData = malloc(atlasSizeBytes); - fread(tiledmap.atlasData, atlasSizeBytes, (size_t) 1, file); + size_t atlasSizeBytes = tiledMap.atlasSize[0]*tiledMap.tileSize*tiledMap.atlasSize[1]*tiledMap.tileSize*4; + tiledMap.atlasData = malloc(atlasSizeBytes); + fread(tiledMap.atlasData, atlasSizeBytes, (size_t) 1, file); fclose(file); - return tiledmap; + return tiledMap; } + |