Allow moving past the top-left edge of the world.
This commit is contained in:
parent
d7868800d4
commit
1313dad568
1 changed files with 3 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
|||
#include "worldgrid.hpp"
|
||||
#include "compatibility.h"
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
|
||||
namespace curry {
|
||||
namespace {
|
||||
|
@ -11,8 +12,8 @@ namespace curry {
|
|||
const auto pos = vector_cast<vec2i>(parViewport.position());
|
||||
const auto ts = parViewport.world()->tile_size();
|
||||
return vec2us(
|
||||
static_cast<uint16_t>(pos.x() / ts.x()),
|
||||
static_cast<uint16_t>(pos.y() / ts.y())
|
||||
static_cast<uint16_t>(std::max(0, pos.x()) / ts.x()),
|
||||
static_cast<uint16_t>(std::max(0, pos.y()) / ts.y())
|
||||
);
|
||||
}
|
||||
} //unnamed namespace
|
||||
|
|
Loading…
Reference in a new issue