diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2009-10-29 22:10:44 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2009-10-29 22:10:44 +0100 |
commit | a5943d58c2fd81cc24e06cc44b55852a217d7c62 (patch) | |
tree | 1f432909379be2e719229a9c4f8b93cf17e431ac | |
parent | c8bb01e2284b0570872be5f638b640d22ae247c8 (diff) | |
download | mana-a5943d58c2fd81cc24e06cc44b55852a217d7c62.tar.gz mana-a5943d58c2fd81cc24e06cc44b55852a217d7c62.tar.bz2 mana-a5943d58c2fd81cc24e06cc44b55852a217d7c62.tar.xz mana-a5943d58c2fd81cc24e06cc44b55852a217d7c62.zip |
Some random cleanups
-rw-r--r-- | src/game.cpp | 88 | ||||
-rw-r--r-- | src/gui/charselectdialog.cpp | 6 | ||||
-rw-r--r-- | src/net/charhandler.h | 4 | ||||
-rw-r--r-- | src/net/ea/charserverhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/ea/gamehandler.cpp | 3 |
5 files changed, 49 insertions, 56 deletions
diff --git a/src/game.cpp b/src/game.cpp index 644da530..ae079af2 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -317,50 +317,50 @@ Game::Game(): { done = false; - createGuiWindows(); - - mWindowMenu = new WindowMenu; - windowContainer->add(mWindowMenu); - - initEngines(); - - // Initialize logic and seconds counters - tick_time = 0; - mLogicCounterId = SDL_AddTimer(MILLISECONDS_IN_A_TICK, nextTick, NULL); - mSecondsCounterId = SDL_AddTimer(1000, nextSecond, NULL); - - // This part is eAthena specific - // For Manaserv, the map is obtained - // with the GPMSG_PLAYER_MAP_CHANGE flag. - map_path = map_path.substr(0, map_path.rfind(".")); - if (!map_path.empty()) - engine->changeMap(map_path); - - // Initialize beings - beingManager->setPlayer(player_node); - - /* - * To prevent the server from sending data before the client - * has initialized, I've modified it to wait for a "ping" - * from the client to complete its initialization - * - * Note: This only affects the latest eAthena version. This - * packet is handled by the older version, but its response - * is ignored by the client - */ - Net::getGameHandler()->ping(tick_time); - - // Initialize frame limiting - config.addListener("fpslimit", this); - optionChanged("fpslimit"); - - Joystick::init(); - // TODO: The user should be able to choose which one to use - // Open the first device - if (Joystick::getNumberOfJoysticks() > 0) - joystick = new Joystick(0); - - setupWindow->setInGame(true); + createGuiWindows(); + + mWindowMenu = new WindowMenu; + windowContainer->add(mWindowMenu); + + initEngines(); + + // Initialize logic and seconds counters + tick_time = 0; + mLogicCounterId = SDL_AddTimer(MILLISECONDS_IN_A_TICK, nextTick, NULL); + mSecondsCounterId = SDL_AddTimer(1000, nextSecond, NULL); + + // This part is eAthena specific + // For Manaserv, the map is obtained + // with the GPMSG_PLAYER_MAP_CHANGE flag. + map_path = map_path.substr(0, map_path.rfind(".")); + if (!map_path.empty()) + engine->changeMap(map_path); + + // Initialize beings + beingManager->setPlayer(player_node); + + /* + * To prevent the server from sending data before the client + * has initialized, I've modified it to wait for a "ping" + * from the client to complete its initialization + * + * Note: This only affects the latest eAthena version. This + * packet is handled by the older version, but its response + * is ignored by the client + */ + Net::getGameHandler()->ping(tick_time); + + // Initialize frame limiting + config.addListener("fpslimit", this); + optionChanged("fpslimit"); + + Joystick::init(); + // TODO: The user should be able to choose which one to use + // Open the first device + if (Joystick::getNumberOfJoysticks() > 0) + joystick = new Joystick(0); + + setupWindow->setInGame(true); } Game::~Game() diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 85d97e6b..9421f77a 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -41,12 +41,6 @@ #include "main.h" #include "units.h" -#ifdef MANASERV_SUPPORT -#include "net/manaserv/accountserver/account.h" -#else -#include "net/ea/protocol.h" -#endif - #include "net/charhandler.h" #include "net/logindata.h" #include "net/loginhandler.h" diff --git a/src/net/charhandler.h b/src/net/charhandler.h index f3d7a6bc..4cace541 100644 --- a/src/net/charhandler.h +++ b/src/net/charhandler.h @@ -46,13 +46,13 @@ class CharHandler virtual void getCharacters() = 0; - virtual void chooseCharacter(int slot, LocalPlayer* character) = 0; + virtual void chooseCharacter(int slot, LocalPlayer *character) = 0; virtual void newCharacter(const std::string &name, int slot, bool gender, int hairstyle, int hairColor, std::vector<int> stats) = 0; - virtual void deleteCharacter(int slot, LocalPlayer* character) = 0; + virtual void deleteCharacter(int slot, LocalPlayer *character) = 0; }; } // namespace Net diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index 0f93efb8..b578fab9 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -257,7 +257,7 @@ void CharServerHandler::getCharacters() connect(); } -void CharServerHandler::chooseCharacter(int slot, LocalPlayer* character) +void CharServerHandler::chooseCharacter(int slot, LocalPlayer *) { MessageOut outMsg(CMSG_CHAR_SELECT); outMsg.writeInt8(slot); @@ -277,7 +277,7 @@ void CharServerHandler::newCharacter(const std::string &name, int slot, outMsg.writeInt16(hairstyle); } -void CharServerHandler::deleteCharacter(int slot, LocalPlayer* character) +void CharServerHandler::deleteCharacter(int slot, LocalPlayer *character) { MessageOut outMsg(CMSG_CHAR_DELETE); outMsg.writeInt32(character->getId()); diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index a3c0ad3a..012e6f8c 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -59,12 +59,11 @@ GameHandler::GameHandler() void GameHandler::handleMessage(MessageIn &msg) { - unsigned char direction; - switch (msg.getId()) { case SMSG_MAP_LOGIN_SUCCESS: { + unsigned char direction; Uint16 x, y; msg.readInt32(); // server tick msg.readCoordinates(x, y, direction); |