1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-07-04 06:54:39 +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; this->textscale = textscale;
} }
void AquariaComboBox::enqueueSelectItem(int index) void AquariaComboBox::enqueueSelectItem(size_t index)
{ {
enqueuedSelectItem = index; enqueuedSelectItem = index;
} }
@ -97,7 +97,9 @@ void AquariaComboBox::doScroll(int t)
else else
{ {
scroll++; scroll++;
if (scroll+numDrops > items.size()) scroll = (items.size()) - numDrops; if (scroll+numDrops > items.size()) {
scroll = items.size() - numDrops;
}
else else
{ {
close(0); close(0);
@ -298,7 +300,7 @@ bool AquariaComboBox::setSelectedItem(const std::string &item)
return false; return false;
} }
void AquariaComboBox::setSelectedItem(int index) void AquariaComboBox::setSelectedItem(size_t index)
{ {
if (isopen) if (isopen)
close(); close();
@ -311,7 +313,7 @@ void AquariaComboBox::setSelectedItem(int index)
{ {
doScroll(0); doScroll(0);
} }
else if((size_t)index < items.size()) else if(index < items.size())
{ {
selectedItem = index; selectedItem = index;
selectedItemLabel->setText(items[index]); selectedItemLabel->setText(items[index]);
@ -326,12 +328,12 @@ void AquariaComboBox::setSelectedItem(int index)
} }
} }
int AquariaComboBox::getSelectedItem() size_t AquariaComboBox::getSelectedItem()
{ {
return selectedItem; return selectedItem;
} }
int AquariaComboBox::addItem(const std::string &n) size_t AquariaComboBox::addItem(const std::string &n)
{ {
items.push_back(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 unselectedColor(0.7f, 0.7f, 0.7f);
Vector selectedColor(1,1,1); 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; this->combo = combo;
index = idx; index = idx;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -473,84 +473,83 @@ std::string Continuity::getIEString(IngredientData *data, size_t i)
os << fabsf(fx.magnitude); os << fabsf(fx.magnitude);
return os.str(); return os.str();
} }
break; // break;
case IET_MAXHP: case IET_MAXHP:
return dsq->continuity.stringBank.get(201); return dsq->continuity.stringBank.get(201);
break; // break;
case IET_DEFENSE: case IET_DEFENSE:
os << dsq->continuity.stringBank.get(202); os << dsq->continuity.stringBank.get(202);
os << " " << fx.magnitude << " " << dsq->continuity.stringBank.get(205) << " " << defenseTime << " " << dsq->continuity.stringBank.get(203); os << " " << fx.magnitude << " " << dsq->continuity.stringBank.get(205) << " " << defenseTime << " " << dsq->continuity.stringBank.get(203);
return os.str(); return os.str();
break; // break;
case IET_SPEED: case IET_SPEED:
os << dsq->continuity.stringBank.get(204) << " " << fx.magnitude; os << dsq->continuity.stringBank.get(204) << " " << fx.magnitude;
os << " " << dsq->continuity.stringBank.get(205) << " " << speedTime << " " << dsq->continuity.stringBank.get(203); os << " " << dsq->continuity.stringBank.get(205) << " " << speedTime << " " << dsq->continuity.stringBank.get(203);
return os.str(); return os.str();
break; // break;
case IET_REGEN: case IET_REGEN:
os << dsq->continuity.stringBank.get(206) << " " << fx.magnitude; os << dsq->continuity.stringBank.get(206) << " " << fx.magnitude;
return os.str(); return os.str();
break; // break;
case IET_TRIP: case IET_TRIP:
return dsq->continuity.stringBank.get(207); return dsq->continuity.stringBank.get(207);
break; // break;
case IET_EAT: case IET_EAT:
return dsq->continuity.stringBank.get(208); return dsq->continuity.stringBank.get(208);
break; // break;
case IET_BITE: case IET_BITE:
os << dsq->continuity.stringBank.get(209); os << dsq->continuity.stringBank.get(209);
os << " " << dsq->continuity.stringBank.get(205) << " " << biteTime << " " << dsq->continuity.stringBank.get(203); os << " " << dsq->continuity.stringBank.get(205) << " " << biteTime << " " << dsq->continuity.stringBank.get(203);
return os.str(); return os.str();
break; // break;
case IET_FISHPOISON: case IET_FISHPOISON:
os << dsq->continuity.stringBank.get(217); os << dsq->continuity.stringBank.get(217);
os << " " << dsq->continuity.stringBank.get(205) << " " << fishPoisonTime << " " << dsq->continuity.stringBank.get(203); os << " " << dsq->continuity.stringBank.get(205) << " " << fishPoisonTime << " " << dsq->continuity.stringBank.get(203);
return os.str(); return os.str();
break; // break;
case IET_INVINCIBLE: case IET_INVINCIBLE:
os << dsq->continuity.stringBank.get(210); os << dsq->continuity.stringBank.get(210);
os << " " << dsq->continuity.stringBank.get(205) << " " << (fx.magnitude*5) << " " << dsq->continuity.stringBank.get(203); os << " " << dsq->continuity.stringBank.get(205) << " " << (fx.magnitude*5) << " " << dsq->continuity.stringBank.get(203);
return os.str(); return os.str();
// break;
break;
case IET_ENERGY: case IET_ENERGY:
os << dsq->continuity.stringBank.get(211) << " " << fx.magnitude; os << dsq->continuity.stringBank.get(211) << " " << fx.magnitude;
os << " " << dsq->continuity.stringBank.get(205) << " " << energyTime << " " << dsq->continuity.stringBank.get(203); os << " " << dsq->continuity.stringBank.get(205) << " " << energyTime << " " << dsq->continuity.stringBank.get(203);
return os.str(); return os.str();
break; // break;
case IET_BLIND: case IET_BLIND:
return dsq->continuity.stringBank.get(212); return dsq->continuity.stringBank.get(212);
break; // break;
case IET_POISON: case IET_POISON:
if (fx.magnitude < 0) if (fx.magnitude < 0)
return dsq->continuity.stringBank.get(213); return dsq->continuity.stringBank.get(213);
else else
return dsq->continuity.stringBank.get(214); return dsq->continuity.stringBank.get(214);
break; // break;
case IET_YUM: case IET_YUM:
return dsq->continuity.stringBank.get(215); return dsq->continuity.stringBank.get(215);
break; // break;
case IET_WEB: case IET_WEB:
os << dsq->continuity.stringBank.get(219); os << dsq->continuity.stringBank.get(219);
os << " " << dsq->continuity.stringBank.get(205) << " " << webTime << " " << dsq->continuity.stringBank.get(203); os << " " << dsq->continuity.stringBank.get(205) << " " << webTime << " " << dsq->continuity.stringBank.get(203);
return os.str(); return os.str();
break; // break;
case IET_ALLSTATUS: case IET_ALLSTATUS:
return dsq->continuity.stringBank.get(218); return dsq->continuity.stringBank.get(218);
break; // break;
case IET_PETPOWER: case IET_PETPOWER:
os << dsq->continuity.stringBank.get(216); os << dsq->continuity.stringBank.get(216);
os << " " << dsq->continuity.stringBank.get(205) << " " << petPowerTime << " " << dsq->continuity.stringBank.get(203); os << " " << dsq->continuity.stringBank.get(205) << " " << petPowerTime << " " << dsq->continuity.stringBank.get(203);
return os.str(); return os.str();
break; // break;
case IET_LIGHT: case IET_LIGHT:
os << dsq->continuity.stringBank.get(220); os << dsq->continuity.stringBank.get(220);
os << " " << dsq->continuity.stringBank.get(205) << " " << lightTime << " " << dsq->continuity.stringBank.get(203); os << " " << dsq->continuity.stringBank.get(205) << " " << lightTime << " " << dsq->continuity.stringBank.get(203);
return os.str(); return os.str();
break; // break;
case IET_LI: case IET_LI:
return dsq->continuity.stringBank.get(227); return dsq->continuity.stringBank.get(227);
break; // break;
case IET_SCRIPT: case IET_SCRIPT:
if(dsq->game->cookingScript) 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 along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __dsq__ #ifndef DSQ_H
#define __dsq__ #define DSQ_H
#include "AquariaCompileConfig.h" #include "AquariaCompileConfig.h"
#include "../BBGE/Core.h" #include "../BBGE/Core.h"
@ -236,8 +236,8 @@ public:
void addElement(Element *e); void addElement(Element *e);
size_t getNumElements() const {return elements.size();} size_t getNumElements() const {return elements.size();}
Element *getElement(int idx) const {return elements[idx];} Element *getElement(size_t idx) const {return elements[idx];}
Element *getFirstElementOnLayer(int layer) const {return layer<0 || layer>15 ? 0 : firstElementOnLayer[layer];} Element *getFirstElementOnLayer(size_t layer) const {return layer>15 ? 0 : firstElementOnLayer[layer];}
void clearElements(); void clearElements();
// Used only by scene editor: // Used only by scene editor:
void removeElement(size_t idx); void removeElement(size_t idx);
@ -527,7 +527,7 @@ protected:
BitmapText *expText, *moneyText; BitmapText *expText, *moneyText;
void clearMenu(float t = 0.01); void clearMenu(float t = 0.01f);
std::vector <RenderObject*> menu; std::vector <RenderObject*> menu;
BitmapText *saveSlotPageCount; BitmapText *saveSlotPageCount;

View file

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

View file

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

View file

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

View file

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

View file

@ -106,7 +106,7 @@ std::string getInputCodeToString(int k)
return spacesToUnderscores(s); 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; const char *pretty = NULL, *tail = NULL;

View file

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

View file

@ -37,7 +37,7 @@ const int ACTIONSET_REASSIGN_JOYSTICK = -2;
struct JoystickConfig struct JoystickConfig
{ {
JoystickConfig(); JoystickConfig();
int s1ax, s1ay, s2ax, s2ay; unsigned int s1ax, s1ay, s2ax, s2ay;
float s1dead, s2dead; float s1dead, s2dead;
}; };
@ -59,7 +59,7 @@ public:
ActionInput *addActionInput(const std::string &name); ActionInput *addActionInput(const std::string &name);
ActionInput *getActionInputByName(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 --- // --- Saved in config ---
ActionInputSet inputSet; ActionInputSet inputSet;

View file

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

View file

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

View file

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

View file

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

View file

@ -77,7 +77,7 @@ public:
float getStringWidth(const std::string& text); float getStringWidth(const std::string& text);
float getActualWidth() { return maxW; } float getActualWidth() { return maxW; }
float getLineHeight(); float getLineHeight();
int getNumLines(); size_t getNumLines();
protected: protected:
float scrollSpeed; 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; size_t i = idx;
return i < joysticks.size() ? joysticks[i] : NULL; 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 along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __core__ #ifndef CORE_H
#define __core__ #define CORE_H
#include "Base.h" #include "Base.h"
#include "RenderObject.h" #include "RenderObject.h"
@ -139,8 +139,8 @@ public:
RenderObject *getNext() RenderObject *getNext()
{ {
const int size = renderObjects.size(); const size_t size = renderObjects.size();
int i; size_t i;
for (i = iter; i < size; i++) for (i = iter; i < size; i++)
{ {
if (renderObjects[i] != 0) if (renderObjects[i] != 0)
@ -322,8 +322,8 @@ public:
void setBaseTextureDirectory(const std::string &baseTextureDirectory) void setBaseTextureDirectory(const std::string &newBaseTextureDirectory)
{ this->baseTextureDirectory = baseTextureDirectory; } { this->baseTextureDirectory = newBaseTextureDirectory; }
std::string getBaseTextureDirectory() std::string getBaseTextureDirectory()
{ {
return baseTextureDirectory; return baseTextureDirectory;
@ -535,9 +535,9 @@ public:
// inclusive! // inclusive!
inline int getMaxActionStatusIndex() const { return int(actionStatus.size()) - 2; } inline int getMaxActionStatusIndex() const { return int(actionStatus.size()) - 2; }
// pass -1 for is a sentinel that captures all input // 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! // not the actual number of joysticks!
size_t getNumJoysticks() const { return joysticks.size(); } size_t getNumJoysticks() const { return joysticks.size(); }
Joystick *getJoystickForSourceID(int sourceID); Joystick *getJoystickForSourceID(int sourceID);

View file

@ -31,7 +31,7 @@ public:
void setText(const std::string &text); void setText(const std::string &text);
void setWidth(float width); void setWidth(float width);
void setFontSize(float sz); void setFontSize(float sz);
int getNumLines() { return lines.size(); } size_t getNumLines() { return lines.size(); }
virtual void setAlign(Align align); virtual void setAlign(Align align);
virtual float getHeight(); virtual float getHeight();
virtual float getLineHeight(); 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 along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __event__ #ifndef EVENT_H
#define __event__ #define EVENT_H
#include <stdlib.h> #include <stdlib.h>

View file

@ -34,7 +34,7 @@ public:
void calibrate(Vector &vec, float dead); void calibrate(Vector &vec, float dead);
bool anyButton() const; 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; float getAxisUncalibrated(int id) const;
int getNumAxes() const; int getNumAxes() const;
int getIndex() const { return stickIndex; } int getIndex() const { return stickIndex; }

View file

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

View file

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

View file

@ -219,10 +219,10 @@ public:
void setFree(size_t free); void setFree(size_t free);
int getFree() { return free; } size_t getFree() { return free; }
int getNumActive() { return numActive; } size_t getNumActive() { return numActive; }
void setNumSuckPositions(int num); void setNumSuckPositions(size_t num);
void setSuckPosition(size_t idx, const Vector &pos); void setSuckPosition(size_t idx, const Vector &pos);
Vector *getSuckPosition(size_t idx); 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 along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __quad__ #ifndef QUAD_H
#define __quad__ #define QUAD_H
#include "RenderObject.h" #include "RenderObject.h"
@ -55,8 +55,8 @@ public:
void setWidthHeight(float w, float h=-1); void setWidthHeight(float w, float h=-1);
void setWidth(float w); void setWidth(float w);
void setHeight(float h); void setHeight(float h);
int getWidth() const {return int(width);} unsigned int getWidth() const {return static_cast<unsigned int>(width);}
int getHeight() const {return int(height);} 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 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); 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 along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __render_object__ #ifndef RENDER_OBJECT_H
#define __render_object__ #define RENDER_OBJECT_H
#include "Base.h" #include "Base.h"
#include "Texture.h" #include "Texture.h"
@ -91,7 +91,7 @@ public:
void setStateDataObject(StateData *state); void setStateDataObject(StateData *state);
bool setTexture(const std::string &name); bool setTexture(const std::string &name);
void toggleAlpha(float t = 0.2); void toggleAlpha(float t = 0.2f);
virtual void update(float dt); virtual void update(float dt);
bool isDead() const {return _dead;} bool isDead() const {return _dead;}
@ -109,15 +109,15 @@ public:
// optimized rendering. // optimized rendering.
void setStatic(bool staticFlag) {_static = staticFlag;} 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; blendType = bt;
} }
@ -136,13 +136,13 @@ public:
bool isfvr(); bool isfvr();
size_t getIdx() const { return idx; } 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 moveToFront();
void moveToBack(); void moveToBack();
inline float getCullRadiusSqr() const inline float getCullRadiusSqr() const
{ {
if (overrideCullRadiusSqr) if (overrideCullRadiusSqr != 0)
return overrideCullRadiusSqr; return overrideCullRadiusSqr;
if (width == 0 || height == 0) if (width == 0 || height == 0)
return 0; return 0;
@ -260,7 +260,7 @@ public:
bool cull; bool cull;
float updateCull; float updateCull;
int layer; size_t layer;
InterpolatedVector *positionSnapTo; InterpolatedVector *positionSnapTo;

View file

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

View file

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

View file

@ -117,7 +117,7 @@ public:
void clearLocalSounds(); 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 loadLocalSound(const std::string &sound);
SoundCore::Buffer loadSoundIntoBank(const std::string &filename, const std::string &path, const std::string &format, SoundLoadType = SFXLOAD_CACHE); 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 stopMusic();
void stopSfx(void *channel); 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); 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 along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __state_data__ #ifndef STATE_DATA_H
#define __state_data__ #define STATE_DATA_H
#include "Base.h" #include "Base.h"
#include <map> #include <map>

View file

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

View file

@ -52,7 +52,7 @@ public:
bool shadow; bool shadow;
int findLine(const std::string &label); int findLine(const std::string &label);
float getLineHeight(); float getLineHeight();
int getNumLines(); size_t getNumLines();
protected: protected:
float width; float width;
float lineHeight; 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 along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __texture__ #ifndef TEXTURE_H
#define __texture__ #define TEXTURE_H
#include <string> #include <string>
#include "Refcounted.h" #include "Refcounted.h"

View file

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