From d9a4b51fac8804520575080328a66123009f10eb Mon Sep 17 00:00:00 2001 From: per Date: Sun, 17 Feb 2013 10:55:28 +0100 Subject: [PATCH] Rename 'tileset' global variable to 'tilesetDir' for increased readability. --- src/map.cpp | 18 +++++++++--------- src/map.h | 3 +-- src/texture.cpp | 4 ++-- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/map.cpp b/src/map.cpp index d2a41a605..59de01ae2 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -116,7 +116,7 @@ static void init_tileNames(int type); /// The different ground types GROUND_TYPE *psGroundTypes; int numGroundTypes; -char *tileset = NULL; +char *tilesetDir = NULL; static int numTile_names; static char *Tile_names = NULL; #define ARIZONA 1 @@ -239,9 +239,9 @@ static bool mapLoadGroundTypes(void) pFileData = fileLoadBuffer; - debug(LOG_TERRAIN, "tileset: %s", tileset); + debug(LOG_TERRAIN, "tileset: %s", tilesetDir); // For Arizona - if (strcmp(tileset, "texpages/tertilesc1hw") == 0) + if (strcmp(tilesetDir, "texpages/tertilesc1hw") == 0) { fallback: init_tileNames(ARIZONA); @@ -281,7 +281,7 @@ fallback: SetDecals("tileset/arizonadecals.txt", "arizona_decals"); } // for Urban - else if (strcmp(tileset, "texpages/tertilesc2hw") == 0) + else if (strcmp(tilesetDir, "texpages/tertilesc2hw") == 0) { init_tileNames(URBAN); if (!loadFileToBuffer("tileset/tertilesc2hwGtype.txt", pFileData, FILE_LOAD_BUFFER_SIZE, &fileSize)) @@ -320,7 +320,7 @@ fallback: SetDecals("tileset/urbandecals.txt", "urban_decals"); } // for Rockie - else if (strcmp(tileset, "texpages/tertilesc3hw") == 0) + else if (strcmp(tilesetDir, "texpages/tertilesc3hw") == 0) { init_tileNames(ROCKIE); if (!loadFileToBuffer("tileset/tertilesc3hwGtype.txt", pFileData, FILE_LOAD_BUFFER_SIZE, &fileSize)) @@ -361,7 +361,7 @@ fallback: // When a map uses something other than the above, we fallback to Arizona else { - debug(LOG_ERROR, "unsupported tileset: %s", tileset); + debug(LOG_ERROR, "unsupported tileset: %s", tilesetDir); debug(LOG_POPUP, "This is a UNSUPPORTED map with a custom tileset.\nDefaulting to tertilesc1hw -- map may look strange!"); // HACK: / FIXME: For now, we just pretend this is a tertilesc1hw map. goto fallback; @@ -627,7 +627,7 @@ static bool mapSetGroundTypes(void) { MAPTILE *psTile = mapTile(i, j); - psTile->ground = determineGroundType(i,j,tileset); + psTile->ground = determineGroundType(i, j, tilesetDir); if (hasDecals(i,j)) { @@ -779,9 +779,9 @@ bool mapLoad(char *filename, bool preview) mapHeight = height; // FIXME: the map preview code loads the map without setting the tileset - if (!tileset) + if (!tilesetDir) { - tileset = strdup("texpages/tertilesc1hw"); + tilesetDir = strdup("texpages/tertilesc1hw"); } // load the ground types diff --git a/src/map.h b/src/map.h index 2c41dcbb1..20c98e43f 100644 --- a/src/map.h +++ b/src/map.h @@ -119,7 +119,7 @@ extern MAPTILE *psMapTiles; extern float waterLevel; extern GROUND_TYPE *psGroundTypes; extern int numGroundTypes; -extern char *tileset; +extern char *tilesetDir; #define AIR_BLOCKED 0x01 ///< Aircraft cannot pass tile #define FEATURE_BLOCKED 0x02 ///< Ground units cannot pass tile due to item in the way @@ -345,7 +345,6 @@ extern MAPTILE *psMapTiles; extern GROUND_TYPE *psGroundTypes; extern int numGroundTypes; -extern char *tileset; /* * Usage-Example: diff --git a/src/texture.cpp b/src/texture.cpp index caed8fb7d..53925317e 100644 --- a/src/texture.cpp +++ b/src/texture.cpp @@ -120,8 +120,8 @@ bool texLoad(const char *fileName) ASSERT_OR_RETURN(false, MIPMAP_MAX == TILE_WIDTH && MIPMAP_MAX == TILE_HEIGHT, "Bad tile sizes"); // store the filename so we can later determine which tileset we are using - if (tileset) free(tileset); - tileset = strdup(fileName); + if (tilesetDir) free(tilesetDir); + tilesetDir = strdup(fileName); // reset defaults mipmap_max = MIPMAP_MAX;