]> git.localhorst.tv Git - l2e.git/commitdiff
fixed entity bounds in Map
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 11 Oct 2012 21:43:25 +0000 (23:43 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 11 Oct 2012 21:43:25 +0000 (23:43 +0200)
src/map/Map.h
src/map/MapState.cpp

index 5eacc7b9b08e15ba2c3d4968debc6793a97811b0..40cce1c497259e31a719a4bcf3114c2ded2478b7 100644 (file)
@@ -8,6 +8,7 @@
 #ifndef MAP_MAP_H_
 #define MAP_MAP_H_
 
+#include "Entity.h"
 #include "fwd.h"
 #include "../geometry/Vector.h"
 #include "../graphics/fwd.h"
@@ -32,8 +33,8 @@ public:
        SDL_Surface *BattleBackgroundAt(const geometry::Vector<int> &);
        geometry::Vector<int> TileCoordinates(const geometry::Vector<int> &) const;
 
-       Entity **EntitiesBegin() { return &entities; }
-       Entity **EntitiesEnd() { return (&entities) + numEntities; }
+       Entity *EntitiesBegin() { return entities; }
+       Entity *EntitiesEnd() { return entities + numEntities; }
 
        void Render(SDL_Surface *dest, const geometry::Vector<int> &offset) const;
        void RenderDebug(SDL_Surface *dest, const geometry::Vector<int> &offset) const;
index 773190e88952b604511fb4a249f94d751035c4a2..8f5a1277e610b1d86e787eb8c2c8fef009278ce8 100644 (file)
@@ -347,7 +347,9 @@ void MapState::UnloadMap() {
 
 void MapState::LoadMap(Map *m) {
        map = m;
-       entities.insert(entities.end(), m->EntitiesBegin(), m->EntitiesEnd());
+       for (Entity *e(m->EntitiesBegin()), *end(m->EntitiesEnd()); e != end; ++e) {
+               entities.push_back(e);
+       }
        for (Entity *e(controlled); e; e = e->Follower()) {
                entities.push_back(e);
        }