1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Fixed setting -1 as hero direction that was causing crashes, like #1488.

This commit is contained in:
Michał W. Urbańczyk 2013-10-13 20:05:34 +00:00
parent d5263d75f8
commit fde8c71c5e

View File

@ -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