mirror of
https://github.com/vcmi/vcmi.git
synced 2025-10-08 23:22:25 +02:00
Merge pull request #6148 from MichalZr6/fix_remove_artifacts
Minor fixes for artifact removal during map load and handling null map objects
This commit is contained in:
@@ -925,8 +925,7 @@ void CMapLoaderH3M::loadArtifactsOfHero(CGHeroInstance * hero)
|
||||
logGlobal->debug("Hero %d at %s has set artifacts twice (in map properties and on adventure map instance). Using the latter set...", hero->getHeroTypeID().getNum(), hero->anchorPos().toString());
|
||||
|
||||
hero->artifactsInBackpack.clear();
|
||||
while(!hero->artifactsWorn.empty())
|
||||
hero->removeArtifact(hero->artifactsWorn.begin()->first);
|
||||
hero->artifactsWorn.clear();
|
||||
}
|
||||
|
||||
for(int i = 0; i < features.artifactSlotsCount; i++)
|
||||
|
@@ -618,6 +618,9 @@ void MainWindow::saveMap()
|
||||
|
||||
for(auto obj : controller.map()->objects)
|
||||
{
|
||||
if(!obj)
|
||||
continue;
|
||||
|
||||
if(obj->ID == Obj::HERO_PLACEHOLDER)
|
||||
{
|
||||
auto hero = dynamic_cast<CGHeroPlaceholder *>(obj.get());
|
||||
|
@@ -746,6 +746,8 @@ ModCompatibilityInfo MapController::modAssessmentMap(const CMap & map)
|
||||
|
||||
for(auto obj : map.objects)
|
||||
{
|
||||
if(!obj)
|
||||
continue;
|
||||
modAssessmentObject(obj.get(), result);
|
||||
}
|
||||
return result;
|
||||
|
@@ -20,7 +20,10 @@ void Translations::cleanupRemovedItems(CMap & map)
|
||||
{
|
||||
std::set<std::string> existingObjects{"map", "header"};
|
||||
for(auto object : map.objects)
|
||||
{
|
||||
if(object)
|
||||
existingObjects.insert(object->instanceName);
|
||||
}
|
||||
|
||||
for(auto & translations : map.translations.Struct())
|
||||
{
|
||||
|
@@ -79,6 +79,8 @@ std::set<Validator::Issue> Validator::validate(const CMap * map)
|
||||
//checking all objects in the map
|
||||
for(auto o : map->objects)
|
||||
{
|
||||
if(!o)
|
||||
continue;
|
||||
//owners for objects
|
||||
if(o->getOwner() == PlayerColor::UNFLAGGABLE)
|
||||
{
|
||||
|
Reference in New Issue
Block a user