From 4cb2485cdf84c12315851189ee1bd245df13da7c Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Thu, 24 Feb 2011 22:13:40 +0000 Subject: [PATCH] - fixed meeting point crash on edge of map --- source/glest_game/world/world.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/glest_game/world/world.cpp b/source/glest_game/world/world.cpp index 99d330a4..4b9bf627 100644 --- a/source/glest_game/world/world.cpp +++ b/source/glest_game/world/world.cpp @@ -556,7 +556,15 @@ bool World::placeUnit(const Vec2i &startLoc, int radius, Unit *unit, bool spacia if(freeSpace) { unit->setPos(pos); - unit->setMeetingPos(pos-Vec2i(1)); + Vec2i meetingPos = pos-Vec2i(1); + if(meetingPos.x < 0) { + meetingPos.x = 0; + } + if(meetingPos.y < 0) { + meetingPos.y = 0; + } + + unit->setMeetingPos(meetingPos); return true; } }