summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map.cpp22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 52459415..f1f8d091 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -474,25 +474,15 @@ void Map::drawAmbientLayers(Graphics *graphics, LayerType type,
}
}
-class ContainsGidFunctor
-{
- public:
- bool operator() (const Tileset *set) const
- {
- return (set->getFirstGid() <= gid &&
- gid - set->getFirstGid() < (int)set->size());
- }
- int gid;
-} containsGid;
-
Tileset *Map::getTilesetWithGid(int gid) const
{
- containsGid.gid = gid;
-
- Tilesets::const_iterator i = find_if(mTilesets.begin(), mTilesets.end(),
- containsGid);
+ Tileset *s = NULL;
+ for (Tilesets::const_iterator it = mTilesets.begin(),
+ it_end = mTilesets.end(); it < it_end && (*it)->getFirstGid() <= gid;
+ it++)
+ s = *it;
- return (i == mTilesets.end()) ? NULL : *i;
+ return s;
}
void Map::blockTile(int x, int y, BlockType type)