mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Logging cleanup.
This commit is contained in:
parent
c293589c07
commit
64d9dadd64
@ -130,7 +130,7 @@ SDL_Surface * BitmapHandler::loadBitmapFromDir(std::string path, std::string fna
|
||||
}
|
||||
else
|
||||
{
|
||||
logGlobal->errorStream()<<"Failed to open "<<fname<<" as H3 PCX!";
|
||||
logGlobal->error("Failed to open %s as H3 PCX!", fname);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -151,8 +151,8 @@ SDL_Surface * BitmapHandler::loadBitmapFromDir(std::string path, std::string fna
|
||||
}
|
||||
else
|
||||
{
|
||||
logGlobal->errorStream() << "Failed to open " << fname << " via SDL_Image";
|
||||
logGlobal->errorStream() << "Reason: " << IMG_GetError();
|
||||
logGlobal->error("Failed to open %s via SDL_Image", fname);
|
||||
logGlobal->error("Reason: %s", IMG_GetError());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -183,7 +183,7 @@ SDL_Surface * BitmapHandler::loadBitmap(std::string fname, bool setKey)
|
||||
if (!(bitmap = loadBitmapFromDir("DATA/", fname, setKey)) &&
|
||||
!(bitmap = loadBitmapFromDir("SPRITES/", fname, setKey)))
|
||||
{
|
||||
logGlobal->errorStream() << "Error: Failed to find file " << fname;
|
||||
logGlobal->error("Error: Failed to find file %s", fname);
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
|
@ -166,9 +166,9 @@ SDL_Surface * CDefHandler::getSprite (int SIndex, const ui8 * FDef, const SDL_Co
|
||||
|
||||
if(nullptr == ret)
|
||||
{
|
||||
logGlobal->errorStream() << __FUNCTION__ <<": Unable to create surface";
|
||||
logGlobal->errorStream() << FullWidth << "X" << FullHeight;
|
||||
logGlobal->errorStream() << SDL_GetError();
|
||||
logGlobal->error("%s: Unable to create surface", __FUNCTION__);
|
||||
logGlobal->error("%dX%d", FullWidth, FullHeight);
|
||||
logGlobal->error(SDL_GetError());
|
||||
throw std::runtime_error("Unable to create surface");
|
||||
}
|
||||
|
||||
|
@ -151,8 +151,7 @@ void startGameFromFile(const bfs::path &fname)
|
||||
}
|
||||
catch(std::exception &e)
|
||||
{
|
||||
logGlobal->errorStream() << "Failed to start from the file: " << fname << ". Error: " << e.what()
|
||||
<< " Falling back to main menu.";
|
||||
logGlobal->error("Failed to start from the file: %s. Error: %s. Falling back to main menu.", fname, e.what());
|
||||
GH.curInt = CGPreGame::create();
|
||||
return;
|
||||
}
|
||||
@ -217,7 +216,7 @@ static void SDLLogCallback(void* userdata,
|
||||
//todo: convert SDL log priority to vcmi log priority
|
||||
//todo: make separate log domain for SDL
|
||||
|
||||
logGlobal->debugStream() << "SDL(category " << category << "; priority " <<priority <<") "<<message;
|
||||
logGlobal->debug("SDL(category %d; priority %d) %s", category, priority, message);
|
||||
}
|
||||
|
||||
#ifdef VCMI_APPLE
|
||||
@ -320,9 +319,9 @@ int main(int argc, char * argv[])
|
||||
const bfs::path logPath = VCMIDirs::get().userCachePath() / "VCMI_Client_log.txt";
|
||||
CBasicLogConfigurator logConfig(logPath, console);
|
||||
logConfig.configureDefault();
|
||||
logGlobal->infoStream() << NAME;
|
||||
logGlobal->info(NAME);
|
||||
logGlobal->info("Creating console and configuring logger: %d ms", pomtime.getDiff());
|
||||
logGlobal->infoStream() << "The log file will be saved to " << logPath;
|
||||
logGlobal->info("The log file will be saved to %s", logPath);
|
||||
|
||||
// Init filesystem and settings
|
||||
preinitDLL(::console);
|
||||
@ -355,7 +354,7 @@ int main(int argc, char * argv[])
|
||||
if (CResourceHandler::get()->existsResource(ResourceID(filename)))
|
||||
return true;
|
||||
|
||||
logGlobal->errorStream() << "Error: " << message << " was not found!";
|
||||
logGlobal->error("Error: %s was not found!", message);
|
||||
return false;
|
||||
};
|
||||
|
||||
@ -383,8 +382,8 @@ int main(int argc, char * argv[])
|
||||
{
|
||||
logGlobal->error("Fatal error: failed to load settings!");
|
||||
logGlobal->error("Possible reasons:");
|
||||
logGlobal->errorStream() << "\tCorrupted local configuration file at " << VCMIDirs::get().userConfigPath() << "/settings.json";
|
||||
logGlobal->errorStream() << "\tMissing or corrupted global configuration file at " << VCMIDirs::get().userConfigPath() << "/schemas/settings.json";
|
||||
logGlobal->error("\tCorrupted local configuration file at %s/settings.json", VCMIDirs::get().userConfigPath());
|
||||
logGlobal->error("\tMissing or corrupted global configuration file at %s/schemas/settings.json", VCMIDirs::get().userConfigPath());
|
||||
logGlobal->error("VCMI will now exit...");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@ -393,7 +392,7 @@ int main(int argc, char * argv[])
|
||||
{
|
||||
if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_AUDIO|SDL_INIT_NOPARACHUTE))
|
||||
{
|
||||
logGlobal->errorStream()<<"Something was wrong: "<< SDL_GetError();
|
||||
logGlobal->error("Something was wrong: %s", SDL_GetError());
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@ -413,7 +412,7 @@ int main(int argc, char * argv[])
|
||||
int driversCount = SDL_GetNumRenderDrivers();
|
||||
std::string preferredDriverName = video["driver"].String();
|
||||
|
||||
logGlobal->infoStream() << "Found " << driversCount << " render drivers";
|
||||
logGlobal->info("Found %d render drivers", driversCount);
|
||||
|
||||
for(int it = 0; it < driversCount; it++)
|
||||
{
|
||||
@ -425,17 +424,17 @@ int main(int argc, char * argv[])
|
||||
if(!preferredDriverName.empty() && driverName == preferredDriverName)
|
||||
{
|
||||
preferredDriverIndex = it;
|
||||
logGlobal->infoStream() << "\t" << driverName << " (active)";
|
||||
logGlobal->info("\t%s (active)", driverName);
|
||||
}
|
||||
else
|
||||
logGlobal->infoStream() << "\t" << driverName;
|
||||
logGlobal->info("\t%s", driverName);
|
||||
}
|
||||
|
||||
config::CConfigHandler::GuiOptionsMap::key_type resPair(res["width"].Float(), res["height"].Float());
|
||||
if (conf.guiOptions.count(resPair) == 0)
|
||||
{
|
||||
// selected resolution was not found - complain & fallback to something that we do have.
|
||||
logGlobal->errorStream() << "Selected resolution " << resPair.first << "x" << resPair.second << " was not found!";
|
||||
logGlobal->error("Selected resolution %dx%d was not found!", resPair.first, resPair.second);
|
||||
if (conf.guiOptions.empty())
|
||||
{
|
||||
logGlobal->error("Unable to continue - no valid resolutions found! Please reinstall VCMI to fix this");
|
||||
@ -448,7 +447,7 @@ int main(int argc, char * argv[])
|
||||
newRes["height"].Float() = conf.guiOptions.begin()->first.second;
|
||||
conf.SetResolution(newRes["width"].Float(), newRes["height"].Float());
|
||||
|
||||
logGlobal->errorStream() << "Falling back to " << newRes["width"].Float() << "x" << newRes["height"].Float();
|
||||
logGlobal->error("Falling back to %dx%d", newRes["width"].Integer(), newRes["height"].Integer());
|
||||
}
|
||||
}
|
||||
|
||||
@ -548,8 +547,7 @@ int main(int argc, char * argv[])
|
||||
{
|
||||
if(!fileToStartFrom.empty())
|
||||
{
|
||||
logGlobal->warnStream() << "Warning: cannot find given file to start from (" << fileToStartFrom
|
||||
<< "). Falling back to main menu.";
|
||||
logGlobal->warn("Warning: cannot find given file to start from (%s). Falling back to main menu.", fileToStartFrom.string());
|
||||
}
|
||||
GH.curInt = CGPreGame::create(); //will set CGP pointer to itself
|
||||
}
|
||||
@ -592,7 +590,7 @@ void printInfoAboutIntObject(const CIntObject *obj, int level)
|
||||
sbuffer << "inactive";
|
||||
sbuffer << " at " << obj->pos.x <<"x"<< obj->pos.y;
|
||||
sbuffer << " (" << obj->pos.w <<"x"<< obj->pos.h << ")";
|
||||
logGlobal->infoStream() << sbuffer.str();
|
||||
logGlobal->info(sbuffer.str());
|
||||
|
||||
for(const CIntObject *child : obj->children)
|
||||
printInfoAboutIntObject(child, level+1);
|
||||
@ -862,7 +860,7 @@ void processCommand(const std::string &message)
|
||||
}
|
||||
catch(std::exception &e)
|
||||
{
|
||||
logGlobal->warnStream() << "Failed opening " << fname << ": " << e.what();
|
||||
logGlobal->warn("Failed opening %s: %s", fname, e.what());
|
||||
logGlobal->warn("Setting not changes, AI not found or invalid!");
|
||||
}
|
||||
}
|
||||
@ -1062,7 +1060,7 @@ static bool recreateWindow(int w, int h, int bpp, bool fullscreen, int displayIn
|
||||
}
|
||||
if(!checkVideoMode(displayIndex, w, h))
|
||||
{
|
||||
logGlobal->errorStream() << "Error: SDL says that " << w << "x" << h << " resolution is not available!";
|
||||
logGlobal->error("Error: SDL says that %dx%d resolution is not available!", w, h);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1105,8 +1103,8 @@ static bool recreateWindow(int w, int h, int bpp, bool fullscreen, int displayIn
|
||||
}
|
||||
|
||||
SDL_RendererInfo info;
|
||||
SDL_GetRendererInfo(mainRenderer,&info);
|
||||
logGlobal->infoStream() << "Created renderer " << info.name;
|
||||
SDL_GetRendererInfo(mainRenderer, &info);
|
||||
logGlobal->info("Created renderer %s", info.name);
|
||||
|
||||
if(!(fullscreen && realFullscreen))
|
||||
{
|
||||
@ -1134,10 +1132,7 @@ static bool recreateWindow(int w, int h, int bpp, bool fullscreen, int displayIn
|
||||
screen = SDL_CreateRGBSurface(0,w,h,bpp,rmask,gmask,bmask,amask);
|
||||
if(nullptr == screen)
|
||||
{
|
||||
logGlobal->error("Unable to create surface");
|
||||
logGlobal->errorStream() << w << " "<< h << " "<< bpp;
|
||||
|
||||
logGlobal->errorStream() << SDL_GetError();
|
||||
logGlobal->error("Unable to create surface %dx%d with %d bpp: %s", w, h, bpp, SDL_GetError());
|
||||
throw std::runtime_error("Unable to create surface");
|
||||
}
|
||||
//No blending for screen itself. Required for proper cursor rendering.
|
||||
@ -1151,7 +1146,7 @@ static bool recreateWindow(int w, int h, int bpp, bool fullscreen, int displayIn
|
||||
if(nullptr == screenTexture)
|
||||
{
|
||||
logGlobal->error("Unable to create screen texture");
|
||||
logGlobal->errorStream() << SDL_GetError();
|
||||
logGlobal->error(SDL_GetError());
|
||||
throw std::runtime_error("Unable to create screen texture");
|
||||
}
|
||||
|
||||
@ -1269,7 +1264,7 @@ static void handleEvent(SDL_Event & ev)
|
||||
fullScreenChanged();
|
||||
break;
|
||||
default:
|
||||
logGlobal->errorStream() << "Unknown user event. Code " << ev.user.code;
|
||||
logGlobal->error("Unknown user event. Code %d", ev.user.code);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ void CAudioBase::init()
|
||||
|
||||
if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024)==-1)
|
||||
{
|
||||
logGlobal->errorStream() << "Mix_OpenAudio error: " << Mix_GetError();
|
||||
logGlobal->error("Mix_OpenAudio error: %s", Mix_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ Mix_Chunk *CSoundHandler::GetSoundChunk(std::string &sound, bool cache)
|
||||
}
|
||||
catch(std::exception &e)
|
||||
{
|
||||
logGlobal->warnStream() << "Cannot get sound " << sound << " chunk: " << e.what();
|
||||
logGlobal->warn("Cannot get sound %s chunk: %s", sound, e.what());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -164,7 +164,7 @@ int CSoundHandler::playSound(soundBase::soundID soundID, int repeats)
|
||||
{
|
||||
assert(soundID < soundBase::sound_after_last);
|
||||
auto sound = sounds[soundID];
|
||||
logGlobal->traceStream() << "Attempt to play sound " << soundID << " with file name " << sound << " with cache";
|
||||
logGlobal->trace("Attempt to play sound %d with file name %s with cache", soundID, sound);
|
||||
|
||||
return playSound(sound, repeats, true);
|
||||
}
|
||||
@ -182,7 +182,7 @@ int CSoundHandler::playSound(std::string sound, int repeats, bool cache)
|
||||
channel = Mix_PlayChannel(-1, chunk, repeats);
|
||||
if (channel == -1)
|
||||
{
|
||||
logGlobal->errorStream() << "Unable to play sound file " << sound << " , error " << Mix_GetError();
|
||||
logGlobal->error("Unable to play sound file %s , error %s", sound, Mix_GetError());
|
||||
if (!cache)
|
||||
Mix_FreeChunk(chunk);
|
||||
}
|
||||
@ -314,7 +314,7 @@ void CMusicHandler::playMusicFromSet(std::string whichSet, bool loop)
|
||||
auto selectedSet = musicsSet.find(whichSet);
|
||||
if (selectedSet == musicsSet.end())
|
||||
{
|
||||
logGlobal->errorStream() << "Error: playing music from non-existing set: " << whichSet;
|
||||
logGlobal->error("Error: playing music from non-existing set: %s", whichSet);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -331,14 +331,14 @@ void CMusicHandler::playMusicFromSet(std::string whichSet, int entryID, bool loo
|
||||
auto selectedSet = musicsSet.find(whichSet);
|
||||
if (selectedSet == musicsSet.end())
|
||||
{
|
||||
logGlobal->errorStream() << "Error: playing music from non-existing set: " << whichSet;
|
||||
logGlobal->error("Error: playing music from non-existing set: %s", whichSet);
|
||||
return;
|
||||
}
|
||||
|
||||
auto selectedEntry = selectedSet->second.find(entryID);
|
||||
if (selectedEntry == selectedSet->second.end())
|
||||
{
|
||||
logGlobal->errorStream() << "Error: playing non-existing entry " << entryID << " from set: " << whichSet;
|
||||
logGlobal->error("Error: playing non-existing entry %d from set: %s", entryID, whichSet);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -373,8 +373,8 @@ void CMusicHandler::queueNext(CMusicHandler *owner, std::string setName, std::st
|
||||
}
|
||||
catch(std::exception &e)
|
||||
{
|
||||
logGlobal->errorStream() << "Failed to queue music. setName=" << setName << "\tmusicURI=" << musicURI;
|
||||
logGlobal->errorStream() << "Exception: " << e.what();
|
||||
logGlobal->error("Failed to queue music. setName=%s\tmusicURI=%s", setName, musicURI);
|
||||
logGlobal->error("Exception: %s", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
@ -429,7 +429,7 @@ MusicEntry::MusicEntry(CMusicHandler *owner, std::string setName, std::string mu
|
||||
}
|
||||
MusicEntry::~MusicEntry()
|
||||
{
|
||||
logGlobal->traceStream()<<"Del-ing music file "<<currentName;
|
||||
logGlobal->trace("Del-ing music file %s", currentName);
|
||||
if (music)
|
||||
Mix_FreeMusic(music);
|
||||
}
|
||||
@ -438,14 +438,14 @@ void MusicEntry::load(std::string musicURI)
|
||||
{
|
||||
if (music)
|
||||
{
|
||||
logGlobal->traceStream()<<"Del-ing music file "<<currentName;
|
||||
logGlobal->trace("Del-ing music file %s", currentName);
|
||||
Mix_FreeMusic(music);
|
||||
music = nullptr;
|
||||
}
|
||||
|
||||
currentName = musicURI;
|
||||
|
||||
logGlobal->traceStream()<<"Loading music file "<<musicURI;
|
||||
logGlobal->trace("Loading music file %s", musicURI);
|
||||
|
||||
auto musicFile = MakeSDLRWops(CResourceHandler::get()->load(ResourceID(std::move(musicURI), EResType::MUSIC)));
|
||||
|
||||
@ -453,7 +453,7 @@ void MusicEntry::load(std::string musicURI)
|
||||
|
||||
if(!music)
|
||||
{
|
||||
logGlobal->warnStream() << "Warning: Cannot open " << currentName << ": " << Mix_GetError();
|
||||
logGlobal->warn("Warning: Cannot open %s: %s", currentName, Mix_GetError());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -469,10 +469,10 @@ bool MusicEntry::play()
|
||||
load(RandomGeneratorUtil::nextItem(set, CRandomGenerator::getDefault())->second);
|
||||
}
|
||||
|
||||
logGlobal->traceStream()<<"Playing music file "<<currentName;
|
||||
logGlobal->trace("Playing music file %s", currentName);
|
||||
if(Mix_PlayMusic(music, 1) == -1)
|
||||
{
|
||||
logGlobal->errorStream() << "Unable to play music (" << Mix_GetError() << ")";
|
||||
logGlobal->error("Unable to play music (%s)", Mix_GetError());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -482,7 +482,7 @@ bool MusicEntry::stop(int fade_ms)
|
||||
{
|
||||
if (Mix_PlayingMusic())
|
||||
{
|
||||
logGlobal->traceStream()<<"Stopping music file "<<currentName;
|
||||
logGlobal->trace("Stopping music file %s", currentName);
|
||||
loop = 0;
|
||||
Mix_FadeOutMusic(fade_ms);
|
||||
return true;
|
||||
|
@ -110,7 +110,7 @@ struct HeroObjectRetriever : boost::static_visitor<const CGHeroInstance *>
|
||||
|
||||
CPlayerInterface::CPlayerInterface(PlayerColor Player)
|
||||
{
|
||||
logGlobal->traceStream() << "\tHuman player interface for player " << Player << " being constructed";
|
||||
logGlobal->trace("\tHuman player interface for player %s being constructed", Player.getStr(false));
|
||||
destinationTeleport = ObjectInstanceID();
|
||||
destinationTeleportPos = int3(-1);
|
||||
howManyPeople++;
|
||||
@ -136,7 +136,7 @@ CPlayerInterface::CPlayerInterface(PlayerColor Player)
|
||||
|
||||
CPlayerInterface::~CPlayerInterface()
|
||||
{
|
||||
logGlobal->traceStream() << "\tHuman player interface for player " << playerID << " being destructed";
|
||||
logGlobal->trace("\tHuman player interface for player %s being destructed", playerID.getStr(false));
|
||||
//howManyPeople--;
|
||||
delete showingDialog;
|
||||
delete cingconsole;
|
||||
@ -358,10 +358,10 @@ void CPlayerInterface::heroMoved(const TryMoveHero & details)
|
||||
{
|
||||
//evil returns here ...
|
||||
//todo: get rid of it
|
||||
logGlobal->traceStream() << "before [un]locks in " << __FUNCTION__;
|
||||
logGlobal->trace("before [un]locks in %s", __FUNCTION__);
|
||||
auto unlockPim = vstd::makeUnlockGuard(*pim); //let frame to be rendered
|
||||
GH.mainFPSmng->framerateDelay(); //for animation purposes
|
||||
logGlobal->traceStream() << "after [un]locks in " << __FUNCTION__;
|
||||
logGlobal->trace("after [un]locks in %s", __FUNCTION__);
|
||||
}
|
||||
//CSDL_Ext::update(screen);
|
||||
|
||||
@ -808,7 +808,7 @@ void CPlayerInterface::actionFinished(const BattleAction &action)
|
||||
BattleAction CPlayerInterface::activeStack(const CStack * stack) //called when it's turn of that stack
|
||||
{
|
||||
THREAD_CREATED_BY_CLIENT;
|
||||
logGlobal->traceStream() << "Awaiting command for " << stack->nodeName();
|
||||
logGlobal->trace("Awaiting command for %s", stack->nodeName());
|
||||
auto stackId = stack->ID;
|
||||
auto stackName = stack->nodeName();
|
||||
if (autofightingAI)
|
||||
@ -856,10 +856,10 @@ BattleAction CPlayerInterface::activeStack(const CStack * stack) //called when i
|
||||
{
|
||||
if (stackId != ret.stackNumber)
|
||||
logGlobal->error("Not current active stack action canceled");
|
||||
logGlobal->traceStream() << "Canceled command for " << stackName;
|
||||
logGlobal->trace("Canceled command for %s", stackName);
|
||||
}
|
||||
else
|
||||
logGlobal->traceStream() << "Giving command for " << stackName;
|
||||
logGlobal->trace("Giving command for %s", stackName);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1362,7 +1362,7 @@ template <typename Handler> void CPlayerInterface::serializeTempl( Handler &h, c
|
||||
if (p.second.nodes.size())
|
||||
pathsMap[p.first] = p.second.endPos();
|
||||
else
|
||||
logGlobal->errorStream() << p.first->name << " has assigned an empty path! Ignoring it...";
|
||||
logGlobal->debug("%s has assigned an empty path! Ignoring it...", p.first->name);
|
||||
}
|
||||
h & pathsMap;
|
||||
}
|
||||
@ -1398,7 +1398,7 @@ void CPlayerInterface::loadGame( BinaryDeserializer & h, const int version )
|
||||
|
||||
void CPlayerInterface::moveHero( const CGHeroInstance *h, CGPath path )
|
||||
{
|
||||
logGlobal->traceStream() << __FUNCTION__;
|
||||
LOG_TRACE(logGlobal);
|
||||
if (!LOCPLINT->makingTurn)
|
||||
return;
|
||||
if (!h)
|
||||
@ -2857,7 +2857,7 @@ void CPlayerInterface::doMoveHero(const CGHeroInstance * h, CGPath path)
|
||||
|
||||
assert(h->pos.z == nextCoord.z); // Z should change only if it's movement via teleporter and in this case this code shouldn't be executed at all
|
||||
int3 endpos(nextCoord.x, nextCoord.y, h->pos.z);
|
||||
logGlobal->traceStream() << "Requesting hero movement to " << endpos;
|
||||
logGlobal->trace("Requesting hero movement to %s", endpos());
|
||||
|
||||
bool useTransit = false;
|
||||
if ((i-2 >= 0) // Check there is node after next one; otherwise transit is pointless
|
||||
@ -2871,7 +2871,7 @@ void CPlayerInterface::doMoveHero(const CGHeroInstance * h, CGPath path)
|
||||
|
||||
doMovement(endpos, useTransit);
|
||||
|
||||
logGlobal->traceStream() << "Resuming " << __FUNCTION__;
|
||||
logGlobal->trace("Resuming %s", __FUNCTION__);
|
||||
bool guarded = cb->isInTheMap(cb->getGuardingCreaturePosition(endpos - int3(1, 0, 0)));
|
||||
if ((!useTransit && guarded) || showingDialog->get() == true) // Abort movement if a guard was fought or there is a dialog to display (Mantis #1136)
|
||||
break;
|
||||
|
@ -358,7 +358,7 @@ static std::function<void()> genCommand(CMenuScreen* menu, std::vector<std::stri
|
||||
}
|
||||
}
|
||||
}
|
||||
logGlobal->errorStream()<<"Failed to parse command: "<<string;
|
||||
logGlobal->error("Failed to parse command: %s", string);
|
||||
return std::function<void()>();
|
||||
}
|
||||
|
||||
@ -538,7 +538,7 @@ void CGPreGame::openCampaignScreen(std::string name)
|
||||
GH.pushInt(new CCampaignScreen(CGPreGameConfig::get().getCampaigns()[name]));
|
||||
return;
|
||||
}
|
||||
logGlobal->errorStream()<<"Unknown campaign set: "<<name;
|
||||
logGlobal->error("Unknown campaign set: %s", name);
|
||||
}
|
||||
|
||||
CGPreGame *CGPreGame::create()
|
||||
@ -942,7 +942,7 @@ void CSelectionScreen::handleConnection()
|
||||
{
|
||||
CPackForSelectionScreen *pack = nullptr;
|
||||
*serv >> pack;
|
||||
logNetwork->traceStream() << "Received a pack of type " << typeid(*pack).name();
|
||||
logNetwork->trace("Received a pack of type %s", typeid(*pack).name());
|
||||
assert(pack);
|
||||
if(QuitMenuWithoutStarting *endingPack = dynamic_cast<QuitMenuWithoutStarting *>(pack))
|
||||
{
|
||||
@ -1130,7 +1130,7 @@ void SelectionTab::parseMaps(const std::unordered_set<ResourceID> &files)
|
||||
}
|
||||
catch(std::exception & e)
|
||||
{
|
||||
logGlobal->errorStream() << "Map " << file.getName() << " is invalid. Message: " << e.what();
|
||||
logGlobal->error("Map %s is invalid. Message: %s", file.getName(), e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1183,7 +1183,7 @@ void SelectionTab::parseGames(const std::unordered_set<ResourceID> &files, CMenu
|
||||
}
|
||||
catch(const std::exception & e)
|
||||
{
|
||||
logGlobal->errorStream() << "Error: Failed to process " << file.getName() <<": " << e.what();
|
||||
logGlobal->error("Error: Failed to process %s: %s", file.getName(), e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1494,7 +1494,7 @@ void SelectionTab::printMaps(SDL_Surface *to)
|
||||
break;
|
||||
default:
|
||||
// Unknown version. Be safe and ignore that map
|
||||
logGlobal->warnStream() << "Warning: " << currentItem->fileURI << " has wrong version!";
|
||||
logGlobal->warn("Warning: %s has wrong version!", currentItem->fileURI);
|
||||
continue;
|
||||
}
|
||||
IImage * icon = formatIcons->getImage(frame,group);
|
||||
@ -1824,7 +1824,7 @@ void CRandomMapTab::addButtonsToGroup(CToggleGroup * group, const std::vector<st
|
||||
|
||||
void CRandomMapTab::deactivateButtonsFrom(CToggleGroup * group, int startId)
|
||||
{
|
||||
logGlobal->infoStream() << "Blocking buttons from " << startId;
|
||||
logGlobal->debug("Blocking buttons from %d", startId);
|
||||
for(auto toggle : group->buttons)
|
||||
{
|
||||
if (auto button = dynamic_cast<CToggleButton*>(toggle.second))
|
||||
@ -3722,7 +3722,7 @@ void CBonusSelection::startMap()
|
||||
{
|
||||
auto exitCb = [=]()
|
||||
{
|
||||
logGlobal->infoStream() << "Starting scenario " << selectedMap;
|
||||
logGlobal->info("Starting scenario %d", selectedMap);
|
||||
CGP->showLoadingScreen(std::bind(&startGame, si, (CConnection *)nullptr));
|
||||
};
|
||||
|
||||
|
@ -99,7 +99,7 @@ bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay, bool scal
|
||||
|
||||
if (!CResourceHandler::get()->existsResource(resource))
|
||||
{
|
||||
logGlobal->errorStream() << "Error: video " << resource.getName() << " was not found";
|
||||
logGlobal->error("Error: video %s was not found", resource.getName());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ void CClient::waitForMoveAndSend(PlayerColor color)
|
||||
BattleAction ba = battleints[color]->activeStack(gs->curB->battleGetStackByID(gs->curB->activeStack, false));
|
||||
if(ba.actionType != Battle::CANCEL)
|
||||
{
|
||||
logNetwork->traceStream() << "Send battle action to server: " << ba;
|
||||
logNetwork->trace("Send battle action to server: %s", ba.toString());
|
||||
MakeAction temp_action(ba);
|
||||
sendRequest(&temp_action, color);
|
||||
}
|
||||
@ -301,7 +301,7 @@ void CClient::loadGame(const std::string & fname, const bool server, const std::
|
||||
}
|
||||
catch(std::exception &e)
|
||||
{
|
||||
logGlobal->errorStream() << "Cannot load game " << fname << ". Error: " << e.what();
|
||||
logGlobal->error("Cannot load game %s. Error: %s", fname, e.what());
|
||||
throw; //obviously we cannot continue here
|
||||
}
|
||||
|
||||
@ -367,7 +367,7 @@ void CClient::loadGame(const std::string & fname, const bool server, const std::
|
||||
// {
|
||||
// auto o = gs->map->objects[i];
|
||||
// if(o)
|
||||
// logGlobal->traceStream() << boost::format("\tindex=%5d, id=%5d; address=%5d, pos=%s, name=%s") % i % o->id % (int)o.get() % o->pos % o->getHoverText();
|
||||
// logGlobal->trace("\tindex=%5d, id=%5d; address=%5d, pos=%s, name=%s", i, o->id, (int)o.get(), o->pos, o->getHoverText());
|
||||
// else
|
||||
// logGlobal->trace("\tindex=%5d --- nullptr", i);
|
||||
// }
|
||||
@ -454,7 +454,7 @@ void CClient::newGame( CConnection *con, StartInfo *si )
|
||||
if(!vstd::contains(myPlayers, color))
|
||||
continue;
|
||||
|
||||
logNetwork->traceStream() << "Preparing interface for player " << color;
|
||||
logNetwork->trace("Preparing interface for player %s", color.getStr(false));
|
||||
if(elem.second.playerID == PlayerSettings::PLAYER_AI)
|
||||
{
|
||||
auto AiToGive = aiNameForPlayer(elem.second, false);
|
||||
@ -882,8 +882,7 @@ int CClient::sendRequest(const CPack *request, PlayerColor player)
|
||||
static ui32 requestCounter = 0;
|
||||
|
||||
ui32 requestID = requestCounter++;
|
||||
logNetwork->traceStream() << boost::format("Sending a request \"%s\". It'll have an ID=%d.")
|
||||
% typeid(*request).name() % requestID;
|
||||
logNetwork->trace("Sending a request \"%s\". It'll have an ID=%d.", typeid(*request).name(), requestID);
|
||||
|
||||
waitingRequest.pushBack(requestID);
|
||||
serv->sendPackToServer(*request, player, requestID);
|
||||
@ -1118,7 +1117,7 @@ void CServerHandler::callServer()
|
||||
else
|
||||
{
|
||||
logNetwork->error("Error: server failed to close correctly or crashed!");
|
||||
logNetwork->errorStream() << "Check " << logName << " for more info";
|
||||
logNetwork->error("Check %s for more info", logName);
|
||||
exit(1);// exit in case of error. Othervice without working server VCMI will hang
|
||||
}
|
||||
#endif
|
||||
|
@ -291,7 +291,7 @@ void Graphics::blueToPlayersAdv(SDL_Surface * sur, PlayerColor player)
|
||||
}
|
||||
else
|
||||
{
|
||||
logGlobal->errorStream() << "Wrong player id in blueToPlayersAdv (" << player << ")!";
|
||||
logGlobal->error("Wrong player id in blueToPlayersAdv (%s)!", player.getStr(false));
|
||||
return;
|
||||
}
|
||||
SDL_SetColors(sur, palette, 224, 32);
|
||||
|
@ -122,7 +122,7 @@ void SetPrimSkill::applyCl(CClient *cl)
|
||||
const CGHeroInstance *h = cl->getHero(id);
|
||||
if(!h)
|
||||
{
|
||||
logNetwork->errorStream() << "Cannot find hero with ID " << id.getNum();
|
||||
logNetwork->error("Cannot find hero with ID %d", id.getNum());
|
||||
return;
|
||||
}
|
||||
INTERFACE_CALL_IF_PRESENT(h->tempOwner,heroPrimarySkillChanged,h,which,val);
|
||||
@ -133,7 +133,7 @@ void SetSecSkill::applyCl(CClient *cl)
|
||||
const CGHeroInstance *h = cl->getHero(id);
|
||||
if(!h)
|
||||
{
|
||||
logNetwork->errorStream() << "Cannot find hero with ID " << id;
|
||||
logNetwork->error("Cannot find hero with ID %d", id.getNum());
|
||||
return;
|
||||
}
|
||||
INTERFACE_CALL_IF_PRESENT(h->tempOwner,heroSecondarySkillChanged,h,which,val);
|
||||
@ -784,7 +784,7 @@ void SystemMessage::applyCl(CClient *cl)
|
||||
std::ostringstream str;
|
||||
str << "System message: " << text;
|
||||
|
||||
logNetwork->errorStream() << str.str(); // usually used to receive error messages from server
|
||||
logNetwork->error(str.str()); // usually used to receive error messages from server
|
||||
if(LOCPLINT && !settings["session"]["hideSystemMessages"].Bool())
|
||||
LOCPLINT->cingconsole->print(str.str());
|
||||
}
|
||||
@ -813,13 +813,13 @@ void SaveGame::applyCl(CClient *cl)
|
||||
}
|
||||
catch(std::exception &e)
|
||||
{
|
||||
logNetwork->errorStream() << "Failed to save game:" << e.what();
|
||||
logNetwork->error("Failed to save game:%s", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerMessage::applyCl(CClient *cl)
|
||||
{
|
||||
logNetwork->debugStream() << "Player "<< player <<" sends a message: " << text;
|
||||
logNetwork->debug("Player %s sends a message: %s", player.getStr(false), text);
|
||||
|
||||
std::ostringstream str;
|
||||
if(player.isSpectator())
|
||||
|
@ -283,7 +283,7 @@ void CDefenceAnimation::endAnim()
|
||||
CDummyAnimation::CDummyAnimation(CBattleInterface * _owner, int howManyFrames)
|
||||
: CBattleAnimation(_owner), counter(0), howMany(howManyFrames)
|
||||
{
|
||||
logAnim->debugStream() << "Created dummy animation for " << howManyFrames <<" frames";
|
||||
logAnim->debug("Created dummy animation for %d frames", howManyFrames);
|
||||
}
|
||||
|
||||
bool CDummyAnimation::init()
|
||||
@ -360,7 +360,7 @@ bool CMeleeAttackAnimation::init()
|
||||
group = mutPosToGroup[mutPos];
|
||||
break;
|
||||
default:
|
||||
logGlobal->errorStream()<<"Critical Error! Wrong dest in stackAttacking! dest: "<<dest<<" attacking stack pos: "<<attackingStackPosBeforeReturn<<" mutual pos: "<<mutPos;
|
||||
logGlobal->error("Critical Error! Wrong dest in stackAttacking! dest: %d; attacking stack pos: %d; mutual pos: %d", dest.hex, attackingStackPosBeforeReturn, mutPos);
|
||||
group = CCreatureAnim::ATTACK_FRONT;
|
||||
break;
|
||||
}
|
||||
@ -875,19 +875,19 @@ void CShootingAnimation::endAnim()
|
||||
CSpellEffectAnimation::CSpellEffectAnimation(CBattleInterface * _owner, ui32 _effect, BattleHex _destTile, int _dx, int _dy, bool _Vflip, bool _alignToBottom)
|
||||
:CBattleAnimation(_owner), effect(_effect), destTile(_destTile), customAnim(""), x(-1), y(-1), dx(_dx), dy(_dy), Vflip(_Vflip), alignToBottom(_alignToBottom)
|
||||
{
|
||||
logAnim->debugStream() << "Created spell anim for effect #" << effect;
|
||||
logAnim->debug("Created spell anim for effect #%d", effect);
|
||||
}
|
||||
|
||||
CSpellEffectAnimation::CSpellEffectAnimation(CBattleInterface * _owner, std::string _customAnim, int _x, int _y, int _dx, int _dy, bool _Vflip, bool _alignToBottom)
|
||||
:CBattleAnimation(_owner), effect(-1), destTile(BattleHex::INVALID), customAnim(_customAnim), x(_x), y(_y), dx(_dx), dy(_dy), Vflip(_Vflip), alignToBottom(_alignToBottom)
|
||||
{
|
||||
logAnim->debugStream() << "Created spell anim for " << customAnim;
|
||||
logAnim->debug("Created spell anim for %s", customAnim);
|
||||
}
|
||||
|
||||
CSpellEffectAnimation::CSpellEffectAnimation(CBattleInterface * _owner, std::string _customAnim, BattleHex _destTile, bool _Vflip, bool _alignToBottom)
|
||||
:CBattleAnimation(_owner), effect(-1), destTile(_destTile), customAnim(_customAnim), x(-1), y(-1), dx(0), dy(0), Vflip(_Vflip), alignToBottom(_alignToBottom)
|
||||
{
|
||||
logAnim->debugStream() << "Created spell anim for " << customAnim;
|
||||
logAnim->debug("Created spell anim for %s", customAnim);
|
||||
}
|
||||
|
||||
|
||||
|
@ -189,9 +189,9 @@ CBattleInterface::CBattleInterface(const CCreatureSet *army1, const CCreatureSet
|
||||
{
|
||||
auto bfieldType = (int)curInt->cb->battleGetBattlefieldType();
|
||||
if (graphics->battleBacks.size() <= bfieldType || bfieldType < 0)
|
||||
logGlobal->errorStream() << bfieldType << " is not valid battlefield type index!";
|
||||
logGlobal->error("%d is not valid battlefield type index!", bfieldType);
|
||||
else if (graphics->battleBacks[bfieldType].empty())
|
||||
logGlobal->errorStream() << bfieldType << " battlefield type does not have any backgrounds!";
|
||||
logGlobal->error("%d battlefield type does not have any backgrounds!", bfieldType);
|
||||
else
|
||||
{
|
||||
const std::string bgName = *RandomGeneratorUtil::nextItem(graphics->battleBacks[bfieldType], CRandomGenerator::getDefault());
|
||||
@ -718,7 +718,7 @@ void CBattleInterface::setBattleCursor(const int myNumber)
|
||||
// Generally should NEVER happen, but to avoid the possibility of having endless loop below... [#1016]
|
||||
if (!vstd::contains_if (sectorCursor, [](int sc) { return sc != -1; }))
|
||||
{
|
||||
logGlobal->errorStream() << "Error: for hex " << myNumber << " cannot find a hex to attack from!";
|
||||
logGlobal->error("Error: for hex %d cannot find a hex to attack from!", myNumber);
|
||||
attackingHex = -1;
|
||||
return;
|
||||
}
|
||||
@ -1143,7 +1143,7 @@ void CBattleInterface::giveCommand(Battle::ActionType action, BattleHex tile, ui
|
||||
|
||||
if (!tacticsMode)
|
||||
{
|
||||
logGlobal->traceStream() << "Setting command for " << (stack ? stack->nodeName() : "hero");
|
||||
logGlobal->trace("Setting command for %s", (stack ? stack->nodeName() : "hero"));
|
||||
myTurn = false;
|
||||
setActiveStack(nullptr);
|
||||
givenCommand.setn(ba);
|
||||
@ -1926,7 +1926,7 @@ void CBattleInterface::startAction(const BattleAction* action)
|
||||
}
|
||||
if (!stack)
|
||||
{
|
||||
logGlobal->errorStream()<<"Something wrong with stackNumber in actionStarted. Stack number: "<<action->stackNumber;
|
||||
logGlobal->error("Something wrong with stackNumber in actionStarted. Stack number: %d", action->stackNumber);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2715,13 +2715,13 @@ void CBattleInterface::obstaclePlaced(const CObstacleInstance & oi)
|
||||
sound = soundBase::fireWall;
|
||||
break;
|
||||
default:
|
||||
logGlobal->errorStream() << "I don't know how to animate appearing obstacle of type " << (int)oi.obstacleType;
|
||||
logGlobal->error("I don't know how to animate appearing obstacle of type %d", (int)oi.obstacleType);
|
||||
return;
|
||||
}
|
||||
|
||||
if (effectID >= 0 && graphics->battleACToDef[effectID].empty())
|
||||
{
|
||||
logGlobal->errorStream() << "Cannot find def for effect type " << effectID;
|
||||
logGlobal->error("Cannot find def for effect type %d", effectID);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ void CBattleConsole::showAll(SDL_Surface * to)
|
||||
|
||||
bool CBattleConsole::addText(const std::string & text)
|
||||
{
|
||||
logGlobal->traceStream() <<"CBattleConsole message: "<<text;
|
||||
logGlobal->trace("CBattleConsole message: %s", text);
|
||||
if(text.size()>70)
|
||||
return false; //text too long!
|
||||
int firstInToken = 0;
|
||||
|
@ -385,7 +385,7 @@ void CCreatureAnimation::nextFrame(SDL_Surface *dest, bool attacker)
|
||||
case 3: return nextFrameT<3>(dest, !attacker);
|
||||
case 4: return nextFrameT<4>(dest, !attacker);
|
||||
default:
|
||||
logGlobal->errorStream() << (int)dest->format->BitsPerPixel << " bpp is not supported!!!";
|
||||
logGlobal->error("%d bpp is not supported!", (int)dest->format->BitsPerPixel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -445,7 +445,7 @@ void CDefFile::loadFrame(size_t frame, size_t group, ImageLoader &loader) const
|
||||
break;
|
||||
}
|
||||
default:
|
||||
logGlobal->errorStream()<<"Error: unsupported format of def file: "<<sprite.format;
|
||||
logGlobal->error("Error: unsupported format of def file: %d", sprite.format);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -741,7 +741,7 @@ SDLImage::SDLImage(std::string filename, bool compressed):
|
||||
|
||||
if (surf == nullptr)
|
||||
{
|
||||
logGlobal->errorStream() << "Error: failed to load image "<<filename;
|
||||
logGlobal->error("Error: failed to load image %s", filename);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@ -1373,8 +1373,7 @@ CDefFile * CAnimation::getFile() 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! "
|
||||
<< "\tFile name: " << name << " Group: " << group << " Frame: " << frame;
|
||||
logGlobal->error("%s error: Request for frame not present in CAnimation! File name: %s, Group: %d, Frame: %d", type, name, group, frame);
|
||||
}
|
||||
|
||||
CAnimation::CAnimation(std::string Name, bool Compressed):
|
||||
@ -1406,7 +1405,7 @@ CAnimation::~CAnimation()
|
||||
|
||||
if(!images.empty())
|
||||
{
|
||||
logGlobal->warnStream()<<"Warning: not all frames were unloaded from "<<name;
|
||||
logGlobal->warn("Warning: not all frames were unloaded from %s", name);
|
||||
for (auto & elem : images)
|
||||
for (auto & _image : elem.second)
|
||||
delete _image.second;
|
||||
@ -1579,7 +1578,7 @@ void CFadeAnimation::init(EMode mode, SDL_Surface * sourceSurface, bool freeSurf
|
||||
}
|
||||
if (animDelta <= 0.0f)
|
||||
{
|
||||
logGlobal->warnStream() << "Fade anim: delta should be positive; " << animDelta << " given.";
|
||||
logGlobal->warn("Fade anim: delta should be positive; %f given.", animDelta);
|
||||
animDelta = DEFAULT_DELTA;
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ void CGuiHandler::renderFrame()
|
||||
CCS->curh->render();
|
||||
|
||||
if(0 != SDL_RenderCopy(mainRenderer, screenTexture, nullptr, nullptr))
|
||||
logGlobal->errorStream() << __FUNCTION__ << " SDL_RenderCopy " << SDL_GetError();
|
||||
logGlobal->error("%s SDL_RenderCopy %s", __FUNCTION__, SDL_GetError());
|
||||
|
||||
SDL_RenderPresent(mainRenderer);
|
||||
}
|
||||
|
@ -26,11 +26,11 @@ void SDL_UpdateRect(SDL_Surface *surface, int x, int y, int w, int h)
|
||||
{
|
||||
Rect rect(x,y,w,h);
|
||||
if(0 !=SDL_UpdateTexture(screenTexture, &rect, surface->pixels, surface->pitch))
|
||||
logGlobal->errorStream() << __FUNCTION__ << "SDL_UpdateTexture " << SDL_GetError();
|
||||
logGlobal->error("%sSDL_UpdateTexture %s", __FUNCTION__, SDL_GetError());
|
||||
|
||||
SDL_RenderClear(mainRenderer);
|
||||
if(0 != SDL_RenderCopy(mainRenderer, screenTexture, NULL, NULL))
|
||||
logGlobal->errorStream() << __FUNCTION__ << "SDL_RenderCopy " << SDL_GetError();
|
||||
logGlobal->error("%sSDL_RenderCopy %s", __FUNCTION__, SDL_GetError());
|
||||
SDL_RenderPresent(mainRenderer);
|
||||
|
||||
}
|
||||
@ -326,7 +326,7 @@ int CSDL_Ext::blit8bppAlphaTo24bpp(const SDL_Surface * src, const SDL_Rect * src
|
||||
case 3: return blit8bppAlphaTo24bppT<3>(src, srcRect, dst, dstRect);
|
||||
case 4: return blit8bppAlphaTo24bppT<4>(src, srcRect, dst, dstRect);
|
||||
default:
|
||||
logGlobal->errorStream() << (int)dst->format->BitsPerPixel << " bpp is not supported!!!";
|
||||
logGlobal->error("%d bpp is not supported!", (int)dst->format->BitsPerPixel);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -349,7 +349,7 @@ void CSDL_Ext::update(SDL_Surface * what)
|
||||
if(!what)
|
||||
return;
|
||||
if(0 !=SDL_UpdateTexture(screenTexture, nullptr, what->pixels, what->pitch))
|
||||
logGlobal->errorStream() << __FUNCTION__ << "SDL_UpdateTexture " << SDL_GetError();
|
||||
logGlobal->error("%s SDL_UpdateTexture %s", __FUNCTION__, SDL_GetError());
|
||||
}
|
||||
void CSDL_Ext::drawBorder(SDL_Surface * sur, int x, int y, int w, int h, const int3 &color)
|
||||
{
|
||||
@ -428,7 +428,7 @@ case BytesPerPixel: \
|
||||
CASE_BPP(3)
|
||||
CASE_BPP(4)
|
||||
default:
|
||||
logGlobal->errorStream() << (int)dest->format->BitsPerPixel << "bpp is not supported!";
|
||||
logGlobal->error("%d bpp is not supported!", (int)dest->format->BitsPerPixel);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -442,7 +442,7 @@ TColorPutterAlpha CSDL_Ext::getPutterAlphaFor(SDL_Surface * const &dest, int inc
|
||||
CASE_BPP(3)
|
||||
CASE_BPP(4)
|
||||
default:
|
||||
logGlobal->errorStream() << (int)dest->format->BitsPerPixel << "bpp is not supported!";
|
||||
logGlobal->error("%d bpp is not supported!", (int)dest->format->BitsPerPixel);
|
||||
return nullptr;
|
||||
}
|
||||
#undef CASE_BPP
|
||||
|
@ -755,7 +755,7 @@ void CMapHandler::CMapBlitter::drawObjects(SDL_Surface * targetSurf, const Terra
|
||||
fade->draw(targetSurf, nullptr, &r2);
|
||||
continue;
|
||||
}
|
||||
logGlobal->errorStream() << "Fading map object with missing fade anim : " << object.fadeAnimKey;
|
||||
logGlobal->error("Fading map object with missing fade anim : %d", object.fadeAnimKey);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -967,7 +967,7 @@ CMapHandler::AnimBitmapHolder CMapHandler::CMapBlitter::findHeroBitmap(const CGH
|
||||
{
|
||||
if(hero->tempOwner >= PlayerColor::PLAYER_LIMIT) //Neutral hero?
|
||||
{
|
||||
logGlobal->errorStream() << "A neutral hero (" << hero->name << ") at " << hero->pos << ". Should not happen!";
|
||||
logGlobal->error("A neutral hero (%s) at %s. Should not happen!", hero->name, hero->pos());
|
||||
return CMapHandler::AnimBitmapHolder();
|
||||
}
|
||||
|
||||
@ -1025,7 +1025,7 @@ IImage * CMapHandler::CMapBlitter::findBoatFlagBitmap(const CGBoat * boat, int a
|
||||
int boatType = boat->subID;
|
||||
if(boatType < 0 || boatType >= graphics->boatFlagAnimations.size())
|
||||
{
|
||||
logGlobal->errorStream() << "Not supported boat subtype: " << boat->subID;
|
||||
logGlobal->error("Not supported boat subtype: %d", boat->subID);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -1035,7 +1035,7 @@ IImage * CMapHandler::CMapBlitter::findBoatFlagBitmap(const CGBoat * boat, int a
|
||||
|
||||
if(colorIndex < 0 || colorIndex >= subtypeFlags.size())
|
||||
{
|
||||
logGlobal->errorStream() << "Invalid player color " << colorIndex;
|
||||
logGlobal->error("Invalid player color %d", colorIndex);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -1138,7 +1138,7 @@ bool CMapHandler::updateObjectsFade()
|
||||
{
|
||||
if ((*objIter).fadeAnimKey == (*iter).first)
|
||||
{
|
||||
logAnim->traceStream() << "Fade anim finished for obj at " << pos << "; remaining: " << (fadeAnims.size() - 1);
|
||||
logAnim->trace("Fade anim finished for obj at %s; remaining: %d", pos(), fadeAnims.size() - 1);
|
||||
if (anim->fadingMode == CFadeAnimation::EMode::OUT)
|
||||
objs.erase(objIter); // if this was fadeout, remove the object from the map
|
||||
else
|
||||
@ -1185,8 +1185,7 @@ bool CMapHandler::startObjectFade(TerrainTileObject & obj, bool in, int3 pos)
|
||||
fadeAnims[++fadeAnimCounter] = std::pair<int3, CFadeAnimation*>(pos, anim);
|
||||
obj.fadeAnimKey = fadeAnimCounter;
|
||||
|
||||
logAnim->traceStream() << "Fade anim started for obj " << obj.obj->ID
|
||||
<< " at " << pos << "; anim count: " << fadeAnims.size();
|
||||
logAnim->trace("Fade anim started for obj %d at %s; anim count: %d", obj.obj->ID, pos(), fadeAnims.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -503,7 +503,7 @@ std::map<int, std::pair<SDL_Color, SDL_Color> > CMinimap::loadColors(std::string
|
||||
auto index = boost::find(GameConstants::TERRAIN_NAMES, m.first);
|
||||
if (index == std::end(GameConstants::TERRAIN_NAMES))
|
||||
{
|
||||
logGlobal->errorStream() << "Error: unknown terrain in terrains.json: " << m.first;
|
||||
logGlobal->error("Error: unknown terrain in terrains.json: %s", m.first);
|
||||
continue;
|
||||
}
|
||||
int terrainID = index - std::begin(GameConstants::TERRAIN_NAMES);
|
||||
|
@ -117,12 +117,12 @@ void CButton::block(bool on)
|
||||
void CButton::onButtonClicked()
|
||||
{
|
||||
// debug logging to figure out pressed button (and as result - player actions) in case of crash
|
||||
logAnim->traceStream() << "Button clicked at " << pos.x << "x" << pos.y;
|
||||
logAnim->trace("Button clicked at %dx%d", pos.x, pos.y);
|
||||
CIntObject * parent = this->parent;
|
||||
std::string prefix = "Parent is";
|
||||
while (parent)
|
||||
{
|
||||
logAnim->traceStream() << prefix << typeid(*parent).name() << " at " << parent->pos.x << "x" << parent->pos.y;
|
||||
logAnim->trace("%s%s at %dx%d", prefix, typeid(*parent).name(), parent->pos.x, parent->pos.y);
|
||||
parent = parent->parent;
|
||||
prefix = '\t' + prefix;
|
||||
}
|
||||
|
@ -229,11 +229,7 @@ bool CHeroArtPlace::askToAssemble(const CArtifactInstance *art, ArtifactPosition
|
||||
0);
|
||||
|
||||
if(assemblyPossibilities.size() > 2)
|
||||
{
|
||||
logGlobal->warnStream() << boost::format(
|
||||
"More than one possibility of assembling on %s... taking only first")
|
||||
% art->artType->Name();
|
||||
}
|
||||
logGlobal->warn("More than one possibility of assembling on %s... taking only first", art->artType->Name());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -821,7 +817,7 @@ CHeroArtPlace * CArtifactsOfHero::getArtPlace(int slot)
|
||||
{
|
||||
if(artWorn.find(ArtifactPosition(slot)) == artWorn.end())
|
||||
{
|
||||
logGlobal->errorStream() << "CArtifactsOfHero::getArtPlace: invalid slot " << slot;
|
||||
logGlobal->error("CArtifactsOfHero::getArtPlace: invalid slot %d", slot);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ void CGarrisonSlot::hover (bool on)
|
||||
}
|
||||
else
|
||||
{
|
||||
logGlobal->warnStream() << "Warning - shouldn't be - highlighted void slot "<<owner->getSelection();
|
||||
logGlobal->warn("Warning - shouldn't be - highlighted void slot %d", owner->getSelection()->ID.getNum());
|
||||
logGlobal->warn("Highlighted set to nullptr");
|
||||
owner->selectSlot(nullptr);
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ void CAnimImage::setFrame(size_t Frame, size_t Group)
|
||||
}
|
||||
}
|
||||
else
|
||||
logGlobal->errorStream() << "Error: accessing unavailable frame " << Group << ":" << Frame << " in CAnimation!";
|
||||
logGlobal->error("Error: accessing unavailable frame %d:%d in CAnimation!", Group, Frame);
|
||||
}
|
||||
|
||||
void CAnimImage::playerColored(PlayerColor currPlayer)
|
||||
|
@ -234,7 +234,7 @@ void CArmyTooltip::init(const InfoAboutArmy &army)
|
||||
{
|
||||
if(slot.first.getNum() >= GameConstants::ARMY_SIZE)
|
||||
{
|
||||
logGlobal->warnStream() << "Warning: " << army.name << " has stack in slot " << slot.first;
|
||||
logGlobal->warn("%s has stack in slot %d", army.name, slot.first.getNum());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -592,7 +592,7 @@ void CTextInput::numberFilter(std::string & text, const std::string & oldText, i
|
||||
catch(boost::bad_lexical_cast &)
|
||||
{
|
||||
//Should never happen. Unless I missed some cases
|
||||
logGlobal->warnStream() << "Warning: failed to convert "<< text << " to number!";
|
||||
logGlobal->warn("Warning: failed to convert %s to number!", text);
|
||||
text = oldText;
|
||||
}
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ int3 CTerrainRect::tileCountOnScreen()
|
||||
switch (adventureInt->mode)
|
||||
{
|
||||
default:
|
||||
logGlobal->errorStream() << "Unhandled map mode " << (int)adventureInt->mode;
|
||||
logGlobal->error("Unknown map mode %d", (int)adventureInt->mode);
|
||||
return int3();
|
||||
case EAdvMapMode::NORMAL:
|
||||
return int3(tilesw, tilesh, 1);
|
||||
|
@ -229,7 +229,7 @@ std::string CBuildingRect::getSubtitle()//hover text for building
|
||||
}
|
||||
else
|
||||
{
|
||||
logGlobal->warnStream() << "Problem: dwelling with id " << bid << " offers no creatures!";
|
||||
logGlobal->warn("Dwelling with id %d offers no creatures!", bid);
|
||||
return "#ERROR#";
|
||||
}
|
||||
}
|
||||
@ -600,7 +600,7 @@ const CGHeroInstance* CCastleBuildings::getHero()
|
||||
|
||||
void CCastleBuildings::buildingClicked(BuildingID building)
|
||||
{
|
||||
logGlobal->traceStream()<<"You've clicked on "<<building;
|
||||
logGlobal->trace("You've clicked on %d", (int)building.toEnum());
|
||||
const CBuilding *b = town->town->buildings.find(building)->second;
|
||||
|
||||
if(building >= BuildingID::DWELL_FIRST)
|
||||
@ -1183,7 +1183,7 @@ void CCastleInterface::keyPressed( const SDL_KeyboardEvent & key )
|
||||
for(const CStructure * str : town->town->clientInfo.structures)
|
||||
{
|
||||
if (str->building)
|
||||
logGlobal->errorStream() << int(str->building->bid) << " -> " << int(str->pos.z);
|
||||
logGlobal->error("%d -> %d", int(str->building->bid), int(str->pos.z));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1199,7 +1199,7 @@ void CCastleInterface::keyPressed( const SDL_KeyboardEvent & key )
|
||||
for(const CStructure * str : town->town->clientInfo.structures)
|
||||
{
|
||||
if (str->building)
|
||||
logGlobal->errorStream() << int(str->building->bid) << " -> " << int(str->pos.z);
|
||||
logGlobal->error("%d -> %d", int(str->building->bid), int(str->pos.z));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -92,11 +92,18 @@ BattleAction BattleAction::makeEndOFTacticPhase(ui8 side)
|
||||
return ba;
|
||||
}
|
||||
|
||||
std::ostream & operator<<(std::ostream & os, const BattleAction & ba)
|
||||
std::string BattleAction::toString() const
|
||||
{
|
||||
std::stringstream actionTypeStream;
|
||||
actionTypeStream << ba.actionType;
|
||||
actionTypeStream << actionType;
|
||||
|
||||
return os << boost::str(boost::format("{BattleAction: side '%d', stackNumber '%d', actionType '%s', destinationTile '%s', additionalInfo '%d', selectedStack '%d'}")
|
||||
% static_cast<int>(ba.side) % ba.stackNumber % actionTypeStream.str() % ba.destinationTile % ba.additionalInfo % ba.selectedStack);
|
||||
boost::format fmt("{BattleAction: side '%d', stackNumber '%d', actionType '%s', destinationTile '%s', additionalInfo '%d', selectedStack '%d'}");
|
||||
fmt % static_cast<int>(side) % stackNumber % actionTypeStream.str() % destinationTile % additionalInfo % selectedStack;
|
||||
return fmt.str();
|
||||
}
|
||||
|
||||
std::ostream & operator<<(std::ostream & os, const BattleAction & ba)
|
||||
{
|
||||
os << ba.toString();
|
||||
return os;
|
||||
}
|
||||
|
@ -42,6 +42,8 @@ struct DLL_LINKAGE BattleAction
|
||||
static BattleAction makeShotAttack(const CStack * shooter, const CStack * target);
|
||||
static BattleAction makeMove(const CStack * stack, BattleHex dest);
|
||||
static BattleAction makeEndOFTacticPhase(ui8 side);
|
||||
|
||||
std::string toString() const;
|
||||
};
|
||||
|
||||
DLL_EXPORT std::ostream & operator<<(std::ostream & os, const BattleAction & ba);
|
||||
DLL_EXPORT std::ostream & operator<<(std::ostream & os, const BattleAction & ba); //todo: remove
|
||||
|
@ -45,7 +45,7 @@ CArchiveLoader::CArchiveLoader(std::string _mountPoint, boost::filesystem::path
|
||||
else
|
||||
throw std::runtime_error("LOD archive format unknown. Cannot deal with " + archive.string());
|
||||
|
||||
logGlobal->traceStream() << ext << "Archive \""<<archive.filename()<<"\" loaded (" << entries.size() << " files found).";
|
||||
logGlobal->trace("%sArchive \"%s\" loaded (%d files found).", ext, archive.filename(), entries.size());
|
||||
}
|
||||
|
||||
void CArchiveLoader::initLODArchive(const std::string &mountPoint, CFileInputStream & fileStream)
|
||||
|
Loading…
Reference in New Issue
Block a user