X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fmisc.c;h=4b436322c94fc5d0f6639402d909eb5cb134e171;hb=b2e74ef7ae9ca5c6f198afc177b7a6412079f10e;hp=5a12dbe3006650a8eba03a9bf8e10015b566b089;hpb=8193de5445484f6e658c06b9ef9209742b3db456;p=rocksndiamonds.git diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 5a12dbe3..4b436322 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -2564,6 +2564,27 @@ char *get_mapped_token(char *token) return getStringCat2(map_token_prefix[i][1], &token[len_token_prefix]); } + // change tokens containing ".gfx" by moving the "gfx" part to the very left + char *gfx_substring = ".gfx"; + char *gfx_prefix = "gfx."; + if (strstr(token, gfx_substring) != NULL) + { + char *token_prefix = getStringCopy(token); + char *token_gfx_pos = strstr(token_prefix, gfx_substring); + char *token_suffix = &token_gfx_pos[strlen(gfx_substring)]; + char *mapped_token; + + // cut off token string at ".gfx" substring position + *token_gfx_pos = '\0'; + + // put together prefix "gfx." and token prefix and suffix without ".gfx" + mapped_token = getStringCat3(gfx_prefix, token_prefix, token_suffix); + + free(token_prefix); + + return mapped_token; + } + return NULL; } @@ -3061,7 +3082,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, } END_HASH_ITERATION(valid_file_hash_tmp, itr) - /* free temporary hash used for iteration */ + /* free temporary hash used for iteration */ freeSetupFileHash(valid_file_hash_tmp); /* read parameters for all known config file tokens */