diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-09-15 14:18:38 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-09-15 14:18:38 +0200 |
commit | 33e36451fb179d14bb4b00fb295c2f7a0874b9d5 (patch) | |
tree | d6a8fce6291e72915b3c7ab326b51ac65087bd00 /src/game-server/charactercomponent.cpp | |
parent | bc3530454e9456bdd58381ddf38d6ab60bd69ed6 (diff) | |
download | manaserv-33e36451fb179d14bb4b00fb295c2f7a0874b9d5.tar.gz manaserv-33e36451fb179d14bb4b00fb295c2f7a0874b9d5.tar.bz2 manaserv-33e36451fb179d14bb4b00fb295c2f7a0874b9d5.tar.xz manaserv-33e36451fb179d14bb4b00fb295c2f7a0874b9d5.zip |
Renamed sendFullStatus to markAllInfoAsChanged
Moved the actual sending of info out of update() and into sendStatus to
prevent delay issues depending on the order of the components getting
updated.
Diffstat (limited to 'src/game-server/charactercomponent.cpp')
-rw-r--r-- | src/game-server/charactercomponent.cpp | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/game-server/charactercomponent.cpp b/src/game-server/charactercomponent.cpp index 89f3eeb3..11e90a65 100644 --- a/src/game-server/charactercomponent.cpp +++ b/src/game-server/charactercomponent.cpp @@ -110,8 +110,6 @@ CharacterComponent::CharacterComponent(Entity &entity, MessageIn &msg): beingComponent->signal_attribute_changed.connect(sigc::mem_fun( this, &CharacterComponent::attributeChanged)); - - sendFullInfo(entity); } CharacterComponent::~CharacterComponent() @@ -276,22 +274,6 @@ void CharacterComponent::serialize(Entity &entity, MessageOut &msg) } } -void CharacterComponent::update(Entity &entity) -{ - // Dead character: don't regenerate anything else - if (entity.getComponent<BeingComponent>()->getAction() == DEAD) - return; - - if (!mModifiedAbilities.empty()) - sendAbilityUpdate(entity); - - if (mSendAbilityCooldown) - sendAbilityCooldownUpdate(entity); - - if (mSendAttributePointsStatus) - sendAttributePointsStatus(entity); -} - void CharacterComponent::characterDied(Entity *being) { executeCallback(mDeathCallback, *being); @@ -448,6 +430,15 @@ void CharacterComponent::sendStatus(Entity &entity) } if (attribMsg.getLength() > 2) gameHandler->sendTo(mClient, attribMsg); mModifiedAttributes.clear(); + + if (!mModifiedAbilities.empty()) + sendAbilityUpdate(entity); + + if (mSendAbilityCooldown) + sendAbilityCooldownUpdate(entity); + + if (mSendAttributePointsStatus) + sendAttributePointsStatus(entity); } void CharacterComponent::modifiedAllAbilities(Entity &entity) @@ -586,7 +577,7 @@ void CharacterComponent::triggerLoginCallback(Entity &entity) executeCallback(mLoginCallback, entity); } -void CharacterComponent::sendFullInfo(Entity &entity) +void CharacterComponent::markAllInfoAsChanged(Entity &entity) { modifiedAllAbilities(entity); modifiedAllAttributes(entity); |