瀏覽代碼

Fix build

MichalZr6 5 月之前
父節點
當前提交
ef95f34bdb
共有 2 個文件被更改,包括 4 次插入20 次删除
  1. 3 19
      mapeditor/mapcontroller.cpp
  2. 1 1
      mapeditor/mapview.cpp

+ 3 - 19
mapeditor/mapcontroller.cpp

@@ -683,23 +683,7 @@ void MapController::modAssessmentObject(const CGObjectInstance * obj, ModCompati
 
 		for(const auto & spellID : town->obligatorySpells)
 		{
-			auto hero = dynamic_cast<CGHeroInstance *>(obj.get());
-			for(const auto & spellID : hero->getSpellsInSpellbook())
-			{
-				if(spellID == SpellID::PRESET || spellID == SpellID::SPELLBOOK_PRESET)
-					continue;
-				extractEntityMod(spellID.toEntity(LIBRARY));
-			}
-
-			for(const auto & [_, slotInfo] : hero->artifactsWorn)
-			{
-				extractEntityMod(slotInfo.getArt()->getTypeId().toEntity(LIBRARY));
-			}
-
-			for(const auto & art : hero->artifactsInBackpack)
-			{
-				extractEntityMod(art.getArt()->getTypeId().toEntity(LIBRARY));
-			}
+			extractEntityMod(spellID.toEntity(LIBRARY));
 		}
 	}
 
@@ -715,12 +699,12 @@ void MapController::modAssessmentObject(const CGObjectInstance * obj, ModCompati
 
 		for(const auto & [_, slotInfo] : hero->artifactsWorn)
 		{
-			extractEntityMod(slotInfo.artifact->getTypeId().toEntity(LIBRARY));
+			extractEntityMod(slotInfo.getArt()->getTypeId().toEntity(LIBRARY));
 		}
 
 		for(const auto & art : hero->artifactsInBackpack)
 		{
-			extractEntityMod(art.artifact->getTypeId().toEntity(LIBRARY));
+			extractEntityMod(art.getArt()->getTypeId().toEntity(LIBRARY));
 		}
 	}
 

+ 1 - 1
mapeditor/mapview.cpp

@@ -614,7 +614,7 @@ void MapView::dropEvent(QDropEvent * event)
 	if(sc->selectionObjectsView.newObject)
 	{
 		QString errorMsg;
-		if(controller->canPlaceObject(sc->selectionObjectsView.newObject, errorMsg))
+		if(controller->canPlaceObject(sc->selectionObjectsView.newObject.get(), errorMsg))
 		{
 			auto obj = sc->selectionObjectsView.newObject;
 			controller->commitObjectCreate(sc->level);