From: Daniel Karbach Date: Thu, 11 Oct 2012 21:43:25 +0000 (+0200) Subject: fixed entity bounds in Map X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=3d7e44003c4a2d555c753b078d7199736af4a939;p=l2e.git fixed entity bounds in Map --- diff --git a/src/map/Map.h b/src/map/Map.h index 5eacc7b..40cce1c 100644 --- a/src/map/Map.h +++ b/src/map/Map.h @@ -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 &); geometry::Vector TileCoordinates(const geometry::Vector &) 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 &offset) const; void RenderDebug(SDL_Surface *dest, const geometry::Vector &offset) const; diff --git a/src/map/MapState.cpp b/src/map/MapState.cpp index 773190e..8f5a127 100644 --- a/src/map/MapState.cpp +++ b/src/map/MapState.cpp @@ -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); }