Bladeren bron

Fix movement freeze after battle in teleport

Andrii Danylchenko 3 jaren geleden
bovenliggende
commit
c4dec67acc
3 gewijzigde bestanden met toevoegingen van 19 en 1 verwijderingen
  1. 2 1
      client/CPlayerInterface.cpp
  2. 15 0
      lib/serializer/CTypeList.cpp
  3. 2 0
      lib/serializer/CTypeList.h

+ 2 - 1
client/CPlayerInterface.cpp

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

+ 15 - 0
lib/serializer/CTypeList.cpp

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

+ 2 - 0
lib/serializer/CTypeList.h

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