X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcommon%2FStats.h;h=f2eed68089d991ef884838f20e6a645bc172bb2c;hb=7b3710c47f24e64e0d01378a4564730bcb2f6ef2;hp=620fc1d1cf4d537db99c45d3dd4db4aaa3020dc1;hpb=06b6411e5dc8fc6b905530f7adbde8bd0c2bb0ea;p=l2e.git diff --git a/src/common/Stats.h b/src/common/Stats.h index 620fc1d..f2eed68 100644 --- a/src/common/Stats.h +++ b/src/common/Stats.h @@ -1,19 +1,20 @@ -/* - * Stats.h - * - * Created on: Aug 19, 2012 - * Author: holy - */ - #ifndef COMMON_STATS_H_ #define COMMON_STATS_H_ +namespace loader { + class TypeDescription; +} + +#include #include namespace common { class Stats { +public: + static const int TYPE_ID = 305; + public: Stats(); Stats(Uint16 attack, Uint16 defense, Uint16 strength, Uint16 agility, Uint16 intelligence, Uint8 gut, Uint16 magicResistance); @@ -38,6 +39,21 @@ public: static void CreateTypeDescription(); static void Construct(void *); +public: + Stats &operator +=(const Stats &other) { + attack += other.attack; + defense += other.defense; + strength += other.strength; + agility += other.agility; + intelligence += other.intelligence; + magicResistance += other.magicResistance; + gut += other.gut; + return *this; + } + +protected: + static void AddFields(loader::TypeDescription &, const Stats &, std::ptrdiff_t offset); + private: int attack; int defense; @@ -49,6 +65,13 @@ private: }; + +inline Stats operator +(const Stats &lhs, const Stats &rhs) { + Stats temp(lhs); + temp = rhs; + return temp; +} + } -#endif /* COMMON_STATS_H_ */ +#endif