From 3d7e44003c4a2d555c753b078d7199736af4a939 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Thu, 11 Oct 2012 23:43:25 +0200 Subject: [PATCH] fixed entity bounds in Map --- src/map/Map.h | 5 +++-- src/map/MapState.cpp | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) 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); } -- 2.39.2