mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-05 00:49:09 +02:00
Remove pointer to boat from CGHeroInstance
This commit is contained in:
@ -372,8 +372,8 @@ void MapViewController::fadeOutObject(const CGObjectInstance * obj)
|
||||
if (obj->ID == Obj::HERO)
|
||||
{
|
||||
auto * hero = dynamic_cast<const CGHeroInstance*>(obj);
|
||||
if (hero->boat)
|
||||
movingObject = hero->boat;
|
||||
if (hero->inBoat())
|
||||
movingObject = hero->getBoat();
|
||||
}
|
||||
|
||||
fadingOutContext->target = movingObject->id;
|
||||
@ -393,8 +393,8 @@ void MapViewController::fadeInObject(const CGObjectInstance * obj)
|
||||
if (obj->ID == Obj::HERO)
|
||||
{
|
||||
auto * hero = dynamic_cast<const CGHeroInstance*>(obj);
|
||||
if (hero->boat)
|
||||
movingObject = hero->boat;
|
||||
if (hero->inBoat())
|
||||
movingObject = hero->getBoat();
|
||||
}
|
||||
|
||||
fadingInContext->target = movingObject->id;
|
||||
@ -416,10 +416,10 @@ void MapViewController::removeObject(const CGObjectInstance * obj)
|
||||
if (obj->ID == Obj::HERO)
|
||||
{
|
||||
auto * hero = dynamic_cast<const CGHeroInstance*>(obj);
|
||||
if (hero->boat)
|
||||
if (hero->inBoat())
|
||||
{
|
||||
view->invalidate(context, hero->boat->id);
|
||||
state->removeObject(hero->boat);
|
||||
view->invalidate(context, hero->getBoat()->id);
|
||||
state->removeObject(hero->getBoat());
|
||||
}
|
||||
}
|
||||
|
||||
@ -514,8 +514,8 @@ void MapViewController::onAfterHeroTeleported(const CGHeroInstance * obj, const
|
||||
assert(!hasOngoingAnimations());
|
||||
|
||||
const CGObjectInstance * movingObject = obj;
|
||||
if(obj->boat)
|
||||
movingObject = obj->boat;
|
||||
if(obj->inBoat())
|
||||
movingObject = obj->getBoat();
|
||||
|
||||
removeObject(movingObject);
|
||||
addObject(movingObject);
|
||||
@ -541,8 +541,8 @@ void MapViewController::onHeroMoved(const CGHeroInstance * obj, const int3 & fro
|
||||
return;
|
||||
|
||||
const CGObjectInstance * movingObject = obj;
|
||||
if(obj->boat)
|
||||
movingObject = obj->boat;
|
||||
if(obj->inBoat())
|
||||
movingObject = obj->getBoat();
|
||||
|
||||
removeObject(movingObject);
|
||||
|
||||
|
Reference in New Issue
Block a user