1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

map editor: dont suggest neutral owner for hero

This commit is contained in:
godric3 2024-02-29 22:38:31 +01:00
parent 51386db347
commit da91e90a7b
2 changed files with 6 additions and 4 deletions

View File

@ -298,7 +298,8 @@ void Inspector::updateProperties(CGHeroInstance * o)
{
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("Hero class", o->type ? o->type->heroClass->getNameTranslated() : "", true);
@ -923,9 +924,10 @@ void InspectorDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
}
}
OwnerDelegate::OwnerDelegate(MapController & controller)
OwnerDelegate::OwnerDelegate(MapController & controller, bool addNeutral)
{
options.push_back({QObject::tr("neutral"), QVariant::fromValue(PlayerColor::NEUTRAL.getNum()) });
if(addNeutral)
options.push_back({QObject::tr("neutral"), QVariant::fromValue(PlayerColor::NEUTRAL.getNum()) });
for(int p = 0; p < controller.map()->players.size(); ++p)
if(controller.map()->players[p].canAnyonePlay())
options.push_back({QString::fromStdString(GameConstants::PLAYER_COLOR_NAMES[p]), QVariant::fromValue(PlayerColor(p).getNum()) });

View File

@ -177,5 +177,5 @@ class OwnerDelegate : public InspectorDelegate
{
Q_OBJECT
public:
OwnerDelegate(MapController &);
OwnerDelegate(MapController & controller, bool addNeutral = true);
};