summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-08-28 18:01:15 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-08-28 18:01:15 +0000
commitb506fe0ff8a2039167aa7c349087af4dd03e1921 (patch)
tree36989bca6fa259815f92e1d3553b4cc97d8f8133 /src/game.cpp
parentb98b6256262da9aafd9e8e1f93744db321d4d1ad (diff)
downloadmana-client-b506fe0ff8a2039167aa7c349087af4dd03e1921.tar.gz
mana-client-b506fe0ff8a2039167aa7c349087af4dd03e1921.tar.bz2
mana-client-b506fe0ff8a2039167aa7c349087af4dd03e1921.tar.xz
mana-client-b506fe0ff8a2039167aa7c349087af4dd03e1921.zip
Applied patch put together by Jaxad0127 with changes from the Aethyra project.
Improves compatibility with the newer version of eAthena and works around an initialization bug.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 37375ca2..aaf5242c 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -69,6 +69,7 @@
#include "gui/trade.h"
#include "gui/viewport.h"
+#include "net/protocol.h"
#include "net/beinghandler.h"
#include "net/buysellhandler.h"
#include "net/chathandler.h"
@@ -80,6 +81,7 @@
#include "net/playerhandler.h"
#include "net/skillhandler.h"
#include "net/tradehandler.h"
+#include "net/messageout.h"
#include "resources/imagewriter.h"
@@ -260,7 +262,7 @@ void destroyGuiWindows()
Game::Game(Network *network):
mNetwork(network),
- mBeingHandler(new BeingHandler()),
+ mBeingHandler(new BeingHandler(config.getValue("EnableSync", 0) == 1)),
mBuySellHandler(new BuySellHandler()),
mChatHandler(new ChatHandler()),
mEquipmentHandler(new EquipmentHandler()),
@@ -291,7 +293,6 @@ Game::Game(Network *network):
// Initialize beings
beingManager->setPlayer(player_node);
player_node->setNetwork(network);
- engine->changeMap(map_path);
Joystick::init();
// TODO: The user should be able to choose which one to use
@@ -311,6 +312,25 @@ Game::Game(Network *network):
network->registerHandler(mPlayerHandler.get());
network->registerHandler(mSkillHandler.get());
network->registerHandler(mTradeHandler.get());
+
+ /*
+ * THIS IS A TEMPORARY WORKAROUND!
+ *
+ * To prevent the server from sending data before the client has
+ * initialized, it's been modified to wait for a "ping" from the client to
+ * complete its initialization.
+ *
+ * The real fix is to make sure we are not throwing away messages in the
+ * network buffer due to not having registered the handlers above straight
+ * after receiving a login success from the map server.
+ *
+ * The response from eAthena on this packet is ignored by the client.
+ */
+ MessageOut msg(mNetwork);
+ msg.writeInt16(CMSG_CLIENT_PING);
+ msg.writeInt32(tick_time);
+
+ engine->changeMap(map_path);
}
Game::~Game()