1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

PathfinderOptions: use settings and move all defaults into schema

This commit is contained in:
ArseniyShestakov 2015-11-21 00:32:23 +03:00
parent cb61572878
commit e91d79414b
2 changed files with 81 additions and 12 deletions

View File

@ -3,7 +3,7 @@
{
"type" : "object",
"$schema": "http://json-schema.org/draft-04/schema",
"required" : [ "general", "video", "adventure", "battle", "server", "logging", "launcher" ],
"required" : [ "general", "video", "adventure", "pathfinder", "battle", "server", "logging", "launcher" ],
"definitions" : {
"logLevelEnum" : {
"type" : "string",
@ -108,6 +108,74 @@
}
}
},
"pathfinder" : {
"type" : "object",
"additionalProperties" : false,
"default": {},
"required" : [ "teleports", "layers", "oneTurnSpecialLayersLimit", "originalMovementRules", "lightweightFlyingMode" ],
"properties" : {
"layers" : {
"type" : "object",
"additionalProperties" : false,
"default": {},
"required" : [ "sailing", "waterWalking", "flying" ],
"properties" : {
"sailing" : {
"type" : "boolean",
"default" : true
},
"waterWalking" : {
"type" : "boolean",
"default" : true
},
"flying" : {
"type" : "boolean",
"default" : true
}
}
},
"teleports" : {
"type" : "object",
"additionalProperties" : false,
"default": {},
"required" : [ "twoWay", "oneWay", "oneWayRandom", "whirlpool", "castleGate" ],
"properties" : {
"twoWay" : {
"type" : "boolean",
"default" : true
},
"oneWay" : {
"type" : "boolean",
"default" : true
},
"oneWayRandom" : {
"type" : "boolean",
"default" : false
},
"whirlpool" : {
"type" : "boolean",
"default" : true
},
"castleGate" : {
"type" : "boolean",
"default" : false
}
}
},
"oneTurnSpecialLayersLimit" : {
"type" : "boolean",
"default" : true
},
"originalMovementRules" : {
"type" : "boolean",
"default" : false
},
"lightweightFlyingMode" : {
"type" : "boolean",
"default" : false
}
}
},
"battle" : {
"type" : "object",
"additionalProperties" : false,

View File

@ -7,6 +7,7 @@
#include "mapObjects/CGHeroInstance.h"
#include "GameConstants.h"
#include "CStopWatch.h"
#include "CConfigHandler.h"
/*
* CPathfinder.cpp, part of VCMI engine
@ -20,19 +21,19 @@
CPathfinder::PathfinderOptions::PathfinderOptions()
{
useFlying = true;
useWaterWalking = true;
useEmbarkAndDisembark = true;
useTeleportTwoWay = true;
useTeleportOneWay = true;
useTeleportOneWayRandom = false;
useTeleportWhirlpool = true;
useFlying = settings["pathfinder"]["layers"]["flying"].Bool();
useWaterWalking = settings["pathfinder"]["layers"]["waterWalking"].Bool();
useEmbarkAndDisembark = settings["pathfinder"]["layers"]["sailing"].Bool();
useTeleportTwoWay = settings["pathfinder"]["teleports"]["twoWay"].Bool();
useTeleportOneWay = settings["pathfinder"]["teleports"]["oneWay"].Bool();
useTeleportOneWayRandom = settings["pathfinder"]["teleports"]["oneWayRandom"].Bool();
useTeleportWhirlpool = settings["pathfinder"]["teleports"]["whirlpool"].Bool();
useCastleGate = false;
useCastleGate = settings["pathfinder"]["teleports"]["castleGate"].Bool();
lightweightFlyingMode = false;
oneTurnSpecialLayersLimit = true;
originalMovementRules = true;
lightweightFlyingMode = settings["pathfinder"]["lightweightFlyingMode"].Bool();
oneTurnSpecialLayersLimit = settings["pathfinder"]["oneTurnSpecialLayersLimit"].Bool();
originalMovementRules = settings["pathfinder"]["originalMovementRules"].Bool();
}
CPathfinder::CPathfinder(CPathsInfo & _out, CGameState * _gs, const CGHeroInstance * _hero)