X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcommon%2FStats.h;h=f2eed68089d991ef884838f20e6a645bc172bb2c;hb=7b3710c47f24e64e0d01378a4564730bcb2f6ef2;hp=5210ada12850986fa5c16e73c61060ca70c2e879;hpb=1907ca03c5e865c4d398170042aa384c67ffff29;p=l2e.git diff --git a/src/common/Stats.h b/src/common/Stats.h index 5210ada..f2eed68 100644 --- a/src/common/Stats.h +++ b/src/common/Stats.h @@ -1,13 +1,11 @@ -/* - * 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 { @@ -41,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; @@ -52,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