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

66 lines
2.4 KiB
C++
Raw Normal View History

2024-02-25 12:39:19 +02:00
/*
* Settings.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#include <limits>
#include "Settings.h"
#include "../../../lib/constants/StringConstants.h"
2024-02-25 12:39:19 +02:00
#include "../../../lib/mapObjectConstructors/AObjectTypeHandler.h"
#include "../../../lib/mapObjectConstructors/CObjectClassesHandler.h"
#include "../../../lib/mapObjectConstructors/CBankInstanceConstructor.h"
#include "../../../lib/mapObjects/MapObjects.h"
#include "../../../lib/modding/CModHandler.h"
#include "../../../lib/VCMI_Lib.h"
#include "../../../lib/filesystem/Filesystem.h"
2024-04-19 17:40:47 +02:00
#include "../../../lib/json/JsonUtils.h"
2024-02-25 12:39:19 +02:00
namespace NKAI
{
Settings::Settings(int difficultyLevel)
2024-02-25 12:39:19 +02:00
: maxRoamingHeroes(8),
mainHeroTurnDistanceLimit(10),
scoutHeroTurnDistanceLimit(5),
maxGoldPressure(0.3f),
retreatThresholdRelative(0.3),
2024-11-28 16:44:12 +02:00
retreatThresholdAbsolute(10000),
2024-11-28 13:53:51 +02:00
safeAttackRatio(1.1),
maxpass(10),
pathfinderBucketsCount(1),
pathfinderBucketSize(32),
2024-05-19 09:04:45 +02:00
allowObjectGraph(true),
useTroopsFromGarrisons(false),
updateHitmapOnTileReveal(false),
openMap(true),
useFuzzy(false)
2024-02-25 12:39:19 +02:00
{
const std::string & difficultyName = GameConstants::DIFFICULTY_NAMES[difficultyLevel];
const JsonNode & rootNode = JsonUtils::assembleFromFiles("config/ai/nkai/nkai-settings");
const JsonNode & node = rootNode[difficultyName];
2024-02-25 12:39:19 +02:00
maxRoamingHeroes = node["maxRoamingHeroes"].Integer();
mainHeroTurnDistanceLimit = node["mainHeroTurnDistanceLimit"].Integer();
scoutHeroTurnDistanceLimit = node["scoutHeroTurnDistanceLimit"].Integer();
maxpass = node["maxpass"].Integer();
pathfinderBucketsCount = node["pathfinderBucketsCount"].Integer();
pathfinderBucketSize = node["pathfinderBucketSize"].Integer();
maxGoldPressure = node["maxGoldPressure"].Float();
retreatThresholdRelative = node["retreatThresholdRelative"].Float();
2024-11-28 16:44:12 +02:00
retreatThresholdAbsolute = node["retreatThresholdAbsolute"].Float();
maxArmyLossTarget = node["maxArmyLossTarget"].Float();
2024-11-28 13:53:51 +02:00
safeAttackRatio = node["safeAttackRatio"].Float();
allowObjectGraph = node["allowObjectGraph"].Bool();
updateHitmapOnTileReveal = node["updateHitmapOnTileReveal"].Bool();
openMap = node["openMap"].Bool();
useFuzzy = node["useFuzzy"].Bool();
useTroopsFromGarrisons = node["useTroopsFromGarrisons"].Bool();
2024-02-25 12:39:19 +02:00
}
}