summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/resources/map/maplayer.cpp9
-rw-r--r--src/resources/map/maplayer_unittest.cc12
2 files changed, 15 insertions, 6 deletions
diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp
index c481f8e33..90ef48e4a 100644
--- a/src/resources/map/maplayer.cpp
+++ b/src/resources/map/maplayer.cpp
@@ -109,9 +109,6 @@ void MapLayer::draw(Graphics *const graphics,
const int scrollX,
const int scrollY) const restrict
{
- if (!localPlayer)
- return;
-
BLOCK_START("MapLayer::draw")
startX -= mX;
startY -= mY;
@@ -140,7 +137,7 @@ void MapLayer::draw(Graphics *const graphics,
TileInfo *tilePtr = &mTiles[CAST_SIZE(x0 + yWidth)];
if (tilePtr->isEnabled == false)
{
- if (x0 + tilePtr->nextTile >= endX)
+ if (x0 + tilePtr->nextTile + 1 >= endX)
{
continue;
}
@@ -567,7 +564,7 @@ void MapLayer::drawFringe(Graphics *const graphics,
std::min(x0 + tilePtr->nextTile + 1, endX),
scrollX,
scrollY);
- if (x0 + tilePtr->nextTile >= endX)
+ if (x0 + tilePtr->nextTile + 1 >= endX)
{
continue;
}
@@ -657,7 +654,7 @@ void MapLayer::drawFringe(Graphics *const graphics,
TileInfo *tilePtr = &mTiles[CAST_SIZE(x0 + yWidth)];
if (tilePtr->isEnabled == false)
{
- if (x0 + tilePtr->nextTile >= endX)
+ if (x0 + tilePtr->nextTile + 1 >= endX)
continue;
x0 += tilePtr->nextTile + 1;
tilePtr = &mTiles[CAST_SIZE(x0 + yWidth)];
diff --git a/src/resources/map/maplayer_unittest.cc b/src/resources/map/maplayer_unittest.cc
index 97a174cf5..014b2b71d 100644
--- a/src/resources/map/maplayer_unittest.cc
+++ b/src/resources/map/maplayer_unittest.cc
@@ -19,11 +19,16 @@
*/
#include "catch.hpp"
+#include "logger.h"
#include "graphicsmanager.h"
+#include "being/localplayer.h"
+
#include "enums/resources/map/blockmask.h"
#include "enums/resources/map/mapitemtype.h"
+#include "gui/theme.h"
+
#include "render/mockgraphics.h"
#include "resources/sdlimagehelper.h"
@@ -2339,6 +2344,7 @@ TEST_CASE("MapLayer drawFringe")
ResourceManager::init();
resourceManager->addToSearchPath("data", Append_false);
resourceManager->addToSearchPath("../data", Append_false);
+ logger = new Logger;
imageHelper = new SDLImageHelper;
#ifdef USE_SDL2
@@ -2350,6 +2356,12 @@ TEST_CASE("MapLayer drawFringe")
graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE);
#endif // USE_SDL2
+ theme = new Theme;
+ Theme::selectSkin();
+
+ localPlayer = new LocalPlayer(static_cast<BeingId>(1),
+ BeingTypeId_zero);
+
Image *const img1 = new Image(32, 32);
Image *const img2 = new Image(32, 32);
Image *const img3 = new Image(32, 32);