1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
This commit is contained in:
AlexVinS 2017-08-12 14:36:04 +03:00
parent 15138c23de
commit 8c0fab1dcf
19 changed files with 37 additions and 33 deletions

View File

@ -110,7 +110,7 @@ struct HeroObjectRetriever : boost::static_visitor<const CGHeroInstance *>
CPlayerInterface::CPlayerInterface(PlayerColor Player)
{
logGlobal->trace("\tHuman player interface for player %s being constructed", Player.getStr(false));
logGlobal->trace("\tHuman player interface for player %s being constructed", Player.getStr());
destinationTeleport = ObjectInstanceID();
destinationTeleportPos = int3(-1);
howManyPeople++;
@ -136,7 +136,7 @@ CPlayerInterface::CPlayerInterface(PlayerColor Player)
CPlayerInterface::~CPlayerInterface()
{
logGlobal->trace("\tHuman player interface for player %s being destructed", playerID.getStr(false));
logGlobal->trace("\tHuman player interface for player %s being destructed", playerID.getStr());
//howManyPeople--;
delete showingDialog;
delete cingconsole;

View File

@ -457,7 +457,7 @@ void CClient::newGame( CConnection *con, StartInfo *si )
if(!vstd::contains(myPlayers, color))
continue;
logNetwork->trace("Preparing interface for player %s", color.getStr(false));
logNetwork->trace("Preparing interface for player %s", color.getStr());
if(elem.second.playerID == PlayerSettings::PLAYER_AI)
{
auto AiToGive = aiNameForPlayer(elem.second, false);

View File

@ -291,7 +291,7 @@ void Graphics::blueToPlayersAdv(SDL_Surface * sur, PlayerColor player)
}
else
{
logGlobal->error("Wrong player id in blueToPlayersAdv (%s)!", player.getStr(false));
logGlobal->error("Wrong player id in blueToPlayersAdv (%s)!", player.getStr());
return;
}
SDL_SetColors(sur, palette, 224, 32);

View File

@ -819,7 +819,7 @@ void SaveGame::applyCl(CClient *cl)
void PlayerMessage::applyCl(CClient *cl)
{
logNetwork->debug("Player %s sends a message: %s", player.getStr(false), text);
logNetwork->debug("Player %s sends a message: %s", player.getStr(), text);
std::ostringstream str;
if(player.isSpectator())

View File

@ -109,11 +109,11 @@ LONG WINAPI onUnhandledException(EXCEPTION_POINTERS* exception)
logGlobal->error("Disaster happened.");
PEXCEPTION_RECORD einfo = exception->ExceptionRecord;
logGlobal->error("Reason: 0x%x - %s at %04x:%x", einfo->ExceptionCode, exceptionName(einfo->ExceptionCode), exception->ContextRecord->SegCs, (void*)einfo->ExceptionAddress);
logGlobal->error("Reason: 0x%x - %s at %04x:%x", einfo->ExceptionCode, exceptionName(einfo->ExceptionCode), exception->ContextRecord->SegCs, (void*)einfo->ExceptionAddress);
if (einfo->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
{
logGlobal->error("Attempt to %s 0x%8x", (einfo->ExceptionInformation[0] == 1 ? "write to " : "read from "), (void*)einfo->ExceptionInformation[1]);
logGlobal->error("Attempt to %s 0x%8x", (einfo->ExceptionInformation[0] == 1 ? "write to" : "read from"), (void*)einfo->ExceptionInformation[1]);
}
const DWORD threadId = ::GetCurrentThreadId();
logGlobal->error("Thread ID: %d", threadId);

View File

@ -937,7 +937,7 @@ void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, CLegacyConfigPars
case 'U':
b.type = Bonus::UNDEAD; break;
default:
logGlobal->trace("Not parsed bonus %s %s", buf , mod);
logGlobal->trace("Not parsed bonus %s %s", buf, mod);
return;
break;
}
@ -1047,7 +1047,7 @@ void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, CLegacyConfigPars
b.type = Bonus::MIND_IMMUNITY;
break;
default:
logGlobal->trace("Not parsed bonus %s %s", buf , mod);
logGlobal->trace("Not parsed bonus %s %s", buf, mod);
return;
}
break;
@ -1088,7 +1088,7 @@ void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, CLegacyConfigPars
b.valType = Bonus::INDEPENDENT_MAX;
break;
default:
logGlobal->trace("Not parsed bonus %s %s", buf , mod);
logGlobal->trace("Not parsed bonus %s %s", buf, mod);
return;
break;
}

View File

@ -336,7 +336,7 @@ CGHeroInstance * CGameState::HeroesPool::pickHeroFor(bool native, PlayerColor pl
}
if(!pool.size())
{
logGlobal->error("Cannot pick native hero for %s. Picking any...", player.getStr(false));
logGlobal->error("Cannot pick native hero for %s. Picking any...", player.getStr());
return pickHeroFor(false, player, town, available, rand);
}
else
@ -359,7 +359,7 @@ CGHeroInstance * CGameState::HeroesPool::pickHeroFor(bool native, PlayerColor pl
}
if(!pool.size() || sum == 0)
{
logGlobal->error("There are no heroes available for player %s!", player.getStr(false));
logGlobal->error("There are no heroes available for player %s!", player.getStr());
return nullptr;
}
@ -429,7 +429,7 @@ int CGameState::pickUnusedHeroTypeRandomly(PlayerColor owner)
return RandomGeneratorUtil::nextItem(factionHeroes, getRandomGenerator())->getNum();
}
logGlobal->warn("Cannot find free hero of appropriate faction for player %s - trying to get first available...", owner.getStr(false));
logGlobal->warn("Cannot find free hero of appropriate faction for player %s - trying to get first available...", owner.getStr());
if(!otherHeroes.empty())
{
return RandomGeneratorUtil::nextItem(otherHeroes, getRandomGenerator())->getNum();
@ -863,7 +863,7 @@ void CGameState::checkMapChecksum()
logGlobal->info("\tOur checksum for the map: %d", map->checksum);
if(scenarioOps->mapfileChecksum)
{
logGlobal->info("\tServer checksum for %s: ", scenarioOps->mapname, scenarioOps->mapfileChecksum);
logGlobal->info("\tServer checksum for %s: %d", scenarioOps->mapname, scenarioOps->mapfileChecksum);
if(map->checksum != scenarioOps->mapfileChecksum)
{
logGlobal->error("Wrong map checksum!!!");

View File

@ -302,7 +302,7 @@ void CIdentifierStorage::finalize()
{
for(auto object : registeredObjects)
{
logGlobal->trace("%s : %s -> %s", object.second.scope, object.first, object.second.id);
logGlobal->trace("%s : %s -> %d", object.second.scope, object.first, object.second.id);
}
logGlobal->error("All known identifiers were dumped into log file");
}
@ -466,7 +466,7 @@ void CContentHandler::preloadData(CModInfo & mod)
bool validate = (mod.validation != CModInfo::PASSED);
// print message in format [<8-symbols checksum>] <modname>
logGlobal->info("\t\t[%08d]%s", mod.checksum, mod.name);
logGlobal->info("\t\t[%08x]%s", mod.checksum, mod.name);
if (validate && mod.identifier != "core")
{

View File

@ -842,7 +842,7 @@ void CBonusSystemNode::childDetached(CBonusSystemNode *child)
children -= child;
else
{
logBonus->error("Error!%s #cannot be detached from# %s", child->nodeName(), nodeName());
logBonus->error("Error! %s #cannot be detached from# %s", child->nodeName(), nodeName());
throw std::runtime_error("internal error");
}

View File

@ -306,7 +306,7 @@ DLL_LINKAGE void ChangeObjPos::applyGs(CGameState *gs)
CGObjectInstance *obj = gs->getObjInstance(objid);
if(!obj)
{
logNetwork->error("Wrong ChangeObjPos: object %d doesn't exist!", objid.getNum());
logNetwork->error("Wrong ChangeObjPos: object %d doesn't exist!", objid.getNum());
return;
}
gs->map->removeBlockVisTiles(obj);

View File

@ -89,7 +89,7 @@ struct StartInfo
{
if(playerInfos.find(no) != playerInfos.end())
return playerInfos[no];
logGlobal->error("Cannot find info about player %s. Throwing...", no.getStr(false));
logGlobal->error("Cannot find info about player %s. Throwing...", no.getStr());
throw std::runtime_error("Cannot find info about player");
}
const PlayerSettings & getIthPlayersSettings(PlayerColor no) const

View File

@ -644,7 +644,7 @@ const CGHeroInstance * BattleInfo::getHero(PlayerColor player) const
if(sides[i].color == player)
return sides[i].hero;
logGlobal->error("Player %s is not in battle!", player.getStr(false));
logGlobal->error("Player %s is not in battle!", player.getStr());
return nullptr;
}
@ -659,7 +659,7 @@ ui8 BattleInfo::whatSide(PlayerColor player) const
if(sides[i].color == player)
return i;
logGlobal->warn("BattleInfo::whatSide: Player %s is not in battle!", player.getStr(false));
logGlobal->warn("BattleInfo::whatSide: Player %s is not in battle!", player.getStr());
return -1;
}

View File

@ -133,7 +133,7 @@ BattlePerspective::BattlePerspective CBattleInfoEssentials::battleGetMySide() co
if(*player == getBattle()->sides[1].color)
return BattlePerspective::RIGHT_SIDE;
logGlobal->error("Cannot find player %s in battle!", player.get().getStr(false));
logGlobal->error("Cannot find player %s in battle!", player->getStr());
return BattlePerspective::INVALID;
}
@ -267,7 +267,7 @@ BattleSideOpt CBattleInfoEssentials::playerToSide(PlayerColor player) const
RETURN_IF_NOT_BATTLE(boost::none);
int ret = vstd::find_pos_if(getBattle()->sides, [=](const SideInBattle &side){ return side.color == player; });
if(ret < 0)
logGlobal->warn("Cannot find side for player %s", player.getStr(false));
logGlobal->warn("Cannot find side for player %s", player.getStr());
return BattleSideOpt(ret);
}

