diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-06-30 23:14:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-07-01 02:08:53 +0300 |
commit | 32014de9008efe051a1a8b05e5e976a4629b34d2 (patch) | |
tree | 694b93739685b8b8462c7f602b8ae693be5e65bf /src | |
parent | 5c260f683e26529d7cf02c12c1fff70a7a7e5eb8 (diff) | |
download | manaverse-32014de9008efe051a1a8b05e5e976a4629b34d2.tar.gz manaverse-32014de9008efe051a1a8b05e5e976a4629b34d2.tar.bz2 manaverse-32014de9008efe051a1a8b05e5e976a4629b34d2.tar.xz manaverse-32014de9008efe051a1a8b05e5e976a4629b34d2.zip |
Replace some lists to vectors.
Diffstat (limited to 'src')
-rw-r--r-- | src/actorsprite.cpp | 2 | ||||
-rw-r--r-- | src/actorspritemanager.cpp | 2 | ||||
-rw-r--r-- | src/actorspritemanager.h | 2 | ||||
-rw-r--r-- | src/effectmanager.cpp | 4 | ||||
-rw-r--r-- | src/effectmanager.h | 2 | ||||
-rw-r--r-- | src/graphics.cpp | 4 | ||||
-rw-r--r-- | src/graphicsvertexes.cpp | 2 | ||||
-rw-r--r-- | src/graphicsvertexes.h | 4 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 4 | ||||
-rw-r--r-- | src/gui/popupmenu.h | 2 | ||||
-rw-r--r-- | src/gui/socialwindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/browserbox.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/vertcontainer.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/vertcontainer.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/windowcontainer.h | 4 | ||||
-rw-r--r-- | src/map.cpp | 14 | ||||
-rw-r--r-- | src/map.h | 12 | ||||
-rw-r--r-- | src/net/tmwa/inventoryhandler.h | 3 | ||||
-rw-r--r-- | src/resources/emotedb.h | 3 | ||||
-rw-r--r-- | src/resources/spritedef.h | 7 |
21 files changed, 46 insertions, 39 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp index a3c0f2e93..5f71c6bbb 100644 --- a/src/actorsprite.cpp +++ b/src/actorsprite.cpp @@ -366,7 +366,7 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display, //setup particle effects if (Particle::enabled && particleEngine) { - std::list<std::string>::const_iterator it, it_end; + std::vector<std::string>::const_iterator it, it_end; for (it = display.particles.begin(), it_end = display.particles.end(); it != it_end; ++it) { diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp index 78cfa256b..b6a8a5b4c 100644 --- a/src/actorspritemanager.cpp +++ b/src/actorspritemanager.cpp @@ -332,7 +332,7 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y, return NULL; } -void ActorSpriteManager::findBeingsByPixel(std::list<Being*> &beings, +void ActorSpriteManager::findBeingsByPixel(std::vector<Being*> &beings, int x, int y, bool allPlayers) const { if (!mMap) diff --git a/src/actorspritemanager.h b/src/actorspritemanager.h index dc1cc9869..f9414e010 100644 --- a/src/actorspritemanager.h +++ b/src/actorspritemanager.h @@ -100,7 +100,7 @@ class ActorSpriteManager: public ConfigListener /** * Returns a beings at the specific pixel. */ - void findBeingsByPixel(std::list<Being*> &beings, int x, int y, + void findBeingsByPixel(std::vector<Being*> &beings, int x, int y, bool allPlayers) const; /** diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp index 4e2f3b249..bb54ced99 100644 --- a/src/effectmanager.cpp +++ b/src/effectmanager.cpp @@ -67,7 +67,7 @@ bool EffectManager::trigger(int id, Being* being) return false; bool rValue = false; - for (std::list<EffectDescription>::iterator i = mEffects.begin(); + for (std::vector<EffectDescription>::iterator i = mEffects.begin(); i != mEffects.end(); ++i) { if ((*i).id == id) @@ -92,7 +92,7 @@ bool EffectManager::trigger(int id, int x, int y) return false; bool rValue = false; - for (std::list<EffectDescription>::iterator i = mEffects.begin(); + for (std::vector<EffectDescription>::iterator i = mEffects.begin(); i != mEffects.end(); ++i) { if ((*i).id == id) diff --git a/src/effectmanager.h b/src/effectmanager.h index 3ee65fe0f..df19a0040 100644 --- a/src/effectmanager.h +++ b/src/effectmanager.h @@ -53,7 +53,7 @@ class EffectManager bool trigger(int id, int x, int y); private: - std::list<EffectDescription> mEffects; + std::vector<EffectDescription> mEffects; }; extern EffectManager *effectManager; diff --git a/src/graphics.cpp b/src/graphics.cpp index 6f3e5a23d..076f9c8e2 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -439,8 +439,8 @@ void Graphics::drawImagePattern2(GraphicsVertexes *vert, Image *img) { // here not checking input parameters - std::list<DoubleRect*> *arr = vert->getRectsSDL(); - std::list<DoubleRect*>::iterator it; + std::vector<DoubleRect*> *arr = vert->getRectsSDL(); + std::vector<DoubleRect*>::iterator it; for (it = arr->begin(); it != arr->end(); ++it) SDL_LowerBlit(img->mSDLSurface, &(*it)->src, mTarget, &(*it)->dst); diff --git a/src/graphicsvertexes.cpp b/src/graphicsvertexes.cpp index d5b374db9..68e60ea1d 100644 --- a/src/graphicsvertexes.cpp +++ b/src/graphicsvertexes.cpp @@ -161,7 +161,7 @@ void GraphicsVertexes::clearSDL() sdl[mPtr].mList.clear(); } -std::list<DoubleRect*> *GraphicsVertexes::getRectsSDL() +std::vector<DoubleRect*> *GraphicsVertexes::getRectsSDL() { return &sdl[mPtr].mList; } diff --git a/src/graphicsvertexes.h b/src/graphicsvertexes.h index d3905ba56..c5daab6cb 100644 --- a/src/graphicsvertexes.h +++ b/src/graphicsvertexes.h @@ -52,7 +52,7 @@ class SDLGraphicsVertexes ~SDLGraphicsVertexes(); - std::list<DoubleRect*> mList; + std::vector<DoubleRect*> mList; }; #ifdef USE_OPENGL @@ -125,7 +125,7 @@ class GraphicsVertexes void clearSDL(); - std::list<DoubleRect*> *getRectsSDL(); + std::vector<DoubleRect*> *getRectsSDL(); void incPtr(int num = 1) { mPtr += num; } diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 89dd64c18..12669415d 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -317,11 +317,11 @@ void PopupMenu::showPopup(int x, int y, Being *being) showPopup(x, y); } -void PopupMenu::showPopup(int x, int y, std::list<Being*> &beings) +void PopupMenu::showPopup(int x, int y, std::vector<Being*> &beings) { mBrowserBox->clearRows(); mBrowserBox->addRow("Players"); - std::list<Being*>::iterator it, it_end; + std::vector<Being*>::iterator it, it_end; for (it = beings.begin(), it_end = beings.end(); it != it_end; ++it) { Being *being = *it; diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h index 50d86ff37..8830bdd00 100644 --- a/src/gui/popupmenu.h +++ b/src/gui/popupmenu.h @@ -102,7 +102,7 @@ class PopupMenu : public Popup, public LinkHandler /** * Shows the beings related popup menu at the specified mouse coords. */ - void showPopup(int x, int y, std::list<Being*> &beings); + void showPopup(int x, int y, std::vector<Being*> &beings); void showPlayerPopup(int x, int y, std::string nick); diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index de9bab42b..fcb33542b 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -553,9 +553,9 @@ public: return; std::vector<Avatar*> *avatars = mBeings->getMembers(); - std::list<MapItem*> portals = map->getPortals(); + std::vector<MapItem*> portals = map->getPortals(); - std::list<MapItem*>::iterator i = portals.begin(); + std::vector<MapItem*>::iterator i = portals.begin(); SpecialLayer *specialLayer = map->getSpecialLayer(); std::vector<Avatar*>::iterator ia = avatars->begin(); diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 0fc7444ec..d2c0db7b1 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -404,7 +404,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) { if (actorSpriteManager) { - std::list<Being*> beings; + std::vector<Being*> beings; const int x = getMouseX() + static_cast<int>(mPixelViewX); const int y = getMouseY() + static_cast<int>(mPixelViewY); actorSpriteManager->findBeingsByPixel(beings, x, y, true); diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index 258e0bd09..2bdf31237 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -200,7 +200,7 @@ class BrowserBox : public gcn::Widget, typedef TextRows::iterator TextRowIterator; TextRows mTextRows; - typedef std::list<LinePart> LinePartList; + typedef std::vector<LinePart> LinePartList; typedef LinePartList::iterator LinePartIterator; LinePartList mLineParts; diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp index 6f94df535..9920c7210 100644 --- a/src/gui/widgets/vertcontainer.cpp +++ b/src/gui/widgets/vertcontainer.cpp @@ -73,7 +73,7 @@ void VertContainer::clear() void VertContainer::widgetResized(const gcn::Event &event _UNUSED_) { - for (WidgetListIterator it = mResizableWidgets.begin(); + for (std::vector<gcn::Widget*>::iterator it = mResizableWidgets.begin(); it != mResizableWidgets.end(); it++) { (*it)->setWidth(getWidth()); diff --git a/src/gui/widgets/vertcontainer.h b/src/gui/widgets/vertcontainer.h index 268c61d4f..cccd772b8 100644 --- a/src/gui/widgets/vertcontainer.h +++ b/src/gui/widgets/vertcontainer.h @@ -26,6 +26,8 @@ #include <guichan/widgetlistener.hpp> +#include <vector> + #ifdef __GNUC__ #define _UNUSED_ __attribute__ ((unused)) #else @@ -53,7 +55,7 @@ class VertContainer : public Container, public gcn::WidgetListener void widgetResized(const gcn::Event &event); private: - std::list<gcn::Widget*> mResizableWidgets; + std::vector<gcn::Widget*> mResizableWidgets; int mVerticalItemSize; int mCount; int mNextY; diff --git a/src/gui/widgets/windowcontainer.h b/src/gui/widgets/windowcontainer.h index 757f7ab5a..b27ba927f 100644 --- a/src/gui/widgets/windowcontainer.h +++ b/src/gui/widgets/windowcontainer.h @@ -25,6 +25,8 @@ #include "gui/widgets/container.h" +#include <vector> + /** * A window container. This container adds functionality for more convenient * widget (windows in particular) destruction. @@ -50,7 +52,7 @@ class WindowContainer : public Container /** * List of widgets that are scheduled to be deleted. */ - typedef std::list<gcn::Widget*> Widgets; + typedef std::vector<gcn::Widget*> Widgets; typedef Widgets::iterator WidgetIterator; Widgets mDeathList; }; diff --git a/src/map.cpp b/src/map.cpp index 66c2315ee..01a003f09 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -103,7 +103,7 @@ void TileAnimation::update(int ticks) Image *img = mAnimation->getCurrentImage(); if (img != mLastImage) { - for (std::list<std::pair<MapLayer*, int> >::iterator i = + for (std::vector<std::pair<MapLayer*, int> >::iterator i = mAffected.begin(); i != mAffected.end(); ++i) { i->first->setTile(i->second, img); @@ -767,7 +767,7 @@ void Map::updateAmbientLayers(float scrollX, float scrollY) float dy = scrollY - mLastScrollY; int timePassed = get_elapsed_time(lastTick); - std::list<AmbientLayer*>::iterator i; + std::vector<AmbientLayer*>::iterator i; for (i = mBackgrounds.begin(); i != mBackgrounds.end(); ++i) (*i)->update(timePassed, dx, dy); @@ -787,7 +787,7 @@ void Map::drawAmbientLayers(Graphics *graphics, LayerType type, return; // find out which layer list to draw - std::list<AmbientLayer*> *layers; + std::vector<AmbientLayer*> *layers; switch (type) { case FOREGROUND_LAYERS: @@ -804,7 +804,7 @@ void Map::drawAmbientLayers(Graphics *graphics, LayerType type, } // Draw overlays - for (std::list<AmbientLayer*>::iterator i = layers->begin(); + for (std::vector<AmbientLayer*>::iterator i = layers->begin(); i != layers->end(); ++i) { (*i)->draw(graphics, graphics->getWidth(), graphics->getHeight()); @@ -1464,8 +1464,8 @@ void Map::updatePortalTile(const std::string &name, int type, MapItem *Map::findPortalXY(int x, int y) { - std::list<MapItem*>::iterator it; - std::list<MapItem*>::iterator it_end; + std::vector<MapItem*>::iterator it; + std::vector<MapItem*>::iterator it_end; for (it = mMapPortals.begin(), it_end = mMapPortals.end(); it != it_end; ++it) @@ -1528,7 +1528,7 @@ std::string Map::getObjectData(unsigned x, unsigned y, int type) if (!list) return ""; - std::list<MapObject>::iterator it = list->objects.begin(); + std::vector<MapObject>::iterator it = list->objects.begin(); while (it != list->objects.end()) { if ((*it).type == type) @@ -92,7 +92,7 @@ class MapObject class MapObjectList { public: - std::list<MapObject> objects; + std::vector<MapObject> objects; }; /** @@ -107,7 +107,7 @@ class TileAnimation void addAffectedTile(MapLayer *layer, int index) { mAffected.push_back(std::make_pair(layer, index)); } private: - std::list<std::pair<MapLayer*, int> > mAffected; + std::vector<std::pair<MapLayer*, int> > mAffected; SimpleAnimation *mAnimation; Image *mLastImage; }; @@ -427,7 +427,7 @@ class Map : public Properties, public ConfigListener void updatePortalTile(const std::string &name, int type, int x, int y, bool addNew = true); - std::list<MapItem*> &getPortals() + std::vector<MapItem*> &getPortals() { return mMapPortals; } /** @@ -521,8 +521,8 @@ class Map : public Properties, public ConfigListener unsigned mOnClosedList, mOnOpenList; // Overlay data - std::list<AmbientLayer*> mBackgrounds; - std::list<AmbientLayer*> mForegrounds; + std::vector<AmbientLayer*> mBackgrounds; + std::vector<AmbientLayer*> mForegrounds; float mLastScrollX; float mLastScrollY; // bool mSpritesUpdated; @@ -538,7 +538,7 @@ class Map : public Properties, public ConfigListener }; std::vector<ParticleEffectData> particleEffects; - std::list<MapItem*> mMapPortals; + std::vector<MapItem*> mMapPortals; std::map<int, TileAnimation*> mTileAnimations; diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h index c6c680b13..4bc45cdb3 100644 --- a/src/net/tmwa/inventoryhandler.h +++ b/src/net/tmwa/inventoryhandler.h @@ -36,6 +36,7 @@ #include "net/tmwa/messagehandler.h" #include <list> +#include <vector> #include <queue> #ifdef __GNUC__ @@ -127,7 +128,7 @@ class InventoryItem } }; -typedef std::list<InventoryItem> InventoryItems; +typedef std::vector<InventoryItem> InventoryItems; class InventoryHandler : public MessageHandler, public Net::InventoryHandler { diff --git a/src/resources/emotedb.h b/src/resources/emotedb.h index 53a39685e..94d97a872 100644 --- a/src/resources/emotedb.h +++ b/src/resources/emotedb.h @@ -24,6 +24,7 @@ #include <list> #include <map> #include <string> +#include <vector> class AnimatedSprite; @@ -36,7 +37,7 @@ struct EmoteSprite struct EmoteInfo { std::list<EmoteSprite*> sprites; - std::list<std::string> particles; + std::vector<std::string> particles; }; typedef std::map<int, EmoteInfo*> EmoteInfos; diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h index 424d88869..475ab2e25 100644 --- a/src/resources/spritedef.h +++ b/src/resources/spritedef.h @@ -30,6 +30,7 @@ #include <list> #include <map> #include <string> +#include <vector> class Action; class ImageSet; @@ -56,11 +57,11 @@ struct SpriteDisplay { std::string image; std::string floor; - std::list<SpriteReference*> sprites; - std::list<std::string> particles; + std::vector<SpriteReference*> sprites; + std::vector<std::string> particles; }; -typedef std::list<SpriteReference*>::const_iterator SpriteRefs; +typedef std::vector<SpriteReference*>::const_iterator SpriteRefs; /* * Remember those are the main action. |