summaryrefslogtreecommitdiff
path: root/src/resources/spritedef.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/spritedef.cpp')
-rw-r--r--src/resources/spritedef.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index ff9b71901..b417345fd 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -73,7 +73,8 @@ unsigned SpriteDef::findNumber(const unsigned num) const
return min;
}
-SpriteDef *SpriteDef::load(const std::string &animationFile, const int variant)
+SpriteDef *SpriteDef::load(const std::string &animationFile,
+ const int variant, bool prot)
{
const size_t pos = animationFile.find('|');
std::string palettes;
@@ -90,7 +91,7 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, const int variant)
std::string errorFile = paths.getStringValue("sprites").append(
paths.getStringValue("spriteErrorFile"));
if (animationFile != errorFile)
- return load(errorFile, 0);
+ return load(errorFile, 0, prot);
else
return nullptr;
}
@@ -101,6 +102,11 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, const int variant)
def->substituteActions();
if (serverVersion < 1)
def->fixDeadAction();
+ if (prot)
+ {
+ def->incRef();
+ def->setProtected(true);
+ }
return def;
}