commit daa8f1cf
Now compiles with sign warnings enabled
Changed files
| M | CMakeLists.txt before |
| M | source/code/MenuSystem.cpp before |
| M | source/code/ReadKeyboard.cpp before |
| M | source/code/listFiles.cpp before |
| M | source/code/stageclearhandler.cpp before |
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 973380b..34e6895 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,7 +31,7 @@ add_definitions(-DSHAREDIR=\"${INSTALL_DATA_DIR}\")
endif()
#Compiler options
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-sign-compare -std=c++11")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG} -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -O2")
diff --git a/source/code/MenuSystem.cpp b/source/code/MenuSystem.cpp
index ca4761e..7f84287 100644
--- a/source/code/MenuSystem.cpp
+++ b/source/code/MenuSystem.cpp
@@ -227,19 +227,19 @@ void Menu::run() {
if (event.key.keysym.sym == SDLK_DOWN) {
marked++;
- if (marked>buttons.size()) {
+ if (marked> (int)buttons.size()) {
marked = 0;
}
}
if (event.key.keysym.sym == SDLK_RETURN || event.key.keysym.sym == SDLK_KP_ENTER ) {
- if (marked < buttons.size()) {
+ if (marked < (int)buttons.size()) {
buttons.at(marked)->doAction();
if (buttons.at(marked)->isPopOnRun()) {
running = false;
}
}
- if (marked == buttons.size()) {
+ if (marked == (int)buttons.size()) {
running = false;
}
}
@@ -248,10 +248,10 @@ void Menu::run() {
}
- for (int i=0; i<buttons.size(); i++) {
+ for (int i=0; i<(int)buttons.size(); i++) {
buttons.at(i)->marked = (i == marked);
}
- exit.marked = (marked == buttons.size());
+ exit.marked = (marked == (int)buttons.size());
Uint8 buttonState = SDL_GetMouseState(&mousex,&mousey);
// If the mouse button is released, make bMouseUp equal true
if ( (buttonState&SDL_BUTTON(1))==0) {
@@ -259,7 +259,7 @@ void Menu::run() {
}
if (abs(mousex-oldmousex)>5 || abs(mousey-oldmousey)>5) {
- for (int i=0; i< buttons.size(); ++i) {
+ for (int i=0; i< (int)buttons.size(); ++i) {
if (buttons.at(i)->isClicked(mousex,mousey)) {
marked = i;
}
@@ -274,7 +274,7 @@ void Menu::run() {
//mouse clicked
if ( (buttonState&SDL_BUTTON(1) )==SDL_BUTTON(1) && bMouseUp) {
bMouseUp = false;
- for (int i=0; i< buttons.size(); ++i) {
+ for (int i=0; i< (int)buttons.size(); ++i) {
if (buttons.at(i)->isClicked(mousex,mousey)) {
buttons.at(i)->doAction();
if (buttons.at(i)->isPopOnRun()) {
diff --git a/source/code/ReadKeyboard.cpp b/source/code/ReadKeyboard.cpp
index e0897f9..695cec5 100644
--- a/source/code/ReadKeyboard.cpp
+++ b/source/code/ReadKeyboard.cpp
@@ -47,19 +47,13 @@ ReadKeyboard::ReadKeyboard(const char* oldName) {
void ReadKeyboard::putchar(const std::string& thing) {
- /*for (char a : thing) {
- std::cout << (int)a;
- }
- std::cout << std::endl;
- cout << "Length (pre): " << std::distance(text_string.begin(), position) << endl;*/
- if (text_string.length() < maxLength) {
+ if ( (int)text_string.length() < maxLength) {
int oldPostition = utf8::distance(text_string.begin(), position);
int lengthOfInsertString = utf8::distance(thing.begin(), thing.end());
text_string.insert(position, thing.begin(), thing.end());
position = text_string.begin(); //Inserting may destroy our old iterator
utf8::advance(position, oldPostition + lengthOfInsertString, text_string.end());
}
- //cout << "Length (post): " << std::distance(text_string.begin(), position) << endl;
}
@@ -82,10 +76,6 @@ bool ReadKeyboard::ReadKey(const SDL_Event& key) {
}
bool ReadKeyboard::ReadKey(SDL_Keycode keyPressed) {
- /*if (keyPressed == SDLK_SPACE) {
- ReadKeyboard::putchar(' ');
- return true;
- }*/
if (keyPressed == SDLK_DELETE) {
if ((text_string.length()>0)&& (position<text_string.end())) {
ReadKeyboard::removeChar();
diff --git a/source/code/listFiles.cpp b/source/code/listFiles.cpp
index 26b464a..54ad367 100644
--- a/source/code/listFiles.cpp
+++ b/source/code/listFiles.cpp
@@ -76,7 +76,7 @@ void ListFiles::setDirectory(const string& directory) {
}
bool ListFiles::isInList(const string& name) {
- for (int i=0; i< filenames.size(); i++) {
+ for (int i=0; i< (int)filenames.size(); i++) {
if (name == filenames.at(i) ) {
return true;
}
@@ -106,7 +106,7 @@ void ListFiles::setDirectory2(const string& dic) {
}
string ListFiles::getFileName(int nr) {
- if (startFileNr+nr<filenames.size()) {
+ if (startFileNr+nr< (int)filenames.size()) {
return filenames[startFileNr+nr];
}
else {
@@ -116,7 +116,7 @@ string ListFiles::getFileName(int nr) {
bool ListFiles::fileExists(int nr) {
string emptyString="";
- if (startFileNr+nr<filenames.size()) {
+ if (startFileNr+nr<(int)filenames.size()) {
if (filenames[startFileNr+nr]==emptyString) {
return false;
}
@@ -139,7 +139,7 @@ void ListFiles::back() {
}
void ListFiles::forward() {
- if (startFileNr<filenames.size()-FIRST_FILE) {
+ if (startFileNr<(int)filenames.size()-FIRST_FILE) {
startFileNr = startFileNr+10;
}
}
diff --git a/source/code/stageclearhandler.cpp b/source/code/stageclearhandler.cpp
index ef81f6e..477d7d2 100644
--- a/source/code/stageclearhandler.cpp
+++ b/source/code/stageclearhandler.cpp
@@ -32,10 +32,10 @@ std::string stageClearSavePath;
std::vector<bool> stageCleared(nrOfStageLevels); //vector that tells if a stage is cleared
-std::vector<Uint32> stageTimes(nrOfStageLevels); //For statistical puposes
-std::vector<Uint32> stageScores(nrOfStageLevels); //--||--
-Uint32 totalScore = 0;
-Uint32 totalTime = 0;
+std::vector<Sint32> stageTimes(nrOfStageLevels); //For statistical puposes
+std::vector<Sint32> stageScores(nrOfStageLevels); //--||--
+Sint32 totalScore = 0;
+Sint32 totalTime = 0;
using namespace std;