summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-21 15:19:48 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-21 15:19:48 +0300
commit5ce3ea5e8377a1f9898dc08b6cc7f3a9679f4232 (patch)
tree2883c9ec84c49ce0519ea3333d396ec535e50de8 /src/being
parentba07ca55476c488504a8d8bf9318f15aab687f12 (diff)
downloadmanaplus-5ce3ea5e8377a1f9898dc08b6cc7f3a9679f4232.tar.gz
manaplus-5ce3ea5e8377a1f9898dc08b6cc7f3a9679f4232.tar.bz2
manaplus-5ce3ea5e8377a1f9898dc08b6cc7f3a9679f4232.tar.xz
manaplus-5ce3ea5e8377a1f9898dc08b6cc7f3a9679f4232.zip
Restore mercenary stats if it was respawned.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/playerinfo.cpp9
-rw-r--r--src/being/playerinfo.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp
index 993c4d8a6..ba36d59a3 100644
--- a/src/being/playerinfo.cpp
+++ b/src/being/playerinfo.cpp
@@ -26,6 +26,7 @@
#include "inventory.h"
#include "being/attributes.h"
+#include "being/localplayer.h"
#include "being/mercenaryinfo.h"
#include "itemsoundmanager.h"
@@ -472,6 +473,14 @@ void setMercenary(MercenaryInfo *const info)
mMercenary = info;
}
+void setMercenaryBeing(Being *const being)
+{
+ if (!being || !mMercenary)
+ return;
+ being->setName(mMercenary->name);
+ being->setOwner(localPlayer);
+}
+
MercenaryInfo *getMercenary()
{
return mMercenary;
diff --git a/src/being/playerinfo.h b/src/being/playerinfo.h
index c01fdd237..4fcc5dfc1 100644
--- a/src/being/playerinfo.h
+++ b/src/being/playerinfo.h
@@ -58,6 +58,7 @@ struct PlayerInfoBackend final
IntMap mSkills;
};
+class Being;
class FloorItem;
class Inventory;
class Item;
@@ -240,6 +241,7 @@ namespace PlayerInfo
void setMercenary(MercenaryInfo *const info);
+ void setMercenaryBeing(Being *const being);
} // namespace PlayerInfo
#endif // BEING_PLAYERINFO_H