diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/chat.cpp | 14 | ||||
-rw-r--r-- | src/gui/minimap.cpp | 13 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 4 | ||||
-rw-r--r-- | src/gui/setup_players.cpp | 6 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 32 | ||||
-rw-r--r-- | src/gui/viewport.h | 9 |
6 files changed, 44 insertions, 34 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 83aaed26..da1bd600 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -21,7 +21,7 @@ #include "chat.h" -#include "beingmanager.h" +#include "actorspritemanager.h" #include "configuration.h" #include "localplayer.h" #include "party.h" @@ -266,20 +266,20 @@ void ChatWindow::chatInput(const std::string &msg) void ChatWindow::doPresent() { - const Beings &beings = beingManager->getAll(); + const ActorSprites &actors = actorSpriteManager->getAll(); std::string response = ""; int playercount = 0; - for (Beings::const_iterator bi = beings.begin(), be = beings.end(); - bi != be; ++bi) + for (ActorSpritesConstIterator it = actors.begin(), it_end = actors.end(); + it != it_end; it++) { - if ((*bi)->getType() == ActorSprite::PLAYER) + if ((*it)->getType() == ActorSprite::PLAYER) { if (!response.empty()) { response += ", "; } - response += (*bi)->getName(); + response += static_cast<Being*>(*it)->getName(); ++playercount; } } @@ -531,7 +531,7 @@ void ChatWindow::autoComplete() if (newName == "") { - beingManager->getPlayerNames(nameList, true); + actorSpriteManager->getPlayerNames(nameList, true); newName = autoComplete(nameList, name); } if (newName == "") diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index b4445d94..e973fa54 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -21,8 +21,8 @@ #include "gui/minimap.h" +#include "actorspritemanager.h" #include "being.h" -#include "beingmanager.h" #include "configuration.h" #include "graphics.h" #include "localplayer.h" @@ -186,12 +186,15 @@ void Minimap::draw(gcn::Graphics *graphics) drawImage(mMapImage, mapOriginX, mapOriginY); } - const Beings &beings = beingManager->getAll(); + const ActorSprites &actors = actorSpriteManager->getAll(); - for (Beings::const_iterator bi = beings.begin(), bi_end = beings.end(); - bi != bi_end; ++bi) + for (ActorSpritesConstIterator it = actors.begin(), it_end = actors.end(); + it != it_end; it++) { - const Being *being = (*bi); + if ((*it)->getType() == ActorSprite::FLOOR_ITEM) + continue; + + const Being *being = static_cast<Being*>(*it); int dotSize = 2; int type = UserPalette::PC; diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 0dae4f4b..76569d38 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -21,8 +21,8 @@ #include "gui/popupmenu.h" +#include "actorspritemanager.h" #include "being.h" -#include "beingmanager.h" #include "flooritem.h" #include "graphics.h" #include "item.h" @@ -199,7 +199,7 @@ void PopupMenu::showPopup(int x, int y, FloorItem *floorItem) void PopupMenu::handleLink(const std::string &link) { - Being *being = beingManager->findBeing(mBeingId); + Being *being = actorSpriteManager->findBeing(mBeingId); // Talk To action if (link == "talk" && being && being->canTalk()) diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp index d92d7917..15cc787a 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -21,7 +21,7 @@ #include "gui/setup_players.h" -#include "beingmanager.h" +#include "actorspritemanager.h" #include "configuration.h" #include "log.h" @@ -354,8 +354,8 @@ void Setup_Players::apply() config.setValue("showgender", mShowGender); - if (beingManager && mShowGender != showGender) - beingManager->updatePlayerNames(); + if (actorSpriteManager && mShowGender != showGender) + actorSpriteManager->updatePlayerNames(); config.setValue("enableChatLog", mEnableChatLog); } diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 3e1f2581..66f614a8 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -21,10 +21,9 @@ #include "gui/viewport.h" +#include "actorspritemanager.h" #include "client.h" -#include "beingmanager.h" #include "configuration.h" -#include "flooritemmanager.h" #include "graphics.h" #include "keyboardconfig.h" #include "localplayer.h" @@ -204,12 +203,16 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) } // Draw player names, speech, and emotion sprite as needed - const Beings &beings = beingManager->getAll(); - for (Beings::const_iterator i = beings.begin(), i_end = beings.end(); - i != i_end; ++i) + const ActorSprites &actors = actorSpriteManager->getAll(); + for (ActorSpritesConstIterator it = actors.begin(), it_end = actors.end(); + it != it_end; it++) { - (*i)->drawSpeech((int) mPixelViewX, (int) mPixelViewY); - (*i)->drawEmotion(graphics, (int) mPixelViewX, (int) mPixelViewY); + if ((*it)->getType() == ActorSprite::FLOOR_ITEM) + continue; + + Being *b = static_cast<Being*>(*it); + b->drawSpeech((int) mPixelViewX, (int) mPixelViewY); + b->drawEmotion(graphics, (int) mPixelViewX, (int) mPixelViewY); } if (miniStatusWindow) @@ -417,7 +420,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) else if (event.getButton() == gcn::MouseEvent::MIDDLE) { // Find the being nearest to the clicked position - Being *target = beingManager->findNearestLivingBeing( + Being *target = actorSpriteManager->findNearestLivingBeing( pixelX, pixelY, 20, ActorSprite::MONSTER); if (target) @@ -491,11 +494,11 @@ void Viewport::mouseMoved(gcn::MouseEvent &event) const int x = (event.getX() + (int) mPixelViewX); const int y = (event.getY() + (int) mPixelViewY); - mHoverBeing = beingManager->findBeingByPixel(x, y); + mHoverBeing = actorSpriteManager->findBeingByPixel(x, y); mBeingPopup->show(getMouseX(), getMouseY(), mHoverBeing); - mHoverItem = floorItemManager->findByCoordinates(x / mMap->getTileWidth(), - y / mMap->getTileHeight()); + mHoverItem = actorSpriteManager->findItem(x / mMap->getTileWidth(), + y / mMap->getTileHeight()); if (mHoverBeing) { @@ -542,8 +545,11 @@ void Viewport::hideBeingPopup() mBeingPopup->setVisible(false); } -void Viewport::clearHoverBeing(Being *being) +void Viewport::clearHover(ActorSprite *actor) { - if (mHoverBeing == being) + if (mHoverBeing == actor) mHoverBeing = 0; + + if (mHoverItem == actor) + mHoverItem = 0; } diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 9658f934..f91504f2 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -22,7 +22,7 @@ #ifndef VIEWPORT_H #define VIEWPORT_H -#include "beingmanager.h" +#include "actorspritemanager.h" #include "configlistener.h" #include "position.h" @@ -30,6 +30,7 @@ #include <guichan/mouselistener.hpp> +class ActorSprite; class Being; class BeingPopup; class FloorItem; @@ -159,10 +160,10 @@ class Viewport : public WindowContainer, public gcn::MouseListener, void hideBeingPopup(); protected: - friend class BeingManager; + friend class ActorSpriteManager; - /// Clears the hovered being if it matches - void clearHoverBeing(Being *being); + /// Clears any matching hovers + void clearHover(ActorSprite *actor); private: /** |