textmessage

This commit is contained in:
Henrique
2011-09-04 14:21:42 -03:00
parent bdbfa5b6ac
commit b69dc5487f
6 changed files with 69 additions and 19 deletions

View File

@@ -97,9 +97,9 @@ void Game::processLogout()
}
}
void Game::processTextMessage(const std::string& message)
void Game::processTextMessage(int type, const std::string& message)
{
g_lua.callGlobalField("Game","onTextMessage", message);
g_lua.callGlobalField("Game","onTextMessage", type, message);
}
void Game::walk(Otc::Direction direction)

View File

@@ -44,7 +44,7 @@ public:
void processLogin(const LocalPlayerPtr& localPlayer);
void processLogout();
void processTextMessage(const std::string& message);
void processTextMessage(int type, const std::string& message);
void walk(Otc::Direction direction);
void turn(Otc::Direction direction);

View File

@@ -734,11 +734,11 @@ void ProtocolGame::parseClosePrivateChannel(InputMessage& msg)
void ProtocolGame::parseTextMessage(InputMessage& msg)
{
msg.getU8(); // messageType
uint8 type = msg.getU8();
std::string message = msg.getString();
// must be scheduled because the map may not exist yet
g_dispatcher.addEvent(std::bind(&Game::processTextMessage, &g_game, message));
g_dispatcher.addEvent(std::bind(&Game::processTextMessage, &g_game, type, message));
}
void ProtocolGame::parseCancelWalk(InputMessage& msg)