1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

Fix indentation of logging code and around it

That wouldn't be as big issue if problem affected few files, but it everywhere in codebase.
Fixed it everywhere since in most files that is the only code with wrong indentation.
This commit is contained in:
Arseniy Shestakov 2016-03-12 04:41:27 +03:00
parent faae305ec0
commit 10dbbead2d
54 changed files with 580 additions and 577 deletions

View File

@ -146,8 +146,8 @@ SDL_Surface * BitmapHandler::loadBitmapFromDir(std::string path, std::string fna
} }
else else
{ {
logGlobal->errorStream()<<"Failed to open "<<fname<<" via SDL_Image"; logGlobal->errorStream() << "Failed to open " << fname << " via SDL_Image";
logGlobal->errorStream()<<"Reason: " << IMG_GetError(); logGlobal->errorStream() << "Reason: " << IMG_GetError();
return nullptr; return nullptr;
} }
} }
@ -173,7 +173,9 @@ SDL_Surface * BitmapHandler::loadBitmap(std::string fname, bool setKey)
if (!(bitmap = loadBitmapFromDir("DATA/", fname, setKey)) && if (!(bitmap = loadBitmapFromDir("DATA/", fname, setKey)) &&
!(bitmap = loadBitmapFromDir("SPRITES/", fname, setKey))) !(bitmap = loadBitmapFromDir("SPRITES/", fname, setKey)))
logGlobal->errorStream()<<"Error: Failed to find file "<<fname; {
logGlobal->errorStream() << "Error: Failed to find file " << fname;
}
return bitmap; return bitmap;
} }

View File

