summaryrefslogtreecommitdiff
path: root/src/game-server
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-26 17:05:18 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-26 17:18:21 +0200
commit43e99491a76bb85faf60c004e84b6c2b14cf41e7 (patch)
tree4aba689b76138118b4da043425fb3e8576db418c /src/game-server
parente726c34606f85347e70a0deb6b180db03b6d0c25 (diff)
downloadmanaserv-43e99491a76bb85faf60c004e84b6c2b14cf41e7.tar.gz
manaserv-43e99491a76bb85faf60c004e84b6c2b14cf41e7.tar.bz2
manaserv-43e99491a76bb85faf60c004e84b6c2b14cf41e7.tar.xz
manaserv-43e99491a76bb85faf60c004e84b6c2b14cf41e7.zip
Standardize on the position of the const keyword
Same as for the client.
Diffstat (limited to 'src/game-server')
-rw-r--r--src/game-server/accountconnection.cpp15
-rw-r--r--src/game-server/accountconnection.hpp8
-rw-r--r--src/game-server/being.cpp6
-rw-r--r--src/game-server/being.hpp12
-rw-r--r--src/game-server/character.cpp4
-rw-r--r--src/game-server/character.hpp6
-rw-r--r--src/game-server/command.cpp32
-rw-r--r--src/game-server/commandhandler.cpp37
-rw-r--r--src/game-server/eventlistener.hpp14
-rw-r--r--src/game-server/gamehandler.cpp21
-rw-r--r--src/game-server/gamehandler.hpp8
-rw-r--r--src/game-server/item.hpp6
-rw-r--r--src/game-server/itemmanager.cpp2
-rw-r--r--src/game-server/itemmanager.hpp4
-rw-r--r--src/game-server/mapcomposite.cpp30
-rw-r--r--src/game-server/mapcomposite.hpp30
-rw-r--r--src/game-server/mapmanager.cpp6
-rw-r--r--src/game-server/mapmanager.hpp6
-rw-r--r--src/game-server/mapreader.cpp6
-rw-r--r--src/game-server/mapreader.hpp15
-rw-r--r--src/game-server/monster.cpp2
-rw-r--r--src/game-server/monster.hpp4
-rw-r--r--src/game-server/monstermanager.cpp2
-rw-r--r--src/game-server/monstermanager.hpp4
-rw-r--r--src/game-server/postman.hpp4
-rw-r--r--src/game-server/quest.cpp22
-rw-r--r--src/game-server/quest.hpp18
-rw-r--r--src/game-server/resourcemanager.cpp4
-rw-r--r--src/game-server/resourcemanager.hpp4
-rw-r--r--src/game-server/spawnarea.hpp2
-rw-r--r--src/game-server/state.cpp16
-rw-r--r--src/game-server/state.hpp4
-rw-r--r--src/game-server/thing.cpp8
-rw-r--r--src/game-server/thing.hpp8
-rw-r--r--src/game-server/trigger.hpp4
35 files changed, 189 insertions, 185 deletions
diff --git a/src/game-server/accountconnection.cpp b/src/game-server/accountconnection.cpp
index 10bc6b46..41f71627 100644
--- a/src/game-server/accountconnection.cpp
+++ b/src/game-server/accountconnection.cpp
@@ -73,7 +73,7 @@ bool AccountConnection::start()
msg.writeString(gameServerAddress);
msg.writeShort(gameServerPort);
msg.writeLong(ItemManager::GetDatabaseVersion());
- MapManager::Maps const &m = MapManager::getMaps();
+ const MapManager::Maps &m = MapManager::getMaps();
for (MapManager::Maps::const_iterator i = m.begin(), i_end = m.end();
i != i_end; ++i)
{
@@ -195,7 +195,8 @@ void AccountConnection::processMessage(MessageIn &msg)
}
}
-void AccountConnection::playerReconnectAccount(int id, std::string const &magic_token)
+void AccountConnection::playerReconnectAccount(int id,
+ const std::string &magic_token)
{
LOG_DEBUG("Send GAMSG_PLAYER_RECONNECT.");
MessageOut msg(GAMSG_PLAYER_RECONNECT);
@@ -204,7 +205,7 @@ void AccountConnection::playerReconnectAccount(int id, std::string const &magic_
send(msg);
}
-void AccountConnection::requestQuestVar(Character *ch, std::string const &name)
+void AccountConnection::requestQuestVar(Character *ch, const std::string &name)
{
MessageOut msg(GAMSG_GET_QUEST);
msg.writeLong(ch->getDatabaseID());
@@ -212,8 +213,8 @@ void AccountConnection::requestQuestVar(Character *ch, std::string const &name)
send(msg);
}
-void AccountConnection::updateQuestVar(Character *ch, std::string const &name,
- std::string const &value)
+void AccountConnection::updateQuestVar(Character *ch, const std::string &name,
+ const std::string &value)
{
MessageOut msg(GAMSG_SET_QUEST);
msg.writeLong(ch->getDatabaseID());
@@ -233,7 +234,7 @@ void AccountConnection::banCharacter(Character *ch, int duration)
void AccountConnection::sendStatistics()
{
MessageOut msg(GAMSG_STATISTICS);
- MapManager::Maps const &maps = MapManager::getMaps();
+ const MapManager::Maps &maps = MapManager::getMaps();
for (MapManager::Maps::const_iterator i = maps.begin(),
i_end = maps.end(); i != i_end; ++i)
{
@@ -242,7 +243,7 @@ void AccountConnection::sendStatistics()
msg.writeShort(i->first);
int nbThings = 0, nbMonsters = 0;
typedef std::vector< Thing * > Things;
- Things const &things = m->getEverything();
+ const Things &things = m->getEverything();
std::vector< int > players;
for (Things::const_iterator j = things.begin(),
j_end = things.end(); j != j_end; ++j)
diff --git a/src/game-server/accountconnection.hpp b/src/game-server/accountconnection.hpp
index da42ea97..1cbe6d82 100644
--- a/src/game-server/accountconnection.hpp
+++ b/src/game-server/accountconnection.hpp
@@ -73,18 +73,18 @@ class AccountConnection : public Connection
/**
* Prepares the account server for a reconnecting player
*/
- void playerReconnectAccount(int id, std::string const &magic_token);
+ void playerReconnectAccount(int id, const std::string &magic_token);
/**
* Requests the value of a quest variable from the database.
*/
- void requestQuestVar(Character *, std::string const &);
+ void requestQuestVar(Character *, const std::string &);
/**
* Pushes a new quest value to the database.
*/
- void updateQuestVar(Character *, std::string const &name,
- std::string const &value);
+ void updateQuestVar(Character *, const std::string &name,
+ const std::string &value);
/**
* Sends ban message.
diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp
index 7319bcbe..a1991551 100644
--- a/src/game-server/being.cpp
+++ b/src/game-server/being.cpp
@@ -46,7 +46,7 @@ Being::Being(ThingType type):
}
}
-int Being::damage(Actor *, Damage const &damage)
+int Being::damage(Actor *, const Damage &damage)
{
if (mAction == DEAD)
return 0;
@@ -108,7 +108,7 @@ void Being::died()
for (Listeners::iterator i = mListeners.begin(),
i_end = mListeners.end(); i != i_end;)
{
- EventListener const &l = **i;
+ const EventListener &l = **i;
++i; // In case the listener removes itself from the list on the fly.
if (l.dispatch->died) l.dispatch->died(&l, this);
}
@@ -218,7 +218,7 @@ int Being::directionToAngle(int direction)
}
}
-void Being::performAttack(Damage const &damage, AttackZone const *attackZone)
+void Being::performAttack(const Damage &damage, const AttackZone *attackZone)
{
Point ppos = getPosition();
const int attackAngle = directionToAngle(getDirection());
diff --git a/src/game-server/being.hpp b/src/game-server/being.hpp
index 500754e4..92957096 100644
--- a/src/game-server/being.hpp
+++ b/src/game-server/being.hpp
@@ -138,7 +138,7 @@ class Being : public Actor
* stats, deducts the result from the hitpoints and adds the result to
* the HitsTaken list.
*/
- virtual int damage(Actor *source, Damage const &damage);
+ virtual int damage(Actor *source, const Damage &damage);
/**
* Changes status and calls all the "died" listeners.
@@ -153,7 +153,7 @@ class Being : public Actor
/**
* Gets the destination coordinates of the being.
*/
- Point const &getDestination() const
+ const Point &getDestination() const
{ return mDst; }
/**
@@ -193,7 +193,7 @@ class Being : public Actor
/**
* Gets the damage list.
*/
- Hits const &getHitsTaken() const
+ const Hits &getHitsTaken() const
{ return mHitsTaken; }
/**
@@ -205,7 +205,7 @@ class Being : public Actor
/**
* Performs an attack.
*/
- void performAttack(Damage const &, AttackZone const *attackZone);
+ void performAttack(const Damage &, const AttackZone *attackZone);
/**
* Sets the current action.
@@ -284,8 +284,8 @@ class Being : public Actor
std::vector< Attribute > mAttributes;
private:
- Being(Being const &rhs);
- Being &operator=(Being const &rhs);
+ Being(const Being &rhs);
+ Being &operator=(const Being &rhs);
std::list<PATH_NODE> mPath;
Point mOld; /**< Old coordinates. */
diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp
index 1d32914f..f9a9b588 100644
--- a/src/game-server/character.cpp
+++ b/src/game-server/character.cpp
@@ -139,7 +139,7 @@ void Character::perform()
if (ic)
{
// weapon fighting
- ItemModifiers const &mods = ic->getModifiers();
+ const ItemModifiers &mods = ic->getModifiers();
damage.element = mods.getValue(MOD_ELEMENT_TYPE);
performAttack(damage, ic->getAttackZone());
}
@@ -502,7 +502,7 @@ void Character::disconnected()
for (Listeners::iterator i = mListeners.begin(),
i_end = mListeners.end(); i != i_end;)
{
- EventListener const &l = **i;
+ const EventListener &l = **i;
++i; // In case the listener removes itself from the list on the fly.
if (l.dispatch->disconnected) l.dispatch->disconnected(&l, this);
}
diff --git a/src/game-server/character.hpp b/src/game-server/character.hpp
index 33be114e..f930c33b 100644
--- a/src/game-server/character.hpp
+++ b/src/game-server/character.hpp
@@ -102,7 +102,7 @@ class Character : public Being
/**
* Gets a reference on the possessions.
*/
- Possessions const &getPossessions() const
+ const Possessions &getPossessions() const
{ return mPossessions; }
/**
@@ -309,8 +309,8 @@ class Character : public Being
{ return 0x82; } // blocked by walls and monsters ( bin 1000 0010)
private:
- Character(Character const &);
- Character &operator=(Character const &);
+ Character(const Character &);
+ Character &operator=(const Character &);
static const float EXPCURVE_EXPONENT;
static const float EXPCURVE_FACTOR;
diff --git a/src/game-server/command.cpp b/src/game-server/command.cpp
index ef8f649b..8d5bd27f 100644
--- a/src/game-server/command.cpp
+++ b/src/game-server/command.cpp
@@ -38,8 +38,8 @@ static T proxy_cast(intptr_t v)
{ return (T)v; }
template<>
-std::string const &proxy_cast(intptr_t v)
-{ return *(std::string const *)v; }
+const std::string &proxy_cast(intptr_t v)
+{ return *(const std::string *)v; }
template< typename T1 >
static void proxy(void (*f)(), Character *from, intptr_t const args[1])
@@ -79,7 +79,7 @@ template< typename T > struct Argument;
template<> struct Argument< int >
{ static char const type = 'n'; };
-template<> struct Argument< std::string const & >
+template<> struct Argument< const std::string & >
{ static char const type = 's'; };
template<> struct Argument< Character * >
{ static char const type = 'c'; };
@@ -95,7 +95,7 @@ template<> struct Argument< MonsterClass * >
*/
struct Command
{
- char const *name;
+ const char *name;
void (*handler)(void (*f)(), Character *, intptr_t const[]);
void (*target)();
char type[4];
@@ -106,7 +106,7 @@ struct Command
* Creates a command with a 1-parameter handler.
*/
template< typename T1 >
-static Command handle(char const *name, int level,
+static Command handle(const char *name, int level,
void (*f)(Character *, T1))
{
Command c;
@@ -123,7 +123,7 @@ static Command handle(char const *name, int level,
* Creates a command with a 2-parameter handler.
*/
template< typename T1, typename T2 >
-static Command handle(char const *name, int level,
+static Command handle(const char *name, int level,
void (*f)(Character *, T1, T2))
{
Command c;
@@ -141,7 +141,7 @@ static Command handle(char const *name, int level,
* Creates a command with a 3-parameter handler.
*/
template< typename T1, typename T2, typename T3 >
-static Command handle(char const *name, int level,
+static Command handle(const char *name, int level,
void (*f)(Character *, T1, T2, T3))
{
Command c;
@@ -160,7 +160,7 @@ static Command handle(char const *name, int level,
* Creates a command with a 4-parameter handler.
*/
template< typename T1, typename T2, typename T3, typename T4 >
-static Command handle(char const *name, int level,
+static Command handle(const char *name, int level,
void (*f)(Character *, T1, T2, T3, T4))
{
Command c;
@@ -201,7 +201,7 @@ static void drop(Character *from, ItemClass *it, int nb)
static void spawn(Character *from, MonsterClass *specy, int nb)
{
MapComposite *map = from->getMap();
- Point const &pos = from->getPosition();
+ const Point &pos = from->getPosition();
for (int i = 0; i < nb; ++i)
{
@@ -220,18 +220,18 @@ static void spawn(Character *from, MonsterClass *specy, int nb)
static void goto_(Character *from, Character *ch)
{
MapComposite *m = ch->getMap();
- Point const &pos = ch->getPosition();
+ const Point &pos = ch->getPosition();
GameState::warp(from, m, pos.x, pos.y);
}
static void recall(Character *from, Character *ch)
{
MapComposite *m = from->getMap();
- Point const &pos = from->getPosition();
+ const Point &pos = from->getPosition();
GameState::warp(ch, m, pos.x, pos.y);
}
-static void reload(Character *, std::string const &db)
+static void reload(Character *, const std::string &db)
{
if (db == "items")
{
@@ -243,7 +243,7 @@ static void reload(Character *, std::string const &db)
}
}
-static void ban(Character *from, Character *ch, std::string const &duration)
+static void ban(Character *from, Character *ch, const std::string &duration)
{
if (from->getAccountLevel() <= ch->getAccountLevel())
{
@@ -285,7 +285,7 @@ static Command const commands[] =
/**
* Send a message to the given character from the server.
*/
-static void say(Character * ch, std::string const &message)
+static void say(Character * ch, const std::string &message)
{
GameState::sayTo(ch, NULL, message);
}
@@ -294,9 +294,9 @@ static void say(Character * ch, std::string const &message)
/**
* Parses a command and executes its associated handler.
*/
-void runCommand(Character *ch, std::string const &text)
+void runCommand(Character *ch, const std::string &text)
{
- Command const *c = NULL;
+ const Command *c = NULL;
std::string::size_type npos = std::string::npos;
std::string::size_type pos = text.find(' ');
// remove the first letter which signifies it was a command
diff --git a/src/game-server/commandhandler.cpp b/src/game-server/commandhandler.cpp
index 3e61fe8f..cf263103 100644
--- a/src/game-server/commandhandler.cpp
+++ b/src/game-server/commandhandler.cpp
@@ -22,21 +22,22 @@
#include <sstream>
#include "defines.h"
-#include "commandhandler.hpp"
-#include "accountconnection.hpp"
-#include "character.hpp"
-#include "gamehandler.hpp"
-#include "inventory.hpp"
-#include "item.hpp"
-#include "itemmanager.hpp"
-#include "mapmanager.hpp"
-#include "monster.hpp"
-#include "monstermanager.hpp"
-#include "state.hpp"
-
-#include "../common/transaction.hpp"
-
-#include "../utils/string.hpp"
+
+#include "game-server/commandhandler.hpp"
+#include "game-server/accountconnection.hpp"
+#include "game-server/character.hpp"
+#include "game-server/gamehandler.hpp"
+#include "game-server/inventory.hpp"
+#include "game-server/item.hpp"
+#include "game-server/itemmanager.hpp"
+#include "game-server/mapmanager.hpp"
+#include "game-server/monster.hpp"
+#include "game-server/monstermanager.hpp"
+#include "game-server/state.hpp"
+
+#include "common/transaction.hpp"
+
+#include "utils/string.hpp"
static void say(const std::string error, Character *player)
{
@@ -418,7 +419,7 @@ static void handleSpawn(Character *player, std::string &args)
{
MonsterClass *mc;
MapComposite *map = player->getMap();
- Point const &pos = player->getPosition();
+ const Point &pos = player->getPosition();
int value, id;
// get the arguments
@@ -504,7 +505,7 @@ static void handleGoto(Character *player, std::string &args)
// move the player to where the other player is
MapComposite *map = other->getMap();
- Point const &pos = other->getPosition();
+ const Point &pos = other->getPosition();
GameState::warp(player, map, pos.x, pos.y);
}
@@ -533,7 +534,7 @@ static void handleRecall(Character *player, std::string &args)
// move the other player to where the player is
MapComposite *map = player->getMap();
- Point const &pos = player->getPosition();
+ const Point &pos = player->getPosition();
GameState::warp(other, map, pos.x, pos.y);
}
diff --git a/src/game-server/eventlistener.hpp b/src/game-server/eventlistener.hpp
index 827a0802..fe59124f 100644
--- a/src/game-server/eventlistener.hpp
+++ b/src/game-server/eventlistener.hpp
@@ -32,8 +32,8 @@ struct EventDispatch;
*/
struct EventListener
{
- EventDispatch const *dispatch;
- EventListener(EventDispatch const *d): dispatch(d) {}
+ const EventDispatch *dispatch;
+ EventListener(const EventDispatch *d): dispatch(d) {}
};
/**
@@ -44,22 +44,22 @@ struct EventDispatch
/**
* Called just after something is inserted in a map.
*/
- void (*inserted)(EventListener const *, Thing *);
+ void (*inserted)(const EventListener *, Thing *);
/**
* Called just before something is removed from a map.
*/
- void (*removed)(EventListener const *, Thing *);
+ void (*removed)(const EventListener *, Thing *);
/**
* Called just after a being has died.
*/
- void (*died)(EventListener const *, Being *);
+ void (*died)(const EventListener *, Being *);
/**
* Called just before a character is deleted.
*/
- void (*disconnected)(EventListener const *, Character *);
+ void (*disconnected)(const EventListener *, Character *);
/**
* Initializes dispatch methods as missing.
@@ -87,7 +87,7 @@ struct EventListenerFactory
template< class U, void (T::*F)(U *), class V = U >
struct create
{
- static void function(EventListener const *d, V *u)
+ static void function(const EventListener *d, V *u)
{
/* Get the address of the T object by substracting the offset of D
from the pointer d. */
diff --git a/src/game-server/gamehandler.cpp b/src/game-server/gamehandler.cpp
index 2ce443c1..42e9ce7a 100644
--- a/src/game-server/gamehandler.cpp
+++ b/src/game-server/gamehandler.cpp
@@ -95,8 +95,8 @@ void GameHandler::prepareServerChange(Character *ch)
client->status = CLIENT_CHANGE_SERVER;
}
-void GameHandler::completeServerChange(int id, std::string const &token,
- std::string const &address, int port)
+void GameHandler::completeServerChange(int id, const std::string &token,
+ const std::string &address, int port)
{
for (NetComputers::const_iterator i = clients.begin(),
i_end = clients.end(); i != i_end; ++i)
@@ -135,7 +135,7 @@ void GameHandler::updateCharacter(int charid, int partyid)
static Actor *findActorNear(Actor *p, int id)
{
MapComposite *map = p->getMap();
- Point const &ppos = p->getPosition();
+ const Point &ppos = p->getPosition();
// See map.hpp for tiles constants
const int pixelDist = DEFAULT_TILE_WIDTH * TILES_TO_BE_NEAR;
for (ActorIterator i(map->getAroundPointIterator(ppos, pixelDist)); i; ++i)
@@ -151,7 +151,7 @@ static Actor *findActorNear(Actor *p, int id)
static Character *findCharacterNear(Actor *p, int id)
{
MapComposite *map = p->getMap();
- Point const &ppos = p->getPosition();
+ const Point &ppos = p->getPosition();
// See map.hpp for tiles constants
const int pixelDist = DEFAULT_TILE_WIDTH * TILES_TO_BE_NEAR;
for (CharacterIterator i(map->getAroundPointIterator(ppos,
@@ -577,7 +577,7 @@ void GameHandler::sendTo(Character *beingPtr, MessageOut &msg)
client->send(msg);
}
-void GameHandler::addPendingCharacter(std::string const &token, Character *ch)
+void GameHandler::addPendingCharacter(const std::string &token, Character *ch)
{
/* First, check if the character is already on the map. This may happen if
a client just lost its connection, and logged to the account server
@@ -615,8 +615,7 @@ void GameHandler::addPendingCharacter(std::string const &token, Character *ch)
mTokenCollector.addPendingConnect(token, ch);
}
-void
-GameHandler::tokenMatched(GameClient* computer, Character* character)
+void GameHandler::tokenMatched(GameClient* computer, Character* character)
{
computer->character = character;
computer->status = CLIENT_CONNECTED;
@@ -645,8 +644,7 @@ GameHandler::tokenMatched(GameClient* computer, Character* character)
}
}
-void
-GameHandler::deletePendingClient(GameClient* computer)
+void GameHandler::deletePendingClient(GameClient* computer)
{
// Something might have changed since it was inserted
if (computer->status != CLIENT_QUEUED) return;
@@ -658,13 +656,12 @@ GameHandler::deletePendingClient(GameClient* computer)
computer->disconnect(msg);
}
-void
-GameHandler::deletePendingConnect(Character* character)
+void GameHandler::deletePendingConnect(Character* character)
{
delete character;
}
-GameClient *GameHandler::getClientByNameSlow(std::string const &name)
+GameClient *GameHandler::getClientByNameSlow(const std::string &name)
{
for (NetComputers::const_iterator i = clients.begin(),
i_end = clients.end(); i != i_end; ++i)
diff --git a/src/game-server/gamehandler.hpp b/src/game-server/gamehandler.hpp
index 0ae0d495..b3370348 100644
--- a/src/game-server/gamehandler.hpp
+++ b/src/game-server/gamehandler.hpp
@@ -77,8 +77,8 @@ class GameHandler: public ConnectionHandler
/**
* Completes a server change for given character ID.
*/
- void completeServerChange(int id, std::string const &token,
- std::string const &address, int port);
+ void completeServerChange(int id, const std::string &token,
+ const std::string &address, int port);
/**
* Updates the party id of the character
@@ -89,7 +89,7 @@ class GameHandler: public ConnectionHandler
* Registers a character that should soon be claimed by a client.
* @param token token used by the client when connecting.
*/
- void addPendingCharacter(std::string const &token, Character *);
+ void addPendingCharacter(const std::string &token, Character *);
/**
* Combines a client with its character.
@@ -116,7 +116,7 @@ class GameHandler: public ConnectionHandler
* Gets the client associated to a character name. This method is slow,
* so it should never be called for regular operations.
*/
- GameClient *getClientByNameSlow(std::string const &);
+ GameClient *getClientByNameSlow(const std::string &);
protected:
NetComputer *computerConnected(ENetPeer *);
diff --git a/src/game-server/item.hpp b/src/game-server/item.hpp
index 4da82cf7..828328ba 100644
--- a/src/game-server/item.hpp
+++ b/src/game-server/item.hpp
@@ -231,13 +231,13 @@ class ItemClass
/**
* Gets item modifiers.
*/
- ItemModifiers const &getModifiers() const
+ const ItemModifiers &getModifiers() const
{ return mModifiers; }
/**
* Sets item modifiers.
*/
- void setModifiers(ItemModifiers const &modifiers)
+ void setModifiers(const ItemModifiers &modifiers)
{ mModifiers = modifiers; }
/**
@@ -272,7 +272,7 @@ class ItemClass
/**
* Gets attack zone of weapon (returns NULL for non-weapon items)
*/
- AttackZone const *getAttackZone() const
+ const AttackZone *getAttackZone() const
{ return mAttackZone ; }
diff --git a/src/game-server/itemmanager.cpp b/src/game-server/itemmanager.cpp
index e275d1a6..ac0ea7d2 100644
--- a/src/game-server/itemmanager.cpp
+++ b/src/game-server/itemmanager.cpp
@@ -39,7 +39,7 @@ static ItemClasses itemClasses; /**< Item reference */
static std::string itemReferenceFile;
static unsigned int itemDatabaseVersion = 0; /**< Version of the loaded items database file.*/
-void ItemManager::initialize(std::string const &file)
+void ItemManager::initialize(const std::string &file)
{
itemReferenceFile = file;
reload();
diff --git a/src/game-server/itemmanager.hpp b/src/game-server/itemmanager.hpp
index a99dffb5..ec2c5c6d 100644
--- a/src/game-server/itemmanager.hpp
+++ b/src/game-server/itemmanager.hpp
@@ -28,12 +28,10 @@ class ItemClass;
namespace ItemManager
{
-
-
/**
* Loads item reference file.
*/
- void initialize(std::string const &);
+ void initialize(const std::string &);
/**
* Reloads item reference file.
diff --git a/src/game-server/mapcomposite.cpp b/src/game-server/mapcomposite.cpp
index d77f73ba..df252761 100644
--- a/src/game-server/mapcomposite.cpp
+++ b/src/game-server/mapcomposite.cpp
@@ -140,7 +140,7 @@ static void addZone(MapRegion &r, unsigned z)
}
}
-ZoneIterator::ZoneIterator(MapRegion const &r, MapContent const *m)
+ZoneIterator::ZoneIterator(const MapRegion &r, const MapContent *m)
: region(r), pos(0), map(m)
{
current = &map->zones[r.empty() ? 0 : r[0]];
@@ -165,7 +165,7 @@ void ZoneIterator::operator++()
}
}
-CharacterIterator::CharacterIterator(ZoneIterator const &it)
+CharacterIterator::CharacterIterator(const ZoneIterator &it)
: iterator(it), pos(0)
{
while (iterator && (*iterator)->nbCharacters == 0) ++iterator;
@@ -188,7 +188,7 @@ void CharacterIterator::operator++()
}
}
-BeingIterator::BeingIterator(ZoneIterator const &it)
+BeingIterator::BeingIterator(const ZoneIterator &it)
: iterator(it), pos(0)
{
while (iterator && (*iterator)->nbMovingObjects == 0) ++iterator;
@@ -211,7 +211,7 @@ void BeingIterator::operator++()
}
}
-FixedActorIterator::FixedActorIterator(ZoneIterator const &it)
+FixedActorIterator::FixedActorIterator(const ZoneIterator &it)
: iterator(it), pos(0)
{
while (iterator && (*iterator)->nbMovingObjects == (*iterator)->objects.size()) ++iterator;
@@ -238,7 +238,7 @@ void FixedActorIterator::operator++()
}
}
-ActorIterator::ActorIterator(ZoneIterator const &it)
+ActorIterator::ActorIterator(const ZoneIterator &it)
: iterator(it), pos(0)
{
while (iterator && (*iterator)->objects.empty()) ++iterator;
@@ -395,7 +395,7 @@ void MapContent::deallocate(Actor *obj)
buckets[id / 256]->deallocate(id % 256);
}
-void MapContent::fillRegion(MapRegion &r, Point const &p, int radius) const
+void MapContent::fillRegion(MapRegion &r, const Point &p, int radius) const
{
int ax = p.x > radius ? (p.x - radius) / zoneDiam : 0,
ay = p.y > radius ? (p.y - radius) / zoneDiam : 0,
@@ -410,7 +410,7 @@ void MapContent::fillRegion(MapRegion &r, Point const &p, int radius) const
}
}
-void MapContent::fillRegion(MapRegion &r, Rectangle const &p) const
+void MapContent::fillRegion(MapRegion &r, const Rectangle &p) const
{
int ax = p.x / zoneDiam,
ay = p.y / zoneDiam,
@@ -425,13 +425,17 @@ void MapContent::fillRegion(MapRegion &r, Rectangle const &p) const
}
}
-MapZone& MapContent::getZone(Point const &pos) const
+MapZone& MapContent::getZone(const Point &pos) const
{
return zones[(pos.x / zoneDiam) + (pos.y / zoneDiam) * mapWidth];
}
-MapComposite::MapComposite(int id, std::string const &name):
- mMap(NULL), mContent(NULL), mScript(NULL), mName(name), mID(id)
+MapComposite::MapComposite(int id, const std::string &name):
+ mMap(NULL),
+ mContent(NULL),
+ mScript(NULL),
+ mName(name),
+ mID(id)
{
}
@@ -442,7 +446,7 @@ MapComposite::~MapComposite()
delete mScript;
}
-ZoneIterator MapComposite::getAroundPointIterator(Point const &p, int radius) const
+ZoneIterator MapComposite::getAroundPointIterator(const Point &p, int radius) const
{
MapRegion r;
mContent->fillRegion(r, p, radius);
@@ -456,7 +460,7 @@ ZoneIterator MapComposite::getAroundActorIterator(Actor *obj, int radius) const
return ZoneIterator(r, mContent);
}
-ZoneIterator MapComposite::getInsideRectangleIterator(Rectangle const &p) const
+ZoneIterator MapComposite::getInsideRectangleIterator(const Rectangle &p) const
{
MapRegion r;
mContent->fillRegion(r, p);
@@ -581,7 +585,7 @@ void MapComposite::update()
}
}
-std::vector< Thing * > const &MapComposite::getEverything() const
+const std::vector< Thing * > &MapComposite::getEverything() const
{
return mContent->things;
}
diff --git a/src/game-server/mapcomposite.hpp b/src/game-server/mapcomposite.hpp
index ccec1db1..c55cfcdf 100644
--- a/src/game-server/mapcomposite.hpp
+++ b/src/game-server/mapcomposite.hpp
@@ -58,9 +58,9 @@ struct ZoneIterator
MapRegion region; /**< Zones to visit. Empty means the entire map. */
unsigned pos;
MapZone *current;
- MapContent const *map;
+ const MapContent *map;
- ZoneIterator(MapRegion const &, MapContent const *);
+ ZoneIterator(const MapRegion &, const MapContent *);
void operator++();
MapZone *operator*() const { return current; }
operator bool() const { return current; }
@@ -75,7 +75,7 @@ struct CharacterIterator
unsigned short pos;
Character *current;
- CharacterIterator(ZoneIterator const &);
+ CharacterIterator(const ZoneIterator &);
void operator++();
Character *operator*() const { return current; }
operator bool() const { return iterator; }
@@ -90,7 +90,7 @@ struct BeingIterator
unsigned short pos;
Being *current;
- BeingIterator(ZoneIterator const &);
+ BeingIterator(const ZoneIterator &);
void operator++();
Being *operator*() const { return current; }
operator bool() const { return iterator; }
@@ -105,7 +105,7 @@ struct FixedActorIterator
unsigned short pos;
Actor *current;
- FixedActorIterator(ZoneIterator const &);
+ FixedActorIterator(const ZoneIterator &);
void operator++();
Actor *operator*() const { return current; }
operator bool() const { return iterator; }
@@ -120,7 +120,7 @@ struct ActorIterator
unsigned short pos;
Actor *current;
- ActorIterator(ZoneIterator const &);
+ ActorIterator(const ZoneIterator &);
void operator++();
Actor *operator*() const { return current; }
operator bool() const { return iterator; }
@@ -190,17 +190,17 @@ struct MapContent
/**
* Fills a region of zones within the range of a point.
*/
- void fillRegion(MapRegion &, Point const &, int) const;
+ void fillRegion(MapRegion &, const Point &, int) const;
/**
* Fills a region of zones inside a rectangle.
*/
- void fillRegion(MapRegion &, Rectangle const &) const;
+ void fillRegion(MapRegion &, const Rectangle &) const;
/**
* Gets zone at given position.
*/
- MapZone &getZone(Point const &pos) const;
+ MapZone &getZone(const Point &pos) const;
/**
* Things (items, characters, monsters, etc) located on the map.
@@ -232,7 +232,7 @@ class MapComposite
/**
* Constructor.
*/
- MapComposite(int id, std::string const &name);
+ MapComposite(int id, const std::string &name);
/**
* Destructor.
@@ -278,7 +278,7 @@ class MapComposite
/**
* Gets the name of this map.
*/
- std::string const &getName() const
+ const std::string &getName() const
{ return mName; }
/**
@@ -310,12 +310,12 @@ class MapComposite
/**
* Gets an iterator on the objects inside a given rectangle.
*/
- ZoneIterator getInsideRectangleIterator(Rectangle const &) const;
+ ZoneIterator getInsideRectangleIterator(const Rectangle &) const;
/**
* Gets an iterator on the objects around a given point.
*/
- ZoneIterator getAroundPointIterator(Point const &, int radius) const;
+ ZoneIterator getAroundPointIterator(const Point &, int radius) const;
/**
* Gets an iterator on the objects around a given actor.
@@ -331,10 +331,10 @@ class MapComposite
/**
* Gets everything related to the map.
*/
- std::vector< Thing * > const &getEverything() const;
+ const std::vector< Thing * > &getEverything() const;
private:
- MapComposite(MapComposite const &);
+ MapComposite(const MapComposite &);
Map *mMap; /**< Actual map. */
MapContent *mContent; /**< Entities on the map. */
diff --git a/src/game-server/mapmanager.cpp b/src/game-server/mapmanager.cpp
index 2cc37de3..0e682afa 100644
--- a/src/game-server/mapmanager.cpp
+++ b/src/game-server/mapmanager.cpp
@@ -35,12 +35,12 @@
*/
static MapManager::Maps maps;
-MapManager::Maps const &MapManager::getMaps()
+const MapManager::Maps &MapManager::getMaps()
{
return maps;
}
-void MapManager::initialize(std::string const &mapReferenceFile)
+void MapManager::initialize(const std::string &mapReferenceFile)
{
int size;
char *data = ResourceManager::loadFile(mapReferenceFile, size);
@@ -103,7 +103,7 @@ MapComposite *MapManager::getMap(int mapId)
return (i != maps.end()) ? i->second : NULL;
}
-MapComposite *MapManager::getMap(std::string const &mapName)
+MapComposite *MapManager::getMap(const std::string &mapName)
{
Maps::iterator i;
for (i = maps.begin(); i != maps.end(); ++i)
diff --git a/src/game-server/mapmanager.hpp b/src/game-server/mapmanager.hpp
index e3fde61a..23675974 100644
--- a/src/game-server/mapmanager.hpp
+++ b/src/game-server/mapmanager.hpp
@@ -34,7 +34,7 @@ namespace MapManager
/**
* Loads map reference file and prepares maps.
*/
- void initialize(std::string const &mapReferenceFile);
+ void initialize(const std::string &mapReferenceFile);
/**
* Destroy loaded maps.
@@ -51,12 +51,12 @@ namespace MapManager
/**
* Returns the requested map
*/
- MapComposite *getMap(std::string const &mapName);
+ MapComposite *getMap(const std::string &mapName);
/**
* Returns all the maps.
*/
- Maps const &getMaps();
+ const Maps &getMaps();
/**
* Sets the activity status of the map.
diff --git a/src/game-server/mapreader.cpp b/src/game-server/mapreader.cpp
index 758b37ee..fdf8e997 100644
--- a/src/game-server/mapreader.cpp
+++ b/src/game-server/mapreader.cpp
@@ -114,7 +114,7 @@ void MapReader::readMap(const std::string &filename, MapComposite *composite)
}
}
-Map* MapReader::readMap(xmlNodePtr node, std::string const &path,
+Map* MapReader::readMap(xmlNodePtr node, const std::string &path,
MapComposite *composite, std::vector<Thing *> &things)
{
// Take the filename off the path
@@ -419,9 +419,9 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
return;
}
- int len = strlen((char const *)dataChild->content) + 1;
+ int len = strlen((const char *) dataChild->content) + 1;
char *charData = new char[len + 1];
- char const *charStart = (char const *)dataChild->content;
+ const char *charStart = (const char *) dataChild->content;
char *charIndex = charData;
while (*charStart)
diff --git a/src/game-server/mapreader.hpp b/src/game-server/mapreader.hpp
index d9b68c4e..d5677007 100644
--- a/src/game-server/mapreader.hpp
+++ b/src/game-server/mapreader.hpp
@@ -40,15 +40,17 @@ class MapReader
/**
* Read an XML map from a file.
*/
- static void readMap(const std::string &filename, MapComposite *composite);
+ static void readMap(const std::string &filename,
+ MapComposite *composite);
private:
/**
- * Read an XML map from a parsed XML tree, and populate things with objects
- * in that map.
+ * Read an XML map from a parsed XML tree, and populate things with
+ * objects in that map.
*/
- static Map* readMap(xmlNodePtr node, std::string const &path,
- MapComposite *composite, std::vector<Thing *> &things);
+ static Map *readMap(xmlNodePtr node, const std::string &path,
+ MapComposite *composite,
+ std::vector<Thing *> &things);
/**
* Reads a map layer and adds it to the given map.
@@ -58,7 +60,8 @@ class MapReader
/**
* Get the string value from the given object property node.
*/
- static std::string getObjectProperty(xmlNodePtr node, const std::string &def);
+ static std::string getObjectProperty(xmlNodePtr node,
+ const std::string &def);
/**
* Get the integer value from the given object property node.
diff --git a/src/game-server/monster.cpp b/src/game-server/monster.cpp
index a5a5f2ec..9c5fb044 100644
--- a/src/game-server/monster.cpp
+++ b/src/game-server/monster.cpp
@@ -319,7 +319,7 @@ void Monster::forgetTarget(Thing *t)
}
}
-int Monster::damage(Actor *source, Damage const &damage)
+int Monster::damage(Actor *source, const Damage &damage)
{
int HPLoss = Being::damage(source, damage);
if (HPLoss && source && source->getType() == OBJECT_CHARACTER)
diff --git a/src/game-server/monster.hpp b/src/game-server/monster.hpp
index b7c5947f..c25d853e 100644
--- a/src/game-server/monster.hpp
+++ b/src/game-server/monster.hpp
@@ -88,7 +88,7 @@ class MonsterClass
* Sets monster drops. These are the items the monster drops when it
* dies.
*/
- void setDrops(MonsterDrops const &v)
+ void setDrops(const MonsterDrops &v)
{ mDrops = v; }
/**
@@ -249,7 +249,7 @@ class Monster : public Being
/**
* Calls the damage function in Being and updates the aggro list
*/
- virtual int damage(Actor *source, Damage const &damage);
+ virtual int damage(Actor *source, const Damage &damage);
/**
* Removes a being from the anger list.
diff --git a/src/game-server/monstermanager.cpp b/src/game-server/monstermanager.cpp
index 022467d8..d7f301c8 100644
--- a/src/game-server/monstermanager.cpp
+++ b/src/game-server/monstermanager.cpp
@@ -57,7 +57,7 @@ Element elementFromString (const std::string &name)
return val == table.end() ? ELEMENT_ILLEGAL : (*val).second;
}
-void MonsterManager::initialize(std::string const &file)
+void MonsterManager::initialize(const std::string &file)
{
monsterReferenceFile = file;
reload();
diff --git a/src/game-server/monstermanager.hpp b/src/game-server/monstermanager.hpp
index ec84ca09..8af9a662 100644
--- a/src/game-server/monstermanager.hpp
+++ b/src/game-server/monstermanager.hpp
@@ -31,7 +31,7 @@ namespace MonsterManager
/**
* Loads monster reference file.
*/
- void initialize(std::string const &);
+ void initialize(const std::string &);
/**
* Reloads monster reference file.
@@ -46,7 +46,7 @@ namespace MonsterManager
/**
* Gets the MonsterClass having the given ID.
*/
- MonsterClass *getMonster(int);
+ MonsterClass *getMonster(int id);
}
#endif
diff --git a/src/game-server/postman.hpp b/src/game-server/postman.hpp
index c9b02b0a..ed9d0c1f 100644
--- a/src/game-server/postman.hpp
+++ b/src/game-server/postman.hpp
@@ -28,8 +28,8 @@ class Character;
struct PostCallback
{
- void (*handler)(Character *, std::string const &sender,
- std::string const &letter, void *data);
+ void (*handler)(Character *, const std::string &sender,
+ const std::string &letter, void *data);
void *data;
};
diff --git a/src/game-server/quest.cpp b/src/game-server/quest.cpp
index 06dc2a4c..2e8c2c2c 100644
--- a/src/game-server/quest.cpp
+++ b/src/game-server/quest.cpp
@@ -45,7 +45,7 @@ typedef std::map< int, PendingQuest > PendingQuests;
static PendingQuests pendingQuests;
-bool getQuestVar(Character *ch, std::string const &name, std::string &value)
+bool getQuestVar(Character *ch, const std::string &name, std::string &value)
{
std::map< std::string, std::string >::iterator
i = ch->questCache.find(name);
@@ -54,8 +54,8 @@ bool getQuestVar(Character *ch, std::string const &name, std::string &value)
return true;
}
-void setQuestVar(Character *ch, std::string const &name,
- std::string const &value)
+void setQuestVar(Character *ch, const std::string &name,
+ const std::string &value)
{
std::map< std::string, std::string >::iterator
i = ch->questCache.lower_bound(name);
@@ -79,9 +79,9 @@ void setQuestVar(Character *ch, std::string const &name,
*/
struct QuestDeathListener: EventDispatch
{
- static void partialRemove(EventListener const *, Thing *);
+ static void partialRemove(const EventListener *, Thing *);
- static void fullRemove(EventListener const *, Character *);
+ static void fullRemove(const EventListener *, Character *);
QuestDeathListener()
{
@@ -93,7 +93,7 @@ struct QuestDeathListener: EventDispatch
static QuestDeathListener questDeathDummy;
static EventListener questDeathListener(&questDeathDummy);
-void QuestDeathListener::partialRemove(EventListener const *, Thing *t)
+void QuestDeathListener::partialRemove(const EventListener *, Thing *t)
{
int id = static_cast< Character * >(t)->getDatabaseID();
PendingVariables &variables = pendingQuests[id].variables;
@@ -106,15 +106,15 @@ void QuestDeathListener::partialRemove(EventListener const *, Thing *t)
// The listener is kept in case a fullRemove is needed later.
}
-void QuestDeathListener::fullRemove(EventListener const *, Character *ch)
+void QuestDeathListener::fullRemove(const EventListener *, Character *ch)
{
ch->removeListener(&questDeathListener);
// Remove anything related to this character.
pendingQuests.erase(ch->getDatabaseID());
}
-void recoverQuestVar(Character *ch, std::string const &name,
- QuestCallback const &f)
+void recoverQuestVar(Character *ch, const std::string &name,
+ const QuestCallback &f)
{
assert(ch->questCache.find(name) == ch->questCache.end());
int id = ch->getDatabaseID();
@@ -131,8 +131,8 @@ void recoverQuestVar(Character *ch, std::string const &name,
accountHandler->requestQuestVar(ch, name);
}
-void recoveredQuestVar(int id, std::string const &name,
- std::string const &value)
+void recoveredQuestVar(int id, const std::string &name,
+ const std::string &value)
{
PendingQuests::iterator i = pendingQuests.find(id);
if (i == pendingQuests.end()) return;
diff --git a/src/game-server/quest.hpp b/src/game-server/quest.hpp
index 614f7571..917a093b 100644
--- a/src/game-server/quest.hpp
+++ b/src/game-server/quest.hpp
@@ -28,8 +28,8 @@ class Character;
struct QuestCallback
{
- void (*handler)(Character *, std::string const &name,
- std::string const &value, void *data);
+ void (*handler)(Character *, const std::string &name,
+ const std::string &value, void *data);
void *data;
};
@@ -37,25 +37,25 @@ struct QuestCallback
* Gets the value associated to a quest variable.
* @return false if no value was in cache.
*/
-bool getQuestVar(Character *, std::string const &name, std::string &value);
+bool getQuestVar(Character *, const std::string &name, std::string &value);
/**
* Sets the value associated to a quest variable.
*/
-void setQuestVar(Character *, std::string const &name,
- std::string const &value);
+void setQuestVar(Character *, const std::string &name,
+ const std::string &value);
/**
* Starts the recovery of a variable and returns immediatly. The callback will
* be called once the value has been recovered.
*/
-void recoverQuestVar(Character *, std::string const &name,
- QuestCallback const &);
+void recoverQuestVar(Character *, const std::string &name,
+ const QuestCallback &);
/**
* Called by the handler of the account server when a value is received.
*/
-void recoveredQuestVar(int id, std::string const &name,
- std::string const &value);
+void recoveredQuestVar(int id, const std::string &name,
+ const std::string &value);
#endif
diff --git a/src/game-server/resourcemanager.cpp b/src/game-server/resourcemanager.cpp
index 9a4b2a08..1eb8cba8 100644
--- a/src/game-server/resourcemanager.cpp
+++ b/src/game-server/resourcemanager.cpp
@@ -111,12 +111,12 @@ void ResourceManager::initialize()
#endif
}
-bool ResourceManager::exists(std::string const &path)
+bool ResourceManager::exists(const std::string &path)
{
return PHYSFS_exists(path.c_str());
}
-char *ResourceManager::loadFile(std::string const &fileName, int &fileSize)
+char *ResourceManager::loadFile(const std::string &fileName, int &fileSize)
{
// Attempt to open the specified file using PhysicsFS
PHYSFS_file* file = PHYSFS_openRead(fileName.c_str());
diff --git a/src/game-server/resourcemanager.hpp b/src/game-server/resourcemanager.hpp
index 9df36abe..7c346f19 100644
--- a/src/game-server/resourcemanager.hpp
+++ b/src/game-server/resourcemanager.hpp
@@ -34,7 +34,7 @@ namespace ResourceManager
/**
* Checks whether the given file or directory exists in the search path
*/
- bool exists(std::string const &path);
+ bool exists(const std::string &path);
/**
* Allocates data into a buffer pointer for raw data loading. The
@@ -47,7 +47,7 @@ namespace ResourceManager
* or <code>NULL</code> on failure.
* @note The array contains an extra \0 character at position fileSize.
*/
- char *loadFile(std::string const &fileName, int &fileSize);
+ char *loadFile(const std::string &fileName, int &fileSize);
}
#endif
diff --git a/src/game-server/spawnarea.hpp b/src/game-server/spawnarea.hpp
index c99450ac..cacec07b 100644
--- a/src/game-server/spawnarea.hpp
+++ b/src/game-server/spawnarea.hpp
@@ -36,7 +36,7 @@ class MonsterClass;
class SpawnArea : public Thing
{
public:
- SpawnArea(MapComposite *, MonsterClass *, Rectangle const &zone,
+ SpawnArea(MapComposite *, MonsterClass *, const Rectangle &zone,
int maxBeings, int spawnRate);
void update();
diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp
index f0997174..2033c4bf 100644
--- a/src/game-server/state.cpp
+++ b/src/game-server/state.cpp
@@ -71,7 +71,7 @@ static DelayedEvents delayedEvents;
static void updateMap(MapComposite *map)
{
// 1. update object status.
- std::vector< Thing * > const &things = map->getEverything();
+ const std::vector< Thing * > &things = map->getEverything();
for (std::vector< Thing * >::const_iterator i = things.begin(),
i_end = things.end(); i != i_end; ++i)
{
@@ -103,7 +103,7 @@ static void updateMap(MapComposite *map)
*/
static void serializeLooks(Character *ch, MessageOut &msg, bool full)
{
- Possessions const &poss = ch->getPossessions();
+ const Possessions &poss = ch->getPossessions();
static int const nb_slots = 4;
static int const slots[nb_slots] =
{
@@ -239,7 +239,7 @@ static void informPlayer(MapComposite *map, Character *p)
if (o->canFight())
{
Being *victim = static_cast< Being * >(o);
- Hits const &hits = victim->getHitsTaken();
+ const Hits &hits = victim->getHitsTaken();
for (Hits::const_iterator j = hits.begin(),
j_end = hits.end(); j != j_end; ++j)
{
@@ -447,7 +447,7 @@ void GameState::update(int worldTime)
# endif
// Update game state (update AI, etc.)
- MapManager::Maps const &maps = MapManager::getMaps();
+ const MapManager::Maps &maps = MapManager::getMaps();
for (MapManager::Maps::const_iterator m = maps.begin(), m_end = maps.end(); m != m_end; ++m)
{
MapComposite *map = m->second;
@@ -492,7 +492,7 @@ void GameState::update(int worldTime)
for (DelayedEvents::iterator i = delayedEvents.begin(),
i_end = delayedEvents.end(); i != i_end; ++i)
{
- DelayedEvent const &e = i->second;
+ const DelayedEvent &e = i->second;
Actor *o = i->first;
switch (e.type)
{
@@ -728,7 +728,7 @@ void GameState::warp(Character *ptr, MapComposite *map, int x, int y)
/**
* Enqueues an event. It will be executed at end of update.
*/
-static void enqueueEvent(Actor *ptr, DelayedEvent const &e)
+static void enqueueEvent(Actor *ptr, const DelayedEvent &e)
{
std::pair< DelayedEvents::iterator, bool > p =
delayedEvents.insert(std::make_pair(ptr, e));
@@ -757,7 +757,7 @@ void GameState::enqueueWarp(Character *ptr, MapComposite *m, int x, int y)
enqueueEvent(ptr, e);
}
-void GameState::sayAround(Actor *obj, std::string const &text)
+void GameState::sayAround(Actor *obj, const std::string &text)
{
Point speakerPosition = obj->getPosition();
int visualRange = Configuration::getValue("visualRange", 320);
@@ -771,7 +771,7 @@ void GameState::sayAround(Actor *obj, std::string const &text)
}
}
-void GameState::sayTo(Actor *destination, Actor *source, std::string const &text)
+void GameState::sayTo(Actor *destination, Actor *source, const std::string &text)
{
if (destination->getType() != OBJECT_CHARACTER)
return; //only characters will read it anyway
diff --git a/src/game-server/state.hpp b/src/game-server/state.hpp
index e08073b7..60e63b0e 100644
--- a/src/game-server/state.hpp
+++ b/src/game-server/state.hpp
@@ -92,12 +92,12 @@ namespace GameState
* Says something to an actor.
* @note passing NULL as source generates a message from "Server:"
*/
- void sayTo(Actor *destination, Actor *source, std::string const &text);
+ void sayTo(Actor *destination, Actor *source, const std::string &text);
/**
* Says something to everything around an actor.
*/
- void sayAround(Actor *, std::string const &text);
+ void sayAround(Actor *, const std::string &text);
/**
* Says something to every player on the server.
diff --git a/src/game-server/thing.cpp b/src/game-server/thing.cpp
index ad33b247..3aa7129e 100644
--- a/src/game-server/thing.cpp
+++ b/src/game-server/thing.cpp
@@ -35,12 +35,12 @@ Thing::~Thing()
assert(mListeners.empty());
}
-void Thing::addListener(EventListener const *l)
+void Thing::addListener(const EventListener *l)
{
mListeners.insert(l);
}
-void Thing::removeListener(EventListener const *l)
+void Thing::removeListener(const EventListener *l)
{
mListeners.erase(l);
}
@@ -50,7 +50,7 @@ void Thing::inserted()
for (Listeners::iterator i = mListeners.begin(),
i_end = mListeners.end(); i != i_end;)
{
- EventListener const &l = **i;
+ const EventListener &l = **i;
++i; // In case the listener removes itself from the list on the fly.
if (l.dispatch->inserted) l.dispatch->inserted(&l, this);
}
@@ -61,7 +61,7 @@ void Thing::removed()
for (Listeners::iterator i = mListeners.begin(),
i_end = mListeners.end(); i != i_end;)
{
- EventListener const &l = **i;
+ const EventListener &l = **i;
++i; // In case the listener removes itself from the list on the fly.
if (l.dispatch->removed) l.dispatch->removed(&l, this);
}
diff --git a/src/game-server/thing.hpp b/src/game-server/thing.hpp
index b87ea657..33ffa908 100644
--- a/src/game-server/thing.hpp
+++ b/src/game-server/thing.hpp
@@ -44,7 +44,7 @@ enum ThingType
};
/**
- * Base class for in-game objects. Knows only its type and the map is resides
+ * Base class for in-game objects. Knows only its type and the map it resides
* on. Provides listeners.
*/
class Thing
@@ -107,12 +107,12 @@ class Thing
/**
* Adds a new listener.
*/
- void addListener(EventListener const *);
+ void addListener(const EventListener *);
/**
* Removes an existing listener.
*/
- void removeListener(EventListener const *);
+ void removeListener(const EventListener *);
/**
* Calls all the "inserted" listeners.
@@ -125,7 +125,7 @@ class Thing
virtual void removed();
protected:
- typedef std::set< EventListener const * > Listeners;
+ typedef std::set< const EventListener * > Listeners;
Listeners mListeners; /**< List of event listeners. */
private:
diff --git a/src/game-server/trigger.hpp b/src/game-server/trigger.hpp
index c134263a..d99fb769 100644
--- a/src/game-server/trigger.hpp
+++ b/src/game-server/trigger.hpp
@@ -51,7 +51,7 @@ class WarpAction : public TriggerAction
class ScriptAction : public TriggerAction
{
public:
- ScriptAction(Script *script, std::string function, int arg)
+ ScriptAction(Script *script, const std::string &function, int arg)
: mScript(script), mFunction(function), mArg(arg) {}
virtual void process(Actor *obj);
@@ -68,7 +68,7 @@ class TriggerArea : public Thing
/**
* Creates a rectangular trigger for a given map.
*/
- TriggerArea(MapComposite *m, Rectangle const &r, TriggerAction *ptr, bool once)
+ TriggerArea(MapComposite *m, const Rectangle &r, TriggerAction *ptr, bool once)
: Thing(OBJECT_OTHER, m), mZone(r), mAction(ptr), mOnce(once) {}
virtual void update();