diff --git a/server/World.cpp b/server/World.cpp index 55376a2..b54f907 100644 --- a/server/World.cpp +++ b/server/World.cpp @@ -84,6 +84,9 @@ boost::asio::awaitable Playfield::updateRobot(const Connection::Client *se if (localRobot->health() != newRobot.health()) { throw Connection::Error("Can't change value", Generic::Error::IllegalOperation); } + if (newRobot.position().x() > 1.0f || newRobot.position().x() < 0.0f || newRobot.position().y() > 1.0f || newRobot.position().y() < 0.0f) { + throw Connection::Error("Position is out of range", Generic::Error::OutOfRange); + } // Apply heal if (newRobot.state() == Generic::Robot::Heal) { newRobot.set_health(localRobot->health() + settings.healperturn());