mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Fix crash on killing hero in boat & visual artifacts from whirpool
This commit is contained in:
parent
39f2bef1ab
commit
87eab92290
@ -219,7 +219,15 @@ void MapViewController::fadeOutObject(const CGObjectInstance * obj)
|
|||||||
adventureContext = fadingOutContext;
|
adventureContext = fadingOutContext;
|
||||||
context = fadingOutContext;
|
context = fadingOutContext;
|
||||||
|
|
||||||
fadingOutContext->target = obj->id;
|
const CGObjectInstance * movingObject = obj;
|
||||||
|
if (obj->ID == Obj::HERO)
|
||||||
|
{
|
||||||
|
auto * hero = dynamic_cast<const CGHeroInstance*>(obj);
|
||||||
|
if (hero->boat)
|
||||||
|
movingObject = hero->boat;
|
||||||
|
}
|
||||||
|
|
||||||
|
fadingOutContext->target = movingObject->id;
|
||||||
fadingOutContext->progress = 1.0;
|
fadingOutContext->progress = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +238,15 @@ void MapViewController::fadeInObject(const CGObjectInstance * obj)
|
|||||||
adventureContext = fadingInContext;
|
adventureContext = fadingInContext;
|
||||||
context = fadingInContext;
|
context = fadingInContext;
|
||||||
|
|
||||||
fadingInContext->target = obj->id;
|
const CGObjectInstance * movingObject = obj;
|
||||||
|
if (obj->ID == Obj::HERO)
|
||||||
|
{
|
||||||
|
auto * hero = dynamic_cast<const CGHeroInstance*>(obj);
|
||||||
|
if (hero->boat)
|
||||||
|
movingObject = hero->boat;
|
||||||
|
}
|
||||||
|
|
||||||
|
fadingInContext->target = movingObject->id;
|
||||||
fadingInContext->progress = 0.0;
|
fadingInContext->progress = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,8 +340,12 @@ void MapViewController::onAfterHeroTeleported(const CGHeroInstance * obj, const
|
|||||||
{
|
{
|
||||||
assert(!hasOngoingAnimations());
|
assert(!hasOngoingAnimations());
|
||||||
|
|
||||||
removeObject(obj);
|
const CGObjectInstance * movingObject = obj;
|
||||||
addObject(obj);
|
if(obj->boat)
|
||||||
|
movingObject = obj->boat;
|
||||||
|
|
||||||
|
removeObject(movingObject);
|
||||||
|
addObject(movingObject);
|
||||||
|
|
||||||
if(isEventVisible(obj, from, dest))
|
if(isEventVisible(obj, from, dest))
|
||||||
{
|
{
|
||||||
@ -333,7 +353,7 @@ void MapViewController::onAfterHeroTeleported(const CGHeroInstance * obj, const
|
|||||||
teleportContext->animationTime = adventureContext->animationTime;
|
teleportContext->animationTime = adventureContext->animationTime;
|
||||||
adventureContext = teleportContext;
|
adventureContext = teleportContext;
|
||||||
context = teleportContext;
|
context = teleportContext;
|
||||||
setViewCenter(obj->getSightCenter());
|
setViewCenter(movingObject->getSightCenter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user