commit e373cd75
Removed some old "using"
Changed files
| M | source/code/DialogBox.hpp before |
| M | source/code/ReadKeyboard.cpp before |
| M | source/code/ScoresDisplay.cpp before |
| M | source/code/levelselect.cpp before |
| M | source/code/sago/SagoMisc.hpp before |
diff --git a/source/code/DialogBox.hpp b/source/code/DialogBox.hpp
index 0cf99c4..d448418 100644
--- a/source/code/DialogBox.hpp
+++ b/source/code/DialogBox.hpp
@@ -35,8 +35,9 @@ class DialogBox : public sago::GameStateInterface {
public:
DialogBox(int x, int y, const std::string& name, const std::string& header);
DialogBox(const DialogBox& orig) = delete;
+ DialogBox& operator=(const DialogBox& orig) = delete;
virtual ~DialogBox();
-
+
bool IsActive() override;
void Draw(SDL_Renderer* target) override;
void ProcessInput(const SDL_Event& event, bool &processed) override;
@@ -46,7 +47,7 @@ public:
private:
bool isActive = true;
std::shared_ptr<ReadKeyboard> rk;
- int x;
+ int x;
int y;
std::string name;
std::string header;
diff --git a/source/code/ReadKeyboard.cpp b/source/code/ReadKeyboard.cpp
index 3692aca..736093a 100644
--- a/source/code/ReadKeyboard.cpp
+++ b/source/code/ReadKeyboard.cpp
@@ -1,7 +1,7 @@
/*
===========================================================================
blockattack - Block Attack - Rise of the Blocks
-Copyright (C) 2005-2012 Poul Sander
+Copyright (C) 2005-2018 Poul Sander
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/
Source information and contacts persons can be found at
-http://blockattack.net
+https://blockattack.net
===========================================================================
*/
@@ -25,9 +25,6 @@ http://blockattack.net
#include "utf8.h"
#include <iostream>
-using std::string;
-using std::cerr;
-
ReadKeyboard::ReadKeyboard(void) {
maxLength = 16;
position = text_string.begin();
@@ -60,7 +57,7 @@ void ReadKeyboard::putchar(const std::string& thing) {
void ReadKeyboard::removeChar() {
if (position < text_string.end()) {
- string::iterator endChar= position;
+ std::string::iterator endChar= position;
utf8::advance(endChar, 1, text_string.end());
text_string.erase(position, endChar);
}
diff --git a/source/code/ScoresDisplay.cpp b/source/code/ScoresDisplay.cpp
index 09ecc78..71db447 100644
--- a/source/code/ScoresDisplay.cpp
+++ b/source/code/ScoresDisplay.cpp
@@ -27,10 +27,6 @@ http://www.blockattack.net
#include "stats.h"
#include "MenuSystem.h"
-using std::string;
-using std::cerr;
-using std::vector;
-
static void setButtonFont(const sago::SagoDataHolder* holder, sago::SagoTextField& field, const char* text) {
field.SetHolder(holder);
field.SetFont("freeserif");
@@ -100,12 +96,12 @@ void ScoresDisplay::DrawStats() {
for (int i=2; i<13; i++) {
y+=y_spacing;
Write(globalData.screen, 10,y,(std::to_string(i)+"X").c_str());
- string numberAsString = std::to_string(Stats::getInstance()->getNumberOf("chainX"+std::to_string(i)));
+ std::string numberAsString = std::to_string(Stats::getInstance()->getNumberOf("chainX"+std::to_string(i)));
Write(globalData.screen, 300,y,numberAsString.c_str());
}
y+=y_spacing*2;
Write(globalData.screen, 10,y,_("Lines Pushed: ") );
- string numberAsString = std::to_string(Stats::getInstance()->getNumberOf("linesPushed"));
+ std::string numberAsString = std::to_string(Stats::getInstance()->getNumberOf("linesPushed"));
Write(globalData.screen, 300,y,numberAsString.c_str());
y+=y_spacing;
@@ -143,10 +139,10 @@ void ScoresDisplay::DrawStats() {
Write(globalData.screen, x_offset,y, _("VS CPU (win/loss)") );
for (int i=0; i<7; i++) {
y += y_spacing;
- Write(globalData.screen, x_offset,y,string("AI "+std::to_string(i+1)).c_str());
+ Write(globalData.screen, x_offset,y,std::string("AI "+std::to_string(i+1)).c_str());
numberAsString = std::to_string(Stats::getInstance()->getNumberOf("defeatedAI"+std::to_string(i)));
- string numberAsString2 = std::to_string(Stats::getInstance()->getNumberOf("defeatedByAI"+std::to_string(i)));
- string toPrint = numberAsString + "/" + numberAsString2;
+ std::string numberAsString2 = std::to_string(Stats::getInstance()->getNumberOf("defeatedByAI"+std::to_string(i)));
+ std::string toPrint = numberAsString + "/" + numberAsString2;
Write(globalData.screen, x_offset+230,y,toPrint.c_str());
}
}
@@ -189,7 +185,7 @@ void ScoresDisplay::Draw(SDL_Renderer*) {
nextLabel.Draw(globalData.screen, nextX+60, nextY+10, sago::SagoTextField::Alignment::center);
//Draw page number
- string pageXofY = SPrintStringF(_("Page %i of %i"), page+1, numberOfPages);
+ std::string pageXofY = SPrintStringF(_("Page %i of %i"), page+1, numberOfPages);
getCachedText(pageXofY)->Draw(globalData.screen, globalData.xsize/2, globalData.ysize-60, sago::SagoTextField::Alignment::center);
}
diff --git a/source/code/levelselect.cpp b/source/code/levelselect.cpp
index 7275c65..6f0730b 100644
--- a/source/code/levelselect.cpp
+++ b/source/code/levelselect.cpp
@@ -30,12 +30,6 @@ https://blockattack.net
#include "MenuSystem.h"
-using std::string;
-using std::cerr;
-using std::cout;
-using std::exception;
-using std::vector;
-
static bool bMouseUp; //true if the mouse(1) is unpressed
static std::map<std::string, std::shared_ptr<sago::SagoTextField> > fieldCache;
@@ -198,8 +192,8 @@ int PuzzleLevelSelect(int Type) {
}
if (Type == 1) {
- string scoreString = SPrintStringF(_("Best score: %i"), GetStageScores(selected)) ;
- string timeString = SPrintStringF(_("Time used: %s"),"-- : --");
+ std::string scoreString = SPrintStringF(_("Best score: %i"), GetStageScores(selected)) ;
+ std::string timeString = SPrintStringF(_("Time used: %s"),"-- : --");
if (GetStageTime(selected)>0) {
timeString = SPrintStringF(_("Time used: %d : %02d"), GetStageTime(selected)/1000/60, (GetStageTime(selected)/1000)%60);
@@ -207,7 +201,7 @@ int PuzzleLevelSelect(int Type) {
Write(globalData.screen, 200,200,scoreString.c_str());
Write(globalData.screen, 200,250,timeString.c_str());
- string totalString = SPrintStringF(_("Total score: %i in %i:%02i"), totalScore, totalTime/1000/60, ((totalTime/1000)%60) );
+ std::string totalString = SPrintStringF(_("Total score: %i in %i:%02i"), totalScore, totalTime/1000/60, ((totalTime/1000)%60) );
Write(globalData.screen, 200,600,totalString.c_str());
}
diff --git a/source/code/sago/SagoMisc.hpp b/source/code/sago/SagoMisc.hpp
index 55bc097..4c3db91 100644
--- a/source/code/sago/SagoMisc.hpp
+++ b/source/code/sago/SagoMisc.hpp
@@ -29,7 +29,7 @@ SOFTWARE.
#include <string>
namespace sago {
-
+
/**
* Returns a vector with all filenames in a given directory.
* PHYSFS must be setup before hand. The directory is relative to the PHYSFS base
@@ -37,7 +37,7 @@ namespace sago {
* @return A vector with the filenames in the given directory. If empty the directory was empty or did not exist
*/
std::vector<std::string> GetFileList(const char* dir);
-
+
/**
* Reads an entire file into memory.
* PHYSFS must be setup before hand
@@ -45,7 +45,7 @@ namespace sago {
* @return The content of the file. If empty either the file was empty, did not exist or could not be opened
*/
std::string GetFileContent(const char* filename);
-
+
/**
* Reads an entire file into memory.
* PHYSFS must be setup before hand
@@ -53,19 +53,19 @@ namespace sago {
* @return The content of the file. If empty either the file was empty, did not exist or could not be opened
*/
inline std::string GetFileContent(const std::string& filename) { return GetFileContent(filename.c_str()); };
-
+
bool FileExists(const char* filename);
-
+
void WriteFileContent(const char* filename, const std::string& content);
-
+
/**
- * This functions convers a string on a best effort basis
+ * This functions converts a string on a best effort basis
* Unlike atol this does NOT cause undefined behavior if out of range
* @param c_string A string that may contain a number
* @return A number between LONG_MIN and LONG_MAX (both inclusive)
*/
long int StrToLong(const char* c_string);
-
+
} //namespace sago
#endif /* SAGOMISC_HPP */