mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-20 20:23:03 +02:00
Added some minor feature
This commit is contained in:
parent
0a81c82971
commit
9d24be5499
@ -23,6 +23,8 @@ Initializer::Initializer(CMap * m, CGObjectInstance * o) : map(m)
|
|||||||
INIT_OBJ_TYPE(CGTownInstance);
|
INIT_OBJ_TYPE(CGTownInstance);
|
||||||
INIT_OBJ_TYPE(CGCreature);
|
INIT_OBJ_TYPE(CGCreature);
|
||||||
INIT_OBJ_TYPE(CGHeroInstance);
|
INIT_OBJ_TYPE(CGHeroInstance);
|
||||||
|
INIT_OBJ_TYPE(CGSignBottle);
|
||||||
|
INIT_OBJ_TYPE(CGLighthouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool stringToBool(const QString & s)
|
bool stringToBool(const QString & s)
|
||||||
@ -38,6 +40,11 @@ void Initializer::initialize(CArmedInstance * o)
|
|||||||
if(!o) return;
|
if(!o) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Initializer::initialize(CGSignBottle * o)
|
||||||
|
{
|
||||||
|
if(!o) return;
|
||||||
|
}
|
||||||
|
|
||||||
void Initializer::initialize(CGCreature * o)
|
void Initializer::initialize(CGCreature * o)
|
||||||
{
|
{
|
||||||
if(!o) return;
|
if(!o) return;
|
||||||
@ -66,6 +73,7 @@ void Initializer::initialize(CGGarrison * o)
|
|||||||
if(!o) return;
|
if(!o) return;
|
||||||
|
|
||||||
o->tempOwner = PlayerColor::NEUTRAL;
|
o->tempOwner = PlayerColor::NEUTRAL;
|
||||||
|
o->removableUnits = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Initializer::initialize(CGShipyard * o)
|
void Initializer::initialize(CGShipyard * o)
|
||||||
@ -75,6 +83,13 @@ void Initializer::initialize(CGShipyard * o)
|
|||||||
o->tempOwner = PlayerColor::NEUTRAL;
|
o->tempOwner = PlayerColor::NEUTRAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Initializer::initialize(CGLighthouse * o)
|
||||||
|
{
|
||||||
|
if(!o) return;
|
||||||
|
|
||||||
|
o->tempOwner = PlayerColor::NEUTRAL;
|
||||||
|
}
|
||||||
|
|
||||||
void Initializer::initialize(CGHeroInstance * o)
|
void Initializer::initialize(CGHeroInstance * o)
|
||||||
{
|
{
|
||||||
if(!o) return;
|
if(!o) return;
|
||||||
@ -142,20 +157,8 @@ void Inspector::updateProperties(CArmedInstance * o)
|
|||||||
{
|
{
|
||||||
if(!o) return;
|
if(!o) return;
|
||||||
|
|
||||||
{
|
|
||||||
auto * delegate = new InspectorDelegate();
|
|
||||||
delegate->options << "NEUTRAL";
|
|
||||||
for(int p = 0; p < map->players.size(); ++p)
|
|
||||||
if(map->players[p].canAnyonePlay())
|
|
||||||
delegate->options << QString("PLAYER %1").arg(p);
|
|
||||||
addProperty("Owner", o->tempOwner, delegate, true);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
auto * delegate = new ArmyDelegate(*o);
|
auto * delegate = new ArmyDelegate(*o);
|
||||||
addProperty("Army", PropertyEditorPlaceholder(), delegate, false);
|
addProperty("Army", PropertyEditorPlaceholder(), delegate, false);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inspector::updateProperties(CGDwelling * o)
|
void Inspector::updateProperties(CGDwelling * o)
|
||||||
@ -165,11 +168,19 @@ void Inspector::updateProperties(CGDwelling * o)
|
|||||||
addProperty("Owner", o->tempOwner, false);
|
addProperty("Owner", o->tempOwner, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Inspector::updateProperties(CGLighthouse * o)
|
||||||
|
{
|
||||||
|
if(!o) return;
|
||||||
|
|
||||||
|
addProperty("Owner", o->tempOwner, false);
|
||||||
|
}
|
||||||
|
|
||||||
void Inspector::updateProperties(CGGarrison * o)
|
void Inspector::updateProperties(CGGarrison * o)
|
||||||
{
|
{
|
||||||
if(!o) return;
|
if(!o) return;
|
||||||
|
|
||||||
addProperty("Owner", o->tempOwner, false);
|
addProperty("Owner", o->tempOwner, false);
|
||||||
|
addProperty("Removable units", o->removableUnits, InspectorDelegate::boolDelegate(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inspector::updateProperties(CGShipyard * o)
|
void Inspector::updateProperties(CGShipyard * o)
|
||||||
@ -236,6 +247,13 @@ void Inspector::updateProperties(CGResource * o)
|
|||||||
addProperty("Message", o->message, false);
|
addProperty("Message", o->message, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Inspector::updateProperties(CGSignBottle * o)
|
||||||
|
{
|
||||||
|
if(!o) return;
|
||||||
|
|
||||||
|
addProperty("Message", o->message, false);
|
||||||
|
}
|
||||||
|
|
||||||
void Inspector::updateProperties(CGCreature * o)
|
void Inspector::updateProperties(CGCreature * o)
|
||||||
{
|
{
|
||||||
if(!o) return;
|
if(!o) return;
|
||||||
@ -270,6 +288,13 @@ void Inspector::updateProperties()
|
|||||||
auto factory = VLC->objtypeh->getHandlerFor(obj->ID, obj->subID);
|
auto factory = VLC->objtypeh->getHandlerFor(obj->ID, obj->subID);
|
||||||
addProperty("IsStatic", factory->isStaticObject());
|
addProperty("IsStatic", factory->isStaticObject());
|
||||||
|
|
||||||
|
auto * delegate = new InspectorDelegate();
|
||||||
|
delegate->options << "NEUTRAL";
|
||||||
|
for(int p = 0; p < map->players.size(); ++p)
|
||||||
|
if(map->players[p].canAnyonePlay())
|
||||||
|
delegate->options << QString("PLAYER %1").arg(p);
|
||||||
|
addProperty("Owner", obj->tempOwner, delegate, true);
|
||||||
|
|
||||||
UPDATE_OBJ_PROPERTIES(CArmedInstance);
|
UPDATE_OBJ_PROPERTIES(CArmedInstance);
|
||||||
UPDATE_OBJ_PROPERTIES(CGResource);
|
UPDATE_OBJ_PROPERTIES(CGResource);
|
||||||
UPDATE_OBJ_PROPERTIES(CGArtifact);
|
UPDATE_OBJ_PROPERTIES(CGArtifact);
|
||||||
@ -280,6 +305,8 @@ void Inspector::updateProperties()
|
|||||||
UPDATE_OBJ_PROPERTIES(CGTownInstance);
|
UPDATE_OBJ_PROPERTIES(CGTownInstance);
|
||||||
UPDATE_OBJ_PROPERTIES(CGCreature);
|
UPDATE_OBJ_PROPERTIES(CGCreature);
|
||||||
UPDATE_OBJ_PROPERTIES(CGHeroInstance);
|
UPDATE_OBJ_PROPERTIES(CGHeroInstance);
|
||||||
|
UPDATE_OBJ_PROPERTIES(CGSignBottle);
|
||||||
|
UPDATE_OBJ_PROPERTIES(CGLighthouse);
|
||||||
|
|
||||||
table->show();
|
table->show();
|
||||||
}
|
}
|
||||||
@ -310,6 +337,8 @@ void Inspector::setProperty(const QString & key, const QVariant & value)
|
|||||||
SET_PROPERTIES(CGCreature);
|
SET_PROPERTIES(CGCreature);
|
||||||
SET_PROPERTIES(CGHeroInstance);
|
SET_PROPERTIES(CGHeroInstance);
|
||||||
SET_PROPERTIES(CGShipyard);
|
SET_PROPERTIES(CGShipyard);
|
||||||
|
SET_PROPERTIES(CGSignBottle);
|
||||||
|
SET_PROPERTIES(CGLighthouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inspector::setProperty(CArmedInstance * object, const QString & key, const QVariant & value)
|
void Inspector::setProperty(CArmedInstance * object, const QString & key, const QVariant & value)
|
||||||
@ -317,6 +346,11 @@ void Inspector::setProperty(CArmedInstance * object, const QString & key, const
|
|||||||
if(!object) return;
|
if(!object) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Inspector::setProperty(CGLighthouse * object, const QString & key, const QVariant & value)
|
||||||
|
{
|
||||||
|
if(!object) return;
|
||||||
|
}
|
||||||
|
|
||||||
void Inspector::setProperty(CGTownInstance * object, const QString & key, const QVariant & value)
|
void Inspector::setProperty(CGTownInstance * object, const QString & key, const QVariant & value)
|
||||||
{
|
{
|
||||||
if(!object) return;
|
if(!object) return;
|
||||||
@ -325,6 +359,14 @@ void Inspector::setProperty(CGTownInstance * object, const QString & key, const
|
|||||||
object->name = value.toString().toStdString();
|
object->name = value.toString().toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Inspector::setProperty(CGSignBottle * object, const QString & key, const QVariant & value)
|
||||||
|
{
|
||||||
|
if(!object) return;
|
||||||
|
|
||||||
|
if(key == "Message")
|
||||||
|
object->message = value.toString().toStdString();
|
||||||
|
}
|
||||||
|
|
||||||
void Inspector::setProperty(CGMine * object, const QString & key, const QVariant & value)
|
void Inspector::setProperty(CGMine * object, const QString & key, const QVariant & value)
|
||||||
{
|
{
|
||||||
if(!object) return;
|
if(!object) return;
|
||||||
@ -361,6 +403,9 @@ void Inspector::setProperty(CGDwelling * object, const QString & key, const QVar
|
|||||||
void Inspector::setProperty(CGGarrison * object, const QString & key, const QVariant & value)
|
void Inspector::setProperty(CGGarrison * object, const QString & key, const QVariant & value)
|
||||||
{
|
{
|
||||||
if(!object) return;
|
if(!object) return;
|
||||||
|
|
||||||
|
if(key == "Removable units")
|
||||||
|
object->removableUnits = stringToBool(value.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inspector::setProperty(CGHeroInstance * object, const QString & key, const QVariant & value)
|
void Inspector::setProperty(CGHeroInstance * object, const QString & key, const QVariant & value)
|
||||||
|
@ -33,6 +33,8 @@ public:
|
|||||||
DECLARE_OBJ_TYPE(CGGarrison);
|
DECLARE_OBJ_TYPE(CGGarrison);
|
||||||
DECLARE_OBJ_TYPE(CGHeroInstance);
|
DECLARE_OBJ_TYPE(CGHeroInstance);
|
||||||
DECLARE_OBJ_TYPE(CGCreature);
|
DECLARE_OBJ_TYPE(CGCreature);
|
||||||
|
DECLARE_OBJ_TYPE(CGSignBottle);
|
||||||
|
DECLARE_OBJ_TYPE(CGLighthouse);
|
||||||
|
|
||||||
|
|
||||||
Initializer(CMap *, CGObjectInstance *);
|
Initializer(CMap *, CGObjectInstance *);
|
||||||
@ -57,6 +59,8 @@ protected:
|
|||||||
DECLARE_OBJ_PROPERTY_METHODS(CGGarrison);
|
DECLARE_OBJ_PROPERTY_METHODS(CGGarrison);
|
||||||
DECLARE_OBJ_PROPERTY_METHODS(CGHeroInstance);
|
DECLARE_OBJ_PROPERTY_METHODS(CGHeroInstance);
|
||||||
DECLARE_OBJ_PROPERTY_METHODS(CGCreature);
|
DECLARE_OBJ_PROPERTY_METHODS(CGCreature);
|
||||||
|
DECLARE_OBJ_PROPERTY_METHODS(CGSignBottle);
|
||||||
|
DECLARE_OBJ_PROPERTY_METHODS(CGLighthouse);
|
||||||
|
|
||||||
//===============DECLARE PROPERTY VALUE TYPE==============================
|
//===============DECLARE PROPERTY VALUE TYPE==============================
|
||||||
QTableWidgetItem * addProperty(unsigned int value);
|
QTableWidgetItem * addProperty(unsigned int value);
|
||||||
|
@ -464,7 +464,7 @@ void MainWindow::loadObjectsTree()
|
|||||||
addGroupIntoCatalog("MISC", true, false, Obj::HILL_FORT);
|
addGroupIntoCatalog("MISC", true, false, Obj::HILL_FORT);
|
||||||
addGroupIntoCatalog("MISC", true, false, Obj::IDOL_OF_FORTUNE);
|
addGroupIntoCatalog("MISC", true, false, Obj::IDOL_OF_FORTUNE);
|
||||||
addGroupIntoCatalog("MISC", true, false, Obj::LIBRARY_OF_ENLIGHTENMENT);
|
addGroupIntoCatalog("MISC", true, false, Obj::LIBRARY_OF_ENLIGHTENMENT);
|
||||||
//addGroupIntoCatalog("MISC", true, false, Obj::LIGHTHOUSE); //TODO: allow to edit owner
|
addGroupIntoCatalog("MISC", true, false, Obj::LIGHTHOUSE);
|
||||||
addGroupIntoCatalog("MISC", true, false, Obj::SCHOOL_OF_MAGIC);
|
addGroupIntoCatalog("MISC", true, false, Obj::SCHOOL_OF_MAGIC);
|
||||||
addGroupIntoCatalog("MISC", true, false, Obj::MAGIC_SPRING);
|
addGroupIntoCatalog("MISC", true, false, Obj::MAGIC_SPRING);
|
||||||
addGroupIntoCatalog("MISC", true, false, Obj::MAGIC_WELL);
|
addGroupIntoCatalog("MISC", true, false, Obj::MAGIC_WELL);
|
||||||
|
@ -372,13 +372,8 @@ QRgb MapHandler::getTileColor(int x, int y, int z)
|
|||||||
// if object at tile is owned - it will be colored as its owner
|
// if object at tile is owned - it will be colored as its owner
|
||||||
for(auto & object : getObjects(x, y, z))
|
for(auto & object : getObjects(x, y, z))
|
||||||
{
|
{
|
||||||
//heroes will be blitted later
|
if(!object.obj->getBlockedPos().count(int3(x, y, z)))
|
||||||
switch (object.obj->ID)
|
|
||||||
{
|
|
||||||
case Obj::HERO:
|
|
||||||
case Obj::PRISON:
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
PlayerColor player = object.obj->getOwner();
|
PlayerColor player = object.obj->getOwner();
|
||||||
if(player == PlayerColor::NEUTRAL)
|
if(player == PlayerColor::NEUTRAL)
|
||||||
|
Loading…
Reference in New Issue
Block a user