From 0e6dccbb4e52e86684274c73e9bb6e8e40ae897e Mon Sep 17 00:00:00 2001 From: fgenesis Date: Thu, 19 Jan 2017 21:48:47 +0100 Subject: [PATCH] Thou shall not break the build (+ more warning fixes) --- Aquaria/AnimationEditor.cpp | 3 +-- Aquaria/AnimationEditor.h | 2 +- Aquaria/AquariaComboBox.cpp | 26 ++++++++++++-------------- Aquaria/AquariaMenuItem.cpp | 2 +- Aquaria/AquariaMenuItem.h | 4 ++-- Aquaria/Continuity.cpp | 4 ++-- Aquaria/DSQ.cpp | 2 +- Aquaria/Game.cpp | 2 +- 8 files changed, 21 insertions(+), 24 deletions(-) diff --git a/Aquaria/AnimationEditor.cpp b/Aquaria/AnimationEditor.cpp index 15941c4..95c78a4 100644 --- a/Aquaria/AnimationEditor.cpp +++ b/Aquaria/AnimationEditor.cpp @@ -511,9 +511,8 @@ void AnimationEditor::undo() std::list::iterator it = undoHistory.begin(); std::advance(it, undoEntry); editSprite->animations = it->animations; - if(undoEntry > 0) { + if(undoEntry) undoEntry--; - } } } } diff --git a/Aquaria/AnimationEditor.h b/Aquaria/AnimationEditor.h index 12cc5a6..3fa64f5 100644 --- a/Aquaria/AnimationEditor.h +++ b/Aquaria/AnimationEditor.h @@ -94,7 +94,7 @@ public: std::list undoHistory; - int undoEntry; + size_t undoEntry; int currentKey; diff --git a/Aquaria/AquariaComboBox.cpp b/Aquaria/AquariaComboBox.cpp index 750c330..e72651b 100644 --- a/Aquaria/AquariaComboBox.cpp +++ b/Aquaria/AquariaComboBox.cpp @@ -300,7 +300,8 @@ bool AquariaComboBox::setSelectedItem(const std::string &item) void AquariaComboBox::setSelectedItem(int index) { - if (isopen) close(); + if (isopen) + close(); if (index == AQUARIACOMBOBOXITEM_UP) { @@ -310,22 +311,19 @@ void AquariaComboBox::setSelectedItem(int index) { doScroll(0); } - else if(index < items.size()) + else if((size_t)index < items.size()) { - if ((size_t) index < items.size()) + selectedItem = index; + selectedItemLabel->setText(items[index]); + scroll = index; + if (scroll + numDrops > items.size()) { - selectedItem = index; - selectedItemLabel->setText(items[index]); - scroll = index; - if (scroll + numDrops > items.size()) - { - if (items.size() < numDrops) - scroll = 0; - else - scroll = items.size() - numDrops; - } + if (items.size() < numDrops) + scroll = 0; + else + scroll = items.size() - numDrops; } - } +} } int AquariaComboBox::getSelectedItem() diff --git a/Aquaria/AquariaMenuItem.cpp b/Aquaria/AquariaMenuItem.cpp index c61ca69..929b32c 100644 --- a/Aquaria/AquariaMenuItem.cpp +++ b/Aquaria/AquariaMenuItem.cpp @@ -933,7 +933,7 @@ void AquariaKeyConfig::onUpdate(float dt) inLoop = false; } -void AquariaKeyConfig::setActionSetIndex(int idx) +void AquariaKeyConfig::setActionSetIndex(size_t idx) { actionSetIndex = idx; } diff --git a/Aquaria/AquariaMenuItem.h b/Aquaria/AquariaMenuItem.h index e8f617b..81fb3cd 100644 --- a/Aquaria/AquariaMenuItem.h +++ b/Aquaria/AquariaMenuItem.h @@ -175,7 +175,7 @@ public: static AquariaKeyConfig *waitingForInput; void setAcceptEsc(bool a); - void setActionSetIndex(int idx); + void setActionSetIndex(size_t idx); void setRejectJoyAxis(bool b); protected: @@ -191,7 +191,7 @@ protected: int inputIdx; TTFText *keyConfigFont; Quad *bg; - int actionSetIndex; + size_t actionSetIndex; bool acceptEsc; bool rejectJoyAxis; }; diff --git a/Aquaria/Continuity.cpp b/Aquaria/Continuity.cpp index ac19954..0f077cc 100644 --- a/Aquaria/Continuity.cpp +++ b/Aquaria/Continuity.cpp @@ -2378,7 +2378,7 @@ void Continuity::saveFile(int slot, Vector position, unsigned char *scrShotData, XMLElement *worldMap = doc.NewElement("WorldMap"); { std::ostringstream os; - for (int i = 0; i < dsq->continuity.worldMap.getNumWorldMapTiles(); i++) + for (size_t i = 0; i < dsq->continuity.worldMap.getNumWorldMapTiles(); i++) { WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(i); if (tile->revealed) @@ -2391,7 +2391,7 @@ void Continuity::saveFile(int slot, Vector position, unsigned char *scrShotData, if (dsq->game->worldMapRender) { std::ostringstream os; - for (int i = 0; i < dsq->continuity.worldMap.getNumWorldMapTiles(); i++) + for (size_t i = 0; i < dsq->continuity.worldMap.getNumWorldMapTiles(); i++) { WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(i); os << tile->index << " "; diff --git a/Aquaria/DSQ.cpp b/Aquaria/DSQ.cpp index 37ec957..441b6c6 100644 --- a/Aquaria/DSQ.cpp +++ b/Aquaria/DSQ.cpp @@ -4502,7 +4502,7 @@ void DSQ::onJoystickRemoved(int instanceID) void DSQ::fixupJoysticks() { - for(int i = 0; i < getNumJoysticks(); ++i) + for(size_t i = 0; i < getNumJoysticks(); ++i) if(Joystick *j = getJoystick(i)) j->setEnabled(false); diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index 8678914..178557d 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -2216,7 +2216,7 @@ bool Game::saveScene(std::string scene) saveFile.InsertEndChild(entitiesNode); } - for (i = 0; i < LR_MAX; i++) + for (int i = 0; i < LR_MAX; i++) { std::string s = simpleElements[i].str(); if (!s.empty())