From 5580ebe8946534e71caf63f423824abbf43aa282 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 27 Feb 2010 00:48:39 +0200 Subject: Fix calling setMap on deleted viewport Signed-off-by: Jared Adams --- src/game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/game.cpp b/src/game.cpp index b3670641..c474d41b 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -275,10 +275,10 @@ Game::~Game() delete commandHandler; delete joystick; delete particleEngine; - delete viewport; viewport->setMap(NULL); + delete viewport; delete mCurrentMap; map_path = ""; -- cgit v1.2.3-70-g09d2 From 01c3edf0d8692ecf6c45ae4e04abf2d0b1f41c6b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 27 Feb 2010 01:55:08 +0200 Subject: Fix configuration saving on exit. Some settings are set after the old position. Signed-off-by: Jared Adams --- src/client.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/client.cpp b/src/client.cpp index cd40615b..b95076ff 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -400,8 +400,6 @@ Client::~Client() delete itemShortcut; delete emoteShortcut; - config.write(); - delete gui; delete graphics; @@ -425,6 +423,9 @@ Client::~Client() logger->log("Quitting"); delete guiPalette; + + config.write(); + delete logger; mInstance = 0; -- cgit v1.2.3-70-g09d2 From 12f9c5639d74747d5e22ec29c1df8d09256b8772 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sat, 27 Feb 2010 08:56:38 -0700 Subject: Disable guilds for eAthena for now MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Thorbjørn Lindeijer --- src/gui/socialwindow.cpp | 10 +++++++--- src/net/ea/generalhandler.cpp | 3 +++ src/net/ea/generalhandler.h | 1 + src/net/guildhandler.h | 6 ++++-- src/net/manaserv/guildhandler.h | 2 ++ 5 files changed, 17 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index 26184cae..5da8018c 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -235,7 +235,8 @@ public: mBrowserBox->setOpaque(false); mBrowserBox->setLinkHandler(this); - mBrowserBox->addRow(strprintf("@@guild|%s@@", _("Create Guild"))); + if (Net::getGuildHandler()->isSupported()) + mBrowserBox->addRow(strprintf("@@guild|%s@@", _("Create Guild"))); mBrowserBox->addRow(strprintf("@@party|%s@@", _("Create Party"))); mBrowserBox->addRow("##3---"); mBrowserBox->addRow(strprintf("@@cancel|%s@@", _("Cancel"))); @@ -425,7 +426,10 @@ void SocialWindow::action(const gcn::ActionEvent &event) } else if (event.getId() == "create") { - mCreatePopup->show(mCreateButton); + if (Net::getGuildHandler()->isSupported()) + mCreatePopup->show(mCreateButton); + else + showPartyCreate(); } else if (event.getId() == "invite") { @@ -564,7 +568,7 @@ void SocialWindow::showPartyCreate() } mPartyCreateDialog = new TextDialog(_("Party Name"), - _("Choose your part's name."), this); + _("Choose your party's name."), this); mPartyCreateDialog->setOKButtonActionId("create party"); mPartyCreateDialog->addActionListener(this); } diff --git a/src/net/ea/generalhandler.cpp b/src/net/ea/generalhandler.cpp index 6ca853fb..021ae08d 100644 --- a/src/net/ea/generalhandler.cpp +++ b/src/net/ea/generalhandler.cpp @@ -38,6 +38,7 @@ #include "net/ea/chathandler.h" #include "net/ea/charserverhandler.h" #include "net/ea/gamehandler.h" +#include "net/ea/guildhandler.h" #include "net/ea/inventoryhandler.h" #include "net/ea/itemhandler.h" #include "net/ea/loginhandler.h" @@ -79,6 +80,7 @@ GeneralHandler::GeneralHandler(): mCharHandler(new CharServerHandler), mChatHandler(new ChatHandler), mGameHandler(new GameHandler), + mGuildHandler(new GuildHandler), mInventoryHandler(new InventoryHandler), mItemHandler(new ItemHandler), mLoginHandler(new LoginHandler), @@ -162,6 +164,7 @@ void GeneralHandler::load() mNetwork->registerHandler(mChatHandler.get()); mNetwork->registerHandler(mCharHandler.get()); mNetwork->registerHandler(mGameHandler.get()); + mNetwork->registerHandler(mGuildHandler.get()); mNetwork->registerHandler(mInventoryHandler.get()); mNetwork->registerHandler(mItemHandler.get()); mNetwork->registerHandler(mLoginHandler.get()); diff --git a/src/net/ea/generalhandler.h b/src/net/ea/generalhandler.h index 579b27b5..464f8bc8 100644 --- a/src/net/ea/generalhandler.h +++ b/src/net/ea/generalhandler.h @@ -60,6 +60,7 @@ class GeneralHandler : public MessageHandler, public Net::GeneralHandler MessageHandlerPtr mCharHandler; MessageHandlerPtr mChatHandler; MessageHandlerPtr mGameHandler; + MessageHandlerPtr mGuildHandler; MessageHandlerPtr mInventoryHandler; MessageHandlerPtr mItemHandler; MessageHandlerPtr mLoginHandler; diff --git a/src/net/guildhandler.h b/src/net/guildhandler.h index 75683944..1696b2d5 100644 --- a/src/net/guildhandler.h +++ b/src/net/guildhandler.h @@ -32,6 +32,10 @@ namespace Net { class GuildHandler { public: + virtual ~GuildHandler() {} + + virtual bool isSupported() { return false; } + virtual void create(const std::string &name) = 0; virtual void invite(int guildId, const std::string &name) = 0; @@ -56,8 +60,6 @@ class GuildHandler bool response) = 0; virtual void endAlliance(int guildId, int otherGuildId) = 0; - - virtual ~GuildHandler() {} }; } diff --git a/src/net/manaserv/guildhandler.h b/src/net/manaserv/guildhandler.h index 1b6d51b5..9929d135 100644 --- a/src/net/manaserv/guildhandler.h +++ b/src/net/manaserv/guildhandler.h @@ -33,6 +33,8 @@ class GuildHandler : public Net::GuildHandler, public MessageHandler public: GuildHandler(); + bool isSupported() { return true; } + void handleMessage(Net::MessageIn &msg); void create(const std::string &name); -- cgit v1.2.3-70-g09d2 From 26b6a14eac441e6069701b37255e1eafa532d7f6 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sat, 27 Feb 2010 16:37:03 +0100 Subject: No point in calling Viewport::setMap(0) before deleting it Reviewed-by: Jared Adams --- src/game.cpp | 3 --- src/net/ea/messageout.cpp | 2 +- src/net/ea/network.cpp | 2 +- src/net/ea/network.h | 2 +- src/net/manaserv/messageout.cpp | 2 +- 5 files changed, 4 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/game.cpp b/src/game.cpp index c474d41b..5b0295da 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -275,9 +275,6 @@ Game::~Game() delete commandHandler; delete joystick; delete particleEngine; - - viewport->setMap(NULL); - delete viewport; delete mCurrentMap; map_path = ""; diff --git a/src/net/ea/messageout.cpp b/src/net/ea/messageout.cpp index 9e7f2b15..844580a9 100644 --- a/src/net/ea/messageout.cpp +++ b/src/net/ea/messageout.cpp @@ -125,4 +125,4 @@ void MessageOut::writeCoordinates(unsigned short x, unsigned short y, data[2] |= direction; } -} +} // namespace EAthena diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp index 3b8ad509..0467241f 100644 --- a/src/net/ea/network.cpp +++ b/src/net/ea/network.cpp @@ -475,4 +475,4 @@ Uint16 Network::readWord(int pos) #endif } -} +} // namespace EAthena diff --git a/src/net/ea/network.h b/src/net/ea/network.h index baaefb4a..0b391bf0 100644 --- a/src/net/ea/network.h +++ b/src/net/ea/network.h @@ -125,6 +125,6 @@ class Network static Network *mInstance; }; -} +} // namespace EAthena #endif // NET_EA_NETWORK_H diff --git a/src/net/manaserv/messageout.cpp b/src/net/manaserv/messageout.cpp index 887d91d6..8779c5f6 100644 --- a/src/net/manaserv/messageout.cpp +++ b/src/net/manaserv/messageout.cpp @@ -61,4 +61,4 @@ void MessageOut::writeInt32(Sint32 value) mPos += 4; } -} +} // namespace ManaServ -- cgit v1.2.3-70-g09d2 From f35dacee58e89528d8a6d638075bc96aa5d5ec0e Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sat, 27 Feb 2010 17:17:51 +0100 Subject: Added m prefix to Client's member variables Reviewed-by: Jared Adams --- src/client.cpp | 316 ++++++++++++++++++++++++++++----------------------------- src/client.h | 38 +++---- 2 files changed, 177 insertions(+), 177 deletions(-) (limited to 'src') diff --git a/src/client.cpp b/src/client.cpp index b95076ff..722d8116 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -193,12 +193,12 @@ Client *Client::mInstance = 0; Client::Client(const Options &options): options(options), - currentDialog(0), - quitDialog(0), - desktop(0), - setupButton(0), - state(STATE_CHOOSE_SERVER), - oldstate(STATE_START), + mCurrentDialog(0), + mQuitDialog(0), + mDesktop(0), + mSetupButton(0), + mState(STATE_CHOOSE_SERVER), + mOldState(STATE_START), mLogicCounterId(0), mSecondsCounterId(0), mLimitFps(false) @@ -217,7 +217,7 @@ Client::Client(const Options &options): initHomeDir(options); // Configure logger - logger->setLogFile(localDataDir + std::string("/mana.log")); + logger->setLogFile(mLocalDataDir + std::string("/mana.log")); // Log the mana version logger->log("Mana %s", FULL_VERSION); @@ -243,14 +243,14 @@ Client::Client(const Options &options): ResourceManager *resman = ResourceManager::getInstance(); - if (!resman->setWriteDir(localDataDir)) + if (!resman->setWriteDir(mLocalDataDir)) { logger->error(strprintf("%s couldn't be set as home directory! " - "Exiting.", localDataDir.c_str())); + "Exiting.", mLocalDataDir.c_str())); } // Add the local data directory to PhysicsFS search path - resman->addToSearchPath(localDataDir, false); + resman->addToSearchPath(mLocalDataDir, false); // Add the main data directories to our PhysicsFS search path if (!options.dataPath.empty()) @@ -281,12 +281,12 @@ Client::Client(const Options &options): SetClassLong(pInfo.window, GCL_HICON, (LONG) icon); } #else - icon = IMG_Load(resman->getPath( + mIcon = IMG_Load(resman->getPath( branding.getValue("appIcon", "data/icons/mana.png")).c_str()); - if (icon) + if (mIcon) { - SDL_SetAlpha(icon, SDL_SRCALPHA, SDL_ALPHA_OPAQUE); - SDL_WM_SetIcon(icon, NULL); + SDL_SetAlpha(mIcon, SDL_SRCALPHA, SDL_ALPHA_OPAQUE); + SDL_WM_SetIcon(mIcon, NULL); } #endif @@ -340,7 +340,7 @@ Client::Client(const Options &options): } catch (const char *err) { - state = STATE_ERROR; + mState = STATE_ERROR; errorMessage = err; logger->log("Warning: %s", err); } @@ -357,28 +357,28 @@ Client::Client(const Options &options): sound.playMusic(branding.getValue("loginMusic", "Magick - Real.ogg")); // Initialize default server - currentServer.hostname = options.serverName; - currentServer.port = options.serverPort; + mCurrentServer.hostname = options.serverName; + mCurrentServer.port = options.serverPort; loginData.username = options.username; loginData.password = options.password; loginData.remember = config.getValue("remember", 0); loginData.registerLogin = false; - if (currentServer.hostname.empty()) + if (mCurrentServer.hostname.empty()) { - currentServer.hostname = branding.getValue("defaultServer", + mCurrentServer.hostname = branding.getValue("defaultServer", "server.themanaworld.org").c_str(); } if (options.serverPort == 0) { - currentServer.port = (short) branding.getValue("defaultPort", + mCurrentServer.port = (short) branding.getValue("defaultPort", DEFAULT_PORT); } if (loginData.username.empty() && loginData.remember) loginData.username = config.getValue("username", ""); - if (state != STATE_ERROR) - state = STATE_CHOOSE_SERVER; + if (mState != STATE_ERROR) + mState = STATE_CHOOSE_SERVER; // Initialize logic and seconds counters tick_time = 0; @@ -419,7 +419,7 @@ Client::~Client() ResourceManager::deleteInstance(); - SDL_FreeSurface(icon); + SDL_FreeSurface(mIcon); logger->log("Quitting"); delete guiPalette; @@ -438,7 +438,7 @@ int Client::exec() Game *game = 0; SDL_Event event; - while (state != STATE_EXIT) + while (mState != STATE_EXIT) { bool handledEvents = false; @@ -457,7 +457,7 @@ int Client::exec() switch (event.type) { case SDL_QUIT: - state = STATE_EXIT; + mState = STATE_EXIT; break; case SDL_KEYDOWN: @@ -500,75 +500,75 @@ int Client::exec() // TODO: Add connect timeouts - if (state == STATE_CONNECT_GAME && + if (mState == STATE_CONNECT_GAME && Net::getGameHandler()->isConnected()) { Net::getLoginHandler()->disconnect(); } - else if (state == STATE_CONNECT_SERVER && oldstate == STATE_CHOOSE_SERVER) + else if (mState == STATE_CONNECT_SERVER && mOldState == STATE_CHOOSE_SERVER) { - Net::connectToServer(currentServer); + Net::connectToServer(mCurrentServer); } - else if (state == STATE_CONNECT_SERVER && - oldstate != STATE_CHOOSE_SERVER && + else if (mState == STATE_CONNECT_SERVER && + mOldState != STATE_CHOOSE_SERVER && Net::getLoginHandler()->isConnected()) { - state = STATE_LOGIN; + mState = STATE_LOGIN; } - else if (state == STATE_WORLD_SELECT && oldstate == STATE_UPDATE) + else if (mState == STATE_WORLD_SELECT && mOldState == STATE_UPDATE) { if (Net::getLoginHandler()->getWorlds().size() < 2) { - state = STATE_LOGIN; + mState = STATE_LOGIN; } } - else if (oldstate == STATE_START || - (oldstate == STATE_GAME && state != STATE_GAME)) + else if (mOldState == STATE_START || + (mOldState == STATE_GAME && mState != STATE_GAME)) { gcn::Container *top = static_cast(gui->getTop()); - desktop = new Desktop; - top->add(desktop); - setupButton = new Button(_("Setup"), "Setup", this); - setupButton->setPosition(top->getWidth() - setupButton->getWidth() + mDesktop = new Desktop; + top->add(mDesktop); + mSetupButton = new Button(_("Setup"), "Setup", this); + mSetupButton->setPosition(top->getWidth() - mSetupButton->getWidth() - 3, 3); - top->add(setupButton); + top->add(mSetupButton); int screenWidth = (int) config.getValue("screenwidth", defaultScreenWidth); int screenHeight = (int) config.getValue("screenheight", defaultScreenHeight); - desktop->setSize(screenWidth, screenHeight); + mDesktop->setSize(screenWidth, screenHeight); } - if (state == STATE_SWITCH_LOGIN && oldstate == STATE_GAME) + if (mState == STATE_SWITCH_LOGIN && mOldState == STATE_GAME) { Net::getGameHandler()->disconnect(); } - if (state != oldstate) + if (mState != mOldState) { - if (oldstate == STATE_GAME) + if (mOldState == STATE_GAME) { delete game; game = 0; } - oldstate = state; + mOldState = mState; // Get rid of the dialog of the previous state - if (currentDialog) + if (mCurrentDialog) { - delete currentDialog; - currentDialog = NULL; + delete mCurrentDialog; + mCurrentDialog = NULL; } // State has changed, while the quitDialog was active, it might // not be correct anymore - if (quitDialog) - quitDialog->scheduleDelete(); + if (mQuitDialog) + mQuitDialog->scheduleDelete(); - switch (state) + switch (mState) { case STATE_CHOOSE_SERVER: logger->log("State: CHOOSE SERVER"); @@ -576,29 +576,29 @@ int Client::exec() // Allow changing this using a server choice dialog // We show the dialog box only if the command-line // options weren't set. - if (options.serverName.empty() && options.serverPort == 0) + if (mOptions.serverName.empty() && mOptions.serverPort == 0) { // Don't allow an alpha opacity // lower than the default value SkinLoader::instance()->setMinimumOpacity(0.8f); - currentDialog = new ServerDialog(¤tServer, - configDir); + mCurrentDialog = new ServerDialog(&mCurrentServer, + mConfigDir); } else { - state = STATE_CONNECT_SERVER; + mState = STATE_CONNECT_SERVER; // Reset options so that cancelling or connect // timeout will show the server dialog. - options.serverName.clear(); - options.serverPort = 0; + mOptions.serverName.clear(); + mOptions.serverPort = 0; } break; case STATE_CONNECT_SERVER: logger->log("State: CONNECT SERVER"); - currentDialog = new ConnectionDialog( + mCurrentDialog = new ConnectionDialog( _("Connecting to server"), STATE_SWITCH_SERVER); break; @@ -608,24 +608,24 @@ int Client::exec() // lower than the default value SkinLoader::instance()->setMinimumOpacity(0.8f); - if (options.username.empty() - || options.password.empty()) + if (mOptions.username.empty() + || mOptions.password.empty()) { - currentDialog = new LoginDialog(&loginData); + mCurrentDialog = new LoginDialog(&loginData); } else { - state = STATE_LOGIN_ATTEMPT; + mState = STATE_LOGIN_ATTEMPT; // Clear the password so that when login fails, the // dialog will show up next time. - options.password.clear(); + mOptions.password.clear(); } break; case STATE_LOGIN_ATTEMPT: logger->log("State: LOGIN ATTEMPT"); accountLogin(&loginData); - currentDialog = new ConnectionDialog( + mCurrentDialog = new ConnectionDialog( _("Logging in"), STATE_SWITCH_SERVER); break; @@ -637,19 +637,19 @@ int Client::exec() if (worlds.size() == 0) { // Trust that the netcode knows what it's doing - state = STATE_UPDATE; + mState = STATE_UPDATE; } else if (worlds.size() == 1) { Net::getLoginHandler()->chooseServer(0); - state = STATE_UPDATE; + mState = STATE_UPDATE; } else { - currentDialog = new WorldSelectDialog(worlds); - if (options.chooseDefault) + mCurrentDialog = new WorldSelectDialog(worlds); + if (mOptions.chooseDefault) { - ((WorldSelectDialog*) currentDialog)->action( + ((WorldSelectDialog*) mCurrentDialog)->action( gcn::ActionEvent(NULL, "ok")); } } @@ -658,27 +658,27 @@ int Client::exec() case STATE_WORLD_SELECT_ATTEMPT: logger->log("State: WORLD SELECT ATTEMPT"); - currentDialog = new ConnectionDialog( + mCurrentDialog = new ConnectionDialog( _("Entering game world"), STATE_WORLD_SELECT); break; case STATE_UPDATE: // Determine which source to use for the update host - if (!options.updateHost.empty()) - updateHost = options.updateHost; + if (!mOptions.updateHost.empty()) + mUpdateHost = mOptions.updateHost; else - updateHost = loginData.updateHost; + mUpdateHost = loginData.updateHost; initUpdatesDir(); - if (options.skipUpdate) + if (mOptions.skipUpdate) { - state = STATE_LOAD_DATA; + mState = STATE_LOAD_DATA; } else { logger->log("State: UPDATE"); - currentDialog = new UpdaterWindow(updateHost, - localDataDir + "/" + updatesDir,options.dataPath.empty()); + mCurrentDialog = new UpdaterWindow(mUpdateHost, + mLocalDataDir + "/" + mUpdatesDir,mOptions.dataPath.empty()); } break; @@ -687,7 +687,7 @@ int Client::exec() // If another data path has been set, // we don't load any other files... - if (options.dataPath.empty()) + if (mOptions.dataPath.empty()) { // Add customdata directory ResourceManager::getInstance()->searchAndAddArchives( @@ -706,15 +706,15 @@ int Client::exec() StatusEffect::load(); Units::loadUnits(); - desktop->reloadWallpaper(); + mDesktop->reloadWallpaper(); - state = STATE_GET_CHARACTERS; + mState = STATE_GET_CHARACTERS; break; case STATE_GET_CHARACTERS: logger->log("State: GET CHARACTERS"); Net::getCharHandler()->requestCharacters(); - currentDialog = new ConnectionDialog( + mCurrentDialog = new ConnectionDialog( _("Requesting characters"), STATE_SWITCH_SERVER); break; @@ -725,14 +725,14 @@ int Client::exec() // lower than the default value SkinLoader::instance()->setMinimumOpacity(0.8f); - currentDialog = new CharSelectDialog(&loginData); + mCurrentDialog = new CharSelectDialog(&loginData); - if (!((CharSelectDialog*) currentDialog)->selectByName( - options.character, CharSelectDialog::Choose)) + if (!((CharSelectDialog*) mCurrentDialog)->selectByName( + mOptions.character, CharSelectDialog::Choose)) { - ((CharSelectDialog*) currentDialog)->selectByName( + ((CharSelectDialog*) mCurrentDialog)->selectByName( config.getValue("lastCharacter", ""), - options.chooseDefault ? + mOptions.chooseDefault ? CharSelectDialog::Choose : CharSelectDialog::Focus); } @@ -743,7 +743,7 @@ int Client::exec() logger->log("State: CONNECT GAME"); Net::getGameHandler()->connect(); - currentDialog = new ConnectionDialog( + mCurrentDialog = new ConnectionDialog( _("Connecting to the game server"), STATE_SWITCH_CHARACTER); break; @@ -762,12 +762,12 @@ int Client::exec() // Allow any alpha opacity SkinLoader::instance()->setMinimumOpacity(-1.0f); - delete setupButton; - delete desktop; - setupButton = NULL; - desktop = NULL; + delete mSetupButton; + delete mDesktop; + mSetupButton = NULL; + mDesktop = NULL; - currentDialog = NULL; + mCurrentDialog = NULL; logger->log("State: GAME"); game = new Game; @@ -775,28 +775,28 @@ int Client::exec() case STATE_LOGIN_ERROR: logger->log("State: LOGIN ERROR"); - currentDialog = new OkDialog(_("Error"), errorMessage); - currentDialog->addActionListener(&loginListener); - currentDialog = NULL; // OkDialog deletes itself + mCurrentDialog = new OkDialog(_("Error"), errorMessage); + mCurrentDialog->addActionListener(&loginListener); + mCurrentDialog = NULL; // OkDialog deletes itself break; case STATE_ACCOUNTCHANGE_ERROR: logger->log("State: ACCOUNT CHANGE ERROR"); - currentDialog = new OkDialog(_("Error"), errorMessage); - currentDialog->addActionListener(&accountListener); - currentDialog = NULL; // OkDialog deletes itself + mCurrentDialog = new OkDialog(_("Error"), errorMessage); + mCurrentDialog->addActionListener(&accountListener); + mCurrentDialog = NULL; // OkDialog deletes itself break; case STATE_REGISTER_PREP: logger->log("State: REGISTER_PREP"); Net::getLoginHandler()->getRegistrationDetails(); - currentDialog = new ConnectionDialog( + mCurrentDialog = new ConnectionDialog( _("Requesting registration details"), STATE_LOGIN); break; case STATE_REGISTER: logger->log("State: REGISTER"); - currentDialog = new RegisterDialog(&loginData); + mCurrentDialog = new RegisterDialog(&loginData); break; case STATE_REGISTER_ATTEMPT: @@ -806,7 +806,7 @@ int Client::exec() case STATE_CHANGEPASSWORD: logger->log("State: CHANGE PASSWORD"); - currentDialog = new ChangePasswordDialog(&loginData); + mCurrentDialog = new ChangePasswordDialog(&loginData); break; case STATE_CHANGEPASSWORD_ATTEMPT: @@ -818,17 +818,17 @@ int Client::exec() case STATE_CHANGEPASSWORD_SUCCESS: logger->log("State: CHANGE PASSWORD SUCCESS"); - currentDialog = new OkDialog(_("Password Change"), + mCurrentDialog = new OkDialog(_("Password Change"), _("Password changed successfully!")); - currentDialog->addActionListener(&accountListener); - currentDialog = NULL; // OkDialog deletes itself + mCurrentDialog->addActionListener(&accountListener); + mCurrentDialog = NULL; // OkDialog deletes itself loginData.password = loginData.newPassword; loginData.newPassword = ""; break; case STATE_CHANGEEMAIL: logger->log("State: CHANGE EMAIL"); - currentDialog = new ChangeEmailDialog(&loginData); + mCurrentDialog = new ChangeEmailDialog(&loginData); break; case STATE_CHANGEEMAIL_ATTEMPT: @@ -838,15 +838,15 @@ int Client::exec() case STATE_CHANGEEMAIL_SUCCESS: logger->log("State: CHANGE EMAIL SUCCESS"); - currentDialog = new OkDialog(_("Email Change"), + mCurrentDialog = new OkDialog(_("Email Change"), _("Email changed successfully!")); - currentDialog->addActionListener(&accountListener); - currentDialog = NULL; // OkDialog deletes itself + mCurrentDialog->addActionListener(&accountListener); + mCurrentDialog = NULL; // OkDialog deletes itself break; case STATE_UNREGISTER: logger->log("State: UNREGISTER"); - currentDialog = new UnRegisterDialog(&loginData); + mCurrentDialog = new UnRegisterDialog(&loginData); break; case STATE_UNREGISTER_ATTEMPT: @@ -859,12 +859,12 @@ int Client::exec() logger->log("State: UNREGISTER SUCCESS"); Net::getLoginHandler()->disconnect(); - currentDialog = new OkDialog(_("Unregister Successful"), + mCurrentDialog = new OkDialog(_("Unregister Successful"), _("Farewell, come back any time...")); loginData.clear(); //The errorlistener sets the state to STATE_CHOOSE_SERVER - currentDialog->addActionListener(&errorListener); - currentDialog = NULL; // OkDialog deletes itself + mCurrentDialog->addActionListener(&errorListener); + mCurrentDialog = NULL; // OkDialog deletes itself break; case STATE_SWITCH_SERVER: @@ -873,7 +873,7 @@ int Client::exec() Net::getLoginHandler()->disconnect(); Net::getGameHandler()->disconnect(); - state = STATE_CHOOSE_SERVER; + mState = STATE_CHOOSE_SERVER; break; case STATE_SWITCH_LOGIN: @@ -881,7 +881,7 @@ int Client::exec() Net::getLoginHandler()->logout(); - state = STATE_LOGIN; + mState = STATE_LOGIN; break; case STATE_SWITCH_CHARACTER: @@ -911,19 +911,19 @@ int Client::exec() logger->log("State: FORCE QUIT"); if (Net::getGeneralHandler()) Net::getGeneralHandler()->unload(); - state = STATE_EXIT; + mState = STATE_EXIT; break; case STATE_ERROR: logger->log("State: ERROR"); - currentDialog = new OkDialog(_("Error"), errorMessage); - currentDialog->addActionListener(&errorListener); - currentDialog = NULL; // OkDialog deletes itself + mCurrentDialog = new OkDialog(_("Error"), errorMessage); + mCurrentDialog->addActionListener(&errorListener); + mCurrentDialog = NULL; // OkDialog deletes itself Net::getGameHandler()->disconnect(); break; default: - state = STATE_FORCE_QUIT; + mState = STATE_FORCE_QUIT; break; } } @@ -961,9 +961,9 @@ void Client::action(const gcn::ActionEvent &event) */ void Client::initHomeDir(const Options &options) { - localDataDir = options.localDataDir; + mLocalDataDir = options.localDataDir; - if (localDataDir.empty()) + if (mLocalDataDir.empty()) { #ifdef __APPLE__ // Use Application Directory instead of .mana @@ -976,20 +976,20 @@ void Client::initHomeDir(const Options &options) localDataDir = std::string(PHYSFS_getUserDir()); localDataDir += "/Mana"; #else - localDataDir = std::string(PHYSFS_getUserDir()) + + mLocalDataDir = std::string(PHYSFS_getUserDir()) + "/.local/share/mana"; #endif } - if (mkdir_r(localDataDir.c_str())) + if (mkdir_r(mLocalDataDir.c_str())) { logger->error(strprintf(_("%s doesn't exist and can't be created! " - "Exiting."), localDataDir.c_str())); + "Exiting."), mLocalDataDir.c_str())); } - configDir = options.configDir; + mConfigDir = options.configDir; - if (configDir.empty()){ + if (mConfigDir.empty()){ #ifdef __APPLE__ configDir = localDataDir; #elif defined WIN32 @@ -999,15 +999,15 @@ void Client::initHomeDir(const Options &options) else configDir += "/mana/" + branding.getValue("appName", "Mana"); #else - configDir = std::string(PHYSFS_getUserDir()) + + mConfigDir = std::string(PHYSFS_getUserDir()) + "/.config/mana/" + branding.getValue("appShort", "mana"); #endif } - if (mkdir_r(configDir.c_str())) + if (mkdir_r(mConfigDir.c_str())) { logger->error(strprintf(_("%s doesn't exist and can't be created! " - "Exiting."), configDir.c_str())); + "Exiting."), mConfigDir.c_str())); } } @@ -1047,7 +1047,7 @@ void Client::initConfiguration(const Options &options) FILE *configFile = 0; std::string configPath; - configPath = configDir + "/config.xml"; + configPath = mConfigDir + "/config.xml"; configFile = fopen(configPath.c_str(), "r"); @@ -1077,47 +1077,47 @@ void Client::initUpdatesDir() std::stringstream updates; // If updatesHost is currently empty, fill it from config file - if (updateHost.empty()) + if (mUpdateHost.empty()) { - updateHost = + mUpdateHost = config.getValue("updatehost", "http://updates.themanaworld.org/"); } // Remove any trailing slash at the end of the update host - if (updateHost.at(updateHost.size() - 1) == '/') - updateHost.resize(updateHost.size() - 1); + if (mUpdateHost.at(mUpdateHost.size() - 1) == '/') + mUpdateHost.resize(mUpdateHost.size() - 1); // Parse out any "http://" or "ftp://", and set the updates directory size_t pos; - pos = updateHost.find("://"); - if (pos != updateHost.npos) + pos = mUpdateHost.find("://"); + if (pos != mUpdateHost.npos) { - if (pos + 3 < updateHost.length()) + if (pos + 3 < mUpdateHost.length()) { - updates << "updates/" << updateHost.substr(pos + 3); - updatesDir = updates.str(); + updates << "updates/" << mUpdateHost.substr(pos + 3); + mUpdatesDir = updates.str(); } else { - logger->log("Error: Invalid update host: %s", updateHost.c_str()); + logger->log("Error: Invalid update host: %s", mUpdateHost.c_str()); errorMessage = strprintf(_("Invalid update host: %s"), - updateHost.c_str()); - state = STATE_ERROR; + mUpdateHost.c_str()); + mState = STATE_ERROR; } } else { logger->log("Warning: no protocol was specified for the update host"); - updates << "updates/" << updateHost; - updatesDir = updates.str(); + updates << "updates/" << mUpdateHost; + mUpdatesDir = updates.str(); } ResourceManager *resman = ResourceManager::getInstance(); // Verify that the updates directory exists. Create if necessary. - if (!resman->isDirectory("/" + updatesDir)) + if (!resman->isDirectory("/" + mUpdatesDir)) { - if (!resman->mkdir("/" + updatesDir)) + if (!resman->mkdir("/" + mUpdatesDir)) { #if defined WIN32 std::string newDir = localDataDir + "\\" + updatesDir; @@ -1139,9 +1139,9 @@ void Client::initUpdatesDir() } #else logger->log("Error: %s/%s can't be made, but doesn't exist!", - localDataDir.c_str(), updatesDir.c_str()); + mLocalDataDir.c_str(), mUpdatesDir.c_str()); errorMessage = _("Error creating updates directory!"); - state = STATE_ERROR; + mState = STATE_ERROR; #endif } } @@ -1150,13 +1150,13 @@ void Client::initUpdatesDir() void Client::initScreenshotDir(const std::string &dir) { if (!dir.empty()) - screenshotDir = dir; + mScreenshotDir = dir; else { std::string configScreenshotDir = config.getValue("screenshotDirectory", ""); if (!configScreenshotDir.empty()) - screenshotDir = configScreenshotDir; + mScreenshotDir = configScreenshotDir; else { #ifdef WIN32 @@ -1164,14 +1164,14 @@ void Client::initScreenshotDir(const std::string &dir) if (screenshotDir.empty()) screenshotDir = getSpecialFolderLocation(CSIDL_DESKTOP); #else - screenshotDir = std::string(PHYSFS_getUserDir()) + "Desktop"; + mScreenshotDir = std::string(PHYSFS_getUserDir()) + "Desktop"; // If ~/Desktop does not exist, we save screenshots in the user's home. struct stat statbuf; - if (stat(screenshotDir.c_str(), &statbuf)) - screenshotDir = std::string(PHYSFS_getUserDir()); + if (stat(mScreenshotDir.c_str(), &statbuf)) + mScreenshotDir = std::string(PHYSFS_getUserDir()); #endif } - config.setValue("screenshotDirectory", screenshotDir); + config.setValue("screenshotDirectory", mScreenshotDir); if (config.getValue("useScreenshotDirectorySuffix", true)) { @@ -1181,19 +1181,19 @@ void Client::initScreenshotDir(const std::string &dir) if (!configScreenshotSuffix.empty()) { - screenshotDir += "/" + configScreenshotSuffix; + mScreenshotDir += "/" + configScreenshotSuffix; config.setValue("screenshotDirectorySuffix", configScreenshotSuffix); } } } - if (mkdir_r(screenshotDir.c_str())) + if (mkdir_r(mScreenshotDir.c_str())) { logger->log("Directory %s doesn't exist and can't be created! " "Setting screenshot directory to home.", - screenshotDir.c_str()); - screenshotDir = std::string(PHYSFS_getUserDir()); + mScreenshotDir.c_str()); + mScreenshotDir = std::string(PHYSFS_getUserDir()); } } diff --git a/src/client.h b/src/client.h index f0fdd508..07910386 100644 --- a/src/client.h +++ b/src/client.h @@ -160,19 +160,19 @@ public: int exec(); static void setState(State state) - { instance()->state = state; } + { instance()->mState = state; } static State getState() - { return instance()->state; } + { return instance()->mState; } static const std::string &getConfigDirectory() - { return instance()->configDir; } + { return instance()->mConfigDir; } static const std::string &getLocalDataDirectory() - { return instance()->localDataDir; } + { return instance()->mLocalDataDir; } static const std::string &getScreenshotDirectory() - { return instance()->screenshotDir; } + { return instance()->mScreenshotDir; } void optionChanged(const std::string &name); void action(const gcn::ActionEvent &event); @@ -187,25 +187,25 @@ private: static Client *mInstance; - Options options; + Options mOptions; - std::string configDir; - std::string localDataDir; - std::string updateHost; - std::string updatesDir; - std::string screenshotDir; + std::string mConfigDir; + std::string mLocalDataDir; + std::string mUpdateHost; + std::string mUpdatesDir; + std::string mScreenshotDir; - ServerInfo currentServer; + ServerInfo mCurrentServer; - Window *currentDialog; - QuitDialog *quitDialog; - Desktop *desktop; - Button *setupButton; + Window *mCurrentDialog; + QuitDialog *mQuitDialog; + Desktop *mDesktop; + Button *mSetupButton; - State state; - State oldstate; + State mState; + State mOldState; - SDL_Surface *icon; + SDL_Surface *mIcon; SDL_TimerID mLogicCounterId; SDL_TimerID mSecondsCounterId; -- cgit v1.2.3-70-g09d2 From 024ad66a350883597ba4c34d1c5868ef43c086a0 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sat, 27 Feb 2010 17:42:13 +0100 Subject: Forgot to amend the last change with this --- src/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/client.cpp b/src/client.cpp index 722d8116..718556ad 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -192,7 +192,7 @@ public: Client *Client::mInstance = 0; Client::Client(const Options &options): - options(options), + mOptions(options), mCurrentDialog(0), mQuitDialog(0), mDesktop(0), -- cgit v1.2.3-70-g09d2 From 43ccd84af0707b29b146a9ea3d21094d6eb30e3a Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sat, 27 Feb 2010 10:35:57 -0700 Subject: Report more info on client in cURL useragent and Desktop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Thorbjørn Lindeijer Reviewed-by: Chuck Miller --- src/gui/widgets/desktop.cpp | 12 +++++++++++- src/main.h | 29 ++++++++++++++++++++++++++++- src/net/download.cpp | 11 ++++++----- 3 files changed, 45 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index e7cd949a..2a80cc11 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -20,6 +20,7 @@ #include "gui/widgets/desktop.h" +#include "configuration.h" #include "graphics.h" #include "log.h" #include "main.h" @@ -32,6 +33,8 @@ #include "resources/resourcemanager.h" #include "resources/wallpaper.h" +#include "utils/stringutils.h" + Desktop::Desktop() : mWallpaper(0) { @@ -39,7 +42,14 @@ Desktop::Desktop() Wallpaper::loadWallpapers(); - mVersionLabel = new Label(FULL_VERSION); + std::string appName = branding.getValue("appName", ""); + + if (appName.empty()) + mVersionLabel = new Label(FULL_VERSION); + else + mVersionLabel = new Label(strprintf("%s (Mana %s)", appName.c_str(), + FULL_VERSION)); + mVersionLabel->setBackgroundColor(gcn::Color(255, 255, 255, 128)); add(mVersionLabel, 25, 2); } diff --git a/src/main.h b/src/main.h index 03e0c7b3..3f30ef14 100644 --- a/src/main.h +++ b/src/main.h @@ -55,7 +55,7 @@ #elif defined WIN32 #include "winver.h" #elif defined __APPLE__ -#define PACKAGE_VERSION "0.0.29.1" +#define PACKAGE_VERSION "1.0.0" #endif #ifdef PACKAGE_VERSION @@ -64,6 +64,33 @@ #define FULL_VERSION "Unknown Version" #endif +#ifdef PACKAGE_OS +// If it's already been defined, let's not change it +#elif defined __APPLE__ +#define PACKAGE_OS "Apple" +#elif defined __FreeBSD__ || defined __DragonFly__ +#define PACKAGE_OS "FreeBSD" +#elif defined __NetBSD__ +#define PACKAGE_OS "NetBSD" +#elif defined __OpenBSD__ +#define PACKAGE_OS "OpenBSD" +#elif defined __linux__ || defined __linux +#define PACKAGE_OS "Linux" +#elif defined __GNU__ +#define PACKAGE_OS "GNU Hurd" +#elif defined WIN32 || defined _WIN32 || defined __WIN32__ || defined __NT__ \ + || defined WIN64 || defined _WIN64 || defined __WIN64__ +#define PACKAGE_OS "Windows" +#else +#define PACKAGE_OS "Other" +#endif + +#ifdef PACKAGE_VERSION +#define PACKAGE_EXTENDED_VERSION "Mana/" PACKAGE_VERSION " (" PACKAGE_OS "; %s)" +#else +#define PACKAGE_EXTENDED_VERSION "Mana (" PACKAGE_OS "; %s)" +#endif + #ifndef PKG_DATADIR #define PKG_DATADIR "" #endif diff --git a/src/net/download.cpp b/src/net/download.cpp index ba5b6b35..2b96a6b9 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -20,9 +20,12 @@ #include "net/download.h" +#include "configuration.h" #include "log.h" #include "main.h" +#include "utils/stringutils.h" + #include #include @@ -217,11 +220,9 @@ int Download::downloadThread(void *ptr) curl_easy_setopt(d->mCurl, CURLOPT_WRITEDATA, file); } -#ifdef PACKAGE_VERSION - curl_easy_setopt(d->mCurl, CURLOPT_USERAGENT, "Mana/" PACKAGE_VERSION); -#else - curl_easy_setopt(d->mCurl, CURLOPT_USERAGENT, "Mana"); -#endif + curl_easy_setopt(d->mCurl, CURLOPT_USERAGENT, + strprintf(PACKAGE_EXTENDED_VERSION, branding + .getValue("appShort", "mana").c_str()).c_str()); curl_easy_setopt(d->mCurl, CURLOPT_ERRORBUFFER, d->mError); curl_easy_setopt(d->mCurl, CURLOPT_URL, d->mUrl.c_str()); curl_easy_setopt(d->mCurl, CURLOPT_NOPROGRESS, 0); -- cgit v1.2.3-70-g09d2 From 2452f914c4997a49db34c30a9a6fb09ea5b7d958 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sat, 27 Feb 2010 18:48:31 +0100 Subject: Corrected some variables names after recent renaming With help from Jared. Reviewed-by: Jared Adams --- src/client.cpp | 38 +++++++++++++++++++------------------- src/client.h | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/client.cpp b/src/client.cpp index 718556ad..c4a4dd63 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -291,7 +291,7 @@ Client::Client(const Options &options): #endif #ifdef USE_OPENGL - bool useOpenGL = !options.noOpenGL && (config.getValue("opengl", 0) == 1); + bool useOpenGL = !mOptions.noOpenGL && (config.getValue("opengl", 0) == 1); // Setup image loading for the right image format Image::setLoadAsOpenGL(useOpenGL); @@ -967,14 +967,14 @@ void Client::initHomeDir(const Options &options) { #ifdef __APPLE__ // Use Application Directory instead of .mana - localDataDir = std::string(PHYSFS_getUserDir()) + + mLocalDataDir = std::string(PHYSFS_getUserDir()) + "/Library/Application Support/" + branding.getValue("appName", "Mana"); #elif defined WIN32 - localDataDir = getSpecialFolderLocation(CSIDL_LOCAL_APPDATA); - if (localDataDir.empty()) - localDataDir = std::string(PHYSFS_getUserDir()); - localDataDir += "/Mana"; + mLocalDataDir = getSpecialFolderLocation(CSIDL_LOCAL_APPDATA); + if (mLocalDataDir.empty()) + mLocalDataDir = std::string(PHYSFS_getUserDir()); + mLocalDataDir += "/Mana"; #else mLocalDataDir = std::string(PHYSFS_getUserDir()) + "/.local/share/mana"; @@ -991,13 +991,13 @@ void Client::initHomeDir(const Options &options) if (mConfigDir.empty()){ #ifdef __APPLE__ - configDir = localDataDir; + mConfigDir = mLocalDataDir; #elif defined WIN32 - configDir = getSpecialFolderLocation(CSIDL_APPDATA); - if (configDir.empty()) - configDir = localDataDir; + mConfigDir = getSpecialFolderLocation(CSIDL_APPDATA); + if (mConfigDir.empty()) + mConfigDir = mLocalDataDir; else - configDir += "/mana/" + branding.getValue("appName", "Mana"); + mConfigDir += "/mana/" + branding.getValue("appName", "Mana"); #else mConfigDir = std::string(PHYSFS_getUserDir()) + "/.config/mana/" + branding.getValue("appShort", "mana"); @@ -1014,7 +1014,7 @@ void Client::initHomeDir(const Options &options) /** * Initialize configuration. */ -void Client::initConfiguration(const Options &options) +void Client::initConfiguration() { // Fill configuration with defaults logger->log("Initializing configuration..."); @@ -1052,12 +1052,12 @@ void Client::initConfiguration(const Options &options) configFile = fopen(configPath.c_str(), "r"); // If we can't read it, it doesn't exist ! - if (configFile == NULL) + if (!configFile) { // We reopen the file in write mode and we create it configFile = fopen(configPath.c_str(), "wt"); } - if (configFile == NULL) + if (!configFile) { logger->log("Can't create %s. Using defaults.", configPath.c_str()); } @@ -1120,7 +1120,7 @@ void Client::initUpdatesDir() if (!resman->mkdir("/" + mUpdatesDir)) { #if defined WIN32 - std::string newDir = localDataDir + "\\" + updatesDir; + std::string newDir = mLocalDataDir + "\\" + mUpdatesDir; std::string::size_type loc = newDir.find("/", 0); while (loc != std::string::npos) @@ -1135,7 +1135,7 @@ void Client::initUpdatesDir() logger->log("Error: %s can't be made, but doesn't exist!", newDir.c_str()); errorMessage = _("Error creating updates directory!"); - state = STATE_ERROR; + mState = STATE_ERROR; } #else logger->log("Error: %s/%s can't be made, but doesn't exist!", @@ -1160,9 +1160,9 @@ void Client::initScreenshotDir(const std::string &dir) else { #ifdef WIN32 - screenshotDir = getSpecialFolderLocation(CSIDL_MYPICTURES); - if (screenshotDir.empty()) - screenshotDir = getSpecialFolderLocation(CSIDL_DESKTOP); + mScreenshotDir = getSpecialFolderLocation(CSIDL_MYPICTURES); + if (mScreenshotDir.empty()) + mScreenshotDir = getSpecialFolderLocation(CSIDL_DESKTOP); #else mScreenshotDir = std::string(PHYSFS_getUserDir()) + "Desktop"; // If ~/Desktop does not exist, we save screenshots in the user's home. diff --git a/src/client.h b/src/client.h index 07910386..db9ed3a9 100644 --- a/src/client.h +++ b/src/client.h @@ -179,7 +179,7 @@ public: private: void initHomeDir(const Options &options); - void initConfiguration(const Options &options); + void initConfiguration(); void initUpdatesDir(); void initScreenshotDir(const std::string &dir); -- cgit v1.2.3-70-g09d2 From 4f0ef07e85f408ebc8f33e2c573737a4ac2d29e1 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sat, 27 Feb 2010 11:28:29 -0700 Subject: Some cleanup and compile fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Thorbjørn Lindeijer --- mana.files | 15 ++++++--------- src/client.cpp | 18 +++++++++--------- src/client.h | 4 ++-- 3 files changed, 17 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/mana.files b/mana.files index 8cba046c..ff28a90d 100644 --- a/mana.files +++ b/mana.files @@ -1,6 +1,5 @@ ./CMakeLists.txt ./config.h -./data/branding.xml ./data/CMakeLists.txt ./data/fonts/CMakeLists.txt ./data/fonts/Makefile.am @@ -51,6 +50,8 @@ ./src/channel.h ./src/channelmanager.cpp ./src/channelmanager.h +./src/client.cpp +./src/client.h ./src/CMakeLists.txt ./src/commandhandler.cpp ./src/commandhandler.h @@ -101,8 +102,6 @@ ./src/gui/focushandler.h ./src/gui/gui.cpp ./src/gui/gui.h -./src/gui/guildwindow.cpp -./src/gui/guildwindow.h ./src/gui/help.cpp ./src/gui/help.h ./src/gui/inventorywindow.cpp @@ -207,8 +206,6 @@ ./src/gui/widgets/emoteshortcutcontainer.h ./src/gui/widgets/flowcontainer.cpp ./src/gui/widgets/flowcontainer.h -./src/gui/widgets/guildlistbox.cpp -./src/gui/widgets/guildlistbox.h ./src/gui/widgets/icon.cpp ./src/gui/widgets/icon.h ./src/gui/widgets/inttextfield.cpp @@ -284,8 +281,6 @@ ./src/imageparticle.h ./src/inventory.cpp ./src/inventory.h -./src/client.cpp -./src/client.h ./src/item.cpp ./src/item.h ./src/itemshortcut.cpp @@ -325,10 +320,10 @@ ./src/net/ea/gamehandler.h ./src/net/ea/generalhandler.cpp ./src/net/ea/generalhandler.h -./src/net/ea/guildhandler.cpp -./src/net/ea/guildhandler.h ./src/net/ea/gui/guildtab.cpp ./src/net/ea/gui/guildtab.h +./src/net/ea/guildhandler.cpp +./src/net/ea/guildhandler.h ./src/net/ea/gui/partytab.cpp ./src/net/ea/gui/partytab.h ./src/net/ea/inventoryhandler.cpp @@ -524,6 +519,8 @@ ./src/utils/mutex.h ./src/utils/sha256.cpp ./src/utils/sha256.h +./src/utils/specialfolder.cpp +./src/utils/specialfolder.h ./src/utils/stringutils.cpp ./src/utils/stringutils.h ./src/utils/xml.cpp diff --git a/src/client.cpp b/src/client.cpp index c4a4dd63..8005a3ff 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -214,7 +214,7 @@ Client::Client(const Options &options): branding.init(options.brandingPath); } - initHomeDir(options); + initHomeDir(); // Configure logger logger->setLogFile(mLocalDataDir + std::string("/mana.log")); @@ -222,8 +222,8 @@ Client::Client(const Options &options): // Log the mana version logger->log("Mana %s", FULL_VERSION); - initConfiguration(options); - initScreenshotDir(options.screenshotDir); + initConfiguration(); + initScreenshotDir(); logger->setLogToStandardOut(config.getValue("logToStandardOut", 0)); @@ -959,9 +959,9 @@ void Client::action(const gcn::ActionEvent &event) * Initializes the home directory. On UNIX and FreeBSD, ~/.mana is used. On * Windows and other systems we use the current working directory. */ -void Client::initHomeDir(const Options &options) +void Client::initHomeDir() { - mLocalDataDir = options.localDataDir; + mLocalDataDir = mOptions.localDataDir; if (mLocalDataDir.empty()) { @@ -987,7 +987,7 @@ void Client::initHomeDir(const Options &options) "Exiting."), mLocalDataDir.c_str())); } - mConfigDir = options.configDir; + mConfigDir = mOptions.configDir; if (mConfigDir.empty()){ #ifdef __APPLE__ @@ -1147,10 +1147,10 @@ void Client::initUpdatesDir() } } -void Client::initScreenshotDir(const std::string &dir) +void Client::initScreenshotDir() { - if (!dir.empty()) - mScreenshotDir = dir; + if (!mOptions.screenshotDir.empty()) + mScreenshotDir = mOptions.screenshotDir; else { std::string configScreenshotDir = diff --git a/src/client.h b/src/client.h index db9ed3a9..934ba9d2 100644 --- a/src/client.h +++ b/src/client.h @@ -178,10 +178,10 @@ public: void action(const gcn::ActionEvent &event); private: - void initHomeDir(const Options &options); + void initHomeDir(); void initConfiguration(); void initUpdatesDir(); - void initScreenshotDir(const std::string &dir); + void initScreenshotDir(); void accountLogin(LoginData *loginData); -- cgit v1.2.3-70-g09d2 From 1eea559d70d8ca49341bdd1648969468970e0db4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 27 Feb 2010 21:34:43 +0200 Subject: Fix program exit on windows. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thorbjørn Lindeijer --- src/client.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/client.cpp b/src/client.cpp index 8005a3ff..9be7d0df 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -199,6 +199,7 @@ Client::Client(const Options &options): mSetupButton(0), mState(STATE_CHOOSE_SERVER), mOldState(STATE_START), + mIcon(0), mLogicCounterId(0), mSecondsCounterId(0), mLimitFps(false) -- cgit v1.2.3-70-g09d2 From 3c1b12b86d02fb9ec0e9cf86b3afe60893119eba Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sat, 27 Feb 2010 18:58:27 -0700 Subject: Use appShort in screenshot name Reviewed-by: http://pastebin.ca/1815165 --- src/game.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/game.cpp b/src/game.cpp index 5b0295da..00c143d4 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -304,7 +304,8 @@ static bool saveScreenshot() filenameSuffix.str(""); filename.str(""); filename << Client::getScreenshotDirectory() << "/"; - filenameSuffix << "Mana_Screenshot_" << screenshotCount << ".png"; + filenameSuffix << branding.getValue("appShort", "Mana") + << "_Screenshot_" << screenshotCount << ".png"; filename << filenameSuffix.str(); testExists.open(filename.str().c_str(), std::ios::in); found = !testExists.is_open(); -- cgit v1.2.3-70-g09d2 From db0e0cd1f043dd1fb7c6298db6158a78c41373df Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sat, 27 Feb 2010 20:07:16 +0100 Subject: Take the URL to the server list from the branding file This way, a Mana based game can have multiple servers associated with it (for example with different languages), listed under the same branding. Reviewed-by: Jared Adams --- docs/example.mana | 1 + mana.files | 1 + src/gui/serverdialog.cpp | 12 ++++++++---- update-creator.sh | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/docs/example.mana b/docs/example.mana index 795d8d40..aa87b96f 100644 --- a/docs/example.mana +++ b/docs/example.mana @@ -13,6 +13,7 @@ filename / path as a command line parameter