Replace all print calls with vlog calls

This is pretty straight-forward to do.
This commit is contained in:
Misa
2021-02-23 15:21:29 -08:00
committed by Misa Elizabeth Kai
parent d9737589de
commit 96539f891c
16 changed files with 213 additions and 203 deletions

View File

@@ -2,7 +2,6 @@
#include "Game.h"
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tinyxml2.h>
@@ -21,6 +20,7 @@
#include "Network.h"
#include "Script.h"
#include "UtilityClass.h"
#include "Vlogging.h"
#include "XMLUtils.h"
static bool GetButtonFromString(const char *pText, SDL_GameControllerButton *button)
@@ -273,7 +273,7 @@ void Game::init(void)
if (!FILESYSTEM_loadTiXml2Document("saves/qsave.vvv", doc))
{
quicksummary = "";
printf("Quick Save Not Found\n");
vlog_info("Quick Save Not Found");
}
else
{
@@ -284,7 +284,7 @@ void Game::init(void)
pElem=hDoc.FirstChildElement().ToElement();
if (!pElem)
{
printf("Quick Save Appears Corrupted: No XML Root\n");
vlog_error("Quick Save Appears Corrupted: No XML Root");
}
// save this for later
@@ -314,7 +314,7 @@ void Game::init(void)
if (!FILESYSTEM_loadTiXml2Document("saves/tsave.vvv", docTele))
{
telesummary = "";
printf("Teleporter Save Not Found\n");
vlog_info("Teleporter Save Not Found");
}
else
{
@@ -328,7 +328,7 @@ void Game::init(void)
// should always have a valid root but handle gracefully if it does
if (!pElem)
{
printf("Teleporter Save Appears Corrupted: No XML Root\n");
vlog_error("Teleporter Save Appears Corrupted: No XML Root");
}
// save this for later
@@ -462,7 +462,7 @@ void Game::deletecustomlevelstats(void)
if (!FILESYSTEM_delete("saves/levelstats.vvv"))
{
puts("Error deleting levelstats.vvv");
vlog_error("Error deleting levelstats.vvv");
}
}
@@ -513,7 +513,7 @@ void Game::loadcustomlevelstats(void)
// should always have a valid root but handle gracefully if it does
if (!pElem)
{
printf("Error: Levelstats file corrupted\n");
vlog_error("Error: Levelstats file corrupted");
}
// save this for later
@@ -605,7 +605,7 @@ void Game::savecustomlevelstats(void)
bool already_exists = FILESYSTEM_loadTiXml2Document("saves/levelstats.vvv", doc);
if (!already_exists)
{
puts("No levelstats.vvv found. Creating new file");
vlog_info("No levelstats.vvv found. Creating new file");
}
xml::update_declaration(doc);
@@ -650,12 +650,12 @@ void Game::savecustomlevelstats(void)
if(FILESYSTEM_saveTiXml2Document("saves/levelstats.vvv", doc))
{
printf("Level stats saved\n");
vlog_info("Level stats saved");
}
else
{
printf("Could Not Save level stats!\n");
printf("Failed: %s%s\n", saveFilePath, "levelstats.vvv");
vlog_error("Could Not Save level stats!");
vlog_error("Failed: %s%s", saveFilePath, "levelstats.vvv");
}
}
@@ -3983,7 +3983,7 @@ void Game::deletestats(void)
{
if (!FILESYSTEM_delete("saves/unlock.vvv"))
{
puts("Error deleting saves/unlock.vvv");
vlog_error("Error deleting saves/unlock.vvv");
}
else
{
@@ -4011,7 +4011,7 @@ void Game::deletesettings(void)
{
if (!FILESYSTEM_delete("saves/settings.vvv"))
{
puts("Error deleting saves/settings.vvv");
vlog_error("Error deleting saves/settings.vvv");
}
}
@@ -4038,7 +4038,7 @@ void Game::loadstats(ScreenSettings* screen_settings)
// and we don't want to overwrite that!
savestats(screen_settings);
printf("No Stats found. Assuming a new player\n");
vlog_info("No Stats found. Assuming a new player");
}
tinyxml2::XMLHandle hDoc(&doc);
@@ -4357,7 +4357,7 @@ bool Game::savestats(const ScreenSettings* screen_settings)
bool already_exists = FILESYSTEM_loadTiXml2Document("saves/unlock.vvv", doc);
if (!already_exists)
{
puts("No unlock.vvv found. Creating new file");
vlog_info("No unlock.vvv found. Creating new file");
}
xml::update_declaration(doc);
@@ -4582,7 +4582,7 @@ void Game::loadsettings(ScreenSettings* screen_settings)
if (!FILESYSTEM_loadTiXml2Document("saves/settings.vvv", doc))
{
savesettings(screen_settings);
puts("No settings.vvv found");
vlog_info("No settings.vvv found");
}
tinyxml2::XMLHandle hDoc(&doc);
@@ -4625,7 +4625,7 @@ bool Game::savesettings(const ScreenSettings* screen_settings)
bool already_exists = FILESYSTEM_loadTiXml2Document("saves/settings.vvv", doc);
if (!already_exists)
{
puts("No settings.vvv found. Creating new file");
vlog_info("No settings.vvv found. Creating new file");
}
xml::update_declaration(doc);
@@ -4876,7 +4876,7 @@ void Game::readmaingamesave(tinyxml2::XMLDocument& doc)
// should always have a valid root but handle gracefully if it does
if (!pElem)
{
printf("Save Not Found\n");
vlog_error("Save Not Found");
}
// save this for later
@@ -5055,7 +5055,7 @@ void Game::customloadquick(std::string savfile)
// should always have a valid root but handle gracefully if it does
if (!pElem)
{
printf("Save Not Found\n");
vlog_error("Save Not Found");
}
// save this for later
@@ -5238,7 +5238,7 @@ void Game::loadsummary(void)
// should always have a valid root but handle gracefully if it does
if (!pElem)
{
printf("Save Not Found\n");
vlog_error("Save Not Found");
}
// save this for later
@@ -5320,7 +5320,7 @@ void Game::loadsummary(void)
// should always have a valid root but handle gracefully if it does
if (!pElem)
{
printf("Save Not Found\n");
vlog_error("Save Not Found");
}
// save this for later
@@ -5416,17 +5416,17 @@ bool Game::savetele(void)
bool already_exists = FILESYSTEM_loadTiXml2Document("saves/tsave.vvv", doc);
if (!already_exists)
{
puts("No tsave.vvv found. Creating new file");
vlog_info("No tsave.vvv found. Creating new file");
}
telesummary = writemaingamesave(doc);
if(!FILESYSTEM_saveTiXml2Document("saves/tsave.vvv", doc))
{
printf("Could Not Save game!\n");
printf("Failed: %s%s\n", saveFilePath, "tsave.vvv");
vlog_error("Could Not Save game!");
vlog_error("Failed: %s%s", saveFilePath, "tsave.vvv");
return false;
}
printf("Game saved\n");
vlog_info("Game saved");
return true;
}
@@ -5443,17 +5443,17 @@ bool Game::savequick(void)
bool already_exists = FILESYSTEM_loadTiXml2Document("saves/qsave.vvv", doc);
if (!already_exists)
{
puts("No qsave.vvv found. Creating new file");
vlog_info("No qsave.vvv found. Creating new file");
}
quicksummary = writemaingamesave(doc);
if(!FILESYSTEM_saveTiXml2Document("saves/qsave.vvv", doc))
{
printf("Could Not Save game!\n");
printf("Failed: %s%s\n", saveFilePath, "qsave.vvv");
vlog_error("Could Not Save game!");
vlog_error("Failed: %s%s", saveFilePath, "qsave.vvv");
return false;
}
printf("Game saved\n");
vlog_info("Game saved");
return true;
}
@@ -5580,7 +5580,7 @@ bool Game::customsavequick(std::string savfile)
bool already_exists = FILESYSTEM_loadTiXml2Document(("saves/" + levelfile + ".vvv").c_str(), doc);
if (!already_exists)
{
printf("No %s.vvv found. Creating new file\n", levelfile.c_str());
vlog_info("No %s.vvv found. Creating new file", levelfile.c_str());
}
xml::update_declaration(doc);
@@ -5703,11 +5703,11 @@ bool Game::customsavequick(std::string savfile)
if(!FILESYSTEM_saveTiXml2Document(("saves/"+levelfile+".vvv").c_str(), doc))
{
printf("Could Not Save game!\n");
printf("Failed: %s%s%s\n", saveFilePath, levelfile.c_str(), ".vvv");
vlog_error("Could Not Save game!");
vlog_error("Failed: %s%s%s", saveFilePath, levelfile.c_str(), ".vvv");
return false;
}
printf("Game saved\n");
vlog_info("Game saved");
return true;
}
@@ -5848,7 +5848,7 @@ void Game::returnmenu(void)
{
if (menustack.empty())
{
puts("Error: returning to previous menu frame on empty stack!");
vlog_error("Error: returning to previous menu frame on empty stack!");
return;
}
@@ -6541,7 +6541,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
void Game::deletequick(void)
{
if( !FILESYSTEM_delete( "saves/qsave.vvv" ) )
puts("Error deleting saves/qsave.vvv");
vlog_error("Error deleting saves/qsave.vvv");
else
quicksummary = "";
}
@@ -6549,7 +6549,7 @@ void Game::deletequick(void)
void Game::deletetele(void)
{
if( !FILESYSTEM_delete( "saves/tsave.vvv" ) )
puts("Error deleting saves/tsave.vvv");
vlog_error("Error deleting saves/tsave.vvv");
else
telesummary = "";
}
@@ -6560,7 +6560,7 @@ void Game::customdeletequick(const std::string& file)
if (!FILESYSTEM_delete(path.c_str()))
{
printf("Error deleting %s\n", path.c_str());
vlog_error("Error deleting %s", path.c_str());
}
}