summaryrefslogtreecommitdiff
path: root/src/game-server
diff options
context:
space:
mode:
Diffstat (limited to 'src/game-server')
-rw-r--r--src/game-server/character.cpp6
-rw-r--r--src/game-server/character.h6
-rw-r--r--src/game-server/gamehandler.cpp2
3 files changed, 14 insertions, 0 deletions
diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp
index 4816f3c1..71427342 100644
--- a/src/game-server/character.cpp
+++ b/src/game-server/character.cpp
@@ -55,6 +55,7 @@ const float Character::EXP_LEVEL_FLEXIBILITY = 1.0f;
Script::Ref Character::mDeathCallback;
Script::Ref Character::mDeathAcceptedCallback;
+Script::Ref Character::mLoginCallback;
static bool executeCallback(Script::Ref function, Character *character)
{
@@ -830,3 +831,8 @@ void Character::clearSpecials()
{
mSpecials.clear();
}
+
+void Character::triggerLoginCallback()
+{
+ executeCallback(mLoginCallback, this);
+}
diff --git a/src/game-server/character.h b/src/game-server/character.h
index b465a90e..b5ef578a 100644
--- a/src/game-server/character.h
+++ b/src/game-server/character.h
@@ -419,6 +419,11 @@ class Character : public Being
static void setDeathAcceptedCallback(Script *script)
{ script->assignCallback(mDeathAcceptedCallback); }
+ static void setLoginCallback(Script *script)
+ { script->assignCallback(mLoginCallback); }
+
+ void triggerLoginCallback();
+
protected:
/**
* Gets the way the actor blocks pathfinding for other objects
@@ -524,6 +529,7 @@ class Character : public Being
static Script::Ref mDeathCallback;
static Script::Ref mDeathAcceptedCallback;
+ static Script::Ref mLoginCallback;
// Set as a friend, but still a lot of redundant accessors. FIXME.
template< class T >
diff --git a/src/game-server/gamehandler.cpp b/src/game-server/gamehandler.cpp
index f7ee6af4..8b8c67a3 100644
--- a/src/game-server/gamehandler.cpp
+++ b/src/game-server/gamehandler.cpp
@@ -371,6 +371,8 @@ void GameHandler::tokenMatched(GameClient *computer, Character *character)
computer->disconnect(result);
return;
}
+ // Trigger login script bind
+ character->triggerLoginCallback();
result.writeInt8(ERRMSG_OK);
computer->send(result);