From fae72b4af815724d6bd3f357f11f6a159c054d02 Mon Sep 17 00:00:00 2001
From: Philipp Sehmisch <tmw@crushnet.org>
Date: Sun, 11 Mar 2007 18:49:32 +0000
Subject: Fixed a bug that made the engine not draw the last row and column of
 the map.

---
 ChangeLog            | 7 ++++++-
 src/gui/viewport.cpp | 4 ++--
 src/map.cpp          | 4 ++--
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3d3406c8..f7e17c06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
-2007-03-09  Bjørn Lindeijer  <bjorn@lindeijer.nl>
+2007-02-27  Philipp Sehmisch  <tmw@crushnet.org>
+
+	* src/map.cpp, src/gui/viewport.cpp: Fixed a bug that made the engine
+	not draw the last row and column of the map.
+
+2007-03-09  Bjørn Lindeijer  <bjorn@lindeijer.nl>
 
 	* data/graphics/gui/target-cursor-blue.png,
 	data/graphics/gui/target-cursor-red.png: Added targeting cursors by Pauan.
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 098b913a..513a7ee5 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -135,8 +135,8 @@ Viewport::draw(gcn::Graphics *gcnGraphics)
     };
 
     // 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();
+    int viewXmax = (mMap->getWidth() * 32) - graphics->getWidth();
+    int viewYmax = (mMap->getHeight() * 32) - graphics->getHeight();
     if (mMap)
     {
         if (mViewX < 0) {
diff --git a/src/map.cpp b/src/map.cpp
index 897fbe22..3206a218 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -150,7 +150,7 @@ Map::draw(Graphics *graphics, int scrollX, int scrollY, int layer)
     if (endX >= mWidth) endX = mWidth - 1;
     if (endY >= mHeight) endY = mHeight - 1;
 
-    for (int y = startY; y < endY; y++)
+    for (int y = startY; y <= endY; y++)
     {
         // If drawing the fringe layer, make sure all sprites above this row of
         // tiles have been drawn
@@ -163,7 +163,7 @@ Map::draw(Graphics *graphics, int scrollX, int scrollY, int layer)
             }
         }
 
-        for (int x = startX; x < endX; x++)
+        for (int x = startX; x <= endX; x++)
         {
             Image *img = getTile(x, y, layer);
             if (img) {
-- 
cgit v1.2.3-70-g09d2