mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Logging cleanup
This commit is contained in:
@@ -1459,7 +1459,7 @@ void CArtifactSet::serializeJsonSlot(JsonSerializeFormat & handler, const Artifa
|
||||
}
|
||||
else
|
||||
{
|
||||
logGlobal->debugStream() << "Artifact can't be put at the specified location."; //TODO add more debugging information
|
||||
logGlobal->debug("Artifact can't be put at the specified location."); //TODO add more debugging information
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ void printWinError()
|
||||
int error = GetLastError();
|
||||
if(!error)
|
||||
{
|
||||
logGlobal->errorStream() << "No Win error information set.";
|
||||
logGlobal->error("No Win error information set.");
|
||||
return;
|
||||
}
|
||||
logGlobal->errorStream() << "Error " << error << " encountered:";
|
||||
@@ -106,7 +106,7 @@ const char* exceptionName(DWORD exc)
|
||||
|
||||
LONG WINAPI onUnhandledException(EXCEPTION_POINTERS* exception)
|
||||
{
|
||||
logGlobal->errorStream() << "Disaster happened.";
|
||||
logGlobal->error("Disaster happened.");
|
||||
|
||||
PEXCEPTION_RECORD einfo = exception->ExceptionRecord;
|
||||
logGlobal->errorStream() << "Reason: 0x" << std::hex << einfo->ExceptionCode << " - " << exceptionName(einfo->ExceptionCode)
|
||||
@@ -242,10 +242,10 @@ CConsoleHandler::CConsoleHandler() : thread(nullptr)
|
||||
}
|
||||
CConsoleHandler::~CConsoleHandler()
|
||||
{
|
||||
logGlobal->infoStream() << "Killing console...";
|
||||
logGlobal->info("Killing console...");
|
||||
end();
|
||||
delete cb;
|
||||
logGlobal->infoStream() << "Killing console... done!";
|
||||
logGlobal->info("Killing console... done!");
|
||||
}
|
||||
void CConsoleHandler::end()
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ bool CCreatureSet::setCreature(SlotID slot, CreatureID type, TQuantity quantity)
|
||||
}
|
||||
if(!quantity)
|
||||
{
|
||||
logGlobal->warnStream() << "Using set creature to delete stack?";
|
||||
logGlobal->warn("Using set creature to delete stack?");
|
||||
eraseStack(slot);
|
||||
return true;
|
||||
}
|
||||
@@ -171,7 +171,7 @@ void CCreatureSet::addToSlot(SlotID slot, CreatureID cre, TQuantity count, bool
|
||||
}
|
||||
else
|
||||
{
|
||||
logGlobal->errorStream() << "Failed adding to slot!";
|
||||
logGlobal->error("Failed adding to slot!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -833,7 +833,7 @@ void CGameState::initNewGame(bool allowSavingRandomMap)
|
||||
}
|
||||
}
|
||||
|
||||
logGlobal->infoStream() << boost::format("Generated random map in %i ms.") % sw.getDiff();
|
||||
logGlobal->info("Generated random map in %i ms.", sw.getDiff());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -274,9 +274,9 @@ bool CIdentifierStorage::resolveIdentifier(const ObjectCallback & request)
|
||||
|
||||
// error found. Try to generate some debug info
|
||||
if (identifiers.size() == 0)
|
||||
logGlobal->errorStream() << "Unknown identifier!";
|
||||
logGlobal->error("Unknown identifier!");
|
||||
else
|
||||
logGlobal->errorStream() << "Ambiguous identifier request!";
|
||||
logGlobal->error("Ambiguous identifier request!");
|
||||
|
||||
logGlobal->errorStream() << "Request for " << request.type << "." << request.name << " from mod " << request.localScope;
|
||||
|
||||
@@ -304,7 +304,7 @@ void CIdentifierStorage::finalize()
|
||||
{
|
||||
logGlobal->traceStream() << object.second.scope << " : " << object.first << " -> " << object.second.id;
|
||||
}
|
||||
logGlobal->errorStream() << "All known identifiers were dumped into log file";
|
||||
logGlobal->error("All known identifiers were dumped into log file");
|
||||
}
|
||||
assert(errorsFound == false);
|
||||
state = FINISHED;
|
||||
@@ -661,7 +661,7 @@ bool CModHandler::hasCircularDependency(TModID modID, std::set <TModID> currentL
|
||||
// Mod already present? We found a loop
|
||||
if (vstd::contains(currentList, modID))
|
||||
{
|
||||
logGlobal->errorStream() << "Error: Circular dependency detected! Printing dependency list:";
|
||||
logGlobal->error("Error: Circular dependency detected! Printing dependency list:");
|
||||
logGlobal->errorStream() << "\t" << mod.name << " -> ";
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ CPathfinder::CPathfinder(CPathsInfo & _out, CGameState * _gs, const CGHeroInstan
|
||||
out.hpos = hero->getPosition(false);
|
||||
if(!isInTheMap(out.hpos)/* || !gs->map->isInTheMap(dest)*/) //check input
|
||||
{
|
||||
logGlobal->errorStream() << "CGameState::calculatePaths: Hero outside the gs->map? How dare you...";
|
||||
logGlobal->error("CGameState::calculatePaths: Hero outside the gs->map? How dare you...");
|
||||
throw std::runtime_error("Wrong checksum");
|
||||
}
|
||||
|
||||
|
||||
@@ -748,7 +748,7 @@ void CTownHandler::loadObject(std::string scope, std::string name, const JsonNod
|
||||
auto & advMap = data["town"]["adventureMap"];
|
||||
if (!advMap.isNull())
|
||||
{
|
||||
logGlobal->warnStream() << "Outdated town mod. Will try to generate valid templates out of fort";
|
||||
logGlobal->warn("Outdated town mod. Will try to generate valid templates out of fort");
|
||||
JsonNode config;
|
||||
config["animation"] = advMap["castle"];
|
||||
VLC->objtypeh->getHandlerFor(index, object->index)->addTemplate(config);
|
||||
|
||||
@@ -1422,7 +1422,7 @@ int CreatureAlignmentLimiter::limit(const BonusLimitationContext &context) const
|
||||
case EAlignment::EVIL:
|
||||
return !c->isEvil();
|
||||
default:
|
||||
logBonus->warnStream() << "Warning: illegal alignment in limiter!";
|
||||
logBonus->warn("Warning: illegal alignment in limiter!");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ void CPrivilagedInfoCallback::getTilesInRange(std::unordered_set<int3, ShashInt3
|
||||
{
|
||||
if(!!player && *player >= PlayerColor::PLAYER_LIMIT)
|
||||
{
|
||||
logGlobal->errorStream() << "Illegal call to getTilesInRange!";
|
||||
logGlobal->error("Illegal call to getTilesInRange!");
|
||||
return;
|
||||
}
|
||||
if (radious == -1) //reveal entire map
|
||||
@@ -91,7 +91,7 @@ void CPrivilagedInfoCallback::getAllTiles(std::unordered_set<int3, ShashInt3> &t
|
||||
{
|
||||
if(!!Player && *Player >= PlayerColor::PLAYER_LIMIT)
|
||||
{
|
||||
logGlobal->errorStream() << "Illegal call to getAllTiles !";
|
||||
logGlobal->error("Illegal call to getAllTiles !");
|
||||
return;
|
||||
}
|
||||
bool water = surface == 0 || surface == 2,
|
||||
@@ -154,37 +154,37 @@ CGameState * CPrivilagedInfoCallback::gameState ()
|
||||
template<typename Loader>
|
||||
void CPrivilagedInfoCallback::loadCommonState(Loader &in)
|
||||
{
|
||||
logGlobal->infoStream() << "Loading lib part of game...";
|
||||
logGlobal->info("Loading lib part of game...");
|
||||
in.checkMagicBytes(SAVEGAME_MAGIC);
|
||||
|
||||
CMapHeader dum;
|
||||
StartInfo *si;
|
||||
|
||||
logGlobal->infoStream() <<"\tReading header";
|
||||
logGlobal->info("\tReading header");
|
||||
in.serializer & dum;
|
||||
|
||||
logGlobal->infoStream() << "\tReading options";
|
||||
logGlobal->info("\tReading options");
|
||||
in.serializer & si;
|
||||
|
||||
logGlobal->infoStream() <<"\tReading handlers";
|
||||
logGlobal->info("\tReading handlers");
|
||||
in.serializer & *VLC;
|
||||
|
||||
logGlobal->infoStream() <<"\tReading gamestate";
|
||||
logGlobal->info("\tReading gamestate");
|
||||
in.serializer & gs;
|
||||
}
|
||||
|
||||
template<typename Saver>
|
||||
void CPrivilagedInfoCallback::saveCommonState(Saver &out) const
|
||||
{
|
||||
logGlobal->infoStream() << "Saving lib part of game...";
|
||||
logGlobal->info("Saving lib part of game...");
|
||||
out.putMagicBytes(SAVEGAME_MAGIC);
|
||||
logGlobal->infoStream() <<"\tSaving header";
|
||||
logGlobal->info("\tSaving header");
|
||||
out.serializer & static_cast<CMapHeader&>(*gs->map);
|
||||
logGlobal->infoStream() << "\tSaving options";
|
||||
logGlobal->info("\tSaving options");
|
||||
out.serializer & gs->scenarioOps;
|
||||
logGlobal->infoStream() << "\tSaving handlers";
|
||||
logGlobal->info("\tSaving handlers");
|
||||
out.serializer & *VLC;
|
||||
logGlobal->infoStream() << "\tSaving gamestate";
|
||||
logGlobal->info("\tSaving gamestate");
|
||||
out.serializer & gs;
|
||||
}
|
||||
|
||||
|
||||
@@ -465,7 +465,7 @@ void JsonUtils::resolveIdentifier(const JsonNode &node, si32 &var)
|
||||
});
|
||||
break;
|
||||
default:
|
||||
logGlobal->errorStream() << "Error! Wrong identifier used for identifier!";
|
||||
logGlobal->error("Error! Wrong identifier used for identifier!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -531,7 +531,7 @@ bool JsonUtils::parseBonus(const JsonNode &ability, Bonus *b)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
logGlobal->errorStream() << "Error! Wrong bonus duration format.";
|
||||
logGlobal->error("Error! Wrong bonus duration format.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ DLL_LINKAGE void AddQuest::applyGs(CGameState *gs)
|
||||
if (!vstd::contains(*vec, quest))
|
||||
vec->push_back (quest);
|
||||
else
|
||||
logNetwork->warnStream() << "Warning! Attempt to add duplicated quest";
|
||||
logNetwork->warn("Warning! Attempt to add duplicated quest");
|
||||
}
|
||||
|
||||
DLL_LINKAGE void UpdateArtHandlerLists::applyGs(CGameState *gs)
|
||||
@@ -804,7 +804,7 @@ DLL_LINKAGE const CArtifactInstance *ArtifactLocation::getArt() const
|
||||
return s->artifact;
|
||||
else
|
||||
{
|
||||
logNetwork->warnStream() << "ArtifactLocation::getArt: This location is locked!";
|
||||
logNetwork->warn("ArtifactLocation::getArt: This location is locked!");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -895,7 +895,7 @@ DLL_LINKAGE void RebalanceStacks::applyGs(CGameState *gs)
|
||||
//else - artifact cna be lost :/
|
||||
else
|
||||
{
|
||||
logNetwork->warnStream() << "Artifact is present at destination slot!";
|
||||
logNetwork->warn("Artifact is present at destination slot!");
|
||||
}
|
||||
artHere->move (alHere, alDest);
|
||||
//TODO: choose from dialog
|
||||
@@ -1078,7 +1078,7 @@ DLL_LINKAGE void SetAvailableArtifacts::applyGs(CGameState *gs)
|
||||
}
|
||||
else
|
||||
{
|
||||
logNetwork->errorStream() << "Wrong black market id!";
|
||||
logNetwork->error("Wrong black market id!");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1162,7 +1162,7 @@ DLL_LINKAGE void SetObjectProperty::applyGs(CGameState *gs)
|
||||
CGObjectInstance *obj = gs->getObjInstance(id);
|
||||
if(!obj)
|
||||
{
|
||||
logNetwork->errorStream() << "Wrong object ID - property cannot be set!";
|
||||
logNetwork->error("Wrong object ID - property cannot be set!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1560,7 +1560,7 @@ DLL_LINKAGE void SetStackEffect::applyGs(CGameState *gs)
|
||||
{
|
||||
if(effect.empty() && cumulativeEffects.empty())
|
||||
{
|
||||
logGlobal->errorStream() << "Trying to apply SetStackEffect with no effects";
|
||||
logGlobal->error("Trying to apply SetStackEffect with no effects");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1788,7 +1788,7 @@ DLL_LINKAGE void BattleStackAdded::applyGs(CGameState *gs)
|
||||
newStackID = 0;
|
||||
if(!BattleHex(pos).isValid())
|
||||
{
|
||||
logNetwork->warnStream() << "No place found for new stack!";
|
||||
logNetwork->warn("No place found for new stack!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ ESpellCastProblem::ESpellCastProblem CBattleInfoCallback::battleCanCastSpell(con
|
||||
return ESpellCastProblem::INVALID;
|
||||
if(!battleDoWeKnowAbout(side.get()))
|
||||
{
|
||||
logGlobal->warnStream() << "You can't check if enemy can cast given spell!";
|
||||
logGlobal->warn("You can't check if enemy can cast given spell!");
|
||||
return ESpellCastProblem::INVALID;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,11 +141,11 @@ bool CFilesystemList::createResource(std::string filename, bool update)
|
||||
// b) in update mode, call with filename that does not exists
|
||||
assert(load(ResourceID(filename)));
|
||||
|
||||
logGlobal->traceStream()<< "Resource created successfully";
|
||||
logGlobal->trace("Resource created successfully");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
logGlobal->traceStream()<< "Failed to create resource";
|
||||
logGlobal->trace("Failed to create resource");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ template <class _Stream> inline int streamProxyClose(voidpf opaque, voidpf strea
|
||||
|
||||
_Stream * actualStream = static_cast<_Stream *>(stream);
|
||||
|
||||
logGlobal->traceStream() << "Proxy stream closed";
|
||||
logGlobal->trace("Proxy stream closed");
|
||||
|
||||
actualStream->seek(0);
|
||||
|
||||
@@ -229,7 +229,7 @@ uLong ZCALLBACK CProxyROIOApi::readFileProxy(voidpf opaque, voidpf stream, void
|
||||
|
||||
uLong ZCALLBACK CProxyROIOApi::writeFileProxy(voidpf opaque, voidpf stream, const void* buf, uLong size)
|
||||
{
|
||||
logGlobal->errorStream() << "Attempt to write to read-only stream";
|
||||
logGlobal->error("Attempt to write to read-only stream");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -740,7 +740,7 @@ void CGHeroInstance::Updatespecialty() //TODO: calculate special value of bonuse
|
||||
}
|
||||
else //no creature found, can't calculate value
|
||||
{
|
||||
logGlobal->warnStream() << "Primary skill specialty growth supported only with creature type limiters";
|
||||
logGlobal->warn("Primary skill specialty growth supported only with creature type limiters");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ void CGUniversity::initObj(CRandomGenerator & rand)
|
||||
}
|
||||
if(toChoose.size() < 4)
|
||||
{
|
||||
logGlobal->warnStream()<<"Warning: less then 4 available skills was found by University initializer!";
|
||||
logGlobal->warn("Warning: less then 4 available skills was found by University initializer!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1155,7 +1155,7 @@ void CGTownInstance::setVisitingHero(CGHeroInstance *h)
|
||||
//if (!(!!visitingHero == !h))
|
||||
//{
|
||||
// logGlobal->warnStream() << boost::format("Hero visiting town %s is %s ") % name % (visitingHero.get() ? visitingHero->name : "NULL");
|
||||
// logGlobal->warnStream() << boost::format("New hero will be %s ") % (h ? h->name : "NULL");
|
||||
// logGlobal->warn("New hero will be %s ", (h ? h->name : "NULL"));
|
||||
//
|
||||
//}
|
||||
assert(!!visitingHero == !h);
|
||||
|
||||
@@ -110,13 +110,13 @@ void IObjectInterface::heroLevelUpDone(const CGHeroInstance *hero) const
|
||||
|
||||
CObjectHandler::CObjectHandler()
|
||||
{
|
||||
logGlobal->traceStream() << "\t\tReading resources prices ";
|
||||
logGlobal->trace("\t\tReading resources prices ");
|
||||
const JsonNode config2(ResourceID("config/resources.json"));
|
||||
for(const JsonNode &price : config2["resources_prices"].Vector())
|
||||
{
|
||||
resVals.push_back(price.Float());
|
||||
}
|
||||
logGlobal->traceStream() << "\t\tDone loading resource prices!";
|
||||
logGlobal->trace("\t\tDone loading resource prices!");
|
||||
}
|
||||
|
||||
PlayerColor CGObjectInstance::getOwner() const
|
||||
|
||||
@@ -179,7 +179,7 @@ void CRewardableObject::onHeroVisit(const CGHeroInstance *h) const
|
||||
}
|
||||
else
|
||||
{
|
||||
logGlobal->debugStream() << "Revisiting already visited object";
|
||||
logGlobal->debug("Revisiting already visited object");
|
||||
InfoWindow iw;
|
||||
iw.player = h->tempOwner;
|
||||
iw.soundID = soundID;
|
||||
|
||||
@@ -1579,7 +1579,7 @@ void CGShrine::onHeroVisit( const CGHeroInstance * h ) const
|
||||
{
|
||||
if(spell == SpellID::NONE)
|
||||
{
|
||||
logGlobal->errorStream() << "Not initialized shrine visited!";
|
||||
logGlobal->error("Not initialized shrine visited!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1627,7 +1627,7 @@ void CGShrine::initObj(CRandomGenerator & rand)
|
||||
|
||||
if(possibilities.empty())
|
||||
{
|
||||
logGlobal->errorStream() << "Error: cannot init shrine, no allowed spells!";
|
||||
logGlobal->error("Error: cannot init shrine, no allowed spells!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2023,7 +2023,7 @@ void CCartographer::onHeroVisit( const CGHeroInstance * h ) const
|
||||
text = 27;
|
||||
break;
|
||||
default:
|
||||
logGlobal->warnStream() << "Unrecognized subtype of cartographer";
|
||||
logGlobal->warn("Unrecognized subtype of cartographer");
|
||||
}
|
||||
assert(text);
|
||||
BlockingDialog bd (true, false);
|
||||
|
||||
@@ -258,7 +258,7 @@ void ObjectTemplate::readJson(const JsonNode &node, const bool withTerrain)
|
||||
}
|
||||
|
||||
if(withTerrain && allowedTerrains.empty())
|
||||
logGlobal->warnStream() << "Loaded template without allowed terrains!";
|
||||
logGlobal->warn("Loaded template without allowed terrains!");
|
||||
|
||||
|
||||
auto charToTile = [&](const char & ch) -> ui8
|
||||
@@ -507,7 +507,7 @@ int3 ObjectTemplate::getVisitableOffset() const
|
||||
if (isVisitableAt(x, y))
|
||||
return int3(x,y,0);
|
||||
|
||||
//logGlobal->warnStream() << "Warning: getVisitableOffset called on non-visitable obj!";
|
||||
//logGlobal->warn("Warning: getVisitableOffset called on non-visitable obj!");
|
||||
return int3(0,0,0);
|
||||
}
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ CScenarioTravel CCampaignHandler::readScenarioTravelFromMemory(CBinaryReader & r
|
||||
break;
|
||||
}
|
||||
default:
|
||||
logGlobal->warnStream() << "Corrupted h3c file";
|
||||
logGlobal->warn("Corrupted h3c file");
|
||||
break;
|
||||
}
|
||||
ret.bonusesToChoose.push_back(bonus);
|
||||
@@ -304,7 +304,7 @@ CScenarioTravel CCampaignHandler::readScenarioTravelFromMemory(CBinaryReader & r
|
||||
}
|
||||
default:
|
||||
{
|
||||
logGlobal->warnStream() << "Corrupted h3c file";
|
||||
logGlobal->warn("Corrupted h3c file");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ const CGObjectInstance * CMap::getObjectiveObjectFrom(int3 pos, Obj::EObj type)
|
||||
// Try to workaround that and find closest object that we can use
|
||||
|
||||
logGlobal->errorStream() << "Failed to find object of type " << int(type) << " at " << pos;
|
||||
logGlobal->errorStream() << "Will try to find closest matching object";
|
||||
logGlobal->error("Will try to find closest matching object");
|
||||
|
||||
CGObjectInstance * bestMatch = nullptr;
|
||||
for (CGObjectInstance * object : objects)
|
||||
|
||||
@@ -648,7 +648,7 @@ void CDrawTerrainOperation::updateTerrainTypes()
|
||||
{
|
||||
//if(!suitableTiles.empty())
|
||||
//{
|
||||
// logGlobal->debugStream() << "Clear suitables tiles.";
|
||||
// logGlobal->debug("Clear suitables tiles.");
|
||||
//}
|
||||
|
||||
invalidNativeTilesCnt = nativeTilesCntNorm;
|
||||
@@ -730,7 +730,7 @@ void CDrawTerrainOperation::updateTerrainViews()
|
||||
if(bestPattern == -1)
|
||||
{
|
||||
// This shouldn't be the case
|
||||
logGlobal->warnStream() << boost::format("No pattern detected at pos '%s'.") % pos;
|
||||
logGlobal->warn("No pattern detected at pos '%s'.", pos);
|
||||
CTerrainViewPatternUtils::printDebuggingInfoAboutTile(map, pos);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -876,13 +876,13 @@ bool CMapLoaderH3M::loadArtifactToSlot(CGHeroInstance * hero, int slot)
|
||||
|
||||
if(nullptr == art)
|
||||
{
|
||||
logGlobal->warnStream() << "Invalid artifact in hero's backpack, ignoring...";
|
||||
logGlobal->warn("Invalid artifact in hero's backpack, ignoring...");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(art->isBig() && slot >= GameConstants::BACKPACK_START)
|
||||
{
|
||||
logGlobal->warnStream() << "A big artifact (war machine) in hero's backpack, ignoring...";
|
||||
logGlobal->warn("A big artifact (war machine) in hero's backpack, ignoring...");
|
||||
return false;
|
||||
}
|
||||
if(aid == 0 && slot == ArtifactPosition::MISC5)
|
||||
@@ -902,7 +902,7 @@ bool CMapLoaderH3M::loadArtifactToSlot(CGHeroInstance * hero, int slot)
|
||||
}
|
||||
else
|
||||
{
|
||||
logGlobal->debugStream() << "Artifact can't be put at the specified location."; //TODO add more debugging information
|
||||
logGlobal->debug("Artifact can't be put at the specified location."); //TODO add more debugging information
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -524,7 +524,7 @@ void CMapFormatJson::readTeams(JsonDeserializer & handler)
|
||||
{
|
||||
// No alliances
|
||||
if(src.getType() != JsonNode::DATA_NULL)
|
||||
logGlobal->errorStream() << "Invalid teams field type";
|
||||
logGlobal->error("Invalid teams field type");
|
||||
|
||||
mapHeader->howManyTeams = 0;
|
||||
for(int i = 0; i < PlayerColor::PLAYER_LIMIT_I; i++)
|
||||
@@ -1061,7 +1061,7 @@ void CMapLoaderJson::MapObjectLoader::construct()
|
||||
std::string typeName = configuration["type"].String(), subtypeName = configuration["subtype"].String();
|
||||
if(typeName.empty())
|
||||
{
|
||||
logGlobal->errorStream() << "Object type missing";
|
||||
logGlobal->error("Object type missing");
|
||||
logGlobal->debugStream() << configuration;
|
||||
return;
|
||||
}
|
||||
@@ -1081,7 +1081,7 @@ void CMapLoaderJson::MapObjectLoader::construct()
|
||||
}
|
||||
else if(subtypeName.empty())
|
||||
{
|
||||
logGlobal->errorStream() << "Object subtype missing";
|
||||
logGlobal->error("Object subtype missing");
|
||||
logGlobal->debugStream() << configuration;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ void CMapGenOptions::finalize(CRandomGenerator & rand)
|
||||
//setHeight(20);
|
||||
//setWidth(50);
|
||||
|
||||
logGlobal->traceStream() << "Player config:";
|
||||
logGlobal->trace("Player config:");
|
||||
int humanPlayers = 0, cpuOnlyPlayers = 0, AIplayers = 0;
|
||||
for (auto player : players)
|
||||
{
|
||||
@@ -378,7 +378,7 @@ PlayerColor CMapGenOptions::getNextPlayerColor() const
|
||||
return i;
|
||||
}
|
||||
}
|
||||
logGlobal->errorStream() << "Failed to get next player color";
|
||||
logGlobal->error("Failed to get next player color");
|
||||
assert(false);
|
||||
return PlayerColor(0);
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ void CMapGenerator::addPlayerInfo()
|
||||
|
||||
if (teamNumbers[j].empty())
|
||||
{
|
||||
logGlobal->errorStream() << boost::format("Not enough places in team for %s player") % ((j == CPUONLY) ? "CPU" : "CPU or human");
|
||||
logGlobal->error("Not enough places in team for %s player", ((j == CPUONLY) ? "CPU" : "CPU or human"));
|
||||
assert (teamNumbers[j].size());
|
||||
}
|
||||
auto itTeam = RandomGeneratorUtil::nextItem(teamNumbers[j], rand);
|
||||
@@ -279,7 +279,7 @@ void CMapGenerator::genZones()
|
||||
placer.placeZones(mapGenOptions, &rand);
|
||||
placer.assignZones(mapGenOptions);
|
||||
|
||||
logGlobal->infoStream() << "Zones generated successfully";
|
||||
logGlobal->info("Zones generated successfully");
|
||||
}
|
||||
|
||||
void CMapGenerator::fillZones()
|
||||
@@ -290,7 +290,7 @@ void CMapGenerator::fillZones()
|
||||
|
||||
findZonesForQuestArts();
|
||||
|
||||
logGlobal->infoStream() << "Started filling zones";
|
||||
logGlobal->info("Started filling zones");
|
||||
|
||||
//we need info about all town types to evaluate dwellings and pandoras with creatures properly
|
||||
//place main town in the middle
|
||||
@@ -378,7 +378,7 @@ void CMapGenerator::fillZones()
|
||||
|
||||
map->grailPos = *RandomGeneratorUtil::nextItem(*grailZone->getFreePaths(), rand);
|
||||
|
||||
logGlobal->infoStream() << "Zones filled successfully";
|
||||
logGlobal->info("Zones filled successfully");
|
||||
}
|
||||
|
||||
void CMapGenerator::createObstaclesCommon1()
|
||||
|
||||
@@ -637,7 +637,7 @@ void CRmgTemplateZone::connectLater(CMapGenerator* gen)
|
||||
for (const int3 node : tilesToConnectLater)
|
||||
{
|
||||
if (!connectWithCenter(gen, node, true))
|
||||
logGlobal->errorStream() << boost::format("Failed to connect node %s with center of the zone") % node;
|
||||
logGlobal->error("Failed to connect node %s with center of the zone", node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -788,7 +788,7 @@ bool CRmgTemplateZone::createRoad(CMapGenerator* gen, const int3& src, const int
|
||||
// add node to path
|
||||
roads.insert (backTracking);
|
||||
gen->setRoad (backTracking, ERoadType::COBBLESTONE_ROAD);
|
||||
//logGlobal->traceStream() << boost::format("Setting road at tile %s") % backTracking;
|
||||
//logGlobal->trace("Setting road at tile %s", backTracking);
|
||||
// do the same for the predecessor
|
||||
backTracking = cameFrom[backTracking];
|
||||
}
|
||||
@@ -1386,7 +1386,7 @@ void CRmgTemplateZone::initTownType (CMapGenerator* gen)
|
||||
if ((type == ETemplateZoneType::CPU_START) || (type == ETemplateZoneType::PLAYER_START))
|
||||
{
|
||||
//set zone types to player faction, generate main town
|
||||
logGlobal->infoStream() << "Preparing playing zone";
|
||||
logGlobal->info("Preparing playing zone");
|
||||
int player_id = *owner - 1;
|
||||
auto & playerInfo = gen->map->players[player_id];
|
||||
PlayerColor player(player_id);
|
||||
@@ -1577,12 +1577,12 @@ EObjectPlacingResult::EObjectPlacingResult CRmgTemplateZone::tryToPlaceObjectAnd
|
||||
int3 accessibleOffset = getAccessibleOffset(gen, obj->appearance, pos);
|
||||
if (!accessibleOffset.valid())
|
||||
{
|
||||
logGlobal->warnStream() << boost::format("Cannot access required object at position %s, retrying") % pos;
|
||||
logGlobal->warn("Cannot access required object at position %s, retrying", pos);
|
||||
return EObjectPlacingResult::CANNOT_FIT;
|
||||
}
|
||||
if (!connectPath(gen, accessibleOffset, true))
|
||||
{
|
||||
logGlobal->traceStream() << boost::format("Failed to create path to required object at position %s, retrying") % pos;
|
||||
logGlobal->trace("Failed to create path to required object at position %s, retrying", pos);
|
||||
return EObjectPlacingResult::SEALED_OFF;
|
||||
}
|
||||
else
|
||||
@@ -1591,7 +1591,7 @@ EObjectPlacingResult::EObjectPlacingResult CRmgTemplateZone::tryToPlaceObjectAnd
|
||||
|
||||
bool CRmgTemplateZone::createRequiredObjects(CMapGenerator* gen)
|
||||
{
|
||||
logGlobal->traceStream() << "Creating required objects";
|
||||
logGlobal->trace("Creating required objects");
|
||||
|
||||
for(const auto &object : requiredObjects)
|
||||
{
|
||||
@@ -1601,7 +1601,7 @@ bool CRmgTemplateZone::createRequiredObjects(CMapGenerator* gen)
|
||||
{
|
||||
if (!findPlaceForObject(gen, obj, 3, pos))
|
||||
{
|
||||
logGlobal->errorStream() << boost::format("Failed to fill zone %d due to lack of space") % id;
|
||||
logGlobal->error("Failed to fill zone %d due to lack of space", id);
|
||||
return false;
|
||||
}
|
||||
if (tryToPlaceObjectAndConnectToPath(gen, obj, pos) == EObjectPlacingResult::SUCCESS)
|
||||
@@ -1646,7 +1646,7 @@ bool CRmgTemplateZone::createRequiredObjects(CMapGenerator* gen)
|
||||
|
||||
if (tiles.empty())
|
||||
{
|
||||
logGlobal->errorStream() << boost::format("Failed to fill zone %d due to lack of space") % id;
|
||||
logGlobal->error("Failed to fill zone %d due to lack of space", id);
|
||||
return false;
|
||||
}
|
||||
for (auto tile : tiles)
|
||||
@@ -2195,11 +2195,11 @@ bool CRmgTemplateZone::guardObject(CMapGenerator* gen, CGObjectInstance* object,
|
||||
{
|
||||
//guardTile = tiles.front();
|
||||
guardTile = getAccessibleOffset(gen, object->appearance, object->pos);
|
||||
logGlobal->traceStream() << boost::format("Guard object at %s") % object->pos();
|
||||
logGlobal->trace("Guard object at %s", object->pos());
|
||||
}
|
||||
else
|
||||
{
|
||||
logGlobal->errorStream() << boost::format("Failed to guard object at %s") % object->pos();
|
||||
logGlobal->error("Failed to guard object at %s", object->pos());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ float CZonePlacer::getDistance (float distance) const
|
||||
|
||||
void CZonePlacer::placeZones(const CMapGenOptions * mapGenOptions, CRandomGenerator * rand)
|
||||
{
|
||||
logGlobal->infoStream() << "Starting zone placement";
|
||||
logGlobal->info("Starting zone placement");
|
||||
|
||||
width = mapGenOptions->getWidth();
|
||||
height = mapGenOptions->getHeight();
|
||||
@@ -184,7 +184,7 @@ void CZonePlacer::prepareZones(TZoneMap &zones, TZoneVector &zonesVector, const
|
||||
if (vstd::contains(playerSettings, player))
|
||||
faction = playerSettings[player].getStartingTown();
|
||||
else
|
||||
logGlobal->errorStream() << boost::format("Can't find info for player %d (starting zone)") % player.getNum();
|
||||
logGlobal->error("Can't find info for player %d (starting zone)", player.getNum());
|
||||
|
||||
if (faction == CMapGenOptions::CPlayerSettings::RANDOM_TOWN) //TODO: check this after a town has already been randomized
|
||||
zonesToPlace.push_back(zone);
|
||||
@@ -375,7 +375,7 @@ void CZonePlacer::moveOneZone(TZoneMap &zones, TForceVector &totalForces, TDista
|
||||
misplacedZone = zone.first;
|
||||
}
|
||||
}
|
||||
logGlobal->traceStream() << boost::format("Worst misplacement/movement ratio: %3.2f") % maxRatio;
|
||||
logGlobal->trace("Worst misplacement/movement ratio: %3.2f", maxRatio);
|
||||
|
||||
if (maxRatio > maxDistanceMovementRatio && misplacedZone)
|
||||
{
|
||||
@@ -402,10 +402,10 @@ void CZonePlacer::moveOneZone(TZoneMap &zones, TForceVector &totalForces, TDista
|
||||
float newDistanceBetweenZones = (std::max(misplacedZone->getSize(), targetZone->getSize())) / mapSize;
|
||||
logGlobal->traceStream() << boost::format("Trying to move zone %d %s towards %d %s. Old distance %f") %
|
||||
misplacedZone->getId() % ourCenter() % targetZone->getId() % targetZone->getCenter()() % maxDistance;
|
||||
logGlobal->traceStream() << boost::format("direction is %s") % vec();
|
||||
logGlobal->trace("direction is %s", vec());
|
||||
|
||||
misplacedZone->setCenter(targetZone->getCenter() - vec.unitVector() * newDistanceBetweenZones); //zones should now overlap by half size
|
||||
logGlobal->traceStream() << boost::format("New distance %f") % targetZone->getCenter().dist2d(misplacedZone->getCenter());
|
||||
logGlobal->trace("New distance %f", targetZone->getCenter().dist2d(misplacedZone->getCenter()));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -431,10 +431,10 @@ void CZonePlacer::moveOneZone(TZoneMap &zones, TForceVector &totalForces, TDista
|
||||
float newDistanceBetweenZones = (misplacedZone->getSize() + targetZone->getSize()) / mapSize;
|
||||
logGlobal->traceStream() << boost::format("Trying to move zone %d %s away from %d %s. Old distance %f") %
|
||||
misplacedZone->getId() % ourCenter() % targetZone->getId() % targetZone->getCenter()() % maxOverlap;
|
||||
logGlobal->traceStream() << boost::format("direction is %s") % vec();
|
||||
logGlobal->trace("direction is %s", vec());
|
||||
|
||||
misplacedZone->setCenter(targetZone->getCenter() + vec.unitVector() * newDistanceBetweenZones); //zones should now be just separated
|
||||
logGlobal->traceStream() << boost::format("New distance %f") % targetZone->getCenter().dist2d(misplacedZone->getCenter());
|
||||
logGlobal->trace("New distance %f", targetZone->getCenter().dist2d(misplacedZone->getCenter()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -462,7 +462,7 @@ d = 0.01 * dx^3 - 0.1618 * dx^2 + 1 * dx + ...
|
||||
|
||||
void CZonePlacer::assignZones(const CMapGenOptions * mapGenOptions)
|
||||
{
|
||||
logGlobal->infoStream() << "Starting zone colouring";
|
||||
logGlobal->info("Starting zone colouring");
|
||||
|
||||
auto width = mapGenOptions->getWidth();
|
||||
auto height = mapGenOptions->getHeight();
|
||||
@@ -571,5 +571,5 @@ void CZonePlacer::assignZones(const CMapGenOptions * mapGenOptions)
|
||||
zone.second->paintZoneTerrain (gen, ETerrainType::SUBTERRANEAN);
|
||||
}
|
||||
}
|
||||
logGlobal->infoStream() << "Finished zone colouring";
|
||||
logGlobal->info("Finished zone colouring");
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ void CLoadFile::openNextFile(const boost::filesystem::path & fname, int minimalV
|
||||
|
||||
void CLoadFile::reportState(CLogger * out)
|
||||
{
|
||||
out->debugStream() << "CLoadFile";
|
||||
out->debug("CLoadFile");
|
||||
if(!!sfile && *sfile)
|
||||
{
|
||||
out->debugStream() << "\tOpened " << fName << "\n\tPosition: " << sfile->tellg();
|
||||
|
||||
@@ -55,7 +55,7 @@ void CSaveFile::openNextFile(const boost::filesystem::path &fname)
|
||||
|
||||
void CSaveFile::reportState(CLogger * out)
|
||||
{
|
||||
out->debugStream() << "CSaveFile";
|
||||
out->debug("CSaveFile");
|
||||
if(sfile.get() && *sfile)
|
||||
{
|
||||
out->debugStream() << "\tOpened " << fName << "\n\tPosition: " << sfile->tellp();
|
||||
|
||||
@@ -75,10 +75,10 @@ CConnection::CConnection(std::string host, ui16 port, std::string Name)
|
||||
}
|
||||
pom = endpoint_iterator;
|
||||
if(pom != end)
|
||||
logNetwork->infoStream()<<"Found endpoints:";
|
||||
logNetwork->info("Found endpoints:");
|
||||
else
|
||||
{
|
||||
logNetwork->errorStream() << "Critical problem: No endpoints found!";
|
||||
logNetwork->error("Critical problem: No endpoints found!");
|
||||
goto connerror1;
|
||||
}
|
||||
i=0;
|
||||
@@ -106,11 +106,11 @@ CConnection::CConnection(std::string host, ui16 port, std::string Name)
|
||||
|
||||
//we shouldn't be here - error handling
|
||||
connerror1:
|
||||
logNetwork->errorStream() << "Something went wrong... checking for error info";
|
||||
logNetwork->error("Something went wrong... checking for error info");
|
||||
if(error)
|
||||
logNetwork->errorStream() << error;
|
||||
else
|
||||
logNetwork->errorStream() << "No error info. ";
|
||||
logNetwork->error("No error info. ");
|
||||
delete io_service;
|
||||
//delete socket;
|
||||
throw std::runtime_error("Can't establish connection :(");
|
||||
@@ -206,10 +206,10 @@ bool CConnection::isHost() const
|
||||
|
||||
void CConnection::reportState(CLogger * out)
|
||||
{
|
||||
out->debugStream() << "CConnection";
|
||||
out->debug("CConnection");
|
||||
if(socket && socket->is_open())
|
||||
{
|
||||
out->debugStream() << "\tWe have an open and valid socket";
|
||||
out->debug("\tWe have an open and valid socket");
|
||||
out->debugStream() << "\t" << socket->available() <<" bytes awaiting";
|
||||
}
|
||||
}
|
||||
@@ -218,7 +218,7 @@ CPack * CConnection::retreivePack()
|
||||
{
|
||||
CPack *ret = nullptr;
|
||||
boost::unique_lock<boost::mutex> lock(*rmx);
|
||||
logNetwork->traceStream() << "Listening... ";
|
||||
logNetwork->trace("Listening... ");
|
||||
iser & ret;
|
||||
logNetwork->traceStream() << "\treceived server message of type " << (ret? typeid(*ret).name() : "nullptr") << ", data: " << ret;
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user