mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Logging cleanup 3
This commit is contained in:
parent
61e241308d
commit
85e952f25f
@ -2348,7 +2348,7 @@ Goals::TSubgoal VCAI::striveToGoalInternal(Goals::TSubgoal ultimateGoal, bool on
|
||||
}
|
||||
catch(std::exception &e)
|
||||
{
|
||||
logAi->debugStream() << boost::format("Goal %s decomposition failed: %s") % goal->name() % e.what();
|
||||
logAi->debug("Goal %s decomposition failed: %s", goal->name(), e.what());
|
||||
return sptr(Goals::Invalid());
|
||||
}
|
||||
}
|
||||
@ -2380,7 +2380,7 @@ Goals::TSubgoal VCAI::striveToGoalInternal(Goals::TSubgoal ultimateGoal, bool on
|
||||
}
|
||||
else
|
||||
{
|
||||
logAi->debugStream() << boost::format("Trying to realize %s (value %2.3f)") % goal->name() % goal->priority;
|
||||
logAi->debug("Trying to realize %s (value %2.3f)", goal->name(), goal->priority);
|
||||
goal->accept(this);
|
||||
}
|
||||
|
||||
@ -2401,7 +2401,7 @@ Goals::TSubgoal VCAI::striveToGoalInternal(Goals::TSubgoal ultimateGoal, bool on
|
||||
}
|
||||
catch(std::exception &e)
|
||||
{
|
||||
logAi->debugStream() << boost::format("Failed to realize subgoal of type %s (greater goal type was %s), I will stop.") % goal->name() % ultimateGoal->name();
|
||||
logAi->debug("Failed to realize subgoal of type %s (greater goal type was %s), I will stop.", goal->name(), ultimateGoal->name());
|
||||
logAi->debug("The error message was: %s", e.what());
|
||||
break;
|
||||
}
|
||||
@ -2553,7 +2553,7 @@ void VCAI::performTypicalActions()
|
||||
if(!h) //hero might be lost. getUnblockedHeroes() called once on start of turn
|
||||
continue;
|
||||
|
||||
logAi->debugStream() << boost::format("Looking into %s, MP=%d") % h->name.c_str() % h->movement;
|
||||
logAi->debug("Looking into %s, MP=%d", h->name.c_str(), h->movement);
|
||||
makePossibleUpgrades(*h);
|
||||
pickBestArtifacts(*h);
|
||||
try
|
||||
@ -2771,7 +2771,7 @@ void VCAI::checkHeroArmy (HeroPtr h)
|
||||
|
||||
void VCAI::recruitHero(const CGTownInstance * t, bool throwing)
|
||||
{
|
||||
logAi->debugStream() << boost::format("Trying to recruit a hero in %s at %s") % t->name % t->visitablePos();
|
||||
logAi->debug("Trying to recruit a hero in %s at %s", t->name, t->visitablePos());
|
||||
|
||||
auto heroes = cb->getAvailableHeroes(t);
|
||||
if(heroes.size())
|
||||
@ -2824,7 +2824,7 @@ void VCAI::lostHero(HeroPtr h)
|
||||
|
||||
void VCAI::answerQuery(QueryID queryID, int selection)
|
||||
{
|
||||
logAi->debugStream() << boost::format("I'll answer the query %d giving the choice %d") % queryID % selection;
|
||||
logAi->debug("I'll answer the query %d giving the choice %d", queryID, selection);
|
||||
if(queryID != QueryID(-1))
|
||||
{
|
||||
cb->selectionMade(selection, queryID);
|
||||
|
@ -906,7 +906,7 @@ void processCommand(const std::string &message)
|
||||
if(elem.second.human)
|
||||
{
|
||||
auto AiToGive = client->aiNameForPlayer(*client->getPlayerSettings(elem.first), false);
|
||||
logNetwork->infoStream() << boost::format("Player %s will be lead by %s") % elem.first % AiToGive;
|
||||
logNetwork->info("Player %s will be lead by %s", elem.first, AiToGive);
|
||||
client->installNewPlayerInterface(CDynLibHandler::getNewAI(AiToGive), elem.first);
|
||||
}
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ std::shared_ptr<CAnimation> Graphics::getAnimation(const ObjectTemplate & info)
|
||||
|
||||
if(info.animationFile.empty())
|
||||
{
|
||||
logGlobal->warnStream() << boost::format("Def name for obj (%d,%d) is empty!") % info.id % info.subid;
|
||||
logGlobal->warn("Def name for obj (%d,%d) is empty!", info.id, info.subid);
|
||||
return std::shared_ptr<CAnimation>();
|
||||
}
|
||||
|
||||
|
@ -217,8 +217,7 @@ std::string CComponent::getSubtitleInternal()
|
||||
auto building = CGI->townh->factions[subtype]->town->buildings[BuildingID(val)];
|
||||
if(!building)
|
||||
{
|
||||
logGlobal->errorStream() << boost::format("Town of faction %s has no building #%d")
|
||||
% CGI->townh->factions[subtype]->town->faction->name % val;
|
||||
logGlobal->error("Town of faction %s has no building #%d", CGI->townh->factions[subtype]->town->faction->name, val);
|
||||
return (boost::format("Missing building #%d") % val).str();
|
||||
}
|
||||
return building->Name();
|
||||
|
@ -1154,7 +1154,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->warn("Hero visiting town %s is %s ", name, (visitingHero.get() ? visitingHero->name : "NULL"));
|
||||
// logGlobal->warn("New hero will be %s ", (h ? h->name : "NULL"));
|
||||
//
|
||||
//}
|
||||
|
@ -1049,7 +1049,7 @@ void CGKeys::setPropertyDer (ui8 what, ui32 val) //101-108 - enable key for play
|
||||
playerKeyMap[player].insert((ui8)val);
|
||||
}
|
||||
else
|
||||
logGlobal->errorStream() << boost::format("Unexpected properties requested to set: what=%d, val=%d") % (int)what % val;
|
||||
logGlobal->error("Unexpected properties requested to set: what=%d, val=%d", (int)what, val);
|
||||
}
|
||||
|
||||
bool CGKeys::wasMyColorVisited (PlayerColor player) const
|
||||
|
@ -575,14 +575,14 @@ void CDrawTerrainOperation::updateTerrainTypes()
|
||||
{
|
||||
const auto & centerPos = *(positions.begin());
|
||||
auto centerTile = map->getTile(centerPos);
|
||||
//logGlobal->debugStream() << boost::format("Set terrain tile at pos '%s' to type '%s'") % centerPos % centerTile.terType;
|
||||
//logGlobal->debug("Set terrain tile at pos '%s' to type '%s'", centerPos, centerTile.terType);
|
||||
auto tiles = getInvalidTiles(centerPos);
|
||||
auto updateTerrainType = [&](const int3 & pos)
|
||||
{
|
||||
map->getTile(pos).terType = centerTile.terType;
|
||||
positions.insert(pos);
|
||||
invalidateTerrainViews(pos);
|
||||
//logGlobal->debugStream() << boost::format("Set additional terrain tile at pos '%s' to type '%s'") % pos % centerTile.terType;
|
||||
//logGlobal->debug("Set additional terrain tile at pos '%s' to type '%s'", pos, centerTile.terType);
|
||||
};
|
||||
|
||||
// Fill foreign invalid tiles
|
||||
|
@ -810,7 +810,7 @@ void CMapLoaderH3M::loadArtifactsOfHero(CGHeroInstance * hero)
|
||||
{
|
||||
if(hero->artifactsWorn.size() || hero->artifactsInBackpack.size())
|
||||
{
|
||||
logGlobal->warnStream() << boost::format("Hero %s at %s has set artifacts twice (in map properties and on adventure map instance). Using the latter set...") % hero->name % hero->pos;
|
||||
logGlobal->warn("Hero %s at %s has set artifacts twice (in map properties and on adventure map instance). Using the latter set...", hero->name, hero->pos);
|
||||
hero->artifactsInBackpack.clear();
|
||||
while(hero->artifactsWorn.size())
|
||||
hero->eraseArtSlot(hero->artifactsWorn.begin()->first);
|
||||
@ -1622,7 +1622,7 @@ CGObjectInstance * CMapLoaderH3M::readHero(ObjectInstanceID idToBeGiven, const i
|
||||
if(nhi->secSkills.size())
|
||||
{
|
||||
nhi->secSkills.clear();
|
||||
//logGlobal->warnStream() << boost::format("Hero %s subID=%d has set secondary skills twice (in map properties and on adventure map instance). Using the latter set...") % nhi->name % nhi->subID;
|
||||
//logGlobal->warn("Hero %s subID=%d has set secondary skills twice (in map properties and on adventure map instance). Using the latter set...", nhi->name, nhi->subID);
|
||||
}
|
||||
|
||||
int howMany = reader.readUInt32();
|
||||
@ -1680,7 +1680,7 @@ CGObjectInstance * CMapLoaderH3M::readHero(ObjectInstanceID idToBeGiven, const i
|
||||
if(nhi->spells.size())
|
||||
{
|
||||
nhi->clear();
|
||||
logGlobal->warnStream() << boost::format("Hero %s subID=%d has spells set twice (in map properties and on adventure map instance). Using the latter set...") % nhi->name % nhi->subID;
|
||||
logGlobal->warn("Hero %s subID=%d has spells set twice (in map properties and on adventure map instance). Using the latter set...", nhi->name, nhi->subID);
|
||||
}
|
||||
|
||||
if(hasCustomSpells)
|
||||
@ -1713,7 +1713,7 @@ CGObjectInstance * CMapLoaderH3M::readHero(ObjectInstanceID idToBeGiven, const i
|
||||
.And(Selector::sourceType(Bonus::HERO_BASE_SKILL)), nullptr);
|
||||
if(ps->size())
|
||||
{
|
||||
logGlobal->warnStream() << boost::format("Hero %s subID=%d has set primary skills twice (in map properties and on adventure map instance). Using the latter set...") % nhi->name % nhi->subID;
|
||||
logGlobal->warn("Hero %s subID=%d has set primary skills twice (in map properties and on adventure map instance). Using the latter set...", nhi->name, nhi->subID);
|
||||
for(auto b : *ps)
|
||||
nhi->removeBonus(b);
|
||||
}
|
||||
|
@ -292,10 +292,10 @@ void CMapGenOptions::finalize(CRandomGenerator & rand)
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
logGlobal->traceStream() << boost::format("Player %d: %s") % player.second.getColor() % playerType;
|
||||
logGlobal->trace("Player %d: %s", player.second.getColor(), playerType);
|
||||
}
|
||||
setCompOnlyPlayerCount(cpuOnlyPlayers); //human players are set automaticlaly (?)
|
||||
logGlobal->infoStream() << boost::format("Final player config: %d total, %d cpu-only") % players.size() % (int)getCompOnlyPlayerCount();
|
||||
logGlobal->info("Final player config: %d total, %d cpu-only", players.size(), (int)getCompOnlyPlayerCount());
|
||||
}
|
||||
|
||||
void CMapGenOptions::updatePlayers()
|
||||
@ -340,7 +340,7 @@ void CMapGenOptions::updateCompOnlyPlayers()
|
||||
|
||||
if (compOnlyPlayersToAdd < 0)
|
||||
{
|
||||
logGlobal->errorStream() << boost::format("Incorrect number of players to add. Requested players %d, current players %d") % playerCount % players.size();
|
||||
logGlobal->error("Incorrect number of players to add. Requested players %d, current players %d", playerCount, players.size());
|
||||
assert (compOnlyPlayersToAdd < 0);
|
||||
}
|
||||
for(int i = 0; i < compOnlyPlayersToAdd; ++i)
|
||||
|
@ -461,7 +461,7 @@ void CMapGenerator::createObstaclesCommon2()
|
||||
}
|
||||
}
|
||||
}
|
||||
logGlobal->traceStream() << boost::format("Set %d tiles to BLOCKED and %d tiles to FREE") % blockedTiles % freeTiles;
|
||||
logGlobal->trace("Set %d tiles to BLOCKED and %d tiles to FREE", blockedTiles, freeTiles);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ void CRmgTemplateStorage::loadObject(std::string scope, std::string name, const
|
||||
}
|
||||
catch(const std::exception & e)
|
||||
{
|
||||
logGlobal->errorStream() << boost::format("Template %s has errors. Message: %s.") % tpl->getName() % std::string(e.what());
|
||||
logGlobal->error("Template %s has errors. Message: %s.", tpl->getName(), std::string(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -839,7 +839,7 @@ bool CRmgTemplateZone::createRoad(CMapGenerator* gen, const int3& src, const int
|
||||
}
|
||||
|
||||
}
|
||||
logGlobal->warnStream() << boost::format("Failed to create road from %s to %s") % src %dst;
|
||||
logGlobal->warn("Failed to create road from %s to %s", src, dst);
|
||||
return false;
|
||||
|
||||
}
|
||||
@ -1927,7 +1927,7 @@ bool CRmgTemplateZone::findPlaceForTreasurePile(CMapGenerator* gen, float min_di
|
||||
|
||||
bool needsGuard = value > minGuardedValue;
|
||||
|
||||
//logGlobal->infoStream() << boost::format("Min dist for density %f is %d") % density % min_dist;
|
||||
//logGlobal->info("Min dist for density %f is %d", density, min_dist);
|
||||
for(auto tile : possibleTiles)
|
||||
{
|
||||
auto dist = gen->getNearestObjectDistance(tile);
|
||||
@ -2099,7 +2099,7 @@ void CRmgTemplateZone::checkAndPlaceObject(CMapGenerator* gen, CGObjectInstance*
|
||||
|
||||
void CRmgTemplateZone::placeObject(CMapGenerator* gen, CGObjectInstance* object, const int3 &pos, bool updateDistance)
|
||||
{
|
||||
//logGlobal->traceStream() << boost::format("Inserting object at %d %d") % pos.x % pos.y;
|
||||
//logGlobal->trace("Inserting object at %d %d", pos.x, pos.y);
|
||||
|
||||
checkAndPlaceObject (gen, object, pos);
|
||||
|
||||
|
@ -147,7 +147,7 @@ void CZonePlacer::placeZones(const CMapGenOptions * mapGenOptions, CRandomGenera
|
||||
}
|
||||
}
|
||||
|
||||
logGlobal->traceStream() << boost::format("Best fitness reached: total distance %2.4f, total overlap %2.4f") % bestTotalDistance % bestTotalOverlap;
|
||||
logGlobal->trace("Best fitness reached: total distance %2.4f, total overlap %2.4f", bestTotalDistance, bestTotalOverlap);
|
||||
for (auto zone : zones) //finalize zone positions
|
||||
{
|
||||
zone.second->setPos (cords (bestSolution[zone.second]));
|
||||
|
Loading…
Reference in New Issue
Block a user