summaryrefslogtreecommitdiff
path: root/src/actorspritemanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/actorspritemanager.cpp')
-rw-r--r--src/actorspritemanager.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index cc18cfbee..4403738f9 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -183,7 +183,7 @@ class SortBeingFunctor
} beingSorter;
ActorSpriteManager::ActorSpriteManager() :
- mMap(0)
+ mMap(nullptr)
{
mSpellHeal1 = serverConfig.getValue("spellHeal1", "#lum");
mSpellHeal2 = serverConfig.getValue("spellHeal2", "#inma");
@@ -295,7 +295,7 @@ Being *ActorSpriteManager::findBeing(int id) const
}
}
- return NULL;
+ return nullptr;
}
Being *ActorSpriteManager::findBeing(int x, int y,
@@ -308,20 +308,20 @@ Being *ActorSpriteManager::findBeing(int x, int y,
ActorSpritesConstIterator it = find_if(mActors.begin(), mActors.end(),
beingFinder);
- return (it == mActors.end()) ? NULL : static_cast<Being*>(*it);
+ return (it == mActors.end()) ? nullptr : static_cast<Being*>(*it);
}
Being *ActorSpriteManager::findBeingByPixel(int x, int y,
bool allPlayers) const
{
if (!mMap)
- return NULL;
+ return nullptr;
bool targetDead = mTargetDeadPlayers;
if (mExtMouseTargeting)
{
- Being *tempBeing = 0;
+ Being *tempBeing = nullptr;
bool noBeing(false);
for_actors
@@ -376,7 +376,7 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y,
}
if (noBeing)
- return 0;
+ return nullptr;
return tempBeing;
}
else
@@ -402,7 +402,7 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y,
return being;
}
}
- return 0;
+ return nullptr;
}
}
@@ -448,7 +448,7 @@ void ActorSpriteManager::findBeingsByPixel(std::vector<Being*> &beings,
Being *ActorSpriteManager::findPortalByTile(int x, int y) const
{
if (!mMap)
- return NULL;
+ return nullptr;
for_actors
{
@@ -464,7 +464,7 @@ Being *ActorSpriteManager::findPortalByTile(int x, int y) const
return being;
}
- return NULL;
+ return nullptr;
}
FloorItem *ActorSpriteManager::findItem(int id) const
@@ -481,7 +481,7 @@ FloorItem *ActorSpriteManager::findItem(int id) const
}
}
- return NULL;
+ return nullptr;
}
FloorItem *ActorSpriteManager::findItem(int x, int y) const
@@ -498,7 +498,7 @@ FloorItem *ActorSpriteManager::findItem(int x, int y) const
}
}
- return NULL;
+ return nullptr;
}
bool ActorSpriteManager::pickUpAll(int x1, int y1, int x2, int y2,
@@ -526,7 +526,7 @@ bool ActorSpriteManager::pickUpAll(int x1, int y1, int x2, int y2,
}
else if (Client::checkPackets(PACKET_PICKUP))
{
- FloorItem *item = 0;
+ FloorItem *item = nullptr;
unsigned cnt = 65535;
for_actors
{
@@ -563,7 +563,7 @@ bool ActorSpriteManager::pickUpNearest(int x, int y, int maxdist)
return false;
maxdist = maxdist * maxdist;
- FloorItem *closestItem = NULL;
+ FloorItem *closestItem = nullptr;
int dist = 0;
for_actors
@@ -614,17 +614,17 @@ Being *ActorSpriteManager::findBeingByName(const std::string &name,
return being;
}
}
- return NULL;
+ return nullptr;
}
Being *ActorSpriteManager::findNearestByName(const std::string &name,
Being::Type type) const
{
if (!player_node)
- return 0;
+ return nullptr;
int dist = 0;
- Being* closestBeing = NULL;
+ Being* closestBeing = nullptr;
int x, y;
x = player_node->getTileX();
@@ -653,8 +653,8 @@ Being *ActorSpriteManager::findNearestByName(const std::string &name,
int d = (being->getTileX() - x) * (being->getTileX() - x)
+ (being->getTileY() - y) * (being->getTileY() - y);
- if (validateBeing(0, being, type, 0, 50)
- && (d < dist || closestBeing == NULL))
+ if (validateBeing(nullptr, being, type, nullptr, 50)
+ && (d < dist || closestBeing == nullptr))
{
dist = d;
closestBeing = being;
@@ -697,7 +697,7 @@ void ActorSpriteManager::logic()
if (player_node)
{
if (player_node->getTarget() == *it)
- player_node->setTarget(0);
+ player_node->setTarget(nullptr);
if (player_node->getPickUpTarget() == *it)
player_node->unSetPickUpTarget();
}
@@ -718,11 +718,11 @@ void ActorSpriteManager::logic()
void ActorSpriteManager::clear()
{
if (beingEquipmentWindow)
- beingEquipmentWindow->setBeing(0);
+ beingEquipmentWindow->setBeing(nullptr);
if (player_node)
{
- player_node->setTarget(0);
+ player_node->setTarget(nullptr);
player_node->unSetPickUpTarget();
mActors.erase(player_node);
}
@@ -745,7 +745,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(int x, int y,
{
const int maxDist = maxTileDist * 32;
- return findNearestLivingBeing(NULL, maxDist, type, x, y, excluded);
+ return findNearestLivingBeing(nullptr, maxDist, type, x, y, excluded);
}
Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
@@ -753,7 +753,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
Being::Type type) const
{
if (!aroundBeing)
- return 0;
+ return nullptr;
int x = aroundBeing->getTileX();
int y = aroundBeing->getTileY();
@@ -769,9 +769,9 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
Being *excluded) const
{
if (!aroundBeing || !player_node)
- return 0;
+ return nullptr;
- Being *closestBeing = 0;
+ Being *closestBeing = nullptr;
std::set<std::string> attackMobs;
std::set<std::string> priorityMobs;
std::set<std::string> ignoreAttackMobs;
@@ -852,7 +852,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
continue;
}
}
- if (validateBeing(aroundBeing, being, type, 0, maxDist))
+ if (validateBeing(aroundBeing, being, type, nullptr, maxDist))
{
if (being != excluded)
sortedBeings.push_back(being);
@@ -861,7 +861,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
// no selectable beings
if (sortedBeings.empty())
- return 0;
+ return nullptr;
beingSorter.x = x;
beingSorter.y = y;
@@ -874,24 +874,24 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
}
else
{
- beingSorter.attackBeings = 0;
- beingSorter.priorityBeings = 0;
+ beingSorter.attackBeings = nullptr;
+ beingSorter.priorityBeings = nullptr;
}
sort(sortedBeings.begin(), sortedBeings.end(), beingSorter);
if (filtered)
{
- beingSorter.attackBeings = 0;
- beingSorter.priorityBeings = 0;
+ beingSorter.attackBeings = nullptr;
+ beingSorter.priorityBeings = nullptr;
}
- if (player_node->getTarget() == NULL)
+ if (player_node->getTarget() == nullptr)
{
Being *target = sortedBeings.at(0);
if (specialDistance && target->getType() == Being::MONSTER
&& target->getDistance() <= 2)
{
- return 0;
+ return nullptr;
}
// if no selected being in vector, return first nearest being
return target;
@@ -970,7 +970,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
// logger->log("index:" + toString(index));
// logger->log("d:" + toString(d));
- if (valid && !filtered && (d <= dist || closestBeing == 0))
+ if (valid && !filtered && (d <= dist || !closestBeing))
{
dist = d;
closestBeing = being;
@@ -1014,7 +1014,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
}
}
}
- return (maxDist >= dist) ? closestBeing : 0;
+ return (maxDist >= dist) ? closestBeing : nullptr;
}
}