summaryrefslogtreecommitdiffhomepage
path: root/Icons.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Icons.cpp')
-rw-r--r--Icons.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/Icons.cpp b/Icons.cpp
index 7b90ae0..cb50740 100644
--- a/Icons.cpp
+++ b/Icons.cpp
@@ -76,18 +76,17 @@ Icons::reset()
Texture2D
Icons::find(const long int type)
{
- const auto existing = m_cache.find(type);
+ const auto search = FILENAMES.find(type);
+ std::string filename = "resources/wreck.png";
+ if (search != FILENAMES.end())
+ filename = search->second;
+ const auto existing = m_cache.find(filename);
if (existing != m_cache.end()) {
return existing->second;
}
else {
- Texture2D texture;
- const auto filename = FILENAMES.find(type);
- if (filename != FILENAMES.end())
- texture = LoadTexture(filename->second.data());
- else
- texture = LoadTexture("resources/wreck.png");
- m_cache[type] = texture;
+ auto texture = LoadTexture(filename.data());
+ m_cache[filename] = texture;
return texture;
}
}