View File

@ -43,7 +43,11 @@ CTraceLogger::CTraceLogger(const CLoggerBase * logger, const std::string & begin
{
logger->trace(beginMessage);
}
CTraceLogger::~CTraceLogger() { logger->trace(std::move(endMessage)); }
CTraceLogger::~CTraceLogger()
{
logger->trace(endMessage);
}
}//namespace vstd

View File

@ -170,7 +170,7 @@ void CGHeroInstance::setSecSkillLevel(SecondarySkill which, int val, bool abs)
if(elem.second > 3) //workaround to avoid crashes when same sec skill is given more than once
{
logGlobal->warn("Skill %d increased over limit! Decreasing to Expert.", which.toEnum());
logGlobal->warn("Skill %d increased over limit! Decreasing to Expert.", (int)which.toEnum());
elem.second = 3;
}
updateSkill(which, elem.second); //when we know final value

View File

@ -427,20 +427,20 @@ void CGPandoraBox::serializeJsonOptions(JsonSerializeFormat & handler)
for(const auto & p : skillMap.Struct())
{
const std::string id = p.first;
const std::string levelId = p.second.String();
const std::string skillName = p.first;
const std::string levelId = p.second.String();
const int rawId = vstd::find_pos(NSecondarySkill::names, id);
const int rawId = vstd::find_pos(NSecondarySkill::names, skillName);
if(rawId < 0)
{
logGlobal->error("Invalid secondary skill %s", id);
logGlobal->error("Invalid secondary skill %s", skillName);
continue;
}
const int level = vstd::find_pos(NSecondarySkill::levels, levelId);
if(level < 0)
{
logGlobal->error("Invalid secondary skill level%s", levelId);
logGlobal->error("Invalid secondary skill level %s", levelId);
continue;
}

View File

@ -353,7 +353,7 @@ bool CMap::isCoastalTile(const int3 & pos) const
if(!isInTheMap(pos))
{
logGlobal->error("Coastal check outside of map :%s", pos.toString());
logGlobal->error("Coastal check outside of map: %s", pos.toString());
return false;
}

View File

@ -84,7 +84,7 @@ void CLoadFile::reportState(vstd::CLoggerBase * out)
{
out->debug("CLoadFile");
if(!!sfile && *sfile)
out->debug("\tOpened %s \tPosition: %d", fName, sfile->tellg());
out->debug("\tOpened %s Position: %d", fName, sfile->tellg());
}
void CLoadFile::clear()

View File

@ -6082,7 +6082,7 @@ void CGameHandler::spawnWanderingMonsters(CreatureID creatureID)
for (int i = 0; i < amount; ++i)
{
tile = tiles.begin();
logGlobal->trace("\tSpawning monster at %s",tile->toString());
logGlobal->trace("\tSpawning monster at %s", tile->toString());
putNewMonster(creatureID, cre->getRandomAmount(std::rand), *tile);
tiles.erase(tile); //not use it again
}