File tree 2 files changed +14
-5
lines changed
2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -122,9 +122,14 @@ std::string getImagePath(std::string path)
122
122
123
123
Utilizes a thread-safe cache.
124
124
*/
125
- std::string getTexturePath (const std::string &filename)
125
+ std::string getTexturePath (const std::string &filename, bool *is_base_pack )
126
126
{
127
127
std::string fullpath;
128
+
129
+ // This can set a wrong value on cached textures, but is irrelevant because
130
+ // is_base_pack is only passed when initializing the textures the first time
131
+ if (is_base_pack)
132
+ *is_base_pack = false ;
128
133
/*
129
134
Check from cache
130
135
*/
@@ -154,6 +159,8 @@ std::string getTexturePath(const std::string &filename)
154
159
std::string testpath = base_path + DIR_DELIM + filename;
155
160
// Check all filename extensions. Returns "" if not found.
156
161
fullpath = getImagePath (testpath);
162
+ if (is_base_pack && !fullpath.empty ())
163
+ *is_base_pack = true ;
157
164
}
158
165
159
166
// Add to cache (also an empty result is cached)
@@ -215,9 +222,11 @@ class SourceImageCache
215
222
bool need_to_grab = true ;
216
223
217
224
// Try to use local texture instead if asked to
218
- if (prefer_local){
219
- std::string path = getTexturePath (name);
220
- if (!path.empty ()) {
225
+ if (prefer_local) {
226
+ bool is_base_pack;
227
+ std::string path = getTexturePath (name, &is_base_pack);
228
+ // Ignore base pack
229
+ if (!path.empty () && !is_base_pack) {
221
230
video::IImage *img2 = RenderingEngine::get_video_driver ()->
222
231
createImageFromFile (path.c_str ());
223
232
if (img2){
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ std::string getImagePath(std::string path);
64
64
65
65
Utilizes a thread-safe cache.
66
66
*/
67
- std::string getTexturePath (const std::string &filename);
67
+ std::string getTexturePath (const std::string &filename, bool *is_base_pack = nullptr );
68
68
69
69
void clearTextureNameCache ();
70
70
You can’t perform that action at this time.
0 commit comments