mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-15 11:46:56 +02:00
use logMod for all mod-related logging
This commit is contained in:
parent
abdca71828
commit
03b7da93e2
@ -360,7 +360,7 @@ ArtifactPosition CArtHandler::stringToSlot(std::string slotName)
|
|||||||
if (it != artifactPositionMap.end())
|
if (it != artifactPositionMap.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
||||||
logGlobal->warn("Warning! Artifact slot %s not recognized!", slotName);
|
logMod->warn("Warning! Artifact slot %s not recognized!", slotName);
|
||||||
return ArtifactPosition::PRE_FIRST;
|
return ArtifactPosition::PRE_FIRST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,7 +421,7 @@ CArtifact::EartClass CArtHandler::stringToClass(std::string className)
|
|||||||
if (it != artifactClassMap.end())
|
if (it != artifactClassMap.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
||||||
logGlobal->warn("Warning! Artifact rarity %s not recognized!", className);
|
logMod->warn("Warning! Artifact rarity %s not recognized!", className);
|
||||||
return CArtifact::ART_SPECIAL;
|
return CArtifact::ART_SPECIAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,7 +455,7 @@ void CArtHandler::loadType(CArtifact * art, const JsonNode & node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
logGlobal->warn("Warning! Artifact type %s not recognized!", b.String());
|
logMod->warn("Warning! Artifact type %s not recognized!", b.String());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -679,11 +679,11 @@ void CArtHandler::erasePickedArt(ArtifactID id)
|
|||||||
artifactList->erase(itr);
|
artifactList->erase(itr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
logGlobal->warn("Problem: cannot erase artifact %s from list, it was not present", art->Name());
|
logMod->warn("Problem: cannot erase artifact %s from list, it was not present", art->Name());
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
logGlobal->warn("Problem: cannot find list for artifact %s, strange class. (special?)", art->Name());
|
logMod->warn("Problem: cannot find list for artifact %s, strange class. (special?)", art->Name());
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::vector<CArtifact*>&> CArtHandler::listFromClass( CArtifact::EartClass artifactClass )
|
boost::optional<std::vector<CArtifact*>&> CArtHandler::listFromClass( CArtifact::EartClass artifactClass )
|
||||||
@ -869,7 +869,7 @@ bool CArtifactInstance::canBePutAt(const CArtifactSet *artSet, ArtifactPosition
|
|||||||
auto possibleSlots = artType->possibleSlots.find(artSet->bearerType());
|
auto possibleSlots = artType->possibleSlots.find(artSet->bearerType());
|
||||||
if(possibleSlots == artType->possibleSlots.end())
|
if(possibleSlots == artType->possibleSlots.end())
|
||||||
{
|
{
|
||||||
logGlobal->warn("Warning: artifact %s doesn't have defined allowed slots for bearer of type %s", artType->Name(), artSet->bearerType());
|
logMod->warn("Warning: artifact %s doesn't have defined allowed slots for bearer of type %s", artType->Name(), artSet->bearerType());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1007,7 +1007,7 @@ SpellID CArtifactInstance::getGivenSpellID() const
|
|||||||
const auto b = getBonusLocalFirst(Selector::type(Bonus::SPELL));
|
const auto b = getBonusLocalFirst(Selector::type(Bonus::SPELL));
|
||||||
if(!b)
|
if(!b)
|
||||||
{
|
{
|
||||||
logGlobal->warn("Warning: %s doesn't bear any spell!", nodeName());
|
logMod->warn("Warning: %s doesn't bear any spell!", nodeName());
|
||||||
return SpellID::NONE;
|
return SpellID::NONE;
|
||||||
}
|
}
|
||||||
return SpellID(b->subtype);
|
return SpellID(b->subtype);
|
||||||
|
@ -362,7 +362,7 @@ void CHeroHandler::loadHeroSkills(CHero * hero, const JsonNode & node)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logGlobal->error("Unknown skill level: %s", set["level"].String());
|
logMod->error("Unknown skill level: %s", set["level"].String());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ CIdentifierStorage::~CIdentifierStorage()
|
|||||||
void CIdentifierStorage::checkIdentifier(std::string & ID)
|
void CIdentifierStorage::checkIdentifier(std::string & ID)
|
||||||
{
|
{
|
||||||
if (boost::algorithm::ends_with(ID, "."))
|
if (boost::algorithm::ends_with(ID, "."))
|
||||||
logGlobal->warn("BIG WARNING: identifier %s seems to be broken!", ID);
|
logMod->warn("BIG WARNING: identifier %s seems to be broken!", ID);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
@ -45,7 +45,7 @@ void CIdentifierStorage::checkIdentifier(std::string & ID)
|
|||||||
{
|
{
|
||||||
if (std::tolower(ID[pos]) != ID[pos] ) //Not in camelCase
|
if (std::tolower(ID[pos]) != ID[pos] ) //Not in camelCase
|
||||||
{
|
{
|
||||||
logGlobal->warn("Warning: identifier %s is not in camelCase!", ID);
|
logMod->warn("Warning: identifier %s is not in camelCase!", ID);
|
||||||
ID[pos] = std::tolower(ID[pos]);// Try to fix the ID
|
ID[pos] = std::tolower(ID[pos]);// Try to fix the ID
|
||||||
}
|
}
|
||||||
pos = ID.find('.', pos);
|
pos = ID.find('.', pos);
|
||||||
@ -149,7 +149,7 @@ boost::optional<si32> CIdentifierStorage::getIdentifier(std::string scope, std::
|
|||||||
if (idList.size() == 1)
|
if (idList.size() == 1)
|
||||||
return idList.front().id;
|
return idList.front().id;
|
||||||
if (!silent)
|
if (!silent)
|
||||||
logGlobal->error("Failed to resolve identifier %s of type %s from mod %s", name , type ,scope);
|
logMod->error("Failed to resolve identifier %s of type %s from mod %s", name , type ,scope);
|
||||||
|
|
||||||
return boost::optional<si32>();
|
return boost::optional<si32>();
|
||||||
}
|
}
|
||||||
@ -162,7 +162,7 @@ boost::optional<si32> CIdentifierStorage::getIdentifier(std::string type, const
|
|||||||
if (idList.size() == 1)
|
if (idList.size() == 1)
|
||||||
return idList.front().id;
|
return idList.front().id;
|
||||||
if (!silent)
|
if (!silent)
|
||||||
logGlobal->error("Failed to resolve identifier %s of type %s from mod %s", name.String(), type, name.meta);
|
logMod->error("Failed to resolve identifier %s of type %s from mod %s", name.String(), type, name.meta);
|
||||||
|
|
||||||
return boost::optional<si32>();
|
return boost::optional<si32>();
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ boost::optional<si32> CIdentifierStorage::getIdentifier(const JsonNode & name, b
|
|||||||
if (idList.size() == 1)
|
if (idList.size() == 1)
|
||||||
return idList.front().id;
|
return idList.front().id;
|
||||||
if (!silent)
|
if (!silent)
|
||||||
logGlobal->error("Failed to resolve identifier %s of type %s from mod %s", name.String(), pair2.first, name.meta);
|
logMod->error("Failed to resolve identifier %s of type %s from mod %s", name.String(), pair2.first, name.meta);
|
||||||
|
|
||||||
return boost::optional<si32>();
|
return boost::optional<si32>();
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ boost::optional<si32> CIdentifierStorage::getIdentifier(std::string scope, std::
|
|||||||
if (idList.size() == 1)
|
if (idList.size() == 1)
|
||||||
return idList.front().id;
|
return idList.front().id;
|
||||||
if (!silent)
|
if (!silent)
|
||||||
logGlobal->error("Failed to resolve identifier %s of type %s from mod %s", fullName, pair2.first, scope);
|
logMod->error("Failed to resolve identifier %s of type %s from mod %s", fullName, pair2.first, scope);
|
||||||
|
|
||||||
return boost::optional<si32>();
|
return boost::optional<si32>();
|
||||||
}
|
}
|
||||||
@ -280,15 +280,15 @@ bool CIdentifierStorage::resolveIdentifier(const ObjectCallback & request)
|
|||||||
|
|
||||||
// error found. Try to generate some debug info
|
// error found. Try to generate some debug info
|
||||||
if (identifiers.size() == 0)
|
if (identifiers.size() == 0)
|
||||||
logGlobal->error("Unknown identifier!");
|
logMod->error("Unknown identifier!");
|
||||||
else
|
else
|
||||||
logGlobal->error("Ambiguous identifier request!");
|
logMod->error("Ambiguous identifier request!");
|
||||||
|
|
||||||
logGlobal->error("Request for %s.%s from mod %s", request.type, request.name, request.localScope);
|
logMod->error("Request for %s.%s from mod %s", request.type, request.name, request.localScope);
|
||||||
|
|
||||||
for (auto id : identifiers)
|
for (auto id : identifiers)
|
||||||
{
|
{
|
||||||
logGlobal->error("\tID is available in mod %s", id.scope);
|
logMod->error("\tID is available in mod %s", id.scope);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -308,9 +308,9 @@ void CIdentifierStorage::finalize()
|
|||||||
{
|
{
|
||||||
for(auto object : registeredObjects)
|
for(auto object : registeredObjects)
|
||||||
{
|
{
|
||||||
logGlobal->trace("%s : %s -> %d", object.second.scope, object.first, object.second.id);
|
logMod->trace("%s : %s -> %d", object.second.scope, object.first, object.second.id);
|
||||||
}
|
}
|
||||||
logGlobal->error("All known identifiers were dumped into log file");
|
logMod->error("All known identifiers were dumped into log file");
|
||||||
}
|
}
|
||||||
assert(errorsFound == false);
|
assert(errorsFound == false);
|
||||||
state = FINISHED;
|
state = FINISHED;
|
||||||
@ -351,9 +351,9 @@ bool CContentHandler::ContentTypeHandler::preloadModData(std::string modName, st
|
|||||||
|
|
||||||
// patching this mod? Send warning and continue - this situation can be handled normally
|
// patching this mod? Send warning and continue - this situation can be handled normally
|
||||||
if (remoteName == modName)
|
if (remoteName == modName)
|
||||||
logGlobal->warn("Redundant namespace definition for %s", objectName);
|
logMod->warn("Redundant namespace definition for %s", objectName);
|
||||||
|
|
||||||
logGlobal->trace("Patching object %s (%s) from %s", objectName, remoteName, modName);
|
logMod->trace("Patching object %s (%s) from %s", objectName, remoteName, modName);
|
||||||
JsonNode & remoteConf = modData[remoteName].patches[objectName];
|
JsonNode & remoteConf = modData[remoteName].patches[objectName];
|
||||||
|
|
||||||
JsonUtils::merge(remoteConf, entry.second);
|
JsonUtils::merge(remoteConf, entry.second);
|
||||||
@ -477,7 +477,7 @@ void CContentHandler::preloadData(CModInfo & mod)
|
|||||||
bool validate = (mod.validation != CModInfo::PASSED);
|
bool validate = (mod.validation != CModInfo::PASSED);
|
||||||
|
|
||||||
// print message in format [<8-symbols checksum>] <modname>
|
// print message in format [<8-symbols checksum>] <modname>
|
||||||
logGlobal->info("\t\t[%08x]%s", mod.checksum, mod.name);
|
logMod->info("\t\t[%08x]%s", mod.checksum, mod.name);
|
||||||
|
|
||||||
if (validate && mod.identifier != "core")
|
if (validate && mod.identifier != "core")
|
||||||
{
|
{
|
||||||
@ -498,12 +498,12 @@ void CContentHandler::load(CModInfo & mod)
|
|||||||
if (validate)
|
if (validate)
|
||||||
{
|
{
|
||||||
if (mod.validation != CModInfo::FAILED)
|
if (mod.validation != CModInfo::FAILED)
|
||||||
logGlobal->info("\t\t[DONE] %s", mod.name);
|
logMod->info("\t\t[DONE] %s", mod.name);
|
||||||
else
|
else
|
||||||
logGlobal->error("\t\t[FAIL] %s", mod.name);
|
logMod->error("\t\t[FAIL] %s", mod.name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
logGlobal->info("\t\t[SKIP] %s", mod.name);
|
logMod->info("\t\t[SKIP] %s", mod.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JsonNode loadModSettings(std::string path)
|
static JsonNode loadModSettings(std::string path)
|
||||||
@ -629,39 +629,39 @@ void CModHandler::loadConfigFromFile (std::string name)
|
|||||||
paths += p.string() + ", ";
|
paths += p.string() + ", ";
|
||||||
}
|
}
|
||||||
paths = paths.substr(0, paths.size() - 2);
|
paths = paths.substr(0, paths.size() - 2);
|
||||||
logGlobal->debug("Loading hardcoded features settings from [%s], result:", paths);
|
logMod->debug("Loading hardcoded features settings from [%s], result:", paths);
|
||||||
settings.data = JsonUtils::assembleFromFiles("config/" + name);
|
settings.data = JsonUtils::assembleFromFiles("config/" + name);
|
||||||
const JsonNode & hardcodedFeatures = settings.data["hardcodedFeatures"];
|
const JsonNode & hardcodedFeatures = settings.data["hardcodedFeatures"];
|
||||||
settings.MAX_HEROES_AVAILABLE_PER_PLAYER = hardcodedFeatures["MAX_HEROES_AVAILABLE_PER_PLAYER"].Integer();
|
settings.MAX_HEROES_AVAILABLE_PER_PLAYER = hardcodedFeatures["MAX_HEROES_AVAILABLE_PER_PLAYER"].Integer();
|
||||||
logGlobal->debug("\tMAX_HEROES_AVAILABLE_PER_PLAYER\t%d", settings.MAX_HEROES_AVAILABLE_PER_PLAYER);
|
logMod->debug("\tMAX_HEROES_AVAILABLE_PER_PLAYER\t%d", settings.MAX_HEROES_AVAILABLE_PER_PLAYER);
|
||||||
settings.MAX_HEROES_ON_MAP_PER_PLAYER = hardcodedFeatures["MAX_HEROES_ON_MAP_PER_PLAYER"].Integer();
|
settings.MAX_HEROES_ON_MAP_PER_PLAYER = hardcodedFeatures["MAX_HEROES_ON_MAP_PER_PLAYER"].Integer();
|
||||||
logGlobal->debug("\tMAX_HEROES_ON_MAP_PER_PLAYER\t%d", settings.MAX_HEROES_ON_MAP_PER_PLAYER);
|
logMod->debug("\tMAX_HEROES_ON_MAP_PER_PLAYER\t%d", settings.MAX_HEROES_ON_MAP_PER_PLAYER);
|
||||||
settings.CREEP_SIZE = hardcodedFeatures["CREEP_SIZE"].Integer();
|
settings.CREEP_SIZE = hardcodedFeatures["CREEP_SIZE"].Integer();
|
||||||
logGlobal->debug("\tCREEP_SIZE\t%d", settings.CREEP_SIZE);
|
logMod->debug("\tCREEP_SIZE\t%d", settings.CREEP_SIZE);
|
||||||
settings.WEEKLY_GROWTH = hardcodedFeatures["WEEKLY_GROWTH_PERCENT"].Integer();
|
settings.WEEKLY_GROWTH = hardcodedFeatures["WEEKLY_GROWTH_PERCENT"].Integer();
|
||||||
logGlobal->debug("\tWEEKLY_GROWTH\t%d", settings.WEEKLY_GROWTH);
|
logMod->debug("\tWEEKLY_GROWTH\t%d", settings.WEEKLY_GROWTH);
|
||||||
settings.NEUTRAL_STACK_EXP = hardcodedFeatures["NEUTRAL_STACK_EXP_DAILY"].Integer();
|
settings.NEUTRAL_STACK_EXP = hardcodedFeatures["NEUTRAL_STACK_EXP_DAILY"].Integer();
|
||||||
logGlobal->debug("\tNEUTRAL_STACK_EXP\t%d", settings.NEUTRAL_STACK_EXP);
|
logMod->debug("\tNEUTRAL_STACK_EXP\t%d", settings.NEUTRAL_STACK_EXP);
|
||||||
settings.MAX_BUILDING_PER_TURN = hardcodedFeatures["MAX_BUILDING_PER_TURN"].Integer();
|
settings.MAX_BUILDING_PER_TURN = hardcodedFeatures["MAX_BUILDING_PER_TURN"].Integer();
|
||||||
logGlobal->debug("\tMAX_BUILDING_PER_TURN\t%d", settings.MAX_BUILDING_PER_TURN);
|
logMod->debug("\tMAX_BUILDING_PER_TURN\t%d", settings.MAX_BUILDING_PER_TURN);
|
||||||
settings.DWELLINGS_ACCUMULATE_CREATURES = hardcodedFeatures["DWELLINGS_ACCUMULATE_CREATURES"].Bool();
|
settings.DWELLINGS_ACCUMULATE_CREATURES = hardcodedFeatures["DWELLINGS_ACCUMULATE_CREATURES"].Bool();
|
||||||
logGlobal->debug("\tDWELLINGS_ACCUMULATE_CREATURES\t%d", static_cast<int>(settings.DWELLINGS_ACCUMULATE_CREATURES));
|
logMod->debug("\tDWELLINGS_ACCUMULATE_CREATURES\t%d", static_cast<int>(settings.DWELLINGS_ACCUMULATE_CREATURES));
|
||||||
settings.ALL_CREATURES_GET_DOUBLE_MONTHS = hardcodedFeatures["ALL_CREATURES_GET_DOUBLE_MONTHS"].Bool();
|
settings.ALL_CREATURES_GET_DOUBLE_MONTHS = hardcodedFeatures["ALL_CREATURES_GET_DOUBLE_MONTHS"].Bool();
|
||||||
logGlobal->debug("\tALL_CREATURES_GET_DOUBLE_MONTHS\t%d", static_cast<int>(settings.ALL_CREATURES_GET_DOUBLE_MONTHS));
|
logMod->debug("\tALL_CREATURES_GET_DOUBLE_MONTHS\t%d", static_cast<int>(settings.ALL_CREATURES_GET_DOUBLE_MONTHS));
|
||||||
settings.WINNING_HERO_WITH_NO_TROOPS_RETREATS = hardcodedFeatures["WINNING_HERO_WITH_NO_TROOPS_RETREATS"].Bool();
|
settings.WINNING_HERO_WITH_NO_TROOPS_RETREATS = hardcodedFeatures["WINNING_HERO_WITH_NO_TROOPS_RETREATS"].Bool();
|
||||||
logGlobal->debug("\tWINNING_HERO_WITH_NO_TROOPS_RETREATS\t%d", static_cast<int>(settings.WINNING_HERO_WITH_NO_TROOPS_RETREATS));
|
logMod->debug("\tWINNING_HERO_WITH_NO_TROOPS_RETREATS\t%d", static_cast<int>(settings.WINNING_HERO_WITH_NO_TROOPS_RETREATS));
|
||||||
settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE = hardcodedFeatures["BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE"].Bool();
|
settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE = hardcodedFeatures["BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE"].Bool();
|
||||||
logGlobal->debug("\tBLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE\t%d", static_cast<int>(settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE));
|
logMod->debug("\tBLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE\t%d", static_cast<int>(settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE));
|
||||||
|
|
||||||
const JsonNode & gameModules = settings.data["modules"];
|
const JsonNode & gameModules = settings.data["modules"];
|
||||||
modules.STACK_EXP = gameModules["STACK_EXPERIENCE"].Bool();
|
modules.STACK_EXP = gameModules["STACK_EXPERIENCE"].Bool();
|
||||||
logGlobal->debug("\tSTACK_EXP\t%d", static_cast<int>(modules.STACK_EXP));
|
logMod->debug("\tSTACK_EXP\t%d", static_cast<int>(modules.STACK_EXP));
|
||||||
modules.STACK_ARTIFACT = gameModules["STACK_ARTIFACTS"].Bool();
|
modules.STACK_ARTIFACT = gameModules["STACK_ARTIFACTS"].Bool();
|
||||||
logGlobal->debug("\tSTACK_ARTIFACT\t%d", static_cast<int>(modules.STACK_ARTIFACT));
|
logMod->debug("\tSTACK_ARTIFACT\t%d", static_cast<int>(modules.STACK_ARTIFACT));
|
||||||
modules.COMMANDERS = gameModules["COMMANDERS"].Bool();
|
modules.COMMANDERS = gameModules["COMMANDERS"].Bool();
|
||||||
logGlobal->debug("\tCOMMANDERS\t%d", static_cast<int>(modules.COMMANDERS));
|
logMod->debug("\tCOMMANDERS\t%d", static_cast<int>(modules.COMMANDERS));
|
||||||
modules.MITHRIL = gameModules["MITHRIL"].Bool();
|
modules.MITHRIL = gameModules["MITHRIL"].Bool();
|
||||||
logGlobal->debug("\tMITHRIL\t%d", static_cast<int>(modules.MITHRIL));
|
logMod->debug("\tMITHRIL\t%d", static_cast<int>(modules.MITHRIL));
|
||||||
}
|
}
|
||||||
|
|
||||||
// currentList is passed by value to get current list of depending mods
|
// currentList is passed by value to get current list of depending mods
|
||||||
@ -672,8 +672,8 @@ bool CModHandler::hasCircularDependency(TModID modID, std::set <TModID> currentL
|
|||||||
// Mod already present? We found a loop
|
// Mod already present? We found a loop
|
||||||
if (vstd::contains(currentList, modID))
|
if (vstd::contains(currentList, modID))
|
||||||
{
|
{
|
||||||
logGlobal->error("Error: Circular dependency detected! Printing dependency list:");
|
logMod->error("Error: Circular dependency detected! Printing dependency list:");
|
||||||
logGlobal->error("\t%s -> ", mod.name);
|
logMod->error("\t%s -> ", mod.name);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,7 +684,7 @@ bool CModHandler::hasCircularDependency(TModID modID, std::set <TModID> currentL
|
|||||||
{
|
{
|
||||||
if (hasCircularDependency(dependency, currentList))
|
if (hasCircularDependency(dependency, currentList))
|
||||||
{
|
{
|
||||||
logGlobal->error("\t%s ->\n", mod.name); // conflict detected, print dependency list
|
logMod->error("\t%s ->\n", mod.name); // conflict detected, print dependency list
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -701,7 +701,7 @@ bool CModHandler::checkDependencies(const std::vector <TModID> & input) const
|
|||||||
{
|
{
|
||||||
if (!vstd::contains(input, dep))
|
if (!vstd::contains(input, dep))
|
||||||
{
|
{
|
||||||
logGlobal->error("Error: Mod %s requires missing %s!", mod.name, dep);
|
logMod->error("Error: Mod %s requires missing %s!", mod.name, dep);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -710,7 +710,7 @@ bool CModHandler::checkDependencies(const std::vector <TModID> & input) const
|
|||||||
{
|
{
|
||||||
if (vstd::contains(input, conflicting))
|
if (vstd::contains(input, conflicting))
|
||||||
{
|
{
|
||||||
logGlobal->error("Error: Mod %s conflicts with %s!", mod.name, allMods.at(conflicting).name);
|
logMod->error("Error: Mod %s conflicts with %s!", mod.name, allMods.at(conflicting).name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -941,11 +941,11 @@ void CModHandler::load()
|
|||||||
CStopWatch totalTime, timer;
|
CStopWatch totalTime, timer;
|
||||||
|
|
||||||
CContentHandler content;
|
CContentHandler content;
|
||||||
logGlobal->info("\tInitializing content handler: %d ms", timer.getDiff());
|
logMod->info("\tInitializing content handler: %d ms", timer.getDiff());
|
||||||
|
|
||||||
for(const TModID & modName : activeMods)
|
for(const TModID & modName : activeMods)
|
||||||
{
|
{
|
||||||
logGlobal->trace("Generating checksum for %s", modName);
|
logMod->trace("Generating checksum for %s", modName);
|
||||||
allMods[modName].updateChecksum(calculateModChecksum(modName, CResourceHandler::get(modName)));
|
allMods[modName].updateChecksum(calculateModChecksum(modName, CResourceHandler::get(modName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -954,7 +954,7 @@ void CModHandler::load()
|
|||||||
content.preloadData(coreMod);
|
content.preloadData(coreMod);
|
||||||
for(const TModID & modName : activeMods)
|
for(const TModID & modName : activeMods)
|
||||||
content.preloadData(allMods[modName]);
|
content.preloadData(allMods[modName]);
|
||||||
logGlobal->info("\tParsing mod data: %d ms", timer.getDiff());
|
logMod->info("\tParsing mod data: %d ms", timer.getDiff());
|
||||||
|
|
||||||
content.load(coreMod);
|
content.load(coreMod);
|
||||||
for(const TModID & modName : activeMods)
|
for(const TModID & modName : activeMods)
|
||||||
@ -962,17 +962,17 @@ void CModHandler::load()
|
|||||||
|
|
||||||
content.loadCustom();
|
content.loadCustom();
|
||||||
|
|
||||||
logGlobal->info("\tLoading mod data: %d ms", timer.getDiff());
|
logMod->info("\tLoading mod data: %d ms", timer.getDiff());
|
||||||
|
|
||||||
VLC->creh->loadCrExpBon();
|
VLC->creh->loadCrExpBon();
|
||||||
VLC->creh->buildBonusTreeForTiers(); //do that after all new creatures are loaded
|
VLC->creh->buildBonusTreeForTiers(); //do that after all new creatures are loaded
|
||||||
|
|
||||||
identifiers.finalize();
|
identifiers.finalize();
|
||||||
logGlobal->info("\tResolving identifiers: %d ms", timer.getDiff());
|
logMod->info("\tResolving identifiers: %d ms", timer.getDiff());
|
||||||
|
|
||||||
content.afterLoadFinalization();
|
content.afterLoadFinalization();
|
||||||
logGlobal->info("\tHandlers post-load finalization: %d ms ", timer.getDiff());
|
logMod->info("\tHandlers post-load finalization: %d ms ", timer.getDiff());
|
||||||
logGlobal->info("\tAll game content loaded in %d ms", totalTime.getDiff());
|
logMod->info("\tAll game content loaded in %d ms", totalTime.getDiff());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModHandler::afterLoad()
|
void CModHandler::afterLoad()
|
||||||
|
@ -183,7 +183,7 @@ CSkill * CSkillHandler::loadFromJson(const JsonNode & json, const std::string &
|
|||||||
|
|
||||||
if(!skill)
|
if(!skill)
|
||||||
{
|
{
|
||||||
logGlobal->error("unknown secondary skill %s", identifier);
|
logMod->error("unknown secondary skill %s", identifier);
|
||||||
throw std::runtime_error("invalid skill");
|
throw std::runtime_error("invalid skill");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -748,7 +748,7 @@ void CTownHandler::loadObject(std::string scope, std::string name, const JsonNod
|
|||||||
auto & advMap = data["town"]["adventureMap"];
|
auto & advMap = data["town"]["adventureMap"];
|
||||||
if (!advMap.isNull())
|
if (!advMap.isNull())
|
||||||
{
|
{
|
||||||
logGlobal->warn("Outdated town mod. Will try to generate valid templates out of fort");
|
logMod->warn("Outdated town mod. Will try to generate valid templates out of fort");
|
||||||
JsonNode config;
|
JsonNode config;
|
||||||
config["animation"] = advMap["castle"];
|
config["animation"] = advMap["castle"];
|
||||||
VLC->objtypeh->getHandlerFor(index, object->index)->addTemplate(config);
|
VLC->objtypeh->getHandlerFor(index, object->index)->addTemplate(config);
|
||||||
@ -818,9 +818,9 @@ void CTownHandler::initializeRequirements()
|
|||||||
{
|
{
|
||||||
if (node.Vector().size() > 1)
|
if (node.Vector().size() > 1)
|
||||||
{
|
{
|
||||||
logGlobal->warn("Unexpected length of town buildings requirements: %d", node.Vector().size());
|
logMod->warn("Unexpected length of town buildings requirements: %d", node.Vector().size());
|
||||||
logGlobal->warn("Entry contains: ");
|
logMod->warn("Entry contains: ");
|
||||||
logGlobal->warn(node.toJson());
|
logMod->warn(node.toJson());
|
||||||
}
|
}
|
||||||
return BuildingID(VLC->modh->identifiers.getIdentifier(requirement.town->getBuildingScope(), node.Vector()[0]).get());
|
return BuildingID(VLC->modh->identifiers.getIdentifier(requirement.town->getBuildingScope(), node.Vector()[0]).get());
|
||||||
});
|
});
|
||||||
|
@ -94,7 +94,7 @@ public:
|
|||||||
|
|
||||||
if (raw_id < 0 || raw_id >= objects.size())
|
if (raw_id < 0 || raw_id >= objects.size())
|
||||||
{
|
{
|
||||||
logGlobal->error("%s id %d is invalid", getTypeName(), static_cast<si64>(raw_id));
|
logMod->error("%s id %d is invalid", getTypeName(), static_cast<si64>(raw_id));
|
||||||
throw std::runtime_error("internal error");
|
throw std::runtime_error("internal error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,8 +163,8 @@ JsonNode JsonParser::parse(std::string fileName)
|
|||||||
|
|
||||||
if (!errors.empty())
|
if (!errors.empty())
|
||||||
{
|
{
|
||||||
logGlobal->warn("File %s is not a valid JSON file!", fileName);
|
logMod->warn("File %s is not a valid JSON file!", fileName);
|
||||||
logGlobal->warn(errors);
|
logMod->warn(errors);
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ std::shared_ptr<Bonus> JsonUtils::parseBonus (const JsonVector &ability_vec) //T
|
|||||||
auto it = bonusNameMap.find(type);
|
auto it = bonusNameMap.find(type);
|
||||||
if (it == bonusNameMap.end())
|
if (it == bonusNameMap.end())
|
||||||
{
|
{
|
||||||
logGlobal->error("Error: invalid ability type %s", type);
|
logMod->error("Error: invalid ability type %s", type);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
b->type = it->second;
|
b->type = it->second;
|
||||||
@ -413,7 +413,7 @@ const T & parseByMap(const std::map<std::string, T> & map, const JsonNode * val,
|
|||||||
auto it = map.find(type);
|
auto it = map.find(type);
|
||||||
if (it == map.end())
|
if (it == map.end())
|
||||||
{
|
{
|
||||||
logGlobal->error("Error: invalid %s%s", err, type);
|
logMod->error("Error: invalid %s%s", err, type);
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -445,7 +445,7 @@ void JsonUtils::resolveIdentifier(si32 &var, const JsonNode &node, std::string n
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
logGlobal->error("Error! Wrong identifier used for value of %s", name);
|
logMod->error("Error! Wrong identifier used for value of %s", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -467,7 +467,7 @@ void JsonUtils::resolveIdentifier(const JsonNode &node, si32 &var)
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
logGlobal->error("Error! Wrong identifier used for identifier!");
|
logMod->error("Error! Wrong identifier used for identifier!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,7 +489,7 @@ bool JsonUtils::parseBonus(const JsonNode &ability, Bonus *b)
|
|||||||
auto it = bonusNameMap.find(type);
|
auto it = bonusNameMap.find(type);
|
||||||
if (it == bonusNameMap.end())
|
if (it == bonusNameMap.end())
|
||||||
{
|
{
|
||||||
logGlobal->error("Error: invalid ability type %s", type);
|
logMod->error("Error: invalid ability type %s", type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
b->type = it->second;
|
b->type = it->second;
|
||||||
@ -533,7 +533,7 @@ bool JsonUtils::parseBonus(const JsonNode &ability, Bonus *b)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
logGlobal->error("Error! Wrong bonus duration format.");
|
logMod->error("Error! Wrong bonus duration format.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,7 +580,7 @@ bool JsonUtils::parseBonus(const JsonNode &ability, Bonus *b)
|
|||||||
auto it = bonusNameMap.find(anotherBonusType);
|
auto it = bonusNameMap.find(anotherBonusType);
|
||||||
if (it == bonusNameMap.end())
|
if (it == bonusNameMap.end())
|
||||||
{
|
{
|
||||||
logGlobal->error("Error: invalid ability type %s", anotherBonusType);
|
logMod->error("Error: invalid ability type %s", anotherBonusType);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
l2->type = it->second;
|
l2->type = it->second;
|
||||||
@ -723,8 +723,8 @@ bool JsonUtils::validate(const JsonNode &node, std::string schemaName, std::stri
|
|||||||
std::string log = Validation::check(schemaName, node);
|
std::string log = Validation::check(schemaName, node);
|
||||||
if (!log.empty())
|
if (!log.empty())
|
||||||
{
|
{
|
||||||
logGlobal->warn("Data in %s is invalid!", dataName);
|
logMod->warn("Data in %s is invalid!", dataName);
|
||||||
logGlobal->warn(log);
|
logMod->warn(log);
|
||||||
}
|
}
|
||||||
return log.empty();
|
return log.empty();
|
||||||
}
|
}
|
||||||
@ -745,7 +745,7 @@ const JsonNode & getSchemaByName(std::string name)
|
|||||||
return loadedSchemas[name];
|
return loadedSchemas[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
logGlobal->error("Error: missing schema with name %s!", name);
|
logMod->error("Error: missing schema with name %s!", name);
|
||||||
assert(0);
|
assert(0);
|
||||||
return nullNode;
|
return nullNode;
|
||||||
}
|
}
|
||||||
@ -756,7 +756,7 @@ const JsonNode & JsonUtils::getSchema(std::string URI)
|
|||||||
size_t posHash = URI.find('#');
|
size_t posHash = URI.find('#');
|
||||||
if(posColon == std::string::npos)
|
if(posColon == std::string::npos)
|
||||||
{
|
{
|
||||||
logGlobal->error("Invalid schema URI:%s", URI);
|
logMod->error("Invalid schema URI:%s", URI);
|
||||||
return nullNode;
|
return nullNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -765,7 +765,7 @@ const JsonNode & JsonUtils::getSchema(std::string URI)
|
|||||||
|
|
||||||
if(protocolName != "vcmi")
|
if(protocolName != "vcmi")
|
||||||
{
|
{
|
||||||
logGlobal->error("Error: unsupported URI protocol for schema: %s", URI);
|
logMod->error("Error: unsupported URI protocol for schema: %s", URI);
|
||||||
return nullNode;
|
return nullNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -819,7 +819,7 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode & json, const std::string &
|
|||||||
|
|
||||||
spell->name = json["name"].String();
|
spell->name = json["name"].String();
|
||||||
|
|
||||||
logGlobal->trace("%s: loading spell %s", __FUNCTION__, spell->name);
|
logMod->trace("%s: loading spell %s", __FUNCTION__, spell->name);
|
||||||
|
|
||||||
const auto schoolNames = json["school"];
|
const auto schoolNames = json["school"];
|
||||||
|
|
||||||
@ -854,7 +854,7 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode & json, const std::string &
|
|||||||
else if(targetType == "LOCATION")
|
else if(targetType == "LOCATION")
|
||||||
spell->targetType = CSpell::LOCATION;
|
spell->targetType = CSpell::LOCATION;
|
||||||
else
|
else
|
||||||
logGlobal->warn("Spell %s: target type %s - assumed NO_TARGET.", spell->name, (targetType.empty() ? "empty" : "unknown ("+targetType+")"));
|
logMod->warn("Spell %s: target type %s - assumed NO_TARGET.", spell->name, (targetType.empty() ? "empty" : "unknown ("+targetType+")"));
|
||||||
|
|
||||||
for(const auto & counteredSpell: json["counters"].Struct())
|
for(const auto & counteredSpell: json["counters"].Struct())
|
||||||
if (counteredSpell.second.Bool())
|
if (counteredSpell.second.Bool())
|
||||||
@ -899,7 +899,7 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode & json, const std::string &
|
|||||||
else if(!implicitPositiveness)
|
else if(!implicitPositiveness)
|
||||||
{
|
{
|
||||||
spell->positiveness = CSpell::NEUTRAL; //duplicates constructor but, just in case
|
spell->positiveness = CSpell::NEUTRAL; //duplicates constructor but, just in case
|
||||||
logGlobal->error("Spell %s: no positiveness specified, assumed NEUTRAL.", spell->name);
|
logMod->error("Spell %s: no positiveness specified, assumed NEUTRAL.", spell->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
spell->isSpecial = flags["special"].Bool();
|
spell->isSpecial = flags["special"].Bool();
|
||||||
@ -909,7 +909,7 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode & json, const std::string &
|
|||||||
auto it = bonusNameMap.find(name);
|
auto it = bonusNameMap.find(name);
|
||||||
if(it == bonusNameMap.end())
|
if(it == bonusNameMap.end())
|
||||||
{
|
{
|
||||||
logGlobal->error("Spell %s: invalid bonus name %s", spell->name, name);
|
logMod->error("Spell %s: invalid bonus name %s", spell->name, name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user