mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-07 07:10:04 +02:00
map editor: dont suggest neutral owner for hero
This commit is contained in:
parent
51386db347
commit
da91e90a7b
@ -298,7 +298,8 @@ void Inspector::updateProperties(CGHeroInstance * o)
|
|||||||
{
|
{
|
||||||
if(!o) return;
|
if(!o) return;
|
||||||
|
|
||||||
addProperty("Owner", o->tempOwner, new OwnerDelegate(controller), o->ID == Obj::PRISON); //field is not editable for prison
|
auto isPrison = o->ID == Obj::PRISON;
|
||||||
|
addProperty("Owner", o->tempOwner, new OwnerDelegate(controller, isPrison), isPrison); //field is not editable for prison
|
||||||
addProperty<int>("Experience", o->exp, false);
|
addProperty<int>("Experience", o->exp, false);
|
||||||
addProperty("Hero class", o->type ? o->type->heroClass->getNameTranslated() : "", true);
|
addProperty("Hero class", o->type ? o->type->heroClass->getNameTranslated() : "", true);
|
||||||
|
|
||||||
@ -923,8 +924,9 @@ void InspectorDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OwnerDelegate::OwnerDelegate(MapController & controller)
|
OwnerDelegate::OwnerDelegate(MapController & controller, bool addNeutral)
|
||||||
{
|
{
|
||||||
|
if(addNeutral)
|
||||||
options.push_back({QObject::tr("neutral"), QVariant::fromValue(PlayerColor::NEUTRAL.getNum()) });
|
options.push_back({QObject::tr("neutral"), QVariant::fromValue(PlayerColor::NEUTRAL.getNum()) });
|
||||||
for(int p = 0; p < controller.map()->players.size(); ++p)
|
for(int p = 0; p < controller.map()->players.size(); ++p)
|
||||||
if(controller.map()->players[p].canAnyonePlay())
|
if(controller.map()->players[p].canAnyonePlay())
|
||||||
|
@ -177,5 +177,5 @@ class OwnerDelegate : public InspectorDelegate
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
OwnerDelegate(MapController &);
|
OwnerDelegate(MapController & controller, bool addNeutral = true);
|
||||||
};
|
};
|
Loading…
x
Reference in New Issue
Block a user