mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-11 14:49:23 +02:00
Merge pull request #1194 from Nordsoft91/editor-crash
Fix hero-related problems in editor [1.1]
This commit is contained in:
commit
35e8b794cd
@ -1434,7 +1434,7 @@ void CGHeroInstance::serializeCommonOptions(JsonSerializeFormat & handler)
|
||||
handler.serializeString("biography", biography);
|
||||
handler.serializeInt("experience", exp, 0);
|
||||
|
||||
if (!handler.saving)
|
||||
if(!handler.saving && exp != 0xffffffff) //do not gain levels if experience is not initialized
|
||||
{
|
||||
while (gainsLevel())
|
||||
{
|
||||
|
@ -555,6 +555,9 @@ void Inspector::setProperty(CGHeroInstance * o, const QString & key, const QVari
|
||||
if(key == "Name")
|
||||
o->name = value.toString().toStdString();
|
||||
|
||||
if(key == "Experience")
|
||||
o->exp = value.toInt();
|
||||
|
||||
if(key == "Hero type")
|
||||
{
|
||||
for(auto t : VLC->heroh->objects)
|
||||
|
@ -128,10 +128,15 @@ void MapController::repairMap()
|
||||
assert(type->heroClass);
|
||||
//TODO: find a way to get proper type name
|
||||
if(obj->ID == Obj::HERO)
|
||||
{
|
||||
nih->typeName = "hero";
|
||||
nih->subTypeName = type->heroClass->identifier;
|
||||
}
|
||||
if(obj->ID == Obj::PRISON)
|
||||
{
|
||||
nih->typeName = "prison";
|
||||
nih->subTypeName = type->heroClass->identifier;
|
||||
nih->subTypeName = "prison";
|
||||
}
|
||||
|
||||
nih->type = type;
|
||||
if(nih->name.empty())
|
||||
|
@ -460,8 +460,11 @@ void SelectionObjectsLayer::selectObjects(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
for(int i = x1; i < x2; ++i)
|
||||
{
|
||||
for(auto & o : handler->getObjects(i, j, scene->level))
|
||||
selectObject(o.obj, false); //do not inform about each object added
|
||||
if(map->isInTheMap(int3(i, j, scene->level)))
|
||||
{
|
||||
for(auto & o : handler->getObjects(i, j, scene->level))
|
||||
selectObject(o.obj, false); //do not inform about each object added
|
||||
}
|
||||
}
|
||||
}
|
||||
onSelection();
|
||||
|
Loading…
x
Reference in New Issue
Block a user