Browse Source

some refactoring

SoundSSGood 2 years ago
parent
commit
2976739c97
2 changed files with 7 additions and 8 deletions
  1. 2 3
      client/NetPacksClient.cpp
  2. 5 5
      lib/CArtHandler.cpp

+ 2 - 3
client/NetPacksClient.cpp

@@ -294,9 +294,8 @@ void BulkMoveArtifacts::applyCl(CClient * cl)
 		{
 			auto srcLoc = ArtifactLocation(srcArtHolder, slotToMove.srcPos);
 			auto dstLoc = ArtifactLocation(dstArtHolder, slotToMove.dstPos);
-			callInterfaceIfPresent(cl, srcLoc.owningPlayer(), &IGameEventsReceiver::artifactMoved, srcLoc, dstLoc);
-			if(srcLoc.owningPlayer() != dstLoc.owningPlayer())
-				callInterfaceIfPresent(cl, dstLoc.owningPlayer(), &IGameEventsReceiver::artifactMoved, srcLoc, dstLoc);
+			MoveArtifact ma(&srcLoc, &dstLoc, false);
+			ma.applyCl(cl);
 		}
 	};
 

+ 5 - 5
lib/CArtHandler.cpp

@@ -1032,13 +1032,13 @@ bool CCombinedArtifactInstance::canBePutAt(const CArtifactSet * artSet, Artifact
 
 	CArtifactFittingSet fittingSet(artSet->bearerType());
 	fittingSet.artifactsWorn = artSet->artifactsWorn;
-	auto removedArt = fittingSet.getArt(slot);
-	if(assumeDestRemoved && removedArt)
+	auto artToRemove = fittingSet.getArt(slot);
+	if(assumeDestRemoved && artToRemove)
 	{
-		if(removedArt->canBeDisassembled())
+		if(artToRemove->canBeDisassembled())
 		{
-			auto contitutient = dynamic_cast<CCombinedArtifactInstance*>(removedArt);
-			for(auto & part : contitutient->constituentsInfo)
+			auto combinedArtToRemove = dynamic_cast<CCombinedArtifactInstance*>(artToRemove);
+			for(auto & part : combinedArtToRemove->constituentsInfo)
 			{
 				if(ArtifactUtils::isSlotEquipment(part.slot))
 				{