1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-20 20:23:03 +02:00

Add coastVisitable property to rewardables, update schemas

This commit is contained in:
Ivan Savenko 2024-08-31 15:28:58 +00:00
parent 503b87561e
commit 31dff8f8da
7 changed files with 22 additions and 5 deletions

View File

@ -99,7 +99,7 @@
}
},
"guards" : {}, //TODO
"guards" : { "$ref" : "#/definitions/identifierWithValueList" },
"limiter" : { "$ref" : "#/definitions/limiter" },
"message" : { "$ref" : "#/definitions/message" },
@ -293,14 +293,16 @@
"type" : "boolean"
},
"coastVisitable": {
"type" : "boolean"
},
"visitMode": {
"enum" : [ "unlimited", "once", "hero", "bonus", "limiter", "player" ],
"type" : "string"
},
"visitLimiter": {
"type" : "object"
},
"visitLimiter": { "$ref" : "#/definitions/limiter" },
"selectMode": {
"enum" : [ "selectFirst", "selectPlayer", "selectRandom", "selectAll" ],

View File

@ -176,7 +176,7 @@ public:
h & fogOfWarMap;
h & static_cast<CBonusSystemNode&>(*this);
if (h.version >= Handler::Version::TEAM_STATE_SCOUTED_OBJECTS)
if (h.version >= Handler::Version::REWARDABLE_BANKS)
h & scoutedObjects;
}

View File

@ -517,4 +517,9 @@ void CRewardableObject::initializeGuards()
}
}
bool CRewardableObject::isCoastVisitable() const
{
return configuration.coastVisitable;
}
VCMI_LIB_NAMESPACE_END

View File

@ -76,6 +76,8 @@ public:
void initObj(vstd::RNG & rand) override;
bool isCoastVisitable() const override;
void initializeGuards();
void setPropertyDer(ObjProperty what, ObjPropertyID identifier) override;

View File

@ -103,6 +103,7 @@ void Rewardable::Configuration::serializeJson(JsonSerializeFormat & handler)
handler.serializeStruct("resetParameters", resetParameters);
handler.serializeBool("canRefuse", canRefuse);
handler.serializeBool("showScoutedPreview", showScoutedPreview);
handler.serializeBool("coastVisitable", coastVisitable);
handler.serializeInt("infoWindowType", infoWindowType);
}

View File

@ -162,6 +162,8 @@ struct DLL_LINKAGE Configuration
/// if true - right-clicking object will show preview of object rewards
bool showScoutedPreview = false;
bool coastVisitable = false;
/// if true - object info will shown in infobox (like resource pickup)
EInfoWindowMode infoWindowType = EInfoWindowMode::AUTO;
@ -190,6 +192,10 @@ struct DLL_LINKAGE Configuration
h & canRefuse;
h & showScoutedPreview;
h & infoWindowType;
if (h.version >= Handler::Version::BANK_UNIT_PLACEMENT)
h & coastVisitable;
else
coastVisitable = false;
}
};

View File

@ -394,6 +394,7 @@ void Rewardable::Info::configureObject(Rewardable::Configuration & object, vstd:
object.canRefuse = parameters["canRefuse"].Bool();
object.showScoutedPreview = parameters["showScoutedPreview"].Bool();
object.coastVisitable = parameters["coastVisitable"].Bool();
if(parameters["showInInfobox"].isNull())
object.infoWindowType = EInfoWindowMode::AUTO;