summaryrefslogtreecommitdiffstats
path: root/src/graphics/engine/engine.cpp
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2014-05-18 12:12:47 +0200
committerkrzys-h <krzys_h@interia.pl>2014-05-18 12:12:47 +0200
commitf0d97bfdb91a2c0a17d1697b145d4df930280dbb (patch)
tree2d529428006e145b624108cce636b07867f566af /src/graphics/engine/engine.cpp
parentf71658e38dbcfc5635a6b2a9c6c4168582728bb5 (diff)
downloadcolobot-f0d97bfdb91a2c0a17d1697b145d4df930280dbb.tar.gz
colobot-f0d97bfdb91a2c0a17d1697b145d4df930280dbb.tar.bz2
colobot-f0d97bfdb91a2c0a17d1697b145d4df930280dbb.zip
Better datadir mod support
Diffstat (limited to 'src/graphics/engine/engine.cpp')
-rw-r--r--src/graphics/engine/engine.cpp34
1 files changed, 7 insertions, 27 deletions
diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp
index 0ee7715..d6e4415 100644
--- a/src/graphics/engine/engine.cpp
+++ b/src/graphics/engine/engine.cpp
@@ -19,6 +19,7 @@
#include "graphics/engine/engine.h"
#include "app/app.h"
+#include "app/gamedata.h"
#include "common/image.h"
#include "common/key.h"
@@ -2246,33 +2247,12 @@ Texture CEngine::CreateTexture(const std::string& texName, const TextureCreatePa
if (image == nullptr)
{
- bool loadedFromTexPack = false;
-
- std::string texPackName = m_app->GetTexPackFilePath(texName);
- if (! texPackName.empty())
+ if (! img.Load(CGameData::GetInstancePointer()->GetFilePath(DIR_TEXTURE, texName)))
{
- if (img.Load(texPackName))
- {
- loadedFromTexPack = true;
- }
- else
- {
- std::string error = img.GetError();
- GetLogger()->Error("Couldn't load texture '%s' from texpack: %s, blacklisting the texpack path\n",
- texName.c_str(), error.c_str());
- m_texBlacklist.insert(texPackName);
- }
- }
-
- if (!loadedFromTexPack)
- {
- if (! img.Load(m_app->GetDataFilePath(DIR_TEXTURE, texName)))
- {
- std::string error = img.GetError();
- GetLogger()->Error("Couldn't load texture '%s': %s, blacklisting\n", texName.c_str(), error.c_str());
- m_texBlacklist.insert(texName);
- return Texture(); // invalid texture
- }
+ std::string error = img.GetError();
+ GetLogger()->Error("Couldn't load texture '%s': %s, blacklisting\n", texName.c_str(), error.c_str());
+ m_texBlacklist.insert(texName);
+ return Texture(); // invalid texture
}
image = &img;
@@ -2435,7 +2415,7 @@ bool CEngine::ChangeTextureColor(const std::string& texName,
CImage img;
- if (! img.Load(m_app->GetDataFilePath(DIR_TEXTURE, texName)))
+ if (! img.Load(CGameData::GetInstancePointer()->GetFilePath(DIR_TEXTURE, texName)))
{
std::string error = img.GetError();
GetLogger()->Error("Couldn't load texture '%s': %s, blacklisting\n", texName.c_str(), error.c_str());