mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-02 00:10:22 +02:00
Add more objects into inspector
This commit is contained in:
parent
0849f93d88
commit
9429cb4340
@ -445,7 +445,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CGShipyard : public CGObjectInstance, public IShipyard
|
class DLL_LINKAGE CGShipyard : public CGObjectInstance, public IShipyard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void getOutOffsets(std::vector<int3> &offsets) const override; //offsets to obj pos when we boat can be placed
|
void getOutOffsets(std::vector<int3> &offsets) const override; //offsets to obj pos when we boat can be placed
|
||||||
|
@ -13,11 +13,41 @@ Initializer::Initializer(CMap * m, CGObjectInstance * o) : map(m)
|
|||||||
INIT_OBJ_TYPE(CGResource);
|
INIT_OBJ_TYPE(CGResource);
|
||||||
INIT_OBJ_TYPE(CGArtifact);
|
INIT_OBJ_TYPE(CGArtifact);
|
||||||
INIT_OBJ_TYPE(CArmedInstance);
|
INIT_OBJ_TYPE(CArmedInstance);
|
||||||
|
INIT_OBJ_TYPE(CGShipyard);
|
||||||
|
INIT_OBJ_TYPE(CGGarrison);
|
||||||
INIT_OBJ_TYPE(CGMine);
|
INIT_OBJ_TYPE(CGMine);
|
||||||
|
INIT_OBJ_TYPE(CGDwelling);
|
||||||
INIT_OBJ_TYPE(CGTownInstance);
|
INIT_OBJ_TYPE(CGTownInstance);
|
||||||
|
INIT_OBJ_TYPE(CGHeroInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Initializer::initialize(CArmedInstance * o)
|
void Initializer::initialize(CArmedInstance * o)
|
||||||
|
{
|
||||||
|
if(!o) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Initializer::initialize(CGDwelling * o)
|
||||||
|
{
|
||||||
|
if(!o) return;
|
||||||
|
|
||||||
|
o->tempOwner = PlayerColor::NEUTRAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Initializer::initialize(CGGarrison * o)
|
||||||
|
{
|
||||||
|
if(!o) return;
|
||||||
|
|
||||||
|
o->tempOwner = PlayerColor::NEUTRAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Initializer::initialize(CGShipyard * o)
|
||||||
|
{
|
||||||
|
if(!o) return;
|
||||||
|
|
||||||
|
o->tempOwner = PlayerColor::NEUTRAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Initializer::initialize(CGHeroInstance * o)
|
||||||
{
|
{
|
||||||
if(!o) return;
|
if(!o) return;
|
||||||
|
|
||||||
@ -80,11 +110,38 @@ void Inspector::updateProperties(CArmedInstance * o)
|
|||||||
addProperty("Owner", o->tempOwner);
|
addProperty("Owner", o->tempOwner);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inspector::updateProperties(CGTownInstance * o)
|
void Inspector::updateProperties(CGDwelling * o)
|
||||||
{
|
{
|
||||||
if(!o) return;
|
if(!o) return;
|
||||||
|
|
||||||
addProperty("Owner", o->tempOwner, false);
|
addProperty("Owner", o->tempOwner, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Inspector::updateProperties(CGGarrison * o)
|
||||||
|
{
|
||||||
|
if(!o) return;
|
||||||
|
|
||||||
|
addProperty("Owner", o->tempOwner, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Inspector::updateProperties(CGShipyard * o)
|
||||||
|
{
|
||||||
|
if(!o) return;
|
||||||
|
|
||||||
|
addProperty("Owner", o->tempOwner, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Inspector::updateProperties(CGHeroInstance * o)
|
||||||
|
{
|
||||||
|
if(!o) return;
|
||||||
|
|
||||||
|
addProperty("Owner", o->tempOwner, o->ID == Obj::PRISON); //field is not editable for prison
|
||||||
|
}
|
||||||
|
|
||||||
|
void Inspector::updateProperties(CGTownInstance * o)
|
||||||
|
{
|
||||||
|
if(!o) return;
|
||||||
|
|
||||||
addProperty("Town name", o->name, false);
|
addProperty("Town name", o->name, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,6 +166,8 @@ void Inspector::updateProperties(CGResource * o)
|
|||||||
addProperty("Amount", o->amount, false);
|
addProperty("Amount", o->amount, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Inspector::updateProperties()
|
void Inspector::updateProperties()
|
||||||
{
|
{
|
||||||
if(!obj)
|
if(!obj)
|
||||||
@ -125,10 +184,14 @@ void Inspector::updateProperties()
|
|||||||
addProperty("IsStatic", factory->isStaticObject());
|
addProperty("IsStatic", factory->isStaticObject());
|
||||||
|
|
||||||
UPDATE_OBJ_PROPERTIES(CArmedInstance);
|
UPDATE_OBJ_PROPERTIES(CArmedInstance);
|
||||||
UPDATE_OBJ_PROPERTIES(CGTownInstance);
|
UPDATE_OBJ_PROPERTIES(CGResource);
|
||||||
UPDATE_OBJ_PROPERTIES(CGArtifact);
|
UPDATE_OBJ_PROPERTIES(CGArtifact);
|
||||||
UPDATE_OBJ_PROPERTIES(CGMine);
|
UPDATE_OBJ_PROPERTIES(CGMine);
|
||||||
UPDATE_OBJ_PROPERTIES(CGResource);
|
UPDATE_OBJ_PROPERTIES(CGGarrison);
|
||||||
|
UPDATE_OBJ_PROPERTIES(CGShipyard);
|
||||||
|
UPDATE_OBJ_PROPERTIES(CGDwelling);
|
||||||
|
UPDATE_OBJ_PROPERTIES(CGTownInstance);
|
||||||
|
UPDATE_OBJ_PROPERTIES(CGHeroInstance);
|
||||||
|
|
||||||
table->show();
|
table->show();
|
||||||
}
|
}
|
||||||
@ -139,18 +202,6 @@ void Inspector::setProperty(const QString & key, const QVariant & value)
|
|||||||
if(!obj)
|
if(!obj)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SET_PROPERTIES(CArmedInstance);
|
|
||||||
SET_PROPERTIES(CGTownInstance);
|
|
||||||
SET_PROPERTIES(CGArtifact);
|
|
||||||
SET_PROPERTIES(CGMine);
|
|
||||||
SET_PROPERTIES(CGResource);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Inspector::setProperty(CArmedInstance * object, const QString & key, const QVariant & value)
|
|
||||||
{
|
|
||||||
if(!object)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(key == "Owner")
|
if(key == "Owner")
|
||||||
{
|
{
|
||||||
PlayerColor owner(value.toString().toInt());
|
PlayerColor owner(value.toString().toInt());
|
||||||
@ -158,9 +209,24 @@ void Inspector::setProperty(CArmedInstance * object, const QString & key, const
|
|||||||
owner = PlayerColor::NEUTRAL;
|
owner = PlayerColor::NEUTRAL;
|
||||||
if(value == "UNFLAGGABLE")
|
if(value == "UNFLAGGABLE")
|
||||||
owner = PlayerColor::UNFLAGGABLE;
|
owner = PlayerColor::UNFLAGGABLE;
|
||||||
object->tempOwner = owner;
|
obj->tempOwner = owner;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SET_PROPERTIES(CArmedInstance);
|
||||||
|
SET_PROPERTIES(CGTownInstance);
|
||||||
|
SET_PROPERTIES(CGArtifact);
|
||||||
|
SET_PROPERTIES(CGMine);
|
||||||
|
SET_PROPERTIES(CGResource);
|
||||||
|
SET_PROPERTIES(CGDwelling);
|
||||||
|
SET_PROPERTIES(CGGarrison);
|
||||||
|
SET_PROPERTIES(CGHeroInstance);
|
||||||
|
SET_PROPERTIES(CGShipyard);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Inspector::setProperty(CArmedInstance * 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)
|
||||||
@ -187,6 +253,30 @@ void Inspector::setProperty(CGArtifact * object, const QString & key, const QVar
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Inspector::setProperty(CGDwelling * object, const QString & key, const QVariant & value)
|
||||||
|
{
|
||||||
|
if(!object)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Inspector::setProperty(CGGarrison * object, const QString & key, const QVariant & value)
|
||||||
|
{
|
||||||
|
if(!object)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Inspector::setProperty(CGHeroInstance * object, const QString & key, const QVariant & value)
|
||||||
|
{
|
||||||
|
if(!object)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Inspector::setProperty(CGShipyard * object, const QString & key, const QVariant & value)
|
||||||
|
{
|
||||||
|
if(!object)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void Inspector::setProperty(CGResource * object, const QString & key, const QVariant & value)
|
void Inspector::setProperty(CGResource * object, const QString & key, const QVariant & value)
|
||||||
{
|
{
|
||||||
if(!object)
|
if(!object)
|
||||||
|
@ -24,10 +24,14 @@ class Initializer
|
|||||||
public:
|
public:
|
||||||
//===============DECLARE MAP OBJECTS======================================
|
//===============DECLARE MAP OBJECTS======================================
|
||||||
DECLARE_OBJ_TYPE(CArmedInstance);
|
DECLARE_OBJ_TYPE(CArmedInstance);
|
||||||
|
DECLARE_OBJ_TYPE(CGShipyard);
|
||||||
DECLARE_OBJ_TYPE(CGTownInstance);
|
DECLARE_OBJ_TYPE(CGTownInstance);
|
||||||
DECLARE_OBJ_TYPE(CGArtifact);
|
DECLARE_OBJ_TYPE(CGArtifact);
|
||||||
DECLARE_OBJ_TYPE(CGMine);
|
DECLARE_OBJ_TYPE(CGMine);
|
||||||
DECLARE_OBJ_TYPE(CGResource);
|
DECLARE_OBJ_TYPE(CGResource);
|
||||||
|
DECLARE_OBJ_TYPE(CGDwelling);
|
||||||
|
DECLARE_OBJ_TYPE(CGGarrison);
|
||||||
|
DECLARE_OBJ_TYPE(CGHeroInstance);
|
||||||
|
|
||||||
|
|
||||||
Initializer(CMap *, CGObjectInstance *);
|
Initializer(CMap *, CGObjectInstance *);
|
||||||
@ -42,9 +46,13 @@ protected:
|
|||||||
//===============DECLARE PROPERTIES SETUP=================================
|
//===============DECLARE PROPERTIES SETUP=================================
|
||||||
DECLARE_OBJ_PROPERTY_METHODS(CArmedInstance);
|
DECLARE_OBJ_PROPERTY_METHODS(CArmedInstance);
|
||||||
DECLARE_OBJ_PROPERTY_METHODS(CGTownInstance);
|
DECLARE_OBJ_PROPERTY_METHODS(CGTownInstance);
|
||||||
|
DECLARE_OBJ_PROPERTY_METHODS(CGShipyard);
|
||||||
DECLARE_OBJ_PROPERTY_METHODS(CGArtifact);
|
DECLARE_OBJ_PROPERTY_METHODS(CGArtifact);
|
||||||
DECLARE_OBJ_PROPERTY_METHODS(CGMine);
|
DECLARE_OBJ_PROPERTY_METHODS(CGMine);
|
||||||
DECLARE_OBJ_PROPERTY_METHODS(CGResource);
|
DECLARE_OBJ_PROPERTY_METHODS(CGResource);
|
||||||
|
DECLARE_OBJ_PROPERTY_METHODS(CGDwelling);
|
||||||
|
DECLARE_OBJ_PROPERTY_METHODS(CGGarrison);
|
||||||
|
DECLARE_OBJ_PROPERTY_METHODS(CGHeroInstance);
|
||||||
|
|
||||||
//===============DECLARE PROPERTY VALUE TYPE==============================
|
//===============DECLARE PROPERTY VALUE TYPE==============================
|
||||||
QTableWidgetItem * addProperty(unsigned int value);
|
QTableWidgetItem * addProperty(unsigned int value);
|
||||||
|
@ -75,6 +75,7 @@ void MapController::setMap(std::unique_ptr<CMap> cmap)
|
|||||||
dynamic_cast<CGDwelling*>(obj.get()) ||
|
dynamic_cast<CGDwelling*>(obj.get()) ||
|
||||||
dynamic_cast<CGTownInstance*>(obj.get()) ||
|
dynamic_cast<CGTownInstance*>(obj.get()) ||
|
||||||
dynamic_cast<CGGarrison*>(obj.get()) ||
|
dynamic_cast<CGGarrison*>(obj.get()) ||
|
||||||
|
dynamic_cast<CGShipyard*>(obj.get()) ||
|
||||||
dynamic_cast<CGHeroInstance*>(obj.get()))
|
dynamic_cast<CGHeroInstance*>(obj.get()))
|
||||||
obj->tempOwner = PlayerColor::NEUTRAL;
|
obj->tempOwner = PlayerColor::NEUTRAL;
|
||||||
|
|
||||||
|
@ -143,8 +143,8 @@ void setPlayerColor(QImage * sur, PlayerColor player)
|
|||||||
if(sur->format() == QImage::Format_Indexed8)
|
if(sur->format() == QImage::Format_Indexed8)
|
||||||
{
|
{
|
||||||
QRgb color = graphics->neutralColor;
|
QRgb color = graphics->neutralColor;
|
||||||
if(player != PlayerColor::NEUTRAL)
|
if(player != PlayerColor::NEUTRAL && player < PlayerColor::PLAYER_LIMIT)
|
||||||
color = graphics->playerColors[player.getNum()];
|
color = graphics->playerColors.at(player.getNum());
|
||||||
|
|
||||||
sur->setColor(5, color);
|
sur->setColor(5, color);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user