mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-29 21:56:54 +02:00
map editor: option to set random town same as player faction
This commit is contained in:
parent
018503c5e8
commit
4b7792075d
@ -1134,6 +1134,7 @@ void CGTownInstance::serializeJsonOptions(JsonSerializeFormat & handler)
|
||||
eventsHandler.syncSize(events, JsonNode::JsonType::DATA_VECTOR);
|
||||
eventsHandler.serializeStruct(events);
|
||||
}
|
||||
handler.serializeId("alignmentToPlayer", alignmentToPlayer, PlayerColor::NEUTRAL);
|
||||
}
|
||||
|
||||
const CFaction * CGTownInstance::getFaction() const
|
||||
|
@ -364,6 +364,8 @@ void Inspector::updateProperties(CGTownInstance * o)
|
||||
addProperty(QObject::tr("Buildings"), PropertyEditorPlaceholder(), delegate, false);
|
||||
addProperty(QObject::tr("Spells"), PropertyEditorPlaceholder(), new TownSpellsDelegate(*o), false);
|
||||
addProperty(QObject::tr("Events"), PropertyEditorPlaceholder(), new TownEventsDelegate(*o, controller), false);
|
||||
if(o->ID == Obj::RANDOM_TOWN)
|
||||
addProperty(QObject::tr("Same as player"), o->alignmentToPlayer, new OwnerDelegate(controller), false);
|
||||
}
|
||||
|
||||
void Inspector::updateProperties(CGArtifact * o)
|
||||
@ -612,6 +614,9 @@ void Inspector::setProperty(CGTownInstance * o, const QString & key, const QVari
|
||||
if(key == QObject::tr("Town name"))
|
||||
o->setNameTextId(mapRegisterLocalizedString("map", *controller.map(),
|
||||
TextIdentifier("town", o->instanceName, "name"), value.toString().toStdString()));
|
||||
|
||||
if(key == QObject::tr("Same as player"))
|
||||
o->alignmentToPlayer = PlayerColor(value.toInt());
|
||||
}
|
||||
|
||||
void Inspector::setProperty(CGSignBottle * o, const QString & key, const QVariant & value)
|
||||
|
Loading…
x
Reference in New Issue
Block a user