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;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -230,7 +238,15 @@ void MapViewController::fadeInObject(const CGObjectInstance * obj)
|
||||
adventureContext = 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;
|
||||
}
|
||||
|
||||
@ -324,8 +340,12 @@ void MapViewController::onAfterHeroTeleported(const CGHeroInstance * obj, const
|
||||
{
|
||||
assert(!hasOngoingAnimations());
|
||||
|
||||
removeObject(obj);
|
||||
addObject(obj);
|
||||
const CGObjectInstance * movingObject = obj;
|
||||
if(obj->boat)
|
||||
movingObject = obj->boat;
|
||||
|
||||
removeObject(movingObject);
|
||||
addObject(movingObject);
|
||||
|
||||
if(isEventVisible(obj, from, dest))
|
||||
{
|
||||
@ -333,7 +353,7 @@ void MapViewController::onAfterHeroTeleported(const CGHeroInstance * obj, const
|
||||
teleportContext->animationTime = adventureContext->animationTime;
|
||||
adventureContext = teleportContext;
|
||||
context = teleportContext;
|
||||
setViewCenter(obj->getSightCenter());
|
||||
setViewCenter(movingObject->getSightCenter());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user