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