1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Bonus limiters refactoring

- Split massive `parseLimiter` method in smaller chunks
- Added alternative format for limiters with named parameters instead of
unclear `parameters` entry that often leads to bugs in mods. Old format
is still available.
- Added detailed validation for limiter format
- Converted vcmi json's to use new format
- Removed parameter-less `CREATURE_FACTION` and `SAME_FACTION` limiter.
They are unused in mods and have unclear use-case that can be replaced
by other limiters
- Expanded documentation on limiter types

All mods that were supported before should still be supported
This commit is contained in:
Ivan Savenko
2025-07-08 13:00:53 +03:00
parent 46072a1d60
commit 4af7949571
13 changed files with 531 additions and 342 deletions

View File

@@ -306,28 +306,6 @@ bool JsonNode::isCompact() const
}
}
bool JsonNode::TryBoolFromString(bool & success) const
{
success = true;
if(getType() == JsonNode::JsonType::DATA_BOOL)
return Bool();
success = getType() == JsonNode::JsonType::DATA_STRING;
if(success)
{
auto boolParamStr = String();
boost::algorithm::trim(boolParamStr);
boost::algorithm::to_lower(boolParamStr);
success = boolParamStr == "true";
if(success)
return true;
success = boolParamStr == "false";
}
return false;
}
void JsonNode::clear()
{
setType(JsonType::DATA_NULL);