mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-17 00:07:41 +02:00
vcmi: add UnitOnHex limiter
Bonus will be accepted, if unit stands in listed hexes
This commit is contained in:
@ -20,6 +20,7 @@
|
||||
#include "CGeneralTextHandler.h"
|
||||
#include "JsonDetail.h"
|
||||
#include "StringConstants.h"
|
||||
#include "battle/BattleHex.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -770,6 +771,17 @@ std::shared_ptr<ILimiter> JsonUtils::parseLimiter(const JsonNode & limiter)
|
||||
}
|
||||
return terrainLimiter;
|
||||
}
|
||||
else if(limiterType == "UNIT_ON_HEXES") {
|
||||
auto hexLimiter = std::make_shared<UnitOnHexLimiter>();
|
||||
if(!parameters.empty())
|
||||
{
|
||||
for (const auto & parameter: parameters){
|
||||
if(parameter.isNumber())
|
||||
hexLimiter->applicableHexes.insert(BattleHex(parameter.Integer()));
|
||||
}
|
||||
}
|
||||
return hexLimiter;
|
||||
}
|
||||
else
|
||||
{
|
||||
logMod->error("Error: invalid customizable limiter type %s.", limiterType);
|
||||
|
Reference in New Issue
Block a user