summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game-server/charactercomponent.cpp10
-rw-r--r--src/game-server/charactercomponent.h4
-rw-r--r--src/game-server/gamehandler.cpp9
-rw-r--r--src/game-server/gamehandler.h2
-rw-r--r--src/game-server/state.cpp4
5 files changed, 15 insertions, 14 deletions
diff --git a/src/game-server/charactercomponent.cpp b/src/game-server/charactercomponent.cpp
index 23a1bd4b..89f3eeb3 100644
--- a/src/game-server/charactercomponent.cpp
+++ b/src/game-server/charactercomponent.cpp
@@ -111,8 +111,7 @@ CharacterComponent::CharacterComponent(Entity &entity, MessageIn &msg):
beingComponent->signal_attribute_changed.connect(sigc::mem_fun(
this, &CharacterComponent::attributeChanged));
- entity.signal_inserted.connect(sigc::mem_fun(this,
- &CharacterComponent::inserted));
+ sendFullInfo(entity);
}
CharacterComponent::~CharacterComponent()
@@ -587,9 +586,8 @@ void CharacterComponent::triggerLoginCallback(Entity &entity)
executeCallback(mLoginCallback, entity);
}
-void CharacterComponent::inserted(Entity *entity)
+void CharacterComponent::sendFullInfo(Entity &entity)
{
- Inventory(entity).sendFull();
- modifiedAllAbilities(*entity);
- modifiedAllAttributes(*entity);
+ modifiedAllAbilities(entity);
+ modifiedAllAttributes(entity);
}
diff --git a/src/game-server/charactercomponent.h b/src/game-server/charactercomponent.h
index a739e691..0e5d5ffd 100644
--- a/src/game-server/charactercomponent.h
+++ b/src/game-server/charactercomponent.h
@@ -279,6 +279,8 @@ class CharacterComponent : public Component
void triggerLoginCallback(Entity &entity);
+ void sendFullInfo(Entity &entity);
+
sigc::signal<void, Entity &> signal_disconnected;
void serialize(Entity &entity, MessageOut &msg);
@@ -289,8 +291,6 @@ class CharacterComponent : public Component
CharacterComponent(const CharacterComponent &);
CharacterComponent &operator=(const CharacterComponent &);
- void inserted(Entity *entity);
-
void abilityStatusChanged(int id);
void abilityCooldownActivated();
diff --git a/src/game-server/gamehandler.cpp b/src/game-server/gamehandler.cpp
index 2cd1c704..fa2c273f 100644
--- a/src/game-server/gamehandler.cpp
+++ b/src/game-server/gamehandler.cpp
@@ -79,7 +79,7 @@ void GameHandler::computerDisconnected(NetComputer *comp)
delete &computer;
}
-void GameHandler::killConnection(Entity *ch)
+void GameHandler::detachClient(Entity *ch)
{
auto *component = ch->getComponent<CharacterComponent>();
GameClient *client = component->getClient();
@@ -364,7 +364,7 @@ void GameHandler::addPendingCharacter(const std::string &token, Entity *ch)
delete ch;
GameState::remove(old_ch);
- killConnection(old_ch);
+ detachClient(old_ch);
MessageOut msg(GPMSG_CONNECT_RESPONSE);
msg.writeInt8(ERRMSG_LOGIN_WAS_TAKEN_OVER);
c->disconnect(msg);
@@ -393,7 +393,7 @@ void GameHandler::tokenMatched(GameClient *computer, Entity *character)
if (!GameState::insert(character))
{
result.writeInt8(ERRMSG_SERVER_FULL);
- killConnection(character);
+ detachClient(character);
delete character;
computer->disconnect(result);
return;
@@ -403,6 +403,9 @@ void GameHandler::tokenMatched(GameClient *computer, Entity *character)
result.writeInt8(ERRMSG_OK);
computer->send(result);
+
+ Inventory(character).sendFull();
+ characterComponent->sendFullInfo(*character);
}
void GameHandler::deletePendingClient(GameClient *computer)
diff --git a/src/game-server/gamehandler.h b/src/game-server/gamehandler.h
index b8a1b636..4134704e 100644
--- a/src/game-server/gamehandler.h
+++ b/src/game-server/gamehandler.h
@@ -65,7 +65,7 @@ class GameHandler: public ConnectionHandler
/**
* Kills connection with given character.
*/
- void killConnection(Entity *);
+ void detachClient(Entity *);
/**
* Prepares a server change for given character.
diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp
index 281b80c2..f690b661 100644
--- a/src/game-server/state.cpp
+++ b/src/game-server/state.cpp
@@ -524,7 +524,7 @@ void GameState::update(int tick)
if (o->getType() == OBJECT_CHARACTER)
{
o->getComponent<CharacterComponent>()->disconnected(*o);
- gameHandler->killConnection(o);
+ gameHandler->detachClient(o);
}
delete o;
break;
@@ -770,7 +770,7 @@ void GameState::warp(Entity *ptr, MapComposite *map, const Point &point)
if (!insert(ptr))
{
characterComponent->disconnected(*ptr);
- gameHandler->killConnection(ptr);
+ gameHandler->detachClient(ptr);
delete ptr;
}
}