summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2007-02-10 18:28:17 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2007-02-10 18:28:17 +0000
commitd9af4a90a1b242645d38ff1427793ba86c1805b7 (patch)
tree9ed0ecc8fa53cb357f2e914145ef3bfea4458bc9
parent41cee6568c7c005ed54d665b82cc5f251b23ab59 (diff)
downloadmana-d9af4a90a1b242645d38ff1427793ba86c1805b7.tar.gz
mana-d9af4a90a1b242645d38ff1427793ba86c1805b7.tar.bz2
mana-d9af4a90a1b242645d38ff1427793ba86c1805b7.tar.xz
mana-d9af4a90a1b242645d38ff1427793ba86c1805b7.zip
Fixed the bug in the scrolling limitation that made it possible to scroll outside of the map in the south and east.
-rw-r--r--ChangeLog7
-rw-r--r--src/gui/viewport.cpp14
2 files changed, 15 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 880a3b9d..1ef0afbe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
-2007-02-04 Bjørn Lindeijer <bjorn@lindeijer.nl>
+2007-02-10 Philipp Sehmisch <tmw@crushnet.org>
+
+ * src/gui/viewport.cpp: Fixed the bug in the scrolling limitation that made
+ it possible to scroll outside of the map in the south and east.
+
+2007-02-04 Bjørn Lindeijer <bjorn@lindeijer.nl>
* src/gui/menuwindow.cpp: Fixed a small glitch when dragging the menu
window.
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 90f3536c..098b913a 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -134,18 +134,22 @@ Viewport::draw(gcn::Graphics *gcnGraphics)
mViewY = player_y;
};
- if (mMap) {
+ // Don't move camera so that the end of the map is on screen
+ int viewXmax = ((mMap->getWidth() - 1) * 32) - graphics->getWidth();
+ int viewYmax = ((mMap->getHeight() - 1) * 32) - graphics->getHeight();
+ if (mMap)
+ {
if (mViewX < 0) {
mViewX = 0;
}
if (mViewY < 0) {
mViewY = 0;
}
- if (mViewX > (mMap->getWidth() - midTileX) * 32) {
- mViewX = (mMap->getWidth() - midTileX) * 32;
+ if (mViewX > viewXmax) {
+ mViewX = viewXmax;
}
- if (mViewY > (mMap->getHeight() - midTileY) * 32) {
- mViewY = (mMap->getHeight() - midTileY) * 32;
+ if (mViewY > viewYmax) {
+ mViewY = viewYmax;
}
}