commit 161a010c
Removed std::endl as it is not part of C++ Core
Changed files
diff --git a/source/code/BlockGame.cpp b/source/code/BlockGame.cpp
index a883b32..b723c77 100644
--- a/source/code/BlockGame.cpp
+++ b/source/code/BlockGame.cpp
@@ -39,7 +39,6 @@ http://blockattack.net
using std::string;
using std::stringstream;
using std::cerr;
-using std::endl;
using std::vector;
@@ -1041,7 +1040,7 @@ int BlockGame::FallBlock(int x, int y, int number) {
i++;
}
if (canFall) {
- //cout << "Now falling" << endl;
+ //cout << "Now falling" << "\n";
for (int j = x; j<i; j++) {
board[j][y-1] = board[j][y];
board[j][y] = -1;
@@ -1231,7 +1230,7 @@ void BlockGame::FindTowerHeight() {
///////////////////////////////////////////////////////////////////////////
//First the helpet functions:
int BlockGame::nrOfType(int line, int type) {
- // cout << "Start_ nrOfType" << endl;
+ // cout << "Start_ nrOfType" << "\n";
int counter = 0;
for (int i=0; i<6; i++)
if (board[i][line]==type) {
@@ -1243,7 +1242,7 @@ int BlockGame::nrOfType(int line, int type) {
//See if a combo can be made in this line
int BlockGame::horiInLine(int line) {
- //cout << "Start_ hori in line" << endl;
+ //cout << "Start_ hori in line" << "\n";
int nrOfType[7] = {0, 0, 0, 0, 0, 0, 0};
int iTemp;
int max = 0;
@@ -1263,7 +1262,7 @@ int BlockGame::horiInLine(int line) {
}
bool BlockGame::horiClearPossible() {
- //cout << "Start_ horiclear possible" << endl;
+ //cout << "Start_ horiclear possible" << "\n";
int i=13;
bool solutionFound = false;
do {
@@ -1290,7 +1289,7 @@ bool BlockGame::lineHasGarbage(int line) {
//Types 0..6 in line
int BlockGame::nrOfRealTypes(int line) {
- //cout << "Start_ nrOfReal" << endl;
+ //cout << "Start_ nrOfReal" << "\n";
int counter = 0;
for (int i=0; i<6; i++) {
if ((board[i][line]>-1)&&(board[i][line]<7)) {
@@ -1302,7 +1301,7 @@ int BlockGame::nrOfRealTypes(int line) {
//See if there is a tower
bool BlockGame::ThereIsATower() {
- //cout << "Start_ there is a tower" << endl;
+ //cout << "Start_ there is a tower" << "\n";
bool bThereIsATower = false; //Unless proven otherwise!
bool topReached = false; //If we have reached the top
int lineNumber = 0;
@@ -1332,13 +1331,13 @@ bool BlockGame::ThereIsATower() {
}
while ((!bThereIsATower)&&(!topReached));
//if(bThereIsATower)
- //cout << "There is actually a tower" << endl;
+ //cout << "There is actually a tower" << "\n";
return bThereIsATower;
}
double BlockGame::firstInLine1(int line) {
if (line > 20 || line < 0) {
- cerr << "Warning: first in Line1: " << line << endl;
+ cerr << "Warning: first in Line1: " << line << "\n";
return 3.0;
}
for (int i=0; i<6; i++) {
@@ -1352,7 +1351,7 @@ double BlockGame::firstInLine1(int line) {
//returns the first coordinate of the block of type
double BlockGame::firstInLine(int line, int type) {
if (line > 20 || line < 0) {
- cerr << "Warning: first in Line: " << line << endl;
+ cerr << "Warning: first in Line: " << line << "\n";
return 3.0;
}
for (int i=0; i<6; i++)
@@ -1378,7 +1377,7 @@ int BlockGame::closestTo(int line, int place) {
//The AI will remove a tower
void BlockGame::AI_ClearTower() {
- // cout << "AI: ClearTower, line: " << AIlineToClear << endl;
+ // cout << "AI: ClearTower, line: " << AIlineToClear << "\n";
int place = (int)firstInLine(AIlineToClear-1, -1); //Find an empty field to frop a brick into
int xplace = closestTo(AIlineToClear, place); //Find the brick to drop in it
if (cursory+1<AIlineToClear) {
@@ -1473,7 +1472,7 @@ void BlockGame::AI_ClearHori() {
else {
AIstatus = 0;
}
- //cout << endl; //for debugging
+ //cout << "\n"; //for debugging
}
//Test if vertical clear is possible
@@ -1519,14 +1518,14 @@ void BlockGame::AI_ClearVertical() {
int placeToCenter = (int)(firstInLine(AIlineToClear, AIcolorToClear)/3.0+firstInLine(AIlineToClear+1, AIcolorToClear)/3.0+firstInLine(AIlineToClear+2, AIcolorToClear)/3.0);
int unlimitedLoop=0;
if (AIlineToClear < 0 || AIlineToClear > 20) {
- cerr << "AIlineToClear out of range: " << AIlineToClear << endl;
+ cerr << "AIlineToClear out of range: " << AIlineToClear << "\n";
return;
}
if (placeToCenter<0 || placeToCenter > 5) {
- cerr << "placeToCenter out of range: " << placeToCenter << endl;
+ cerr << "placeToCenter out of range: " << placeToCenter << "\n";
return;
}
- //cout << "AI_ClearVertical: " << placeToCenter << ", " << AIlineToClear << endl;
+ //cout << "AI_ClearVertical: " << placeToCenter << ", " << AIlineToClear << "\n";
while (((board[placeToCenter][AIlineToClear]>1000000)||(board[placeToCenter][AIlineToClear+1]>1000000)||(board[placeToCenter][AIlineToClear+2]>1000000))&&(unlimitedLoop<10)) {
unlimitedLoop++;
placeToCenter++;
@@ -1617,7 +1616,7 @@ void BlockGame::AI_ClearVertical() {
if ((nrOfType(AIlineToClear, AIcolorToClear)==0)||(nrOfType(AIlineToClear+1, AIcolorToClear)==0)||(nrOfType(AIlineToClear+2, AIcolorToClear)==0)) {
AIstatus = 0;
}
- //cout << endl;
+ //cout << "\n";
}
diff --git a/source/code/MenuSystem.cpp b/source/code/MenuSystem.cpp
index 1f261cf..4929569 100644
--- a/source/code/MenuSystem.cpp
+++ b/source/code/MenuSystem.cpp
@@ -33,7 +33,6 @@ static int mousey;
using std::string;
using std::cerr;
using std::cout;
-using std::endl;
using std::vector;
@@ -45,7 +44,7 @@ void ButtonGfx::setSurfaces(sago::SagoSprite* marked, sago::SagoSprite* unmarked
xsize=(marked)->GetWidth();
ysize=(marked)->GetHeight();
if (verboseLevel) {
- cout << "Surfaces set, size: " <<xsize << " , " << ysize << endl;
+ cout << "Surfaces set, size: " <<xsize << " , " << ysize << "\n";
}
}
@@ -93,7 +92,7 @@ void Button::doAction() {
void Button::drawToScreen() {
#if DEBUG
- //cout << "Painting button: " << label << " at: " << x << "," << y << endl;
+ //cout << "Painting button: " << label << " at: " << x << "," << y << "\n";
#endif
if (marked) {
gfx->marked->Draw(screen, SDL_GetTicks(), x, y);
diff --git a/source/code/ReadKeyboard.cpp b/source/code/ReadKeyboard.cpp
index 6aa1f35..3692aca 100644
--- a/source/code/ReadKeyboard.cpp
+++ b/source/code/ReadKeyboard.cpp
@@ -27,7 +27,6 @@ http://blockattack.net
using std::string;
using std::cerr;
-using std::endl;
ReadKeyboard::ReadKeyboard(void) {
maxLength = 16;
diff --git a/source/code/ScoresDisplay.cpp b/source/code/ScoresDisplay.cpp
index 73a6258..443551d 100644
--- a/source/code/ScoresDisplay.cpp
+++ b/source/code/ScoresDisplay.cpp
@@ -29,7 +29,6 @@ http://www.blockattack.net
using std::string;
using std::cerr;
-using std::endl;
using std::vector;
static void NFont_Write(SDL_Renderer* target, int x, int y, const char* text) {
diff --git a/source/code/common.cpp b/source/code/common.cpp
index 5cf51d6..e1dc6cb 100644
--- a/source/code/common.cpp
+++ b/source/code/common.cpp
@@ -32,7 +32,6 @@ http://www.blockattack.net
using std::string;
using std::stringstream;
using std::cerr;
-using std::endl;
using std::map;
using std::vector;
using boost::format;
@@ -195,7 +194,7 @@ void Config::load() {
inFile.get(); //Read the space between the key and the content
inFile.getline(value,MAX_VAR_LENGTH);
#if DEBUG
- cerr << "Config read: " << key << " with:\"" << value << "\"" << endl;
+ cerr << "Config read: " << key << " with:\"" << value << "\"" << "\n";
#endif
configMap[key] = (string)value;
}
@@ -214,7 +213,7 @@ void Config::save() {
std::stringstream outFile;
map<string,string>::iterator iter;
for (iter = configMap.begin(); iter != configMap.end(); iter++) {
- outFile << iter->first << " " << iter->second << endl;
+ outFile << iter->first << " " << iter->second << "\n";
}
outFile << "\n"; //The last entry in the file will be read double if a linebreak is missing
//This is checked on load too in case a user changes it himself.
diff --git a/source/code/gamecontroller.cpp b/source/code/gamecontroller.cpp
index 7dbc463..0e05d9e 100644
--- a/source/code/gamecontroller.cpp
+++ b/source/code/gamecontroller.cpp
@@ -74,7 +74,7 @@ static int GetNextPlayerByGui(const SDL_JoystickGUID& guid) {
Config::getInstance()->setDefault(configName, "1");
int player = Config::getInstance()->getInt(configName) + gamecontrollers_assigned[guidAsHex];
gamecontrollers_assigned[guidAsHex]++; //Next controller with same guid should be assigned to different player.
- //std::cout << "Guid: " << guidAsHex << std::endl;
+ //std::cout << "Guid: " << guidAsHex << "\n";
if (player%2==0) {
return 2; //Even number means player 2
@@ -86,10 +86,10 @@ void InitGameControllers() {
std::string configFile = sago::getConfigHome()+"/blockattack/gamecontrollerdb.txt";
int errorCode = SDL_GameControllerAddMappingsFromFile(configFile.c_str());
if (errorCode == -1 && verbose) {
- std::cerr << "Could not load mapping file: " << configFile << std::endl;
+ std::cerr << "Could not load mapping file: " << configFile << "\n";
}
if (verbose) {
- std::cout << "Number of Game controllers: " << SDL_NumJoysticks() << std::endl;
+ std::cout << "Number of Game controllers: " << SDL_NumJoysticks() << "\n";
}
SDL_GameController* controller = nullptr;
for (int i = 0; i < SDL_NumJoysticks(); ++i) {
@@ -101,8 +101,8 @@ void InitGameControllers() {
int assingToPlayer = GetNextPlayerByGui(guid);
controllerStatusMap[instanceId].player = assingToPlayer;
if (verbose) {
- std::cout << "Supported game controller detected: " << GameControllerGetName(controller) << ", mapping: " << SDL_GameControllerMapping(controller) << std::endl;
- std::cout << "Assigned to player: " << controllerStatusMap[instanceId].player << std::endl;
+ std::cout << "Supported game controller detected: " << GameControllerGetName(controller) << ", mapping: " << SDL_GameControllerMapping(controller) << "\n";
+ std::cout << "Assigned to player: " << controllerStatusMap[instanceId].player << "\n";
}
}
}
diff --git a/source/code/highscore.cpp b/source/code/highscore.cpp
index a26e4a6..2da363f 100644
--- a/source/code/highscore.cpp
+++ b/source/code/highscore.cpp
@@ -64,7 +64,7 @@ Highscore::Highscore(const std::string& type) {
}
catch (cereal::Exception& e) {
std::cerr << "Failed to read highscore " << filename << " due to formatting errors. Resetting the file. Reason: " <<
- e.what() << std::endl;
+ e.what() << "\n";
table.clear();
}
}
diff --git a/source/code/main.cpp b/source/code/main.cpp
index fc3b4d8..868c7bc 100644
--- a/source/code/main.cpp
+++ b/source/code/main.cpp
@@ -83,7 +83,6 @@ http://www.blockattack.net
using std::string;
using std::cerr;
using std::cout;
-using std::endl;
using std::exception;
using std::vector;
@@ -558,7 +557,7 @@ static TextManager theTextManager;
//writeScreenShot saves the screen as a bmp file, it uses the time to get a unique filename
void writeScreenShot() {
if (verboseLevel) {
- cout << "Saving screenshot" << endl;
+ cout << "Saving screenshot" << "\n";
}
int rightNow = (int)time(nullptr);
string buf = getPathToSaveFiles() + "/screenshots/screenshot"+itoa(rightNow)+".bmp";
@@ -1170,8 +1169,8 @@ int main(int argc, char* argv[]) {
boost::program_options::notify(vm);
}
catch (exception& e) {
- cerr << e.what() << endl;
- cerr << desc << endl;
+ cerr << e.what() << "\n";
+ cerr << desc << "\n";
throw;
}
if (vm.count("bind-text-domain")) {
@@ -1187,22 +1186,22 @@ int main(int argc, char* argv[]) {
cout << SPrintStringF("Block Attack - Rise of the blocks %s\n\n"
"Block Attack - Rise of the Blocks is a puzzle/blockfall game inspired by Tetris Attack for the SNES.\n\n"
"%s\n\n", VERSION_NUMBER, "www.blockattack.net");
- cout << "Usage: "<< commandname << " [OPTION]..." << endl;
- cout << desc << endl;
- cout << "Examples:" << endl;
- cout << "\tblockattack \tStart the game normally" << endl;
- cout << "\tblockattack --nosound\tStart the game without sound. Can be used if sound problems prevents the game from starting" << endl;
- cout << endl;
- cout << "Report bugs to the issue tracker here: <https://github.com/blockattack/blockattack-game/issues>" << endl;
+ cout << "Usage: "<< commandname << " [OPTION]..." << "\n";
+ cout << desc << "\n";
+ cout << "Examples:" << "\n";
+ cout << "\tblockattack \tStart the game normally" << "\n";
+ cout << "\tblockattack --nosound\tStart the game without sound. Can be used if sound problems prevents the game from starting" << "\n";
+ cout << "\n";
+ cout << "Report bugs to the issue tracker here: <https://github.com/blockattack/blockattack-game/issues>" << "\n";
return 0;
}
if (vm.count("version")) {
- cout << "blockattack " << VERSION_NUMBER << endl;
- cout << endl;
- cout << "Copyright (C) 2005-2016 Poul Sander" << endl;
- cout << "License GPLv2+: GNU GPL version 2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html> or later <http://gnu.org/licenses/gpl.html>" << endl;
- cout << "This is free software: you are free to change and redistribute it." << endl;
- cout << "There is NO WARRANTY, to the extent permitted by law." << endl;
+ cout << "blockattack " << VERSION_NUMBER << "\n";
+ cout << "\n";
+ cout << "Copyright (C) 2005-2016 Poul Sander" << "\n";
+ cout << "License GPLv2+: GNU GPL version 2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html> or later <http://gnu.org/licenses/gpl.html>" << "\n";
+ cout << "This is free software: you are free to change and redistribute it." << "\n";
+ cout << "There is NO WARRANTY, to the extent permitted by law." << "\n";
return 0;
}
if (vm.count("nosound")) {
@@ -1219,9 +1218,9 @@ int main(int argc, char* argv[]) {
}
if (vm.count("print-search-path")) {
for (const string& s : search_paths) {
- cout << s << endl;
+ cout << s << "\n";
}
- cout << savepath << endl;
+ cout << savepath << "\n";
return 0;
}
if (vm.count("puzzle-single-level")) {
@@ -1255,7 +1254,7 @@ int main(int argc, char* argv[]) {
sago::SagoFatalErrorF("Unable to init SDL: %s", SDL_GetError());
}
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER ) != 0) {
- cerr << "Warning: Game controller failed to initialize. Reason: " << SDL_GetError() << endl;
+ cerr << "Warning: Game controller failed to initialize. Reason: " << SDL_GetError() << "\n";
}
InitGameControllers();
TTF_Init();
@@ -1269,8 +1268,8 @@ int main(int argc, char* argv[]) {
if (!NoSound) {
//If sound has not been disabled, then load the sound system
if (Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 2048) < 0) {
- cerr << "Warning: Couldn't set 44100 Hz 16-bit audio - Reason: " << SDL_GetError() << endl
- << "Sound will be disabled!" << endl;
+ cerr << "Warning: Couldn't set 44100 Hz 16-bit audio - Reason: " << SDL_GetError() << "\n"
+ << "Sound will be disabled!" << "\n";
NoSound = true; //Tries to stop all sound from playing/loading
}
}
@@ -1278,10 +1277,10 @@ int main(int argc, char* argv[]) {
if (verboseLevel) {
//Copyright notice:
- cout << "Block Attack - Rise of the Blocks (" << VERSION_NUMBER << ")" << endl << "http://www.blockattack.net" << endl << "Copyright 2004-2016 Poul Sander" << endl <<
- "A SDL2 based game (see www.libsdl.org)" << endl <<
- "The game is availeble under the GPL, see COPYING for details." << endl;
- cout << "-------------------------------------------" << endl;
+ cout << "Block Attack - Rise of the Blocks (" << VERSION_NUMBER << ")" << "\n" << "http://www.blockattack.net" << "\n" << "Copyright 2004-2016 Poul Sander" << "\n" <<
+ "A SDL2 based game (see www.libsdl.org)" << "\n" <<
+ "The game is availeble under the GPL, see COPYING for details." << "\n";
+ cout << "-------------------------------------------" << "\n";
}
@@ -1354,12 +1353,12 @@ int main(int argc, char* argv[]) {
player2name = configSettings->getString("player2name");
}
if (verboseLevel) {
- cout << "Data loaded from config file" << endl;
+ cout << "Data loaded from config file" << "\n";
}
}
else {
if (verboseLevel) {
- cout << "Unable to load options file, using default values" << endl;
+ cout << "Unable to load options file, using default values" << "\n";
}
}
@@ -1387,7 +1386,7 @@ int main(int argc, char* argv[]) {
SetSDLIcon(sdlWindow);
if (verboseLevel) {
- cout << "Images loaded" << endl;
+ cout << "Images loaded" << "\n";
}
BlockGameSdl theGame = BlockGameSdl(50,100); //creates game objects
@@ -1461,12 +1460,12 @@ int main(int argc, char* argv[]) {
commonTime ct = TimeHandler::ms2ct(SDL_GetTicks());
if (verboseLevel) {
- cout << boost::format("Block Attack - Rise of the Blocks ran for: %1% hours %2% mins and %3% secs") % ct.hours % ct.minutes % ct.seconds << endl;
+ cout << boost::format("Block Attack - Rise of the Blocks ran for: %1% hours %2% mins and %3% secs") % ct.hours % ct.minutes % ct.seconds << "\n";
}
ct = TimeHandler::addTime("totalTime",ct);
if (verboseLevel) {
- cout << "Total run time is now: " << ct.days << " days " << ct.hours << " hours " << ct.minutes << " mins and " << ct.seconds << " secs" << endl;
+ cout << "Total run time is now: " << ct.days << " days " << ct.hours << " hours " << ct.minutes << " mins and " << ct.seconds << " secs" << "\n";
}
Stats::getInstance()->save();
@@ -1522,7 +1521,7 @@ int runGame(int gametype, int level) {
//game loop
int done = 0;
if (verboseLevel) {
- cout << "Starting game loop" << endl;
+ cout << "Starting game loop" << "\n";
}
@@ -1778,7 +1777,7 @@ int runGame(int gametype, int level) {
}
}
if (event.type == SDL_MOUSEMOTION) {
- //cout << "Moved" << endl;
+ //cout << "Moved" << "\n";
bool pressed = false;
int x = 0;
int y = 0;
@@ -1845,7 +1844,7 @@ int runGame(int gametype, int level) {
mousey > ysize-bExitOffset && mousey < ysize-bExitOffset+bExitSize) {
done = 1;
}
- //cout << "Mouse x: " << mousex << ", mouse y: " << mousey << endl;
+ //cout << "Mouse x: " << mousex << ", mouse y: " << mousey << "\n";
}
//Mouse button 2:
diff --git a/source/code/menudef.cpp b/source/code/menudef.cpp
index 1cea4fc..a6f9fd2 100644
--- a/source/code/menudef.cpp
+++ b/source/code/menudef.cpp
@@ -29,13 +29,12 @@ http://blockattack.net
using std::string;
using std::cerr;
-using std::endl;
using std::vector;
#if 0
//Menu
static void PrintHi(Button* b) {
- cout << "Hi" <<endl;
+ cout << "Hi" <<"\n";
}
#endif
@@ -56,7 +55,7 @@ extern control keySettings[3];
static string getKeyName(SDL_Keycode key) {
string keyname(SDL_GetKeyName(key));
if (verboseLevel) {
- cout << key << " translated to " << keyname << endl;
+ cout << key << " translated to " << keyname << "\n";
}
return keyname;
}
diff --git a/source/code/os.cpp b/source/code/os.cpp
index ae70809..77e58ed 100644
--- a/source/code/os.cpp
+++ b/source/code/os.cpp
@@ -60,7 +60,7 @@ void OsCreateSaveFolder() {
std::string cmd = "mkdir -p '"+getPathToSaveFiles()+"/'";
int retcode = system(cmd.c_str());
if (retcode != 0) {
- std::cerr << "Failed to create: " << getPathToSaveFiles()+"/" << std::endl;
+ std::cerr << "Failed to create: " << getPathToSaveFiles()+"/" << "\n";
}
#elif defined(_WIN32)
//Now for Windows NT/2k/xp/2k3 etc.
diff --git a/source/code/puzzlehandler.cpp b/source/code/puzzlehandler.cpp
index 9653b39..ce4ba67 100644
--- a/source/code/puzzlehandler.cpp
+++ b/source/code/puzzlehandler.cpp
@@ -33,7 +33,6 @@ http://blockattack.net
using std::string;
using std::cerr;
-using std::endl;
using std::vector;
const int maxNrOfPuzzleStages = 50; //Maximum number of puzzle stages
@@ -80,7 +79,7 @@ void LoadClearData() {
archive(cereal::make_nvp("cleared", puzzleCleared));
}
catch (cereal::Exception& e) {
- std::cerr << "Failed to read \"" << puzzleSavePath << "\". File will be regenerated. Reason: " << e.what() << std::endl;
+ std::cerr << "Failed to read \"" << puzzleSavePath << "\". File will be regenerated. Reason: " << e.what() << "\n";
puzzleCleared.clear();
}
}
@@ -111,7 +110,7 @@ void PuzzleSetClear(int Level) {
/*Loads all the puzzle levels*/
int LoadPuzzleStages( ) {
if (!PHYSFS_exists(((std::string)("puzzles/"+puzzleName)).c_str())) {
- std::cerr << "Warning: File not in blockattack.data: " << ("puzzles/"+puzzleName) << endl;
+ std::cerr << "Warning: File not in blockattack.data: " << ("puzzles/"+puzzleName) << "\n";
return -1; //file doesn't exist
}
std::string fileContent = sago::GetFileContent(((std::string)("puzzles/"+puzzleName)).c_str());
diff --git a/source/code/sago/SagoDataHolder.cpp b/source/code/sago/SagoDataHolder.cpp
index 516cdef..3db057f 100644
--- a/source/code/sago/SagoDataHolder.cpp
+++ b/source/code/sago/SagoDataHolder.cpp
@@ -46,7 +46,7 @@ struct SagoDataHolder::SagoDataHolderData {
};
static void printFileWeLoad(const std::string& value) {
- std::cout << "Loading " << value << std::endl;
+ std::cout << "Loading " << value << "\n";
}
SagoDataHolder::SagoDataHolder(SDL_Renderer* renderer) {
@@ -93,7 +93,7 @@ SDL_Texture* SagoDataHolder::getTexturePtr(const std::string& textureName) const
int length_read = PHYSFS_read (myfile, m_data.get(), 1, m_size);
if (length_read != (int)m_size) {
PHYSFS_close(myfile);
- std::cerr << "Error: Curropt data file: " << path << std::endl;
+ std::cerr << "Error: Curropt data file: " << path << "\n";
return ret;
}
PHYSFS_close(myfile);
@@ -101,7 +101,7 @@ SDL_Texture* SagoDataHolder::getTexturePtr(const std::string& textureName) const
//The above might fail an return null.
if (!rw) {
PHYSFS_close(myfile);
- std::cerr << "Error. Curropt data file!" << std::endl;
+ std::cerr << "Error. Curropt data file!\n";
return NULL;
}
SDL_Surface* surface = IMG_Load_RW(rw,true);
@@ -109,7 +109,7 @@ SDL_Texture* SagoDataHolder::getTexturePtr(const std::string& textureName) const
ret = SDL_CreateTextureFromSurface(data->renderer, surface);
if (!ret) {
- std::cerr << "getTextureFailed to load " << path << std::endl;
+ std::cerr << "getTextureFailed to load " << path << "\n";
}
SDL_FreeSurface(surface);
data->textures[textureName] = ret;
@@ -126,7 +126,7 @@ TTF_Font* SagoDataHolder::getFontPtr(const std::string& fontName, int ptsize) co
printFileWeLoad(path);
}
if (!PHYSFS_exists(path.c_str())) {
- std::cerr << "getFontPtr - Font does not exists: " << path << std::endl;
+ std::cerr << "getFontPtr - Font does not exists: " << path << "\n";
return ret;
}
PHYSFS_file* myfile = PHYSFS_openRead(path.c_str());
@@ -135,7 +135,7 @@ TTF_Font* SagoDataHolder::getFontPtr(const std::string& fontName, int ptsize) co
int length_read = PHYSFS_read (myfile, m_data.get(), 1, m_size);
if (length_read != (int)m_size) {
PHYSFS_close(myfile);
- std::cerr << "Error: Curropt data file: " << path << std::endl;
+ std::cerr << "Error: Curropt data file: " << path << "\n";
return ret;
}
PHYSFS_close(myfile);
@@ -145,13 +145,13 @@ TTF_Font* SagoDataHolder::getFontPtr(const std::string& fontName, int ptsize) co
//The above might fail an return null.
if (!rw) {
PHYSFS_close(myfile);
- std::cerr << "Error: Curropt data file!" << std::endl;
+ std::cerr << "Error: Curropt data file!\n";
return ret;
}
ret = TTF_OpenFontRW(rw, SDL_FALSE, ptsize);
if (!ret) {
- std::cerr << "Error openening font: " << fontName << " because: " << TTF_GetError() << std::endl;
+ std::cerr << "Error openening font: " << fontName << " because: " << TTF_GetError() << "\n";
}
data->fonts[fontName][ptsize] = ret;
data->dataToFree.push_back(std::move(m_data));
@@ -169,7 +169,7 @@ Mix_Music* SagoDataHolder::getMusicPtr(const std::string& musicName) const {
printFileWeLoad(path);
}
if (!PHYSFS_exists(path.c_str())) {
- std::cerr << "getMusicPtr - Music file does not exists: " << path << std::endl;
+ std::cerr << "getMusicPtr - Music file does not exists: " << path << "\n";
return ret;
}
PHYSFS_file* myfile = PHYSFS_openRead(path.c_str());
@@ -178,7 +178,7 @@ Mix_Music* SagoDataHolder::getMusicPtr(const std::string& musicName) const {
int length_read = PHYSFS_read (myfile, m_data.get(), 1, m_size);
if (length_read != (int)m_size) {
PHYSFS_close(myfile);
- std::cerr << "Error: Curropt data file: " << path << std::endl;
+ std::cerr << "Error: Curropt data file: " << path << "\n";
return ret;
}
PHYSFS_close(myfile);
@@ -187,14 +187,14 @@ Mix_Music* SagoDataHolder::getMusicPtr(const std::string& musicName) const {
//The above might fail an return null.
if (!rw) {
PHYSFS_close(myfile);
- std::cerr << "Error. Curropt data file!" << std::endl;
+ std::cerr << "Error. Curropt data file!\n";
return NULL;
}
ret = Mix_LoadMUS_RW(rw, SDL_TRUE); //SDL_TRUE causes rw to be freed
if (!ret) {
- std::cerr << "getMusicPtr to load " << path << " because: " << Mix_GetError() << std::endl;
+ std::cerr << "getMusicPtr to load " << path << " because: " << Mix_GetError() << "\n";
}
data->music[musicName] = ret;
data->dataToFree.push_back(std::move(m_data));
@@ -212,7 +212,7 @@ Mix_Chunk* SagoDataHolder::getSoundPtr(const std::string& soundName) const {
printFileWeLoad(path);
}
if (!PHYSFS_exists(path.c_str())) {
- std::cerr << "getSoundPtr - Sound file does not exists: " << path << std::endl;
+ std::cerr << "getSoundPtr - Sound file does not exists: " << path << "\n";
return ret;
}
PHYSFS_file* myfile = PHYSFS_openRead(path.c_str());
@@ -221,7 +221,7 @@ Mix_Chunk* SagoDataHolder::getSoundPtr(const std::string& soundName) const {
int length_read = PHYSFS_read (myfile, m_data.get(), 1, m_size);
if (length_read != (int)m_size) {
PHYSFS_close(myfile);
- std::cerr << "Error: Curropt data file: " << path << std::endl;
+ std::cerr << "Error: Curropt data file: " << path << "\n";
return ret;
}
PHYSFS_close(myfile);
@@ -230,7 +230,7 @@ Mix_Chunk* SagoDataHolder::getSoundPtr(const std::string& soundName) const {
//The above might fail an return null.
if (!rw) {
PHYSFS_close(myfile);
- std::cerr << "Error. Curropt data file!" << std::endl;
+ std::cerr << "Error. Curropt data file!\n";
return NULL;
}
diff --git a/source/code/sago/SagoMisc.cpp b/source/code/sago/SagoMisc.cpp
index 8f2b1a2..581e750 100644
--- a/source/code/sago/SagoMisc.cpp
+++ b/source/code/sago/SagoMisc.cpp
@@ -31,7 +31,6 @@
using std::string;
using std::cerr;
-using std::endl;
using std::vector;
namespace sago {
@@ -54,7 +53,7 @@ bool FileExists(const char* filename) {
std::string GetFileContent(const char* filename) {
string ret;
if (!PHYSFS_exists(filename)) {
- cerr << "GetFileContent - File does not exists: " << filename << endl;
+ cerr << "GetFileContent - File does not exists: " << filename << "\n";
return ret;
}
PHYSFS_file* myfile = PHYSFS_openRead(filename);
@@ -65,7 +64,7 @@ std::string GetFileContent(const char* filename) {
delete [] m_data;
m_data = nullptr;
PHYSFS_close(myfile);
- cerr << "Error: Curropt data file: " << filename << endl;
+ cerr << "Error: Curropt data file: " << filename << "\n";
return ret;
}
PHYSFS_close(myfile);
@@ -78,7 +77,7 @@ std::string GetFileContent(const char* filename) {
void WriteFileContent(const char* filename, const std::string& content) {
PHYSFS_file* myfile = PHYSFS_openWrite(filename);
if (!myfile) {
- cerr << "Failed to open file for writing, " << PHYSFS_getLastError() << endl;
+ cerr << "Failed to open file for writing, " << PHYSFS_getLastError() << "\n";
return;
}
PHYSFS_write(myfile, content.c_str(), sizeof(char), content.length());
diff --git a/source/code/sago/SagoSprite.cpp b/source/code/sago/SagoSprite.cpp
index d1da53e..f275e66 100644
--- a/source/code/sago/SagoSprite.cpp
+++ b/source/code/sago/SagoSprite.cpp
@@ -62,7 +62,7 @@ SagoSprite::~SagoSprite() {
void SagoSprite::Draw(SDL_Renderer* target, Sint32 frameTime, int x, int y) const {
if (!data->tex) {
- std::cerr << "Texture is null!" << std::endl;
+ std::cerr << "Texture is null!\n";
}
SDL_Rect rect = data->imgCord;
rect.x+=rect.w*((frameTime/data->aniFrameTime)%data->aniFrames);
diff --git a/source/code/sago/SagoSpriteHolder.cpp b/source/code/sago/SagoSpriteHolder.cpp
index 1c8b543..d3383f4 100644
--- a/source/code/sago/SagoSpriteHolder.cpp
+++ b/source/code/sago/SagoSpriteHolder.cpp
@@ -42,7 +42,6 @@
using std::string;
using std::cerr;
using std::cout;
-using std::endl;
using std::vector;
namespace sago {
@@ -77,8 +76,8 @@ void SagoSpriteHolder::ReadSpriteFile(const std::string& filename) {
Json::Reader reader;
bool parsingSuccessful = reader.parse( content, root );
if ( !parsingSuccessful ) {
- cerr << "Failed to parse: " << fullfile << endl
- << reader.getFormattedErrorMessages() << endl;
+ cerr << "Failed to parse: " << fullfile << "\n"
+ << reader.getFormattedErrorMessages() << "\n";
return;
}
for (Json::Value::iterator it = root.begin(); it != root.end() ; ++it) {
@@ -110,13 +109,13 @@ void SagoSpriteHolder::ReadSprites() {
for (std::string& item : spritefiles ) {
if (boost::algorithm::ends_with(item,".sprite")) {
if (data->verbose) {
- cout << "Found " << item << endl;
+ cout << "Found " << item << "\n";
}
ReadSpriteFile(item);
}
else {
if (data->verbose) {
- cout << "Ignoreing " << item << endl;
+ cout << "Ignoreing " << item << "\n";
}
}
}
diff --git a/source/code/sago/platform_folders.cpp b/source/code/sago/platform_folders.cpp
index 4aa637d..43a4443 100644
--- a/source/code/sago/platform_folders.cpp
+++ b/source/code/sago/platform_folders.cpp
@@ -142,7 +142,7 @@ static void appendExtraFoldersTokenizer(const char* envName, const char* envValu
else {
//Unless the system is wrongly configured this should never happen... But of course some systems will be incorectly configured.
//The XDG documentation indicates that the folder should be ignored but that the program should continue.
- std::cerr << "Skipping path \"" << p << "\" in \"" << envName << "\" because it does not start with a \"/\"" << std::endl;
+ std::cerr << "Skipping path \"" << p << "\" in \"" << envName << "\" because it does not start with a \"/\"" << "\n";
}
p = strtok_r (NULL, ":", &saveptr);
}
@@ -227,7 +227,7 @@ static void PlatformFoldersAddFromFile(const std::string& filename, std::map<std
std::string key = line.substr(0, splitPos);
std::string value = line.substr(splitPos+2, line.length()-splitPos-3);
folders[key] = value;
- //std::cout << key << " : " << value << std::endl;
+ //std::cout << key << " : " << value << "\n";
}
}
diff --git a/source/code/stageclearhandler.cpp b/source/code/stageclearhandler.cpp
index 959992a..83b2ef4 100644
--- a/source/code/stageclearhandler.cpp
+++ b/source/code/stageclearhandler.cpp
@@ -56,7 +56,6 @@ Sint32 totalTime = 0;
using std::string;
using std::cerr;
-using std::endl;
using std::vector;
static void SaveStageClearStages() {
@@ -91,7 +90,7 @@ void LoadStageClearStages() {
archive(cereal::make_nvp("stages", stages));
}
catch (cereal::Exception& e) {
- std::cerr << "Failed to load file \"" << stageClearSaveName << "\". Reason: " << e.what() << std::endl;
+ std::cerr << "Failed to load file \"" << stageClearSaveName << "\". Reason: " << e.what() << "\n";
stages.clear();
}
}
diff --git a/source/code/stats.cpp b/source/code/stats.cpp
index 4be57ae..8e1f372 100644
--- a/source/code/stats.cpp
+++ b/source/code/stats.cpp
@@ -30,7 +30,6 @@ http://www.blockattack.net
using std::string;
using std::stringstream;
using std::cerr;
-using std::endl;
using std::map;
using std::vector;
@@ -70,7 +69,7 @@ void Stats::save() {
std::stringstream outFile;
map<string,unsigned int>::iterator iter;
for (iter = statMap.begin(); iter != statMap.end(); iter++) {
- outFile << iter->first << " " << iter->second << endl;
+ outFile << iter->first << " " << iter->second << "\n";
}
sago::WriteFileContent(statsFileName, outFile.str());
}