summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-02-02 12:49:08 +0300
committerAndrei Karas <akaras@inbox.ru>2014-02-02 12:49:08 +0300
commit5c3746562bafd61603c67958fc82ff097a69e3a4 (patch)
treec36e46dd4df2bc7388e7e82b6e6ae8294c4ecd02
parent60b386b1a97a052cea867dd3a4f7a9c52394b312 (diff)
downloadmanaverse-5c3746562bafd61603c67958fc82ff097a69e3a4.tar.gz
manaverse-5c3746562bafd61603c67958fc82ff097a69e3a4.tar.bz2
manaverse-5c3746562bafd61603c67958fc82ff097a69e3a4.tar.xz
manaverse-5c3746562bafd61603c67958fc82ff097a69e3a4.zip
Add missing const and static into other classes.
-rw-r--r--src/actionmanager.cpp2
-rw-r--r--src/actormanager.cpp2
-rw-r--r--src/actormanager.h5
-rw-r--r--src/chatlogger.cpp5
-rw-r--r--src/chatlogger.h4
-rw-r--r--src/client.cpp8
-rw-r--r--src/client.h16
-rw-r--r--src/dragdrop.h4
-rw-r--r--src/dropshortcut.h2
-rw-r--r--src/emoteshortcut.h2
-rw-r--r--src/eventsmanager.cpp2
-rw-r--r--src/eventsmanager.h2
-rw-r--r--src/game.cpp4
-rw-r--r--src/game.h4
-rw-r--r--src/graphicsmanager.cpp2
-rw-r--r--src/graphicsmanager.h8
-rw-r--r--src/itemshortcut.h2
-rw-r--r--src/map.cpp2
-rw-r--r--src/map.h2
-rw-r--r--src/maplayer.cpp3
-rw-r--r--src/maplayer.h5
-rw-r--r--src/mumblemanager.cpp2
-rw-r--r--src/mumblemanager.h2
-rw-r--r--src/particle/particleemitter.h2
-rw-r--r--src/soundmanager.cpp2
-rw-r--r--src/soundmanager.h4
-rw-r--r--src/spellmanager.cpp2
-rw-r--r--src/spellmanager.h6
-rw-r--r--src/touchmanager.cpp5
-rw-r--r--src/touchmanager.h4
30 files changed, 58 insertions, 57 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index bc7be23a9..7c370a372 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -215,7 +215,7 @@ impHandler0(mouseClick)
return false;
int mouseX, mouseY;
- gui->getMouseState(&mouseX, &mouseY);
+ Gui::getMouseState(&mouseX, &mouseY);
guiInput->simulateMouseClick(mouseX, mouseY, gcn::MouseEvent::RIGHT);
return true;
}
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index f55875351..a056fd5fc 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -1556,7 +1556,7 @@ void ActorManager::rebuildPickupItems()
}
int ActorManager::getIndexByName(const std::string &name,
- const std::map<std::string, int> &map) const
+ const std::map<std::string, int> &map)
{
const std::map<std::string, int>::const_iterator
i = map.find(name);
diff --git a/src/actormanager.h b/src/actormanager.h
index 9ccd5eaa6..d7b760d51 100644
--- a/src/actormanager.h
+++ b/src/actormanager.h
@@ -296,8 +296,9 @@ class ActorManager final: public ConfigListener
int getPickupItemIndex(const std::string &name) const A_WARN_UNUSED;
- int getIndexByName(const std::string &name, const std::map<std::string,
- int> &map) const A_WARN_UNUSED;
+ static int getIndexByName(const std::string &name,
+ const std::map<std::string,int> &map)
+ A_WARN_UNUSED;
bool checkForPickup(const FloorItem *const item) const A_WARN_UNUSED;
diff --git a/src/chatlogger.cpp b/src/chatlogger.cpp
index c3da6e0b1..2bfe4933b 100644
--- a/src/chatlogger.cpp
+++ b/src/chatlogger.cpp
@@ -131,7 +131,7 @@ std::string ChatLogger::getDir() const
return date;
}
-std::string ChatLogger::secureName(std::string &name) const
+std::string ChatLogger::secureName(std::string &name)
{
const unsigned int sz = name.length();
for (unsigned int f = 0; f < sz; f ++)
@@ -151,7 +151,8 @@ std::string ChatLogger::secureName(std::string &name) const
return name;
}
-void ChatLogger::writeTo(std::ofstream &file, const std::string &str) const
+void ChatLogger::writeTo(std::ofstream &file,
+ const std::string &str)
{
file << str << std::endl;
}
diff --git a/src/chatlogger.h b/src/chatlogger.h
index c95cea7fe..ae0e21388 100644
--- a/src/chatlogger.h
+++ b/src/chatlogger.h
@@ -55,7 +55,7 @@ class ChatLogger final
std::string getDir() const A_WARN_UNUSED;
- std::string secureName(std::string &str) const;
+ static std::string secureName(std::string &str);
void setServerName(const std::string &serverName);
@@ -72,7 +72,7 @@ class ChatLogger final
void setLogDir(const std::string &logDir);
- void writeTo(std::ofstream &file, const std::string &str) const;
+ static void writeTo(std::ofstream &file, const std::string &str);
std::ofstream mLogFile;
std::string mLogDir;
diff --git a/src/client.cpp b/src/client.cpp
index 4d301ccfe..77a7f213e 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -2106,7 +2106,7 @@ void Client::initServerConfig(std::string serverName)
dropShortcut = new DropShortcut;
}
-void Client::initFeatures() const
+void Client::initFeatures()
{
features.init(paths.getStringValue("featuresFile"), true);
features.setDefaultValues(getFeaturesDefaults());
@@ -2337,7 +2337,7 @@ void Client::initScreenshotDir()
logger->log("screenshotDirectory: " + mScreenshotDir);
}
-void Client::accountLogin(LoginData *const data) const
+void Client::accountLogin(LoginData *const data)
{
if (!data)
return;
@@ -2758,7 +2758,7 @@ bool Client::limitPackets(const int type)
return true;
}
-void Client::setFramerate(const int fpsLimit)
+void Client::setFramerate(const int fpsLimit) const
{
if (!fpsLimit)
return;
@@ -3012,7 +3012,7 @@ void Client::setIcon()
#else
iconFile.append(".png");
#endif
- iconFile = ResourceManager::getInstance()->getPath(iconFile);
+ iconFile = ResourceManager::getPath(iconFile);
logger->log("Loading icon from file: %s", iconFile.c_str());
#ifdef WIN32
diff --git a/src/client.h b/src/client.h
index 92daff44b..22567ae94 100644
--- a/src/client.h
+++ b/src/client.h
@@ -285,7 +285,7 @@ public:
static void closeDialogs();
- void setFramerate(const int fpsLimit);
+ void setFramerate(const int fpsLimit) const;
int getFramerate() const A_WARN_UNUSED;
@@ -335,9 +335,9 @@ public:
const bool modal);
private:
- void createWindows();
+ static void createWindows();
- void initLang();
+ static void initLang();
void initSoundManager();
@@ -347,7 +347,7 @@ private:
void initTitle();
- void extractDataDir();
+ static void extractDataDir();
void mountDataDir();
@@ -369,9 +369,9 @@ private:
void initServerConfig(std::string serverName);
- void initFeatures() const;
+ static void initFeatures();
- void accountLogin(LoginData *const data) const;
+ static void accountLogin(LoginData *const data);
#ifndef ANDROID
void storeSafeParameters() const;
@@ -383,9 +383,9 @@ private:
void testsClear();
- void logVars();
+ static void logVars();
- void checkConfigVersion();
+ static void checkConfigVersion();
void setIcon();
diff --git a/src/dragdrop.h b/src/dragdrop.h
index 42d01c238..99cfb1ee7 100644
--- a/src/dragdrop.h
+++ b/src/dragdrop.h
@@ -75,10 +75,10 @@ class DragDrop final
mItemImage->decRef();
}
- int getItem()
+ int getItem() const
{ return mItem; }
- int getItemColor()
+ int getItemColor() const
{ return mItemColor; }
Image *getItemImage()
diff --git a/src/dropshortcut.h b/src/dropshortcut.h
index b4450127f..85c0b6620 100644
--- a/src/dropshortcut.h
+++ b/src/dropshortcut.h
@@ -71,7 +71,7 @@ class DropShortcut final
/**
* Returns the amount of shortcut items.
*/
- int getItemCount() const A_WARN_UNUSED
+ static int getItemCount() A_WARN_UNUSED
{ return DROP_SHORTCUT_ITEMS; }
/**
diff --git a/src/emoteshortcut.h b/src/emoteshortcut.h
index 0b5859fe9..3e03a18f5 100644
--- a/src/emoteshortcut.h
+++ b/src/emoteshortcut.h
@@ -60,7 +60,7 @@ class EmoteShortcut final
/**
* Returns the amount of shortcut Emotes.
*/
- unsigned int getEmoteCount() const A_WARN_UNUSED
+ static unsigned int getEmoteCount() A_WARN_UNUSED
{ return SHORTCUT_EMOTES; }
/**
diff --git a/src/eventsmanager.cpp b/src/eventsmanager.cpp
index 237e7bf68..85646010a 100644
--- a/src/eventsmanager.cpp
+++ b/src/eventsmanager.cpp
@@ -60,7 +60,7 @@ void EventsManager::shutdown()
config.removeListeners(this);
}
-bool EventsManager::handleCommonEvents(const SDL_Event &event)
+bool EventsManager::handleCommonEvents(const SDL_Event &event) const
{
if (mLogInput)
logEvent(event);
diff --git a/src/eventsmanager.h b/src/eventsmanager.h
index 7bf1eea24..f4136e35c 100644
--- a/src/eventsmanager.h
+++ b/src/eventsmanager.h
@@ -44,7 +44,7 @@ class EventsManager final : public ConfigListener
bool handleEvents();
- bool handleCommonEvents(const SDL_Event &event);
+ bool handleCommonEvents(const SDL_Event &event) const;
void handleGameEvents();
diff --git a/src/game.cpp b/src/game.cpp
index 6e4341372..13c9ccc75 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -962,7 +962,7 @@ void Game::handleInput()
}
handleMove();
- inputManager.handleRepeat();
+ InputManager::handleRepeat();
BLOCK_END("Game::handleInput 1")
}
@@ -1175,7 +1175,7 @@ void Game::closeDialogs()
}
}
-void Game::videoResized(const int width, const int height) const
+void Game::videoResized(const int width, const int height)
{
if (viewport)
viewport->setSize(width, height);
diff --git a/src/game.h b/src/game.h
index 08349cdaa..023796290 100644
--- a/src/game.h
+++ b/src/game.h
@@ -107,12 +107,12 @@ class Game final
static void closeDialogs();
- void videoResized(const int width, const int height) const;
+ static void videoResized(const int width, const int height);
bool getValidSpeed() const A_WARN_UNUSED
{ return mValidSpeed; }
- void moveInDirection(const unsigned char direction);
+ static void moveInDirection(const unsigned char direction);
static bool createScreenshot();
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 00cceb22f..b40f8df57 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -546,7 +546,7 @@ bool GraphicsManager::supportExtension(const std::string &ext) const
return mExtensions.find(ext) != mExtensions.end();
}
-void GraphicsManager::updateTextureFormat()
+void GraphicsManager::updateTextureFormat() const
{
const int compressionFormat = config.getIntValue("compresstextures");
if (compressionFormat)
diff --git a/src/graphicsmanager.h b/src/graphicsmanager.h
index 744514ed2..8e5aba51f 100644
--- a/src/graphicsmanager.h
+++ b/src/graphicsmanager.h
@@ -78,7 +78,7 @@ class GraphicsManager final
void initGraphics(const bool noOpenGL);
- void setVideoMode();
+ static void setVideoMode();
SDL_Window *createWindow(const int w, const int h,
const int bpp, const int flags);
@@ -94,7 +94,7 @@ class GraphicsManager final
std::string getDensityString() const;
- int getDensity()
+ int getDensity() const
{ return mDensity; }
#ifdef USE_OPENGL
@@ -104,7 +104,7 @@ class GraphicsManager final
bool supportExtension(const std::string &ext) const A_WARN_UNUSED;
- void updateTextureFormat();
+ void updateTextureFormat() const;
bool checkGLVersion(const int major, const int minor)
const A_WARN_UNUSED;
@@ -154,7 +154,7 @@ class GraphicsManager final
void updateDebugLog() const;
- std::string getGLVersion()
+ std::string getGLVersion() const
{ return mGlVersionString; }
#endif
diff --git a/src/itemshortcut.h b/src/itemshortcut.h
index 2293a1583..b40ae87f1 100644
--- a/src/itemshortcut.h
+++ b/src/itemshortcut.h
@@ -72,7 +72,7 @@ class ItemShortcut final
/**
* Returns the amount of shortcut items.
*/
- int getItemCount() const A_WARN_UNUSED
+ static int getItemCount() A_WARN_UNUSED
{ return SHORTCUT_ITEMS; }
/**
diff --git a/src/map.cpp b/src/map.cpp
index 0bbb21271..b17e9ebdb 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -738,7 +738,7 @@ bool Map::getWalk(const int x, const int y, const unsigned char walkmask) const
return !(mMetaTiles[x + y * mWidth].blockmask & walkmask);
}
-unsigned char Map::getBlockMask(const int x, const int y)
+unsigned char Map::getBlockMask(const int x, const int y) const
{
// You can't walk outside of the map
if (x < 0 || y < 0 || x >= mWidth || y >= mHeight)
diff --git a/src/map.h b/src/map.h
index 9c9d0100f..26303da7a 100644
--- a/src/map.h
+++ b/src/map.h
@@ -240,7 +240,7 @@ class Map final : public Properties, public ConfigListener
void setWalk(const int x, const int y, const bool walkable);
- unsigned char getBlockMask(const int x, const int y);
+ unsigned char getBlockMask(const int x, const int y) const;
/**
* Returns the width of this map in tiles.
diff --git a/src/maplayer.cpp b/src/maplayer.cpp
index 2bb7884d8..3da8ba7d9 100644
--- a/src/maplayer.cpp
+++ b/src/maplayer.cpp
@@ -548,7 +548,8 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY,
}
int MapLayer::getTileDrawWidth(const Image *img,
- const int endX, int &width) const
+ const int endX,
+ int &width)
{
BLOCK_START("MapLayer::getTileDrawWidth")
const Image *const img1 = img;
diff --git a/src/maplayer.h b/src/maplayer.h
index 697f52c89..dcfdb991e 100644
--- a/src/maplayer.h
+++ b/src/maplayer.h
@@ -177,8 +177,9 @@ class MapLayer final: public ConfigListener
void optionChanged(const std::string &value) override final;
- int getTileDrawWidth(const Image *img,
- const int endX, int &width) const A_WARN_UNUSED;
+ static int getTileDrawWidth(const Image *img,
+ const int endX,
+ int &width) A_WARN_UNUSED;
private:
int mX;
diff --git a/src/mumblemanager.cpp b/src/mumblemanager.cpp
index 43b10b76b..7a2337b7e 100644
--- a/src/mumblemanager.cpp
+++ b/src/mumblemanager.cpp
@@ -56,7 +56,7 @@ MumbleManager::~MumbleManager()
}
}
-uint16_t MumbleManager::getMapId(std::string mapName) const
+uint16_t MumbleManager::getMapId(std::string mapName)
{
uint16_t res = 0;
if (mapName.size() != 5 || mapName[3] != '-')
diff --git a/src/mumblemanager.h b/src/mumblemanager.h
index 12de869e4..4d76f0f54 100644
--- a/src/mumblemanager.h
+++ b/src/mumblemanager.h
@@ -60,7 +60,7 @@ class MumbleManager final
void setServer(const std::string &serverName);
private:
- uint16_t getMapId(std::string mapName) const A_WARN_UNUSED;
+ static uint16_t getMapId(std::string mapName) A_WARN_UNUSED;
void setMapBase(uint16_t mapid);
diff --git a/src/particle/particleemitter.h b/src/particle/particleemitter.h
index 9e149034f..3f771ab57 100644
--- a/src/particle/particleemitter.h
+++ b/src/particle/particleemitter.h
@@ -83,7 +83,7 @@ class ParticleEmitter final
void adjustSize(const int w, const int h);
private:
- template <typename T> ParticleEmitterProp<T>
+ template <typename T> static ParticleEmitterProp<T>
readParticleEmitterProp(XmlNodePtrConst propertyNode, T def);
ImageSet *getImageSet(XmlNodePtrConst node);
diff --git a/src/soundmanager.cpp b/src/soundmanager.cpp
index f106b6623..e9fd3fea0 100644
--- a/src/soundmanager.cpp
+++ b/src/soundmanager.cpp
@@ -170,7 +170,7 @@ void SoundManager::init()
playMusic(mCurrentMusicFile);
}
-void SoundManager::info() const
+void SoundManager::info()
{
SDL_version compiledVersion;
const char *format = "Unknown";
diff --git a/src/soundmanager.h b/src/soundmanager.h
index 3ed5b6fc0..9eb1ea8a2 100644
--- a/src/soundmanager.h
+++ b/src/soundmanager.h
@@ -94,7 +94,7 @@ class SoundManager final : public ConfigListener
void fadeOutAndPlayMusic(const std::string &fileName,
const int ms = 1000);
- int getMaxVolume() const A_WARN_UNUSED
+ static int getMaxVolume() A_WARN_UNUSED
{ return MIX_MAX_VOLUME; }
void setMusicVolume(const int volume);
@@ -138,7 +138,7 @@ class SoundManager final : public ConfigListener
private:
/** Logs various info about sound device. */
- void info() const;
+ static void info();
/** Halts and frees currently playing music. */
void haltMusic();
diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp
index 85ac4bf22..5a9d5cc4f 100644
--- a/src/spellmanager.cpp
+++ b/src/spellmanager.cpp
@@ -181,7 +181,7 @@ void SpellManager::invokeSpell(const TextCommand *const spell,
}
std::string SpellManager::parseCommand(std::string command,
- const Being *const target) const
+ const Being *const target)
{
if (!player_node)
return command;
diff --git a/src/spellmanager.h b/src/spellmanager.h
index c30fa645f..9fb5da850 100644
--- a/src/spellmanager.h
+++ b/src/spellmanager.h
@@ -75,9 +75,9 @@ class SpellManager final
void invokeSpell(const TextCommand *const spell) const;
- std::string parseCommand(std::string command,
- const Being *const target)
- const A_WARN_UNUSED;
+ static std::string parseCommand(std::string command,
+ const Being *const target)
+ A_WARN_UNUSED;
std::map<unsigned int, TextCommand*> mSpells;
std::vector<TextCommand*> mSpellsVector;
diff --git a/src/touchmanager.cpp b/src/touchmanager.cpp
index 2f93a4ddc..0b2b85562 100644
--- a/src/touchmanager.cpp
+++ b/src/touchmanager.cpp
@@ -346,12 +346,9 @@ void TouchManager::unload(TouchItem *const item)
{
if (item)
{
- Theme *const theme = Theme::instance();
- if (!theme)
- return;
if (item->images)
{
- theme->unloadRect(*item->images);
+ Theme::unloadRect(*item->images);
delete item->images;
item->images = nullptr;
if (item->icon)
diff --git a/src/touchmanager.h b/src/touchmanager.h
index 8668654ec..f937c1129 100644
--- a/src/touchmanager.h
+++ b/src/touchmanager.h
@@ -151,7 +151,7 @@ class TouchManager final : public ConfigListener
void loadKeyboard();
- int getPadSize()
+ int getPadSize() const
{ return (mJoystickSize + 2) * 50; }
void setInGame(const bool b);
@@ -160,7 +160,7 @@ class TouchManager final : public ConfigListener
void shutdown();
- void executeAction(const std::string &event);
+ static void executeAction(const std::string &event);
private:
TouchItem *mKeyboard;