diff --git a/source/code/BlockGameSdl.inc b/source/code/BlockGameSdl.inc index 9fadf51..d64b94b 100644 --- a/source/code/BlockGameSdl.inc +++ b/source/code/BlockGameSdl.inc @@ -350,7 +350,7 @@ public: if (AI_Enabled&&(!bGameOver)) { strHolder = "AI_status: " + std::to_string(AIstatus)+ ", "+ std::to_string(AIlineToClear); //NFont_Write( 5, 5, strHolder.c_str()); - globalData.nf_standard_blue_font.draw(globalData.screen, topx+5, topy+5, "%s",strHolder.c_str()); + globalData.standard_blue_font.draw(globalData.screen, topx+5, topy+5, strHolder.c_str()); } #endif if (!bGameOver) { diff --git a/source/code/common.cpp b/source/code/common.cpp index 882aae6..cdf9940 100644 --- a/source/code/common.cpp +++ b/source/code/common.cpp @@ -157,7 +157,6 @@ void Config::load() { stringstream inFile(filecontent); string key; string previuskey; - char value[MAX_VAR_LENGTH]; if (inFile) { while (!inFile.eof()) { inFile >> key; @@ -166,11 +165,12 @@ void Config::load() { } previuskey = key; inFile.get(); //Read the space between the key and the content - inFile.getline(value,MAX_VAR_LENGTH); + std::string value; + std::getline(inFile, value); #if DEBUG cerr << "Config read: " << key << " with:\"" << value << "\"" << "\n"; #endif - configMap[key] = (string)value; + configMap[key] = value; } } } @@ -186,7 +186,7 @@ Config* Config::getInstance() { void Config::save() { std::stringstream outFile; map::iterator iter; - for (iter = configMap.begin(); iter != configMap.end(); iter++) { + for (iter = configMap.begin(); iter != configMap.end(); ++iter) { outFile << iter->first << " " << iter->second << "\n"; } outFile << "\n"; //The last entry in the file will be read double if a linebreak is missing diff --git a/source/code/main.cpp b/source/code/main.cpp index 3cb346b..5fdf55c 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp @@ -613,7 +613,7 @@ void DrawEverything(int xsize, int ysize,BlockGameSdl* theGame, BlockGameSdl* th Ticks = SDL_GetTicks(); } - globalData.nf_standard_blue_font.draw(globalData.screen, 800, 4, "%s", FPS); + globalData.standard_blue_font.draw(globalData.screen, 800, 4, FPS); #endif } diff --git a/source/code/scopeHelpers.hpp b/source/code/scopeHelpers.hpp index 8b898d3..626de7e 100644 --- a/source/code/scopeHelpers.hpp +++ b/source/code/scopeHelpers.hpp @@ -30,7 +30,7 @@ http://www.blockattack.net class SDL_RendererHolder { SDL_Renderer* ptr; public: - SDL_RendererHolder(SDL_Renderer* input) { + explicit SDL_RendererHolder(SDL_Renderer* input) { dieOnNullptr(input, "Failed to get render"); ptr = input; } diff --git a/source/code/stats.cpp b/source/code/stats.cpp index 8e1f372..4570e80 100644 --- a/source/code/stats.cpp +++ b/source/code/stats.cpp @@ -68,7 +68,7 @@ Stats* Stats::getInstance() { void Stats::save() { std::stringstream outFile; map::iterator iter; - for (iter = statMap.begin(); iter != statMap.end(); iter++) { + for (iter = statMap.begin(); iter != statMap.end(); ++iter) { outFile << iter->first << " " << iter->second << "\n"; } sago::WriteFileContent(statsFileName, outFile.str());