@ -336,7 +336,7 @@ int main(int argc, char** argv)
testFile("SOUNDS/G1A.WAV", "campaign music"); //technically not a music but voiced intro sounds testFile("SOUNDS/G1A.WAV", "campaign music"); //technically not a music but voiced intro sounds
conf.init(); conf.init();
logGlobal->infoStream() <<"Loading settings: "<<pomtime.getDiff(); logGlobal->infoStream() << "Loading settings: " << pomtime.getDiff();
logGlobal->infoStream() << NAME; logGlobal->infoStream() << NAME;
srand ( time(nullptr) ); srand ( time(nullptr) );
@ -627,7 +627,7 @@ void processCommand(const std::string &message)
} }
else if(message=="get txt") else if(message=="get txt")
{ {
std::cout<<"Command accepted.\t"; std::cout << "Command accepted.\t";
const bfs::path outPath = const bfs::path outPath =
VCMIDirs::get().userCachePath() / "extracted"; VCMIDirs::get().userCachePath() / "extracted";

View File

@ -331,8 +331,8 @@ void CClient::loadGame(const std::string & fname, const bool server, const std::
if(server) if(server)
{ {
for(auto & elem : gs->scenarioOps->playerInfos) for(auto & elem : gs->scenarioOps->playerInfos)
if(!std::count(humanplayerindices.begin(),humanplayerindices.end(),elem.first.getNum()) || elem.first==player)
{ {
if(!std::count(humanplayerindices.begin(),humanplayerindices.end(),elem.first.getNum()) || elem.first==player)
clientPlayers.insert(elem.first); clientPlayers.insert(elem.first);
} }
clientPlayers.insert(PlayerColor::NEUTRAL); clientPlayers.insert(PlayerColor::NEUTRAL);
@ -438,10 +438,10 @@ void CClient::newGame( CConnection *con, StartInfo *si )
{ {
const_cast<CGameInfo*>(CGI)->mh = new CMapHandler(); const_cast<CGameInfo*>(CGI)->mh = new CMapHandler();
CGI->mh->map = gs->map; CGI->mh->map = gs->map;
logNetwork->infoStream() <<"Creating mapHandler: "<<tmh.getDiff(); logNetwork->infoStream() << "Creating mapHandler: " << tmh.getDiff();
CGI->mh->init(); CGI->mh->init();
pathInfo = make_unique<CPathsInfo>(getMapSize()); pathInfo = make_unique<CPathsInfo>(getMapSize());
logNetwork->infoStream() <<"Initializing mapHandler (together): "<<tmh.getDiff(); logNetwork->infoStream() << "Initializing mapHandler (together): " << tmh.getDiff();
} }
int humanPlayers = 0; int humanPlayers = 0;

View File

@ -1050,8 +1050,8 @@ CDefFile * CAnimation::getFile() const
void CAnimation::printError(size_t frame, size_t group, std::string type) const void CAnimation::printError(size_t frame, size_t group, std::string type) const
{ {
logGlobal->errorStream() << type <<" error: Request for frame not present in CAnimation! " logGlobal->errorStream() << type << " error: Request for frame not present in CAnimation! "
<<"\tFile name: "<<name<<" Group: "<<group<<" Frame: "<<frame; << "\tFile name: " << name << " Group: " << group << " Frame: " << frame;
} }
CAnimation::CAnimation(std::string Name, bool Compressed): CAnimation::CAnimation(std::string Name, bool Compressed):
@ -1171,13 +1171,12 @@ std::set<CAnimation*> CAnimation::loadedAnims;
void CAnimation::getAnimInfo() void CAnimation::getAnimInfo()
{ {
logGlobal->errorStream()<<"Animation stats: Loaded "<<loadedAnims.size()<<" total"; logGlobal->errorStream() << "Animation stats: Loaded " << loadedAnims.size() << " total";
for (auto anim : loadedAnims) for(auto anim : loadedAnims)
{ {
logGlobal->errorStream() << "Name: " << anim->name << " Groups: " << anim->images.size();
logGlobal->errorStream()<<"Name: "<<anim->name<<" Groups: "<<anim->images.size(); if(!anim->images.empty())
if (!anim->images.empty()) logGlobal->errorStream() << ", " << anim->images.begin()->second.size() << " image loaded in group " << anim->images.begin()->first;
logGlobal->errorStream()<<", "<<anim->images.begin()->second.size()<<" image loaded in group "<< anim->images.begin()->first;
} }
} }

View File

@ -261,7 +261,7 @@ void CBuildingRect::mouseMoved (const SDL_MouseMotionEvent & sEvent)
} }
CDwellingInfoBox::CDwellingInfoBox(int centerX, int centerY, const CGTownInstance *Town, int level): CDwellingInfoBox::CDwellingInfoBox(int centerX, int centerY, const CGTownInstance *Town, int level):
CWindowObject(RCLICK_POPUP | PLAYER_COLORED, "CRTOINFO", Point(centerX, centerY)) CWindowObject(RCLICK_POPUP | PLAYER_COLORED, "CRTOINFO", Point(centerX, centerY))
{ {
OBJ_CONSTRUCTION_CAPTURING_ALL; OBJ_CONSTRUCTION_CAPTURING_ALL;

View File

@ -2159,8 +2159,10 @@ bool AccessibilityInfo::accessible(BattleHex tile, bool doubleWide, bool attacke
// isn't accessible // isn't accessible
else if(at(hex) != EAccessibility::ACCESSIBLE && else if(at(hex) != EAccessibility::ACCESSIBLE &&
!(at(hex) == EAccessibility::GATE && !attackerOwned)) !(at(hex) == EAccessibility::GATE && !attackerOwned))
{
return false; return false;
} }
}
return true; return true;
} }

View File

@ -1467,7 +1467,7 @@ void actualizeEffect(CStack * s, const std::vector<Bonus> & ef)
DLL_LINKAGE void SetStackEffect::applyGs( CGameState *gs ) DLL_LINKAGE void SetStackEffect::applyGs( CGameState *gs )
{ {
if (effect.empty()) if(effect.empty())
{ {
logGlobal->errorStream() << "Trying to apply SetStackEffect with no effects"; logGlobal->errorStream() << "Trying to apply SetStackEffect with no effects";
return; return;

View File

@ -961,9 +961,9 @@ bool CGHeroInstance::canCastThisSpell(const CSpell * spell) const
const bool levelBonus = hasBonusOfType(Bonus::SPELLS_OF_LEVEL, spell->level); const bool levelBonus = hasBonusOfType(Bonus::SPELLS_OF_LEVEL, spell->level);
if (spell->isSpecialSpell()) if(spell->isSpecialSpell())
{ {
if (inSpellBook) if(inSpellBook)
{//hero has this spell in spellbook {//hero has this spell in spellbook
logGlobal->errorStream() << "Special spell " << spell->name << "in spellbook."; logGlobal->errorStream() << "Special spell " << spell->name << "in spellbook.";
} }
@ -971,7 +971,7 @@ bool CGHeroInstance::canCastThisSpell(const CSpell * spell) const
} }
else if(!isAllowed) else if(!isAllowed)
{ {
if (inSpellBook) if(inSpellBook)
{//hero has this spell in spellbook {//hero has this spell in spellbook
logGlobal->errorStream() << "Banned spell " << spell->name << " in spellbook."; logGlobal->errorStream() << "Banned spell " << spell->name << " in spellbook.";
} }

View File

@ -2142,7 +2142,7 @@ bool CGameHandler::teleportHero(ObjectInstanceID hid, ObjectInstanceID dstid, ui
const CGTownInstance *t = getTown(dstid); const CGTownInstance *t = getTown(dstid);
if ( !h || !t || h->getOwner() != gs->currentPlayer ) if ( !h || !t || h->getOwner() != gs->currentPlayer )
logGlobal->errorStream()<<"Invalid call to teleportHero!"; logGlobal->errorStream() << "Invalid call to teleportHero!";
const CGTownInstance *from = h->visitedTown; const CGTownInstance *from = h->visitedTown;
if(((h->getOwner() != t->getOwner()) if(((h->getOwner() != t->getOwner())
@ -4702,7 +4702,7 @@ void CGameHandler::handleTimeEvents()
ev.firstOccurence += ev.nextOccurence; ev.firstOccurence += ev.nextOccurence;
auto it = gs->map->events.begin(); auto it = gs->map->events.begin();
while ( it !=gs->map->events.end() && it->earlierThanOrEqual(ev)) while(it != gs->map->events.end() && it->earlierThanOrEqual(ev))
it++; it++;
gs->map->events.insert(it, ev); gs->map->events.insert(it, ev);
} }
@ -4785,7 +4785,7 @@ void CGameHandler::handleTownEvents(CGTownInstance * town, NewTurn &n)
ev.firstOccurence += ev.nextOccurence; ev.firstOccurence += ev.nextOccurence;
auto it = town->events.begin(); auto it = town->events.begin();
while ( it != town->events.end() && it->earlierThanOrEqual(ev)) while(it != town->events.end() && it->earlierThanOrEqual(ev))
it++; it++;
town->events.insert(it, ev); town->events.insert(it, ev);
} }
@ -6134,7 +6134,7 @@ CasualtiesAfterBattle::CasualtiesAfterBattle(const CArmedInstance * _army, Battl
{ {
if(st->alive() && st->count > 0) if(st->alive() && st->count > 0)
{ {
logGlobal->debugStream() << "Permanently summoned " + st->count << " units."; logGlobal->debugStream() << "Permanently summoned " << st->count << " units.";
const CreatureID summonedType = st->type->idNumber; const CreatureID summonedType = st->type->idNumber;
summoned[summonedType] += st->count; summoned[summonedType] += st->count;
} }