1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix movement freeze after battle in teleport

This commit is contained in:
Andrii Danylchenko 2022-06-19 10:33:24 +03:00 committed by Andrii Danylchenko
parent 188607b05f
commit c4dec67acc
3 changed files with 19 additions and 1 deletions

View File

@ -2771,7 +2771,8 @@ void CPlayerInterface::doMoveHero(const CGHeroInstance * h, CGPath path)
destinationTeleport = destTeleportObj->id;
destinationTeleportPos = nextCoord;
doMovement(h->pos, false);
if (path.nodes[i-1].action == CGPathNode::TELEPORT_BLOCKING_VISIT)
if (path.nodes[i-1].action == CGPathNode::TELEPORT_BLOCKING_VISIT
|| path.nodes[i-1].action == CGPathNode::TELEPORT_BATTLE)
{
destinationTeleport = ObjectInstanceID();
destinationTeleportPos = int3(-1);

View File

@ -45,6 +45,21 @@ ui16 CTypeList::getTypeID(const std::type_info *type, bool throws) const
return descriptor->typeID;
}
CTypeList::TypeInfoPtr CTypeList::getTypeDescriptor(ui16 typeID) const
{
auto found = std::find_if(typeInfos.begin(), typeInfos.end(), [typeID](const std::pair<const std::type_info *, TypeInfoPtr> & p) -> bool
{
return p.second->typeID == typeID;
});
if(found != typeInfos.end())
{
return found->second;
}
return TypeInfoPtr();
}
std::vector<CTypeList::TypeInfoPtr> CTypeList::castSequence(TypeInfoPtr from, TypeInfoPtr to) const
{
if(!strcmp(from->name, to->name))

View File

@ -148,6 +148,8 @@ public:
return getTypeID(getTypeInfo(t), throws);
}
TypeInfoPtr getTypeDescriptor(ui16 typeID) const;
template<typename TInput>
void * castToMostDerived(const TInput * inputPtr) const
{