diff options
author | Ira Rice <irarice@gmail.com> | 2008-12-07 16:53:32 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-12-07 16:53:32 -0700 |
commit | aef082e6fe4fca268f9bfe401409eb342f82e4af (patch) | |
tree | 26e9f2f2be9ad59666a4c039c7717e0e5becd3eb /src/map.cpp | |
parent | 7f24abc455a407e84f13d75099e36db77fa8931d (diff) | |
parent | a7c21e6f8add37af7412449742ec55c8daa8571a (diff) | |
download | mana-aef082e6fe4fca268f9bfe401409eb342f82e4af.tar.gz mana-aef082e6fe4fca268f9bfe401409eb342f82e4af.tar.bz2 mana-aef082e6fe4fca268f9bfe401409eb342f82e4af.tar.xz mana-aef082e6fe4fca268f9bfe401409eb342f82e4af.zip |
Merge commit 'a7c21e6f8add37af7412449742ec55c8daa8571a'
Conflicts:
AUTHORS
CMakeLists.txt
ChangeLog
INSTALL
README
aethyra.cbp
configure.ac
data/help/changes.txt
data/help/commands.txt
data/help/header.txt
data/help/support.txt
src/Makefile.am
src/aethyra.rc
src/being.cpp
src/being.h
src/equipment.cpp
src/equipment.h
src/floor_item.h
src/game.cpp
src/gui/buddywindow.cpp
src/gui/char_select.cpp
src/gui/char_server.cpp
src/gui/chat.cpp
src/gui/chat.h
src/gui/equipmentwindow.cpp
src/gui/equipmentwindow.h
src/gui/gui.cpp
src/gui/inventorywindow.cpp
src/gui/inventorywindow.h
src/gui/itemcontainer.cpp
src/gui/itemcontainer.h
src/gui/minimap.cpp
src/gui/ministatus.cpp
src/gui/newskill.cpp
src/gui/npc_text.cpp
src/gui/npclistdialog.h
src/gui/ok_dialog.cpp
src/gui/setup_video.cpp
src/gui/skill.cpp
src/gui/skill.h
src/gui/status.h
src/gui/table_model.h
src/gui/updatewindow.cpp
src/gui/viewport.cpp
src/inventory.cpp
src/inventory.h
src/keyboardconfig.cpp
src/keyboardconfig.h
src/localplayer.cpp
src/localplayer.h
src/logindata.h
src/main.cpp
src/map.cpp
src/monster.cpp
src/monster.h
src/net/beinghandler.cpp
src/net/beinghandler.h
src/net/buysellhandler.cpp
src/net/equipmenthandler.cpp
src/net/loginhandler.cpp
src/net/loginhandler.h
src/net/network.h
src/net/npchandler.cpp
src/net/playerhandler.cpp
src/net/protocol.h
src/net/tradehandler.cpp
src/npc.cpp
src/npc.h
src/particleemitter.cpp
src/particleemitterprop.h
src/player.cpp
src/player.h
src/player_relations.cpp
src/resources/imageset.cpp
src/resources/imageset.h
src/resources/itemdb.cpp
src/resources/mapreader.cpp
src/resources/monsterinfo.h
src/text.cpp
src/text.h
src/textmanager.cpp
src/textmanager.h
src/tileset.h
src/utils/fastsqrt.h
src/utils/strprintf.cpp
src/winver.h
tools/tmxcopy/Makefile
tools/tmxcopy/base64.cpp
tools/tmxcopy/base64.h
tools/tmxcopy/tostring.h
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/map.cpp')
-rw-r--r-- | src/map.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/map.cpp b/src/map.cpp index 612d9020..02b046fb 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -71,22 +71,22 @@ MapLayer::MapLayer(int x, int y, int width, int height, bool isFringeLayer): mTiles = new Image*[size]; std::fill_n(mTiles, size, (Image*) 0); } - + MapLayer::~MapLayer() { delete[] mTiles; } - + void MapLayer::setTile(int x, int y, Image *img) { mTiles[x + y * mWidth] = img; } - + Image* MapLayer::getTile(int x, int y) const { return mTiles[x + y * mWidth]; } - + void MapLayer::draw(Graphics *graphics, int startX, int startY, int endX, int endY, @@ -97,43 +97,43 @@ void MapLayer::draw(Graphics *graphics, startY -= mY; endX -= mX; endY -= mY; - + if (startX < 0) startX = 0; if (startY < 0) startY = 0; if (endX > mWidth) endX = mWidth; if (endY > mHeight) endY = mHeight; - + Sprites::const_iterator si = sprites.begin(); - + for (int y = startY; y < endY; y++) { // If drawing the fringe layer, make sure all sprites above this row of // tiles have been drawn if (mIsFringeLayer) { - player_node->drawTargetCursor(graphics, scrollX, scrollY); - while (si != sprites.end() && (*si)->getPixelY() <= y * 32 - 32) { - (*si)->draw(graphics, -scrollX, -scrollY); - si++; - } + player_node->drawTargetCursor(graphics, scrollX, scrollY); + while (si != sprites.end() && (*si)->getPixelY() <= y * 32 - 32) { + (*si)->draw(graphics, -scrollX, -scrollY); + si++; + } } for (int x = startX; x < endX; x++) { - Image *img = getTile(x, y); - if (img) { - const int px = (x + mX) * 32 - scrollX; - const int py = (y + mY) * 32 - scrollY + 32 - img->getHeight(); - graphics->drawImage(img, px, py); - } - } + Image *img = getTile(x, y); + if (img) { + const int px = (x + mX) * 32 - scrollX; + const int py = (y + mY) * 32 - scrollY + 32 - img->getHeight(); + graphics->drawImage(img, px, py); + } + } } - + // Draw any remaining sprites if (mIsFringeLayer) { - while (si != sprites.end()) { - (*si)->draw(graphics, -scrollX, -scrollY); - si++; - } + while (si != sprites.end()) { + (*si)->draw(graphics, -scrollX, -scrollY); + si++; + } } } @@ -186,7 +186,7 @@ void Map::initializeOverlays() void Map::addLayer(MapLayer *layer) { - mLayers.push_back(layer); + mLayers.push_back(layer); } void Map::addTileset(Tileset *tileset) @@ -273,7 +273,7 @@ void Map::drawOverlay(Graphics *graphics, class ContainsGidFunctor { public: - bool operator() (Tileset* set) const + bool operator() (const Tileset* set) const { return (set->getFirstGid() <= gid && gid - set->getFirstGid() < (int)set->size()); |