mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-26 17:36:05 -05:00
add GEODE_HIDDEN to _spr
This commit is contained in:
parent
f64c74a128
commit
71a79ab4dd
3 changed files with 6 additions and 4 deletions
|
@ -412,6 +412,6 @@ namespace geode {
|
|||
};
|
||||
}
|
||||
|
||||
inline char const* operator"" _spr(char const* str, size_t) {
|
||||
GEODE_HIDDEN inline char const* operator"" _spr(char const* str, size_t) {
|
||||
return geode::Mod::get()->expandSpriteName(str);
|
||||
}
|
||||
|
|
|
@ -592,14 +592,14 @@ ghc::filesystem::path Mod::Impl::getConfigDir(bool create) const {
|
|||
}
|
||||
|
||||
char const* Mod::Impl::expandSpriteName(char const* name) {
|
||||
static std::unordered_map<std::string, char const*> expanded = {};
|
||||
if (expanded.count(name)) return expanded[name];
|
||||
log::debug("Expanding sprite name {} for {}", name, m_metadata.getID());
|
||||
if (m_expandedSprites.count(name)) return m_expandedSprites[name];
|
||||
|
||||
auto exp = new char[strlen(name) + 2 + m_metadata.getID().size()];
|
||||
auto exps = m_metadata.getID() + "/" + name;
|
||||
memcpy(exp, exps.c_str(), exps.size() + 1);
|
||||
|
||||
expanded[name] = exp;
|
||||
m_expandedSprites[name] = exp;
|
||||
|
||||
return exp;
|
||||
}
|
||||
|
|
|
@ -61,6 +61,8 @@ namespace geode {
|
|||
*/
|
||||
bool m_loggingEnabled = true;
|
||||
|
||||
std::unordered_map<std::string, char const*> m_expandedSprites;
|
||||
|
||||
|
||||
ModRequestedAction m_requestedAction = ModRequestedAction::None;
|
||||
|
||||
|
|
Loading…
Reference in a new issue