summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-07-19 20:22:59 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-07-19 20:22:59 +0200
commit86eb0c08d233636cd4647649c6542d3cf410e3ab (patch)
tree9721759b41f0256f15c3786c357448a93215440e /src/map.cpp
parent335eec717f6189c01d8217dd2c4f4e74a171d9a5 (diff)
parent2d584d7e8aaeacbcb1036bae5c8deca9b810fe60 (diff)
downloadmana-86eb0c08d233636cd4647649c6542d3cf410e3ab.tar.gz
mana-86eb0c08d233636cd4647649c6542d3cf410e3ab.tar.bz2
mana-86eb0c08d233636cd4647649c6542d3cf410e3ab.tar.xz
mana-86eb0c08d233636cd4647649c6542d3cf410e3ab.zip
Merge branch '1.0'
Conflicts: src/gui/itempopup.cpp src/item.cpp src/monster.cpp src/net/manaserv/playerhandler.cpp src/net/tmwa/partyhandler.cpp src/npc.cpp src/player.cpp src/resources/itemdb.cpp src/resources/monsterdb.cpp src/resources/monsterinfo.cpp src/resources/npcdb.cpp src/resources/spritedef.cpp
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 33bbccb1..f5214420 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -472,25 +472,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)