From fde8c71c5ea849e0c246909679c3d5cd3a36808e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Sun, 13 Oct 2013 20:05:34 +0000 Subject: [PATCH] Fixed setting -1 as hero direction that was causing crashes, like #1488. --- lib/NetPacksLib.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/NetPacksLib.cpp b/lib/NetPacksLib.cpp index e87e82347..98ef61fb0 100644 --- a/lib/NetPacksLib.cpp +++ b/lib/NetPacksLib.cpp @@ -407,8 +407,12 @@ void TryMoveHero::applyGs( CGameState *gs ) CGHeroInstance *h = gs->getHero(id); h->movement = movePoints; - if((result == SUCCESS || result == BLOCKING_VISIT || result == EMBARK || result == DISEMBARK) && start != end) { - h->moveDir = getDir(start,end); + if((result == SUCCESS || result == BLOCKING_VISIT || result == EMBARK || result == DISEMBARK) && start != end) + { + auto dir = getDir(start,end); + if(dir > 0 && dir <= 8) + h->moveDir = dir; + //else dont change movedir - hero might have traversed the subterranean gate, dorectopm shpuld be kept } if(result == EMBARK) //hero enters boat at dest tile