diff --git a/src/worldviewport.cpp b/src/worldviewport.cpp index 99f57ce..9b72e61 100644 --- a/src/worldviewport.cpp +++ b/src/worldviewport.cpp @@ -2,6 +2,7 @@ #include "worldgrid.hpp" #include "compatibility.h" #include +#include namespace curry { namespace { @@ -11,8 +12,8 @@ namespace curry { const auto pos = vector_cast(parViewport.position()); const auto ts = parViewport.world()->tile_size(); return vec2us( - static_cast(pos.x() / ts.x()), - static_cast(pos.y() / ts.y()) + static_cast(std::max(0, pos.x()) / ts.x()), + static_cast(std::max(0, pos.y()) / ts.y()) ); } } //unnamed namespace