From a5943d58c2fd81cc24e06cc44b55852a217d7c62 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Thu, 29 Oct 2009 22:10:44 +0100 Subject: Some random cleanups --- src/game.cpp | 88 ++++++++++++++++++++-------------------- src/gui/charselectdialog.cpp | 6 --- src/net/charhandler.h | 4 +- src/net/ea/charserverhandler.cpp | 4 +- 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 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); -- cgit v1.2.3-70-g09d2