1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-02-16 17:45:52 +00:00

Fix some warnings

mostly sign-related, but also some about commas after the last item in
an enum list, usage of default in switches, implicit or old-style casts
This commit is contained in:
Valentin Ochs 2017-01-20 04:51:38 +01:00 committed by fgenesis
parent 21fa854c87
commit 9245bee717
38 changed files with 128 additions and 126 deletions

View file

@ -67,7 +67,7 @@ AquariaComboBox::AquariaComboBox(Vector textscale) : RenderObject()
this->textscale = textscale;
}
void AquariaComboBox::enqueueSelectItem(int index)
void AquariaComboBox::enqueueSelectItem(size_t index)
{
enqueuedSelectItem = index;
}
@ -97,7 +97,9 @@ void AquariaComboBox::doScroll(int t)
else
{
scroll++;
if (scroll+numDrops > items.size()) scroll = (items.size()) - numDrops;
if (scroll+numDrops > items.size()) {
scroll = items.size() - numDrops;
}
else
{
close(0);
@ -298,7 +300,7 @@ bool AquariaComboBox::setSelectedItem(const std::string &item)
return false;
}
void AquariaComboBox::setSelectedItem(int index)
void AquariaComboBox::setSelectedItem(size_t index)
{
if (isopen)
close();
@ -311,7 +313,7 @@ void AquariaComboBox::setSelectedItem(int index)
{
doScroll(0);
}
else if((size_t)index < items.size())
else if(index < items.size())
{
selectedItem = index;
selectedItemLabel->setText(items[index]);
@ -326,12 +328,12 @@ void AquariaComboBox::setSelectedItem(int index)
}
}
int AquariaComboBox::getSelectedItem()
size_t AquariaComboBox::getSelectedItem()
{
return selectedItem;
}
int AquariaComboBox::addItem(const std::string &n)
size_t AquariaComboBox::addItem(const std::string &n)
{
items.push_back(n);
@ -346,7 +348,7 @@ int AquariaComboBox::addItem(const std::string &n)
Vector unselectedColor(0.7f, 0.7f, 0.7f);
Vector selectedColor(1,1,1);
AquariaComboBoxItem::AquariaComboBoxItem(const std::string &str, int idx, AquariaComboBox *combo, Vector textscale) : Quad()
AquariaComboBoxItem::AquariaComboBoxItem(const std::string &str, size_t idx, AquariaComboBox *combo, Vector textscale) : Quad()
{
this->combo = combo;
index = idx;

View file

@ -1,5 +1,5 @@
#ifndef __AQUARIA_COMPILE_CONFIG_H__
#define __AQUARIA_COMPILE_CONFIG_H__
#ifndef AQUARIA_COMPILE_CONFIG_H
#define AQUARIA_COMPILE_CONFIG_H
// The settings below are also configurable with CMake.
// Define BBGE_SKIP_CONFIG_HEADERS to use CMake-only configuration.

View file

@ -263,7 +263,7 @@ AquariaGuiElement *AquariaGuiElement::FindClosestTo(AquariaGuiElement *cur, Vect
if (go)
{
dist = (p1 - p2).getSquaredLength2D();
dist = static_cast<int>((p1 - p2).getSquaredLength2D());
if (smallDist == -1 || dist < smallDist)
{
@ -576,7 +576,7 @@ void AquariaKeyConfig::onUpdate(float dt)
inLoop = true;
int *k = 0;
unsigned int *k = 0;
ActionInput *ai = 0;
@ -599,7 +599,8 @@ void AquariaKeyConfig::onUpdate(float dt)
case INPUTSET_JOY:
k = &ai->data.single.joy[inputIdx];
break;
default:
case INPUTSET_NONE:
case INPUTSET_OTHER:
k = 0;
break;
}
@ -760,7 +761,7 @@ void AquariaKeyConfig::onUpdate(float dt)
{
bool clear = false;
bool abort = false;
int ac = 0;
unsigned int ac = 0;
if (core->getKeyState(KEY_DELETE) || core->getKeyState(KEY_BACKSPACE))
{
while(core->getKeyState(KEY_DELETE) || core->getKeyState(KEY_BACKSPACE))
@ -815,7 +816,7 @@ void AquariaKeyConfig::onUpdate(float dt)
break;
case INPUTSET_JOY:
{
int ac = 0;
size_t ac = 0;
bool clear = false;
bool abort = false;
if (core->getKeyState(KEY_DELETE) || core->getKeyState(KEY_BACKSPACE))
@ -833,7 +834,7 @@ void AquariaKeyConfig::onUpdate(float dt)
Joystick *j = core->getJoystick(as.joystickID);
if(j)
{
for (int i = 0; i < MAX_JOYSTICK_BTN; i++)
for (size_t i = 0; i < MAX_JOYSTICK_BTN; i++)
if (j->getButton(i))
{
ac = JOY_BUTTON_0 + i;

View file

@ -202,12 +202,12 @@ class AquariaComboBoxItem : public Quad
{
friend class AquariaComboBox;
public:
AquariaComboBoxItem(const std::string &str, int idx, AquariaComboBox *combo, Vector textscale);
AquariaComboBoxItem(const std::string &str, size_t idx, AquariaComboBox *combo, Vector textscale);
protected:
void onUpdate(float dt);
int index;
size_t index;
AquariaComboBox *combo;
BitmapText *label;
@ -218,13 +218,13 @@ class AquariaComboBox : public RenderObject
{
public:
AquariaComboBox(Vector textscale = Vector(1, 1));
int addItem(const std::string &n);
size_t addItem(const std::string &n);
void open(float t=0.1f);
void close(float t=0.1f);
void setSelectedItem(int index);
void setSelectedItem(size_t index);
bool setSelectedItem(const std::string &item);
int getSelectedItem();
void enqueueSelectItem(int index);
size_t getSelectedItem();
void enqueueSelectItem(size_t index);
void setScroll(size_t sc);
std::string getSelectedItemString();
void doScroll(int dir);
@ -235,8 +235,8 @@ protected:
size_t numDrops;
bool mb, isopen;
int scroll;
int enqueuedSelectItem;
size_t scroll;
size_t enqueuedSelectItem;
std::vector<std::string> items;

View file

@ -31,11 +31,11 @@ AquariaProgressBar::AquariaProgressBar() : RenderObject()
followCamera = 1;
}
void AquariaProgressBar::progress(float perc)
void AquariaProgressBar::progress(float addPerc)
{
if (perc==0)
perc = 0.01f;
this->perc += perc;
if (addPerc==0)
addPerc = 0.01f;
this->perc += addPerc;
spinner.rotation = Vector(0,0,this->perc*360);
core->render();
core->showBuffer();

View file

@ -28,7 +28,7 @@ class AquariaProgressBar : public RenderObject
public:
AquariaProgressBar();
void progress(float perc=0);
void progress(float addPerc=0);
protected:
Quad spinner;

View file

@ -473,84 +473,83 @@ std::string Continuity::getIEString(IngredientData *data, size_t i)
os << fabsf(fx.magnitude);
return os.str();
}
break;
// break;
case IET_MAXHP:
return dsq->continuity.stringBank.get(201);
break;
// break;
case IET_DEFENSE:
os << dsq->continuity.stringBank.get(202);
os << " " << fx.magnitude << " " << dsq->continuity.stringBank.get(205) << " " << defenseTime << " " << dsq->continuity.stringBank.get(203);
return os.str();
break;
// break;
case IET_SPEED:
os << dsq->continuity.stringBank.get(204) << " " << fx.magnitude;
os << " " << dsq->continuity.stringBank.get(205) << " " << speedTime << " " << dsq->continuity.stringBank.get(203);
return os.str();
break;
// break;
case IET_REGEN:
os << dsq->continuity.stringBank.get(206) << " " << fx.magnitude;
return os.str();
break;
// break;
case IET_TRIP:
return dsq->continuity.stringBank.get(207);
break;
// break;
case IET_EAT:
return dsq->continuity.stringBank.get(208);
break;
// break;
case IET_BITE:
os << dsq->continuity.stringBank.get(209);
os << " " << dsq->continuity.stringBank.get(205) << " " << biteTime << " " << dsq->continuity.stringBank.get(203);
return os.str();
break;
// break;
case IET_FISHPOISON:
os << dsq->continuity.stringBank.get(217);
os << " " << dsq->continuity.stringBank.get(205) << " " << fishPoisonTime << " " << dsq->continuity.stringBank.get(203);
return os.str();
break;
// break;
case IET_INVINCIBLE:
os << dsq->continuity.stringBank.get(210);
os << " " << dsq->continuity.stringBank.get(205) << " " << (fx.magnitude*5) << " " << dsq->continuity.stringBank.get(203);
return os.str();
break;
// break;
case IET_ENERGY:
os << dsq->continuity.stringBank.get(211) << " " << fx.magnitude;
os << " " << dsq->continuity.stringBank.get(205) << " " << energyTime << " " << dsq->continuity.stringBank.get(203);
return os.str();
break;
// break;
case IET_BLIND:
return dsq->continuity.stringBank.get(212);
break;
// break;
case IET_POISON:
if (fx.magnitude < 0)
return dsq->continuity.stringBank.get(213);
else
return dsq->continuity.stringBank.get(214);
break;
// break;
case IET_YUM:
return dsq->continuity.stringBank.get(215);
break;
// break;
case IET_WEB:
os << dsq->continuity.stringBank.get(219);
os << " " << dsq->continuity.stringBank.get(205) << " " << webTime << " " << dsq->continuity.stringBank.get(203);
return os.str();
break;
// break;
case IET_ALLSTATUS:
return dsq->continuity.stringBank.get(218);
break;
// break;
case IET_PETPOWER:
os << dsq->continuity.stringBank.get(216);
os << " " << dsq->continuity.stringBank.get(205) << " " << petPowerTime << " " << dsq->continuity.stringBank.get(203);
return os.str();
break;
// break;
case IET_LIGHT:
os << dsq->continuity.stringBank.get(220);
os << " " << dsq->continuity.stringBank.get(205) << " " << lightTime << " " << dsq->continuity.stringBank.get(203);
return os.str();
break;
// break;
case IET_LI:
return dsq->continuity.stringBank.get(227);
break;
// break;
case IET_SCRIPT:
if(dsq->game->cookingScript)
{

View file

@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __dsq__
#define __dsq__
#ifndef DSQ_H
#define DSQ_H
#include "AquariaCompileConfig.h"
#include "../BBGE/Core.h"
@ -236,8 +236,8 @@ public:
void addElement(Element *e);
size_t getNumElements() const {return elements.size();}
Element *getElement(int idx) const {return elements[idx];}
Element *getFirstElementOnLayer(int layer) const {return layer<0 || layer>15 ? 0 : firstElementOnLayer[layer];}
Element *getElement(size_t idx) const {return elements[idx];}
Element *getFirstElementOnLayer(size_t layer) const {return layer>15 ? 0 : firstElementOnLayer[layer];}
void clearElements();
// Used only by scene editor:
void removeElement(size_t idx);
@ -527,7 +527,7 @@ protected:
BitmapText *expText, *moneyText;
void clearMenu(float t = 0.01);
void clearMenu(float t = 0.01f);
std::vector <RenderObject*> menu;
BitmapText *saveSlotPageCount;

View file

@ -24,7 +24,7 @@ enum DamageType
DT_ENEMY_ACTIVEPOISON = 10,
DT_ENEMY_CREATOR = 11,
DT_ENEMY_MANTISBOMB = 12,
DT_ENEMY_REALMAX ,
DT_ENEMY_REALMAX = 13,
DT_ENEMY_MAX = 13,
DT_AVATAR = 1000,

View file

@ -141,7 +141,7 @@ enum AquariaActions
ACTION_LOOK ,
ACTION_TOGGLEHELPSCREEN,
ACTION_PLACE_AVATAR,
ACTION_SCREENSHOT,
ACTION_SCREENSHOT
};
enum AuraType

View file

@ -14,7 +14,7 @@ namespace tinyxml2
enum ModType
{
MODTYPE_MOD,
MODTYPE_PATCH,
MODTYPE_PATCH
};

View file

@ -38,7 +38,7 @@ protected:
void initSegments(const Vector &position);
void updateSegments(const Vector &position, bool reverse=false);
void updateSegment(int i, const Vector &diff);
void destroySegments(float life = 0.01);
void destroySegments(float life = 0.01f);
std::vector<Vector> lastPositions;
int numSegments;
std::vector<RenderObject *> segments;

View file

@ -106,7 +106,7 @@ std::string getInputCodeToString(int k)
return spacesToUnderscores(s);
}
std::string getInputCodeToUserString(int k, int joystickID)
std::string getInputCodeToUserString(unsigned int k, size_t joystickID)
{
const char *pretty = NULL, *tail = NULL;

View file

@ -32,7 +32,7 @@ enum ActionInputSize
};
std::string getInputCodeToString(int k);
std::string getInputCodeToUserString(int k, int joystickID);
std::string getInputCodeToUserString(unsigned int k, size_t joystickID);
int getStringToInputCode(const std::string& s);
class ActionInput
@ -46,9 +46,9 @@ public:
{
struct
{
int mse[INP_MSESIZE];
int key[INP_KEYSIZE];
int joy[INP_JOYSIZE];
unsigned int mse[INP_MSESIZE];
unsigned int key[INP_KEYSIZE];
unsigned int joy[INP_JOYSIZE];
} single;
int all[INP_COMBINED_SIZE];
} data;

View file

@ -37,7 +37,7 @@ const int ACTIONSET_REASSIGN_JOYSTICK = -2;
struct JoystickConfig
{
JoystickConfig();
int s1ax, s1ay, s2ax, s2ay;
unsigned int s1ax, s1ay, s2ax, s2ay;
float s1dead, s2dead;
};
@ -59,7 +59,7 @@ public:
ActionInput *addActionInput(const std::string &name);
ActionInput *getActionInputByName(const std::string &name);
int joystickID; // >= 0: use that, -1 = no joystick, or ACTIONSET_REASSIGN_JOYSTICK
size_t joystickID; // >= 0: use that, -1 = no joystick, or ACTIONSET_REASSIGN_JOYSTICK
// --- Saved in config ---
ActionInputSet inputSet;

View file

@ -29,7 +29,7 @@ class Effect
{
public:
Effect();
virtual ~Effect(){};
virtual ~Effect(){}
virtual void go(){}
virtual void update(float dt, Vector ** drawGrid, int xDivs, int yDivs){}
bool done;

View file

@ -1,5 +1,5 @@
#ifndef __BBGE_COMPILE_CONFIG_H__
#define __BBGE_COMPILE_CONFIG_H__
#ifndef BBGE_COMPILE_CONFIG_H
#define BBGE_COMPILE_CONFIG_H
#ifndef BBGE_SKIP_CONFIG_HEADERS

View file

@ -14,7 +14,7 @@ public:
virtual void setFontSize(float sz) = 0;
virtual void setAlign(Align a) = 0;
virtual float getLineHeight() = 0;
virtual int getNumLines() = 0;
virtual size_t getNumLines() = 0;
virtual float getHeight() = 0; // total height
virtual float getStringWidth(const std::string& text) = 0; // width of string when not auto-wrapped
virtual float getActualWidth() = 0; // width of text after wrapping

View file

@ -379,7 +379,7 @@ bool BitmapText::isScrollingText()
return scrolling;
}
int BitmapText::getNumLines()
size_t BitmapText::getNumLines()
{
return lines.size();
}

View file

@ -77,7 +77,7 @@ public:
float getStringWidth(const std::string& text);
float getActualWidth() { return maxW; }
float getLineHeight();
int getNumLines();
size_t getNumLines();
protected:
float scrollSpeed;

View file

@ -2840,7 +2840,7 @@ void Core::onJoystickRemoved(int instanceID)
}
}
Joystick *Core::getJoystick(int idx)
Joystick *Core::getJoystick(size_t idx)
{
size_t i = idx;
return i < joysticks.size() ? joysticks[i] : NULL;

View file

@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __core__
#define __core__
#ifndef CORE_H
#define CORE_H
#include "Base.h"
#include "RenderObject.h"
@ -139,8 +139,8 @@ public:
RenderObject *getNext()
{
const int size = renderObjects.size();
int i;
const size_t size = renderObjects.size();
size_t i;
for (i = iter; i < size; i++)
{
if (renderObjects[i] != 0)
@ -322,8 +322,8 @@ public:
void setBaseTextureDirectory(const std::string &baseTextureDirectory)
{ this->baseTextureDirectory = baseTextureDirectory; }
void setBaseTextureDirectory(const std::string &newBaseTextureDirectory)
{ this->baseTextureDirectory = newBaseTextureDirectory; }
std::string getBaseTextureDirectory()
{
return baseTextureDirectory;
@ -535,9 +535,9 @@ public:
// inclusive!
inline int getMaxActionStatusIndex() const { return int(actionStatus.size()) - 2; }
// pass -1 for is a sentinel that captures all input
inline ActionButtonStatus *getActionStatus(int idx) { return actionStatus[idx + 1]; }
inline ActionButtonStatus *getActionStatus(size_t idx) { return actionStatus[idx + 1]; }
Joystick *getJoystick(int idx); // warning: may return NULL/contain holes
Joystick *getJoystick(size_t idx); // warning: may return NULL/contain holes
// not the actual number of joysticks!
size_t getNumJoysticks() const { return joysticks.size(); }
Joystick *getJoystickForSourceID(int sourceID);

View file

@ -31,7 +31,7 @@ public:
void setText(const std::string &text);
void setWidth(float width);
void setFontSize(float sz);
int getNumLines() { return lines.size(); }
size_t getNumLines() { return lines.size(); }
virtual void setAlign(Align align);
virtual float getHeight();
virtual float getLineHeight();

View file

@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __event__
#define __event__
#ifndef EVENT_H
#define EVENT_H
#include <stdlib.h>

View file

@ -34,7 +34,7 @@ public:
void calibrate(Vector &vec, float dead);
bool anyButton() const;
bool getButton(unsigned id) const { return !!(buttonBitmask & (1u << id)); }
bool getButton(size_t id) const { return !!(buttonBitmask & (1u << id)); }
float getAxisUncalibrated(int id) const;
int getNumAxes() const;
int getIndex() const { return stickIndex; }

View file

@ -50,11 +50,11 @@ private:
inline unsigned char *getPtr()
{
return (unsigned char*)&bitmap[bitmapInts];
return reinterpret_cast<unsigned char *>(&bitmap[bitmapInts]);
}
inline const unsigned char *getPtr() const
{
return (unsigned char*)&bitmap[bitmapInts];
return reinterpret_cast<const unsigned char *>(&bitmap[bitmapInts]);
}
inline unsigned char *getEndPtr()
{

View file

@ -66,7 +66,7 @@ void ParticleManager::setSize(size_t size)
free = oldFree = 0;
}
void ParticleManager::setNumSuckPositions(int num)
void ParticleManager::setNumSuckPositions(size_t num)
{
suckPositions.resize(num);
}

View file

@ -219,10 +219,10 @@ public:
void setFree(size_t free);
int getFree() { return free; }
int getNumActive() { return numActive; }
size_t getFree() { return free; }
size_t getNumActive() { return numActive; }
void setNumSuckPositions(int num);
void setNumSuckPositions(size_t num);
void setSuckPosition(size_t idx, const Vector &pos);
Vector *getSuckPosition(size_t idx);

View file

@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __quad__
#define __quad__
#ifndef QUAD_H
#define QUAD_H
#include "RenderObject.h"
@ -55,8 +55,8 @@ public:
void setWidthHeight(float w, float h=-1);
void setWidth(float w);
void setHeight(float h);
int getWidth() const {return int(width);}
int getHeight() const {return int(height);}
unsigned int getWidth() const {return static_cast<unsigned int>(width);}
unsigned int getHeight() const {return static_cast<unsigned int>(height);}
void setSegs(int x, int y, float dgox, float dgoy, float dgmx, float dgmy, float dgtm, bool dgo);
void setDrawGridAlpha(size_t x, size_t y, float alpha);

View file

@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __render_object__
#define __render_object__
#ifndef RENDER_OBJECT_H
#define RENDER_OBJECT_H
#include "Base.h"
#include "Texture.h"
@ -91,7 +91,7 @@ public:
void setStateDataObject(StateData *state);
bool setTexture(const std::string &name);
void toggleAlpha(float t = 0.2);
void toggleAlpha(float t = 0.2f);
virtual void update(float dt);
bool isDead() const {return _dead;}
@ -109,15 +109,15 @@ public:
// optimized rendering.
void setStatic(bool staticFlag) {_static = staticFlag;}
void setLife(float life)
void setLife(float newlife)
{
maxLife = this->life = life;
maxLife = this->life = newlife;
}
void setDecayRate(float decayRate)
void setDecayRate(float newdecayRate)
{
this->decayRate = decayRate;
this->decayRate = newdecayRate;
}
void setBlendType (int bt)
void setBlendType (unsigned char bt)
{
blendType = bt;
}
@ -136,13 +136,13 @@ public:
bool isfvr();
size_t getIdx() const { return idx; }
void setIdx(size_t idx) { this->idx = idx; }
void setIdx(size_t newidx) { this->idx = newidx; }
void moveToFront();
void moveToBack();
inline float getCullRadiusSqr() const
{
if (overrideCullRadiusSqr)
if (overrideCullRadiusSqr != 0)
return overrideCullRadiusSqr;
if (width == 0 || height == 0)
return 0;
@ -260,7 +260,7 @@ public:
bool cull;
float updateCull;
int layer;
size_t layer;
InterpolatedVector *positionSnapTo;

View file

@ -103,7 +103,7 @@ class SimpleIStringStream {
/* Take over the passed-in string buffer, which must have been
* allocated with new[]. The buffer will be deleted on object
* destruction. */
TAKE_OVER,
TAKE_OVER
};
/*-------------------------------------------------------------------*/
@ -227,7 +227,7 @@ class SimpleIStringStream {
/* Is the given character a whitespace character? */
inline bool my_isspace(char c) const {
return c==' ' || c=='\t' || c=='\r' || c=='\n' || c=='\v';
};
}
/* Skip over leading whitespace. Assumes "position" is valid. */
inline void skip_spaces() {
@ -467,7 +467,7 @@ inline SimpleIStringStream &SimpleIStringStream::operator>>(short &target)
target = 0;
} else {
skip_spaces();
target = (short)strtol(position, &position, 0);
target = static_cast<short>(strtol(position, &position, 0));
error = (position == old_position || *position == 0);
}
VERIFY(short, 0);
@ -486,7 +486,7 @@ inline SimpleIStringStream &SimpleIStringStream::operator>>(unsigned short &targ
target = 0;
} else {
skip_spaces();
target = (unsigned short)strtoul(position, &position, 0);
target = static_cast<unsigned short>(strtoul(position, &position, 0));
error = (position == old_position || *position == 0);
}
VERIFY(unsigned short, 0);
@ -507,7 +507,7 @@ inline SimpleIStringStream &SimpleIStringStream::operator>>(int &target)
target = 0;
} else {
skip_spaces();
target = (int)strtol(position, &position, 0);
target = static_cast<int>(strtol(position, &position, 0));
error = (position == old_position || *position == 0);
}
VERIFY(int, 0);
@ -526,7 +526,7 @@ inline SimpleIStringStream &SimpleIStringStream::operator>>(unsigned int &target
target = 0;
} else {
skip_spaces();
target = (unsigned int)strtoul(position, &position, 0);
target = static_cast<unsigned int>(strtoul(position, &position, 0));
error = (position == old_position || *position == 0);
}
VERIFY(unsigned int, 0);
@ -678,7 +678,7 @@ inline SimpleIStringStream &SimpleIStringStream::operator>>(unsigned char &targe
if (error) {
target = 0;
} else {
target = *position;
target = static_cast<unsigned char>(*position);
if (*position) {
position++;
error = (*position == 0);
@ -714,7 +714,7 @@ inline SimpleIStringStream &SimpleIStringStream::operator>>(std::string &target)
while (*position && !my_isspace(*position)) {
position++;
}
target.assign(start, position - start);
target.assign(start, static_cast<size_t>(position - start));
error = (*position == 0);
}
}

View file

@ -35,7 +35,7 @@ enum AnimationCommand
AC_SND_PLAY ,
AC_SEGS_STOP,
AC_SET_PASS,
AC_RESET_PASS,
AC_RESET_PASS
};
class ParticleEffect;
@ -257,13 +257,13 @@ public:
std::vector<Animation> animations;
std::vector<Bone*> bones;
inline int getSelectedBoneIdx(void) { return selectedBone; }
inline size_t getSelectedBoneIdx(void) { return selectedBone; }
void setSelectedBone(int b);
void selectPrevBone();
void selectNextBone();
bool isLoaded();
int getNumAnimLayers() const { return animLayers.size(); }
size_t getNumAnimLayers() const { return animLayers.size(); }
AnimationLayer* getAnimationLayer(size_t l);
size_t getBoneIdx(Bone *b);

View file

@ -117,7 +117,7 @@ public:
void clearLocalSounds();
void setVoicePath2(const std::string &voicePath2) { this->voicePath2 = voicePath2; }
void setVoicePath2(const std::string &newVoicePath2) { this->voicePath2 = newVoicePath2; }
SoundCore::Buffer loadLocalSound(const std::string &sound);
SoundCore::Buffer loadSoundIntoBank(const std::string &filename, const std::string &path, const std::string &format, SoundLoadType = SFXLOAD_CACHE);
@ -156,7 +156,7 @@ public:
void stopMusic();
void stopSfx(void *channel);
void fadeSfx(void *channel, SoundFadeType sft=SFT_OUT, float t=0.8);
void fadeSfx(void *channel, SoundFadeType sft=SFT_OUT, float t=0.8f);
void fadeMusic(SoundFadeType sft=SFT_OUT, float t=1);

View file

@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __state_data__
#define __state_data__
#ifndef STATE_DATA_H
#define STATE_DATA_H
#include "Base.h"
#include <map>

View file

@ -110,7 +110,7 @@ void TTFText::updateAlign()
}
}
int TTFText::getNumLines()
size_t TTFText::getNumLines()
{
return (int)text.size();
}

View file

@ -52,7 +52,7 @@ public:
bool shadow;
int findLine(const std::string &label);
float getLineHeight();
int getNumLines();
size_t getNumLines();
protected:
float width;
float lineHeight;

View file

@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __texture__
#define __texture__
#ifndef TEXTURE_H
#define TEXTURE_H
#include <string>
#include "Refcounted.h"

View file

@ -227,11 +227,11 @@ public:
// length of vector
inline scalar_t getLength3D() const
{
return (scalar_t)sqrtf(x*x + y*y + z*z);
return static_cast<scalar_t>(sqrtf(x*x + y*y + z*z));
}
inline scalar_t getLength2D() const
{
return (scalar_t)sqrtf(x*x + y*y);
return static_cast<scalar_t>(sqrtf(x*x + y*y));
}
// return the unit vector
@ -376,7 +376,7 @@ public:
void addPathNode(Vector v, float p);
Vector getValue(float percent);
size_t getNumPathNodes() { return pathNodes.size(); }
void resizePathNodes(int sz) { pathNodes.resize(sz); }
void resizePathNodes(size_t sz) { pathNodes.resize(sz); }
VectorPathNode *getPathNode(size_t i) { if (i<getNumPathNodes()) return &pathNodes[i]; return 0; }
void cut(int n);
void splice(const VectorPath &path, int sz);