diff options
author | Freeyorp <Freeyorp101@hotmail.com> | 2010-08-29 19:47:25 +1200 |
---|---|---|
committer | Freeyorp <Freeyorp101@hotmail.com> | 2010-08-29 19:47:25 +1200 |
commit | 7fc50c2d31e1d289e9d2a950271c6d399fe0896a (patch) | |
tree | 1ebff71f7b1526425cc57e2e3b2681297e540f90 /src/game-server/character.hpp | |
parent | 853cbb6efdb79f879fabc2133acb8c11d9d4f7b1 (diff) | |
parent | 7db9f6fe36b737d2eec7c6070497035b0834def2 (diff) | |
download | manaserv-7fc50c2d31e1d289e9d2a950271c6d399fe0896a.tar.gz manaserv-7fc50c2d31e1d289e9d2a950271c6d399fe0896a.tar.bz2 manaserv-7fc50c2d31e1d289e9d2a950271c6d399fe0896a.tar.xz manaserv-7fc50c2d31e1d289e9d2a950271c6d399fe0896a.zip |
Merge branch 'testing'
Conflicts:
src/account-server/storage.cpp
src/game-server/being.cpp
src/game-server/being.hpp
src/game-server/character.cpp
src/game-server/character.hpp
src/game-server/gamehandler.cpp
src/game-server/inventory.cpp
src/scripting/lua.cpp
src/sql/mysql/createTables.sql
src/sql/sqlite/createTables.sql
Diffstat (limited to 'src/game-server/character.hpp')
-rw-r--r-- | src/game-server/character.hpp | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/game-server/character.hpp b/src/game-server/character.hpp index 98c518a2..5581fc7a 100644 --- a/src/game-server/character.hpp +++ b/src/game-server/character.hpp @@ -29,6 +29,7 @@ #include "game-server/being.hpp" #include "protocol.h" #include "defines.h" +#include "utils/logger.h" class BuySell; class GameClient; @@ -168,6 +169,7 @@ class Character : public Being /* * Character data: * Get and set methods + * Most of this should be accessed directly as a friend */ /** Gets the database id of the character. */ @@ -255,21 +257,14 @@ class Character : public Being void setMapId(int); /** - * Over loads Being::getAttribute, character skills are - * treated as extend attributes + * Marks all attributes as being modified. */ - int getAttribute(int) const; - - /** - * Over loads Being::getModifiedAttribute - * Charcter skills are treated as extend attributes - */ - int getModifiedAttribute(int) const; + void modifiedAllAttribute(); /** * Updates base Being attributes. */ - void updateDerivedAttributes(int); + void updateDerivedAttributes(unsigned int); /** * Calls all the "disconnected" listener. @@ -359,12 +354,6 @@ class Character : public Being int getKillCount(int monsterType) const; /** - * Shortcut to get being's health - */ - int getHealth() const - { return getModifiedAttribute(CHAR_ATTR_VITALITY); } - - /** * Returns the exp needed to reach a specific skill level */ static int expForLevel(int level); @@ -404,7 +393,20 @@ class Character : public Being virtual unsigned char getWalkMask() const { return 0x82; } // blocked by walls and monsters ( bin 1000 0010) + protected: + /** + * Gets the way the actor blocks pathfinding for other objects + */ + virtual Map::BlockType getBlockType() const + { return Map::BLOCKTYPE_CHARACTER; } + private: + + double getAttrBase(AttributeMap::const_iterator it) const + { return it->second.getBase(); } + double getAttrMod(AttributeMap::const_iterator it) const + { return it->second.getModifiedAttribute(); } + Character(const Character &); Character &operator=(const Character &); @@ -483,12 +485,9 @@ class Character : public Being TransactionType mTransaction; /**< Trade/buy/sell action the character is involved in. */ std::map<int, int> mKillCount; /**< How many monsters the character has slain of each type */ - protected: - /** - * Gets the way the actor blocks pathfinding for other objects - */ - virtual Map::BlockType getBlockType() const - { return Map::BLOCKTYPE_CHARACTER; } + // Set as a friend, but still a lot of redundant accessors. FIXME. + template< class T > + friend void serializeCharacterData(const T &data, MessageOut &msg); }; #endif // CHARACTER_HPP |