mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-25 09:44:02 +00:00
Fix some more warnings
This commit is contained in:
parent
fe0ab0418b
commit
4dc7e27ee6
11 changed files with 24 additions and 29 deletions
|
@ -84,7 +84,7 @@ void AquariaComboBox::setScroll(size_t sc)
|
|||
|
||||
std::string AquariaComboBox::getSelectedItemString()
|
||||
{
|
||||
if (selectedItem >= 0 && selectedItem < items.size())
|
||||
if (selectedItem < items.size())
|
||||
return items[selectedItem];
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -495,7 +495,7 @@ void Continuity::setFishPoison(float m, float t)
|
|||
|
||||
std::string Continuity::getIEString(IngredientData *data, size_t i)
|
||||
{
|
||||
if (i < 0 || i >= data->effects.size()) return "";
|
||||
if (i >= data->effects.size()) return "";
|
||||
|
||||
IngredientEffect fx = data->effects[i];
|
||||
IngredientEffectType useType = fx.type;
|
||||
|
@ -2284,7 +2284,7 @@ void Continuity::loadPetData()
|
|||
|
||||
PetData *Continuity::getPetData(size_t idx)
|
||||
{
|
||||
if (idx < 0 || idx >= petData.size())
|
||||
if (idx >= petData.size())
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << "getPetData(" << idx << ") index out of range";
|
||||
|
|
|
@ -2875,7 +2875,7 @@ void DSQ::prevSaveSlotPage()
|
|||
if (saveSlots.empty()) return;
|
||||
|
||||
user.data.savePage--;
|
||||
if (user.data.savePage < 0)
|
||||
if (user.data.savePage > maxPages)
|
||||
user.data.savePage = maxPages;
|
||||
createSaveSlotPage();
|
||||
|
||||
|
|
|
@ -1468,7 +1468,7 @@ void SceneEditor::mouseButtonLeft()
|
|||
{
|
||||
Path *p = getSelectedPath();
|
||||
editingPath = p;
|
||||
if (p && selectedNode >= 0 && selectedNode < p->nodes.size())
|
||||
if (p && selectedNode < p->nodes.size())
|
||||
{
|
||||
if (core->getShiftState())
|
||||
{
|
||||
|
@ -2317,7 +2317,7 @@ void nextEntityPage()
|
|||
void prevEntityPage()
|
||||
{
|
||||
game->sceneEditor.entityPageNum--;
|
||||
if (game->sceneEditor.entityPageNum < 0)
|
||||
if (game->sceneEditor.entityPageNum >= game->entityGroups.size())
|
||||
game->sceneEditor.entityPageNum = game->entityGroups.size()-1;
|
||||
|
||||
createEntityPage();
|
||||
|
@ -2540,12 +2540,9 @@ void SceneEditor::doPrevElement()
|
|||
{
|
||||
int oldCur = curElement;
|
||||
curElement--;
|
||||
if (curElement < 0)
|
||||
if (curElement >= game->elementTemplates.size())
|
||||
curElement = dsq->game->elementTemplates.size()-1;
|
||||
|
||||
if (curElement < 0)
|
||||
return;
|
||||
|
||||
if (dsq->game->elementTemplates[curElement].idx < 1024)
|
||||
{
|
||||
placer->setTexture(dsq->game->elementTemplates[curElement].gfx);
|
||||
|
@ -3106,8 +3103,7 @@ void SceneEditor::update(float dt)
|
|||
}
|
||||
break;
|
||||
case ES_MOVING:
|
||||
if (selectedIdx >= 0)
|
||||
dsq->game->getPath(selectedIdx)->nodes[selectedNode].position = dsq->getGameCursorPosition() + cursorOffset;
|
||||
dsq->game->getPath(selectedIdx)->nodes[selectedNode].position = dsq->getGameCursorPosition() + cursorOffset;
|
||||
break;
|
||||
case ES_ROTATING:
|
||||
case ES_MAX:
|
||||
|
|
|
@ -8484,7 +8484,7 @@ luaFunc(setGemBlink)
|
|||
size_t gemId = lua_tointeger(L, 1);
|
||||
bool result = false;
|
||||
|
||||
if(gemId >= 0 && gemId < dsq->continuity.gems.size())
|
||||
if(gemId < dsq->continuity.gems.size())
|
||||
{
|
||||
Continuity::Gems::iterator it = dsq->continuity.gems.begin();
|
||||
std::advance(it, gemId);
|
||||
|
@ -8501,7 +8501,7 @@ luaFunc(setGemBlink)
|
|||
luaFunc(removeGem)
|
||||
{
|
||||
size_t gemId = lua_tointeger(L, 1);
|
||||
if(gemId >= 0 && gemId < dsq->continuity.gems.size())
|
||||
if(gemId < dsq->continuity.gems.size())
|
||||
{
|
||||
Continuity::Gems::iterator it = dsq->continuity.gems.begin();
|
||||
std::advance(it, gemId);
|
||||
|
|
|
@ -199,7 +199,7 @@ void ScriptedEntity::initSegments(int numSegments, int minDist, int maxDist, std
|
|||
this->minDist = minDist;
|
||||
this->maxDist = maxDist;
|
||||
segments.resize(numSegments);
|
||||
for (size_t i = segments.size()-1; i >= 0 ; i--)
|
||||
for (size_t i = segments.size(); i-- >= 0 ; )
|
||||
{
|
||||
Quad *q = new Quad;
|
||||
if (i == segments.size()-1)
|
||||
|
|
|
@ -281,12 +281,9 @@ void BitmapText::onUpdate(float dt)
|
|||
Vector BitmapText::getColorIndex(size_t i, size_t j)
|
||||
{
|
||||
Vector c(1,1,1);
|
||||
if (!(i < 0 || j < 0))
|
||||
if ( i < colorIndices.size() && j < colorIndices[i].size())
|
||||
{
|
||||
if ( i < colorIndices.size() && j < colorIndices[i].size())
|
||||
{
|
||||
c = colorIndices[i][j];
|
||||
}
|
||||
c = colorIndices[i][j];
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
|
|
@ -207,14 +207,16 @@ void ParticleManager::nextFree(int jump)
|
|||
|
||||
void ParticleManager::prevFree(int jump)
|
||||
{
|
||||
free -= jump;
|
||||
if (free < 0)
|
||||
free += size;
|
||||
if(free < jump) {
|
||||
free = free + size - jump;
|
||||
} else {
|
||||
free -= jump;
|
||||
}
|
||||
}
|
||||
|
||||
void ParticleManager::setFree(int free)
|
||||
void ParticleManager::setFree(size_t free)
|
||||
{
|
||||
if (free != -1)
|
||||
if (free != ~0UL)
|
||||
{
|
||||
this->free = free;
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ public:
|
|||
|
||||
void endParticle(Particle *p);
|
||||
|
||||
void setFree(int free);
|
||||
void setFree(size_t free);
|
||||
|
||||
int getFree() { return free; }
|
||||
int getNumActive() { return numActive; }
|
||||
|
|
|
@ -106,7 +106,7 @@ void Quad::createGrid(int xd, int yd)
|
|||
|
||||
void Quad::setDrawGridAlpha(size_t x, size_t y, float alpha)
|
||||
{
|
||||
if (x < xDivs && x >= 0 && y < yDivs && y >= 0)
|
||||
if (x < xDivs && y < yDivs)
|
||||
{
|
||||
drawGrid[x][y].z = alpha;
|
||||
}
|
||||
|
|
|
@ -1093,7 +1093,7 @@ void SkeletalSprite::prevAnimation()
|
|||
{
|
||||
stopAnimation();
|
||||
animLayers[0].currentAnimation--;
|
||||
if (animLayers[0].currentAnimation < 0)
|
||||
if (animLayers[0].currentAnimation >= animations.size())
|
||||
animLayers[0].currentAnimation = animations.size()-1;
|
||||
}
|
||||
|
||||
|
@ -1878,7 +1878,7 @@ void SkeletalSprite::selectNextBone()
|
|||
selectedBone--;
|
||||
if(selectedBone == oldsel)
|
||||
break;
|
||||
if (selectedBone < 0)
|
||||
if (selectedBone >= bones.size())
|
||||
selectedBone = bones.size()-1;
|
||||
}
|
||||
while (!bones[selectedBone]->selectable);
|
||||
|
|
Loading…
Reference in a new issue