From d3994b21fda3e7d8ba417a382fc8f065a7bf1c52 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 23 Aug 2013 22:48:57 +0300 Subject: improve some mode methods in Client. --- src/auctionmanager.cpp | 2 +- src/client.cpp | 20 ++-------- src/client.h | 64 +++++++++++++++--------------- src/commands.cpp | 2 +- src/game.cpp | 8 ++-- src/gui/minimap.cpp | 2 +- src/gui/setup_video.cpp | 4 +- src/gui/theme.cpp | 2 +- src/gui/whoisonline.cpp | 2 +- src/gui/widgets/button.cpp | 2 +- src/gui/widgets/chattab.cpp | 6 +-- src/gui/widgets/checkbox.cpp | 2 +- src/gui/widgets/dropdown.cpp | 2 +- src/gui/widgets/dropshortcutcontainer.cpp | 6 +-- src/gui/widgets/emoteshortcutcontainer.cpp | 6 +-- src/gui/widgets/guitable.cpp | 4 +- src/gui/widgets/itemshortcutcontainer.cpp | 6 +-- src/gui/widgets/listbox.cpp | 2 +- src/gui/widgets/playerbox.cpp | 4 +- src/gui/widgets/progressbar.cpp | 2 +- src/gui/widgets/radiobutton.cpp | 2 +- src/gui/widgets/scrollarea.cpp | 2 +- src/gui/widgets/shoplistbox.cpp | 4 +- src/gui/widgets/slider.cpp | 2 +- src/gui/widgets/spellshortcutcontainer.cpp | 6 +-- src/gui/widgets/tab.cpp | 2 +- src/gui/widgets/textfield.cpp | 6 +-- src/gui/widgets/textpreview.cpp | 4 +- src/gui/widgets/window.cpp | 2 +- src/guildmanager.cpp | 2 +- src/joystick.cpp | 4 +- src/net/download.cpp | 2 +- src/net/ea/charserverhandler.cpp | 2 +- src/net/ea/loginhandler.cpp | 2 +- src/resources/emotedb.cpp | 2 +- 35 files changed, 88 insertions(+), 104 deletions(-) diff --git a/src/auctionmanager.cpp b/src/auctionmanager.cpp index 348866e19..e5b253933 100644 --- a/src/auctionmanager.cpp +++ b/src/auctionmanager.cpp @@ -50,7 +50,7 @@ void AuctionManager::init() int val = serverConfig.getValue("enableAuctionBot", -1); if (val == -1) { - if (Client::isTmw()) + if (client->isTmw()) val = 1; else val = 0; diff --git a/src/client.cpp b/src/client.cpp index 4838618b6..6a65fa700 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -171,7 +171,7 @@ static uint32_t nextSecond(uint32_t interval, void *param A_UNUSED); void ErrorListener::action(const gcn::ActionEvent &event) { if (event.getId() == "yes") - openBrowser(Client::getSupportUrl()); + openBrowser(client->getSupportUrl()); client->setState(STATE_CHOOSE_SERVER); } @@ -2730,16 +2730,6 @@ bool Client::limitPackets(const int type) return true; } -void Client::setGuiAlpha(const float n) -{ - instance()->mGuiAlpha = n; -} - -float Client::getGuiAlpha() -{ - return instance()->mGuiAlpha; -} - void Client::setFramerate(const int fpsLimit) { if (!fpsLimit) @@ -2898,16 +2888,12 @@ void Client::setIsMinimized(const bool n) void Client::newChatMessage() { - Client *const client = instance(); - if (!client) - return; - - if (!client->mNewMessageFlag && client->mIsMinimized) + if (!mNewMessageFlag && mIsMinimized) { // show * on window caption SDL::SetWindowTitle(mainGraphics->getWindow(), ("*" + client->mCaption).c_str()); - client->mNewMessageFlag = true; + mNewMessageFlag = true; } } diff --git a/src/client.h b/src/client.h index 3c7951ffc..17b0372fa 100644 --- a/src/client.h +++ b/src/client.h @@ -262,47 +262,45 @@ public: const std::string getNpcsDirectory() const A_WARN_UNUSED { return mNpcsDir; } - static bool getIsMinimized() A_WARN_UNUSED - { return instance()->mIsMinimized; } + bool getIsMinimized() const A_WARN_UNUSED + { return mIsMinimized; } - static void setIsMinimized(const bool n); + void setIsMinimized(const bool n); - static void newChatMessage(); + void newChatMessage(); - static bool getInputFocused() A_WARN_UNUSED - { return instance()->mInputFocused; } + bool getInputFocused() const A_WARN_UNUSED + { return mInputFocused; } - static void setInputFocused(const bool n) - { instance()->mInputFocused = n; } + void setInputFocused(const bool n) + { mInputFocused = n; } - static bool getMouseFocused() A_WARN_UNUSED - { return instance()->mMouseFocused; } + bool getMouseFocused() const A_WARN_UNUSED + { return mMouseFocused; } - static void setMouseFocused(const bool n) - { instance()->mMouseFocused = n; } + void setMouseFocused(const bool n) + { mMouseFocused = n; } - static std::string getUpdatesDir() A_WARN_UNUSED - { return instance()->mUpdatesDir; } + std::string getUpdatesDir() const A_WARN_UNUSED + { return mUpdatesDir; } - static std::string getServerName() A_WARN_UNUSED - { return instance()->mServerName; } + std::string getServerName() const A_WARN_UNUSED + { return mServerName; } - static std::string getOnlineUrl() A_WARN_UNUSED - { return instance()->mOnlineListUrl; } + std::string getOnlineUrl() const A_WARN_UNUSED + { return mOnlineListUrl; } - static std::string getSupportUrl() A_WARN_UNUSED - { return instance()->mCurrentServer.supportUrl; } + std::string getSupportUrl() const A_WARN_UNUSED + { return mCurrentServer.supportUrl; } - static void resize(const int width, const int height, - const bool always = false) - { instance()->resizeVideo(width, height, always); } + bool isKeyboardVisible() const + { return mKeyboardHeight > 1; } - static bool isKeyboardVisible() - { return instance()->mKeyboardHeight > 1; } + void setGuiAlpha(const float n) + { mGuiAlpha = n; } - static void setGuiAlpha(const float n); - - static float getGuiAlpha() A_WARN_UNUSED; + float getGuiAlpha() const A_WARN_UNUSED + { return mGuiAlpha; } static void closeDialogs(); @@ -310,7 +308,7 @@ public: static int getFramerate() A_WARN_UNUSED; - static bool isTmw() A_WARN_UNUSED; + bool isTmw() A_WARN_UNUSED; static void applyGrabMode(); @@ -336,7 +334,7 @@ public: void writePacketLimits(const std::string &packetLimitsName) const; - void resizeVideo(int width, int height, const bool always); + void resizeVideo(int width, int height, const bool always = false); static bool limitPackets(const int type) A_WARN_UNUSED; @@ -350,9 +348,9 @@ public: static void updateScreenKeyboard(int height); - static Window *openErrorDialog(const std::string &header, - const std::string &message, - const bool modal); + Window *openErrorDialog(const std::string &header, + const std::string &message, + const bool modal); private: void initRootDir(); diff --git a/src/commands.cpp b/src/commands.cpp index be5bc3a20..c7a4ce824 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1065,7 +1065,7 @@ impHandler2(dumpGraphics) str.append(",0"); #endif - str.append(strprintf(",%f,", static_cast(Client::getGuiAlpha()))) + str.append(strprintf(",%f,", static_cast(client->getGuiAlpha()))) .append(config.getBoolValue("adjustPerfomance") ? "1" : "0") .append(config.getBoolValue("alphaCache") ? "1" : "0") .append(config.getBoolValue("enableMapReduce") ? "1" : "0") diff --git a/src/game.cpp b/src/game.cpp index 379bb42f6..446b3fbfd 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -620,7 +620,7 @@ void Game::slowLogic() { // TRANSLATORS: error message text errorMessage = _("The connection to the server was lost."); - disconnectedDialog = Client::openErrorDialog( + disconnectedDialog = client->openErrorDialog( // TRANSLATORS: error message header _("Network Error"), errorMessage, false); disconnectedDialog->addActionListener(&errorListener); @@ -917,7 +917,7 @@ void Game::handleActive(const SDL_Event &event) player_node->updateName(); if (event.active.state & SDL_APPINPUTFOCUS) - Client::setInputFocused(event.active.gain); + client->setInputFocused(event.active.gain); if (event.active.state & SDL_APPMOUSEFOCUS) Client::setMouseFocused(event.active.gain); @@ -925,7 +925,7 @@ void Game::handleActive(const SDL_Event &event) { if (player_node && player_node->getAway()) { - if (Client::getInputFocused() || Client::getMouseFocused()) + if (client->getInputFocused() || client->getMouseFocused()) fpsLimit = config.getIntValue("fpslimit"); else fpsLimit = config.getIntValue("altfpslimit"); @@ -979,7 +979,7 @@ void Game::handleInput() case SDL_VIDEORESIZE: // Let the client deal with this one (it'll // pass down from there) - Client::resize(event.resize.w, event.resize.h); + client->resizeVideo(event.resize.w, event.resize.h); break; // Active event case SDL_ACTIVEEVENT: diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 4acf7944d..8b2ddef5e 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -153,7 +153,7 @@ void Minimap::setMap(const Map *const map) SDL_UnlockSurface(surface); mMapImage = imageHelper->load(surface); - mMapImage->setAlpha(Client::getGuiAlpha()); + mMapImage->setAlpha(client->getGuiAlpha()); mCustomMapImage = true; SDL_FreeSurface(surface); } diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 4d030238e..12ae9fe83 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -512,7 +512,7 @@ void Setup_Video::action(const gcn::ActionEvent &event) #if defined(WIN32) || defined(__APPLE__) || defined(ANDROID) if (!config.getIntValue("opengl")) { - Client::resize(width, height); + client->resizeVideo(width, height); } else { @@ -536,7 +536,7 @@ void Setup_Video::action(const gcn::ActionEvent &event) } } #else - Client::resize(width, height); + client->resizeVideo(width, height); #endif } diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index affec0b8c..97afec6d3 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -130,7 +130,7 @@ void Skin::updateAlpha(const float minimumOpacityAllowed) { const float alpha = static_cast( std::max(static_cast(minimumOpacityAllowed), - static_cast(Client::getGuiAlpha()))); + static_cast(client->getGuiAlpha()))); for (int i = 0; i < 9; i++) { diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index 7036ac7d0..d454eb2f3 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -494,7 +494,7 @@ int WhoIsOnline::downloadThread(void *ptr) int attempts = 0; WhoIsOnline *const wio = reinterpret_cast(ptr); CURLcode res; - const std::string url(Client::getOnlineUrl() + "/online.txt"); + const std::string url(client->getOnlineUrl() + "/online.txt"); while (attempts < 1 && !wio->mDownloadComplete) { diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index ae6886e72..ed9ac0580 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -283,7 +283,7 @@ void Button::loadImage(const std::string &imageName) void Button::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (mAlpha != alpha) diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 37e94ef1b..1cb2e9d82 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -308,8 +308,8 @@ void ChatTab::chatLog(std::string line, Own own, if ((getAllowHighlight() || own == BY_GM) && (this != tabArea->getSelectedTab() - || (Client::getIsMinimized() || (!Client::getMouseFocused() - && !Client::getInputFocused())))) + || (client->getIsMinimized() || (!client->getMouseFocused() + && !client->getInputFocused())))) { if (own == BY_GM) { @@ -323,7 +323,7 @@ void ChatTab::chatLog(std::string line, Own own, chatWindow->unHideWindow(); playNewMessageSound(); } - Client::newChatMessage(); + client->newChatMessage(); } } } diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index b9abe45fa..f1ab408fe 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -109,7 +109,7 @@ void CheckBox::draw(gcn::Graphics* graphics) void CheckBox::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (mAlpha != alpha) diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index e8d4006a2..0b67958df 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -196,7 +196,7 @@ DropDown::~DropDown() void DropDown::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (mAlpha != alpha) diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index e26183116..d0bf896eb 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -61,7 +61,7 @@ DropShortcutContainer::DropShortcutContainer(): if (mBackgroundImg) { - mBackgroundImg->setAlpha(Client::getGuiAlpha()); + mBackgroundImg->setAlpha(client->getGuiAlpha()); mBoxHeight = mBackgroundImg->getHeight(); mBoxWidth = mBackgroundImg->getWidth(); } @@ -98,9 +98,9 @@ void DropShortcutContainer::draw(gcn::Graphics *graphics) return; BLOCK_START("DropShortcutContainer::draw") - if (Client::getGuiAlpha() != mAlpha) + if (client->getGuiAlpha() != mAlpha) { - mAlpha = Client::getGuiAlpha(); + mAlpha = client->getGuiAlpha(); if (mBackgroundImg) mBackgroundImg->setAlpha(mAlpha); } diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 10ef44f6a..1353e6317 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -60,7 +60,7 @@ EmoteShortcutContainer::EmoteShortcutContainer(): "item_shortcut_background.xml", "background.xml"); if (mBackgroundImg) - mBackgroundImg->setAlpha(Client::getGuiAlpha()); + mBackgroundImg->setAlpha(client->getGuiAlpha()); // Setup emote sprites for (int i = 0; i <= EmoteDB::getLast(); i++) @@ -109,8 +109,8 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics) return; BLOCK_START("EmoteShortcutContainer::draw") - mAlpha = Client::getGuiAlpha(); - if (Client::getGuiAlpha() != mAlpha && mBackgroundImg) + mAlpha = client->getGuiAlpha(); + if (client->getGuiAlpha() != mAlpha && mBackgroundImg) mBackgroundImg->setAlpha(mAlpha); Graphics *const g = static_cast(graphics); diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index e3dda4162..473899b29 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -299,8 +299,8 @@ void GuiTable::draw(gcn::Graphics* graphics) return; BLOCK_START("GuiTable::draw") - if (Client::getGuiAlpha() != mAlpha) - mAlpha = Client::getGuiAlpha(); + if (client->getGuiAlpha() != mAlpha) + mAlpha = client->getGuiAlpha(); const gcn::Rectangle &rect = mDimension; const int width = rect.width; diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 517c783a0..3d36caafe 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -72,7 +72,7 @@ ItemShortcutContainer::ItemShortcutContainer(const unsigned number) : if (mBackgroundImg) { - mBackgroundImg->setAlpha(Client::getGuiAlpha()); + mBackgroundImg->setAlpha(client->getGuiAlpha()); mBoxHeight = mBackgroundImg->getHeight(); mBoxWidth = mBackgroundImg->getWidth(); } @@ -118,8 +118,8 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics) return; } - mAlpha = Client::getGuiAlpha(); - if (Client::getGuiAlpha() != mAlpha) + mAlpha = client->getGuiAlpha(); + if (client->getGuiAlpha() != mAlpha) { if (mBackgroundImg) mBackgroundImg->setAlpha(mAlpha); diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index 51751c463..e283d5db0 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -77,7 +77,7 @@ ListBox::~ListBox() void ListBox::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (mAlpha != alpha) diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 20260b9ac..6a5c815d4 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -126,9 +126,9 @@ void PlayerBox::draw(gcn::Graphics *graphics) mBeing->drawSpriteAt(static_cast(graphics), x, y); } - if (Client::getGuiAlpha() != mAlpha) + if (client->getGuiAlpha() != mAlpha) { - const float alpha = Client::getGuiAlpha(); + const float alpha = client->getGuiAlpha(); for (int a = 0; a < 9; a++) { if (mBackground.grid[a]) diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index f76c9610e..33e27a0d9 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -129,7 +129,7 @@ void ProgressBar::logic() void ProgressBar::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); mAlpha = alpha; } diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index 08561d56c..c8d833a64 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -90,7 +90,7 @@ RadioButton::~RadioButton() void RadioButton::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (mAlpha != alpha) diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 76d883216..98b58f51c 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -234,7 +234,7 @@ void ScrollArea::logic() void ScrollArea::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (alpha != mAlpha) diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index b0f58bd5f..6cfff4727 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -90,8 +90,8 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) return; } - if (Client::getGuiAlpha() != mAlpha) - mAlpha = Client::getGuiAlpha(); + if (client->getGuiAlpha() != mAlpha) + mAlpha = client->getGuiAlpha(); const int alpha = static_cast(mAlpha * 255.0f); Graphics *graphics = static_cast(gcnGraphics); diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index e8ea8ea25..00b55f936 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -94,7 +94,7 @@ void Slider::init() void Slider::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (alpha != mAlpha) diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index afd4e14f4..31d0a716b 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -64,7 +64,7 @@ SpellShortcutContainer::SpellShortcutContainer(const unsigned number) : if (mBackgroundImg) { - mBackgroundImg->setAlpha(Client::getGuiAlpha()); + mBackgroundImg->setAlpha(client->getGuiAlpha()); mBoxHeight = mBackgroundImg->getHeight(); mBoxWidth = mBackgroundImg->getWidth(); } @@ -98,9 +98,9 @@ void SpellShortcutContainer::draw(gcn::Graphics *graphics) return; BLOCK_START("SpellShortcutContainer::draw") - if (Client::getGuiAlpha() != mAlpha) + if (client->getGuiAlpha() != mAlpha) { - mAlpha = Client::getGuiAlpha(); + mAlpha = client->getGuiAlpha(); if (mBackgroundImg) mBackgroundImg->setAlpha(mAlpha); } diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index bce4ae11f..99a69897d 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -142,7 +142,7 @@ void Tab::init() void Tab::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (alpha != mAlpha) diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 0fec552e3..37629e44e 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -119,7 +119,7 @@ TextField::~TextField() void TextField::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (alpha != mAlpha) @@ -550,7 +550,7 @@ void TextField::fontChanged() void TextField::mousePressed(gcn::MouseEvent &mouseEvent) { #ifdef ANDROID - if (!Client::isKeyboardVisible()) + if (!client->isKeyboardVisible()) inputManager.executeAction(Input::KEY_SHOW_KEYBOARD); #endif if (mouseEvent.getButton() == gcn::MouseEvent::RIGHT) @@ -578,7 +578,7 @@ void TextField::mousePressed(gcn::MouseEvent &mouseEvent) void TextField::focusGained(const gcn::Event &event A_UNUSED) { #ifdef ANDROID - if (!Client::isKeyboardVisible()) + if (!client->isKeyboardVisible()) inputManager.executeAction(Input::KEY_SHOW_KEYBOARD); #endif } diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index 11de5b553..e788f1f4c 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -83,8 +83,8 @@ TextPreview::~TextPreview() void TextPreview::draw(gcn::Graphics* graphics) { BLOCK_START("TextPreview::draw") - if (Client::getGuiAlpha() != mAlpha) - mAlpha = Client::getGuiAlpha(); + if (client->getGuiAlpha() != mAlpha) + mAlpha = client->getGuiAlpha(); Graphics *const g = static_cast(graphics); const int intAlpha = static_cast(mAlpha * 255.0f); diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index ad510d363..485f875fc 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -1086,7 +1086,7 @@ bool Window::isResizeAllowed(const gcn::MouseEvent &event) const int Window::getGuiAlpha() const { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); return static_cast(alpha * 255.0f); } diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp index 6fbf15666..7057aa311 100644 --- a/src/guildmanager.cpp +++ b/src/guildmanager.cpp @@ -65,7 +65,7 @@ void GuildManager::init() int val = serverConfig.getValue("enableGuildBot", -1); if (val == -1) { - if (Client::isTmw()) + if (client->isTmw()) val = 1; else val = 0; diff --git a/src/joystick.cpp b/src/joystick.cpp index 244996937..a2809d8b9 100644 --- a/src/joystick.cpp +++ b/src/joystick.cpp @@ -164,7 +164,7 @@ void Joystick::logic() mDirection = 0; - if (mUseInactive || Client::getInputFocused()) + if (mUseInactive || client->getInputFocused()) { // X-Axis int position = SDL_JoystickGetAxis(mJoystick, 0); @@ -333,7 +333,7 @@ bool Joystick::validate() const if (mCalibrating || !mEnabled || !mCalibrated) return false; - return (mUseInactive || Client::getInputFocused()); + return (mUseInactive || client->getInputFocused()); } void Joystick::handleRepeat(const int time) diff --git a/src/net/download.cpp b/src/net/download.cpp index f469a3258..1d49caea2 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -73,7 +73,7 @@ Download::Download(void *const ptr, const std::string &url, mOptions.cancel = 0; mOptions.memoryWrite = 0; mOptions.checkAdler = true; - const std::string serverName = Client::getServerName(); + const std::string serverName = client->getServerName(); if (!serverName.empty()) { if (mUrl.find("?") == std::string::npos) diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index 81beac26e..f428aea54 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -242,7 +242,7 @@ void CharServerHandler::processCharMapInfo(Net::MessageIn &msg, if (config.getBoolValue("usePersistentIP")) { msg.readInt32(); - server.hostname = Client::getServerName(); + server.hostname = client->getServerName(); } else { diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index fbe588b1f..70b32c92c 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -87,7 +87,7 @@ void LoginHandler::chooseServer(const unsigned int server) const if (charServer) { if (config.getBoolValue("usePersistentIP")) - charServer->hostname = Client::getServerName(); + charServer->hostname = client->getServerName(); else charServer->hostname = ipToString(mWorlds[server]->address); charServer->port = mWorlds[server]->port; diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp index 7361d99df..9a0c086bc 100644 --- a/src/resources/emotedb.cpp +++ b/src/resources/emotedb.cpp @@ -71,7 +71,7 @@ void EmoteDB::load() const int id = XML::getProperty(emoteNode, "id", -1); // skip hight images - if (id > 19 || (Client::isTmw() && id > 13)) + if (id > 19 || (client->isTmw() && id > 13)) continue; if (id == -1) -- cgit v1.2.3-70-g09d2