summaryrefslogtreecommitdiffstats
path: root/src/game-server
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-04-27 21:42:58 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-04-27 21:42:58 +0200
commitd4f3105d9a879f27baad6e43b8b3cb6fe2f0ef50 (patch)
tree474ec7369f0d367d7780f73901d38d1daec4d2eb /src/game-server
parent2c14cd30ecbacbd5a808cb2641d40f6d568ec294 (diff)
downloadmanaserv-d4f3105d9a879f27baad6e43b8b3cb6fe2f0ef50.tar.gz
manaserv-d4f3105d9a879f27baad6e43b8b3cb6fe2f0ef50.tar.xz
manaserv-d4f3105d9a879f27baad6e43b8b3cb6fe2f0ef50.zip
Use nullptr instead of NULL everywhere
Diffstat (limited to 'src/game-server')
-rw-r--r--src/game-server/character.cpp8
-rw-r--r--src/game-server/commandhandler.cpp6
-rw-r--r--src/game-server/gamehandler.cpp2
-rw-r--r--src/game-server/main-game.cpp4
-rw-r--r--src/game-server/mapcomposite.cpp6
-rw-r--r--src/game-server/mapmanager.cpp4
-rw-r--r--src/game-server/mapmanager.h2
-rw-r--r--src/game-server/mapreader.cpp2
-rw-r--r--src/game-server/monster.cpp2
-rw-r--r--src/game-server/state.cpp2
-rw-r--r--src/game-server/state.h2
11 files changed, 20 insertions, 20 deletions
diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp
index d0bcf46..52cc73f 100644
--- a/src/game-server/character.cpp
+++ b/src/game-server/character.cpp
@@ -72,9 +72,9 @@ static bool executeCallback(Script::Ref function, Entity &entity)
CharacterComponent::CharacterComponent(Entity &entity, MessageIn &msg):
- mClient(NULL),
+ mClient(nullptr),
mConnected(true),
- mTransactionHandler(NULL),
+ mTransactionHandler(nullptr),
mSpecialUpdateNeeded(false),
mDatabaseID(-1),
mHairStyle(0),
@@ -374,13 +374,13 @@ void CharacterComponent::cancelTransaction()
Trade *CharacterComponent::getTrading() const
{
return mTransaction == TRANS_TRADE
- ? static_cast< Trade * >(mTransactionHandler) : NULL;
+ ? static_cast< Trade * >(mTransactionHandler) : nullptr;
}
BuySell *CharacterComponent::getBuySell() const
{
return mTransaction == TRANS_BUYSELL
- ? static_cast< BuySell * >(mTransactionHandler) : NULL;
+ ? static_cast< BuySell * >(mTransactionHandler) : nullptr;
}
void CharacterComponent::setTrading(Trade *t)
diff --git a/src/game-server/commandhandler.cpp b/src/game-server/commandhandler.cpp
index 9c413ed..dcdd8c6 100644
--- a/src/game-server/commandhandler.cpp
+++ b/src/game-server/commandhandler.cpp
@@ -167,7 +167,7 @@ static CmdRef const cmdRef[] =
"<setname>_<specialname>", &handleRechargeSpecial},
{"listspecials", "<character>",
"Lists the specials of the character.", &handleListSpecials},
- {NULL, NULL, NULL, NULL}
+ {nullptr, nullptr, nullptr, nullptr}
};
@@ -284,7 +284,7 @@ static void handleHelp(Entity *player, std::string &args)
return;
}
// detailed description of single command
- for (size_t j = 0; cmdRef[j].cmd != NULL; j++)
+ for (size_t j = 0; cmdRef[j].cmd != nullptr; j++)
{
if (cmdRef[j].cmd == args)
{
@@ -1803,7 +1803,7 @@ void CommandHandler::handleCommand(Entity *player,
break;
case PermissionManager::PMR_ALLOWED:
// handle the command
- for (size_t i = 0; cmdRef[i].cmd != NULL; i++)
+ for (size_t i = 0; cmdRef[i].cmd != nullptr; i++)
{
if (cmdRef[i].cmd == type)
{
diff --git a/src/game-server/gamehandler.cpp b/src/game-server/gamehandler.cpp
index fa579c3..79a14c6 100644
--- a/src/game-server/gamehandler.cpp
+++ b/src/game-server/gamehandler.cpp
@@ -116,7 +116,7 @@ void GameHandler::completeServerChange(int id, const std::string &token,
c->character->getComponent<CharacterComponent>()->disconnected(
*c->character);
delete c->character;
- c->character = NULL;
+ c->character = nullptr;
c->status = CLIENT_LOGIN;
return;
}
diff --git a/src/game-server/main-game.cpp b/src/game-server/main-game.cpp
index 3a12cdb..8866a39 100644
--- a/src/game-server/main-game.cpp
+++ b/src/game-server/main-game.cpp
@@ -165,7 +165,7 @@ static void initializeServer()
utils::processor::init();
// Seed the random number generator
- std::srand( time(NULL) );
+ std::srand( time(nullptr) );
}
@@ -257,7 +257,7 @@ static void parseOptions(int argc, char *argv[], CommandLineOptions &options)
while (optind < argc)
{
- int result = getopt_long(argc, argv, optString, longOptions, NULL);
+ int result = getopt_long(argc, argv, optString, longOptions, nullptr);
if (result == -1)
break;
diff --git a/src/game-server/mapcomposite.cpp b/src/game-server/mapcomposite.cpp
index ec881cf..4a5d800 100644
--- a/src/game-server/mapcomposite.cpp
+++ b/src/game-server/mapcomposite.cpp
@@ -159,7 +159,7 @@ ZoneIterator::ZoneIterator(const MapRegion &r, const MapContent *m)
void ZoneIterator::operator++()
{
- current = NULL;
+ current = nullptr;
if (!region.empty())
{
if (++pos != region.size())
@@ -348,13 +348,13 @@ void ObjectBucket::deallocate(int i)
*****************************************************************************/
MapContent::MapContent(Map *map)
- : last_bucket(0), zones(NULL)
+ : last_bucket(0), zones(nullptr)
{
buckets[0] = new ObjectBucket;
buckets[0]->allocate(); // Skip ID 0
for (int i = 1; i < 256; ++i)
{
- buckets[i] = NULL;
+ buckets[i] = nullptr;
}
mapWidth = (map->getWidth() * map->getTileWidth() + zoneDiam - 1)
/ zoneDiam;
diff --git a/src/game-server/mapmanager.cpp b/src/game-server/mapmanager.cpp
index b3b2931..50f79cd 100644
--- a/src/game-server/mapmanager.cpp
+++ b/src/game-server/mapmanager.cpp
@@ -118,7 +118,7 @@ void MapManager::deinitialize()
MapComposite *MapManager::getMap(int mapId)
{
Maps::const_iterator i = maps.find(mapId);
- return (i != maps.end()) ? i->second : NULL;
+ return (i != maps.end()) ? i->second : nullptr;
}
MapComposite *MapManager::getMap(const std::string &mapName)
@@ -127,7 +127,7 @@ MapComposite *MapManager::getMap(const std::string &mapName)
if (i->second->getName() == mapName)
return i->second;
- return NULL;
+ return nullptr;
}
bool MapManager::activateMap(int mapId)
diff --git a/src/game-server/mapmanager.h b/src/game-server/mapmanager.h
index 6b51881..12cbc34 100644
--- a/src/game-server/mapmanager.h
+++ b/src/game-server/mapmanager.h
@@ -45,7 +45,7 @@ namespace MapManager
/**
* Returns the requested map.
*
- * @return the requested map, or NULL if no map with the given ID exists.
+ * @return the requested map, or nullptr if no map with the given ID exists.
*/
MapComposite *getMap(int mapId);
diff --git a/src/game-server/mapreader.cpp b/src/game-server/mapreader.cpp
index af40e56..acac685 100644
--- a/src/game-server/mapreader.cpp
+++ b/src/game-server/mapreader.cpp
@@ -56,7 +56,7 @@ Map *MapReader::readMap(xmlNodePtr node)
int tileH = XML::getProperty(node, "tileheight", DEFAULT_TILE_LENGTH);
Map *map = new Map(w, h, tileW, tileH);
- for (node = node->xmlChildrenNode; node != NULL; node = node->next)
+ for (node = node->xmlChildrenNode; node != nullptr; node = node->next)
{
if (xmlStrEqual(node->name, BAD_CAST "tileset"))
{
diff --git a/src/game-server/monster.cpp b/src/game-server/monster.cpp
index be0e161..5d77db4 100644
--- a/src/game-server/monster.cpp
+++ b/src/game-server/monster.cpp
@@ -125,7 +125,7 @@ MonsterComponent::~MonsterComponent()
void MonsterComponent::update(Entity &entity)
{
if (mKillStealProtectedTimeout.justFinished())
- mOwner = NULL;
+ mOwner = nullptr;
auto *beingComponent = entity.getComponent<BeingComponent>();
diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp
index 58d848d..db224b8 100644
--- a/src/game-server/state.cpp
+++ b/src/game-server/state.cpp
@@ -845,7 +845,7 @@ void GameState::sayTo(Entity *destination, Entity *source, const std::string &te
return; //only characters will read it anyway
MessageOut msg(GPMSG_SAY);
- if (source == NULL)
+ if (source == nullptr)
{
msg.writeInt16(0);
}
diff --git a/src/game-server/state.h b/src/game-server/state.h
index 147a57c..256512c 100644
--- a/src/game-server/state.h
+++ b/src/game-server/state.h
@@ -92,7 +92,7 @@ namespace GameState
/**
* Says something to an actor.
- * @note passing NULL as source generates a message from "Server:"
+ * @note passing nullptr as source generates a message from "Server:"
*/
void sayTo(Entity *destination, Entity *source, const std::string &text);