summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2013-04-12 14:51:10 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2013-04-12 15:08:02 +0200
commitf04f62249ae52e256cb889dfa17eed1f02efcbce (patch)
tree9e056215c6e9595b4ed7bf0c1254b8b7c489ecbb
parent9e6a0f98ecb52e04ab5afce817cb1d7fe2076450 (diff)
downloadmanaserv-f04f62249ae52e256cb889dfa17eed1f02efcbce.tar.gz
manaserv-f04f62249ae52e256cb889dfa17eed1f02efcbce.tar.xz
manaserv-f04f62249ae52e256cb889dfa17eed1f02efcbce.zip
Removed CharacterData member from CharacterComponent
It is only needed temporarily while serializing and deserializing.
-rw-r--r--src/game-server/accountconnection.cpp2
-rw-r--r--src/game-server/character.cpp5
-rw-r--r--src/game-server/character.h5
3 files changed, 3 insertions, 9 deletions
diff --git a/src/game-server/accountconnection.cpp b/src/game-server/accountconnection.cpp
index 72f8776..e52393b 100644
--- a/src/game-server/accountconnection.cpp
+++ b/src/game-server/accountconnection.cpp
@@ -107,7 +107,7 @@ void AccountConnection::sendCharacterData(Entity *p)
MessageOut msg(GAMSG_PLAYER_DATA);
auto *characterComponent = p->getComponent<CharacterComponent>();
msg.writeInt32(characterComponent->getDatabaseID());
- serializeCharacterData(*characterComponent->getCharacterData(), msg);
+ serializeCharacterData(CharacterData(p, characterComponent), msg);
send(msg);
}
diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp
index ab13e00..d0bcf46 100644
--- a/src/game-server/character.cpp
+++ b/src/game-server/character.cpp
@@ -90,8 +90,6 @@ CharacterComponent::CharacterComponent(Entity &entity, MessageIn &msg):
mKnuckleAttackInfo(0),
mBaseEntity(&entity)
{
- mCharacterData = new CharacterData(&entity, this);
-
auto *beingComponent = entity.getComponent<BeingComponent>();
const AttributeManager::AttributeScope &attributes =
@@ -134,7 +132,8 @@ CharacterComponent::CharacterComponent(Entity &entity, MessageIn &msg):
mDatabaseID = msg.readInt32();
beingComponent->setName(msg.readString());
- deserializeCharacterData(*mCharacterData, msg);
+ CharacterData characterData(&entity, this);
+ deserializeCharacterData(characterData, msg);
Inventory(&entity, mPossessions).initialize();
modifiedAllAttributes(entity);;
diff --git a/src/game-server/character.h b/src/game-server/character.h
index 195ea8d..704122d 100644
--- a/src/game-server/character.h
+++ b/src/game-server/character.h
@@ -467,9 +467,6 @@ class CharacterComponent : public Component
void attackAdded(CombatComponent *combatComponent, Attack &attackInfo);
void attackRemoved(CombatComponent *combatComponent, Attack &attackInfo);
- CharacterData *getCharacterData()
- { return mCharacterData; }
-
sigc::signal<void, Entity &> signal_disconnected;
private:
@@ -570,8 +567,6 @@ class CharacterComponent : public Component
IS AVOIDABLE in order to allow
refactoring this easier later! */
- CharacterData *mCharacterData;
-
static Script::Ref mDeathCallback;
static Script::Ref mDeathAcceptedCallback;
static Script::Ref mLoginCallback;