summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-03 21:58:08 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-04 03:06:57 +0300
commit866a71ffd576fd10c4e309195016d86f0c8ed635 (patch)
tree21bbec175afc181cada529598267d62f12fcb671
parentebecb0cf42f2066943908fa158ac91527e0e6629 (diff)
downloadplus-866a71ffd576fd10c4e309195016d86f0c8ed635.tar.gz
plus-866a71ffd576fd10c4e309195016d86f0c8ed635.tar.bz2
plus-866a71ffd576fd10c4e309195016d86f0c8ed635.tar.xz
plus-866a71ffd576fd10c4e309195016d86f0c8ed635.zip
Add const to more classes.
-rw-r--r--src/resources/spritedef.cpp86
-rw-r--r--src/resources/spritedef.h35
-rw-r--r--src/resources/subimage.cpp14
-rw-r--r--src/resources/subimage.h9
-rw-r--r--src/resources/wallpaper.cpp12
-rw-r--r--src/resources/wallpaper.h2
-rw-r--r--src/rotationalparticle.cpp10
-rw-r--r--src/rotationalparticle.h4
-rw-r--r--src/shopitem.cpp18
-rw-r--r--src/shopitem.h11
-rw-r--r--src/simpleanimation.cpp26
-rw-r--r--src/simpleanimation.h12
-rw-r--r--src/sound.cpp30
-rw-r--r--src/sound.h18
-rw-r--r--src/spellmanager.cpp40
-rw-r--r--src/spellmanager.h24
-rw-r--r--src/spellshortcut.h4
-rw-r--r--src/statuseffect.cpp29
-rw-r--r--src/statuseffect.h15
19 files changed, 214 insertions, 185 deletions
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index fd5178ec6..b55253c05 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -38,7 +38,8 @@
SpriteReference *SpriteReference::Empty = nullptr;
extern int serverVersion;
-Action *SpriteDef::getAction(std::string action, unsigned num) const
+Action *SpriteDef::getAction(const std::string &action,
+ const unsigned num) const
{
Actions::const_iterator i = mActions.find(num);
if (i == mActions.end() && num != 100)
@@ -47,7 +48,7 @@ Action *SpriteDef::getAction(std::string action, unsigned num) const
if (i == mActions.end() || !(*i).second)
return nullptr;
- ActionMap::const_iterator it = ((*i).second)->find(action);
+ const ActionMap::const_iterator it = ((*i).second)->find(action);
if (it == ((*i).second)->end())
{
@@ -58,13 +59,13 @@ Action *SpriteDef::getAction(std::string action, unsigned num) const
return (*it).second;
}
-unsigned SpriteDef::findNumber(unsigned num) const
+unsigned SpriteDef::findNumber(const unsigned num) const
{
unsigned min = 101;
for (Actions::const_iterator it = mActions.begin(),
it_end = mActions.end(); it != it_end; ++ it)
{
- unsigned n = (*it).first;
+ const unsigned n = (*it).first;
if (n >= num && n < min)
min = n;
}
@@ -73,7 +74,7 @@ unsigned SpriteDef::findNumber(unsigned num) const
return min;
}
-SpriteDef *SpriteDef::load(const std::string &animationFile, int variant)
+SpriteDef *SpriteDef::load(const std::string &animationFile, const int variant)
{
size_t pos = animationFile.find('|');
std::string palettes;
@@ -95,7 +96,7 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, int variant)
return nullptr;
}
- SpriteDef *def = new SpriteDef;
+ SpriteDef *const def = new SpriteDef;
def->mProcessedFiles.insert(animationFile);
def->loadSprite(rootNode, variant, palettes);
def->substituteActions();
@@ -109,11 +110,11 @@ void SpriteDef::fixDeadAction()
for (ActionsIter it = mActions.begin(), it_end = mActions.end();
it != it_end; ++ it)
{
- ActionMap *d = (*it).second;
+ ActionMap *const d = (*it).second;
if (!d)
continue;
- ActionMap::iterator i = d->find(SpriteAction::DEAD);
- ActionMap::iterator i2 = d->find(SpriteAction::STAND);
+ const ActionMap::iterator i = d->find(SpriteAction::DEAD);
+ const ActionMap::iterator i2 = d->find(SpriteAction::STAND);
// search dead action and check what it not same with stand action
if (i != d->end() && i->second && i->second != i2->second)
(i->second)->setLastFrameDelay(0);
@@ -125,12 +126,12 @@ void SpriteDef::substituteAction(std::string complete, std::string with)
for (ActionsConstIter it = mActions.begin(), it_end = mActions.end();
it != it_end; ++ it)
{
- ActionMap *d = (*it).second;
+ ActionMap *const d = (*it).second;
if (!d)
continue;
if (d->find(complete) == d->end())
{
- ActionMap::iterator i = d->find(with);
+ const ActionMap::iterator i = d->find(with);
if (i != d->end())
(*d)[complete] = i->second;
}
@@ -152,7 +153,7 @@ void SpriteDef::substituteActions()
substituteAction(SpriteAction::SPAWN, SpriteAction::STAND);
}
-void SpriteDef::loadSprite(XmlNodePtr spriteNode, int variant,
+void SpriteDef::loadSprite(const XmlNodePtr spriteNode, const int variant,
const std::string &palettes)
{
// Get the variant
@@ -176,7 +177,8 @@ void SpriteDef::loadSprite(XmlNodePtr spriteNode, int variant,
}
}
-void SpriteDef::loadImageSet(XmlNodePtr node, const std::string &palettes)
+void SpriteDef::loadImageSet(const XmlNodePtr node,
+ const std::string &palettes)
{
const std::string name = XML::getProperty(node, "name", "");
@@ -190,8 +192,8 @@ void SpriteDef::loadImageSet(XmlNodePtr node, const std::string &palettes)
std::string imageSrc = XML::getProperty(node, "src", "");
Dye::instantiate(imageSrc, palettes);
- ResourceManager *resman = ResourceManager::getInstance();
- ImageSet *imageSet = resman->getImageSet(imageSrc, width, height);
+ ResourceManager *const resman = ResourceManager::getInstance();
+ ImageSet *const imageSet = resman->getImageSet(imageSrc, width, height);
if (!imageSet)
{
@@ -204,20 +206,20 @@ void SpriteDef::loadImageSet(XmlNodePtr node, const std::string &palettes)
mImageSets[name] = imageSet;
}
-void SpriteDef::loadAction(XmlNodePtr node, int variant_offset)
+void SpriteDef::loadAction(const XmlNodePtr node, const int variant_offset)
{
const std::string actionName = XML::getProperty(node, "name", "");
const std::string imageSetName = XML::getProperty(node, "imageset", "");
const unsigned hp = XML::getProperty(node, "hp", 100);
- ImageSetIterator si = mImageSets.find(imageSetName);
+ const ImageSetIterator si = mImageSets.find(imageSetName);
if (si == mImageSets.end())
{
logger->log("Warning: imageset \"%s\" not defined in %s",
imageSetName.c_str(), getIdPath().c_str());
return;
}
- ImageSet *imageSet = si->second;
+ ImageSet *const imageSet = si->second;
if (actionName == SpriteAction::INVALID)
{
@@ -225,7 +227,7 @@ void SpriteDef::loadAction(XmlNodePtr node, int variant_offset)
actionName.c_str(), getIdPath().c_str());
return;
}
- Action *action = new Action;
+ Action *const action = new Action;
action->setNumber(hp);
addAction(hp, actionName, action);
@@ -234,7 +236,7 @@ void SpriteDef::loadAction(XmlNodePtr node, int variant_offset)
addAction(hp, "attack", action);
// When first action set it as default direction
- Actions::const_iterator i = mActions.find(hp);
+ const Actions::const_iterator i = mActions.find(hp);
if ((*i).second->size() == 1)
addAction(hp, SpriteAction::DEFAULT, action);
@@ -246,9 +248,9 @@ void SpriteDef::loadAction(XmlNodePtr node, int variant_offset)
}
}
-void SpriteDef::loadAnimation(XmlNodePtr animationNode,
- Action *action, ImageSet *imageSet,
- int variant_offset)
+void SpriteDef::loadAnimation(const XmlNodePtr animationNode,
+ Action *const action, ImageSet *const imageSet,
+ const int variant_offset)
{
if (!action || !imageSet)
return;
@@ -264,7 +266,7 @@ void SpriteDef::loadAnimation(XmlNodePtr animationNode,
return;
}
- Animation *animation = new Animation;
+ Animation *const animation = new Animation;
action->setAnimation(directionType, animation);
// Get animation frames
@@ -276,7 +278,7 @@ void SpriteDef::loadAnimation(XmlNodePtr animationNode,
imageSet->getOffsetX();
int offsetY = XML::getProperty(frameNode, "offsetY", 0) +
imageSet->getOffsetY();
- int rand = XML::getIntProperty(frameNode, "rand", 100, 0, 100);
+ const int rand = XML::getIntProperty(frameNode, "rand", 100, 0, 100);
offsetY -= imageSet->getHeight() - 32;
offsetX -= imageSet->getWidth() / 2 - 16;
@@ -291,7 +293,7 @@ void SpriteDef::loadAnimation(XmlNodePtr animationNode,
continue;
}
- Image *img = imageSet->get(index + variant_offset);
+ Image *const img = imageSet->get(index + variant_offset);
if (!img)
{
@@ -306,7 +308,8 @@ void SpriteDef::loadAnimation(XmlNodePtr animationNode,
const int start = XML::getProperty(frameNode, "start", -1);
const int end = XML::getProperty(frameNode, "end", -1);
const std::string value = XML::getProperty(frameNode, "value", "");
- int repeat = XML::getIntProperty(frameNode, "repeat", 1, 0, 100);
+ const int repeat = XML::getIntProperty(
+ frameNode, "repeat", 1, 0, 100);
if (repeat < 1)
{
@@ -338,14 +341,14 @@ void SpriteDef::loadAnimation(XmlNodePtr animationNode,
}
else if (idx != std::string::npos)
{
- int v1 = atoi(str.substr(0, idx).c_str());
- int v2 = atoi(str.substr(idx + 1).c_str());
+ const int v1 = atoi(str.substr(0, idx).c_str());
+ const int v2 = atoi(str.substr(idx + 1).c_str());
addSequence(v1, v2, delay, offsetX, offsetY,
variant_offset, repeat, rand, imageSet, animation);
}
else
{
- Image *img = imageSet->get(atoi(
+ Image *const img = imageSet->get(atoi(
str.c_str()) + variant_offset);
if (img)
{
@@ -384,7 +387,7 @@ void SpriteDef::loadAnimation(XmlNodePtr animationNode,
} // for frameNode
}
-void SpriteDef::includeSprite(XmlNodePtr includeNode)
+void SpriteDef::includeSprite(const XmlNodePtr includeNode)
{
std::string filename = XML::getProperty(includeNode, "file", "");
@@ -401,7 +404,7 @@ void SpriteDef::includeSprite(XmlNodePtr includeNode)
mProcessedFiles.insert(filename);
XML::Document doc(filename);
- XmlNodePtr rootNode = doc.rootNode();
+ const XmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, "sprite"))
{
@@ -470,19 +473,22 @@ SpriteDirection SpriteDef::makeSpriteDirection(const std::string &direction)
return DIRECTION_INVALID;
}
-void SpriteDef::addAction(unsigned hp, std::string name, Action *action)
+void SpriteDef::addAction(const unsigned hp, const std::string &name,
+ Action *const action)
{
- Actions::const_iterator i = mActions.find(hp);
+ const Actions::const_iterator i = mActions.find(hp);
if (i == mActions.end())
mActions[hp] = new ActionMap();
(*mActions[hp])[name] = action;
}
-bool SpriteDef::addSequence(int start, int end, int delay,
- int offsetX, int offsetY, int variant_offset,
- int repeat, int rand, ImageSet *imageSet,
- Animation *animation)
+bool SpriteDef::addSequence(const int start, const int end, const int delay,
+ const int offsetX, const int offsetY,
+ const int variant_offset,
+ int repeat, const int rand,
+ ImageSet *const imageSet,
+ Animation *const animation) const
{
if (start < 0 || end < 0)
{
@@ -497,7 +503,7 @@ bool SpriteDef::addSequence(int start, int end, int delay,
int pos = start;
while (end >= pos)
{
- Image *img = imageSet->get(pos + variant_offset);
+ Image *const img = imageSet->get(pos + variant_offset);
if (!img)
{
@@ -521,7 +527,7 @@ bool SpriteDef::addSequence(int start, int end, int delay,
int pos = start;
while (end <= pos)
{
- Image *img = imageSet->get(pos + variant_offset);
+ Image *const img = imageSet->get(pos + variant_offset);
if (!img)
{
diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h
index 461e60230..565c3a95a 100644
--- a/src/resources/spritedef.h
+++ b/src/resources/spritedef.h
@@ -44,7 +44,7 @@ struct SpriteReference
sprite(""), variant(0)
{}
- SpriteReference(std::string sprite0, int variant0) :
+ SpriteReference(const std::string &sprite0, const int variant0) :
sprite(sprite0), variant(variant0)
{
}
@@ -113,14 +113,14 @@ class SpriteDef : public Resource
/**
* Loads a sprite definition file.
*/
- static SpriteDef *load(const std::string &file, int variant);
+ static SpriteDef *load(const std::string &file, const int variant);
/**
* Returns the specified action.
*/
- Action *getAction(std::string action, unsigned num) const;
+ Action *getAction(const std::string &action, const unsigned num) const;
- unsigned findNumber(unsigned num) const;
+ unsigned findNumber(const unsigned num) const;
/**
* Converts a string into a SpriteDirection enum.
@@ -129,12 +129,15 @@ class SpriteDef : public Resource
makeSpriteDirection(const std::string &direction);
- void addAction(unsigned hp, std::string name, Action *action);
+ void addAction(const unsigned hp, const std::string &name,
+ Action *const action);
- bool addSequence(int start, int end, int delay,
- int offsetX, int offsetY, int variant_offset,
- int repeat, int rand, ImageSet *imageSet,
- Animation *animation);
+ bool addSequence(const int start, const int end, const int delay,
+ const int offsetX, const int offsetY,
+ const int variant_offset,
+ int repeat, const int rand,
+ ImageSet *const imageSet,
+ Animation *const animation) const;
private:
/**
@@ -151,30 +154,30 @@ class SpriteDef : public Resource
/**
* Loads a sprite element.
*/
- void loadSprite(XmlNodePtr spriteNode, int variant,
+ void loadSprite(const XmlNodePtr spriteNode, const int variant,
const std::string &palettes = "");
/**
* Loads an imageset element.
*/
- void loadImageSet(XmlNodePtr node, const std::string &palettes);
+ void loadImageSet(const XmlNodePtr node, const std::string &palettes);
/**
* Loads an action element.
*/
- void loadAction(XmlNodePtr node, int variant_offset);
+ void loadAction(const XmlNodePtr node, const int variant_offset);
/**
* Loads an animation element.
*/
- void loadAnimation(XmlNodePtr animationNode,
- Action *action, ImageSet *imageSet,
- int variant_offset);
+ void loadAnimation(const XmlNodePtr animationNode,
+ Action *const action, ImageSet *const imageSet,
+ const int variant_offset);
/**
* Include another sprite into this one.
*/
- void includeSprite(XmlNodePtr includeNode);
+ void includeSprite(const XmlNodePtr includeNode);
/**
* Complete missing actions by copying existing ones.
diff --git a/src/resources/subimage.cpp b/src/resources/subimage.cpp
index 2dc7d4a7a..138805d24 100644
--- a/src/resources/subimage.cpp
+++ b/src/resources/subimage.cpp
@@ -31,8 +31,9 @@
#include "debug.h"
-SubImage::SubImage(Image *parent, SDL_Surface *image,
- int x, int y, int width, int height):
+SubImage::SubImage(Image *const parent, SDL_Surface *const image,
+ const int x, const int y,
+ const int width, const int height) :
Image(image),
mParent(parent)
{
@@ -77,9 +78,9 @@ SubImage::SubImage(Image *parent, SDL_Surface *image,
}
#ifdef USE_OPENGL
-SubImage::SubImage(Image *parent, GLuint image,
- int x, int y, int width, int height,
- int texWidth, int texHeight):
+SubImage::SubImage(Image *const parent, const GLuint image,
+ const int x, const int y, const int width, const int height,
+ const int texWidth, const int texHeight):
Image(image, width, height, texWidth, texHeight),
mParent(parent)
{
@@ -128,7 +129,8 @@ SubImage::~SubImage()
}
}
-Image *SubImage::getSubImage(int x, int y, int w, int h)
+Image *SubImage::getSubImage(const int x, const int y,
+ const int w, const int h)
{
if (mParent)
return mParent->getSubImage(mBounds.x + x, mBounds.y + y, w, h);
diff --git a/src/resources/subimage.h b/src/resources/subimage.h
index 1ff268288..4b5478b71 100644
--- a/src/resources/subimage.h
+++ b/src/resources/subimage.h
@@ -51,11 +51,12 @@ class SubImage : public Image
/**
* Constructor.
*/
- SubImage(Image *parent, SDL_Surface *image,
- int x, int y, int width, int height);
+ SubImage(Image *const parent, SDL_Surface *const image,
+ const int x, const int y, const int width, const int height);
#ifdef USE_OPENGL
- SubImage(Image *parent, GLuint image, int x, int y,
- int width, int height, int texWidth, int textHeight);
+ SubImage(Image *const parent, const GLuint image,
+ const int x, const int y, const int width, const int height,
+ const int texWidth, const int textHeight);
#endif
/**
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index 9ee87e33a..3a5cd05b7 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -44,7 +44,7 @@ struct WallpaperData
int height;
};
-static bool wallpaperCompare(WallpaperData a, WallpaperData b);
+static bool wallpaperCompare(const WallpaperData &a, const WallpaperData &b);
static std::vector<WallpaperData> wallpaperData;
static bool haveBackup; // Is the backup (no size given) version available?
@@ -55,7 +55,7 @@ static std::string wallpaperFile;
// Search for the wallpaper path values sequentially..
static void initDefaultWallpaperPaths()
{
- ResourceManager *resman = ResourceManager::getInstance();
+ ResourceManager *const resman = ResourceManager::getInstance();
// Init the path
wallpaperPath = branding.getStringValue("wallpapersPath");
@@ -78,10 +78,10 @@ static void initDefaultWallpaperPaths()
wallpaperFile = "login_wallpaper.png";
}
-static bool wallpaperCompare(WallpaperData a, WallpaperData b)
+static bool wallpaperCompare(const WallpaperData &a, const WallpaperData &b)
{
- int aa = a.width * a.height;
- int ab = b.width * b.height;
+ const int aa = a.width * a.height;
+ const int ab = b.width * b.height;
return (aa > ab || (aa == ab && a.width > b.width));
}
@@ -135,7 +135,7 @@ void Wallpaper::loadWallpapers()
std::sort(wallpaperData.begin(), wallpaperData.end(), wallpaperCompare);
}
-std::string Wallpaper::getWallpaper(int width, int height)
+std::string Wallpaper::getWallpaper(const int width, const int height)
{
WallpaperData wp;
diff --git a/src/resources/wallpaper.h b/src/resources/wallpaper.h
index 7123cfd96..517ace011 100644
--- a/src/resources/wallpaper.h
+++ b/src/resources/wallpaper.h
@@ -45,7 +45,7 @@ class Wallpaper
* @param height the desired height
* @return the file to use, or empty if no wallpapers are useable
*/
- static std::string getWallpaper(int width, int height);
+ static std::string getWallpaper(const int width, const int height);
};
#endif // WALLPAPER_H
diff --git a/src/rotationalparticle.cpp b/src/rotationalparticle.cpp
index 8c024c4fa..84fe07d62 100644
--- a/src/rotationalparticle.cpp
+++ b/src/rotationalparticle.cpp
@@ -29,13 +29,15 @@
static const double PI = 3.14159265;
-RotationalParticle::RotationalParticle(Map *map, Animation *animation):
+RotationalParticle::RotationalParticle(Map *const map,
+ Animation *const animation) :
ImageParticle(map, nullptr),
mAnimation(new SimpleAnimation(animation))
{
}
-RotationalParticle::RotationalParticle(Map *map, XmlNodePtr animationNode,
+RotationalParticle::RotationalParticle(Map *const map,
+ const XmlNodePtr animationNode,
const std::string& dyePalettes):
ImageParticle(map, nullptr),
mAnimation(new SimpleAnimation(animationNode, dyePalettes))
@@ -56,7 +58,7 @@ bool RotationalParticle::update()
// TODO: cache velocities to avoid spamming atan2()
- int size = mAnimation->getLength();
+ const int size = mAnimation->getLength();
if (!size)
return false;
@@ -64,7 +66,7 @@ bool RotationalParticle::update()
if (rad < 0)
rad = static_cast<float>(PI) + static_cast<float>(PI) + rad;
- float range = static_cast<float>(PI / size);
+ const float range = static_cast<const float>(PI / size);
// Determines which frame the particle should play
if (rad < range || rad > ((static_cast<float>(PI)*2) - range))
diff --git a/src/rotationalparticle.h b/src/rotationalparticle.h
index 251e3769c..e951e4c77 100644
--- a/src/rotationalparticle.h
+++ b/src/rotationalparticle.h
@@ -34,9 +34,9 @@ class SimpleAnimation;
class RotationalParticle : public ImageParticle
{
public:
- RotationalParticle(Map *map, Animation *animation);
+ RotationalParticle(Map *const map, Animation *const animation);
- RotationalParticle(Map *map, XmlNodePtr animationNode,
+ RotationalParticle(Map *const map, const XmlNodePtr animationNode,
const std::string& dyePalettes = std::string());
~RotationalParticle();
diff --git a/src/shopitem.cpp b/src/shopitem.cpp
index a9068bacb..8d91c6ca0 100644
--- a/src/shopitem.cpp
+++ b/src/shopitem.cpp
@@ -29,8 +29,9 @@
#include "debug.h"
-ShopItem::ShopItem(int inventoryIndex, int id, unsigned char color,
- int quantity, int price) :
+ShopItem::ShopItem(const int inventoryIndex, const int id,
+ const unsigned char color,
+ const int quantity, const int price) :
Item(id, 0, 0, color),
mPrice(price),
mShowQuantity(true)
@@ -52,7 +53,7 @@ ShopItem::ShopItem(int inventoryIndex, int id, unsigned char color,
addDuplicate(inventoryIndex, quantity);
}
-ShopItem::ShopItem (int id, unsigned char color, int price) :
+ShopItem::ShopItem (const int id, const unsigned char color, const int price) :
Item (id, 0, 0, color),
mPrice(price),
mShowQuantity(false)
@@ -100,9 +101,9 @@ void ShopItem::update()
}
}
-void ShopItem::addDuplicate(int inventoryIndex, int quantity)
+void ShopItem::addDuplicate(const int inventoryIndex, const int quantity)
{
- DuplicateItem* di = new DuplicateItem;
+ DuplicateItem *const di = new DuplicateItem;
di->inventoryIndex = inventoryIndex;
di->quantity = quantity;
mDuplicates.push(di);
@@ -111,19 +112,20 @@ void ShopItem::addDuplicate(int inventoryIndex, int quantity)
void ShopItem::addDuplicate()
{
- DuplicateItem* di = new DuplicateItem;
+ DuplicateItem *const di = new DuplicateItem;
di->inventoryIndex = -1;
di->quantity = 0;
mDuplicates.push(di);
}
-int ShopItem::sellCurrentDuplicate(int quantity)
+int ShopItem::sellCurrentDuplicate(const int quantity)
{
DuplicateItem* dupl = mDuplicates.top();
if (!dupl)
return 0;
- int sellCount = quantity <= dupl->quantity ? quantity : dupl->quantity;
+ const int sellCount = quantity <= dupl->quantity
+ ? quantity : dupl->quantity;
dupl->quantity -= sellCount;
mQuantity -= sellCount;
if (dupl->quantity == 0)
diff --git a/src/shopitem.h b/src/shopitem.h
index 61d23a4ab..0608d0c4a 100644
--- a/src/shopitem.h
+++ b/src/shopitem.h
@@ -42,8 +42,9 @@ class ShopItem : public Item
* @param quantity number of available copies of the item
* @param price price of the item
*/
- ShopItem(int inventoryIndex, int id, unsigned char color,
- int quantity, int price);
+ ShopItem(const int inventoryIndex, const int id,
+ const unsigned char color,
+ const int quantity, const int price);
/**
* Constructor. Creates a new ShopItem. Inventory index will be set to
@@ -52,7 +53,7 @@ class ShopItem : public Item
* @param id the id of the item
* @param price price of the item
*/
- ShopItem(int id, unsigned char color, int price);
+ ShopItem(const int id, const unsigned char color, const int price);
/**
* Destructor.
@@ -65,7 +66,7 @@ class ShopItem : public Item
* @param inventoryIndex the inventory index of the item
* @param quantity number of available copies of the item
*/
- void addDuplicate(int inventoryIndex, int quantity);
+ void addDuplicate(const int inventoryIndex, const int quantity);
/**
* Add a duplicate. Id and price will be taken from this item.
@@ -108,7 +109,7 @@ class ShopItem : public Item
*
* @return the amount, that actually was sold.
*/
- int sellCurrentDuplicate(int quantity);
+ int sellCurrentDuplicate(const int quantity);
/**
* Gets the price of the item.
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp
index 9ab011c92..595a7aaaf 100644
--- a/src/simpleanimation.cpp
+++ b/src/simpleanimation.cpp
@@ -35,7 +35,7 @@
#include "debug.h"
-SimpleAnimation::SimpleAnimation(Animation *animation):
+SimpleAnimation::SimpleAnimation(Animation *const animation) :
mAnimation(animation),
mAnimationTime(0),
mAnimationPhase(0),
@@ -44,7 +44,7 @@ SimpleAnimation::SimpleAnimation(Animation *animation):
{
}
-SimpleAnimation::SimpleAnimation(XmlNodePtr animationNode,
+SimpleAnimation::SimpleAnimation(const XmlNodePtr animationNode,
const std::string& dyePalettes):
mAnimation(new Animation),
mAnimationTime(0),
@@ -64,7 +64,8 @@ SimpleAnimation::~SimpleAnimation()
mAnimation = nullptr;
}
-bool SimpleAnimation::draw(Graphics *graphics, int posX, int posY) const
+bool SimpleAnimation::draw(Graphics *const graphics,
+ const int posX, const int posY) const
{
if (!mCurrentFrame || !mCurrentFrame->image)
return false;
@@ -93,7 +94,7 @@ void SimpleAnimation::setFrame(int frame)
mCurrentFrame = &mAnimation->mFrames[mAnimationPhase];
}
-bool SimpleAnimation::update(int timePassed)
+bool SimpleAnimation::update(const int timePassed)
{
if (!mCurrentFrame || !mAnimation)
return false;
@@ -138,7 +139,7 @@ Image *SimpleAnimation::getCurrentImage() const
return nullptr;
}
-void SimpleAnimation::initializeAnimation(XmlNodePtr animationNode,
+void SimpleAnimation::initializeAnimation(const XmlNodePtr animationNode,
const std::string& dyePalettes)
{
mInitialized = false;
@@ -153,7 +154,7 @@ void SimpleAnimation::initializeAnimation(XmlNodePtr animationNode,
if (!imagePath.empty() && !dyePalettes.empty())
Dye::instantiate(imagePath, dyePalettes);
- ImageSet *imageset = ResourceManager::getInstance()->getImageSet(
+ ImageSet *const imageset = ResourceManager::getInstance()->getImageSet(
XML::getProperty(animationNode, "imageset", ""),
XML::getProperty(animationNode, "width", 0),
XML::getProperty(animationNode, "height", 0)
@@ -166,16 +167,17 @@ void SimpleAnimation::initializeAnimation(XmlNodePtr animationNode,
for (XmlNodePtr frameNode = animationNode->xmlChildrenNode;
frameNode; frameNode = frameNode->next)
{
- int delay = XML::getIntProperty(frameNode, "delay", 0, 0, 100000);
+ const int delay = XML::getIntProperty(
+ frameNode, "delay", 0, 0, 100000);
int offsetX = XML::getProperty(frameNode, "offsetX", 0);
int offsetY = XML::getProperty(frameNode, "offsetY", 0);
- int rand = XML::getIntProperty(frameNode, "rand", 100, 0, 100);
+ const int rand = XML::getIntProperty(frameNode, "rand", 100, 0, 100);
offsetY -= imageset->getHeight() - 32;
offsetX -= imageset->getWidth() / 2 - 16;
if (xmlNameEqual(frameNode, "frame"))
{
- int index = XML::getProperty(frameNode, "index", -1);
+ const int index = XML::getProperty(frameNode, "index", -1);
if (index < 0)
{
@@ -183,7 +185,7 @@ void SimpleAnimation::initializeAnimation(XmlNodePtr animationNode,
continue;
}
- Image *img = imageset->get(index);
+ Image *const img = imageset->get(index);
if (!img)
{
@@ -197,7 +199,7 @@ void SimpleAnimation::initializeAnimation(XmlNodePtr animationNode,
else if (xmlNameEqual(frameNode, "sequence"))
{
int start = XML::getProperty(frameNode, "start", -1);
- int end = XML::getProperty(frameNode, "end", -1);
+ const int end = XML::getProperty(frameNode, "end", -1);
if (start < 0 || end < 0)
{
@@ -207,7 +209,7 @@ void SimpleAnimation::initializeAnimation(XmlNodePtr animationNode,
while (end >= start)
{
- Image *img = imageset->get(start);
+ Image *const img = imageset->get(start);
if (!img)
{
diff --git a/src/simpleanimation.h b/src/simpleanimation.h
index a7355a929..6e2f1405c 100644
--- a/src/simpleanimation.h
+++ b/src/simpleanimation.h
@@ -42,12 +42,12 @@ class SimpleAnimation
* Creates a simple animation with an already created \a animation.
* Takes ownership over the given animation.
*/
- SimpleAnimation(Animation *animation);
+ SimpleAnimation(Animation *const animation);
/**
* Creates a simple animation that creates its animation from XML Data.
*/
- SimpleAnimation(XmlNodePtr animationNode,
+ SimpleAnimation(const XmlNodePtr animationNode,
const std::string& dyePalettes = std::string());
~SimpleAnimation();
@@ -56,9 +56,10 @@ class SimpleAnimation
int getLength() const;
- bool update(int timePassed);
+ bool update(const int timePassed);
- bool draw(Graphics *graphics, int posX, int posY) const;
+ bool draw(Graphics *const graphics,
+ const int posX, const int posY) const;
/**
* Resets the animation.
@@ -68,7 +69,8 @@ class SimpleAnimation
Image *getCurrentImage() const;
private:
- void initializeAnimation(XmlNodePtr animationNode, const std::string&
+ void initializeAnimation(const XmlNodePtr animationNode,
+ const std::string&
dyePalettes = std::string());
/** The hosted animation. */
diff --git a/src/sound.cpp b/src/sound.cpp
index 7869d3108..cb4b11770 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -147,7 +147,7 @@ void Sound::init()
playMusic(mCurrentMusicFile);
}
-void Sound::info()
+void Sound::info() const
{
SDL_version compiledVersion;
const SDL_version *linkedVersion;
@@ -195,7 +195,7 @@ void Sound::info()
logger->log("Sound::info() Channels: %i", channels);
}
-void Sound::setMusicVolume(int volume)
+void Sound::setMusicVolume(const int volume)
{
mMusicVolume = volume;
@@ -203,7 +203,7 @@ void Sound::setMusicVolume(int volume)
Mix_VolumeMusic(mMusicVolume);
}
-void Sound::setSfxVolume(int volume)
+void Sound::setSfxVolume(const int volume)
{
mSfxVolume = volume;
@@ -213,7 +213,7 @@ void Sound::setSfxVolume(int volume)
static Music *loadMusic(const std::string &fileName)
{
- ResourceManager *resman = ResourceManager::getInstance();
+ ResourceManager *const resman = ResourceManager::getInstance();
return resman->getMusic(paths.getStringValue("music") + fileName);
}
@@ -239,7 +239,7 @@ void Sound::stopMusic()
haltMusic();
}
-void Sound::fadeInMusic(const std::string &fileName, int ms)
+void Sound::fadeInMusic(const std::string &fileName, const int ms)
{
mCurrentMusicFile = fileName;
@@ -256,7 +256,7 @@ void Sound::fadeInMusic(const std::string &fileName, int ms)
}
}
-void Sound::fadeOutMusic(int ms)
+void Sound::fadeOutMusic(const int ms)
{
mCurrentMusicFile.clear();
@@ -277,7 +277,7 @@ void Sound::fadeOutMusic(int ms)
}
}
-void Sound::fadeOutAndPlayMusic(const std::string &fileName, int ms)
+void Sound::fadeOutAndPlayMusic(const std::string &fileName, const int ms)
{
mNextMusicFile = fileName;
fadeOutMusic(ms);
@@ -302,7 +302,7 @@ void Sound::logic()
}
}
-void Sound::playSfx(const std::string &path, int x, int y)
+void Sound::playSfx(const std::string &path, const int x, const int y) const
{
if (!mInstalled || path.empty() || !mPlayBattle)
return;
@@ -312,8 +312,8 @@ void Sound::playSfx(const std::string &path, int x, int y)
tmpPath = path;
else
tmpPath = paths.getValue("sfx", "sfx/") + path;
- ResourceManager *resman = ResourceManager::getInstance();
- SoundEffect *sample = resman->getSoundEffect(tmpPath);
+ ResourceManager *const resman = ResourceManager::getInstance();
+ SoundEffect *const sample = resman->getSoundEffect(tmpPath);
if (sample)
{
logger->log("Sound::playSfx() Playing: %s", path.c_str());
@@ -326,7 +326,7 @@ void Sound::playSfx(const std::string &path, int x, int y)
dx = -dx;
if (dy < 0)
dy = -dy;
- int dist = dx > dy ? dx : dy;
+ const int dist = dx > dy ? dx : dy;
if (dist * 8 > vol)
return;
@@ -352,12 +352,12 @@ void Sound::playGuiSfx(const std::string &path)
tmpPath = path;
else
tmpPath = paths.getValue("sfx", "sfx/") + path;
- ResourceManager *resman = ResourceManager::getInstance();
- SoundEffect *sample = resman->getSoundEffect(tmpPath);
+ ResourceManager *const resman = ResourceManager::getInstance();
+ SoundEffect *const sample = resman->getSoundEffect(tmpPath);
if (sample)
{
logger->log("Sound::playGuiSfx() Playing: %s", path.c_str());
- int ret = sample->play(0, 120, mGuiChannel);
+ const int ret = sample->play(0, 120, mGuiChannel);
if (ret != -1)
mGuiChannel = ret;
}
@@ -396,7 +396,7 @@ void Sound::changeAudio()
init();
}
-void Sound::volumeOff()
+void Sound::volumeOff() const
{
if (mInstalled)
{
diff --git a/src/sound.h b/src/sound.h
index bf9226c18..7db9ecfea 100644
--- a/src/sound.h
+++ b/src/sound.h
@@ -80,14 +80,14 @@ class Sound : public ConfigListener
* @param fileName The name of the music file.
* @param ms Duration of fade-in effect (ms)
*/
- void fadeInMusic(const std::string &fileName, int ms = 1000);
+ void fadeInMusic(const std::string &fileName, const int ms = 1000);
/**
* Fades out currently running background music track.
*
* @param ms Duration of fade-out effect (ms)
*/
- void fadeOutMusic(int ms = 1000);
+ void fadeOutMusic(const int ms = 1000);
/**
* Fades out a background music and play a new one.
@@ -95,21 +95,23 @@ class Sound : public ConfigListener
* @param fileName The name of the music file.
* @param ms Duration of fade-out effect (ms)
*/
- void fadeOutAndPlayMusic(const std::string &fileName, int ms = 1000);
+ void fadeOutAndPlayMusic(const std::string &fileName,
+ const int ms = 1000);
int getMaxVolume() const
{ return MIX_MAX_VOLUME; }
- void setMusicVolume(int volume);
+ void setMusicVolume(const int volume);
- void setSfxVolume(int volume);
+ void setSfxVolume(const int volume);
/**
* Plays an item.
*
* @param path The resource path to the sound file.
*/
- void playSfx(const std::string &path, int x = 0, int y = 0);
+ void playSfx(const std::string &path, const int x = 0,
+ const int y = 0) const;
/**
* Plays an item for gui.
@@ -122,7 +124,7 @@ class Sound : public ConfigListener
void changeAudio();
- void volumeOff();
+ void volumeOff() const;
void volumeRestore();
@@ -138,7 +140,7 @@ class Sound : public ConfigListener
private:
/** Logs various info about sound device. */
- void info();
+ void info() const;
/** Halts and frees currently playing music. */
void haltMusic();
diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp
index fa567d256..4832a780a 100644
--- a/src/spellmanager.cpp
+++ b/src/spellmanager.cpp
@@ -47,7 +47,7 @@ SpellManager::~SpellManager()
mSpellsVector.clear();
}
-TextCommand* SpellManager::getSpell(int spellId)
+TextCommand* SpellManager::getSpell(const int spellId)
{
if (spellId < 0 || static_cast<unsigned int>(spellId) >= mSpells.size())
return nullptr;
@@ -55,7 +55,7 @@ TextCommand* SpellManager::getSpell(int spellId)
return mSpells[spellId];
}
-TextCommand* SpellManager::getSpellByItem(int itemId)
+TextCommand* SpellManager::getSpellByItem(const int itemId)
{
return getSpell(itemId - SPELL_MIN_ID);
}
@@ -94,12 +94,12 @@ void SpellManager::fillSpells()
addSpell(new TextCommand(f));
}
-bool SpellManager::addSpell(TextCommand *spell)
+bool SpellManager::addSpell(TextCommand *const spell)
{
if (!spell)
return false;
- std::map<unsigned int, TextCommand*>::const_iterator
+ const std::map<unsigned int, TextCommand*>::const_iterator
i = mSpells.find(spell->getId());
if (i == mSpells.end())
{
@@ -110,23 +110,23 @@ bool SpellManager::addSpell(TextCommand *spell)
return false;
}
-std::vector<TextCommand*> SpellManager::getAll()
+std::vector<TextCommand*> SpellManager::getAll() const
{
//logger->log(("mSpellsVector = " + toString(mSpellsVector.size())).c_str());
return mSpellsVector;
}
-void SpellManager::useItem(int itemId)
+void SpellManager::useItem(const int itemId)
{
invoke(itemId - SPELL_MIN_ID);
}
-void SpellManager::invoke(int spellId)
+void SpellManager::invoke(const int spellId)
{
if (!player_node)
return;
- TextCommand* spell = getSpell(spellId);
+ const TextCommand *const spell = getSpell(spellId);
if (!spell)
return;
@@ -142,7 +142,7 @@ void SpellManager::invoke(int spellId)
>= static_cast<signed>(spell->getSchoolLvl())
&& PlayerInfo::getAttribute(PlayerInfo::MP) >= spell->getMana()))
{
- Being* target = player_node->getTarget();
+ Being *const target = player_node->getTarget();
if (spell->getTargetType() == NOTARGET)
{
invokeSpell(spell);
@@ -161,14 +161,15 @@ void SpellManager::invoke(int spellId)
}
}
-void SpellManager::invokeSpell(TextCommand* spell) const
+void SpellManager::invokeSpell(const TextCommand *const spell) const
{
if (!chatWindow || !spell)
return;
chatWindow->localChatInput(parseCommand(spell->getCommand(), nullptr));
}
-void SpellManager::invokeSpell(TextCommand* spell, Being* target) const
+void SpellManager::invokeSpell(const TextCommand *const spell,
+ Being *const target) const
{
if (!chatWindow || !spell || !target)
return;
@@ -176,7 +177,7 @@ void SpellManager::invokeSpell(TextCommand* spell, Being* target) const
}
std::string SpellManager::parseCommand(std::string command,
- Being *target) const
+ const Being *const target) const
{
if (!player_node)
return command;
@@ -223,14 +224,14 @@ std::string SpellManager::parseCommand(std::string command,
return command;
}
-TextCommand *SpellManager::createNewSpell()
+TextCommand *SpellManager::createNewSpell() const
{
return new TextCommand(static_cast<unsigned>(mSpellsVector.size()));
}
-void SpellManager::load(bool oldConfig)
+void SpellManager::load(const bool oldConfig)
{
- Configuration *cfg;
+ const Configuration *cfg;
if (oldConfig)
cfg = &config;
else
@@ -293,7 +294,7 @@ void SpellManager::save()
{
for (unsigned i = 0; i < SPELL_SHORTCUT_ITEMS * SPELL_SHORTCUT_TABS; i++)
{
- TextCommand *spell = mSpellsVector[i];
+ const TextCommand *const spell = mSpellsVector[i];
if (spell)
{
if (spell->getCommand() != "")
@@ -353,13 +354,14 @@ void SpellManager::save()
std::string SpellManager::autoComplete(std::string partName)
{
std::vector<TextCommand*>::const_iterator i = mSpellsVector.begin();
- std::vector<TextCommand*>::const_iterator i_end = mSpellsVector.end();
+ const std::vector<TextCommand*>::const_iterator
+ i_end = mSpellsVector.end();
std::string newName = "";
- TextCommand *newCommand = nullptr;
+ const TextCommand *newCommand = nullptr;
while (i != i_end)
{
- TextCommand *cmd = *i;
+ TextCommand *const cmd = *i;
std::string line = cmd->getCommand();
if (line != "")
diff --git a/src/spellmanager.h b/src/spellmanager.h
index c3abd829a..ebda6ec40 100644
--- a/src/spellmanager.h
+++ b/src/spellmanager.h
@@ -40,21 +40,21 @@ class SpellManager
~SpellManager();
- TextCommand *getSpell(int spellId);
+ TextCommand *getSpell(const int spellId);
- TextCommand* getSpellByItem(int itemId);
+ TextCommand* getSpellByItem(const int itemId);
- bool addSpell(TextCommand *spell);
+ bool addSpell(TextCommand *const spell);
- TextCommand *createNewSpell();
+ TextCommand *createNewSpell() const;
- std::vector<TextCommand*> getAll();
+ std::vector<TextCommand*> getAll() const;
- void useItem(int itemId);
+ void useItem(const int itemId);
- void invoke(int spellId);
+ void invoke(const int spellId);
- void load(bool oldConfig = false);
+ void load(const bool oldConfig = false);
void save();
@@ -63,11 +63,13 @@ class SpellManager
private:
void fillSpells();
- void invokeSpell(TextCommand* spell, Being* target) const;
+ void invokeSpell(const TextCommand *const spell,
+ Being *const target) const;
- void invokeSpell(TextCommand* spell) const;
+ void invokeSpell(const TextCommand *const spell) const;
- std::string parseCommand(std::string command, Being* target) const;
+ std::string parseCommand(std::string command,
+ const Being *const target) const;
std::map<unsigned int, TextCommand*> mSpells;
std::vector<TextCommand*> mSpellsVector;
diff --git a/src/spellshortcut.h b/src/spellshortcut.h
index 7e17c9f57..b26211fc4 100644
--- a/src/spellshortcut.h
+++ b/src/spellshortcut.h
@@ -55,7 +55,7 @@ class SpellShortcut
*
* @param itemId The ID of the item that is to be assigned.
*/
- void setItemSelected(int itemId)
+ void setItemSelected(const int itemId)
{ mItemSelected = itemId; }
/**
@@ -75,7 +75,7 @@ class SpellShortcut
*
* @param index Index of the shortcut item.
*/
- int getItem(int index) const
+ int getItem(const int index) const
{ return mItems[index]; }
private:
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
index 0855d2c9b..4b86de2fc 100644
--- a/src/statuseffect.cpp
+++ b/src/statuseffect.cpp
@@ -48,19 +48,19 @@ StatusEffect::~StatusEffect()
{
}
-void StatusEffect::playSFX()
+void StatusEffect::playSFX() const
{
if (!mSFXEffect.empty())
sound.playSfx(mSFXEffect);
}
-void StatusEffect::deliverMessage()
+void StatusEffect::deliverMessage() const
{
if (!mMessage.empty() && localChatTab)
localChatTab->chatLog(mMessage, BY_SERVER);
}
-Particle *StatusEffect::getParticle()
+Particle *StatusEffect::getParticle() const
{
if (!particleEngine || mParticleEffect.empty())
return nullptr;
@@ -68,7 +68,7 @@ Particle *StatusEffect::getParticle()
return particleEngine->addEffect(mParticleEffect, 0, 0);
}
-AnimatedSprite *StatusEffect::getIcon()
+AnimatedSprite *StatusEffect::getIcon() const
{
if (mIcon.empty())
{
@@ -76,7 +76,7 @@ AnimatedSprite *StatusEffect::getIcon()
}
else
{
- AnimatedSprite *sprite = AnimatedSprite::load(
+ AnimatedSprite *const sprite = AnimatedSprite::load(
paths.getStringValue("sprites") + mIcon);
if (false && sprite)
{
@@ -87,7 +87,7 @@ AnimatedSprite *StatusEffect::getIcon()
}
}
-std::string StatusEffect::getAction()
+std::string StatusEffect::getAction() const
{
if (mAction.empty())
return SpriteAction::INVALID;
@@ -105,19 +105,20 @@ static status_effect_map statusEffects;
static status_effect_map stunEffects;
static std::map<int, int> blockEffectIndexMap;
-int StatusEffect::blockEffectIndexToEffectIndex(int blockIndex)
+int StatusEffect::blockEffectIndexToEffectIndex(const int blockIndex)
{
if (blockEffectIndexMap.find(blockIndex) == blockEffectIndexMap.end())
return -1;
return blockEffectIndexMap[blockIndex];
}
-StatusEffect *StatusEffect::getStatusEffect(int index, bool enabling)
+StatusEffect *StatusEffect::getStatusEffect(const int index,
+ const bool enabling)
{
return statusEffects[enabling][index];
}
-StatusEffect *StatusEffect::getStunEffect(int index, bool enabling)
+StatusEffect *StatusEffect::getStunEffect(const int index, const bool enabling)
{
return stunEffects[enabling][index];
}
@@ -128,7 +129,7 @@ void StatusEffect::load()
unload();
XML::Document doc(STATUS_EFFECTS_FILE);
- XmlNodePtr rootNode = doc.rootNode();
+ const XmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, "status-effects"))
{
@@ -140,12 +141,12 @@ void StatusEffect::load()
{
status_effect_map *the_map = nullptr;
- int index = atoi(XML::getProperty(node, "id", "-1").c_str());
+ const int index = atoi(XML::getProperty(node, "id", "-1").c_str());
if (xmlNameEqual(node, "status-effect"))
{
the_map = &statusEffects;
- int block_index = atoi(XML::getProperty(
+ const int block_index = atoi(XML::getProperty(
node, "block-id", "-1").c_str());
if (index >= 0 && block_index >= 0)
@@ -159,8 +160,8 @@ void StatusEffect::load()
if (the_map)
{
- StatusEffect *startEffect = new StatusEffect;
- StatusEffect *endEffect = new StatusEffect;
+ StatusEffect *const startEffect = new StatusEffect;
+ StatusEffect *const endEffect = new StatusEffect;
startEffect->mMessage = XML::getProperty(
node, "start-message", "");
diff --git a/src/statuseffect.h b/src/statuseffect.h
index 326a0d3c1..b5df3a45f 100644
--- a/src/statuseffect.h
+++ b/src/statuseffect.h
@@ -32,34 +32,35 @@ class StatusEffect
{
public:
StatusEffect();
+
~StatusEffect();
/**
* Plays the sound effect associated with this status effect, if possible.
*/
- void playSFX();
+ void playSFX() const;
/**
* Delivers the chat message associated with this status effect, if
* possible.
*/
- void deliverMessage();
+ void deliverMessage() const;
/**
* Creates the particle effect associated with this status effect, if
* possible.
*/
- Particle *getParticle();
+ Particle *getParticle() const;
/**
* Retrieves the status icon for this effect, if applicable
*/
- AnimatedSprite *getIcon();
+ AnimatedSprite *getIcon() const;
/**
* Retrieves an action to perform, or SpriteAction::INVALID
*/
- std::string getAction();
+ std::string getAction() const;
/**
* Determines whether the particle effect should be restarted when the
@@ -76,7 +77,7 @@ public:
* \param enabling Whether to retrieve the activating effect (true) or
* the deactivating effect (false).
*/
- static StatusEffect *getStatusEffect(int index, bool enabling);
+ static StatusEffect *getStatusEffect(const int index, const bool enabling);
/**
* Retrieves a stun effect.
@@ -94,7 +95,7 @@ public:
*
* Returns -1 on failure.
*/
- static int blockEffectIndexToEffectIndex(int blocKIndex);
+ static int blockEffectIndexToEffectIndex(const int blocKIndex);
static void load();