summaryrefslogtreecommitdiff
path: root/src/game-server/charactercomponent.cpp
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-09-15 13:35:35 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-09-15 13:35:35 +0200
commit6de8fd28ecb23dccded9c3eabed2f80cde7eb122 (patch)
treebff3d63e9f3c6753e7fe56372c48e06e69314537 /src/game-server/charactercomponent.cpp
parentd15190dc8cd8258fcdf06bb615de80bc97a5ac20 (diff)
downloadmanaserv-6de8fd28ecb23dccded9c3eabed2f80cde7eb122.tar.gz
manaserv-6de8fd28ecb23dccded9c3eabed2f80cde7eb122.tar.bz2
manaserv-6de8fd28ecb23dccded9c3eabed2f80cde7eb122.tar.xz
manaserv-6de8fd28ecb23dccded9c3eabed2f80cde7eb122.zip
Fixed handling of reconnects while the old connection is still valid
The old connection is now terminated. And the new connection will receive the character data properly.
Diffstat (limited to 'src/game-server/charactercomponent.cpp')
-rw-r--r--src/game-server/charactercomponent.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/game-server/charactercomponent.cpp b/src/game-server/charactercomponent.cpp
index 8a50d7cd..23a1bd4b 100644
--- a/src/game-server/charactercomponent.cpp
+++ b/src/game-server/charactercomponent.cpp
@@ -107,13 +107,12 @@ CharacterComponent::CharacterComponent(Entity &entity, MessageIn &msg):
deserialize(entity, msg);
Inventory(&entity, mPossessions).initialize();
- modifiedAllAttributes(entity);;
beingComponent->signal_attribute_changed.connect(sigc::mem_fun(
this, &CharacterComponent::attributeChanged));
- for (auto &abilityIt : abilityComponent->getAbilities())
- mModifiedAbilities.insert(abilityIt.first);
+ entity.signal_inserted.connect(sigc::mem_fun(this,
+ &CharacterComponent::inserted));
}
CharacterComponent::~CharacterComponent()
@@ -452,6 +451,12 @@ void CharacterComponent::sendStatus(Entity &entity)
mModifiedAttributes.clear();
}
+void CharacterComponent::modifiedAllAbilities(Entity &entity)
+{
+ for (auto &abilityIt : entity.getComponent<AbilityComponent>()->getAbilities())
+ mModifiedAbilities.insert(abilityIt.first);
+}
+
void CharacterComponent::modifiedAllAttributes(Entity &entity)
{
auto *beingComponent = entity.getComponent<BeingComponent>();
@@ -581,3 +586,10 @@ void CharacterComponent::triggerLoginCallback(Entity &entity)
{
executeCallback(mLoginCallback, entity);
}
+
+void CharacterComponent::inserted(Entity *entity)
+{
+ Inventory(entity).sendFull();
+ modifiedAllAbilities(*entity);
+ modifiedAllAttributes(*entity);
+}