Selaa lähdekoodia

map-editor: add hero placeholder with heroType defined to `reservedCampaignHeroes` on map save

godric3 1 vuosi sitten
vanhempi
sitoutus
786be6f253
1 muutettua tiedostoa jossa 12 lisäystä ja 0 poistoa
  1. 12 0
      mapeditor/mainwindow.cpp

+ 12 - 0
mapeditor/mainwindow.cpp

@@ -452,6 +452,18 @@ void MainWindow::saveMap()
 	
 	Translations::cleanupRemovedItems(*controller.map());
 
+	for(auto obj : controller.map()->objects)
+	{
+		if(obj->ID == Obj::HERO_PLACEHOLDER)
+		{
+			auto hero = dynamic_cast<CGHeroPlaceholder *>(obj.get());
+			if(hero->heroType.has_value())
+			{
+				controller.map()->reservedCampaignHeroes.insert(hero->heroType.value());
+			}
+		}
+	}
+
 	CMapService mapService;
 	try
 	{