diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-23 00:42:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-23 00:42:38 +0300 |
commit | 2acd4cd73813e8cd0bf6d662e10e34af59cfac99 (patch) | |
tree | 2fa62d81b7849510df10a9efb8cec8b3384fa12b /src/being | |
parent | c4122f537ce74b55c6e465d2020f17b791b278a4 (diff) | |
download | ManaVerse-2acd4cd73813e8cd0bf6d662e10e34af59cfac99.tar.gz ManaVerse-2acd4cd73813e8cd0bf6d662e10e34af59cfac99.tar.bz2 ManaVerse-2acd4cd73813e8cd0bf6d662e10e34af59cfac99.tar.xz ManaVerse-2acd4cd73813e8cd0bf6d662e10e34af59cfac99.zip |
eathena: use petinfo for loading and storing data about pet.
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/petinfo.h | 11 | ||||
-rw-r--r-- | src/being/playerinfo.cpp | 23 | ||||
-rw-r--r-- | src/being/playerinfo.h | 7 |
3 files changed, 39 insertions, 2 deletions
diff --git a/src/being/petinfo.h b/src/being/petinfo.h index 3d171079d..8e7b50200 100644 --- a/src/being/petinfo.h +++ b/src/being/petinfo.h @@ -30,8 +30,11 @@ struct PetInfo final id(0), level(0), hungry(0), - intimate(0), - race(0) + intimacy(0), + race(0), + performance(0), + hairStyle(0), + equip(0) { } A_DELETE_COPY(PetInfo) @@ -40,7 +43,11 @@ struct PetInfo final int id; int level; int hungry; + int intimacy; int race; + int performance; + int hairStyle; + int equip; }; #endif // BEING_PETINFO_H diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp index e23c4c1b5..6c4e1c92d 100644 --- a/src/being/playerinfo.cpp +++ b/src/being/playerinfo.cpp @@ -28,6 +28,7 @@ #include "being/attributes.h" #include "being/localplayer.h" #include "being/mercenaryinfo.h" +#include "being/petinfo.h" #include "itemsoundmanager.h" @@ -56,6 +57,7 @@ int mCharId = 0; Inventory *mInventory = nullptr; Equipment *mEquipment = nullptr; MercenaryInfo *mMercenary = nullptr; +PetInfo *mPet = nullptr; bool mTrading = false; int mLevelProgress = 0; @@ -488,4 +490,25 @@ MercenaryInfo *getMercenary() return mMercenary; } +void setPet(PetInfo *const info) +{ + if (mPet) + delete mPet; + mPet = info; +} + +void setPetBeing(Being *const being) +{ + if (!being || !mPet) + return; + being->setName(mPet->name); + being->setOwner(localPlayer); + being->setLevel(mPet->level); +} + +PetInfo *getPet() +{ + return mPet; +} + } // namespace PlayerInfo diff --git a/src/being/playerinfo.h b/src/being/playerinfo.h index 4fcc5dfc1..23fb41731 100644 --- a/src/being/playerinfo.h +++ b/src/being/playerinfo.h @@ -64,6 +64,7 @@ class Inventory; class Item; struct MercenaryInfo; +struct PetInfo; /** * A database like namespace which holds global info about the localplayer @@ -242,6 +243,12 @@ namespace PlayerInfo void setMercenary(MercenaryInfo *const info); void setMercenaryBeing(Being *const being); + + PetInfo *getPet(); + + void setPet(PetInfo *const info); + + void setPetBeing(Being *const being); } // namespace PlayerInfo #endif // BEING_PLAYERINFO_H |