1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-07-03 14:34:34 +00:00

More signed/unsigned comparison fixes. int -> size_t.

This commit is contained in:
fgenesis 2017-01-19 18:50:33 +01:00
parent 4134140be2
commit 9bb3fe86f6
15 changed files with 126 additions and 179 deletions

View file

@ -1287,7 +1287,7 @@ void Continuity::loadSongBank()
} }
} }
int Continuity::getSongTypeBySlot(int slot) int Continuity::getSongTypeBySlot(size_t slot)
{ {
return songSlotsToType[slot]; return songSlotsToType[slot];
} }

View file

@ -144,7 +144,7 @@ public:
bool hasSong(int song); bool hasSong(int song);
int getSongTypeBySlot(int slot); int getSongTypeBySlot(size_t slot);
int getSongSlotByType(int type); int getSongSlotByType(int type);
void learnSong(int song); void learnSong(int song);
void unlearnSong(int song); void unlearnSong(int song);

View file

@ -320,7 +320,7 @@ void Game::transitionToScene(std::string scene)
ElementTemplate *Game::getElementTemplateByIdx(size_t idx) ElementTemplate *Game::getElementTemplateByIdx(size_t idx)
{ {
for (int i = 0; i < elementTemplates.size(); i++) for (size_t i = 0; i < elementTemplates.size(); i++)
{ {
if (elementTemplates[i].idx == idx) if (elementTemplates[i].idx == idx)
{ {
@ -471,10 +471,10 @@ void Game::fillGridFromQuad(Quad *q, ObsType obsType, bool trim)
// obs now empty // obs now empty
int sides = 0; int sides = 0;
for (int i = 0; i < obsCopy.size(); i++) for (size_t i = 0; i < obsCopy.size(); i++)
{ {
sides = 0; sides = 0;
for (int j = 0; j < obsCopy.size(); j++) for (size_t j = 0; j < obsCopy.size(); j++)
{ {
if (i != j) if (i != j)
{ {
@ -500,7 +500,7 @@ void Game::fillGridFromQuad(Quad *q, ObsType obsType, bool trim)
glPushMatrix(); glPushMatrix();
for (int i = 0; i < obs.size(); i++) for (size_t i = 0; i < obs.size(); i++)
{ {
glLoadIdentity(); glLoadIdentity();
@ -577,15 +577,14 @@ void Game::reconstructGrid(bool force)
if (!force && isSceneEditorActive()) return; if (!force && isSceneEditorActive()) return;
clearGrid(); clearGrid();
int i = 0; for (size_t i = 0; i < dsq->getNumElements(); i++)
for (i = 0; i < dsq->getNumElements(); i++)
{ {
Element *e = dsq->getElement(i); Element *e = dsq->getElement(i);
e->fillGrid(); e->fillGrid();
} }
ObsRow *o; ObsRow *o;
for (i = 0; i < obsRows.size(); i++) for (size_t i = 0; i < obsRows.size(); i++)
{ {
o = &obsRows[i]; o = &obsRows[i];
for (int tx = 0; tx < o->len; tx++) for (int tx = 0; tx < o->len; tx++)
@ -718,8 +717,8 @@ Vector Game::getWallNormal(Vector pos, int sampleArea, float *dist, int obs)
} }
} }
} }
int sz = (TILE_SIZE*(sampleArea-1)); const int sz = (TILE_SIZE*(sampleArea-1));
for (int i = 0; i < vs.size(); i++) for (size_t i = 0; i < vs.size(); i++)
{ {
float len = vs[i].getLength2D(); float len = vs[i].getLength2D();
if (len < sz) if (len < sz)
@ -792,13 +791,13 @@ bool Game::removeEntity(Entity *selected)
e = e->NextSiblingElement("Enemy"); e = e->NextSiblingElement("Enemy");
} }
for (int i = 0; i < entitySaveData.size(); i++) for (size_t i = 0; i < entitySaveData.size(); i++)
{ {
if (entitySaveData[i].x == int(selected->startPos.x) && entitySaveData[i].y == int(selected->startPos.y)) if (entitySaveData[i].x == int(selected->startPos.x) && entitySaveData[i].y == int(selected->startPos.y))
{ {
std::vector<EntitySaveData> copy = entitySaveData; std::vector<EntitySaveData> copy = entitySaveData;
entitySaveData.clear(); entitySaveData.clear();
for (int j = 0; j < copy.size(); j++) for (size_t j = 0; j < copy.size(); j++)
{ {
if (j != i) if (j != i)
entitySaveData.push_back(copy[j]); entitySaveData.push_back(copy[j]);
@ -893,7 +892,7 @@ void Game::loadEntityTypeList()
EntityClass *Game::getEntityClassForEntityType(const std::string &type) EntityClass *Game::getEntityClassForEntityType(const std::string &type)
{ {
for (int i = 0; i < entityTypeList.size(); i++) for (size_t i = 0; i < entityTypeList.size(); i++)
{ {
if (nocasecmp(entityTypeList[i].name, type)==0) if (nocasecmp(entityTypeList[i].name, type)==0)
return &entityTypeList[i]; return &entityTypeList[i];
@ -903,7 +902,7 @@ EntityClass *Game::getEntityClassForEntityType(const std::string &type)
int Game::getIdxForEntityType(std::string type) int Game::getIdxForEntityType(std::string type)
{ {
for (int i = 0; i < entityTypeList.size(); i++) for (size_t i = 0; i < entityTypeList.size(); i++)
{ {
if (nocasecmp(entityTypeList[i].name, type)==0) if (nocasecmp(entityTypeList[i].name, type)==0)
return entityTypeList[i].idx; return entityTypeList[i].idx;
@ -914,7 +913,7 @@ int Game::getIdxForEntityType(std::string type)
Entity *Game::createEntity(int idx, int id, Vector position, int rot, bool createSaveData, std::string name, EntityType et, bool doPostInit) Entity *Game::createEntity(int idx, int id, Vector position, int rot, bool createSaveData, std::string name, EntityType et, bool doPostInit)
{ {
std::string type; std::string type;
for (int i = 0; i < dsq->game->entityTypeList.size(); i++) for (size_t i = 0; i < dsq->game->entityTypeList.size(); i++)
{ {
EntityClass *ec = &dsq->game->entityTypeList[i]; EntityClass *ec = &dsq->game->entityTypeList[i];
if (ec->idx == idx) if (ec->idx == idx)
@ -1052,7 +1051,7 @@ void Game::initEntities()
EntitySaveData *Game::getEntitySaveDataForEntity(Entity *e, Vector pos) EntitySaveData *Game::getEntitySaveDataForEntity(Entity *e, Vector pos)
{ {
for (int i = 0; i < entitySaveData.size(); i++) for (size_t i = 0; i < entitySaveData.size(); i++)
{ {
if (entitySaveData[i].e == e) if (entitySaveData[i].e == e)
{ {
@ -1188,9 +1187,9 @@ void Game::clearPaths()
firstPathOfType[i] = 0; firstPathOfType[i] = 0;
} }
int Game::getIndexOfPath(Path *p) size_t Game::getIndexOfPath(Path *p)
{ {
for (int i = 0; i < paths.size(); i++) for (size_t i = 0; i < paths.size(); i++)
{ {
if (paths[i] == p) if (paths[i] == p)
return i; return i;
@ -1205,8 +1204,8 @@ Path *Game::getPathAtCursor()
Path *Game::getScriptedPathAtCursor(bool withAct) Path *Game::getScriptedPathAtCursor(bool withAct)
{ {
int sz = paths.size(); const size_t sz = paths.size();
for (int i = 0; i < sz; i++) for (size_t i = 0; i < sz; i++)
{ {
Path *p = (paths[i]); Path *p = (paths[i]);
if (!p->nodes.empty() && p->hasScript()) if (!p->nodes.empty() && p->hasScript())
@ -1229,7 +1228,7 @@ Path *Game::getNearestPath(const Vector &pos, const std::string &s, const Path *
float smallestDist = HUGE_VALF; float smallestDist = HUGE_VALF;
std::string st = s; std::string st = s;
stringToLower(st); stringToLower(st);
for (int i = 0; i < dsq->game->paths.size(); i++) for (size_t i = 0; i < dsq->game->paths.size(); i++)
{ {
Path *cp = dsq->game->paths[i]; Path *cp = dsq->game->paths[i];
if (cp != ignore && !cp->nodes.empty() && (st.empty() || st == cp->label)) if (cp != ignore && !cp->nodes.empty() && (st.empty() || st == cp->label))
@ -1276,7 +1275,7 @@ Path *Game::getNearestPath(Path *p, std::string s)
Path *Game::getPathByName(std::string name) Path *Game::getPathByName(std::string name)
{ {
stringToLowerUserData(name); stringToLowerUserData(name);
for (int i = 0; i < paths.size(); i++) for (size_t i = 0; i < paths.size(); i++)
{ {
if (paths[i]->label == name) if (paths[i]->label == name)
return paths[i]; return paths[i];
@ -2034,8 +2033,7 @@ void Game::findMaxCameraValues()
cameraMin.y = 20; cameraMin.y = 20;
cameraMax.x = -1; cameraMax.x = -1;
cameraMax.y = -1; cameraMax.y = -1;
int i = 0; for (size_t i = 0; i < obsRows.size(); i++)
for (i = 0; i < obsRows.size(); i++)
{ {
ObsRow *r = &obsRows[i]; ObsRow *r = &obsRows[i];
TileVector t(r->tx + r->len, r->ty); TileVector t(r->tx + r->len, r->ty);
@ -2134,8 +2132,7 @@ bool Game::saveScene(std::string scene)
} }
std::ostringstream obs; std::ostringstream obs;
int i = 0; for (size_t i = 0; i < obsRows.size(); i++)
for (i = 0; i < obsRows.size(); i++)
{ {
obs << obsRows[i].tx << " " << obsRows[i].ty << " " << obsRows[i].len << " "; obs << obsRows[i].tx << " " << obsRows[i].ty << " " << obsRows[i].len << " ";
} }
@ -2144,12 +2141,12 @@ bool Game::saveScene(std::string scene)
saveFile.InsertEndChild(obsXml); saveFile.InsertEndChild(obsXml);
for (i = 0; i < dsq->game->getNumPaths(); i++) for (size_t i = 0; i < dsq->game->getNumPaths(); i++)
{ {
XMLElement *pathXml = saveFile.NewElement("Path"); XMLElement *pathXml = saveFile.NewElement("Path");
Path *p = dsq->game->getPath(i); Path *p = dsq->game->getPath(i);
pathXml->SetAttribute("name", p->name.c_str()); pathXml->SetAttribute("name", p->name.c_str());
for (int n = 0; n < p->nodes.size(); n++) for (size_t n = 0; n < p->nodes.size(); n++)
{ {
XMLElement *nodeXml = saveFile.NewElement("Node"); XMLElement *nodeXml = saveFile.NewElement("Node");
std::ostringstream os; std::ostringstream os;
@ -2171,7 +2168,7 @@ bool Game::saveScene(std::string scene)
std::ostringstream simpleElements[LR_MAX]; std::ostringstream simpleElements[LR_MAX];
std::ostringstream simpleElements_repeatScale[LR_MAX]; std::ostringstream simpleElements_repeatScale[LR_MAX];
for (i = 0; i < dsq->getNumElements(); i++) for (size_t i = 0; i < dsq->getNumElements(); i++)
{ {
Element *e = dsq->getElement(i); Element *e = dsq->getElement(i);
std::ostringstream& SE = simpleElements[e->bgLayer]; std::ostringstream& SE = simpleElements[e->bgLayer];
@ -2200,7 +2197,7 @@ bool Game::saveScene(std::string scene)
XMLElement *entitiesNode = saveFile.NewElement("Entities"); XMLElement *entitiesNode = saveFile.NewElement("Entities");
std::ostringstream os; std::ostringstream os;
for (int i = 0; i < dsq->game->entitySaveData.size(); i++) for (size_t i = 0; i < dsq->game->entitySaveData.size(); i++)
{ {
EntitySaveData *e = &dsq->game->entitySaveData[i]; EntitySaveData *e = &dsq->game->entitySaveData[i];
os << e->idx << " "; os << e->idx << " ";
@ -2490,7 +2487,7 @@ void Game::rebuildElementUpdateList()
elementUpdateList.clear(); elementUpdateList.clear();
elementInteractionList.clear(); elementInteractionList.clear();
for (int i = 0; i < dsq->getNumElements(); i++) for (size_t i = 0; i < dsq->getNumElements(); i++)
{ {
Element *e = dsq->getElement(i); Element *e = dsq->getElement(i);
const int eeidx = e->getElementEffectIndex(); const int eeidx = e->getElementEffectIndex();
@ -2527,7 +2524,7 @@ float Game::getHalfTimer(float mod)
void Game::action(int id, int state, int source, InputDevice device) void Game::action(int id, int state, int source, InputDevice device)
{ {
for (int i = 0; i < paths.size(); i++) for (size_t i = 0; i < paths.size(); i++)
{ {
if (paths[i]->catchActions) if (paths[i]->catchActions)
{ {
@ -2979,7 +2976,7 @@ void Game::applyState()
Path *closest = 0; Path *closest = 0;
Vector closestPushOut; Vector closestPushOut;
bool doFlip = false; bool doFlip = false;
for (int i = 0; i < dsq->game->getNumPaths(); i++) for (size_t i = 0; i < dsq->game->getNumPaths(); i++)
{ {
Path *p = dsq->game->getPath(i); Path *p = dsq->game->getPath(i);
Vector pos = p->nodes[0].position; Vector pos = p->nodes[0].position;
@ -3328,7 +3325,7 @@ void Game::clearControlHint()
controlHint_image->alpha.interpolateTo(0, hintTransTime); controlHint_image->alpha.interpolateTo(0, hintTransTime);
} }
for (int i = 0; i < controlHintNotes.size(); i++) for (size_t i = 0; i < controlHintNotes.size(); i++)
{ {
controlHintNotes[i]->alpha.interpolateTo(0, hintTransTime); controlHintNotes[i]->alpha.interpolateTo(0, hintTransTime);
} }
@ -3392,7 +3389,7 @@ void Game::setControlHint(const std::string &h, bool left, bool right, bool midd
p += Vector(100, 0); p += Vector(100, 0);
for (int i = 0; i < song->notes.size(); i++) for (size_t i = 0; i < song->notes.size(); i++)
{ {
int note = song->notes[i]; int note = song->notes[i];
@ -3479,7 +3476,7 @@ void Game::setControlHint(const std::string &h, bool left, bool right, bool midd
controlHint_mouseBody->alpha.interpolateTo(0.5, hintTransTime); controlHint_mouseBody->alpha.interpolateTo(0.5, hintTransTime);
} }
for (int i = 0; i < controlHintNotes.size(); i++) for (size_t i = 0; i < controlHintNotes.size(); i++)
{ {
controlHintNotes[i]->alpha.interpolateTo(alphaOn, hintTransTime); controlHintNotes[i]->alpha.interpolateTo(alphaOn, hintTransTime);
} }
@ -3948,7 +3945,7 @@ Bone *Game::collideSkeletalVsCircle(Entity *skeletal, Vector pos, float radius)
float smallestDist = HUGE_VALF; float smallestDist = HUGE_VALF;
Bone *closest = 0; Bone *closest = 0;
if (!(pos - skeletal->position).isLength2DIn(2000)) return 0; if (!(pos - skeletal->position).isLength2DIn(2000)) return 0;
for (int i = 0; i < skeletal->skeletalSprite.bones.size(); i++) for (size_t i = 0; i < skeletal->skeletalSprite.bones.size(); i++)
{ {
Bone *b = skeletal->skeletalSprite.bones[i]; Bone *b = skeletal->skeletalSprite.bones[i];
@ -3964,7 +3961,7 @@ Bone *Game::collideSkeletalVsCircle(Entity *skeletal, Vector pos, float radius)
{ {
if (dist < checkRadius) if (dist < checkRadius)
{ {
for (int i = 0; i < b->transformedCollisionMask.size(); i++) for (size_t i = 0; i < b->transformedCollisionMask.size(); i++)
{ {
if ((b->transformedCollisionMask[i] - pos).isLength2DIn(radius+b->collideRadius*skeletal->scale.x)) if ((b->transformedCollisionMask[i] - pos).isLength2DIn(radius+b->collideRadius*skeletal->scale.x))
{ {

View file

@ -516,7 +516,7 @@ public:
Path *getPath(size_t idx) const {return paths[idx];} Path *getPath(size_t idx) const {return paths[idx];}
Path *getFirstPathOfType(PathType type) const {return firstPathOfType[type];} Path *getFirstPathOfType(PathType type) const {return firstPathOfType[type];}
Path *getPathByName(std::string name); Path *getPathByName(std::string name);
int getIndexOfPath(Path *p); size_t getIndexOfPath(Path *p);
Path *getPathAtCursor(); Path *getPathAtCursor();
Path *getScriptedPathAtCursor(bool withAct=false); Path *getScriptedPathAtCursor(bool withAct=false);
Path *getNearestPath(const Vector &pos, const std::string &name="", const Path *ignore=0); Path *getNearestPath(const Vector &pos, const std::string &name="", const Path *ignore=0);

View file

@ -24,7 +24,7 @@ void Recipe::learn()
void Recipe::addName(const std::string &name) void Recipe::addName(const std::string &name)
{ {
int i = 0; size_t i = 0;
for (; i < names.size(); i++) for (; i < names.size(); i++)
{ {
if (names[i].name == name) if (names[i].name == name)
@ -39,7 +39,7 @@ void Recipe::addName(const std::string &name)
void Recipe::addType(IngredientType type, const std::string &typeName) void Recipe::addType(IngredientType type, const std::string &typeName)
{ {
int i = 0; size_t i = 0;
for (; i < types.size(); i++) for (; i < types.size(); i++)
{ {
if (types[i].type == type) if (types[i].type == type)

View file

@ -494,7 +494,7 @@ void FoodSlot::eatMe()
{ {
if (ingredient && !dsq->isNested()) if (ingredient && !dsq->isNested())
{ {
for (int i = 0; i < foodHolders.size(); i++) for (size_t i = 0; i < foodHolders.size(); i++)
{ {
if (!foodHolders[i]->isTrash() && !foodHolders[i]->isEmpty()) if (!foodHolders[i]->isTrash() && !foodHolders[i]->isEmpty())
{ {
@ -588,7 +588,7 @@ void FoodSlot::onUpdate(float dt)
else else
{ {
bool droppedIn = false; bool droppedIn = false;
for (int i = 0; i < foodHolders.size(); i++) for (size_t i = 0; i < foodHolders.size(); i++)
{ {
bool in = (foodHolders[i]->getWorldPosition() - wp).isLength2DIn(32); bool in = (foodHolders[i]->getWorldPosition() - wp).isLength2DIn(32);
if (in) if (in)
@ -1079,7 +1079,7 @@ void InGameMenu::action(int id, int state, int source, InputDevice device)
} }
else else
{ {
for (int i = 0; i < foodHolders.size(); i++) for (size_t i = 0; i < foodHolders.size(); i++)
{ {
if (!foodHolders[i]->isTrash() && !foodHolders[i]->isEmpty()) if (!foodHolders[i]->isTrash() && !foodHolders[i]->isEmpty())
{ {
@ -1097,7 +1097,7 @@ void InGameMenu::action(int id, int state, int source, InputDevice device)
} }
else else
{ {
for (int i = 0; i < foodSlots.size(); i++) for (size_t i = 0; i < foodSlots.size(); i++)
{ {
if (foodSlots[i]->isCursorIn() && foodSlots[i]->getIngredient()) if (foodSlots[i]->isCursorIn() && foodSlots[i]->getIngredient())
{ {
@ -1116,7 +1116,7 @@ void InGameMenu::action(int id, int state, int source, InputDevice device)
else else
{ {
int trashIndex = -1; int trashIndex = -1;
for (int i = 0; i < foodHolders.size(); i++) for (size_t i = 0; i < foodHolders.size(); i++)
{ {
if (foodHolders[i]->isValid() && foodHolders[i]->isTrash()) if (foodHolders[i]->isValid() && foodHolders[i]->isTrash())
{ {
@ -1126,19 +1126,14 @@ void InGameMenu::action(int id, int state, int source, InputDevice device)
} }
if (trashIndex >= 0) if (trashIndex >= 0)
{ {
int ingrIndex = -1; for (size_t i = 0; i < foodSlots.size(); i++)
for (int i = 0; i < foodSlots.size(); i++)
{ {
if (foodSlots[i]->isCursorIn() && foodSlots[i]->getIngredient()) if (foodSlots[i]->isCursorIn() && foodSlots[i]->getIngredient())
{ {
ingrIndex = i; foodSlots[i]->discard();
break; break;
} }
} }
if (ingrIndex >= 0)
{
foodSlots[ingrIndex]->discard();
}
} }
} }
} }
@ -1252,7 +1247,7 @@ void InGameMenu::show(bool ignoreInput, bool optionsOnly, MenuPage menuPage)
else else
liCrystal->alphaMod = 0; liCrystal->alphaMod = 0;
for (int i = 0; i < songSlots.size(); i++) for (size_t i = 0; i < songSlots.size(); i++)
{ {
if (dsq->continuity.hasSong(dsq->continuity.getSongTypeBySlot(i))) if (dsq->continuity.hasSong(dsq->continuity.getSongTypeBySlot(i)))
songSlots[i]->alpha.interpolateTo(1, t); songSlots[i]->alpha.interpolateTo(1, t);
@ -1299,12 +1294,12 @@ void InGameMenu::show(bool ignoreInput, bool optionsOnly, MenuPage menuPage)
eYes->setHidden(false); eYes->setHidden(false);
eNo->setHidden(false); eNo->setHidden(false);
menuIconGlow->setHidden(false); menuIconGlow->setHidden(false);
for (int i = 0; i < menu.size(); i++) for (size_t i = 0; i < menu.size(); i++)
menu[i]->setHidden(false); menu[i]->setHidden(false);
for (int i = 0; i < treasureSlots.size(); i++) for (size_t i = 0; i < treasureSlots.size(); i++)
treasureSlots[i]->setHidden(false); treasureSlots[i]->setHidden(false);
treasureDescription->setHidden(false); treasureDescription->setHidden(false);
for (int i = 0; i < foodSlots.size(); i++) for (size_t i = 0; i < foodSlots.size(); i++)
foodSlots[i]->setHidden(false); foodSlots[i]->setHidden(false);
@ -1359,7 +1354,7 @@ void InGameMenu::show(bool ignoreInput, bool optionsOnly, MenuPage menuPage)
toggleMainMenu(true); toggleMainMenu(true);
songBubbles->alpha.interpolateTo(1, t); songBubbles->alpha.interpolateTo(1, t);
for (int i = 0; i < menu.size(); i++) for (size_t i = 0; i < menu.size(); i++)
{ {
menu[i]->scale = Vector(0,0); menu[i]->scale = Vector(0,0);
menu[i]->alpha = 0; menu[i]->alpha = 0;
@ -1372,7 +1367,7 @@ void InGameMenu::show(bool ignoreInput, bool optionsOnly, MenuPage menuPage)
if (!optionsOnly) if (!optionsOnly)
{ {
for (int i = 0; i < menu.size(); i++) for (size_t i = 0; i < menu.size(); i++)
{ {
menu[i]->scale.interpolateTo(Vector(1, 1), 0.15); menu[i]->scale.interpolateTo(Vector(1, 1), 0.15);
@ -1416,7 +1411,7 @@ void InGameMenu::hide(bool effects, bool cancel)
if (!effects) if (!effects)
t = 0; t = 0;
for (int i = 0; i < foodHolders.size(); i++) for (size_t i = 0; i < foodHolders.size(); i++)
{ {
foodHolders[i]->dropFood(); foodHolders[i]->dropFood();
} }
@ -1438,11 +1433,11 @@ void InGameMenu::hide(bool effects, bool cancel)
menuIconGlow->alpha = 0; menuIconGlow->alpha = 0;
for (int i = 0; i < menu.size(); i++) for (size_t i = 0; i < menu.size(); i++)
{ {
menu[i]->alpha = 0; menu[i]->alpha = 0;
} }
for (int i = 0; i < songSlots.size(); i++) for (size_t i = 0; i < songSlots.size(); i++)
songSlots[i]->alpha.interpolateTo(0, t); songSlots[i]->alpha.interpolateTo(0, t);
songBubbles->alpha.interpolateTo(0, t); songBubbles->alpha.interpolateTo(0, t);
@ -1477,10 +1472,10 @@ void InGameMenu::hide(bool effects, bool cancel)
inGameMenu = false; inGameMenu = false;
for (int i = 0; i < songTips.size(); i++) for (size_t i = 0; i < songTips.size(); i++)
songTips[i]->alpha = 0; songTips[i]->alpha = 0;
for (int i = 0; i < dropIngrNames.size(); i++) for (size_t i = 0; i < dropIngrNames.size(); i++)
{ {
game->spawnIngredient(dropIngrNames[i], game->avatar->position + Vector(0,-96), 1, 1); game->spawnIngredient(dropIngrNames[i], game->avatar->position + Vector(0,-96), 1, 1);
} }
@ -1518,12 +1513,12 @@ void InGameMenu::hide(bool effects, bool cancel)
eYes->setHidden(true); eYes->setHidden(true);
eNo->setHidden(true); eNo->setHidden(true);
menuIconGlow->setHidden(true); menuIconGlow->setHidden(true);
for (int i = 0; i < menu.size(); i++) for (size_t i = 0; i < menu.size(); i++)
menu[i]->setHidden(true); menu[i]->setHidden(true);
for (int i = 0; i < treasureSlots.size(); i++) for (size_t i = 0; i < treasureSlots.size(); i++)
treasureSlots[i]->setHidden(true); treasureSlots[i]->setHidden(true);
treasureDescription->setHidden(true); treasureDescription->setHidden(true);
for (int i = 0; i < foodSlots.size(); i++) for (size_t i = 0; i < foodSlots.size(); i++)
foodSlots[i]->setHidden(true); foodSlots[i]->setHidden(true);
} }
@ -1651,7 +1646,7 @@ void InGameMenu::sortFood()
std::vector<std::string> foodHolderNames; std::vector<std::string> foodHolderNames;
foodHolderNames.resize(foodHolders.size()); foodHolderNames.resize(foodHolders.size());
for (int i = 0; i < foodHolders.size(); i++) { for (size_t i = 0; i < foodHolders.size(); i++) {
IngredientData *ing = foodHolders[i]->getIngredient(); IngredientData *ing = foodHolders[i]->getIngredient();
if (ing) if (ing)
foodHolderNames[i] = ing->name; foodHolderNames[i] = ing->name;
@ -1671,7 +1666,7 @@ void InGameMenu::sortFood()
dsq->sound->playSfx("menu-switch", 0.5); dsq->sound->playSfx("menu-switch", 0.5);
dsq->spawnParticleEffect("menu-switch", worldLeftCenter, 0, 0, LR_HUD3, 1); dsq->spawnParticleEffect("menu-switch", worldLeftCenter, 0, 0, LR_HUD3, 1);
for (int i = 0; i < foodHolders.size(); i++) { for (size_t i = 0; i < foodHolders.size(); i++) {
if (!foodHolderNames[i].empty()) { if (!foodHolderNames[i].empty()) {
IngredientData *ing = dsq->continuity.getIngredientHeldByName(foodHolderNames[i]); IngredientData *ing = dsq->continuity.getIngredientHeldByName(foodHolderNames[i]);
foodHolders[i]->setIngredient(ing, false); foodHolders[i]->setIngredient(ing, false);
@ -1720,8 +1715,6 @@ static bool isCurrentScreenMode(const ScreenMode& m)
void InGameMenu::create() void InGameMenu::create()
{ {
float menuz = 4; float menuz = 4;
int i = 0;
menuBg = new Quad; menuBg = new Quad;
menuBg->setTexture("menu"); menuBg->setTexture("menu");
@ -1817,7 +1810,7 @@ void InGameMenu::create()
resBox = new AquariaComboBox(Vector(0.7f, 1.0f)); resBox = new AquariaComboBox(Vector(0.7f, 1.0f));
resBox->position = Vector(196, 285); resBox->position = Vector(196, 285);
for (i = 0; i < core->screenModes.size(); i++) for (size_t i = 0; i < core->screenModes.size(); i++)
{ {
const ScreenMode& m = core->screenModes[i]; const ScreenMode& m = core->screenModes[i];
resBox->addItem(screenModeStr(m)); resBox->addItem(screenModeStr(m));
@ -2298,7 +2291,7 @@ void InGameMenu::create()
foodHolders.resize(3); foodHolders.resize(3);
int holders=0; int holders=0;
for (i = 0; i < foodHolders.size(); i++) for (size_t i = 0; i < foodHolders.size(); i++)
{ {
foodHolders[i] = new FoodHolder(i); foodHolders[i] = new FoodHolder(i);
foodHolders[i]->toggleValid(false); foodHolders[i]->toggleValid(false);
@ -2373,7 +2366,7 @@ void InGameMenu::create()
petSlots.resize(dsq->continuity.petData.size()); petSlots.resize(dsq->continuity.petData.size());
for (i = 0; i < petSlots.size(); i++) for (size_t i = 0; i < petSlots.size(); i++)
{ {
PetData *p = dsq->continuity.getPetData(i); PetData *p = dsq->continuity.getPetData(i);
if (p) if (p)
@ -2396,7 +2389,7 @@ void InGameMenu::create()
int outer = 0; int outer = 0;
int inner = 0; int inner = 0;
for (i = 0; i < songSlots.size(); i++) for (size_t i = 0; i < songSlots.size(); i++)
{ {
songSlots[i] = new SongSlot(i); songSlots[i] = new SongSlot(i);
float angle = 0; float angle = 0;
@ -2457,7 +2450,7 @@ void InGameMenu::create()
menu.resize(10); menu.resize(10);
for (i = 0; i < menu.size(); i++) for (size_t i = 0; i < menu.size(); i++)
menu[i] = new AquariaMenuItem; menu[i] = new AquariaMenuItem;
int ty = 530; int ty = 530;
@ -2540,7 +2533,7 @@ void InGameMenu::create()
menu[9]->position = Vector(100,100); menu[9]->position = Vector(100,100);
*/ */
for (i = 0; i < menu.size(); i++) for (size_t i = 0; i < menu.size(); i++)
{ {
game->addRenderObject(menu[i], LR_MENU); game->addRenderObject(menu[i], LR_MENU);
menu[i]->alpha = 0; menu[i]->alpha = 0;
@ -2565,7 +2558,7 @@ void InGameMenu::create()
Vector worldCenter(222, 252); Vector worldCenter(222, 252);
int foodSlotRadius = 96; int foodSlotRadius = 96;
for (i = 0; i < foodSlots.size(); i++) for (size_t i = 0; i < foodSlots.size(); i++)
{ {
foodSlots[i] = new FoodSlot(i); foodSlots[i] = new FoodSlot(i);
@ -2620,7 +2613,7 @@ void InGameMenu::create()
treasureSlots.resize(treasurePageSize); treasureSlots.resize(treasurePageSize);
for (i = 0; i < treasureSlots.size(); i++) for (size_t i = 0; i < treasureSlots.size(); i++)
{ {
treasureSlots[i] = new TreasureSlot(i); treasureSlots[i] = new TreasureSlot(i);
@ -2797,7 +2790,7 @@ void InGameMenu::onUseTreasure(int flag)
static bool ingType(const std::vector<IngredientData*> &list, IngredientType type, int amount=1) static bool ingType(const std::vector<IngredientData*> &list, IngredientType type, int amount=1)
{ {
int c = 0; int c = 0;
for (int i = 0; i < list.size(); i++) for (size_t i = 0; i < list.size(); i++)
{ {
IngredientData *data = list[i]; IngredientData *data = list[i];
if ((data->marked < data->held) && (data->type == type || type == IT_ANYTHING)) if ((data->marked < data->held) && (data->type == type || type == IT_ANYTHING))
@ -2815,7 +2808,7 @@ static bool ingType(const std::vector<IngredientData*> &list, IngredientType typ
static bool ingName(const std::vector<IngredientData*> &list, const std::string &name, int amount=1) static bool ingName(const std::vector<IngredientData*> &list, const std::string &name, int amount=1)
{ {
int c = 0; int c = 0;
for (int i = 0; i < list.size(); i++) for (size_t i = 0; i < list.size(); i++)
{ {
IngredientData *data = list[i]; IngredientData *data = list[i];
if ((data->marked < data->held) && (nocasecmp(data->name, name)==0))//data->name == name) if ((data->marked < data->held) && (nocasecmp(data->name, name)==0))//data->name == name)
@ -2835,14 +2828,13 @@ Recipe *InGameMenu::findRecipe(const std::vector<IngredientData*> &list)
if (list.size() < 2) return 0; if (list.size() < 2) return 0;
// there will be a number of types and a number of names // there will be a number of types and a number of names
// the types and names DO NOT overlap
int rc = 0;
Recipe *r = 0; Recipe *r = 0;
Recipe *tr = 0; Recipe *tr = 0;
int q = 0, q2 = 0; size_t q = 0, q2 = 0;
for ( rc = 0; rc < dsq->continuity.recipes.size(); rc++) for (size_t rc = 0; rc < dsq->continuity.recipes.size(); rc++)
{ {
for (int i = 0; i < list.size(); i++) list[i]->marked = 0; for (size_t i = 0; i < list.size(); i++)
list[i]->marked = 0;
tr = 0; tr = 0;
r = &dsq->continuity.recipes[rc]; r = &dsq->continuity.recipes[rc];
@ -2850,21 +2842,21 @@ Recipe *InGameMenu::findRecipe(const std::vector<IngredientData*> &list)
q = 0; q = 0;
// get the amount of ingredients provided by the player // get the amount of ingredients provided by the player
int listAmount = list.size(); size_t listAmount = list.size();
// get the amount of ingredients required // get the amount of ingredients required
int recipeAmount = 0; size_t recipeAmount = 0;
for (int i = 0; i < r->types.size(); i++) for (size_t i = 0; i < r->types.size(); i++)
recipeAmount += r->types[i].amount; recipeAmount += r->types[i].amount;
for (int i = 0; i < r->names.size(); i++) for (size_t i = 0; i < r->names.size(); i++)
recipeAmount += r->names[i].amount; recipeAmount += r->names[i].amount;
if (listAmount != recipeAmount) if (listAmount != recipeAmount)
continue; continue;
for (int c = 0; c < r->types.size(); c++) for (size_t c = 0; c < r->types.size(); c++)
{ {
RecipeType *t = &r->types[c]; RecipeType *t = &r->types[c];
if (ingType(list, t->type, t->amount)) if (ingType(list, t->type, t->amount))
@ -2887,7 +2879,7 @@ Recipe *InGameMenu::findRecipe(const std::vector<IngredientData*> &list)
if (q == r->types.size()) if (q == r->types.size())
{ {
q2 = 0; q2 = 0;
for (int c = 0; c < r->names.size(); c++) for (size_t c = 0; c < r->names.size(); c++)
{ {
RecipeName *n = &r->names[c]; RecipeName *n = &r->names[c];
if (ingName(list, n->name, n->amount)) if (ingName(list, n->name, n->amount))
@ -2915,18 +2907,8 @@ Recipe *InGameMenu::findRecipe(const std::vector<IngredientData*> &list)
} }
} }
for (int i = 0; i < list.size(); i++) list[i]->marked = 0; for (size_t i = 0; i < list.size(); i++)
list[i]->marked = 0;
if (rc == dsq->continuity.recipes.size())
{
/*
data = dsq->continuity.getIngredientByName("SeaLoaf");
if (data)
{
dsq->continuity.pickupIngredient(data);
}
*/
}
return 0; return 0;
} }
@ -2934,7 +2916,7 @@ Recipe *InGameMenu::findRecipe(const std::vector<IngredientData*> &list)
void InGameMenu::updateCookList() void InGameMenu::updateCookList()
{ {
cookList.clear(); cookList.clear();
for (int i = 0; i < foodHolders.size(); i++) for (size_t i = 0; i < foodHolders.size(); i++)
{ {
IngredientData *ing = foodHolders[i]->getIngredient(); IngredientData *ing = foodHolders[i]->getIngredient();
if (!foodHolders[i]->isTrash() && ing) if (!foodHolders[i]->isTrash() && ing)
@ -3092,7 +3074,7 @@ void InGameMenu::onCook()
dsq->sound->playSfx("boil"); dsq->sound->playSfx("boil");
for (int i = 0; i < foodHolders.size(); i++) for (size_t i = 0; i < foodHolders.size(); i++)
{ {
if (!foodHolders[i]->isEmpty()) if (!foodHolders[i]->isEmpty())
dsq->spawnParticleEffect("cook-ingredient", foodHolders[i]->getWorldPosition(), 0, 0, LR_HUD3, 1); dsq->spawnParticleEffect("cook-ingredient", foodHolders[i]->getWorldPosition(), 0, 0, LR_HUD3, 1);
@ -3104,7 +3086,7 @@ void InGameMenu::onCook()
dsq->run(0.2); dsq->run(0.2);
bool haveLeftovers = true; bool haveLeftovers = true;
for (int i = 0; i < foodHolders.size(); i++) for (size_t i = 0; i < foodHolders.size(); i++)
{ {
if (!foodHolders[i]->isEmpty()) { if (!foodHolders[i]->isEmpty()) {
IngredientData *ing = foodHolders[i]->getIngredient(); IngredientData *ing = foodHolders[i]->getIngredient();
@ -3115,7 +3097,7 @@ void InGameMenu::onCook()
} }
} }
} }
for (int i = 0; i < foodHolders.size(); i++) for (size_t i = 0; i < foodHolders.size(); i++)
{ {
IngredientData *ing = foodHolders[i]->getIngredient(); IngredientData *ing = foodHolders[i]->getIngredient();
if (ing) if (ing)
@ -3131,7 +3113,7 @@ void InGameMenu::onCook()
dsq->sound->playSfx("Cook"); dsq->sound->playSfx("Cook");
for (int i = 0; i < foodHolders.size(); i++) for (size_t i = 0; i < foodHolders.size(); i++)
if (foodHolders[i]->isValid() && !foodHolders[i]->isTrash()) if (foodHolders[i]->isValid() && !foodHolders[i]->isTrash())
foodHolders[i]->animateLid(false); foodHolders[i]->animateLid(false);
@ -3194,7 +3176,7 @@ endcook:
FoodSlot* InGameMenu::getFoodSlotFromIndex() FoodSlot* InGameMenu::getFoodSlotFromIndex()
{ {
for (int i = 0; i < foodSlots.size(); i++) for (size_t i = 0; i < foodSlots.size(); i++)
{ {
if (foodSlots[i]->slot == FoodSlot::foodSlotIndex) if (foodSlots[i]->slot == FoodSlot::foodSlotIndex)
{ {
@ -3279,7 +3261,7 @@ void InGameMenu::onOptionsSave()
{ {
if (resBox) if (resBox)
{ {
int itm = resBox->getSelectedItem(); size_t itm = resBox->getSelectedItem();
if(itm < core->screenModes.size()) // Required because the menu appends another element if it can't select one in the list if(itm < core->screenModes.size()) // Required because the menu appends another element if it can't select one in the list
{ {
const ScreenMode& m = core->screenModes[itm]; const ScreenMode& m = core->screenModes[itm];
@ -3382,7 +3364,7 @@ void InGameMenu::onOptionsCancel()
void InGameMenu::refreshFoodSlots(bool effects) void InGameMenu::refreshFoodSlots(bool effects)
{ {
for (int i = 0; i < foodSlots.size(); i++) for (size_t i = 0; i < foodSlots.size(); i++)
{ {
foodSlots[i]->refresh(effects); foodSlots[i]->refresh(effects);
} }
@ -3390,7 +3372,7 @@ void InGameMenu::refreshFoodSlots(bool effects)
void InGameMenu::refreshTreasureSlots() void InGameMenu::refreshTreasureSlots()
{ {
for (int i = 0; i < treasureSlots.size(); i++) for (size_t i = 0; i < treasureSlots.size(); i++)
{ {
treasureSlots[i]->refresh(); treasureSlots[i]->refresh();
} }
@ -3415,30 +3397,10 @@ void InGameMenu::togglePetMenu(bool f)
toggleMainMenu(false); toggleMainMenu(false);
bool hasPet = false; bool hasPet = false;
for (int i = 0; i < petSlots.size(); i++) for (size_t i = 0; i < petSlots.size(); i++)
{ {
petSlots[i]->alpha = 1; petSlots[i]->alpha = 1;
bool has = dsq->continuity.getFlag(petSlots[i]->petFlag); hasPet = dsq->continuity.getFlag(petSlots[i]->petFlag) || hasPet;
if (has)
{
hasPet = true;
/*
for (int j = 0; j < petSlots.size(); j++)
{
if (j != i)
{
bool has = dsq->continuity.getFlag(petSlots[j]->petFlag);
if (has)
{
if (i == 0 && j == 1)
{
}
}
}
}
*/
}
} }
// act as if they're all active for now... // act as if they're all active for now...
if (petSlots.size() == 4) if (petSlots.size() == 4)
@ -3468,20 +3430,8 @@ void InGameMenu::togglePetMenu(bool f)
} }
for (int i = 0; i < petTips.size(); i++) for (size_t i = 0; i < petTips.size(); i++)
{
/*
if (hasPet && i == 0)
{
petTips[i]->alpha = 0;
}
else if (!hasPet && i == 1)
petTips[i]->alpha = 0;
else
petTips[i]->alpha = 1; petTips[i]->alpha = 1;
*/
petTips[i]->alpha = 1;
}
liCrystal->alpha = 1; liCrystal->alpha = 1;
@ -3494,12 +3444,12 @@ void InGameMenu::togglePetMenu(bool f)
} }
else if (!f && petMenu) else if (!f && petMenu)
{ {
for (int i = 0; i < petSlots.size(); i++) for (size_t i = 0; i < petSlots.size(); i++)
{ {
petSlots[i]->alpha = 0; petSlots[i]->alpha = 0;
} }
for (int i = 0; i < petTips.size(); i++) for (size_t i = 0; i < petTips.size(); i++)
{ {
petTips[i]->alpha = 0; petTips[i]->alpha = 0;
} }
@ -3536,7 +3486,7 @@ void InGameMenu::toggleTreasureMenu(bool f)
refreshTreasureSlots(); refreshTreasureSlots();
for (int i = 0; i < treasureTips.size(); i++) for (size_t i = 0; i < treasureTips.size(); i++)
treasureTips[i]->alpha = 1; treasureTips[i]->alpha = 1;
if (treasureSlots.size() > 8) if (treasureSlots.size() > 8)
@ -3562,7 +3512,7 @@ void InGameMenu::toggleTreasureMenu(bool f)
{ {
treasureMenu = false; treasureMenu = false;
for (int i = 0; i < treasureTips.size(); i++) for (size_t i = 0; i < treasureTips.size(); i++)
treasureTips[i]->alpha = 0; treasureTips[i]->alpha = 0;
menu[0]->setDirMove(DIR_UP, 0); menu[0]->setDirMove(DIR_UP, 0);
@ -3573,7 +3523,7 @@ void InGameMenu::toggleTreasureMenu(bool f)
circlePageNum->alpha = 0; circlePageNum->alpha = 0;
} }
for (int i = 0; i < treasureSlots.size(); i++) for (size_t i = 0; i < treasureSlots.size(); i++)
{ {
if (f) if (f)
treasureSlots[i]->alpha = 1; treasureSlots[i]->alpha = 1;
@ -3618,7 +3568,7 @@ void InGameMenu::toggleFoodMenu(bool f)
toggleTreasureMenu(false); toggleTreasureMenu(false);
for (int i = 0; i < foodHolders.size(); i++) for (size_t i = 0; i < foodHolders.size(); i++)
foodHolders[i]->toggleValid(f); foodHolders[i]->toggleValid(f);
if (f) if (f)
@ -3659,7 +3609,7 @@ void InGameMenu::toggleFoodMenu(bool f)
foodSort->alpha = 1; foodSort->alpha = 1;
for (int i = 0; i < foodTips.size(); i++) for (size_t i = 0; i < foodTips.size(); i++)
foodTips[i]->alpha = 1; foodTips[i]->alpha = 1;
if (foodSlots.size() >= 16) if (foodSlots.size() >= 16)
@ -3711,7 +3661,7 @@ void InGameMenu::toggleFoodMenu(bool f)
liCrystal->alpha = 0; liCrystal->alpha = 0;
for (int i = 0; i < foodTips.size(); i++) for (size_t i = 0; i < foodTips.size(); i++)
foodTips[i]->alpha = 0; foodTips[i]->alpha = 0;
menu[5]->setDirMove(DIR_LEFT, 0); menu[5]->setDirMove(DIR_LEFT, 0);
@ -3721,7 +3671,7 @@ void InGameMenu::toggleFoodMenu(bool f)
previewRecipe->alpha = 0; previewRecipe->alpha = 0;
} }
for (int i = 0; i < foodSlots.size(); i++) for (size_t i = 0; i < foodSlots.size(); i++)
{ {
foodSlots[i]->toggle(f); foodSlots[i]->toggle(f);
} }
@ -3741,21 +3691,21 @@ void InGameMenu::toggleMainMenu(bool f)
if (f) if (f)
{ {
currentMenuPage = MENUPAGE_SONGS; currentMenuPage = MENUPAGE_SONGS;
for (int i = 0; i < songSlots.size(); i++) for (size_t i = 0; i < songSlots.size(); i++)
{ {
songSlots[i]->alphaMod = 1; songSlots[i]->alphaMod = 1;
} }
songBubbles->alpha.interpolateTo(1,t); songBubbles->alpha.interpolateTo(1,t);
energyIdol->alpha.interpolateTo(1,t); energyIdol->alpha.interpolateTo(1,t);
liCrystal->alpha.interpolateTo(1, t); liCrystal->alpha.interpolateTo(1, t);
for (int i = 0; i < songTips.size(); i++) for (size_t i = 0; i < songTips.size(); i++)
songTips[i]->alpha = 1; songTips[i]->alpha = 1;
menuBg2->alpha.interpolateTo(1, t); menuBg2->alpha.interpolateTo(1, t);
int sm=-900; int sm=-900;
SongSlot *ss=0; SongSlot *ss=0;
for (int i = 0; i < songSlots.size(); i++) for (size_t i = 0; i < songSlots.size(); i++)
{ {
if (dsq->continuity.hasSong(dsq->continuity.getSongTypeBySlot(i))) if (dsq->continuity.hasSong(dsq->continuity.getSongTypeBySlot(i)))
{ {
@ -3780,12 +3730,12 @@ void InGameMenu::toggleMainMenu(bool f)
{ {
((AquariaMenuItem*)menu[5])->setDirMove(DIR_LEFT, 0); ((AquariaMenuItem*)menu[5])->setDirMove(DIR_LEFT, 0);
for (int i = 0; i < songSlots.size(); i++) for (size_t i = 0; i < songSlots.size(); i++)
{ {
songSlots[i]->alphaMod = 0; songSlots[i]->alphaMod = 0;
} }
for (int i = 0; i < songTips.size(); i++) for (size_t i = 0; i < songTips.size(); i++)
songTips[i]->alpha = 0; songTips[i]->alpha = 0;
songBubbles->alpha.interpolateTo(0, t); songBubbles->alpha.interpolateTo(0, t);

View file

@ -172,7 +172,7 @@ private:
std::vector<std::string> dropIngrNames; std::vector<std::string> dropIngrNames;
float songMenuPlayDelay; float songMenuPlayDelay;
int currentSongMenuNote; size_t currentSongMenuNote;
int playingSongInMenu; int playingSongInMenu;
void onOptionsMenu(); void onOptionsMenu();

View file

@ -443,7 +443,7 @@ void StatsAndAchievements::EvaluateAchievement( Achievement &achievement )
{ {
// check world map data somehow // check world map data somehow
bool hasAllMap = true; bool hasAllMap = true;
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); WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(i);
if (!tile->revealed && (nocasecmp(tile->name, "thirteenlair") != 0)) { if (!tile->revealed && (nocasecmp(tile->name, "thirteenlair") != 0)) {

View file

@ -27,7 +27,7 @@ public:
typedef std::vector<SubLine> SubLines; typedef std::vector<SubLine> SubLines;
SubLines subLines; SubLines subLines;
int curLine; size_t curLine;
protected: protected:
bool vis, hidden; bool vis, hidden;
}; };

View file

@ -214,7 +214,7 @@ void UserSettings::save()
xml_joyAxes->SetAttribute("s2dead", as.joycfg.s2dead); xml_joyAxes->SetAttribute("s2dead", as.joycfg.s2dead);
} }
xml_actionSet->InsertEndChild(xml_joyAxes); xml_actionSet->InsertEndChild(xml_joyAxes);
for (int i = 0; i < as.inputSet.size(); i++) for (size_t i = 0; i < as.inputSet.size(); i++)
{ {
XMLElement *xml_action = doc.NewElement("Action"); XMLElement *xml_action = doc.NewElement("Action");
const ActionInput& ai = as.inputSet[i]; const ActionInput& ai = as.inputSet[i];
@ -522,7 +522,7 @@ void UserSettings::load(bool doApply, const std::string &overrideFile)
int nas = (int)control.actionSets.size(); int nas = (int)control.actionSets.size();
if(nas < control.minActionSets) if(nas < control.minActionSets)
control.actionSets.resize(control.minActionSets); control.actionSets.resize(control.minActionSets);
while(nas < control.actionSets.size()) while(nas < control.minActionSets)
{ {
ActionSet& as = control.actionSets[nas]; ActionSet& as = control.actionSets[nas];
ensureDefaultActions(as); ensureDefaultActions(as);

View file

@ -814,7 +814,7 @@ void WorldMapRender::bindInput()
void WorldMapRender::destroy() void WorldMapRender::destroy()
{ {
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); WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(i);
clearVis(tile); clearVis(tile);
@ -891,7 +891,7 @@ void WorldMapRender::onUpdate(float dt)
{ {
WorldMapTile *selectedTile = 0; WorldMapTile *selectedTile = 0;
int sd=-1,d=0; int sd=-1,d=0;
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); WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(i);
if (tile && tile != activeTile) if (tile && tile != activeTile)
@ -1355,7 +1355,7 @@ void WorldMapRender::toggle(bool turnON)
xMin = xMax = -internalOffset.x; xMin = xMax = -internalOffset.x;
yMin = yMax = -internalOffset.y; yMin = yMax = -internalOffset.y;
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); WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(i);
if (tile && (tile->revealed || tile->prerevealed) && tile->q) if (tile && (tile->revealed || tile->prerevealed) && tile->q)

View file

@ -41,7 +41,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//#pragma warning(disable:4005) //#pragma warning(disable:4005)
#pragma warning(disable:4305) #pragma warning(disable:4305)
#pragma warning(disable:4018) // signed/unsigned mismatch //#pragma warning(disable:4018) // signed/unsigned mismatch
#pragma warning(disable:4244) // conversion from types with possible loss of data #pragma warning(disable:4244) // conversion from types with possible loss of data
#pragma warning(disable:4800) // forcing value to bool 'true' or 'false (performance warning) #pragma warning(disable:4800) // forcing value to bool 'true' or 'false (performance warning)

View file

@ -198,14 +198,14 @@ void ParticleManager::endParticle(Particle *p)
p->reset(); p->reset();
} }
void ParticleManager::nextFree(int jump) void ParticleManager::nextFree(size_t jump)
{ {
free+=jump; free+=jump;
if (free >= size) if (free >= size)
free -= size; free -= size;
} }
void ParticleManager::prevFree(int jump) void ParticleManager::prevFree(size_t jump)
{ {
if(free < jump) { if(free < jump) {
free = free + size - jump; free = free + size - jump;

View file

@ -237,8 +237,8 @@ protected:
size_t numActive; size_t numActive;
Particle* stomp(); Particle* stomp();
void nextFree(int f=1); void nextFree(size_t f=1);
void prevFree(int f=1); void prevFree(size_t f=1);
size_t oldFree; size_t oldFree;

View file

@ -429,7 +429,6 @@ ImageTGA *Texture::TGAloadMem(void *mem, int size)
byte bits = 0; // The bits per pixel for the image (16, 24, 32) byte bits = 0; // The bits per pixel for the image (16, 24, 32)
uint32_t channels = 0; // The channels of the image (3 = RGA : 4 = RGBA) uint32_t channels = 0; // The channels of the image (3 = RGA : 4 = RGBA)
uint32_t stride = 0; // The stride (channels * width) uint32_t stride = 0; // The stride (channels * width)
size_t i = 0; // A counter
// This function loads in a TARGA (.TGA) file and returns its data to be // This function loads in a TARGA (.TGA) file and returns its data to be
// used as a texture or what have you. This currently loads in a 16, 24 // used as a texture or what have you. This currently loads in a 16, 24
@ -498,7 +497,7 @@ ImageTGA *Texture::TGAloadMem(void *mem, int size)
// Go through all of the pixels and swap the B and R values since TGA // Go through all of the pixels and swap the B and R values since TGA
// files are stored as BGR instead of RGB (or use GL_BGR_EXT verses GL_RGB) // files are stored as BGR instead of RGB (or use GL_BGR_EXT verses GL_RGB)
for(i = 0; i < stride; i += channels) for(unsigned i = 0; i < stride; i += channels)
{ {
int temp = pLine[i]; int temp = pLine[i];
pLine[i] = pLine[i + 2]; pLine[i] = pLine[i + 2];
@ -578,7 +577,8 @@ ImageTGA *Texture::TGAloadMem(void *mem, int size)
byte *pColors = new byte [channels]; byte *pColors = new byte [channels];
// Load in all the pixel data // Load in all the pixel data
while(i < width*height) const size_t datalen = size_t(width) * size_t(height);
for(size_t i = 0; i < datalen; )
{ {
// Read in the current color count + 1 // Read in the current color count + 1
bb >> rleID; bb >> rleID;