diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/game.cpp | 13 | ||||
-rw-r--r-- | src/gui/gui.cpp | 5 | ||||
-rw-r--r-- | src/gui/recorder.cpp | 1 | ||||
-rw-r--r-- | src/gui/skilldialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/specialswindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/statuswindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 68 | ||||
-rw-r--r-- | src/gui/viewport.h | 24 | ||||
-rw-r--r-- | src/gui/widgets/popup.cpp | 23 | ||||
-rw-r--r-- | src/gui/widgets/popup.h | 8 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 21 | ||||
-rw-r--r-- | src/gui/widgets/window.h | 6 | ||||
-rw-r--r-- | src/gui/widgets/windowcontainer.cpp | 39 | ||||
-rw-r--r-- | src/gui/widgets/windowcontainer.h | 59 | ||||
-rw-r--r-- | src/gui/windowmenu.cpp | 6 | ||||
-rw-r--r-- | src/localplayer.cpp | 5 | ||||
-rw-r--r-- | src/localplayer.h | 13 | ||||
-rw-r--r-- | src/main.h | 5 |
20 files changed, 83 insertions, 231 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b84e59c6..9a27b610 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -194,8 +194,6 @@ SET(SRCS gui/widgets/whispertab.h gui/widgets/window.cpp gui/widgets/window.h - gui/widgets/windowcontainer.cpp - gui/widgets/windowcontainer.h gui/beingpopup.cpp gui/beingpopup.h gui/buy.cpp diff --git a/src/Makefile.am b/src/Makefile.am index f36fcdf2..61e30978 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -93,8 +93,6 @@ mana_SOURCES = gui/widgets/avatarlistbox.cpp \ gui/widgets/whispertab.h \ gui/widgets/window.cpp \ gui/widgets/window.h \ - gui/widgets/windowcontainer.cpp \ - gui/widgets/windowcontainer.h \ gui/beingpopup.cpp \ gui/beingpopup.h \ gui/buy.cpp \ diff --git a/src/game.cpp b/src/game.cpp index 2b9e932e..8558d421 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -124,7 +124,6 @@ ChannelManager *channelManager = NULL; CommandHandler *commandHandler = NULL; Particle *particleEngine = NULL; EffectManager *effectManager = NULL; -Viewport *viewport = NULL; /**< Viewport on the map. */ ChatTab *localChatTab = NULL; @@ -217,19 +216,10 @@ Game::Game(): disconnectedDialog = NULL; - // Create the viewport - viewport = new Viewport; - viewport->setDimension(gcn::Rectangle(0, 0, graphics->getWidth(), - graphics->getHeight())); - - gcn::Container *top = static_cast<gcn::Container*>(gui->getTop()); - top->add(viewport); - viewport->requestMoveToBottom(); - createGuiWindows(); mWindowMenu = new WindowMenu; - windowContainer->add(mWindowMenu); + viewport->add(mWindowMenu); initEngines(); @@ -276,7 +266,6 @@ Game::~Game() delete commandHandler; delete joystick; delete particleEngine; - delete viewport; delete mCurrentMap; map_path = ""; diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index bc3eb675..2a6e1ce3 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -29,7 +29,6 @@ #include "gui/viewport.h" #include "gui/widgets/window.h" -#include "gui/widgets/windowcontainer.h" #include "configlistener.h" #include "configuration.h" @@ -94,11 +93,11 @@ Gui::Gui(Graphics *graphics): mFocusHandler = new FocusHandler; // Initialize top GUI widget - WindowContainer *guiTop = new WindowContainer; + Viewport *guiTop = new Viewport; + guiTop->setFocusable(true); guiTop->setDimension(gcn::Rectangle(0, 0, graphics->getWidth(), graphics->getHeight())); guiTop->setOpaque(false); - Window::setWindowContainer(guiTop); setTop(guiTop); ResourceManager *resman = ResourceManager::getInstance(); diff --git a/src/gui/recorder.cpp b/src/gui/recorder.cpp index 257afd7f..cbeb435f 100644 --- a/src/gui/recorder.cpp +++ b/src/gui/recorder.cpp @@ -27,7 +27,6 @@ #include "gui/widgets/button.h" #include "gui/widgets/chattab.h" #include "gui/widgets/layout.h" -#include "gui/widgets/windowcontainer.h" #include "utils/gettext.h" #include "utils/stringutils.h" diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index d53a1867..2c026036 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -26,6 +26,7 @@ #include "gui/setup.h" #include "gui/skin.h" +#include "gui/viewport.h" #include "gui/widgets/button.h" #include "gui/widgets/container.h" @@ -36,7 +37,6 @@ #include "gui/widgets/scrollarea.h" #include "gui/widgets/tab.h" #include "gui/widgets/tabbedarea.h" -#include "gui/widgets/windowcontainer.h" #include "net/net.h" #include "net/playerhandler.h" @@ -188,7 +188,7 @@ SkillDialog::SkillDialog(): setCloseButton(true); setResizable(true); setSaveVisible(true); - setDefaultSize(windowContainer->getWidth() - 280, 30, 275, 425); + setDefaultSize(viewport->getWidth() - 280, 30, 275, 425); setupWindow->registerWindowForReset(this); mTabs = new TabbedArea(); diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp index 3ca0f037..6b5d9afd 100644 --- a/src/gui/specialswindow.cpp +++ b/src/gui/specialswindow.cpp @@ -25,6 +25,7 @@ #include "gui/setup.h" #include "gui/skin.h" +#include "gui/viewport.h" #include "gui/widgets/button.h" #include "gui/widgets/container.h" @@ -37,7 +38,6 @@ #include "gui/widgets/tab.h" #include "gui/widgets/tabbedarea.h" #include "gui/widgets/flowcontainer.h" -#include "gui/widgets/windowcontainer.h" #include "net/net.h" #include "net/specialhandler.h" @@ -88,7 +88,7 @@ SpecialsWindow::SpecialsWindow(): setCloseButton(true); setResizable(true); setSaveVisible(true); - setDefaultSize(windowContainer->getWidth() - 280, 30, 275, 425); + setDefaultSize(viewport->getWidth() - 280, 30, 275, 425); setupWindow->registerWindowForReset(this); mTabs = new TabbedArea(); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 7ea2cf18..48e0ef93 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -26,6 +26,7 @@ #include "gui/ministatus.h" #include "gui/setup.h" +#include "gui/viewport.h" #include "gui/widgets/button.h" #include "gui/widgets/label.h" @@ -33,7 +34,6 @@ #include "gui/widgets/progressbar.h" #include "gui/widgets/scrollarea.h" #include "gui/widgets/vertcontainer.h" -#include "gui/widgets/windowcontainer.h" #include "net/net.h" #include "net/playerhandler.h" @@ -89,8 +89,8 @@ StatusWindow::StatusWindow(): setResizable(true); setCloseButton(true); setSaveVisible(true); - setDefaultSize((windowContainer->getWidth() - 365) / 2, - (windowContainer->getHeight() - 255) / 2, 365, 275); + setDefaultSize((viewport->getWidth() - 365) / 2, + (viewport->getHeight() - 255) / 2, 365, 275); // ---------------------- // Status Part diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 4622c538..99053339 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -43,22 +43,23 @@ #include "resources/monsterinfo.h" #include "resources/resourcemanager.h" +#include "utils/dtor.h" #include "utils/stringutils.h" extern volatile int tick_time; +Viewport *viewport = NULL; + Viewport::Viewport(): mMap(0), mMouseX(0), mMouseY(0), mPixelViewX(0.0f), mPixelViewY(0.0f), - mTileViewX(0), - mTileViewY(0), mShowDebugPath(false), - mVisibleNames(false), mPlayerFollowMouse(false), - mLocalWalkTime(-1) + mLocalWalkTime(-1), + mBeingPopup(0) { setOpaque(false); addMouseListener(this); @@ -67,21 +68,20 @@ Viewport::Viewport(): mScrollRadius = (int) config.getValue("ScrollRadius", 0); mScrollCenterOffsetX = (int) config.getValue("ScrollCenterOffsetX", 0); mScrollCenterOffsetY = (int) config.getValue("ScrollCenterOffsetY", 0); - mVisibleNames = config.getValue("visiblenames", 1); config.addListener("ScrollLaziness", this); config.addListener("ScrollRadius", this); - config.addListener("visiblenames", this); + + viewport = this; mPopupMenu = new PopupMenu; - mBeingPopup = new BeingPopup; + + setFocusable(true); } Viewport::~Viewport() { delete mPopupMenu; - - config.removeListener("visiblenames", this); } void Viewport::setMap(Map *map) @@ -91,6 +91,9 @@ void Viewport::setMap(Map *map) map->setDebugFlags(mMap->getDebugFlags()); } mMap = map; + + if (!mBeingPopup) + mBeingPopup = new BeingPopup; } extern MiniStatusWindow *miniStatusWindow; @@ -104,15 +107,14 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) gcnGraphics->setColor(gcn::Color(64, 64, 64)); gcnGraphics->fillRectangle( gcn::Rectangle(0, 0, getWidth(), getHeight())); + + // Draw contained widgets + Container::draw(gcnGraphics); return; } Graphics *graphics = static_cast<Graphics*>(gcnGraphics); - // Ensure the client doesn't freak out if a feature localplayer uses - // is dependent on a map. - player_node->setMapInitialized(true); - // Avoid freaking out when tick_time overflows if (tick_time < lastTick) { @@ -184,9 +186,6 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) mPixelViewY = viewYmax; } - mTileViewX = (int) (mPixelViewX + 16) / 32; - mTileViewY = (int) (mPixelViewY + 16) / 32; - // Draw tiles and sprites if (mMap) { @@ -228,16 +227,22 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) miniStatusWindow->drawIcons(graphics); // Draw contained widgets - WindowContainer::draw(gcnGraphics); + Container::draw(gcnGraphics); } void Viewport::logic() { - WindowContainer::logic(); + delete_all(mDeathList); + mDeathList.clear(); - // Make the player follow the mouse position - // if the mouse is dragged elsewhere than in a window. - _followMouse(); + if (mMap) + { + // Make the player follow the mouse position + // if the mouse is dragged elsewhere than in a window. + _followMouse(); + } + + gcn::Container::logic(); } void Viewport::_followMouse() @@ -423,8 +428,8 @@ void Viewport::mouseDragged(gcn::MouseEvent &event) if (mLocalWalkTime != player_node->getWalkTime()) { mLocalWalkTime = player_node->getWalkTime(); - int destX = event.getX() / 32 + mTileViewX; - int destY = event.getY() / 32 + mTileViewY; + int destX = (event.getX() + mPixelViewX) / mMap->getTileWidth(); + int destY = (event.getY() + mPixelViewY) / mMap->getTileHeight(); player_node->setDestination(destX, destY); } } @@ -454,9 +459,6 @@ void Viewport::optionChanged(const std::string &name) { mScrollLaziness = (int) config.getValue("ScrollLaziness", 32); mScrollRadius = (int) config.getValue("ScrollRadius", 32); - - if (name == "visiblenames") - mVisibleNames = config.getValue("visiblenames", 1); } void Viewport::mouseMoved(gcn::MouseEvent &event) @@ -469,8 +471,10 @@ void Viewport::mouseMoved(gcn::MouseEvent &event) const int y = (event.getY() + (int) mPixelViewY); mHoverBeing = beingManager->findBeingByPixel(x, y); - if (Player *p = dynamic_cast<Player*>(mHoverBeing)) - mBeingPopup->show(getMouseX(), getMouseY(), p); + if (mHoverBeing && mHoverBeing->getType() == Being::PLAYER && + event.getSource() == this) + mBeingPopup->show(getMouseX(), getMouseY(), + static_cast<Player*>(mHoverBeing)); else mBeingPopup->setVisible(false); @@ -519,5 +523,11 @@ void Viewport::toggleDebugPath() void Viewport::hideBeingPopup() { - mBeingPopup->setVisible(false); + if (mBeingPopup) + mBeingPopup->setVisible(false); +} + +void Viewport::scheduleDelete(gcn::Widget *widget) +{ + mDeathList.push_back(widget); } diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 3fab607d..196070f1 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -25,7 +25,7 @@ #include "configlistener.h" #include "position.h" -#include "gui/widgets/windowcontainer.h" +#include "gui/widgets/container.h" #include <guichan/mouselistener.hpp> @@ -50,7 +50,7 @@ const int walkingMouseDelay = 500; * of it such as NPC messages, which are positioned using map pixel * coordinates. */ -class Viewport : public WindowContainer, public gcn::MouseListener, +class Viewport : public Container, public gcn::MouseListener, public ConfigListener { public: @@ -157,6 +157,12 @@ class Viewport : public WindowContainer, public gcn::MouseListener, */ void hideBeingPopup(); + /** + * Schedule a widget for deletion. It will be deleted at the start of + * the next logic update. + */ + void scheduleDelete(gcn::Widget *widget); + private: /** * Finds a path from the player to the mouse, and draws it. This is for @@ -174,6 +180,13 @@ class Viewport : public WindowContainer, public gcn::MouseListener, */ void _followMouse(); + /** + * List of widgets that are scheduled to be deleted. + */ + typedef std::list<gcn::Widget*> Widgets; + typedef Widgets::iterator WidgetIterator; + Widgets mDeathList; + Map *mMap; /**< The current map. */ int mScrollRadius; @@ -184,10 +197,7 @@ class Viewport : public WindowContainer, public gcn::MouseListener, int mMouseY; /**< Current mouse position in pixels. */ float mPixelViewX; /**< Current viewpoint in pixels. */ float mPixelViewY; /**< Current viewpoint in pixels. */ - int mTileViewX; /**< Current viewpoint in tiles. */ - int mTileViewY; /**< Current viewpoint in tiles. */ int mShowDebugPath; /**< Show a path from player to pointer. */ - bool mVisibleNames; /**< Show target names. */ bool mPlayerFollowMouse; @@ -196,9 +206,9 @@ class Viewport : public WindowContainer, public gcn::MouseListener, PopupMenu *mPopupMenu; /**< Popup menu. */ Being *mHoverBeing; /**< Being mouse is currently over. */ FloorItem *mHoverItem; /**< FloorItem mouse is currently over. */ - BeingPopup *mBeingPopup; + BeingPopup *mBeingPopup; /**< Being information popup. */ }; -extern Viewport *viewport; /**< The viewport */ +extern Viewport *viewport; /**< The viewport. */ #endif diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index 970b21ec..1bfd7fd2 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -29,8 +29,6 @@ #include "gui/skin.h" #include "gui/viewport.h" -#include "gui/widgets/windowcontainer.h" - #include "resources/image.h" #include <guichan/exception.hpp> @@ -45,16 +43,16 @@ Popup::Popup(const std::string &name, const std::string &skin): { logger->log("Popup::Popup(\"%s\")", name.c_str()); - if (!windowContainer) - throw GCN_EXCEPTION("Popup::Popup(): no windowContainer set"); + if (!viewport) + throw GCN_EXCEPTION("Popup::Popup(): no viewport set"); setPadding(3); // Loads the skin mSkin = SkinLoader::instance()->load(skin, mDefaultSkinPath); - // Add this window to the window container - windowContainer->add(this); + // Add this window to the viewport + viewport->add(this); // Popups are invisible by default setVisible(false); @@ -69,11 +67,6 @@ Popup::~Popup() mSkin->instances--; } -void Popup::setWindowContainer(WindowContainer *wc) -{ - windowContainer = wc; -} - void Popup::loadPopupConfiguration() { if (mPopupName.empty()) @@ -168,7 +161,7 @@ void Popup::setMaxHeight(int height) void Popup::scheduleDelete() { - windowContainer->scheduleDelete(this); + viewport->scheduleDelete(this); } void Popup::position(int x, int y) @@ -187,9 +180,3 @@ void Popup::position(int x, int y) setVisible(true); requestMoveToTop(); } - -void Popup::mouseMoved(gcn::MouseEvent &event) -{ - if (viewport) - viewport->hideBeingPopup(); -} diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h index 5c9164f6..dfa9b2fa 100644 --- a/src/gui/widgets/popup.h +++ b/src/gui/widgets/popup.h @@ -31,7 +31,6 @@ #include <guichan/mouselistener.hpp> class Skin; -class WindowContainer; /** * A light version of the Window class. Particularly suited for popup type @@ -65,11 +64,6 @@ class Popup : public Container, public gcn::MouseListener ~Popup(); /** - * Sets the window container to be used by new popups. - */ - static void setWindowContainer(WindowContainer *windowContainer); - - /** * Changes the popup's skin to use the skin defined in the saved * configuration file. */ @@ -96,8 +90,6 @@ class Popup : public Container, public gcn::MouseListener */ void setLocationRelativeTo(gcn::Widget *widget); - void mouseMoved(gcn::MouseEvent &event); - /** * Sets the minimum width of the popup. */ diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 83c918cf..4d70df84 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -31,7 +31,6 @@ #include "gui/widgets/layout.h" #include "gui/widgets/resizegrip.h" -#include "gui/widgets/windowcontainer.h" #include "resources/image.h" @@ -63,8 +62,8 @@ Window::Window(const std::string &caption, bool modal, Window *parent, { logger->log("Window::Window(\"%s\")", caption.c_str()); - if (!windowContainer) - throw GCN_EXCEPTION("Window::Window(): no windowContainer set"); + if (!viewport) + throw GCN_EXCEPTION("Window::Window(): no viewport set"); instances++; @@ -75,8 +74,8 @@ Window::Window(const std::string &caption, bool modal, Window *parent, // Loads the skin mSkin = SkinLoader::instance()->load(skin, mDefaultSkinPath); - // Add this window to the window container - windowContainer->add(this); + // Add this window to the viewport + viewport->add(this); if (mModal) { @@ -88,6 +87,8 @@ Window::Window(const std::string &caption, bool modal, Window *parent, setVisible(false); addWidgetListener(this); + + setFocusable(true); } Window::~Window() @@ -108,11 +109,6 @@ Window::~Window() mSkin->instances--; } -void Window::setWindowContainer(WindowContainer *wc) -{ - windowContainer = wc; -} - void Window::draw(gcn::Graphics *graphics) { Graphics *g = static_cast<Graphics*>(graphics); @@ -336,7 +332,7 @@ void Window::setVisible(bool visible, bool forceSticky) void Window::scheduleDelete() { - windowContainer->scheduleDelete(this); + viewport->scheduleDelete(this); } void Window::mousePressed(gcn::MouseEvent &event) @@ -431,9 +427,6 @@ void Window::mouseMoved(gcn::MouseEvent &event) default: gui->setCursorType(Gui::CURSOR_POINTER); } - - if (viewport) - viewport->hideBeingPopup(); } void Window::mouseDragged(gcn::MouseEvent &event) diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index b72be9d4..3c458efe 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -34,7 +34,6 @@ class Layout; class LayoutCell; class ResizeGrip; class Skin; -class WindowContainer; /** * A window. This window can be dragged around and has a title bar. Windows are @@ -65,11 +64,6 @@ class Window : public gcn::Window, gcn::WidgetListener ~Window(); /** - * Sets the window container to be used by new windows. - */ - static void setWindowContainer(WindowContainer *windowContainer); - - /** * Draws the window. */ void draw(gcn::Graphics *graphics); diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp deleted file mode 100644 index 7d5ecd37..00000000 --- a/src/gui/widgets/windowcontainer.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The Mana Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * - * This file is part of The Mana Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "gui/widgets/windowcontainer.h" - -#include "utils/dtor.h" - -WindowContainer *windowContainer = NULL; - -void WindowContainer::logic() -{ - delete_all(mDeathList); - mDeathList.clear(); - - gcn::Container::logic(); -} - -void WindowContainer::scheduleDelete(gcn::Widget *widget) -{ - mDeathList.push_back(widget); -} diff --git a/src/gui/widgets/windowcontainer.h b/src/gui/widgets/windowcontainer.h deleted file mode 100644 index 2ec65d15..00000000 --- a/src/gui/widgets/windowcontainer.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * The Mana Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * - * This file is part of The Mana Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef WINDOWCONTAINER_H -#define WINDOWCONTAINER_H - -#include "gui/widgets/container.h" - -/** - * A window container. This container adds functionality for more convenient - * widget (windows in particular) destruction. - * - * \ingroup GUI - */ -class WindowContainer : public Container -{ - public: - /** - * Do GUI logic. This functions adds automatic deletion of objects that - * volunteered to be deleted. - */ - void logic(); - - /** - * Schedule a widget for deletion. It will be deleted at the start of - * the next logic update. - */ - void scheduleDelete(gcn::Widget *widget); - - private: - /** - * List of widgets that are scheduled to be deleted. - */ - typedef std::list<gcn::Widget*> Widgets; - typedef Widgets::iterator WidgetIterator; - Widgets mDeathList; -}; - -extern WindowContainer *windowContainer; - -#endif diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 81e96fb2..1a497588 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -24,10 +24,10 @@ #include "graphics.h" #include "gui/emotepopup.h" +#include "gui/viewport.h" #include "gui/widgets/button.h" #include "gui/widgets/window.h" -#include "gui/widgets/windowcontainer.h" #include "net/net.h" #include "net/playerhandler.h" @@ -103,7 +103,7 @@ void WindowMenu::action(const gcn::ActionEvent &event) } else { - windowContainer->scheduleDelete(mEmotePopup); + viewport->scheduleDelete(mEmotePopup); mEmotePopup = 0; } } @@ -158,7 +158,7 @@ void WindowMenu::valueChanged(const gcn::SelectionEvent &event) if (emote) Net::getPlayerHandler()->emote(emote); - windowContainer->scheduleDelete(mEmotePopup); + viewport->scheduleDelete(mEmotePopup); mEmotePopup = 0; } } diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 750c8c45..8c918a97 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -103,11 +103,6 @@ LocalPlayer::LocalPlayer(int id, int job): mLocalWalkTime(-1), mMessageTime(0) { - // Variable to keep the local player from doing certain actions before a map - // is initialized. e.g. drawing a player's name using the TextManager, since - // it appears to be dependant upon map coordinates for updating drawing. - mMapInitialized = false; - mUpdateName = true; mTextColor = &guiPalette->getColor(Palette::PLAYER); diff --git a/src/localplayer.h b/src/localplayer.h index 919b5540..69fd4d0f 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -391,17 +391,6 @@ class LocalPlayer : public Player */ bool getCheckNameSetting() const { return mUpdateName; } - /** - * Set if the current map is initialized. - */ - void setMapInitialized(bool initialized) - { mMapInitialized = initialized; } - - /** - * Tells if the current map is initialized. - */ - bool isMapInitialized() const { return mMapInitialized; } - /** Keeps the Equipment related values */ const std::auto_ptr<Equipment> mEquipment; @@ -410,8 +399,6 @@ class LocalPlayer : public Player /** Whether or not the name settings have changed */ bool mUpdateName; - bool mMapInitialized; /**< Whether or not the map is available yet */ - virtual void handleStatusEffect(StatusEffect *effect, int effectId); // Colors don't change for local player @@ -34,9 +34,8 @@ * \section General General information * * During the game, the current Map is displayed by the main Viewport, which - * is the bottom-most widget in the WindowContainer. Aside the viewport, the - * window container keeps track of all the \link Window Windows\endlink - * displayed during the game. It is the <i>top</i> widget for Guichan. + * also contains all game \link Window Windows\endlink. It is the <i>top</i> + * widget for Guichan. * * A Map is composed of several layers of \link Image Images\endlink (tiles), * a layer with collision information and \link Sprite Sprites\endlink. The |