summaryrefslogtreecommitdiff
path: root/src/net/ea/charserverhandler.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-04-12 14:46:06 -0600
committerJared Adams <jaxad0127@gmail.com>2010-04-12 15:15:37 -0600
commit612c842f32fec68ece4244ac672a1b889cf2eb18 (patch)
tree8682f225a4681e281505bd0f4c501be701228a9e /src/net/ea/charserverhandler.cpp
parentf30f3e6a51fc20bded8a3a04cd3a0f328a064469 (diff)
downloadmana-612c842f32fec68ece4244ac672a1b889cf2eb18.tar.gz
mana-612c842f32fec68ece4244ac672a1b889cf2eb18.tar.bz2
mana-612c842f32fec68ece4244ac672a1b889cf2eb18.tar.xz
mana-612c842f32fec68ece4244ac672a1b889cf2eb18.zip
Add support for map-server switching under eAthena
Also do some cleanup that's been needed for a while. Reviewed-by: Bertram
Diffstat (limited to 'src/net/ea/charserverhandler.cpp')
-rw-r--r--src/net/ea/charserverhandler.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp
index f0a13f43..64e1d427 100644
--- a/src/net/ea/charserverhandler.cpp
+++ b/src/net/ea/charserverhandler.cpp
@@ -33,6 +33,7 @@
#include "net/messageout.h"
#include "net/net.h"
+#include "net/ea/gamehandler.h"
#include "net/ea/loginhandler.h"
#include "net/ea/network.h"
#include "net/ea/protocol.h"
@@ -60,6 +61,7 @@ CharServerHandler::CharServerHandler()
SMSG_CHAR_DELETE_SUCCEEDED,
SMSG_CHAR_DELETE_FAILED,
SMSG_CHAR_MAP_INFO,
+ SMSG_CHANGE_MAP_SERVER,
0
};
handledMessages = _messages;
@@ -153,8 +155,10 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg)
break;
case SMSG_CHAR_MAP_INFO:
+ {
msg.skip(4); // CharID, must be the same as player_node->charID
- map_path = msg.readString(16);
+ GameHandler *gh = static_cast<GameHandler*>(Net::getGameHandler());
+ gh->setMap(msg.readString(16));
mapServer.hostname = ipToString(msg.readInt32());
mapServer.port = msg.readInt16();
@@ -168,7 +172,24 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg)
mNetwork->disconnect();
Client::setState(STATE_CONNECT_GAME);
- break;
+ }
+ break;
+
+ case SMSG_CHANGE_MAP_SERVER:
+ {
+ GameHandler *gh = static_cast<GameHandler*>(Net::getGameHandler());
+ gh->setMap(msg.readString(16));
+ int x = msg.readInt16();
+ int y = msg.readInt16();
+ mapServer.hostname = ipToString(msg.readInt32());
+ mapServer.port = msg.readInt16();
+
+ mNetwork->disconnect();
+ Client::setState(STATE_CHANGE_MAP);
+ player_node->setTileCoords(x, y);
+ player_node->setMap(0);
+ }
+ break;
}
}