summaryrefslogtreecommitdiffstats
path: root/src/game-server/character.cpp
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-04-11 11:10:47 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-04-12 14:56:28 +0200
commit9e6a0f98ecb52e04ab5afce817cb1d7fe2076450 (patch)
tree97b6ffedbfbaf09389fe05c1d183471a97740ebb /src/game-server/character.cpp
parentd7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da (diff)
downloadmanaserv-9e6a0f98ecb52e04ab5afce817cb1d7fe2076450.tar.gz
manaserv-9e6a0f98ecb52e04ab5afce817cb1d7fe2076450.tar.xz
manaserv-9e6a0f98ecb52e04ab5afce817cb1d7fe2076450.zip
Moved Actor into an Component
This was the final step to remove the hierachy with Entity on the top.
Diffstat (limited to 'src/game-server/character.cpp')
-rw-r--r--src/game-server/character.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp
index 8f35fef..ab13e00 100644
--- a/src/game-server/character.cpp
+++ b/src/game-server/character.cpp
@@ -90,10 +90,7 @@ CharacterComponent::CharacterComponent(Entity &entity, MessageIn &msg):
mKnuckleAttackInfo(0),
mBaseEntity(&entity)
{
- // Temporary until all dependencies are in a component
- Actor &being = static_cast<Actor &>(entity);
-
- mCharacterData = new CharacterData(&being, this);
+ mCharacterData = new CharacterData(&entity, this);
auto *beingComponent = entity.getComponent<BeingComponent>();
@@ -105,12 +102,13 @@ CharacterComponent::CharacterComponent(Entity &entity, MessageIn &msg):
beingComponent->createAttribute(attributeScope.first,
*attributeScope.second);
-
- being.setWalkMask(Map::BLOCKMASK_WALL);
- being.setBlockType(BLOCKTYPE_CHARACTER);
+ auto *actorComponent = entity.getComponent<ActorComponent>();
+ actorComponent->setWalkMask(Map::BLOCKMASK_WALL);
+ actorComponent->setBlockType(BLOCKTYPE_CHARACTER);
+ actorComponent->setSize(16);
- CombatComponent *combatcomponent = new CombatComponent(being);
+ CombatComponent *combatcomponent = new CombatComponent(entity);
entity.addComponent(combatcomponent);
combatcomponent->getAttacks().attack_added.connect(
sigc::mem_fun(this, &CharacterComponent::attackAdded));
@@ -138,9 +136,8 @@ CharacterComponent::CharacterComponent(Entity &entity, MessageIn &msg):
deserializeCharacterData(*mCharacterData, msg);
- Inventory(&being, mPossessions).initialize();
- modifiedAllAttributes(entity);
- being.setSize(16);
+ Inventory(&entity, mPossessions).initialize();
+ modifiedAllAttributes(entity);;
beingComponent->signal_attribute_changed.connect(sigc::mem_fun(
this, &CharacterComponent::attributeChanged));