diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 0b18a498..17992678 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -3474,9 +3474,17 @@ int glestMain(int argc, char** argv) { // Cache Player textures - START string data_path = getGameReadWritePath(GameConstants::path_data_CacheLookupKey); + string playerColorTexturePath = getGameCustomCoreDataPath(data_path, "") + "data/core/faction_textures/faction*.tga"; + vector playerColorTextureFilenames; + findAll(playerColorTexturePath, playerColorTextureFilenames, false, false); + std::map &crcPlayerTextureCache = CacheManager::getCachedItem< std::map >(GameConstants::playerTextureCacheLookupKey); for(int index = 0; index < GameConstants::maxPlayers; ++index) { string playerTexture = data_path + "data/core/faction_textures/faction" + intToStr(index) + ".tga"; + if(playerColorTextureFilenames.size() > 0) { + playerTexture = getGameCustomCoreDataPath(data_path, "") + "data/core/faction_textures/faction" + intToStr(index) + ".tga"; + } + if(fileExists(playerTexture) == true) { Texture2D *texture = Renderer::getInstance().newTexture2D(rsGlobal); if(texture) { diff --git a/source/glest_game/type_instances/faction.cpp b/source/glest_game/type_instances/faction.cpp index be6fe809..f69009b9 100644 --- a/source/glest_game/type_instances/faction.cpp +++ b/source/glest_game/type_instances/faction.cpp @@ -490,8 +490,15 @@ void Faction::init( texture= Renderer::getInstance().newTexture2D(rsGame); string data_path = getGameReadWritePath(GameConstants::path_data_CacheLookupKey); + if(texture) { - texture->load(data_path + "data/core/faction_textures/faction"+intToStr(startLocationIndex)+".tga"); + string playerColorTexture = getGameCustomCoreDataPath(data_path, "") + "data/core/faction_textures/faction" + intToStr(startLocationIndex) + ".tga"; + if(fileExists(playerColorTexture) == true) { + texture->load(getGameCustomCoreDataPath(data_path, "") + "data/core/faction_textures/faction" + intToStr(startLocationIndex) + ".tga"); + } + else { + texture->load(data_path + "data/core/faction_textures/faction" + intToStr(startLocationIndex) + ".tga"); + } } if( game->getGameSettings()->getPathFinderType() == pfBasic &&