1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-24 09:16:48 +00:00

couple random warning fixes, no functional changes

This commit is contained in:
fgenesis 2025-01-13 00:56:28 +01:00
parent 63892518cd
commit 1138eab08e
12 changed files with 18 additions and 22 deletions

View file

@ -148,7 +148,7 @@ void Hair::updatePositions()
void Hair::exertForce(const Vector &force, float dt, int usePerc)
{
const Vector f = force * dt;
for (int i = hairNodes.size()-1; i >= 1; i--)
for (size_t i = hairNodes.size(); i --> 1; )
{
switch (usePerc)
{

View file

@ -46,7 +46,6 @@ ScriptedEntity::ScriptedEntity(const std::string &scriptName, Vector position, E
layer = LR_ENTITIES;
surfaceMoveDir = 1;
this->position = position;
numSegments = 0;
reverseSegments = false;
manaBallAmount = 1;
this->name = scriptName;
@ -189,7 +188,6 @@ void ScriptedEntity::registerNewPart(RenderObject *r, const std::string &name)
void ScriptedEntity::initSegments(int numSegments, int minDist, int maxDist, std::string bodyTex, std::string tailTex, int w, int h, float taper, bool reverseSegments)
{
this->reverseSegments = reverseSegments;
this->numSegments = numSegments;
this->minDist = minDist;
this->maxDist = maxDist;
segments.resize(numSegments);
@ -502,7 +500,7 @@ void ScriptedEntity::onUpdate(float dt)
debugLog(name + " : update : " + script->getLastError());
}
if (numSegments > 0)
if (!segments.empty())
{
updateSegments(position, reverseSegments);
updateAlpha(alpha.x);

View file

@ -38,7 +38,6 @@ void Segmented::initSegments(const Vector &position)
{
for (size_t i = 0; i < segments.size(); i++)
segments[i]->position = position;
numSegments = segments.size();
}
void Segmented::destroySegments(float life)

View file

@ -40,7 +40,6 @@ protected:
void updateSegment(int i, const Vector &diff);
void destroySegments(float life = 0.01f);
std::vector<Vector> lastPositions;
int numSegments;
std::vector<RenderObject *> segments;
};

View file

@ -309,7 +309,7 @@ void loadShotCallback(const std::string &filename, void *param)
ShotData shotData;
std::string ident;
int first = filename.find_last_of('/')+1;
size_t first = filename.find_last_of('/')+1;
ident = filename.substr(first, filename.find_last_of('.')-first);
stringToLower(ident);
debugLog(ident);
@ -385,7 +385,7 @@ void Shot::applyShotData(const ShotData& shotData)
if (shotData.numSegs > 0)
{
segments.resize(shotData.numSegs);
for (int i = segments.size()-1; i >=0 ; i--)
for (size_t i = segments.size(); i --> 0; )
{
Quad *flame = new Quad;
flame->setTexture(shotData.segTexture);
@ -669,7 +669,7 @@ void Shot::hitEntity(Entity *e, Bone *b)
void Shot::noSegs()
{
if (numSegments > 0)
if (!segments.empty())
{
destroySegments();
}

View file

@ -149,7 +149,7 @@ protected:
bool updateScript;
private:
unsigned int shotIdx;
size_t shotIdx;
};
#endif

View file

@ -44,12 +44,12 @@ void SteamRender::onRender(const RenderState& rs) const
if (p->active)
{
int w2 = p->rect.getWidth()/2;
const float w2 = p->rect.getWidth()/2;
if (true)
{
const int sz = p->nodes.size()-1;
for (int n = 0; n < sz; n++)
const size_t sz = p->nodes.size()-1;
for (size_t n = 0; n < sz; n++)
{
const PathNode *n1 = &p->nodes[n];
const PathNode *n2 = &p->nodes[n+1];

View file

@ -51,7 +51,7 @@ void Strand::onUpdate(float dt)
void Strand::onRender(const RenderState& rs) const
{
const int numSegments = segments.size();
const size_t numSegments = segments.size();
if (numSegments == 0) return;
glTranslatef(-position.x, -position.y, 0);
@ -71,8 +71,8 @@ void Strand::onRender(const RenderState& rs) const
glColor4ub(r>>8, g>>8, b>>8, a>>8);
glVertex2f(position.x, position.y);
glVertex2f(segments[0]->position.x, segments[0]->position.y);
const int colorLimit = numSegments<50 ? numSegments : 50;
int i;
const size_t colorLimit = numSegments<50 ? numSegments : 50;
size_t i;
for (i = 1; i < colorLimit; i++)
{
r -= dr;

View file

@ -61,7 +61,7 @@ void Web::setExistence(float t)
existence = t;
}
int Web::addPoint(const Vector &point)
size_t Web::addPoint(const Vector &point)
{
points.push_back(point);
return points.size()-1;
@ -81,7 +81,7 @@ Vector Web::getPoint(size_t pt) const
return v;
}
int Web::getNumPoints()
size_t Web::getNumPoints() const
{
return points.size();
}

View file

@ -29,11 +29,11 @@ class Web : public RenderObject
{
public:
Web();
int addPoint(const Vector &point = Vector(0,0));
size_t addPoint(const Vector &point = Vector(0,0));
void setPoint(size_t pt, const Vector &v);
Vector getPoint(size_t pt) const;
void setParentEntity(Entity *e);
int getNumPoints();
size_t getNumPoints() const;
typedef std::list<Web*> Webs;
static Webs webs;
static void killAllWebs();

View file

@ -230,7 +230,7 @@ void VectorPath::splice(const VectorPath &path, int sz)
}
}
void VectorPath::removeNodes(unsigned int startInclusive, unsigned int endInclusive)
void VectorPath::removeNodes(size_t startInclusive, size_t endInclusive)
{
// end iterator is exclusive, so max. end + 1
pathNodes.erase(pathNodes.begin() + startInclusive, pathNodes.begin() + std::min<size_t>(pathNodes.size(), endInclusive+1));

View file

@ -391,7 +391,7 @@ public:
void calculatePercentages();
float getLength();
void realPercentageCalc();
void removeNodes(unsigned int startInclusive, unsigned int endInclusive);
void removeNodes(size_t startInclusive, size_t endInclusive);
float getSubSectionLength(int startIncl, int endIncl);
protected:
std::vector <VectorPathNode> pathNodes;