Просмотр исходного кода

Fix mine resource and productivity on map load, also made them non editable

godric3 1 год назад
Родитель
Сommit
ec735aa959
2 измененных файлов с 10 добавлено и 1 удалено
  1. 1 1
      mapeditor/inspector/inspector.cpp
  2. 9 0
      mapeditor/mapcontroller.cpp

+ 1 - 1
mapeditor/inspector/inspector.cpp

@@ -370,7 +370,7 @@ void Inspector::updateProperties(CGMine * o)
 	
 	addProperty("Owner", o->tempOwner, false);
 	addProperty("Resource", o->producedResource);
-	addProperty("Productivity", o->producedQuantity, false);
+	addProperty("Productivity", o->producedQuantity);
 }
 
 void Inspector::updateProperties(CGResource * o)

+ 9 - 0
mapeditor/mapcontroller.cpp

@@ -204,6 +204,15 @@ void MapController::repairMap(CMap * map) const
 				art->storedArtifact = a;
 			}
 		}
+		//fix mines 
+		if(auto * mine = dynamic_cast<CGMine*>(obj.get()))
+		{
+			if(!mine->isAbandoned())
+			{
+				mine->producedResource = GameResID(mine->subID);
+				mine->producedQuantity = mine->defaultResProduction();
+			}
+		}
 	}
 }