summaryrefslogtreecommitdiff
path: root/src/resources/iteminfo.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-03-12 23:59:10 +0300
committerAndrei Karas <akaras@inbox.ru>2012-03-13 00:04:53 +0300
commit0a7725600eecd8491f3c814110bb434824e71252 (patch)
tree05df7742a9697f394a9478082fdeb15a46d4bbb4 /src/resources/iteminfo.cpp
parent9e53440cb2dbcfd4311ce2566eb98839383738c7 (diff)
downloadmanaverse-0a7725600eecd8491f3c814110bb434824e71252.tar.gz
manaverse-0a7725600eecd8491f3c814110bb434824e71252.tar.bz2
manaverse-0a7725600eecd8491f3c814110bb434824e71252.tar.xz
manaverse-0a7725600eecd8491f3c814110bb434824e71252.zip
Use per race equipment sprites.
Example: <sprite gender="male" race="4">...</sprite>
Diffstat (limited to 'src/resources/iteminfo.cpp')
-rw-r--r--src/resources/iteminfo.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index f163fc590..15454dccd 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -32,6 +32,8 @@
#include "debug.h"
+extern int serverVersion;
+
/*
ItemInfo::ItemInfo(ItemInfo &info)
{
@@ -99,20 +101,28 @@ ItemInfo::~ItemInfo()
mSpriteToItemReplaceMap[f] = nullptr;
}
-const std::string &ItemInfo::getSprite(Gender gender) const
+const std::string &ItemInfo::getSprite(Gender gender, int race) const
{
if (mView)
{
// Forward the request to the item defining how to view this item
- return ItemDB::get(mView).getSprite(gender);
+ return ItemDB::get(mView).getSprite(gender, race);
}
else
{
static const std::string empty("");
std::map<int, std::string>::const_iterator i =
- mAnimationFiles.find(gender);
+ mAnimationFiles.find(static_cast<int>(gender) * 2 + race);
- return (i != mAnimationFiles.end()) ? i->second : empty;
+ if (i != mAnimationFiles.end())
+ return i->second;
+ if (serverVersion > 0)
+ {
+ i = mAnimationFiles.find(static_cast<int>(gender) * 2);
+ if (i != mAnimationFiles.end())
+ return i->second;
+ }
+ return empty;
}
}
@@ -311,3 +321,9 @@ int ItemInfo::getDrawPriority(int direction) const
return 0;
return mDrawPriority[direction];
}
+
+void ItemInfo::setSprite(const std::string &animationFile,
+ Gender gender, int race)
+{
+ mAnimationFiles[static_cast<int>(gender) * 2 + race] = animationFile;
+}