mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-28 03:57:02 +02:00
Merge pull request #2750 from Nordsoft91/editor-improvements
This commit is contained in:
commit
a0fead361b
@ -341,6 +341,9 @@ void CGObjectInstance::serializeJsonOptions(JsonSerializeFormat & handler)
|
||||
|
||||
void CGObjectInstance::serializeJsonOwner(JsonSerializeFormat & handler)
|
||||
{
|
||||
if(handler.saving && tempOwner == PlayerColor::NEUTRAL)
|
||||
return;
|
||||
|
||||
ui8 temp = tempOwner.getNum();
|
||||
|
||||
handler.serializeEnum("owner", temp, PlayerColor::NEUTRAL.getNum(), GameConstants::PLAYER_COLOR_NAMES);
|
||||
|
@ -196,6 +196,8 @@ public:
|
||||
GameResID producedResource;
|
||||
ui32 producedQuantity;
|
||||
std::set<GameResID> abandonedMineResources;
|
||||
|
||||
bool isAbandoned() const;
|
||||
|
||||
private:
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
@ -209,7 +211,6 @@ private:
|
||||
std::string getObjectName() const override;
|
||||
std::string getHoverText(PlayerColor player) const override;
|
||||
|
||||
bool isAbandoned() const;
|
||||
public:
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
|
@ -118,7 +118,10 @@ void Initializer::initialize(CGHeroInstance * o)
|
||||
|
||||
o->tempOwner = defaultPlayer;
|
||||
if(o->ID == Obj::PRISON)
|
||||
{
|
||||
o->subID = 0;
|
||||
o->tempOwner = PlayerColor::NEUTRAL;
|
||||
}
|
||||
|
||||
if(o->ID == Obj::HERO)
|
||||
{
|
||||
@ -184,8 +187,16 @@ void Initializer::initialize(CGMine * o)
|
||||
if(!o) return;
|
||||
|
||||
o->tempOwner = defaultPlayer;
|
||||
o->producedResource = GameResID(o->subID);
|
||||
o->producedQuantity = o->defaultResProduction();
|
||||
if(o->isAbandoned())
|
||||
{
|
||||
for(auto r = 0; r < GameConstants::RESOURCE_QUANTITY - 1; ++r)
|
||||
o->abandonedMineResources.insert(GameResID(r));
|
||||
}
|
||||
else
|
||||
{
|
||||
o->producedResource = GameResID(o->subID);
|
||||
o->producedQuantity = o->defaultResProduction();
|
||||
}
|
||||
}
|
||||
|
||||
void Initializer::initialize(CGResource * o)
|
||||
|
@ -141,6 +141,7 @@ void MapController::repairMap()
|
||||
{
|
||||
nih->typeName = "prison";
|
||||
nih->subTypeName = "prison";
|
||||
nih->subID = 0;
|
||||
}
|
||||
|
||||
nih->type = type;
|
||||
|
Loading…
x
Reference in New Issue
Block a user