newer standards prefer nullptr over NULL - this is most of them but there are others too

This commit is contained in:
DarthArgus
2016-02-11 15:16:14 -06:00
parent a7f2d0ea6a
commit 3e4cc36e7e
937 changed files with 14983 additions and 14983 deletions
@@ -106,7 +106,7 @@ bool AggroListPropertyNamespace::isIncapacitated(TangibleObject const & target)
{
CreatureObject const * const targetCreatureObject = target.asCreatureObject();
return (targetCreatureObject != NULL) ? targetCreatureObject->isIncapacitated() : false;
return (targetCreatureObject != nullptr) ? targetCreatureObject->isIncapacitated() : false;
}
// ----------------------------------------------------------------------
@@ -114,7 +114,7 @@ bool AggroListPropertyNamespace::isDead(TangibleObject const & target)
{
CreatureObject const * const targetCreatureObject = target.asCreatureObject();
return (targetCreatureObject != NULL) ? targetCreatureObject->isDead() : false;
return (targetCreatureObject != nullptr) ? targetCreatureObject->isDead() : false;
}
// ----------------------------------------------------------------------
@@ -122,7 +122,7 @@ bool AggroListPropertyNamespace::isInvulnerable(TangibleObject const & target)
{
CreatureObject const * const targetCreatureObject = target.asCreatureObject();
return (targetCreatureObject != NULL) ? targetCreatureObject->isInvulnerable() : false;
return (targetCreatureObject != nullptr) ? targetCreatureObject->isInvulnerable() : false;
}
// ----------------------------------------------------------------------
@@ -138,7 +138,7 @@ bool AggroListPropertyNamespace::isFeigningDeath(TangibleObject const & target)
{
CreatureObject const * const targetCreatureObject = target.asCreatureObject();
return (targetCreatureObject != NULL) ? targetCreatureObject->getState(States::FeignDeath) : false;
return (targetCreatureObject != nullptr) ? targetCreatureObject->getState(States::FeignDeath) : false;
}
// ----------------------------------------------------------------------
@@ -146,7 +146,7 @@ bool AggroListPropertyNamespace::isInPlayerBuilding(TangibleObject const & targe
{
ServerObject const * const topMostServerObject = ServerObject::asServerObject(ContainerInterface::getTopmostContainer(target));
return (topMostServerObject != NULL) ? (topMostServerObject->getGameObjectType() == SharedObjectTemplate::GOT_building_player) : false;
return (topMostServerObject != nullptr) ? (topMostServerObject->getGameObjectType() == SharedObjectTemplate::GOT_building_player) : false;
}
// ----------------------------------------------------------------------
@@ -154,7 +154,7 @@ bool AggroListPropertyNamespace::isAggroImmune(TangibleObject const & target)
{
PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(target.asCreatureObject());
return (playerObject != NULL) ? playerObject->isAggroImmune() : false;
return (playerObject != nullptr) ? playerObject->isAggroImmune() : false;
}
// ======================================================================
@@ -212,7 +212,7 @@ void AggroListProperty::alter()
// First, list things that invalidate this target in the aggro list
// Second, list the things that promote the target to the hate list
if (target.getObject() == NULL)
if (target.getObject() == nullptr)
{
purgeList.push_back(iterTargetList);
}
@@ -315,7 +315,7 @@ TangibleObject & AggroListProperty::getTangibleOwner()
AggroListProperty * AggroListProperty::getAggroListProperty(Object & object)
{
Property * const property = object.getProperty(getClassPropertyId());
AggroListProperty * const aggroProperty = (property != NULL) ? static_cast<AggroListProperty *>(property) : NULL;
AggroListProperty * const aggroProperty = (property != nullptr) ? static_cast<AggroListProperty *>(property) : nullptr;
return aggroProperty;
}
@@ -45,7 +45,7 @@ void AiCombatPulseQueue::remove()
void AiCombatPulseQueue::schedule(TangibleObject * const object, int waitTimeMs, unsigned long currentFrameTimeMs)
{
if (object == NULL)
if (object == nullptr)
return;
unsigned long desiredTime = Clock::getFrameStartTimeMs() + currentFrameTimeMs + waitTimeMs;
@@ -97,7 +97,7 @@ void AiCombatPulseQueue::alter(real time)
TangibleObject * const object = (j->second)->first;
if (object != NULL && object->isInCombat())
if (object != nullptr && object->isInCombat())
{
NetworkId const & id = object->getNetworkId();
@@ -107,7 +107,7 @@ void AiCombatPulseQueue::alter(real time)
GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(object);
if (gameScriptObject != NULL)
if (gameScriptObject != nullptr)
{
ScriptParams scriptParams;
IGNORE_RETURN(gameScriptObject->trigAllScripts(Scripting::TRIG_AI_COMBAT_FRAME, scriptParams));
@@ -136,9 +136,9 @@ void AiCreatureCombatProfileNamespace::loadCombatProfileTable(DataTable const &
for (int i = 0; i < serverObjectCount; ++i)
{
ServerObject * const serverObject = ServerWorld::getObject(i);
CreatureObject * const creatureObject = (serverObject != NULL) ? serverObject->asCreatureObject() : NULL;
CreatureObject * const creatureObject = (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr;
if ( (creatureObject != NULL)
if ( (creatureObject != nullptr)
&& !creatureObject->isPlayerControlled())
{
creatureObject->makeDead(NetworkId::cms_invalid, NetworkId::cms_invalid);
@@ -228,7 +228,7 @@ void AiCreatureCombatProfileNamespace::grantActions(CreatureObject & owner, AiCr
// ----------------------------------------------------------------------
AiCreatureCombatProfile::AiCreatureCombatProfile()
: m_profileId(NULL)
: m_profileId(nullptr)
, m_singleUseActionList()
, m_delayRepeatActionList()
, m_instantRepeatActionList()
@@ -247,7 +247,7 @@ void AiCreatureCombatProfile::install()
bool const openIfNotFound = true;
DataTable * const dataTable = DataTableManager::getTable(s_combatProfileTable, openIfNotFound);
if (dataTable != NULL)
if (dataTable != nullptr)
{
#ifdef _DEBUG
DataTableManager::addReloadCallback(s_combatProfileTable, &loadCombatProfileTable);
@@ -267,7 +267,7 @@ void AiCreatureCombatProfile::install()
// ----------------------------------------------------------------------
AiCreatureCombatProfile const * AiCreatureCombatProfile::getCombatProfile(CrcString const & profileName)
{
AiCreatureCombatProfile const * result = NULL;
AiCreatureCombatProfile const * result = nullptr;
CombatProfileMap::const_iterator iterCombatProfileMap = s_combatProfileMap.find(PersistentCrcString(profileName));
if (iterCombatProfileMap != s_combatProfileMap.end())
@@ -46,7 +46,7 @@ namespace AiCreatureDataNamespace
CreatureDataMap s_creatureDataMap;
WeaponDataMap s_weaponDataMap;
AiCreatureData const * s_defaultCreatureData = NULL;
AiCreatureData const * s_defaultCreatureData = nullptr;
int s_creatureErrorCount = 0;
int s_weaponErrorCount = 0;
@@ -154,7 +154,7 @@ void AiCreatureDataNamespace::verifySecondaryWeapon(CrcString const & creatureNa
void AiCreatureDataNamespace::verifyPrimarySpecials(CrcString const & creatureName, CrcString & primarySpecials)
{
if ( !primarySpecials.isEmpty()
&& (AiCreatureCombatProfile::getCombatProfile(primarySpecials) == NULL))
&& (AiCreatureCombatProfile::getCombatProfile(primarySpecials) == nullptr))
{
++s_creatureErrorCount;
WARNING(true, ("AiCreatureData::verifyPrimarySpecials() Creature(%s) has invalid primary_weapon_specials(%s)", creatureName.getString(), primarySpecials.getString()));
@@ -165,7 +165,7 @@ void AiCreatureDataNamespace::verifyPrimarySpecials(CrcString const & creatureNa
void AiCreatureDataNamespace::verifySecondarySpecials(CrcString const & creatureName, CrcString & secondarySpecials)
{
if ( !secondarySpecials.isEmpty()
&& (AiCreatureCombatProfile::getCombatProfile(secondarySpecials) == NULL))
&& (AiCreatureCombatProfile::getCombatProfile(secondarySpecials) == nullptr))
{
++s_creatureErrorCount;
WARNING(true, ("AiCreatureData::verifySecondarySpecials() Creature(%s) has invalid secondary_weapon_specials(%s)", creatureName.getString(), secondarySpecials.getString()));
@@ -320,7 +320,7 @@ void AiCreatureDataNamespace::loadWeaponColumn(WeaponList & weaponList, std::str
// ----------------------------------------------------------------------
AiCreatureData::AiCreatureData()
: m_name(NULL)
: m_name(nullptr)
, m_movementSpeedPercent(1.0f)
, m_primaryWeapon()
, m_secondaryWeapon()
@@ -348,7 +348,7 @@ void AiCreatureData::install()
bool const openIfNotFound = true;
DataTable * const dataTable = DataTableManager::getTable(s_weaponDataTable, openIfNotFound);
if (dataTable != NULL)
if (dataTable != nullptr)
{
DataTableManager::addReloadCallback(s_weaponDataTable, &loadWeaponData);
loadWeaponData(*dataTable);
@@ -366,7 +366,7 @@ void AiCreatureData::install()
bool const openIfNotFound = true;
DataTable * const dataTable = DataTableManager::getTable(s_creaureDataTable, openIfNotFound);
if (dataTable != NULL)
if (dataTable != nullptr)
{
DataTableManager::addReloadCallback(s_creaureDataTable, &loadCreatureData);
loadCreatureData(*dataTable);
@@ -58,7 +58,7 @@ AiCreatureWeaponActions::AiCreatureWeaponActions()
: m_singleUseActionList()
, m_delayRepeatActionList()
, m_instantRepeatActionList()
, m_combatProfile(NULL)
, m_combatProfile(nullptr)
{
}
@@ -81,7 +81,7 @@ void AiCreatureWeaponActions::setCombatProfile(CreatureObject & owner, AiCreatur
// ----------------------------------------------------------------------
void AiCreatureWeaponActions::reset()
{
if (m_combatProfile != NULL)
if (m_combatProfile != nullptr)
{
resetActionTimers(m_singleUseActionList, m_combatProfile->m_singleUseActionList);
resetActionTimers(m_delayRepeatActionList, m_combatProfile->m_delayRepeatActionList);
@@ -92,9 +92,9 @@ void AiCreatureWeaponActions::reset()
// ----------------------------------------------------------------------
PersistentCrcString const & AiCreatureWeaponActions::getCombatAction()
{
// If the combat profile is NULL, then the AI has no special actions assigned
// If the combat profile is nullptr, then the AI has no special actions assigned
if (m_combatProfile != NULL)
if (m_combatProfile != nullptr)
{
time_t const osTime = Os::getRealSystemTime();
@@ -34,12 +34,12 @@ namespace Archive
get(source, target.m_objectId);
get(source, movementType);
AICreatureController * controller = NULL;
AICreatureController * controller = nullptr;
Object * object = NetworkIdManager::getObjectById(target.getObjectId());
if (object != NULL)
if (object != nullptr)
controller = dynamic_cast<AICreatureController *>(object->getController());
if (controller == NULL)
if (controller == nullptr)
{
WARNING(true, ("AiMovementMessage Archive::get, got message to object %s that doesn't have an AICreatureController", target.getObjectId().getValueString().c_str()));
target.m_movement = AiMovementBaseNullPtr;
@@ -30,9 +30,9 @@
AiMovementBase::AiMovementBase( AICreatureController * controller )
: m_controller( controller ),
m_stateFunction( NULL ),
m_stateFunction( nullptr ),
m_stateName(),
m_pendingFunction( NULL ),
m_pendingFunction( nullptr ),
m_pendingName()
{
}
@@ -41,9 +41,9 @@ AiMovementBase::AiMovementBase( AICreatureController * controller )
AiMovementBase::AiMovementBase( AICreatureController * controller, Archive::ReadIterator & source )
: m_controller( controller ),
m_stateFunction( NULL ),
m_stateFunction( nullptr ),
m_stateName(),
m_pendingFunction( NULL ),
m_pendingFunction( nullptr ),
m_pendingName()
{
// !!!
@@ -177,7 +177,7 @@ void AiMovementBase::applyStateChange ( void )
m_stateFunction = m_pendingFunction;
m_stateName = m_pendingName;
m_pendingFunction = NULL;
m_pendingFunction = nullptr;
m_pendingName.clear();
}
}
@@ -249,49 +249,49 @@ char const * AiMovementBase::getMovementString(AiMovementType const aiMovementTy
// ----------------------------------------------------------------------
AiMovementSwarm * AiMovementBase::asAiMovementSwarm()
{
return NULL;
return nullptr;
}
// ----------------------------------------------------------------------
AiMovementFace * AiMovementBase::asAiMovementFace()
{
return NULL;
return nullptr;
}
// ----------------------------------------------------------------------
AiMovementFlee * AiMovementBase::asAiMovementFlee()
{
return NULL;
return nullptr;
}
// ----------------------------------------------------------------------
AiMovementFollow * AiMovementBase::asAiMovementFollow()
{
return NULL;
return nullptr;
}
// ----------------------------------------------------------------------
AiMovementLoiter * AiMovementBase::asAiMovementLoiter()
{
return NULL;
return nullptr;
}
// ----------------------------------------------------------------------
AiMovementMove * AiMovementBase::asAiMovementMove()
{
return NULL;
return nullptr;
}
// ----------------------------------------------------------------------
AiMovementPatrol * AiMovementBase::asAiMovementPatrol()
{
return NULL;
return nullptr;
}
// ----------------------------------------------------------------------
AiMovementWander * AiMovementBase::asAiMovementWander()
{
return NULL;
return nullptr;
}
// ======================================================================
@@ -67,9 +67,9 @@ Vector AiMovementLoiterNamespace::getRandomLoiterPosition_p(Vector const anchorP
bool AiMovementLoiterNamespace::isPositionOnFloor(Floor const * const floor, Vector const & position_p, float const radius, Vector & floorPosition_p)
{
bool result = false;
FloorMesh const * const floorMesh = (floor != NULL) ? floor->getFloorMesh() : NULL;
FloorMesh const * const floorMesh = (floor != nullptr) ? floor->getFloorMesh() : nullptr;
if (floorMesh != NULL)
if (floorMesh != nullptr)
{
// See if the circle fits entirely on the floor
{
@@ -199,7 +199,7 @@ AiMovementLoiter::AiMovementLoiter( AICreatureController * controller, Archive::
AiMovementLoiter::~AiMovementLoiter()
{
delete m_cachedAiLocations;
m_cachedAiLocations = NULL;
m_cachedAiLocations = nullptr;
}
// ----------------------------------------------------------------------
@@ -420,7 +420,7 @@ bool AiMovementLoiter::generateWaypoint()
Floor const * const ownerFloor = CollisionWorld::getFloorStandingOn(*creatureOwner);
if (ownerFloor != NULL)
if (ownerFloor != nullptr)
{
// The owner is standing on a floor
@@ -476,7 +476,7 @@ bool AiMovementLoiter::generateWaypoint()
TerrainObject const * const terrainObject = TerrainObject::getConstInstance();
if ( (terrainObject != NULL)
if ( (terrainObject != nullptr)
&& terrainObject->isPassable(randomPosition_p))
{
// Snap the random position to the terrain
@@ -518,7 +518,7 @@ bool AiMovementLoiter::generateWaypoint()
{
BaseExtent const * const extent = collisionProperty->getExtent_l();
if (extent != NULL)
if (extent != nullptr)
{
Vector const begin_o(object.rotateTranslate_w2o(m_anchor.getPosition_p()));
Vector const end_o(object.rotateTranslate_w2o(randomPosition_p));
@@ -580,7 +580,7 @@ void AiMovementLoiter::addDebug(AiDebugString & aiDebugString)
AiMovementWaypoint::addDebug(aiDebugString);
FormattedString<512> fs;
aiDebugString.addText(fs.sprintf("LOITER %s\n%s\ndist[%.0f...%.0f]\ndelay[%.1f...%.1f]\n", (m_anchor.getObject() != NULL) ? "TARGET" : "POSITION", m_stateName.c_str(), m_minDistance, m_maxDistance, m_minDelay, m_maxDelay), PackedRgb::solidCyan);
aiDebugString.addText(fs.sprintf("LOITER %s\n%s\ndist[%.0f...%.0f]\ndelay[%.1f...%.1f]\n", (m_anchor.getObject() != nullptr) ? "TARGET" : "POSITION", m_stateName.c_str(), m_minDistance, m_maxDistance, m_minDelay, m_maxDelay), PackedRgb::solidCyan);
//if (m_bubbleCheckResult == BCR_invalid)
//{
@@ -599,7 +599,7 @@ void AiMovementLoiter::addDebug(AiDebugString & aiDebugString)
{
Object const * const anchorObject = m_anchor.getObject();
if (anchorObject != NULL)
if (anchorObject != nullptr)
{
// We are anchored to a moving target
@@ -659,7 +659,7 @@ bool AiMovementLoiter::isAnchorValid() const
{
TangibleObject const * const tangibleObject = TangibleObject::asTangibleObject(m_anchor.getObject());
if (tangibleObject != NULL)
if (tangibleObject != nullptr)
{
if (tangibleObject->isInCombat())
{
@@ -85,7 +85,7 @@ AiMovementMove::AiMovementMove( AICreatureController * controller, Archive::Read
AiMovementMove::~AiMovementMove()
{
delete m_pathBuilder;
m_pathBuilder = NULL;
m_pathBuilder = nullptr;
}
// ----------------------------------------------------------------------
@@ -151,7 +151,7 @@ void AiMovementMove::refresh( void )
m_target = target;
m_targetName = targetName;
if (m_controller != NULL)
if (m_controller != nullptr)
m_start = AiLocation(m_controller->getCreatureCell(), m_controller->getCreaturePosition_p());
CHANGE_STATE( AiMovementMove::stateWaiting );
}
@@ -73,7 +73,7 @@ AiMovementPathFollow::AiMovementPathFollow( AICreatureController * controller, A
: AiMovementWaypoint( controller, source ),
m_path( new AiPath() )
{
if (m_path != NULL)
if (m_path != nullptr)
Archive::get(source, *m_path);
}
@@ -84,7 +84,7 @@ AiMovementPathFollow::~AiMovementPathFollow()
clearPath();
delete m_path;
m_path = NULL;
m_path = nullptr;
}
// ----------------------------------------------------------------------
@@ -92,7 +92,7 @@ AiMovementPathFollow::~AiMovementPathFollow()
void AiMovementPathFollow::pack( Archive::ByteStream & target ) const
{
AiMovementWaypoint::pack(target);
if (m_path != NULL)
if (m_path != nullptr)
Archive::put(target, *m_path);
else
Archive::put(target, static_cast<int>(0));
@@ -288,7 +288,7 @@ AiPath const * AiMovementPathFollow::getPath ( void ) const
void AiMovementPathFollow::swapPath ( AiPath * newPath )
{
if(newPath == NULL) return;
if(newPath == nullptr) return;
AiPath::iterator it;
@@ -60,7 +60,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect
m_patrolPointIndex(startPoint)
{
ServerObject * owner = safe_cast<ServerObject *>(controller->getOwner());
if (owner != NULL)
if (owner != nullptr)
{
DEBUG_REPORT_LOG(ConfigServerGame::isAiLoggingEnabled(), ("AiMovementPatrol creating named path for %s\n", owner->getNetworkId().getValueString().c_str()));
@@ -98,7 +98,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect
{
const Unicode::String & pointName = *i;
const CityPathNode * node = CityPathGraphManager::getNamedNodeFor(*owner, pointName);
if (node != NULL)
if (node != nullptr)
{
m_patrolPath.push_back(AiLocation(node->getSourceId()));
}
@@ -118,16 +118,16 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect
// try an find a node on the path that is a previous root node, or isn't
// being used in any other path
std::vector<AiLocation>::iterator i;
const ServerObject * node = NULL;
const ServerObject * root = NULL;
const ServerObject * node = nullptr;
const ServerObject * root = nullptr;
for (i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i)
{
node = safe_cast<const ServerObject *>(i->getObject());
if (node != NULL)
if (node != nullptr)
{
if (node->isPatrolPathRoot())
{
if (root == NULL || !root->isPatrolPathRoot())
if (root == nullptr || !root->isPatrolPathRoot())
{
// if we already have a set up root node, use that
root = node;
@@ -135,18 +135,18 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect
else
{
// we've got two previous root nodes, we can't connect them
root = NULL;
root = nullptr;
break;
}
}
else if (!node->isPatrolPathNode() && root == NULL)
else if (!node->isPatrolPathNode() && root == nullptr)
{
// found a free node
root = node;
}
}
}
if (root != NULL)
if (root != nullptr)
{
// set up the root node
if (!root->isPatrolPathRoot())
@@ -156,7 +156,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect
for (i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i)
{
node = safe_cast<const ServerObject *>(i->getObject());
if (node != NULL && node != root)
if (node != nullptr && node != root)
const_cast<ServerObject *>(node)->setPatrolPathRoot(*root);
}
const_cast<ServerObject *>(root)->addPatrolPathingObject(*owner);
@@ -167,7 +167,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect
for (i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i)
{
node = safe_cast<const ServerObject *>(i->getObject());
if (node != NULL)
if (node != nullptr)
nodes += node->getNetworkId().getValueString() + " ";
}
WARNING(true, ("AiMovementPatrol unable to find root node for path: %s", nodes.c_str()));
@@ -266,15 +266,15 @@ void AiMovementPatrol::getDebugInfo ( std::string & outString ) const
void AiMovementPatrol::endBehavior()
{
if (!m_patrolPath.empty() && m_controller != NULL)
if (!m_patrolPath.empty() && m_controller != nullptr)
{
const ServerObject * owner = safe_cast<const ServerObject *>(m_controller->getOwner());
if (owner != NULL)
if (owner != nullptr)
{
for (std::vector<AiLocation>::iterator i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i)
{
const ServerObject * node = safe_cast<const ServerObject *>(i->getObject());
if (node != NULL && node->isPatrolPathRoot())
if (node != nullptr && node->isPatrolPathRoot())
{
const_cast<ServerObject *>(node)->removePatrolPathingObject(*owner);
break;
@@ -304,7 +304,7 @@ bool AiMovementPatrol::getHibernateOk() const
if (!m_patrolPath.empty())
{
const ServerObject * node = safe_cast<const ServerObject *>(m_patrolPath.front().getObject());
if (node != NULL)
if (node != nullptr)
{
return node->getPatrolPathObservers() == 0;
}
@@ -104,10 +104,10 @@ void AiMovementSwarm::alter ( float time )
}
// update the offset from our target we want to go to
if (m_target.getObject() != NULL)
if (m_target.getObject() != nullptr)
{
const CreatureObject * owner = m_controller->getCreature();
if (owner != NULL)
if (owner != nullptr)
{
offsetMap::const_iterator found = s_offsetMap.find(CachedNetworkId(*owner));
if (found != s_offsetMap.end())
@@ -179,7 +179,7 @@ AiStateResult AiMovementSwarm::triggerWaiting()
{
// note: don't use the m_target position function, because it includes the offset position
const Object * target = m_target.getObject();
if (target != NULL)
if (target != nullptr)
m_controller->turnToward(target->getParentCell(), target->getPosition_p());
return AiMovementFollow::triggerWaiting();
}
@@ -196,7 +196,7 @@ void AiMovementSwarm::init()
const CreatureObject * creatureOwner = m_controller->getCreature();
const CreatureObject * creatureTarget = CreatureObject::asCreatureObject(m_target.getObject());
if (creatureOwner != NULL && creatureTarget != NULL)
if (creatureOwner != nullptr && creatureTarget != nullptr)
{
CreatureWatcher watchedCreature(creatureOwner);
targetMap::iterator found = s_swarmMap.find(CachedNetworkId(*creatureTarget));
@@ -226,7 +226,7 @@ void AiMovementSwarm::cleanup()
// note: using static_cast instead of safe_cast because the owner may be in the process of being destructed
const CreatureObject * owner = static_cast<const CreatureObject *>(m_controller->getOwner());
const CreatureObject * target = static_cast<const CreatureObject *>(m_target.getObject());
if (owner != NULL && target != NULL)
if (owner != nullptr && target != nullptr)
{
targetMap::iterator found = s_swarmMap.find(CachedNetworkId(*target));
if (found != s_swarmMap.end())
@@ -258,7 +258,7 @@ void AiMovementSwarm::computeGoals()
for (targetMap::iterator i = s_swarmMap.begin(); i != s_swarmMap.end();)
{
const CreatureObject * target = CreatureObject::asCreatureObject((*i).first.getObject());
if (target != NULL && !target->isDead())
if (target != nullptr && !target->isDead())
{
computeGoals(*target, (*i).second);
if ((*i).second.empty())
@@ -294,16 +294,16 @@ void AiMovementSwarm::computeGoals(const CreatureObject & target, std::vector<Cr
{
// determine movement to target
const CreatureObject * mover = movers[i];
const AICreatureController * controller = NULL;
const AiMovementSwarm * swarmMovement = NULL;
if (mover != NULL)
const AICreatureController * controller = nullptr;
const AiMovementSwarm * swarmMovement = nullptr;
if (mover != nullptr)
{
controller = AICreatureController::asAiCreatureController(mover->getController());
if (controller != NULL)
if (controller != nullptr)
swarmMovement = dynamic_cast<const AiMovementSwarm *>(controller->getCurrentMovement());
}
if (mover == NULL || mover->isDead())
if (mover == nullptr || mover->isDead())
{
// dump the mover from our list
--count;
@@ -314,7 +314,7 @@ void AiMovementSwarm::computeGoals(const CreatureObject & target, std::vector<Cr
--i;
continue;
}
if (swarmMovement == NULL)
if (swarmMovement == nullptr)
{
// there are legitimate cases where a creature is in a swarm list but doesn't
// have its movement as AiMovementSwarm, such as when the movement is
@@ -337,7 +337,7 @@ void AiMovementSwarm::computeGoals(const CreatureObject & target, std::vector<Cr
for (int j = i + 1; j < count; ++j)
{
const CreatureObject * blocker = movers[j];
if (blocker == NULL || blocker->isDead())
if (blocker == nullptr || blocker->isDead())
{
continue;
}
@@ -361,7 +361,7 @@ void AiMovementSwarm::computeGoals(const CreatureObject & target, std::vector<Cr
// update the desired destinations of all the movers for when they are altered
for (i = 0; i < count; ++i)
{
if (movers[i] != NULL)
if (movers[i] != nullptr)
s_offsetMap[CachedNetworkId(*movers[i])] = movement[i];
}
}
@@ -69,7 +69,7 @@ bool AiMovementTarget::getHibernateOk( void ) const
{
static const int MAX_RECURSION = 50;
static int recursionCount = 0;
static const AiMovementTarget * preventRecurse = NULL;
static const AiMovementTarget * preventRecurse = nullptr;
// prevent recursing too many times
if (++recursionCount == MAX_RECURSION)
@@ -90,20 +90,20 @@ static const AiMovementTarget * preventRecurse = NULL;
--recursionCount;
return true;
}
if (preventRecurse == NULL)
if (preventRecurse == nullptr)
preventRecurse = this;
bool hibernate = true;
if (m_target.isValid() && m_target.getObjectId() != NetworkId::cms_invalid)
{
const Object * o = m_target.getObject();
if (o != NULL && o->asServerObject() != NULL)
if (o != nullptr && o->asServerObject() != nullptr)
{
// if the target is a player, don't hibernate
if (o->asServerObject()->isPlayerControlled())
hibernate = false;
// hibernate if who we're following is hibernating
else if (o->asServerObject()->asCreatureObject() != NULL)
else if (o->asServerObject()->asCreatureObject() != nullptr)
hibernate = (safe_cast<const CreatureController *>(o->getController()))->getHibernate();
}
else
@@ -114,7 +114,7 @@ static const AiMovementTarget * preventRecurse = NULL;
// clean up recusion checkers
if (preventRecurse == this)
preventRecurse = NULL;
preventRecurse = nullptr;
--recursionCount;
return hibernate;
}
@@ -82,23 +82,23 @@ bool AiMovementWanderInterior::updateWaypoint ( void )
{
CreatureObject const * creature = m_controller->getCreature();
if(creature == NULL) return false;
if(creature == nullptr) return false;
CellProperty const * cell = creature->getParentCell();
if(cell == NULL) return false;
if(cell == nullptr) return false;
Floor const * floor = cell->getFloor();
if(floor == NULL) return false;
if(floor == nullptr) return false;
FloorMesh const * floorMesh = floor->getFloorMesh();
if(floorMesh == NULL) return false;
if(floorMesh == nullptr) return false;
PathGraph const * graph = safe_cast<PathGraph const *>(floorMesh->getPathGraph());
if(graph == NULL) return false;
if(graph == nullptr) return false;
// ----------
@@ -107,11 +107,11 @@ bool AiMovementWanderInterior::updateWaypoint ( void )
if(closestIndex == -2)
{
const CellObject *cellObject = dynamic_cast<const CellObject*>(&cell->getOwner());
const BuildingObject *building = (cellObject ? cellObject->getOwnerBuilding() : NULL);
const BuildingObject *building = (cellObject ? cellObject->getOwnerBuilding() : nullptr);
Vector creaturePosition = creature->getPosition_w();
LOG("building-data-error",("Building id=%s has no path data but creature id=%s at (x=%.2f,y=%.2f,z=%.2f) requires it for wandering, stopping behavior.",
(building ? building->getNetworkId().getValueString().c_str() : "<NULL building>"),
(building ? building->getNetworkId().getValueString().c_str() : "<nullptr building>"),
creature->getNetworkId().getValueString().c_str(),
creaturePosition.x,
creaturePosition.y,
@@ -132,7 +132,7 @@ bool AiMovementWanderInterior::updateWaypoint ( void )
{
PathNode const * closestNode = graph->getNode(closestIndex);
if(closestNode != NULL)
if(closestNode != nullptr)
{
m_target = AiLocation(m_controller->getCreatureCell(),closestNode->getPosition_p());
@@ -34,7 +34,7 @@ float computeMovementModifier (CreatureObject * const object)
{
if (!object)
{
DEBUG_FATAL(true, ("object is NULL."));
DEBUG_FATAL(true, ("object is nullptr."));
return 0.0f;
}
@@ -81,7 +81,7 @@ float computeMovementModifier (CreatureObject * const object)
// if the creature has a slope effect property, see if it has a greater
// (more negative) effect on the creature than the terrain
const Property * property = object->getProperty(SlopeEffectProperty::getClassPropertyId());
if (property != NULL)
if (property != nullptr)
{
// note we use the creature's base speed modifier, not the one modified by skills
// (although for ai they're probably the same)
@@ -94,7 +94,7 @@ bool AiTargetingSystem::canAttackTarget(TangibleObject const * target)
{
bool result = false;
if (target != NULL)
if (target != nullptr)
{
if ( (m_owner.getDistanceBetweenCollisionSpheres_w(*target) <= ConfigServerGame::getMaxCombatRange())
&& m_owner.checkLOSTo(*target))
@@ -128,8 +128,8 @@ void Formation::build(Squad & squad)
DEBUG_FATAL(squad.isEmpty(), ("Building a formation on an empty squad."));
Object const * const leaderObject = squad.getLeader().getObject();
CollisionProperty const * const leaderCollisionProperty = (leaderObject != NULL) ? leaderObject->getCollisionProperty() : NULL;
float const leaderRadius = (leaderCollisionProperty != NULL) ? (leaderCollisionProperty->getBoundingSphere_l().getRadius() * 2.0f) : 1.0f;
CollisionProperty const * const leaderCollisionProperty = (leaderObject != nullptr) ? leaderObject->getCollisionProperty() : nullptr;
float const leaderRadius = (leaderCollisionProperty != nullptr) ? (leaderCollisionProperty->getBoundingSphere_l().getRadius() * 2.0f) : 1.0f;
int slotIndex = 0;
Squad::UnitMap const & unitSet = squad.getUnitMap();
@@ -41,8 +41,8 @@
// ----------------------------------------------------------------------
HateList::HateList()
: m_owner(NULL)
, m_playerObject(NULL)
: m_owner(nullptr)
, m_playerObject(nullptr)
, m_hateList()
, m_target(CachedNetworkId::cms_cachedInvalid)
, m_maxHate(0.0f)
@@ -56,8 +56,8 @@ HateList::HateList()
HateList::~HateList()
{
clear();
m_owner = NULL;
m_playerObject = NULL;
m_owner = nullptr;
m_playerObject = nullptr;
}
// ----------------------------------------------------------------------
@@ -119,7 +119,7 @@ bool HateList::addHate(NetworkId const & target, float const hate)
// If a target AI has a master, the target and the master needs to be added to the hate list (ie. pets should cause their master to gain hate)
{
CreatureObject const * const targetCreatureObject = CreatureObject::asCreatureObject(targetObject);
NetworkId const & masterId = (targetCreatureObject != NULL) ? targetCreatureObject->getMasterId() : NetworkId::cms_invalid;
NetworkId const & masterId = (targetCreatureObject != nullptr) ? targetCreatureObject->getMasterId() : NetworkId::cms_invalid;
if (masterId != NetworkId::cms_invalid)
{
@@ -274,7 +274,7 @@ bool HateList::removeTarget(NetworkId const & target)
{
AggroListProperty * const aggroList = AggroListProperty::getAggroListProperty(*m_owner);
if (aggroList != NULL)
if (aggroList != nullptr)
{
aggroList->addTarget(target);
}
@@ -301,7 +301,7 @@ bool HateList::isValidTarget(Object * const target)
bool valid = true;
TangibleObject * const targetTangibleObject = TangibleObject::asTangibleObject(target);
if (targetTangibleObject == NULL)
if (targetTangibleObject == nullptr)
{
LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::isValidTarget() owner(%s:%s) TARGET IS NOT A TANGIBLEOBJECT", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str()));
valid = false;
@@ -334,7 +334,7 @@ bool HateList::isValidTarget(Object * const target)
{
CreatureObject const * const targetCreatureObject = targetTangibleObject->asCreatureObject();
if (targetCreatureObject != NULL)
if (targetCreatureObject != nullptr)
{
if (targetTangibleObject->isDisabled())
{
@@ -355,7 +355,7 @@ bool HateList::isValidTarget(Object * const target)
{
AICreatureController const * const targetAiCreatureController = AICreatureController::asAiCreatureController(targetCreatureObject->getController());
if ( (targetAiCreatureController != NULL)
if ( (targetAiCreatureController != nullptr)
&& targetAiCreatureController->isRetreating())
{
LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::isValidTarget() owner(%s:%s) TARGET IS RETREATING", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str()));
@@ -370,7 +370,7 @@ bool HateList::isValidTarget(Object * const target)
// themselves towards the player so that they and the player
// enter combat correctly.
{
if ( (m_owner->asCreatureObject() != NULL)
if ( (m_owner->asCreatureObject() != nullptr)
&& !Pvp::canAttack(*m_owner, *targetTangibleObject))
{
LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::isValidTarget() owner(%s:%s) PVP CAN'T ATTACK", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str()));
@@ -393,7 +393,7 @@ CachedNetworkId const & HateList::getTarget() const
if ( (m_target.get() == CachedNetworkId::cms_cachedInvalid)
&& !isEmpty())
{
WARNING(true, ("HateList::getTarget() owner(%s) m_hateList.size(%u) m_target is NULL but the HateList is not empty.", m_owner->getDebugInformation().c_str(), m_hateList.size()));
WARNING(true, ("HateList::getTarget() owner(%s) m_hateList.size(%u) m_target is nullptr but the HateList is not empty.", m_owner->getDebugInformation().c_str(), m_hateList.size()));
}
#endif // _DEBUG
@@ -458,7 +458,7 @@ void HateList::findNewTarget()
for (; iterHateList != m_hateList.end(); ++iterHateList)
{
if (iterHateList->first.getObject() == NULL)
if (iterHateList->first.getObject() == nullptr)
{
// This target will be removed in the next alter call
continue;
@@ -510,11 +510,11 @@ void HateList::setTarget(CachedNetworkId const & target, float const hate)
#ifdef _DEBUG
// We should only have tangible objects in our target list
if (m_target.get().getObject() != NULL)
if (m_target.get().getObject() != nullptr)
{
TangibleObject const * const targetTangibleObject = TangibleObject::asTangibleObject(m_target.get().getObject()->asServerObject());
if (targetTangibleObject == NULL)
if (targetTangibleObject == nullptr)
{
WARNING(true, ("HateList::setTarget() owner(%s) How did we get a target(%s) that is not a TangibleObject", m_owner->getDebugInformation().c_str(), m_target.get().getObject()->getDebugInformation().c_str()));
}
@@ -559,7 +559,7 @@ void HateList::triggerTargetChanged(NetworkId const & target)
{
GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_owner);
if (gameScriptObject != NULL)
if (gameScriptObject != nullptr)
{
LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::triggerTargetChanged() owner(%s:%s) target(%s)", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str(), target.getValueString().c_str()));
@@ -578,7 +578,7 @@ void HateList::triggerTargetAdded(NetworkId const & target)
{
GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_owner);
if (gameScriptObject != NULL)
if (gameScriptObject != nullptr)
{
LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::triggerTargetAdded() owner(%s:%s) target(%s)", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str(), target.getValueString().c_str()));
@@ -597,7 +597,7 @@ void HateList::triggerTargetRemoved(NetworkId const & target)
{
GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_owner);
if (gameScriptObject != NULL)
if (gameScriptObject != nullptr)
{
LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::triggerTargetRemoved() owner(%s:%s) target(%s)", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str(), target.getValueString().c_str()));
@@ -628,7 +628,7 @@ int HateList::getAutoExpireTargetDuration() const
bool HateList::isOwnerValid() const
{
CreatureObject const * const ownerCreature = CreatureObject::asCreatureObject(m_owner);
bool const ownerIncapacitated = (ownerCreature != NULL) ? ownerCreature->isIncapacitated() : false;
bool const ownerIncapacitated = (ownerCreature != nullptr) ? ownerCreature->isIncapacitated() : false;
if (ownerIncapacitated)
{
@@ -636,7 +636,7 @@ bool HateList::isOwnerValid() const
return false;
}
bool const ownerDead = (ownerCreature != NULL) ? ownerCreature->isDead() : false;
bool const ownerDead = (ownerCreature != nullptr) ? ownerCreature->isDead() : false;
if (ownerDead)
{
@@ -644,7 +644,7 @@ bool HateList::isOwnerValid() const
return false;
}
bool const ownerDisabled = (ownerCreature != NULL) ? ownerCreature->isDisabled() : false;
bool const ownerDisabled = (ownerCreature != nullptr) ? ownerCreature->isDisabled() : false;
if (ownerDisabled)
{
@@ -653,7 +653,7 @@ bool HateList::isOwnerValid() const
}
AICreatureController const * const ownerAiCreatureController = AICreatureController::asAiCreatureController(m_owner->getController());
const bool ownerRetreating = (ownerAiCreatureController != NULL) ? ownerAiCreatureController->isRetreating() : false;
const bool ownerRetreating = (ownerAiCreatureController != nullptr) ? ownerAiCreatureController->isRetreating() : false;
if (ownerRetreating)
{
@@ -752,11 +752,11 @@ void HateList::forceHateTarget(const NetworkId &target)
#ifdef _DEBUG
// We should only have tangible objects in our target list
if (m_target.get().getObject() != NULL)
if (m_target.get().getObject() != nullptr)
{
TangibleObject const * const targetTangibleObject = TangibleObject::asTangibleObject(m_target.get().getObject()->asServerObject());
if (targetTangibleObject == NULL)
if (targetTangibleObject == nullptr)
{
WARNING(true, ("HateList::setTarget() owner(%s) How did we get a target(%s) that is not a TangibleObject", m_owner->getDebugInformation().c_str(), m_target.get().getObject()->getDebugInformation().c_str()));
}
@@ -99,7 +99,7 @@ private:
inline bool HateList::isOwnerPlayer() const
{
return (m_playerObject != NULL);
return (m_playerObject != nullptr);
}
// ======================================================================
@@ -380,7 +380,7 @@ void Squad::buildFormation()
{
NetworkId const & unit = iterUnitMap->first;
PersistentCrcString const * unitName = iterUnitMap->second;
DEBUG_FATAL((unitName == NULL), ("The unit should have a non-null name."));
DEBUG_FATAL((unitName == nullptr), ("The unit should have a non-nullptr name."));
if (unit == m_leader)
{
@@ -401,7 +401,7 @@ void Squad::buildFormation()
#ifdef DEBUG
Object * const unitObject = NetworkIdManager::getObjectById(unit);
DEBUG_WARNING(true, ("className(%s) Unable to find the ship(%s) [%s] in the formation priority list.",
getClassName(), unitName->getString(), unitObject ? unitObject->getDebugInformation().c_str() : "NULL"));
getClassName(), unitName->getString(), unitObject ? unitObject->getDebugInformation().c_str() : "nullptr"));
#endif
}
@@ -463,7 +463,7 @@ void Squad::calculateSquadPosition_w()
Object * const object = NetworkIdManager::getObjectById(unit);
if (object != NULL)
if (object != nullptr)
{
m_squadPosition_w += object->getPosition_w();
}
@@ -28,15 +28,15 @@ namespace Archive
#ifdef _DEBUG
Object * const object = NetworkIdManager::getObjectById(target.m_networkId);
if (object == NULL)
if (object == nullptr)
{
WARNING(true, ("AiCreatureStateArchive::get() Unable to resolve networkId(%s) to an Object", target.m_networkId.getValueString().c_str()));
return;
}
AICreatureController * const controller = (object != NULL) ? AICreatureController::asAiCreatureController(object->getController()) : NULL;
AICreatureController * const controller = (object != nullptr) ? AICreatureController::asAiCreatureController(object->getController()) : nullptr;
if (controller == NULL)
if (controller == nullptr)
{
WARNING(true, ("AiCreatureStateArchive::get() Message to object(%s) that does not have an AICreatureController", object->getDebugInformation().c_str()));
return;
@@ -43,9 +43,9 @@ namespace AiLocationArchive
AiLocation::AiLocation ( void )
: m_valid(false),
m_attached(false),
m_object(NULL),
m_object(nullptr),
m_objectId(),
m_cellObject(NULL),
m_cellObject(nullptr),
m_position_p(Vector::zero),
m_position_w(Vector::zero),
m_radius(0.0f),
@@ -60,9 +60,9 @@ AiLocation::AiLocation ( void )
AiLocation::AiLocation ( CellProperty const * cell, Vector const & position, float radius )
: m_valid(true),
m_attached(false),
m_object(NULL),
m_object(nullptr),
m_objectId(),
m_cellObject(cell ? &cell->getOwner() : NULL),
m_cellObject(cell ? &cell->getOwner() : nullptr),
m_position_p(position),
m_position_w(CollisionUtils::transformToWorld(cell,position)),
m_radius(radius),
@@ -78,9 +78,9 @@ AiLocation::AiLocation ( CellProperty const * cell, Vector const & position, flo
AiLocation::AiLocation ( NetworkId const & cellId, Vector const & position, float radius )
: m_valid(true),
m_attached(false),
m_object(NULL),
m_object(nullptr),
m_objectId(),
m_cellObject(NULL),
m_cellObject(nullptr),
m_position_p(position),
m_position_w(position),
m_radius(radius),
@@ -110,9 +110,9 @@ AiLocation::AiLocation ( NetworkId const & cellId, Vector const & position, floa
AiLocation::AiLocation ( Object const * object )
: m_valid(true),
m_attached(true),
m_object(NULL),
m_object(nullptr),
m_objectId(),
m_cellObject(NULL),
m_cellObject(nullptr),
m_position_p(Vector::zero),
m_position_w(Vector::zero),
m_radius(0.0f),
@@ -129,9 +129,9 @@ AiLocation::AiLocation ( Object const * object )
AiLocation::AiLocation ( NetworkId const & objectId )
: m_valid(true),
m_attached(true),
m_object(NULL),
m_object(nullptr),
m_objectId(),
m_cellObject(NULL),
m_cellObject(nullptr),
m_position_p(Vector::zero),
m_position_w(Vector::zero),
m_radius(0.0f),
@@ -148,9 +148,9 @@ AiLocation::AiLocation ( NetworkId const & objectId )
AiLocation::AiLocation ( Object const * object, Vector const & offset, bool relativeOffset )
: m_valid(true),
m_attached(true),
m_object(NULL),
m_object(nullptr),
m_objectId(),
m_cellObject(NULL),
m_cellObject(nullptr),
m_position_p(Vector::zero),
m_position_w(Vector::zero),
m_radius(0.0f),
@@ -167,9 +167,9 @@ AiLocation::AiLocation ( Object const * object, Vector const & offset, bool rela
AiLocation::AiLocation ( NetworkId const & objectId, Vector const & offset, bool relativeOffset )
: m_valid(true),
m_attached(true),
m_object(NULL),
m_object(nullptr),
m_objectId(),
m_cellObject(NULL),
m_cellObject(nullptr),
m_position_p(Vector::zero),
m_position_w(Vector::zero),
m_radius(0.0f),
@@ -365,7 +365,7 @@ void AiLocation::setObject ( Object const * object )
{
if(m_attached)
{
if (object == NULL)
if (object == nullptr)
{
clear();
return;
@@ -385,7 +385,7 @@ void AiLocation::setObject ( Object const * object )
void AiLocation::detach ( void )
{
m_object = NULL;
m_object = nullptr;
m_objectId = NetworkId::cms_invalid;
m_attached = false;
}
@@ -394,7 +394,7 @@ void AiLocation::detach ( void )
CellProperty const * AiLocation::getCell ( void ) const
{
return m_cellObject ? m_cellObject->getCellProperty() : NULL;
return m_cellObject ? m_cellObject->getCellProperty() : nullptr;
}
// ----------
@@ -424,7 +424,7 @@ bool AiLocation::hasChanged ( void ) const
Vector AiLocation::getPosition_p ( void ) const
{
if(m_cellObject.getPointer() == NULL)
if(m_cellObject.getPointer() == nullptr)
{
WARNING(ConfigServerGame::getReportAiWarnings(),("AiLocation::getPosition_p - Locations's parent cell has disappeared\n"));
@@ -572,8 +572,8 @@ void AiLocation::clear ( void )
m_valid = false;
m_attached = false;
m_object = NULL;
m_cellObject = NULL;
m_object = nullptr;
m_cellObject = nullptr;
m_position_p = Vector::zero;
m_radius = 0.0f;
m_offset_p = Vector::zero;
@@ -585,7 +585,7 @@ void AiLocation::clear ( void )
bool AiLocation::isInWorldCell ( void ) const
{
return isValid() && ( (getCell() == NULL) || (getCell() == CellProperty::getWorldCellProperty()) );
return isValid() && ( (getCell() == nullptr) || (getCell() == CellProperty::getWorldCellProperty()) );
}
@@ -599,7 +599,7 @@ bool AiLocation::validate ( void ) const
TerrainObject * terrain = TerrainObject::getInstance();
if(terrain == NULL) return true;
if(terrain == nullptr) return true;
float w = terrain->getMapWidthInMeters() / 2.0f;
@@ -159,7 +159,7 @@ void AiShipAttackTargetList::add(ShipObject & unit, float const damage)
AiShipController * const ownerAiShipController = AiShipController::asAiShipController(m_owner->getController());
if (ownerAiShipController != NULL)
if (ownerAiShipController != nullptr)
{
if (!ownerAiShipController->isValidTarget(unit))
{
@@ -204,7 +204,7 @@ void AiShipAttackTargetList::add(ShipObject & unit, float const damage)
ShipController * const attackingUnitShipController = unit.getController()->asShipController();
if (attackingUnitShipController != NULL)
if (attackingUnitShipController != nullptr)
{
attackingUnitShipController->addAiTargetingMe(m_owner->getNetworkId());
}
@@ -217,7 +217,7 @@ void AiShipAttackTargetList::add(ShipObject & unit, float const damage)
// ----------------------------------------------------------------------
bool AiShipAttackTargetList::remove(NetworkId const & unit, bool const inDestructorHack)
{
DEBUG_FATAL((unit == NetworkId::cms_invalid), ("Removing a NULL unit"));
DEBUG_FATAL((unit == NetworkId::cms_invalid), ("Removing a nullptr unit"));
bool result = false;
@@ -238,11 +238,11 @@ bool AiShipAttackTargetList::remove(NetworkId const & unit, bool const inDestruc
// Tell this unit that we are no longer targeting it
if (object != NULL)
if (object != nullptr)
{
ShipController * const shipController = object->getController()->asShipController();
if (shipController != NULL)
if (shipController != nullptr)
{
shipController->removeAiTargetingMe(m_owner->getNetworkId());
}
@@ -398,12 +398,12 @@ void AiShipAttackTargetList::findNewPrimaryTarget()
// We should only have ship objects in our target list
if (m_primaryTarget.getObject() != NULL)
if (m_primaryTarget.getObject() != nullptr)
{
ServerObject * const targetServerObject = m_primaryTarget.getObject()->asServerObject();
ShipObject * const targetShipObject = (targetServerObject != NULL) ? targetServerObject->asShipObject() : NULL;
ShipObject * const targetShipObject = (targetServerObject != nullptr) ? targetServerObject->asShipObject() : nullptr;
if (targetShipObject == NULL)
if (targetShipObject == nullptr)
{
DEBUG_WARNING(true, ("debug_ai: AiShipAttackTargetList::findNewPrimaryTarget() ERROR: How did we get a target that is not a ShipObject (%s)", m_primaryTarget.getObject()->getDebugInformation().c_str()));
}
@@ -444,7 +444,7 @@ void AiShipAttackTargetList::verify()
AiShipController * const ownerAiShipController = AiShipController::asAiShipController(m_owner->getController());
if (ownerAiShipController != NULL)
if (ownerAiShipController != nullptr)
{
if (ownerAiShipController->hasExclusiveAggros())
{
@@ -457,9 +457,9 @@ void AiShipAttackTargetList::verify()
for (; iterTargetList != m_targetList->end(); ++iterTargetList)
{
ShipObject * const unitShipObject = ShipObject::asShipObject(iterTargetList->first.getObject());
CreatureObject const * const unitPilot = (unitShipObject != NULL) ? unitShipObject->getPilot() : NULL;
CreatureObject const * const unitPilot = (unitShipObject != nullptr) ? unitShipObject->getPilot() : nullptr;
if ( (unitPilot == NULL)
if ( (unitPilot == nullptr)
|| !ownerAiShipController->isExclusiveAggro(*unitPilot))
{
s_purgeList.push_back(unitShipObject->getNetworkId());
@@ -56,7 +56,7 @@ AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipController & aiShip
m_evadeChangeDirectionTimer(0.5f),
m_missilesFired(0)
{
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber() unit(%s)", (aiShipController.getOwner() != NULL) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner"));
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber() unit(%s)", (aiShipController.getOwner() != nullptr) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner"));
}
// ----------------------------------------------------------------------
@@ -73,7 +73,7 @@ AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipBehaviorAttack cons
m_evadeChangeDirectionTimer(0.5f),
m_missilesFired(0)
{
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipBehaviorAttack &) unit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner"));
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipBehaviorAttack &) unit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner"));
}
// ----------------------------------------------------------------------
@@ -293,7 +293,7 @@ ShipObject const * AiShipBehaviorAttackBomber::getTargetCapitalShip() const
return targetShipObject;
}
return NULL;
return nullptr;
}
// ----------------------------------------------------------------------
@@ -19,7 +19,7 @@
AiShipBehaviorAttackCapitalShip::AiShipBehaviorAttackCapitalShip(AiShipController & aiShipController)
: AiShipBehaviorAttack(aiShipController)
{
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackCapitalShip::AiShipBehaviorAttackCapitalShip() unit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner"));
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackCapitalShip::AiShipBehaviorAttackCapitalShip() unit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner"));
}
// ----------------------------------------------------------------------
@@ -145,7 +145,7 @@ Vector const AiShipBehaviorAttackFighter::calculateEvadePositionWithinLeashDista
AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipController & aiShipController)
: AiShipBehaviorAttack(aiShipController)
, m_currentManeuver(NULL)
, m_currentManeuver(nullptr)
, m_timeDelta(0.0f)
, m_projectileTimer()
, m_missileLockOnTimer()
@@ -165,7 +165,7 @@ AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipController & aiSh
, m_shotErrorPosition_l()
, m_nextShotPosition_w()
{
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (aiShipController.getOwner() != NULL) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner"));
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (aiShipController.getOwner() != nullptr) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner"));
initializeTimers();
calculateEvadeHealthPercent();
calculateNextProjectileShotPerfect();
@@ -178,7 +178,7 @@ AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipController & aiSh
AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipBehaviorAttack const & sourceBehavior)
: AiShipBehaviorAttack(sourceBehavior)
, m_currentManeuver(NULL)
, m_currentManeuver(nullptr)
, m_timeDelta(0.0f)
, m_projectileTimer()
, m_missileLockOnTimer()
@@ -198,7 +198,7 @@ AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipBehaviorAttack co
, m_shotErrorPosition_l()
, m_nextShotPosition_w()
{
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (getAiShipController().getOwner() != NULL) ? getAiShipController().getOwner()->getNetworkId().getValueString().c_str() : "NULL owner"));
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (getAiShipController().getOwner() != nullptr) ? getAiShipController().getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner"));
initializeTimers();
calculateEvadeHealthPercent();
calculateNextProjectileShotPerfect();
@@ -214,7 +214,7 @@ AiShipBehaviorAttackFighter::~AiShipBehaviorAttackFighter()
delete m_targetInfo;
delete m_currentManeuver;
m_currentManeuver = NULL;
m_currentManeuver = nullptr;
}
// ----------------------------------------------------------------------
@@ -265,7 +265,7 @@ void AiShipBehaviorAttackFighter::alterManeuver()
}
else
{
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::alterManeuver() owner(%s) Why does this ship in the attack state with a NULL attack target?", getAiShipController().getOwner()->getNetworkId().getValueString().c_str()));
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::alterManeuver() owner(%s) Why does this ship in the attack state with a nullptr attack target?", getAiShipController().getOwner()->getNetworkId().getValueString().c_str()));
}
if (overallHealthPercent > m_lastEvadeHealthPercent)
@@ -347,7 +347,7 @@ void AiShipBehaviorAttackFighter::alterWeapons()
if (!targetShipObject)
{
DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target NULL?", getAiShipController().getShipOwner()->getDebugInformation().c_str()));
DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target nullptr?", getAiShipController().getShipOwner()->getDebugInformation().c_str()));
return;
}
@@ -584,7 +584,7 @@ void AiShipBehaviorAttackFighter::alterTargetInformation()
ShipObject & ownerShipObject = *NON_NULL(getAiShipController().getShipOwner());
ShipObject const * const targetShipObject = getAiShipController().getPrimaryAttackTargetShipObject();
if (targetShipObject != NULL)
if (targetShipObject != nullptr)
{
//-- Set pilot data here.
AiShipPilotData const * pilotData = NON_NULL(getAiShipController().getPilotData());
@@ -600,7 +600,7 @@ void AiShipBehaviorAttackFighter::alterTargetInformation()
CreatureObject const * const targetPilot = targetShipObject->getPilot();
m_targetInfo->m_playerControlled = (targetPilot != NULL) ? targetPilot->isPlayerControlled() : false;
m_targetInfo->m_playerControlled = (targetPilot != nullptr) ? targetPilot->isPlayerControlled() : false;
// Cached target info.
bool const includeMissiles = true;
@@ -707,7 +707,7 @@ void AiShipBehaviorAttackFighter::alterTargetInformation()
}
else
{
DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: The primary attack target is NULL.", ownerShipObject.getDebugInformation().c_str()));
DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: The primary attack target is nullptr.", ownerShipObject.getDebugInformation().c_str()));
}
}
@@ -956,7 +956,7 @@ void AiShipBehaviorAttackFighter::calculateNextShotPosition_w()
if (!targetShipObject)
{
DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target NULL?", getAiShipController().getShipOwner()->getDebugInformation().c_str()));
DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target nullptr?", getAiShipController().getShipOwner()->getDebugInformation().c_str()));
return;
}
@@ -1014,7 +1014,7 @@ void AiShipBehaviorAttackFighter::addDebug(AiDebugString & aiDebugString)
AiShipBehaviorAttackFighter::Maneuver::Path const * path = m_currentManeuver->getCurrentPath();
char pathSizeText[256];
if (path != NULL)
if (path != nullptr)
{
snprintf(pathSizeText, sizeof(pathSizeText) - 1, "PATH(%d)", path->getLength());
}
@@ -1027,7 +1027,7 @@ void AiShipBehaviorAttackFighter::addDebug(AiDebugString & aiDebugString)
// Show the current maneuver
{
char const * const text = FormattedString<512>().sprintf("attack[%s%s%s] %d %s\n", AiDebugString::getColorCode(PackedRgb::solidWhite).c_str(), (m_currentManeuver != NULL) ? m_currentManeuver->getFighterManeuverString() : "NULL", AiDebugString::getResetColorCode(), (m_currentManeuver != NULL) ? m_currentManeuver->getSequenceId() : -1, pathSizeText);
char const * const text = FormattedString<512>().sprintf("attack[%s%s%s] %d %s\n", AiDebugString::getColorCode(PackedRgb::solidWhite).c_str(), (m_currentManeuver != nullptr) ? m_currentManeuver->getFighterManeuverString() : "nullptr", AiDebugString::getResetColorCode(), (m_currentManeuver != nullptr) ? m_currentManeuver->getSequenceId() : -1, pathSizeText);
aiDebugString.addText(text, PackedRgb::solidCyan);
}
@@ -1060,7 +1060,7 @@ void AiShipBehaviorAttackFighter::addDebug(AiDebugString & aiDebugString)
// Show the maneuver path
if ( (path != NULL)
if ( (path != nullptr)
&& !path->isEmpty())
{
AiDebugString::TransformList transformList;
@@ -72,7 +72,7 @@ AiShipBehaviorAttackFighter::Maneuver::~Maneuver()
delete m_pathList;
//m_currentPath = NULL;
//m_currentPath = nullptr;
}
// ----------------------------------------------------------------------
@@ -128,7 +128,7 @@ void AiShipBehaviorAttackFighter::Maneuver::addPath(Path * const path)
AiShipBehaviorAttackFighter::Maneuver::Path * AiShipBehaviorAttackFighter::Maneuver::getCurrentPath()
{
Path * currentPath = NULL;
Path * currentPath = nullptr;
if (!m_pathList->empty() && m_currentPath != m_pathList->end())
{
@@ -230,7 +230,7 @@ void AiShipBehaviorAttackFighter::Maneuver::alterThrottle(float const /*timeDelt
AiShipBehaviorAttackFighter::Maneuver * AiShipBehaviorAttackFighter::Maneuver::createManeuver(FighterManeuver const manueverType, AiShipBehaviorAttackFighter & aiShipBehaviorAttack, AiAttackTargetInformation const & targetInfo)
{
Maneuver * aiManeuver = NULL;
Maneuver * aiManeuver = nullptr;
switch(manueverType)
{
@@ -298,7 +298,7 @@ public:
ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject();
if (primaryTargetShipObject != NULL)
if (primaryTargetShipObject != nullptr)
{
float const ownerShipRadius = getAiShipController().getShipOwner()->getRadius();
float const ownerTurnRadius = getAiShipController().getLargestTurnRadius();
@@ -337,7 +337,7 @@ protected:
ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject();
if (primaryTargetShipObject != NULL)
if (primaryTargetShipObject != nullptr)
{
bool const facingTarget = m_aiShipBehaviorAttack.isFacingTarget();
@@ -450,7 +450,7 @@ private:
{
ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject();
if (primaryTargetShipObject != NULL)
if (primaryTargetShipObject != nullptr)
{
AiShipPilotData const & pilotData = *NON_NULL(getAiShipController().getPilotData());
float const currentSpeed = getAiShipController().getShipOwner()->getCurrentSpeed();
@@ -665,11 +665,11 @@ private:
{
ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject();
if (primaryTargetShipObject!= NULL)
if (primaryTargetShipObject!= nullptr)
{
ShipController const * const targetShipController = primaryTargetShipObject->getController()->asShipController();
if (targetShipController != NULL)
if (targetShipController != nullptr)
{
Transform transform;
Vector velocity;
@@ -66,7 +66,7 @@ AiShipBehaviorDock::AiShipBehaviorDock(ShipController & shipController, ShipObje
, m_goalPosition_w()
, m_wingsOpenedBeforeDock(m_shipController.getShipOwner()->hasWings() && m_shipController.getShipOwner()->wingsOpened())
{
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock: [1/6] unit(%s) dockTarget(%s) secondsAtDock(%.2f) landingHardPoint(%s)", (shipController.getOwner() != NULL) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", dockTarget.getNetworkId().getValueString().c_str(), secondsAtDock, m_hasLandingHardPoint ? "yes" : "no"));
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock: [1/6] unit(%s) dockTarget(%s) secondsAtDock(%.2f) landingHardPoint(%s)", (shipController.getOwner() != nullptr) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", dockTarget.getNetworkId().getValueString().c_str(), secondsAtDock, m_hasLandingHardPoint ? "yes" : "no"));
if (m_shipController.isBeingDocked())
{
@@ -119,7 +119,7 @@ AiShipBehaviorDock::AiShipBehaviorDock(ShipController & shipController, ShipObje
ShipController * const dockTargetShipController = dockTarget.getController()->asShipController();
if (dockTargetShipController != NULL)
if (dockTargetShipController != nullptr)
{
dockTargetShipController->addDockedBy(*shipController.getOwner());
}
@@ -146,7 +146,7 @@ AiShipBehaviorDock::AiShipBehaviorDock(ShipController & shipController, ShipObje
m_initialApproachHardPointCount = static_cast<int>(m_approachHardPointList->size());
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock() unit(%s) dockTarget(%s) approachHardPointCount(%u) exitHardPointCount(%u)", (shipController.getOwner() != NULL) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", dockTarget.getNetworkId().getValueString().c_str(), m_approachHardPointList->size(), m_exitHardPointList->size()));
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock() unit(%s) dockTarget(%s) approachHardPointCount(%u) exitHardPointCount(%u)", (shipController.getOwner() != nullptr) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", dockTarget.getNetworkId().getValueString().c_str(), m_approachHardPointList->size(), m_exitHardPointList->size()));
}
// ----------------------------------------------------------------------
@@ -156,7 +156,7 @@ AiShipBehaviorDock::~AiShipBehaviorDock()
// Open the wings
if ( (ownerShipObject != NULL)
if ( (ownerShipObject != nullptr)
&& m_wingsOpenedBeforeDock)
{
m_shipController.getShipOwner()->openWings();
@@ -168,7 +168,7 @@ AiShipBehaviorDock::~AiShipBehaviorDock()
{
CollisionCallbackManager::removeIgnoreIntersect(m_shipController.getOwner()->getNetworkId(), m_dockTarget);
if ( (ownerShipObject != NULL)
if ( (ownerShipObject != nullptr)
&& ownerShipObject->isPlayerShip())
{
m_shipController.appendMessage(CM_removeIgnoreIntersect, 0.0f, new MessageQueueGenericValueType<NetworkId>(m_dockTarget), GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
@@ -179,11 +179,11 @@ AiShipBehaviorDock::~AiShipBehaviorDock()
Object * const dockTarget = m_dockTarget.getObject();
if (dockTarget != NULL)
if (dockTarget != nullptr)
{
ShipController * const dockTargetShipController = dockTarget->getController()->asShipController();
if (dockTargetShipController != NULL)
if (dockTargetShipController != nullptr)
{
dockTargetShipController->removeDockedBy(*m_shipController.getOwner());
}
@@ -200,7 +200,7 @@ void AiShipBehaviorDock::alter(float deltaSeconds)
bool abortDocking = false;
if (m_dockTarget.getObject() == NULL)
if (m_dockTarget.getObject() == nullptr)
{
// If we lose the dock target, fail the docking procedure.
@@ -213,7 +213,7 @@ void AiShipBehaviorDock::alter(float deltaSeconds)
AiShipController * const dockTargetAiShipController = AiShipController::asAiShipController(m_dockTarget.getObject()->getController());
if ( (dockTargetAiShipController != NULL)
if ( (dockTargetAiShipController != nullptr)
&& dockTargetAiShipController->isAttacking())
{
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock::alter() unit(%s) dockTarget(%s) DOCK TARGET IS ATTACKING...UNDOCKING", m_shipController.getOwner()->getDebugInformation().c_str(), m_dockTarget.getValueString().c_str()));
@@ -478,7 +478,7 @@ void AiShipBehaviorDock::triggerDocked()
GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner());
if(gameScriptObject != NULL)
if(gameScriptObject != nullptr)
{
ScriptParams scriptParams;
scriptParams.addParam(m_dockTarget);
@@ -499,7 +499,7 @@ void AiShipBehaviorDock::triggerStartUnDock()
GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner());
if(gameScriptObject != NULL)
if(gameScriptObject != nullptr)
{
ScriptParams scriptParams;
scriptParams.addParam(m_dockTarget);
@@ -520,7 +520,7 @@ void AiShipBehaviorDock::triggerUnDockWithSuccess()
GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner());
if(gameScriptObject != NULL)
if(gameScriptObject != nullptr)
{
ScriptParams scriptParams;
scriptParams.addParam(m_dockTarget);
@@ -542,7 +542,7 @@ void AiShipBehaviorDock::triggerUnDockWithFailure()
GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner());
if(gameScriptObject != NULL)
if(gameScriptObject != nullptr)
{
ScriptParams scriptParams;
scriptParams.addParam(m_dockTarget);
@@ -622,7 +622,7 @@ float AiShipBehaviorDock::getMaxTractorBeamSpeed() const
float const shipActualSpeedMaximum = m_shipController.getShipOwner()->getShipActualSpeedMaximum();
AiShipController * const aiShipController = m_shipController.asAiShipController();
return (aiShipController != NULL) ? (shipActualSpeedMaximum * aiShipController->getPilotData()->m_nonCombatMaxSpeedPercent) : shipActualSpeedMaximum;
return (aiShipController != nullptr) ? (shipActualSpeedMaximum * aiShipController->getPilotData()->m_nonCombatMaxSpeedPercent) : shipActualSpeedMaximum;
}
// ----------------------------------------------------------------------
@@ -676,7 +676,7 @@ void AiShipBehaviorDock::addDebug(AiDebugString & aiDebugString)
aiDebugString.addLineToPosition(m_goalPosition_w, PackedRgb::solidCyan);
if (m_dockTarget.getObject() != NULL)
if (m_dockTarget.getObject() != nullptr)
{
Transform transform;
transform.multiply(m_dockTarget.getObject()->getTransform_o2w(), m_dockHardPoint);
@@ -45,9 +45,9 @@ AiShipBehaviorFollow::AiShipBehaviorFollow(AiShipController & aiShipController,
, m_followedUnit(followedUnit)
, m_followedUnitLost(false)
{
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorFollow::AiShipBehaviorFollow() unit(%s) followedUnit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", followedUnit.getValueString().c_str()));
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorFollow::AiShipBehaviorFollow() unit(%s) followedUnit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", followedUnit.getValueString().c_str()));
DEBUG_WARNING((m_followedUnit.getObject() == NULL), ("Trying to follow a NULL object."));
DEBUG_WARNING((m_followedUnit.getObject() == nullptr), ("Trying to follow a nullptr object."));
}
// ----------------------------------------------------------------------
@@ -60,7 +60,7 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds)
Object * const followedUnitObject = m_followedUnit.getObject();
Vector goalPosition_w;
if (followedUnitObject != NULL)
if (followedUnitObject != nullptr)
{
goalPosition_w = Formation::getPosition_w(followedUnitObject->getTransform_o2w(), m_aiShipController.getFormationPosition_l());
@@ -69,9 +69,9 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds)
if (m_aiShipController.getOwner()->getPosition_w().magnitudeBetweenSquared(goalPosition_w) > sqr(m_aiShipController.getLargestTurnRadius() * slowDownRequestRadiusGain))
{
ShipController * const shipController = followedUnitObject->getController()->asShipController();
AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL;
AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr;
if (aiShipController != NULL)
if (aiShipController != nullptr)
{
aiShipController->requestSlowDown();
}
@@ -90,7 +90,7 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds)
Object const * const object = m_aiShipController.getOwner();
if (object != NULL)
if (object != nullptr)
{
goalPosition_w = object->getPosition_w();
}
@@ -109,10 +109,10 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds)
void AiShipBehaviorFollow::triggerFollowedUnitLost()
{
Object * object = m_aiShipController.getOwner();
ServerObject *serverObject = (object != NULL) ? object->asServerObject() : NULL;
GameScriptObject * gameScriptObject = (serverObject != NULL) ? serverObject->getScriptObject() : NULL;
ServerObject *serverObject = (object != nullptr) ? object->asServerObject() : nullptr;
GameScriptObject * gameScriptObject = (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr;
if(gameScriptObject != NULL)
if(gameScriptObject != nullptr)
{
ScriptParams scriptParams;
scriptParams.addParam(m_followedUnit);
@@ -25,7 +25,7 @@
AiShipBehaviorIdle::AiShipBehaviorIdle(AiShipController & aiShipController)
: AiShipBehaviorBase(aiShipController)
{
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorIdle() unit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner"));
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorIdle() unit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner"));
}
// ----------------------------------------------------------------------
@@ -27,7 +27,7 @@ AiShipBehaviorTrack::AiShipBehaviorTrack(AiShipController & aiShipController, Ob
: AiShipBehaviorBase(aiShipController)
, m_target(&target)
{
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorTrack() unit(%s) target(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", target.getNetworkId().getValueString().c_str()));
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorTrack() unit(%s) target(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", target.getNetworkId().getValueString().c_str()));
}
// ----------------------------------------------------------------------
@@ -36,7 +36,7 @@ void AiShipBehaviorTrack::alter(float deltaSeconds)
{
PROFILER_AUTO_BLOCK_DEFINE("AiShipBehaviorTrack::alter");
if (m_target != NULL)
if (m_target != nullptr)
{
IGNORE_RETURN(m_aiShipController.face(m_target->getPosition_w(), deltaSeconds));
}
@@ -35,7 +35,7 @@ AiShipBehaviorWaypoint::AiShipBehaviorWaypoint(AiShipController & aiShipControll
, m_cyclic(cyclic)
, m_moveToCompleteTriggerSent(false)
{
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorWaypoint::AiShipBehaviorWaypoint() unit(%s) cyclic(%s)", (aiShipController.getOwner() != NULL) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", cyclic ? "yes" : "no"));
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorWaypoint::AiShipBehaviorWaypoint() unit(%s) cyclic(%s)", (aiShipController.getOwner() != nullptr) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", cyclic ? "yes" : "no"));
}
// ----------------------------------------------------------------------
@@ -61,7 +61,7 @@ void AiShipBehaviorWaypoint::alter(float deltaSeconds)
{
SpacePath const * const path = m_aiShipController.getPath();
if ( (path != NULL)
if ( (path != nullptr)
&& !m_cyclic
&& (m_aiShipController.getCurrentPathIndex() == (path->getTransformList().size() - 1)))
{
@@ -76,7 +76,7 @@ void AiShipBehaviorWaypoint::alter(float deltaSeconds)
GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_aiShipController.getOwner());
if(gameScriptObject != NULL)
if(gameScriptObject != nullptr)
{
ScriptParams scriptParams;
IGNORE_RETURN(gameScriptObject->trigAllScripts(Scripting::TRIG_SPACE_UNIT_MOVE_TO_COMPLETE, scriptParams));
@@ -104,13 +104,13 @@ bool AiShipBehaviorWaypoint::getNextPosition_w(Vector & position_w)
SpacePath * const path = m_aiShipController.getPath();
if ( (path != NULL)
if ( (path != nullptr)
&& !path->isEmpty()
&& (m_aiShipController.getCurrentPathIndex() < path->getTransformList().size()))
{
ShipObject const * const shipObject = m_aiShipController.getShipOwner();
if (shipObject != NULL)
if (shipObject != nullptr)
{
SpacePath::TransformList const & transformList = path->getTransformList();
Vector const & nextPosition = getGoalPosition_w();
@@ -166,7 +166,7 @@ Vector AiShipBehaviorWaypoint::getGoalPosition_w() const
SpacePath * const path = m_aiShipController.getPath();
if ( (path != NULL)
if ( (path != nullptr)
&& !path->isEmpty())
{
SpacePath::TransformList const & transformList = path->getTransformList();
@@ -245,7 +245,7 @@ void AiShipBehaviorWaypoint::addDebug(AiDebugString & aiDebugString)
{
SpacePath const * const path = m_aiShipController.getPath();
if (path != NULL)
if (path != nullptr)
{
aiDebugString.addLineToPosition(m_aiShipController.getMoveToGoalPosition_w(), PackedRgb::solidGreen);
aiDebugString.addCircle(m_aiShipController.getMoveToGoalPosition_w(), m_aiShipController.getLargestTurnRadius(), PackedRgb::solidGreen);
@@ -124,7 +124,7 @@ void ShipTurretTargetingSystem::onTargetLost(NetworkId const & target)
ShipObject * const shipObject = NON_NULL(NON_NULL(NON_NULL(m_shipController.getOwner())->asServerObject())->asShipObject());
if (!shipObject) // for release builds
{
WARNING(true,("Programmer bug: got a NULL ShipObject in ShipTurretTargetingSystem::onTargetLost(). May indicate that the ShipObject has already been partially deconstructed."));
WARNING(true,("Programmer bug: got a nullptr ShipObject in ShipTurretTargetingSystem::onTargetLost(). May indicate that the ShipObject has already been partially deconstructed."));
return;
}
@@ -168,7 +168,7 @@ bool ShipTurretTargetingSystem::buildTargetList()
bool result = false;
m_targetList->clear();
if (ownerShipController != NULL)
if (ownerShipController != nullptr)
{
if (!ownerShipController->getAttackTargetList().isEmpty())
{
@@ -86,7 +86,7 @@ void CollisionCallbacksNamespace::remove()
int CollisionCallbacksNamespace::convertObjectToIndex(Object * const object)
{
FATAL(!object, ("CollisionCallbacksNamespace::convertObjectToIndex: object == NULL."));
FATAL(!object, ("CollisionCallbacksNamespace::convertObjectToIndex: object == nullptr."));
ServerObject const * serverObject = object->asServerObject();
if (serverObject)
@@ -99,11 +99,11 @@ int CollisionCallbacksNamespace::convertObjectToIndex(Object * const object)
bool CollisionCallbacksNamespace::onHitDoCollisionWith(Object * const object, Object * const wasHitByThisObject)
{
DEBUG_WARNING(!object, ("CollisionCallbacksNamespace::onHitDoCollisionWith: Object == NULL"));
DEBUG_WARNING(!wasHitByThisObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: wasHitByThisObject == NULL"));
DEBUG_WARNING(!object, ("CollisionCallbacksNamespace::onHitDoCollisionWith: Object == nullptr"));
DEBUG_WARNING(!wasHitByThisObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: wasHitByThisObject == nullptr"));
ShipObject * shipObject = safe_cast<ShipObject *>(object);
DEBUG_WARNING(!shipObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: shipObject == NULL"));
DEBUG_WARNING(!shipObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: shipObject == nullptr"));
CollisionCallbackManager::Result result;
if (CollisionCallbackManager::intersectAndReflect(object, wasHitByThisObject, result))
@@ -123,10 +123,10 @@ bool CollisionCallbacksNamespace::onHitDoCollisionWith(Object * const object, Ob
bool CollisionCallbacksNamespace::onDoCollisionWithTerrain(Object * const object)
{
DEBUG_FATAL (!object, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: Object == NULL"));
DEBUG_FATAL (!object, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: Object == nullptr"));
ShipObject * shipObject = safe_cast<ShipObject *>(object);
DEBUG_FATAL (!shipObject, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: shipObject == NULL"));
DEBUG_FATAL (!shipObject, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: shipObject == nullptr"));
CollisionCallbackManager::Result result;
if (CollisionCallbackManager::intersectAndReflectWithTerrain(object, result))
File diff suppressed because it is too large Load Diff
@@ -309,11 +309,11 @@ void CommandQueue::executeCommandQueue()
{
CommandQueueEntry &entry = *(m_queue.begin());
// try to recover from having a null command
// try to recover from having a nullptr command
// maybe this should result in a fatal error?
if ( entry.m_command == 0 )
{
WARNING( true, ( "executeCommandQueue: entry.m_command was NULL! WTF?\n" ) );
WARNING( true, ( "executeCommandQueue: entry.m_command was nullptr! WTF?\n" ) );
m_queue.pop();
m_state = State_Waiting;
m_nextEventTime = 0.f;
@@ -387,7 +387,7 @@ void CommandQueue::executeCommandQueue()
// switch state might have removed elements from the queue and invalidated entry
// so we can't assume that we're still safe
if(!m_queue.empty() && (&(*(m_queue.begin())) == &entry) && m_queue.begin()->m_command != NULL)
if(!m_queue.empty() && (&(*(m_queue.begin())) == &entry) && m_queue.begin()->m_command != nullptr)
{
handleEntryRemoved(*(m_queue.begin()), true);
m_queue.pop();
@@ -458,7 +458,7 @@ void CommandQueue::updateClient(TimerClass timerClass )
{
CreatureObject * const creatureOwner = getServerOwner().asCreatureObject();
if ( (creatureOwner == NULL)
if ( (creatureOwner == nullptr)
|| !creatureOwner->getClient())
{
return;
@@ -475,7 +475,7 @@ void CommandQueue::updateClient(TimerClass timerClass )
if ( entry.m_command == 0 ) // woah that's bad news!
{
WARNING( true, ( "CommandQueue::updateClient(): command was NULL!\n" ) );
WARNING( true, ( "CommandQueue::updateClient(): command was nullptr!\n" ) );
return;
}
@@ -539,7 +539,7 @@ void CommandQueue::notifyClient()
{
CreatureObject * const creatureOwner = getServerOwner().asCreatureObject();
if ( (creatureOwner == NULL)
if ( (creatureOwner == nullptr)
|| !creatureOwner->getClient())
{
return;
@@ -555,7 +555,7 @@ void CommandQueue::notifyClient()
if ( entry.m_command == 0 )
{
WARNING( true, ( "CommandQueue::notifyClient(): command was NULL!\n" ) );
WARNING( true, ( "CommandQueue::notifyClient(): command was nullptr!\n" ) );
return;
}
@@ -612,7 +612,7 @@ bool CommandQueue::doWarmupTrigger(const CommandQueueEntry &entry )
CreatureObject * const creatureOwner = getServerOwner().asCreatureObject();
if (creatureOwner != NULL)
if (creatureOwner != nullptr)
{
creatureOwner->doWarmupChecks( *entry.m_command, entry.m_targetId, entry.m_params, m_status, m_statusDetail );
@@ -620,7 +620,7 @@ bool CommandQueue::doWarmupTrigger(const CommandQueueEntry &entry )
if ( m_status == Command::CEC_Success )
{
FATAL( entry.m_command == 0, ( "entry had a null command\n" ) );
FATAL( entry.m_command == 0, ( "entry had a nullptr command\n" ) );
std::vector<float> timeValues;
timeValues.push_back( entry.m_command->m_warmTime );
@@ -659,7 +659,7 @@ uint32 CommandQueue::getCurrentCommand() const
if ( entry.m_command == 0 )
{
WARNING( true, ( "CommandQueue::getCurrentCommand(): command was NULL!\n" ) );
WARNING( true, ( "CommandQueue::getCurrentCommand(): command was nullptr!\n" ) );
return 0;
}
@@ -680,7 +680,7 @@ void CommandQueue::switchState()
if ( entry.m_command == 0 )
{
WARNING( true, ( "CommandQueue::switchState(): command was NULL!\n" ) );
WARNING( true, ( "CommandQueue::switchState(): command was nullptr!\n" ) );
return;
}
@@ -726,7 +726,7 @@ void CommandQueue::switchState()
bool const targetIsAuthoritative = target && target->isAuthoritative();
REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_COMMAND: commandName=[%s] commandHash=[%lu] owner=[%s][%s][%s] target=[%s][%s][%s] sequenceId=[%lu] params=[%s] clearable=[%s] priority=[%d]\n",
entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "NULL",
entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "nullptr",
entryCopy.m_command ? entryCopy.m_command->m_commandHash : 0,
NameManager::getInstance().getPlayerName(getOwner().getNetworkId()).c_str(),
getOwner().getNetworkId().getValueString().c_str(),
@@ -746,7 +746,7 @@ void CommandQueue::switchState()
for (; itEntry != m_queue.end(); ++itEntry)
{
REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "NULL"));
REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "nullptr"));
}
}
#endif
@@ -838,7 +838,7 @@ void CommandQueue::switchState()
bool const targetIsAuthoritative = target && target->isAuthoritative();
REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_COMMAND: commandName=[%s] commandHash=[%lu] owner=[%s][%s][%s] target=[%s][%s][%s] sequenceId=[%lu] params=[%s] clearable=[%s] priority=[%d]\n",
entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "NULL",
entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "nullptr",
entryCopy.m_command ? entryCopy.m_command->m_commandHash : 0,
NameManager::getInstance().getPlayerName(getOwner().getNetworkId()).c_str(),
getOwner().getNetworkId().getValueString().c_str(),
@@ -858,7 +858,7 @@ void CommandQueue::switchState()
for (; itEntry != m_queue.end(); ++itEntry)
{
REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "NULL"));
REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "nullptr"));
}
}
#endif
@@ -1160,7 +1160,7 @@ void CommandQueue::notifyClientOfCommandRemoval(uint32 sequenceId, float waitTim
CreatureObject * const creatureOwner = getServerOwner().asCreatureObject();
if ( (creatureOwner != NULL)
if ( (creatureOwner != nullptr)
&& creatureOwner->getClient()
&& (sequenceId != 0))
{
@@ -1359,7 +1359,7 @@ void CommandQueue::executeCommand(Command const &command, NetworkId const &targe
CreatureObject * const creatureOwner = getServerOwner().asCreatureObject();
if (creatureOwner != NULL)
if (creatureOwner != nullptr)
{
CreatureController * const creatureController = creatureOwner->getCreatureController();
if (creatureController && creatureController->getSecureTrade())
@@ -1399,7 +1399,7 @@ void CommandQueue::executeCommand(Command const &command, NetworkId const &targe
TangibleObject * const tangibleOwner = getServerOwner().asTangibleObject();
if (tangibleOwner != NULL)
if (tangibleOwner != nullptr)
{
// Really execute the command - swap targets if necessary, and call
// forceExecuteCommand (which will handle messaging if not authoritative)
@@ -1440,7 +1440,7 @@ CommandQueue * CommandQueue::getCommandQueue(Object & object)
{
Property * const property = object.getProperty(getClassPropertyId());
return (property != NULL) ? (static_cast<CommandQueue *>(property)) : NULL;
return (property != nullptr) ? (static_cast<CommandQueue *>(property)) : nullptr;
}
// ----------------------------------------------------------------------
@@ -218,7 +218,7 @@ public:
void resetCooldowns();
// debug diagnostic
void spew(std::string * output = NULL);
void spew(std::string * output = nullptr);
private:
CommandQueue(CommandQueue const &);
@@ -201,7 +201,7 @@ namespace CommoditiesMarketNamespace
Container::ContainerErrorCode tmp = Container::CEC_Success;
ServerObject *bazaarContainer = auctionContainer.getBazaarContainer();
if (!bazaarContainer || !ContainerInterface::canTransferTo(bazaarContainer, item, NULL, tmp))
if (!bazaarContainer || !ContainerInterface::canTransferTo(bazaarContainer, item, nullptr, tmp))
{
errorCode = ar_INVALID_ITEM_ID;
}
@@ -326,7 +326,7 @@ bool CommoditiesMarketNamespace::isVendorItemRestriction(ServerObject const & it
return false;
}
ItemRestriction const * itemRestriction = NULL;
ItemRestriction const * itemRestriction = nullptr;
std::map<std::string, ItemRestriction>::const_iterator const iterFind = itemRestrictionList.find(itemRestrictionFile);
if (iterFind != itemRestrictionList.end())
@@ -1068,7 +1068,7 @@ void CommoditiesMarket::getCommoditiesServerConnection()
if (ObjectIdManager::hasAvailableObjectId())
{
s_market = new CommoditiesServerConnection(ConfigServerGame::getCommoditiesServerServiceBindInterface(), static_cast<unsigned short>(ConfigServerGame::getCommoditiesServerServiceBindPort()));
s_timeMarketConnectionCreated = ::time(NULL);
s_timeMarketConnectionCreated = ::time(nullptr);
}
}
@@ -1082,10 +1082,10 @@ int CommoditiesMarket::getCommoditiesServerConnectionAgeSeconds()
if (s_timeMarketConnectionCreated <= 0)
return 0;
if (s_market == NULL)
if (s_market == nullptr)
return 0;
return static_cast<int>(::time(NULL) - s_timeMarketConnectionCreated);
return static_cast<int>(::time(nullptr) - s_timeMarketConnectionCreated);
}
// ----------------------------------------------------------------------
@@ -1295,7 +1295,7 @@ void CommoditiesMarket::onAddAuction(int sequence, int32 result, const NetworkId
CreatureObject * const auctionCreator = dynamic_cast<CreatureObject*>(NetworkIdManager::getObjectById(auctionOwnerId));
ServerObject * const item = dynamic_cast<ServerObject*>(NetworkIdManager::getObjectById(itemId));
Client *client = NULL;
Client *client = nullptr;
if (auctionCreator)
client = auctionCreator->getClient();
@@ -1347,7 +1347,7 @@ void CommoditiesMarket::onAddAuction(int sequence, int32 result, const NetworkId
if (container)
{
Container::ContainerErrorCode tmp = Container::CEC_Success;
bool result = ContainerInterface::transferItemToVolumeContainer(*container,*item, NULL, tmp);
bool result = ContainerInterface::transferItemToVolumeContainer(*container,*item, nullptr, tmp);
if (!result)
{
LOG("CustomerService", ("Auction: Player %s transfer of item (%Ld) to auction container (%Ld) failed with code %d",
@@ -2536,7 +2536,7 @@ void CommoditiesMarket::checkPendingLoads(const NetworkId &itemId)
bool transferAllowed = true;
Container::ContainerErrorCode error = Container::CEC_Success;
transferAllowed = ContainerInterface::canTransferTo(targetContainer, *item, NULL, error);
transferAllowed = ContainerInterface::canTransferTo(targetContainer, *item, nullptr, error);
if (!transferAllowed)
{
@@ -2603,11 +2603,11 @@ void CommoditiesMarket::onGetItemReply(int32 result, int32 requestId, NetworkId
LOG("AuctionRetrieval", ("CommoditiesMarket::received onGetItemReply for loading object %s for retrieval", itemId.getValueString().c_str()));
AuctionResult auctionResult = ar_OK;
CreatureObject *player = dynamic_cast<CreatureObject*>(NetworkIdManager::getObjectById(itemOwnerId));
Client *client = player ? player->getClient() : NULL;
Client *client = player ? player->getClient() : nullptr;
bool transactionFailed = false;
ServerObject* vendor = NULL;
ServerObject* item = NULL;
ServerObject* vendor = nullptr;
ServerObject* item = nullptr;
if (result == ARC_AuctionDoesNotExist)
{
@@ -2637,7 +2637,7 @@ void CommoditiesMarket::onGetItemReply(int32 result, int32 requestId, NetworkId
vendor = safe_cast<ServerObject*>(ContainerInterface::getContainedByObject(*item));
if (vendor && vendor->getNetworkId() == location)
{
bool retval = ContainerInterface::transferItemToVolumeContainer(*inventory, *item, NULL, tmp, false);
bool retval = ContainerInterface::transferItemToVolumeContainer(*inventory, *item, nullptr, tmp, false);
if (retval)
{
@@ -2779,7 +2779,7 @@ void CommoditiesMarket::onIsVendorOwner(const NetworkId & requesterId, const Net
ServerObject * const auctionContainer = safe_cast<ServerObject*>(NetworkIdManager::getObjectById(container));
NetworkId resultContainer = container;
const TangibleObject * resultContainerObject = auctionContainer ? auctionContainer->asTangibleObject() : NULL;
const TangibleObject * resultContainerObject = auctionContainer ? auctionContainer->asTangibleObject() : nullptr;
if (auctionContainer)
{
marketName = getLocationString(*auctionContainer);
@@ -2952,7 +2952,7 @@ void CommoditiesMarket::onGetItemDetailsReply(int32 result, int32 requestId, Net
OutOfBandBase *base = *it;
if (!base)
{
WARNING(true, ("NULL OOB Base for Auction Data"));
WARNING(true, ("nullptr OOB Base for Auction Data"));
return;
}
if (base->getTypeId() == OutOfBandPackager::OT_auctionToken)
@@ -2979,7 +2979,7 @@ void CommoditiesMarket::onGetItemDetailsReply(int32 result, int32 requestId, Net
base = *it;
if (!base)
{
WARNING(true, ("NULL OOB Base for Auction Data"));
WARNING(true, ("nullptr OOB Base for Auction Data"));
return;
}
if (base->getTypeId() == OutOfBandPackager::OT_objectAttributes)
@@ -3624,22 +3624,22 @@ void CommoditiesMarket::updateItemTypeMap(int itemTypeMapVersionNumber, int item
// get the server template
const ObjectTemplate * ot = ObjectTemplateList::fetch(static_cast<uint32>(itemTemplateId));
if (ot != NULL)
if (ot != nullptr)
{
objectName = StringId(std::string(ot->getName()));
// get the shared template
const ServerObjectTemplate * serverOt = ot->asServerObjectTemplate();
if (serverOt != NULL)
if (serverOt != nullptr)
{
const std::string sharedTemplateName(serverOt->getSharedTemplate());
serverOt->releaseReference();
serverOt = NULL;
serverOt = nullptr;
ot = ObjectTemplateList::fetch(sharedTemplateName);
if (ot != NULL)
if (ot != nullptr)
{
const SharedObjectTemplate * sharedOt = ot->asSharedObjectTemplate();
if (sharedOt != NULL)
if (sharedOt != nullptr)
{
gameObjectType = static_cast<int>(sharedOt->getGameObjectType());
StringId const tempObjectName(objectName);
@@ -3649,19 +3649,19 @@ void CommoditiesMarket::updateItemTypeMap(int itemTypeMapVersionNumber, int item
objectName = tempObjectName;
}
sharedOt->releaseReference();
sharedOt = NULL;
sharedOt = nullptr;
}
else
{
ot->releaseReference();
ot = NULL;
ot = nullptr;
}
}
}
else
{
ot->releaseReference();
ot = NULL;
ot = nullptr;
}
}
else
@@ -576,7 +576,7 @@ void CommoditiesServerConnection::onReceive(const Archive::ByteStream & message)
ScriptDictionaryPtr dictionary;
GameScriptObject::makeScriptDictionary(params, dictionary);
if (dictionary.get() != NULL)
if (dictionary.get() != nullptr)
{
dictionary->serialize();
MessageToQueue::getInstance().sendMessageToJava(response.getValue().first.first,
@@ -74,7 +74,7 @@ CreatureObject * const ConsoleCommandParserAiNamespace::getAiCreatureObject(Crea
CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId);
if ( (aiCreatureObject == NULL)
if ( (aiCreatureObject == nullptr)
|| aiCreatureObject->isPlayerControlled())
{
Chat::sendSystemMessage(user, Unicode::narrowToWide(FormattedString<1024>().sprintf("[FAILURE] Unable to resolve %s to an AI", aiNetworkId.getValueString().c_str())), Unicode::emptyString);
@@ -113,7 +113,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
{
CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId);
if (userCreatureObject == NULL)
if (userCreatureObject == nullptr)
{
result += getErrorMessage(argv[0], ERR_FAIL);
}
@@ -121,7 +121,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
{
CreatureObject * const aiCreatureObject = getAiCreatureObject(*userCreatureObject, argv);
if (aiCreatureObject == NULL)
if (aiCreatureObject == nullptr)
{
result += getErrorMessage(argv[0], ERR_FAIL);
}
@@ -129,7 +129,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
{
AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController());
if (aiCreatureController == NULL)
if (aiCreatureController == nullptr)
{
Chat::sendSystemMessage(*userCreatureObject, Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI", aiCreatureObject->getNetworkId().getValueString().c_str())), Unicode::emptyString);
result += getErrorMessage(argv[0], ERR_FAIL);
@@ -148,7 +148,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
{
CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId);
if (userCreatureObject == NULL)
if (userCreatureObject == nullptr)
{
result += getErrorMessage(argv[0], ERR_FAIL);
}
@@ -167,7 +167,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
AICreatureController * const aiCreatureController = AICreatureController::getAiCreatureController(targetNetworkId);
if (aiCreatureController == NULL)
if (aiCreatureController == nullptr)
{
result = Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI\n", targetNetworkId.getValueString().c_str()));
result += getErrorMessage(argv[0], ERR_FAIL);
@@ -190,7 +190,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
{
CellProperty const * const cellProperty = creatureOwner->getParentCell();
if (cellProperty != NULL)
if (cellProperty != nullptr)
{
Vector const & position_p = creatureOwner->getPosition_p();
@@ -245,13 +245,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject());
float const hate = iterHateList->second;
std::string hateTargetName;
if (hateTargetTangibleObject != NULL)
if (hateTargetTangibleObject != nullptr)
{
hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str();
}
else
{
hateTargetName = "NULL";
hateTargetName = "nullptr";
}
result += Unicode::narrowToWide(fs.sprintf("%s:%s(%.1f)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), hate));
@@ -271,13 +271,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
CachedNetworkId const hateTarget(iter->first);
TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject());
std::string hateTargetName;
if (hateTargetTangibleObject != NULL)
if (hateTargetTangibleObject != nullptr)
{
hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str();
}
else
{
hateTargetName = "NULL";
hateTargetName = "nullptr";
}
result += Unicode::narrowToWide(fs.sprintf("%s:%s (%.2f, %lu, %lu)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), iter->second.first, iter->second.second.first, iter->second.second.second));
@@ -295,7 +295,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
{
CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId);
if (userCreatureObject == NULL)
if (userCreatureObject == nullptr)
{
result += getErrorMessage(argv[0], ERR_FAIL);
}
@@ -313,7 +313,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
}
TangibleObject const * const to = TangibleObject::asTangibleObject(NetworkIdManager::getObjectById(targetNetworkId));
if (to == NULL)
if (to == nullptr)
{
result += Unicode::narrowToWide(fs.sprintf("Target %s not found or not TangibleObject\n", targetNetworkId.getValueString().c_str()));
}
@@ -342,13 +342,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject());
float const hate = iterHateList->second;
std::string hateTargetName;
if (hateTargetTangibleObject != NULL)
if (hateTargetTangibleObject != nullptr)
{
hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str();
}
else
{
hateTargetName = "NULL";
hateTargetName = "nullptr";
}
result += Unicode::narrowToWide(fs.sprintf("%s:%s(%.1f)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), hate));
@@ -368,13 +368,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
CachedNetworkId const hateTarget(iter->first);
TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject());
std::string hateTargetName;
if (hateTargetTangibleObject != NULL)
if (hateTargetTangibleObject != nullptr)
{
hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str();
}
else
{
hateTargetName = "NULL";
hateTargetName = "nullptr";
}
result += Unicode::narrowToWide(fs.sprintf("%s:%s (%.2f, %lu, %lu)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), iter->second.first, iter->second.second.first, iter->second.second.second));
@@ -390,7 +390,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
{
CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId);
if (userCreatureObject == NULL)
if (userCreatureObject == nullptr)
{
result += getErrorMessage(argv[0], ERR_FAIL);
}
@@ -398,7 +398,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
{
CreatureObject * const aiCreatureObject = getAiCreatureObject(*userCreatureObject, argv);
if (aiCreatureObject == NULL)
if (aiCreatureObject == nullptr)
{
result += getErrorMessage(argv[0], ERR_FAIL);
}
@@ -416,7 +416,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
{
CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId);
if (userCreatureObject == NULL)
if (userCreatureObject == nullptr)
{
result += getErrorMessage(argv[0], ERR_FAIL);
}
@@ -424,7 +424,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
{
CreatureObject * const aiCreatureObject = getAiCreatureObject(*userCreatureObject, argv);
if (aiCreatureObject == NULL)
if (aiCreatureObject == nullptr)
{
result += getErrorMessage(argv[0], ERR_FAIL);
}
@@ -442,14 +442,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
{
CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId);
if (userCreatureObject == NULL)
if (userCreatureObject == nullptr)
{
result += getErrorMessage(argv[0], ERR_FAIL);
}
else
{
NetworkId aiNetworkId;
CreatureObject * aiCreatureObject = NULL;
CreatureObject * aiCreatureObject = nullptr;
if (argv.size() > 2)
{
@@ -458,7 +458,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
aiNetworkId = NetworkId(Unicode::wideToNarrow(argv[1]));
aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId);
if ( (aiCreatureObject != NULL)
if ( (aiCreatureObject != nullptr)
&& !aiCreatureObject->isPlayerControlled())
{
aiCreatureObject->setBaseWalkSpeed(Unicode::toFloat(argv[2]));
@@ -471,14 +471,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
aiNetworkId = userCreatureObject->getLookAtTarget();
aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId);
if ( (aiCreatureObject != NULL)
if ( (aiCreatureObject != nullptr)
&& !aiCreatureObject->isPlayerControlled())
{
aiCreatureObject->setBaseWalkSpeed(Unicode::toFloat(argv[1]));
}
}
if ( (aiCreatureObject == NULL)
if ( (aiCreatureObject == nullptr)
|| aiCreatureObject->isPlayerControlled())
{
Chat::sendSystemMessage(*userCreatureObject, Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI", aiNetworkId.getValueString().c_str())), Unicode::emptyString);
@@ -495,14 +495,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
{
CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId);
if (userCreatureObject == NULL)
if (userCreatureObject == nullptr)
{
result += getErrorMessage(argv[0], ERR_FAIL);
}
else
{
NetworkId aiNetworkId;
CreatureObject * aiCreatureObject = NULL;
CreatureObject * aiCreatureObject = nullptr;
if (argv.size() > 2)
{
@@ -511,7 +511,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
aiNetworkId = NetworkId(Unicode::wideToNarrow(argv[1]));
aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId);
if ( (aiCreatureObject != NULL)
if ( (aiCreatureObject != nullptr)
&& !aiCreatureObject->isPlayerControlled())
{
aiCreatureObject->setBaseRunSpeed(Unicode::toFloat(argv[2]));
@@ -524,14 +524,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
aiNetworkId = userCreatureObject->getLookAtTarget();
aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId);
if ( (aiCreatureObject != NULL)
if ( (aiCreatureObject != nullptr)
&& !aiCreatureObject->isPlayerControlled())
{
aiCreatureObject->setBaseRunSpeed(Unicode::toFloat(argv[1]));
}
}
if ( (aiCreatureObject == NULL)
if ( (aiCreatureObject == nullptr)
|| aiCreatureObject->isPlayerControlled())
{
Chat::sendSystemMessage(*userCreatureObject, Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI", aiNetworkId.getValueString().c_str())), Unicode::emptyString);
@@ -549,7 +549,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
{
CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId);
if (userCreatureObject != NULL)
if (userCreatureObject != nullptr)
{
NetworkId sparedAiNetworkId;
@@ -573,9 +573,9 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
for (int i = 0; i < serverObjectCount; ++i)
{
ServerObject * const serverObject = ServerWorld::getObject(i);
CreatureObject * const creatureObject = (serverObject != NULL) ? serverObject->asCreatureObject() : NULL;
CreatureObject * const creatureObject = (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr;
if ( (creatureObject != NULL)
if ( (creatureObject != nullptr)
&& !creatureObject->isDead()
&& !creatureObject->isPlayerControlled()
&& (creatureObject->getNetworkId() != sparedAiNetworkId))
@@ -597,10 +597,10 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
else if (isAbbrev(argv[0], "debug"))
{
Object * const object = NetworkIdManager::getObjectById(userId);
ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL;
ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr;
int temp;
if (serverObject != NULL)
if (serverObject != nullptr)
{
if ( serverObject->getObjVars().getItem("ai_debug_string", temp)
&& (temp > 0))
@@ -621,7 +621,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
Client * const client = serverObject->getClient();
if (client != NULL)
if (client != nullptr)
{
AiDebugString aiDebugString;
aiDebugString.enableClearClientFlag();
@@ -650,9 +650,9 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri
else if (isAbbrev(argv[0], "debugText"))
{
Object * const object = NetworkIdManager::getObjectById(userId);
ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL;
ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr;
if (serverObject != NULL)
if (serverObject != nullptr)
{
AiDebugString::setTextEnabled(!AiDebugString::isTextEnabled());
@@ -415,7 +415,7 @@ bool ConsoleCommandParserCity::performParsing (const NetworkId & userId, const S
}
else
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[3]).c_str()) - 1;
@@ -63,21 +63,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject * c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -172,21 +172,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject * c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -249,21 +249,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject * c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -326,21 +326,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject * c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -403,21 +403,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject * c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -466,21 +466,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject * c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -529,21 +529,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject * c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -592,21 +592,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject * c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -719,21 +719,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject * c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -776,7 +776,7 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c
else if (isCommand (argv [0], "setServerFirstTime"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[3]).c_str()) - 1;
@@ -151,7 +151,7 @@ bool ConsoleCommandParserCraft::performParsing (const NetworkId & userId, const
else if (isAbbrev( argv [0], "enableSchematicFilter"))
{
if (creatureObject->getClient() == NULL || !creatureObject->getClient()->isGod())
if (creatureObject->getClient() == nullptr || !creatureObject->getClient()->isGod())
result += getErrorMessage (argv[0], ERR_FAIL);
else
{
@@ -164,7 +164,7 @@ bool ConsoleCommandParserCraft::performParsing (const NetworkId & userId, const
else if (isAbbrev( argv [0], "disableSchematicFilter"))
{
if (creatureObject->getClient() == NULL || !creatureObject->getClient()->isGod())
if (creatureObject->getClient() == nullptr || !creatureObject->getClient()->isGod())
result += getErrorMessage (argv[0], ERR_FAIL);
else
{
@@ -53,19 +53,19 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId,
{
/* // get the station
TangibleObject * station = getStation(argv, result);
if (station == NULL)
if (station == nullptr)
return true;
// get the ingredient
NetworkId ingredientId(Unicode::wideToNarrow (argv[2]));
ServerObject * object = ServerWorld::findObjectByNetworkId(ingredientId);
if (object == NULL)
if (object == nullptr)
{
result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT);
return true;
}
TangibleObject * ingredient = dynamic_cast<TangibleObject *>(object);
if (ingredient == NULL)
if (ingredient == nullptr)
{
result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT);
return true;
@@ -82,19 +82,19 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId,
{
/* // get the station
TangibleObject * station = getStation(argv, result);
if (station == NULL)
if (station == nullptr)
return true;
// get the ingredient
NetworkId ingredientId(Unicode::wideToNarrow (argv[2]));
ServerObject * object = ServerWorld::findObjectByNetworkId(ingredientId);
if (object == NULL)
if (object == nullptr)
{
result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT);
return true;
}
TangibleObject * ingredient = dynamic_cast<TangibleObject *>(object);
if (ingredient == NULL)
if (ingredient == nullptr)
{
result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT);
return true;
@@ -112,13 +112,13 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId,
/* // get the station
NetworkId id(Unicode::wideToNarrow (argv[1]));
ServerObject * object = ServerWorld::findObjectByNetworkId(id);
if (object == NULL)
if (object == nullptr)
{
result += getErrorMessage (argv [0], ERR_INVALID_OBJECT);
return true;
}
TangibleObject * station = dynamic_cast<TangibleObject *>(object);
if (station == NULL)
if (station == nullptr)
{
result += getErrorMessage (argv [0], ERR_INVALID_OBJECT);
return true;
@@ -144,33 +144,33 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId,
/**
* Finds the crafting station for a given id.
*
* @return the station or NULL on error
* @return the station or nullptr on error
*/
TangibleObject * ConsoleCommandParserCraftStation::getStation(const StringVector_t & argv, String_t & result)
{
NetworkId id(Unicode::wideToNarrow (argv[1]));
ServerObject * object = ServerWorld::findObjectByNetworkId(id);
if (object == NULL)
if (object == nullptr)
{
result += getErrorMessage (argv [0], ERR_INVALID_OBJECT);
return NULL;
return nullptr;
}
TangibleObject * station = dynamic_cast<TangibleObject *>(object);
if (station == NULL)
if (station == nullptr)
{
result += getErrorMessage (argv [0], ERR_INVALID_OBJECT);
return NULL;
return nullptr;
}
// make sure the station is a atation and that it isn't in use
if (!station->getObjVars().hasItem("crafting.station"))
{
result += getErrorMessage (argv [0], ERR_INVALID_STATION);
return NULL;
return nullptr;
}
if (station->getObjVars().hasItem("crafting.crafter"))
{
result += getErrorMessage (argv [0], ERR_STATION_IN_USE);
return NULL;
return nullptr;
}
return station;
} // ConsoleCommandParserCraftStation::getStation
@@ -1218,17 +1218,17 @@ bool ConsoleCommandParserGuild::performParsing (const NetworkId & userId, const
{
// new guild leader is not a guild member, so make a guild member first, then make guild leader
ServerObject const* o = dynamic_cast<ServerObject const*>(ServerWorld::findObjectByNetworkId(leaderOid));
CreatureObject const* c = (o ? o->asCreatureObject() : NULL);
PlayerObject const* p = (c ? PlayerCreatureController::getPlayerObject(c) : NULL);
if (o == NULL)
CreatureObject const* c = (o ? o->asCreatureObject() : nullptr);
PlayerObject const* p = (c ? PlayerCreatureController::getPlayerObject(c) : nullptr);
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
}
else if (c == NULL)
else if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
}
else if (p == NULL)
else if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
}
@@ -64,7 +64,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
ManufactureInstallationObject * station = dynamic_cast<ManufactureInstallationObject *>(stationId.getObject());
ServerObject * ingredient = safe_cast<ServerObject *>(ingredientId.getObject());
if (station == NULL || ingredient == NULL)
if (station == nullptr || ingredient == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -77,7 +77,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
}
ServerObject * hopper = station->getInputHopper();
if (hopper == NULL)
if (hopper == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -99,7 +99,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
ManufactureInstallationObject * station = dynamic_cast<ManufactureInstallationObject *>(stationId.getObject());
ServerObject * ingredient = safe_cast<ServerObject *>(ingredientId.getObject());
if (station == NULL || ingredient == NULL)
if (station == nullptr || ingredient == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -112,7 +112,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
}
ServerObject * hopper = station->getInputHopper();
if (hopper == NULL)
if (hopper == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -124,7 +124,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
return true;
}
if (playerObject->getInventory() == NULL)
if (playerObject->getInventory() == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -144,7 +144,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
ManufactureInstallationObject * station = dynamic_cast<ManufactureInstallationObject *>(stationId.getObject());
if (station == NULL)
if (station == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -157,14 +157,14 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
}
ServerObject * hopper = station->getInputHopper();
if (hopper == NULL)
if (hopper == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
VolumeContainer * container = ContainerInterface::getVolumeContainer(*hopper);
if (container == NULL)
if (container == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -174,7 +174,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
while (iter != container->end())
{
const Container::ContainedItem & itemId = *iter;
if (itemId.getObject() != NULL)
if (itemId.getObject() != nullptr)
{
const ServerObject * item = safe_cast<const ServerObject *>(itemId.getObject());
result += Unicode::narrowToWide("(");
@@ -182,7 +182,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
result += Unicode::narrowToWide(") - ");
const ResourceContainerObject * crate = dynamic_cast<
const ResourceContainerObject *>(item);
if (crate != NULL)
if (crate != nullptr)
{
char buffer[32];
_itoa(crate->getQuantity(), buffer, 10);
@@ -226,7 +226,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
ManufactureInstallationObject * station = dynamic_cast<ManufactureInstallationObject *>(stationId.getObject());
ManufactureSchematicObject * schematic = dynamic_cast<ManufactureSchematicObject *>(schematicId.getObject());
if (station == NULL || schematic == NULL)
if (station == nullptr || schematic == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -239,7 +239,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
}
// if (station->addSchematic(*schematic, playerObject))
if (station->addSchematic(*schematic, NULL))
if (station->addSchematic(*schematic, nullptr))
result += getErrorMessage(argv[0], ERR_SUCCESS);
else
result += getErrorMessage(argv[0], ERR_INVALID_CONTAINER_TRANSFER);
@@ -253,7 +253,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
ManufactureInstallationObject * station = dynamic_cast<ManufactureInstallationObject *>(stationId.getObject());
if (station == NULL)
if (station == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -266,9 +266,9 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
}
ManufactureSchematicObject * schematic = station->getSchematic();
if (schematic != NULL)
if (schematic != nullptr)
{
if (playerObject->getDatapad() == NULL)
if (playerObject->getDatapad() == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -291,7 +291,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
ManufactureInstallationObject * station = dynamic_cast<ManufactureInstallationObject *>(stationId.getObject());
if (station == NULL)
if (station == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -304,7 +304,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
}
ManufactureSchematicObject * schematic = station->getSchematic();
if (schematic != NULL)
if (schematic != nullptr)
{
result += Unicode::narrowToWide("(");
result += Unicode::narrowToWide(schematic->getNetworkId().getValueString());
@@ -325,7 +325,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
ManufactureInstallationObject * station = dynamic_cast<ManufactureInstallationObject *>(stationId.getObject());
if (station == NULL)
if (station == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
}
@@ -344,7 +344,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
ManufactureInstallationObject * station = dynamic_cast<ManufactureInstallationObject *>(stationId.getObject());
if (station == NULL)
if (station == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
}
@@ -360,7 +360,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
else if (isAbbrev( argv [0], "getObjects"))
{
ServerObject * myInventory = playerObject->getInventory();
if (myInventory == NULL)
if (myInventory == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -370,21 +370,21 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
ManufactureInstallationObject * station = dynamic_cast<ManufactureInstallationObject *>(stationId.getObject());
if (station == NULL)
if (station == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
ServerObject * hopper = station->getOutputHopper();
if (hopper == NULL)
if (hopper == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
VolumeContainer * container = ContainerInterface::getVolumeContainer(*hopper);
if (container == NULL)
if (container == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -394,7 +394,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
while (iter != container->end())
{
const Container::ContainedItem & itemId = *iter;
if (itemId.getObject() != NULL)
if (itemId.getObject() != nullptr)
{
ContainerInterface::transferItemToVolumeContainer (*myInventory, *safe_cast<ServerObject *>(itemId.getObject()), playerObject, tmp);
}
@@ -419,21 +419,21 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
ManufactureInstallationObject * station = dynamic_cast<ManufactureInstallationObject *>(stationId.getObject());
if (station == NULL)
if (station == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
ServerObject * hopper = station->getOutputHopper();
if (hopper == NULL)
if (hopper == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
VolumeContainer * container = ContainerInterface::getVolumeContainer(*hopper);
if (container == NULL)
if (container == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -443,7 +443,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId,
while (iter != container->end())
{
const Container::ContainedItem & itemId = *iter;
if (itemId.getObject() != NULL)
if (itemId.getObject() != nullptr)
{
const ServerObject * item = safe_cast<const ServerObject *>(itemId.getObject());
result += Unicode::narrowToWide("(");
@@ -58,7 +58,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const
{
NetworkId sourceId(Unicode::wideToNarrow (argv[1]));
NetworkId targetId(Unicode::wideToNarrow (argv[2]));
int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10));
int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10));
ServerObject* source = dynamic_cast<ServerObject*>(NetworkIdManager::getObjectById(sourceId));
if (!source)
@@ -75,7 +75,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const
{
NetworkId sourceId(Unicode::wideToNarrow (argv[1]));
NetworkId targetId(Unicode::wideToNarrow (argv[2]));
int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10));
int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10));
ServerObject* source = dynamic_cast<ServerObject*>(NetworkIdManager::getObjectById(sourceId));
if (!source)
@@ -91,7 +91,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const
else if (isAbbrev( argv [0], "namedTransfer"))
{
NetworkId sourceId(Unicode::wideToNarrow (argv[1]));
int amount(strtol(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10));
int amount(strtol(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10));
ServerObject* source = dynamic_cast<ServerObject*>(NetworkIdManager::getObjectById(sourceId));
if (!source)
@@ -117,7 +117,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const
else if (isAbbrev( argv [0], "withdraw"))
{
NetworkId sourceId(Unicode::wideToNarrow (argv[1]));
int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), NULL, 10));
int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), nullptr, 10));
ServerObject* source = dynamic_cast<ServerObject*>(NetworkIdManager::getObjectById(sourceId));
if (!source)
@@ -133,7 +133,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const
else if (isAbbrev( argv [0], "deposit"))
{
NetworkId sourceId(Unicode::wideToNarrow (argv[1]));
int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), NULL, 10));
int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), nullptr, 10));
ServerObject* source = dynamic_cast<ServerObject*>(NetworkIdManager::getObjectById(sourceId));
if (!source)
@@ -175,7 +175,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const
}
else if (isAbbrev( argv [0], "setGalacticReserve"))
{
int const newGalacticReserve(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), NULL, 10));
int const newGalacticReserve(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), nullptr, 10));
if ((newGalacticReserve < 0) || (newGalacticReserve > ConfigServerGame::getMaxGalacticReserveDepositBillion()))
{
result += Unicode::narrowToWide(FormattedString<1024>().sprintf("specified galactic reserve balance (%d) must be in the (inclusive) range (0, %d)\n", newGalacticReserve, ConfigServerGame::getMaxGalacticReserveDepositBillion()));
@@ -52,19 +52,19 @@ bool ConsoleCommandParserNpc::performParsing (const NetworkId & userId, const St
NetworkId const oid(Unicode::wideToNarrow(argv[1]));
ServerObject * const object = ServerWorld::findObjectByNetworkId(oid);
if (object == NULL)
if (object == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
TangibleObject * const npc = object->asTangibleObject();
if (npc == NULL)
if (npc == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
playerObject->startNpcConversation(*npc, NULL, NpcConversationData::CS_Player, 0);
playerObject->startNpcConversation(*npc, nullptr, NpcConversationData::CS_Player, 0);
result += getErrorMessage (argv[0], ERR_SUCCESS);
}
@@ -82,7 +82,7 @@ bool ConsoleCommandParserNpc::performParsing (const NetworkId & userId, const St
else if (isAbbrev( argv [0], "respond"))
{
TangibleObject * const playerObject = safe_cast<TangibleObject *>(ServerWorld::findObjectByNetworkId(userId));
int const response = strtol(Unicode::wideToNarrow(argv[1]).c_str (), NULL, 10);
int const response = strtol(Unicode::wideToNarrow(argv[1]).c_str (), nullptr, 10);
playerObject->respondToNpc(response);
result += getErrorMessage (argv[0], ERR_SUCCESS);
}
@@ -119,23 +119,23 @@ namespace ConsoleCommandParserObjectNamespace
{
WARNING(true, ("ConsoleCommandParserObject invalid object template [%s]", templateName.c_str()));
ot->releaseReference();
return NULL;
return nullptr;
}
if (sot->getId() == ServerShipObjectTemplate::ServerShipObjectTemplate_tag)
{
SharedObjectTemplate const * const sharedTemplate = safe_cast<SharedObjectTemplate const *>(ObjectTemplateList::fetch(sot->getSharedTemplate()));
if (NULL == sharedTemplate ||
if (nullptr == sharedTemplate ||
(sharedTemplate->getGameObjectType() != SharedObjectTemplate::GOT_ship_mining_asteroid_dynamic &&
sharedTemplate->getGameObjectType() != SharedObjectTemplate::GOT_ship_mining_asteroid_static))
{
ot->releaseReference();
return NULL;
return nullptr;
}
}
return sot;
}
return NULL;
return nullptr;
}
void checkBadBuildClusterObject(ServerObject *& o)
@@ -523,7 +523,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject const * const obj = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (obj == NULL)
if (obj == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -531,7 +531,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
Client const * const client = obj->getClient();
if(client == NULL)
if(client == nullptr)
{
result += Unicode::narrowToWide("specified object is not a client object\n");
return true;
@@ -561,7 +561,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
}
const char *objectTemplateName = obj->getObjectTemplateName();
result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total opened objects\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "NULL object template"), opened.size()));
result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total opened objects\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "nullptr object template"), opened.size()));
if(!text.empty())
{
@@ -615,7 +615,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
ServerObject * const object = dynamic_cast<ServerObject *>(NetworkIdManager::getObjectById(oid));
if (object)
{
uint32 const pid = (strtoul(Unicode::wideToNarrow(argv[2]).c_str (), NULL, 10));
uint32 const pid = (strtoul(Unicode::wideToNarrow(argv[2]).c_str (), nullptr, 10));
GenericValueTypeMessage<std::pair<NetworkId, uint32> > const msg(
"RequestAuthTransfer",
std::make_pair(
@@ -646,9 +646,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
}
real x,y,z;
x = static_cast<real>(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL));
y = static_cast<real>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL));
z = static_cast<real>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL));
x = static_cast<real>(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr));
y = static_cast<real>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr));
z = static_cast<real>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr));
ServerObject *newObject = 0;
ServerObjectTemplate const * const ot = getObjectTemplateForCreation(tmpString);
@@ -706,9 +706,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
}
real x,y,z;
x = static_cast<real>(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL));
y = static_cast<real>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL));
z = static_cast<real>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL));
x = static_cast<real>(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr));
y = static_cast<real>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr));
z = static_cast<real>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr));
// check to see if we're in a region we shouldn't be building in
if ( ConfigServerGame::getBlockBuildRegionPlacement() )
@@ -726,10 +726,10 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
}
real quatW,quatX,quatY,quatZ;
quatW = static_cast<real>(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL));
quatX = static_cast<real>(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL));
quatY = static_cast<real>(strtod(Unicode::wideToNarrow(argv[7]).c_str(), NULL));
quatZ = static_cast<real>(strtod(Unicode::wideToNarrow(argv[8]).c_str(), NULL));
quatW = static_cast<real>(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr));
quatX = static_cast<real>(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr));
quatY = static_cast<real>(strtod(Unicode::wideToNarrow(argv[7]).c_str(), nullptr));
quatZ = static_cast<real>(strtod(Unicode::wideToNarrow(argv[8]).c_str(), nullptr));
ServerObject * const cell = safe_cast<ServerObject *>(ContainerInterface::getContainingCellObject(*playerObject));
@@ -934,7 +934,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
NetworkId oid(Unicode::wideToNarrow(argv[2]));
ServerObject* object = dynamic_cast<ServerObject*>(NetworkIdManager::getObjectById(oid));
if (object == NULL)
if (object == nullptr)
{
//container does not exist
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
@@ -994,7 +994,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId cellId(Unicode::wideToNarrow(argv[2]));
ServerObject* cell = dynamic_cast<ServerObject*>(NetworkIdManager::getObjectById(cellId));
if (cell == NULL && cellId != NetworkId::cms_invalid)
if (cell == nullptr && cellId != NetworkId::cms_invalid)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -1011,9 +1011,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
}
real x,y,z;
x = static_cast<real>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL));
y = static_cast<real>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL));
z = static_cast<real>(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL));
x = static_cast<real>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr));
y = static_cast<real>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr));
z = static_cast<real>(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr));
ServerObject *newObject = 0;
ServerObjectTemplate const * const ot = getObjectTemplateForCreation(tmpString);
@@ -1070,22 +1070,22 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
NetworkId cellId(Unicode::wideToNarrow(argv[2]));
ServerObject * const cell = safe_cast<ServerObject *>(NetworkIdManager::getObjectById(cellId));
if (cell == NULL && cellId != NetworkId::cms_invalid)
if (cell == nullptr && cellId != NetworkId::cms_invalid)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
real x,y,z;
x = static_cast<real>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL));
y = static_cast<real>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL));
z = static_cast<real>(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL));
x = static_cast<real>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr));
y = static_cast<real>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr));
z = static_cast<real>(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr));
real quatW,quatX,quatY,quatZ;
quatW = static_cast<real>(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL));
quatX = static_cast<real>(strtod(Unicode::wideToNarrow(argv[7]).c_str(), NULL));
quatY = static_cast<real>(strtod(Unicode::wideToNarrow(argv[8]).c_str(), NULL));
quatZ = static_cast<real>(strtod(Unicode::wideToNarrow(argv[9]).c_str(), NULL));
quatW = static_cast<real>(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr));
quatX = static_cast<real>(strtod(Unicode::wideToNarrow(argv[7]).c_str(), nullptr));
quatY = static_cast<real>(strtod(Unicode::wideToNarrow(argv[8]).c_str(), nullptr));
quatZ = static_cast<real>(strtod(Unicode::wideToNarrow(argv[9]).c_str(), nullptr));
ServerObject *newObject = 0;
ServerObjectTemplate const * const ot = getObjectTemplateForCreation(tmpString);
@@ -1165,7 +1165,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject* object = dynamic_cast<ServerObject*>(NetworkIdManager::getObjectById(oid));
if (object == NULL)
if (object == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -1200,7 +1200,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject* object = dynamic_cast<ServerObject*>(NetworkIdManager::getObjectById(oid));
if (object == NULL)
if (object == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -1236,7 +1236,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
const NetworkId oid (Unicode::wideToNarrow(argv[1]));
ServerObject* const object = safe_cast<ServerObject*>(NetworkIdManager::getObjectById(oid));
if (object == NULL)
if (object == nullptr)
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
else if (object->getClient())
result += getErrorMessage(argv[0], ERR_INVALID_USER);
@@ -1268,7 +1268,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
ServerObject* const object = safe_cast<ServerObject*>(NetworkIdManager::getObjectById(oid));
if (object == NULL)
if (object == nullptr)
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
// ----------
@@ -1279,11 +1279,11 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
ServerObject * object = ServerWorld::getObject(i);
if(object == NULL) continue;
if(object == nullptr) continue;
CreatureObject * creature = object->asCreatureObject();
if(creature == NULL) continue;
if(creature == nullptr) continue;
if(creature->getNetworkId() == oid) continue;
@@ -1307,11 +1307,11 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
ServerObject * object = ServerWorld::getObject(i);
if(object == NULL) continue;
if(object == nullptr) continue;
CreatureObject * creature = object->asCreatureObject();
if(creature == NULL) continue;
if(creature == nullptr) continue;
if(creature->getParentCell() != CellProperty::getWorldCellProperty()) continue;
@@ -1331,9 +1331,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
Vector pos;
pos.x = static_cast<real>(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL));
pos.y = static_cast<real>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL));
pos.z = static_cast<real>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL));
pos.x = static_cast<real>(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr));
pos.y = static_cast<real>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr));
pos.z = static_cast<real>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr));
// disallow certain object types from being "move"
bool allowMove = true;
@@ -1418,7 +1418,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject* o = ServerWorld::findObjectByNetworkId(oid);
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -1433,9 +1433,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
real r,p,y;
r = static_cast<real>(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL));
p = static_cast<real>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL));
y = static_cast<real>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL));
r = static_cast<real>(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr));
p = static_cast<real>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr));
y = static_cast<real>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr));
if (rotateObject(oid, r, p, y))
{
result += getErrorMessage(argv[0], ERR_SUCCESS);
@@ -1450,7 +1450,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject* o = ServerWorld::findObjectByNetworkId(oid);
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -1479,7 +1479,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
// erase keys assigned to this player.
s_playerCreatureNameMap.erase(userId);
if (dataTable != NULL)
if (dataTable != nullptr)
{
StringVector creatureStrings;
{
@@ -1548,7 +1548,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId const oid(Unicode::wideToNarrow(argv[1]));
ServerObject* const o = ServerWorld::findObjectByNetworkId(oid);
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -1580,7 +1580,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
o->deletePobPersistedContents(NULL, DeleteReasons::God);
o->deletePobPersistedContents(nullptr, DeleteReasons::God);
result += getErrorMessage(argv[0], ERR_SUCCESS);
}
else if (isCommand( argv[0], "moveItemInHouseToMe"))
@@ -1607,7 +1607,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
TangibleObject* vendor = dynamic_cast<TangibleObject*>(ServerWorld::findObjectByNetworkId(oid));
if (vendor == NULL)
if (vendor == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -1621,7 +1621,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
TangibleObject* vendor = dynamic_cast<TangibleObject*>(ServerWorld::findObjectByNetworkId(oid));
if (vendor == NULL)
if (vendor == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -1699,13 +1699,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
CreatureObject* o = dynamic_cast<CreatureObject*>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
real scale;
scale = static_cast<real>(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL));
scale = static_cast<real>(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr));
o->setMovementScale(scale);
result += getErrorMessage(argv[0], ERR_SUCCESS);
}
@@ -1716,13 +1716,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
CreatureObject* o = dynamic_cast<CreatureObject*>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
real scale;
scale = static_cast<real>(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL));
scale = static_cast<real>(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr));
o->setScaleFactor(scale);
result += getErrorMessage(argv[0], ERR_SUCCESS);
}
@@ -1765,7 +1765,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject* o = ServerWorld::findObjectByNetworkId(oid);
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -1788,13 +1788,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
CachedNetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(oid.getObject());
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
Container const * const container = ContainerInterface::getContainer(*o);
if (container == NULL)
if (container == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -1811,7 +1811,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = ServerWorld::findObjectByNetworkId(oid);
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -1846,7 +1846,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = ServerWorld::findObjectByNetworkId(oid);
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -1881,7 +1881,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = ServerWorld::findObjectByNetworkId(oid);
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -1914,7 +1914,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
TangibleObject* o = dynamic_cast<TangibleObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -1940,7 +1940,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
const ServerObject* o = dynamic_cast<const ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -1976,7 +1976,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
ServerMessageForwarding::end();
if (ObjectTemplateList::reload(templateFile) == NULL)
if (ObjectTemplateList::reload(templateFile) == nullptr)
{
result += getErrorMessage(argv[0], ERR_TEMPLATE_NOT_LOADED);
return true;
@@ -1991,7 +1991,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
CreatureObject * creature = dynamic_cast<CreatureObject *>(ServerWorld::findObjectByNetworkId(oid));
if (creature == NULL || !creature->isIncapacitated())
if (creature == nullptr || !creature->isIncapacitated())
result += Unicode::narrowToWide("no");
else if (creature->isDead())
result += Unicode::narrowToWide("dead");
@@ -2011,11 +2011,11 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
LocationData d;
d.name = argv[2];
Vector pos;
pos.x = static_cast<real>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL));
pos.y = static_cast<real>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL));
pos.z = static_cast<real>(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL));
pos.x = static_cast<real>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr));
pos.y = static_cast<real>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr));
pos.z = static_cast<real>(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr));
d.location.setCenter(pos);
float radius = static_cast<real>(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL));
float radius = static_cast<real>(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr));
d.location.setRadius(radius);
o->addLocationTarget(d);
}
@@ -2079,7 +2079,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
oid.getObject());
const CreatureObject * creature = dynamic_cast<const CreatureObject *>(
tangible);
if (creature != NULL)
if (creature != nullptr)
{
char buffer[1024];
sprintf(buffer, "he:%d, co=%d, ac=%d, st=%d, mi=%d, wi=%d",
@@ -2091,7 +2091,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
creature->getAttribute(Attributes::Willpower));
result += Unicode::narrowToWide(buffer);
}
else if (tangible != NULL)
else if (tangible != nullptr)
{
char buffer[1024];
sprintf(buffer, "max hp = %d, damage taken = %d",
@@ -2156,13 +2156,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const
bool value = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), 0, 10) != 0;
ServerObject * const o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(actorId));
CreatureObject * const c = (o ? o->asCreatureObject() : NULL);
if (o == NULL)
CreatureObject * const c = (o ? o->asCreatureObject() : nullptr);
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
@@ -2261,7 +2261,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
const char *objectTemplateName = obj->getObjectTemplateName();
result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total observers (%d observers on this game server)\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "NULL object template"), obj->getObserversCount(), observerList.size()));
result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total observers (%d observers on this game server)\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "nullptr object template"), obj->getObserversCount(), observerList.size()));
if (!observers.empty())
{
@@ -2560,7 +2560,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
else if(isCommand(argv[0], "setPathLinkDistance"))
{
float dist = static_cast<real>(strtod(Unicode::wideToNarrow(argv[1]).c_str(), NULL));
float dist = static_cast<real>(strtod(Unicode::wideToNarrow(argv[1]).c_str(), nullptr));
CityPathGraphManager::setLinkDistance(dist);
@@ -2601,7 +2601,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
CachedNetworkId const oid(Unicode::wideToNarrow(argv[1]));
TangibleObject * object = dynamic_cast<TangibleObject *>(oid.getObject());
if (object == NULL)
if (object == nullptr)
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
else
{
@@ -2619,7 +2619,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
CachedNetworkId const oid(Unicode::wideToNarrow(argv[1]));
TangibleObject * object = dynamic_cast<TangibleObject *>(oid.getObject());
if (object == NULL)
if (object == nullptr)
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
else
{
@@ -2653,7 +2653,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
ServerObject * object = dynamic_cast<TangibleObject *>(oid.getObject());
CreatureObject * creature = dynamic_cast<CreatureObject *>(object);
if (object == NULL)
if (object == nullptr)
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
else
{
@@ -2694,7 +2694,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
NetworkId oid(Unicode::wideToNarrow(argv[1]));
CreatureObject *creature = dynamic_cast<CreatureObject*>(NetworkIdManager::getObjectById(oid));
PlayerObject *player = NULL;
PlayerObject *player = nullptr;
if (creature)
player = PlayerCreatureController::getPlayerObject(creature);
if (player)
@@ -2739,7 +2739,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
NetworkId oid(Unicode::wideToNarrow(argv[1]));
CreatureObject *creature = dynamic_cast<CreatureObject*>(NetworkIdManager::getObjectById(oid));
PlayerObject *player = NULL;
PlayerObject *player = nullptr;
if (creature)
player = PlayerCreatureController::getPlayerObject(creature);
if (player)
@@ -2864,7 +2864,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
const InstallationObject* o = dynamic_cast<const InstallationObject*>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -2888,7 +2888,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
NetworkId oid(Unicode::wideToNarrow(argv[1]));
InstallationObject* o = dynamic_cast<InstallationObject*>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -2904,7 +2904,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
const InstallationObject* o = dynamic_cast<const InstallationObject*>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -2928,7 +2928,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
NetworkId oid(Unicode::wideToNarrow(argv[1]));
InstallationObject* o = dynamic_cast<InstallationObject*>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -3056,7 +3056,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject *o = safe_cast<ServerObject *>(NetworkIdManager::getObjectById(oid));
if (o != NULL && o->asCreatureObject() != NULL && o->isPlayerControlled())
if (o != nullptr && o->asCreatureObject() != nullptr && o->isPlayerControlled())
{
CreatureObject * creatureTarget = o->asCreatureObject();
@@ -3068,7 +3068,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
for (CreatureObject::SkillList::const_iterator i = skills.begin(); i != skills.end(); ++i)
{
const SkillObject * profession = (*i)->findProfessionForSkill();
if (profession != NULL)
if (profession != nullptr)
professionName = profession->getSkillName();
}
}
@@ -3317,7 +3317,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
NetworkId oid (Unicode::wideToNarrow(argv[1]));
ServerObject* const object = safe_cast<ServerObject*>(NetworkIdManager::getObjectById(oid));
if (object == NULL)
if (object == nullptr)
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
else if (!object->getClient())
result += getErrorMessage(argv[0], ERR_INVALID_USER);
@@ -3346,7 +3346,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
NetworkId ownerId (Unicode::wideToNarrow(argv[2]));
ServerObject * const object = safe_cast<ServerObject*>(NetworkIdManager::getObjectById(houseId));
TangibleObject * const tangible = object ? object->asTangibleObject() : NULL;
TangibleObject * const tangible = object ? object->asTangibleObject() : nullptr;
if (!tangible)
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
else
@@ -3359,7 +3359,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
ServerObject * object = safe_cast<ServerObject*>(NetworkIdManager::getObjectById(playerObject->getLookAtTarget()));
if (NULL == object)
if (nullptr == object)
object = playerObject;
RegionMaster::RegionVector rv;
@@ -3373,7 +3373,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
for (RegionMaster::RegionVector::const_iterator it = rv.begin(); it != rv.end(); ++it)
{
Region const * const r = *it;
if (NULL != r)
if (nullptr != r)
{
_itoa(r->getGeography(), buf, 10);
result += Unicode::narrowToWide(buf);
@@ -3390,7 +3390,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
ServerObject * const target = safe_cast<ServerObject*>(NetworkIdManager::getObjectById(playerObject->getLookAtTarget()));
if (NULL == target)
if (nullptr == target)
{
result += Unicode::narrowToWide("Invalid target");
return true;
@@ -3434,7 +3434,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
ServerObject * object = safe_cast<ServerObject*>(NetworkIdManager::getObjectById(playerObject->getLookAtTarget()));
if (NULL == object)
if (nullptr == object)
object = playerObject;
Vector const & pos_w = object->getPosition_w();
@@ -3449,7 +3449,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
ServerObject * object = safe_cast<ServerObject*>(NetworkIdManager::getObjectById(playerObject->getLookAtTarget()));
if (NULL == object)
if (nullptr == object)
object = playerObject;
Vector const & pos_w = object->getPosition_w();
@@ -3463,7 +3463,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
ServerObject * object = safe_cast<ServerObject*>(NetworkIdManager::getObjectById(playerObject->getLookAtTarget()));
if (NULL == object)
if (nullptr == object)
object = playerObject;
Vector const & pos_w = object->getPosition_w();
@@ -3477,7 +3477,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
const ServerObject* o = dynamic_cast<const ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -3503,7 +3503,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
const ServerObject* o = dynamic_cast<const ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -3576,13 +3576,13 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject const* o = dynamic_cast<ServerObject const*>(ServerWorld::findObjectByNetworkId(oid));
CreatureObject const* c = (o ? o->asCreatureObject() : NULL);
if (o == NULL)
CreatureObject const* c = (o ? o->asCreatureObject() : nullptr);
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
else if (c == NULL)
else if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
@@ -3590,7 +3590,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
else
{
PlayerObject const* p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -3612,8 +3612,8 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject* o = dynamic_cast<ServerObject*>(ServerWorld::findObjectByNetworkId(oid));
CreatureObject* c = (o ? o->asCreatureObject() : NULL);
if (o == NULL)
CreatureObject* c = (o ? o->asCreatureObject() : nullptr);
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -3623,7 +3623,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
result += Unicode::narrowToWide("specified object is not authoritative on this game server\n");
return true;
}
else if (c == NULL)
else if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
@@ -3631,7 +3631,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
else
{
PlayerObject* p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -3668,20 +3668,20 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
CreatureObject * c = (o ? o->asCreatureObject() : NULL);
if (o == NULL)
CreatureObject * c = (o ? o->asCreatureObject() : nullptr);
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
else if (c == NULL)
else if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -3755,14 +3755,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject const* o = dynamic_cast<ServerObject const*>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
TangibleObject const* t = o->asTangibleObject();
if (t == NULL)
if (t == nullptr)
{
result += Unicode::narrowToWide("specified object is not a tangible object\n");
return true;
@@ -3797,14 +3797,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId sourceOid(Unicode::wideToNarrow(argv[1]));
ServerObject * sourceSo = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(sourceOid));
if (sourceSo == NULL)
if (sourceSo == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str()));
return true;
}
TangibleObject * sourceTo = sourceSo->asTangibleObject();
if (sourceTo == NULL)
if (sourceTo == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", sourceOid.getValueString().c_str()));
return true;
@@ -3812,14 +3812,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
NetworkId targetOid(Unicode::wideToNarrow(argv[2]));
ServerObject * targetSo = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(targetOid));
if (targetSo == NULL)
if (targetSo == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", targetOid.getValueString().c_str()));
return true;
}
TangibleObject * targetTo = targetSo->asTangibleObject();
if (targetTo == NULL)
if (targetTo == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", targetOid.getValueString().c_str()));
return true;
@@ -3839,14 +3839,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId sourceOid(Unicode::wideToNarrow(argv[1]));
ServerObject * sourceSo = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(sourceOid));
if (sourceSo == NULL)
if (sourceSo == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str()));
return true;
}
TangibleObject * sourceTo = sourceSo->asTangibleObject();
if (sourceTo == NULL)
if (sourceTo == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", sourceOid.getValueString().c_str()));
return true;
@@ -3866,14 +3866,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId sourceOid(Unicode::wideToNarrow(argv[1]));
ServerObject * sourceSo = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(sourceOid));
if (sourceSo == NULL)
if (sourceSo == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str()));
return true;
}
TangibleObject * sourceTo = sourceSo->asTangibleObject();
if (sourceTo == NULL)
if (sourceTo == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", sourceOid.getValueString().c_str()));
return true;
@@ -3891,14 +3891,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId sourceOid(Unicode::wideToNarrow(argv[1]));
ServerObject const * sourceSo = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(sourceOid));
if (sourceSo == NULL)
if (sourceSo == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str()));
return true;
}
CreatureObject const * sourceCo = sourceSo->asCreatureObject();
if (sourceCo == NULL)
if (sourceCo == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a creature object\n", sourceOid.getValueString().c_str()));
return true;
@@ -3915,14 +3915,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId sourceOid(Unicode::wideToNarrow(argv[1]));
ServerObject * sourceSo = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(sourceOid));
if (sourceSo == NULL)
if (sourceSo == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str()));
return true;
}
CreatureObject * sourceCo = sourceSo->asCreatureObject();
if (sourceCo == NULL)
if (sourceCo == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a creature object\n", sourceOid.getValueString().c_str()));
return true;
@@ -3931,7 +3931,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
result += Unicode::narrowToWide(FormattedString<512>().sprintf("dumping %s's command queue contents\n", sourceCo->getNetworkId().getValueString().c_str()));
CommandQueue * queue = sourceCo->getCommandQueue();
if (queue != NULL)
if (queue != nullptr)
{
std::string output;
queue->spew(&output);
@@ -3947,26 +3947,26 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
CreatureObject * c = (o ? o->asCreatureObject() : NULL);
if (o == NULL)
CreatureObject * c = (o ? o->asCreatureObject() : nullptr);
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
else if (c == NULL)
else if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
}
time_t const timeNow = ::time(NULL);
time_t const timeNow = ::time(nullptr);
time_t const timeStartInterval = ((p->getChatSpamTimeEndInterval() > 0) ? static_cast<time_t>(p->getChatSpamTimeEndInterval() - (ConfigServerGame::getChatSpamLimiterIntervalMinutes() * 60)) : 0);
if ((timeStartInterval <= 0) || (timeNow < timeStartInterval))
@@ -3986,28 +3986,28 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject const * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject const * c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject const * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
}
Client * client = o->getClient();
if (client == NULL)
if (client == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("specified character object %s (%s) doesn't have a Client object (possible causes are may not be authoritative, or may not be connected)\n", o->getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(o->getAssignedObjectName()).c_str()));
return true;
@@ -4042,28 +4042,28 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject const * c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject const * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
}
Client * client = o->getClient();
if (client == NULL)
if (client == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("specified character object %s (%s) doesn't have a Client object (possible causes are may not be authoritative, or may not be connected)\n", o->getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(o->getAssignedObjectName()).c_str()));
return true;
@@ -4083,28 +4083,28 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject const * c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject const * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
}
Client * client = o->getClient();
if (client == NULL)
if (client == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("specified character object %s (%s) doesn't have a Client object (possible causes are may not be authoritative, or may not be connected)\n", o->getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(o->getAssignedObjectName()).c_str()));
return true;
@@ -4180,12 +4180,12 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const
}
else
{
result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getFootprint() returns NULL.\n", oid.getValueString().c_str()));
result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getFootprint() returns nullptr.\n", oid.getValueString().c_str()));
}
}
else
{
result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getCollisionProperty() returns NULL.\n", oid.getValueString().c_str()));
result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getCollisionProperty() returns nullptr.\n", oid.getValueString().c_str()));
}
}
else
@@ -100,7 +100,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const
{
NetworkId oid (Unicode::wideToNarrow (argv[1]));
ServerObject* object = ServerWorld::findObjectByNetworkId(oid);
if (object == NULL)
if (object == nullptr)
{
result += getErrorMessage (argv [0], ERR_INVALID_OBJECT);
return true;
@@ -224,7 +224,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const
// This is now a no-op, but left in to avoid breaking the god client
// NetworkId oid (Unicode::wideToNarrow (argv[1]));
// ServerObject* object = ServerWorld::findObjectByNetworkId(oid);
// if (object == NULL)
// if (object == nullptr)
// {
// result += getErrorMessage (argv [0], ERR_INVALID_OBJECT);
// return true;
@@ -241,7 +241,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const
{
NetworkId oid (Unicode::wideToNarrow(argv[1]));
ServerObject* object = ServerWorld::findObjectByNetworkId(oid);
if (object == NULL)
if (object == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -317,7 +317,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const
{
ServerObject * const userServerObject = ServerWorld::findObjectByNetworkId(userId);
if (userServerObject != NULL)
if (userServerObject != nullptr)
{
NetworkId specifiedNetworkId;
@@ -329,7 +329,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const
{
CreatureObject * const userCreatureObject = CreatureObject::asCreatureObject(userServerObject);
if (userCreatureObject != NULL)
if (userCreatureObject != nullptr)
{
specifiedNetworkId = userCreatureObject->getLookAtTarget();
}
@@ -337,7 +337,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const
ServerObject * const specifiedServerObject = ServerWorld::findObjectByNetworkId(specifiedNetworkId);
if (specifiedServerObject != NULL)
if (specifiedServerObject != nullptr)
{
DynamicVariableList const & objVarList = specifiedServerObject->getObjVars();
FormattedString<1024> fs;
@@ -357,7 +357,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const
{
NetworkId oid = NetworkId(Unicode::wideToNarrow(argv[1]));
ServerObject* object = ServerWorld::findObjectByNetworkId(oid);
if (object == NULL)
if (object == nullptr)
{
result += getErrorMessage (argv [0], ERR_INVALID_OBJECT);
return true;
@@ -376,7 +376,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const
{
NetworkId oid = NetworkId(Unicode::wideToNarrow(argv[1]));
ServerObject* object = ServerWorld::findObjectByNetworkId(oid);
if (object == NULL)
if (object == nullptr)
{
result += getErrorMessage (argv [0], ERR_INVALID_OBJECT);
return true;
@@ -103,13 +103,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject const* o = dynamic_cast<ServerObject const*>(ServerWorld::findObjectByNetworkId(oid));
CreatureObject const* c = (o ? o->asCreatureObject() : NULL);
if (o == NULL)
CreatureObject const* c = (o ? o->asCreatureObject() : nullptr);
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
else if (c == NULL)
else if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
@@ -117,7 +117,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
else
{
PlayerObject const* p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -185,7 +185,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
result += Unicode::narrowToWide(FormattedString<512>().sprintf("lifetime PvP kills: %ld\n",p->getLifetimePvpKills()));
result += Unicode::narrowToWide(FormattedString<512>().sprintf("next GCW rating calculation time: %ld",p->getNextGcwRatingCalcTime()));
int32 const now = static_cast<int32>(::time(NULL));
int32 const now = static_cast<int32>(::time(nullptr));
if (p->getNextGcwRatingCalcTime() > 0)
{
if (p->getNextGcwRatingCalcTime() >= now)
@@ -223,13 +223,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
CreatureObject * c = (o ? o->asCreatureObject() : NULL);
if (o == NULL)
CreatureObject * c = (o ? o->asCreatureObject() : nullptr);
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
else if (c == NULL)
else if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
@@ -237,7 +237,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
else
{
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -259,13 +259,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
CreatureObject * c = (o ? o->asCreatureObject() : NULL);
if (o == NULL)
CreatureObject * c = (o ? o->asCreatureObject() : nullptr);
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
else if (c == NULL)
else if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
@@ -273,7 +273,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
else
{
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -295,13 +295,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
CreatureObject * c = (o ? o->asCreatureObject() : NULL);
if (o == NULL)
CreatureObject * c = (o ? o->asCreatureObject() : nullptr);
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
else if (c == NULL)
else if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
@@ -309,7 +309,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
else
{
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -331,13 +331,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
CreatureObject * c = (o ? o->asCreatureObject() : NULL);
if (o == NULL)
CreatureObject * c = (o ? o->asCreatureObject() : nullptr);
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
else if (c == NULL)
else if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
@@ -345,7 +345,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
else
{
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -369,13 +369,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
CreatureObject * c = (o ? o->asCreatureObject() : NULL);
if (o == NULL)
CreatureObject * c = (o ? o->asCreatureObject() : nullptr);
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
else if (c == NULL)
else if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
@@ -383,7 +383,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
else
{
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -405,13 +405,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
CreatureObject * c = (o ? o->asCreatureObject() : NULL);
if (o == NULL)
CreatureObject * c = (o ? o->asCreatureObject() : nullptr);
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
else if (c == NULL)
else if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
@@ -419,7 +419,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
else
{
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -441,13 +441,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
CreatureObject * c = (o ? o->asCreatureObject() : NULL);
if (o == NULL)
CreatureObject * c = (o ? o->asCreatureObject() : nullptr);
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
else if (c == NULL)
else if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
@@ -455,7 +455,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
else
{
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -477,21 +477,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject * c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -585,7 +585,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -612,21 +612,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * const o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject * const c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * const p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -660,21 +660,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * const o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject * const c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * const p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -708,21 +708,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * const o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject * const c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * const p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -756,21 +756,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * const o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject * const c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * const p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -804,21 +804,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject * const o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject * const c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject * const p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -852,14 +852,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId const oid(Unicode::wideToNarrow(argv[1]));
ServerObject const * const o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject const * const c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
@@ -874,14 +874,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId const actorOid(Unicode::wideToNarrow(argv[1]));
ServerObject const * const actorSo = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(actorOid));
if (actorSo == NULL)
if (actorSo == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
TangibleObject const * const actorTo = actorSo->asTangibleObject();
if (actorTo == NULL)
if (actorTo == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", actorOid.getValueString().c_str()));
return true;
@@ -889,14 +889,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
NetworkId const targetOid(Unicode::wideToNarrow(argv[2]));
ServerObject const * const targetSo = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(targetOid));
if (targetSo == NULL)
if (targetSo == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
TangibleObject const * const targetTo = targetSo->asTangibleObject();
if (targetTo == NULL)
if (targetTo == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", targetOid.getValueString().c_str()));
return true;
@@ -924,14 +924,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
{
NetworkId const actorOid(Unicode::wideToNarrow(argv[1]));
ServerObject * const actorSo = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(actorOid));
if (actorSo == NULL)
if (actorSo == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
TangibleObject * const actorTo = actorSo->asTangibleObject();
if (actorTo == NULL)
if (actorTo == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", actorOid.getValueString().c_str()));
return true;
@@ -939,14 +939,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
NetworkId const targetOid(Unicode::wideToNarrow(argv[2]));
ServerObject * const targetSo = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(targetOid));
if (targetSo == NULL)
if (targetSo == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
TangibleObject * const targetTo = targetSo->asTangibleObject();
if (targetTo == NULL)
if (targetTo == nullptr)
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", targetOid.getValueString().c_str()));
return true;
@@ -968,28 +968,28 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
NetworkId const oid(Unicode::wideToNarrow(argv[1]));
ServerObject const * const o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject const * const c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject const * const p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
}
ShipObject const * const ship = ShipObject::getContainingShipObject(c);
if (ship == NULL)
if (ship == nullptr)
{
result += Unicode::narrowToWide("specified character object is not in a ship\n");
return true;
@@ -1042,28 +1042,28 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St
NetworkId const oid(Unicode::wideToNarrow(argv[1]));
ServerObject const * const o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject const * const c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject const * const p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
}
ShipObject const * const ship = ShipObject::getContainingShipObject(c);
if (ship == NULL)
if (ship == nullptr)
{
result += Unicode::narrowToWide("specified character object is not in a ship\n");
return true;
@@ -73,7 +73,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con
CachedNetworkId harvester(Unicode::wideToNarrow (argv[1]));
ServerObject* harvesterObject = safe_cast<ServerObject*>(harvester.getObject());
if (harvesterObject == NULL)
if (harvesterObject == nullptr)
{
result += getErrorMessage (argv [0], ERR_INVALID_OBJECT);
return true;
@@ -90,7 +90,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con
CachedNetworkId harvester(Unicode::wideToNarrow (argv[1]));
ServerObject* harvesterObject = safe_cast<ServerObject*>(harvester.getObject());
if (harvesterObject == NULL)
if (harvesterObject == nullptr)
{
result += getErrorMessage (argv [0], ERR_INVALID_OBJECT);
return true;
@@ -123,7 +123,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con
CachedNetworkId harvester(Unicode::wideToNarrow (argv[1]));
ServerObject* harvesterObject = safe_cast<ServerObject*>(harvester.getObject());
if (harvesterObject == NULL)
if (harvesterObject == nullptr)
{
result += getErrorMessage (argv [0], ERR_INVALID_OBJECT);
return true;
@@ -208,7 +208,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con
ResourceContainerObject * const container = dynamic_cast<ResourceContainerObject*>(NetworkIdManager::getObjectById(contId));
std::string const & resourcePath = Unicode::wideToNarrow(argv[2]);
ResourceTypeObject * const resType = ServerUniverse::getInstance().getResourceTypeByName(resourcePath);
int const amount = strtol(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10);
int const amount = strtol(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10);
NetworkId const source(Unicode::wideToNarrow (argv[4]));
if (container && resType)
@@ -228,7 +228,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con
{
NetworkId contId (Unicode::wideToNarrow (argv[1]));
ResourceContainerObject* container=dynamic_cast<ResourceContainerObject*>(NetworkIdManager::getObjectById(contId));
if (container != NULL)
if (container != nullptr)
{
NetworkId sourceId;
if (argv.size() >= 3)
@@ -251,7 +251,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con
{
NetworkId contId (Unicode::wideToNarrow (argv[1]));
ResourceContainerObject* container=dynamic_cast<ResourceContainerObject*>(NetworkIdManager::getObjectById(contId));
if (container != NULL)
if (container != nullptr)
{
if (container->debugRecycle())
result += getErrorMessage(argv[0], ERR_SUCCESS);
@@ -267,7 +267,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con
CachedNetworkId contId (Unicode::wideToNarrow (argv[1]));
ResourceContainerObject* container=dynamic_cast<ResourceContainerObject*>(contId.getObject());
ResourceTypeObject *resType=ServerUniverse::getInstance().getResourceTypeByName(Unicode::wideToNarrow(argv[2]));
int amount=strtol(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10);
int amount=strtol(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10);
if (container && resType)
{
@@ -307,8 +307,8 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con
{
const std::string parentResourceClassName (Unicode::wideToNarrow(argv[1]));
const std::string resourceTypeName (Unicode::wideToNarrow(argv[2]));
const int surveyRange = strtol(Unicode::wideToNarrow(argv[3]).c_str(),NULL,10);
const int numPoints = strtol(Unicode::wideToNarrow(argv[4]).c_str(),NULL,10);
const int surveyRange = strtol(Unicode::wideToNarrow(argv[3]).c_str(),nullptr,10);
const int numPoints = strtol(Unicode::wideToNarrow(argv[4]).c_str(),nullptr,10);
const Object * player = NetworkIdManager::getObjectById(userId);
if (player)
@@ -62,7 +62,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow (argv[2]));
ServerObject* object = ServerWorld::findObjectByNetworkId(oid);
if (object == NULL)
if (object == nullptr)
{
result += getErrorMessage (argv [0], ERR_INVALID_OBJECT);
return true;
@@ -81,7 +81,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[2]));
ServerObject* object = ServerWorld::findObjectByNetworkId(oid);
if (object == NULL)
if (object == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -100,7 +100,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const
{
ServerObject * const userServerObject = ServerWorld::findObjectByNetworkId(userId);
if (userServerObject != NULL)
if (userServerObject != nullptr)
{
NetworkId specifiedNetworkId;
@@ -112,7 +112,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const
{
CreatureObject * const userCreatureObject = CreatureObject::asCreatureObject(userServerObject);
if (userCreatureObject != NULL)
if (userCreatureObject != nullptr)
{
specifiedNetworkId = userCreatureObject->getLookAtTarget();
}
@@ -120,7 +120,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const
ServerObject * const specifiedServerObject = ServerObject::getServerObject(specifiedNetworkId);
if (specifiedServerObject != NULL)
if (specifiedServerObject != nullptr)
{
ScriptList const & scripts = specifiedServerObject->getScriptObject()->getScripts();
FormattedString<1024> fs;
@@ -226,7 +226,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const
// get the object id
NetworkId oid(Unicode::wideToNarrow(argv[oidIndex]));
ServerObject* object = ServerWorld::findObjectByNetworkId(oid);
if (object == NULL)
if (object == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -301,7 +301,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const
return true;
}
unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), NULL, 10);
unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), nullptr, 10);
const bool isPublic = (val != 0);
SetConnectionServerPublic const p(isPublic);
@@ -354,8 +354,8 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const
return true;
}
unsigned long secsToWait = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), NULL, 10);
unsigned long maxSecs = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10);
unsigned long secsToWait = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), nullptr, 10);
unsigned long maxSecs = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10);
Unicode::String systemMessage;
for( size_t i=3; i< argv.size(); ++i)
{
@@ -386,7 +386,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const
return true;
}
unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), NULL, 10);
unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), nullptr, 10);
switch (val)
{
case 1:
@@ -482,7 +482,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject* object = ServerWorld::findObjectByNetworkId(oid);
if (object == NULL)
if (object == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -574,7 +574,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const
}
else if (isAbbrev (argv[0], "getSceneId"))
{
if (user == NULL)
if (user == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -596,7 +596,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const
return true;
}
unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), NULL, 10);
unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), nullptr, 10);
if (user->getClient()->setGodMode(val != 0))
result += getErrorMessage (argv[0], ERR_SUCCESS);
else
@@ -637,7 +637,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const
{
std::string tableName;
tableName = Unicode::wideToNarrow(argv[1]);
if (DataTableManager::reload(tableName) != NULL)
if (DataTableManager::reload(tableName) != nullptr)
{
ServerMessageForwarding::beginBroadcast();
@@ -694,7 +694,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const
else
{
PlanetObject * planet = ServerUniverse::getInstance().getCurrentPlanet();
if (planet == NULL)
if (planet == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -708,7 +708,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const
for (std::vector<const Region *>::const_iterator i = regions.begin(); i != regions.end(); ++i)
{
const RegionRectangle * ro = dynamic_cast<const RegionRectangle*>(*i);
if (ro != NULL)
if (ro != nullptr)
{
float minX, minY, maxX, maxY;
ro->getExtent(minX, minY, maxX, maxY);
@@ -717,7 +717,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const
client->send(mrgrr, true);
}
const RegionCircle* co = dynamic_cast<const RegionCircle*>(*i);
if (co != NULL)
if (co != nullptr)
{
float centerX, centerY, radius;
co->getExtent(centerX, centerY, radius);
@@ -743,7 +743,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const
{
uint32 processId = GameServer::getInstance().getProcessId();
if (argv.size() > 3)
processId = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), NULL, 10);
processId = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), nullptr, 10);
std::string op = Unicode::wideToNarrow(argv[1]) + " " + Unicode::wideToNarrow(argv[2]);
@@ -760,7 +760,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const
{
uint32 processId = GameServer::getInstance().getProcessId();
if (argv.size() > 2)
processId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10);
processId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10);
std::string op(Unicode::wideToNarrow(argv[1]));
if (processId == GameServer::getInstance().getProcessId())
@@ -840,8 +840,8 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "getRegionsAt"))
{
float x = static_cast<real>(strtod(Unicode::wideToNarrow(argv[1]).c_str(), NULL));
float z = static_cast<real>(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL));
float x = static_cast<real>(strtod(Unicode::wideToNarrow(argv[1]).c_str(), nullptr));
float z = static_cast<real>(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr));
std::vector<const Region *> results;
@@ -990,10 +990,10 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const
//"<server_table> <client_table> <x1> <z1> <x2> <z2>", "Save out an area for buildout datatables"
std::string const &serverFilename = Unicode::wideToNarrow(argv[1]);
std::string const &clientFilename = Unicode::wideToNarrow(argv[2]);
float x1 = static_cast<float>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL));
float z1 = static_cast<float>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL));
float x2 = static_cast<float>(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL));
float z2 = static_cast<float>(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL));
float x1 = static_cast<float>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr));
float z1 = static_cast<float>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr));
float x2 = static_cast<float>(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr));
float z2 = static_cast<float>(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr));
ServerBuildoutManager::saveArea(serverFilename, clientFilename, x1, z1, x2, z2);
}
else if (isAbbrev(argv[0], "clientSaveBuildoutArea"))
@@ -1001,10 +1001,10 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const
//"<scene> <area_name> <x1> <z1> <x2> <z2>"
std::string const &scene = Unicode::wideToNarrow(argv[1]);
std::string const &areaName = Unicode::wideToNarrow(argv[2]);
float x1 = static_cast<float>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL));
float z1 = static_cast<float>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL));
float x2 = static_cast<float>(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL));
float z2 = static_cast<float>(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL));
float x1 = static_cast<float>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr));
float z1 = static_cast<float>(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr));
float x2 = static_cast<float>(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr));
float z2 = static_cast<float>(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr));
if (scene == ConfigServerGame::getSceneID() && user->getClient())
ServerBuildoutManager::clientSaveArea(*user->getClient(), areaName, x1, z1, x2, z2);
}
@@ -1044,7 +1044,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
if (argv.size() == 2)
{
// specify server by process id
uint32 serverId = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), NULL, 10);
uint32 serverId = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), nullptr, 10);
if (serverId != 0)
{
ExcommunicateGameServerMessage exmsg(serverId, 0, "");
@@ -1058,7 +1058,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
{
// specify server by scene & preload role number
std::string const &scene = Unicode::wideToNarrow(argv[1]);
uint32 preloadRole = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10);
uint32 preloadRole = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10);
GenericValueTypeMessage<std::pair<std::string, uint32> > msg("RestartServerByRoleMessage", std::make_pair(scene, preloadRole));
if (scene == ConfigServerGame::getSceneID())
@@ -1072,8 +1072,8 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
{
// specify server by geographic location
std::string const &scene = Unicode::wideToNarrow(argv[1]);
int x = static_cast<int>(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL));
int z = static_cast<int>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL));
int x = static_cast<int>(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr));
int z = static_cast<int>(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr));
RestartServerMessage msg(scene, x, z);
if (scene == ConfigServerGame::getSceneID())
@@ -1322,14 +1322,14 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
NetworkId oid2(Unicode::wideToNarrow(argv[2]));
ServerObject const * const object1 = ServerWorld::findObjectByNetworkId(oid1);
if (object1 == NULL)
if (object1 == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
ServerObject const * const object2 = ServerWorld::findObjectByNetworkId(oid2);
if (object2 == NULL)
if (object2 == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
@@ -1366,7 +1366,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
TerrainObject const * terrain = TerrainObject::getConstInstance();
if (!terrain)
{
result += Unicode::narrowToWide("terrain object is NULL\n");
result += Unicode::narrowToWide("terrain object is nullptr\n");
return true;
}
@@ -1443,7 +1443,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
TerrainObject const * terrain = TerrainObject::getConstInstance();
if (!terrain)
{
result += Unicode::narrowToWide("terrain object is NULL\n");
result += Unicode::narrowToWide("terrain object is nullptr\n");
return true;
}
@@ -1491,7 +1491,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
TerrainObject * terrain = TerrainObject::getInstance();
if (!terrain)
{
result += Unicode::narrowToWide("terrain object is NULL\n");
result += Unicode::narrowToWide("terrain object is nullptr\n");
return true;
}
@@ -1557,8 +1557,8 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
{
result += Unicode::narrowToWide(iterFind->second.getDebugString());
ServerObject const * const soGroupObject = (iterFind->second.groupId.isValid() ? safe_cast<ServerObject const *>(NetworkIdManager::getObjectById(iterFind->second.groupId)) : NULL);
GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : NULL);
ServerObject const * const soGroupObject = (iterFind->second.groupId.isValid() ? safe_cast<ServerObject const *>(NetworkIdManager::getObjectById(iterFind->second.groupId)) : nullptr);
GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : nullptr);
if (groupObject)
{
unsigned int const secondsLeftOnGroupPickup = groupObject->getSecondsLeftOnGroupPickup();
@@ -1717,7 +1717,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBrief"))
{
int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str());
time_t const cutoff = std::max(static_cast<time_t>(0), static_cast<time_t>(::time(NULL) - (60 * 60 * 24 * days)));
time_t const cutoff = std::max(static_cast<time_t>(0), static_cast<time_t>(::time(nullptr) - (60 * 60 * 24 * days)));
std::multimap<time_t, std::pair<std::pair<NetworkId, uint32>, std::string> > resultList;
NameManager::getInstance().getPlayerWithLastLoginTimeAfter(cutoff, resultList);
@@ -1726,7 +1726,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "listCharacterLastLoginTimeAfterBrief"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -1749,7 +1749,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBeforeBrief"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -1772,7 +1772,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBetweenBrief"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -1817,7 +1817,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
else if (isAbbrev(argv[0], "listCharacterLastLoginTimeDetailed"))
{
int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str());
time_t const cutoff = std::max(static_cast<time_t>(0), static_cast<time_t>(::time(NULL) - (60 * 60 * 24 * days)));
time_t const cutoff = std::max(static_cast<time_t>(0), static_cast<time_t>(::time(nullptr) - (60 * 60 * 24 * days)));
std::multimap<time_t, std::pair<std::pair<NetworkId, uint32>, std::string> > resultList;
NameManager::getInstance().getPlayerWithLastLoginTimeAfter(cutoff, resultList);
@@ -1829,7 +1829,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "listCharacterLastLoginTimeAfterDetailed"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -1855,7 +1855,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBeforeDetailed"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -1881,7 +1881,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBetweenDetailed"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -1929,7 +1929,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTime"))
{
int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str());
time_t const cutoff = std::max(static_cast<time_t>(0), static_cast<time_t>(::time(NULL) - (60 * 60 * 24 * days)));
time_t const cutoff = std::max(static_cast<time_t>(0), static_cast<time_t>(::time(nullptr) - (60 * 60 * 24 * days)));
int const argc = argv.size();
Unicode::String mailBody;
@@ -1952,7 +1952,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
static Unicode::String s_mailBody;
static time_t s_confirmationTimeout = 0;
time_t const timeNow = ::time(NULL);
time_t const timeNow = ::time(nullptr);
if ((s_days == days) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[2])) && (s_mailSubject == argv[3]) && (s_mailBody == mailBody))
{
@@ -1991,7 +1991,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTimeAfter"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -2028,7 +2028,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
static Unicode::String s_mailBody;
static time_t s_confirmationTimeout = 0;
time_t const timeNow = ::time(NULL);
time_t const timeNow = ::time(nullptr);
if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody))
{
@@ -2067,7 +2067,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTimeBefore"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -2104,7 +2104,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
static Unicode::String s_mailBody;
static time_t s_confirmationTimeout = 0;
time_t const timeNow = ::time(NULL);
time_t const timeNow = ::time(nullptr);
if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody))
{
@@ -2143,7 +2143,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTimeBetween"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -2202,7 +2202,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
static Unicode::String s_mailBody;
static time_t s_confirmationTimeout = 0;
time_t const timeNow = ::time(NULL);
time_t const timeNow = ::time(nullptr);
if ((s_cutoffLower == cutoffLower) && (s_cutoffUpper == cutoffUpper) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[13])) && (s_mailSubject == argv[14]) && (s_mailBody == mailBody))
{
@@ -2244,7 +2244,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
else if (isAbbrev(argv[0], "listCharacterCreateTimeBrief"))
{
int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str());
time_t const cutoff = std::max(static_cast<time_t>(0), static_cast<time_t>(::time(NULL) - (60 * 60 * 24 * days)));
time_t const cutoff = std::max(static_cast<time_t>(0), static_cast<time_t>(::time(nullptr) - (60 * 60 * 24 * days)));
std::multimap<time_t, std::pair<std::pair<NetworkId, uint32>, std::string> > resultList;
NameManager::getInstance().getPlayerWithCreateTimeAfter(cutoff, resultList);
@@ -2253,7 +2253,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "listCharacterCreateTimeAfterBrief"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -2276,7 +2276,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "listCharacterCreateTimeBeforeBrief"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -2299,7 +2299,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "listCharacterCreateTimeBetweenBrief"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -2344,7 +2344,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
else if (isAbbrev(argv[0], "listCharacterCreateTimeDetailed"))
{
int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str());
time_t const cutoff = std::max(static_cast<time_t>(0), static_cast<time_t>(::time(NULL) - (60 * 60 * 24 * days)));
time_t const cutoff = std::max(static_cast<time_t>(0), static_cast<time_t>(::time(nullptr) - (60 * 60 * 24 * days)));
std::multimap<time_t, std::pair<std::pair<NetworkId, uint32>, std::string> > resultList;
NameManager::getInstance().getPlayerWithCreateTimeAfter(cutoff, resultList);
@@ -2356,7 +2356,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "listCharacterCreateTimeAfterDetailed"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -2382,7 +2382,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "listCharacterCreateTimeBeforeDetailed"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -2408,7 +2408,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "listCharacterCreateTimeBetweenDetailed"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -2456,7 +2456,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
else if (isAbbrev(argv[0], "sendMailToCharacterCreateTime"))
{
int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str());
time_t const cutoff = std::max(static_cast<time_t>(0), static_cast<time_t>(::time(NULL) - (60 * 60 * 24 * days)));
time_t const cutoff = std::max(static_cast<time_t>(0), static_cast<time_t>(::time(nullptr) - (60 * 60 * 24 * days)));
int const argc = argv.size();
Unicode::String mailBody;
@@ -2479,7 +2479,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
static Unicode::String s_mailBody;
static time_t s_confirmationTimeout = 0;
time_t const timeNow = ::time(NULL);
time_t const timeNow = ::time(nullptr);
if ((s_days == days) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[2])) && (s_mailSubject == argv[3]) && (s_mailBody == mailBody))
{
@@ -2518,7 +2518,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "sendMailToCharacterCreateTimeAfter"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -2555,7 +2555,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
static Unicode::String s_mailBody;
static time_t s_confirmationTimeout = 0;
time_t const timeNow = ::time(NULL);
time_t const timeNow = ::time(nullptr);
if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody))
{
@@ -2594,7 +2594,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "sendMailToCharacterCreateTimeBefore"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -2631,7 +2631,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
static Unicode::String s_mailBody;
static time_t s_confirmationTimeout = 0;
time_t const timeNow = ::time(NULL);
time_t const timeNow = ::time(nullptr);
if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody))
{
@@ -2670,7 +2670,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
}
else if (isAbbrev(argv[0], "sendMailToCharacterCreateTimeBetween"))
{
time_t const rawtime = ::time(NULL);
time_t const rawtime = ::time(nullptr);
struct tm * timeinfo = ::localtime(&rawtime);
timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900;
timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1;
@@ -2729,7 +2729,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
static Unicode::String s_mailBody;
static time_t s_confirmationTimeout = 0;
time_t const timeNow = ::time(NULL);
time_t const timeNow = ::time(nullptr);
if ((s_cutoffLower == cutoffLower) && (s_cutoffUpper == cutoffUpper) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[13])) && (s_mailSubject == argv[14]) && (s_mailBody == mailBody))
{
@@ -2776,7 +2776,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
uint32 const targetStationId = static_cast<uint32>(atoi(Unicode::wideToNarrow(argv[4]).c_str()));
std::string const targetCluster = Unicode::wideToNarrow(argv[5]);
time_t const timeNow = ::time(NULL);
time_t const timeNow = ::time(nullptr);
result += Unicode::narrowToWide(FormattedString<512>().sprintf(" currentTime: %ld, %s\n", timeNow, CalendarTime::convertEpochToTimeStringLocal(timeNow).c_str()));
result += Unicode::narrowToWide(FormattedString<512>().sprintf("\n characterCreateTime: %ld\n", sourceCharacterCreateTime));
@@ -2837,7 +2837,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
{
std::string const sourceCluster = Unicode::wideToNarrow(argv[1]);
time_t const timeNow = ::time(NULL);
time_t const timeNow = ::time(nullptr);
result += Unicode::narrowToWide(FormattedString<512>().sprintf(" currentTime: %ld, %s\n", timeNow, CalendarTime::convertEpochToTimeStringLocal(timeNow).c_str()));
result += Unicode::narrowToWide(FormattedString<512>().sprintf(" sourceCluster: %s\n", sourceCluster.c_str()));
@@ -2893,7 +2893,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
{
result += Unicode::narrowToWide(FormattedString<512>().sprintf(" free CTS info file: %s\n", FreeCtsDataTable::getFreeCtsFileName().c_str()));
time_t const timeNow = ::time(NULL);
time_t const timeNow = ::time(nullptr);
result += Unicode::narrowToWide(FormattedString<512>().sprintf(" currentTime: %ld, %s\n", timeNow, CalendarTime::convertEpochToTimeStringLocal(timeNow).c_str()));
}
@@ -3125,7 +3125,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
else
{
result += Unicode::narrowToWide(FormattedString<1024>().sprintf("Requesting adjustment of imperial score for GCW score category (%s) by (%d). It can take up to 1 minute for the adjustment request to be completed.\n", category.c_str(), adjustment));
ServerUniverse::getInstance().adjustGcwImperialScore("remote server adjustGcwImperialScore", NULL, category, adjustment);
ServerUniverse::getInstance().adjustGcwImperialScore("remote server adjustGcwImperialScore", nullptr, category, adjustment);
}
}
else if (isAbbrev(argv[0], "adjustGcwRebelScore"))
@@ -3148,7 +3148,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
else
{
result += Unicode::narrowToWide(FormattedString<1024>().sprintf("Requesting adjustment of rebel score for GCW score category (%s) by (%d). It can take up to 1 minute for the adjustment request to be completed.\n", category.c_str(), adjustment));
ServerUniverse::getInstance().adjustGcwRebelScore("remote server adjustGcwRebelScore", NULL, category, adjustment);
ServerUniverse::getInstance().adjustGcwRebelScore("remote server adjustGcwRebelScore", nullptr, category, adjustment);
}
}
else if (isAbbrev(argv[0], "decayGcwScore"))
@@ -3202,20 +3202,20 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject const * const o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject const * const c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
if (PlayerCreatureController::getPlayerObject(c) == NULL)
if (PlayerCreatureController::getPlayerObject(c) == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -3240,21 +3240,21 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const
{
NetworkId oid(Unicode::wideToNarrow(argv[1]));
ServerObject const * const o = dynamic_cast<ServerObject *>(ServerWorld::findObjectByNetworkId(oid));
if (o == NULL)
if (o == nullptr)
{
result += getErrorMessage(argv[0], ERR_INVALID_OBJECT);
return true;
}
CreatureObject const * const c = o->asCreatureObject();
if (c == NULL)
if (c == nullptr)
{
result += Unicode::narrowToWide("specified object is not a creature object\n");
return true;
}
PlayerObject const * const p = PlayerCreatureController::getPlayerObject(c);
if (p == NULL)
if (p == nullptr)
{
result += Unicode::narrowToWide("specified object is not a character object\n");
return true;
@@ -116,7 +116,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S
slotNameToken.clear ();
}
if (ship == NULL)
if (ship == nullptr)
{
result += getErrorMessage (argv[0], ERR_INVALID_OBJECT);
return true;
@@ -126,7 +126,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S
ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (chassisType);
if (shipChassis == NULL)
if (shipChassis == nullptr)
{
result += Unicode::narrowToWide ("No chassis");
return true;
@@ -178,7 +178,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S
if (ship->isSlotInstalled(chassisSlot))
shipComponentData = ship->createShipComponentData(chassisSlot);
if (shipComponentData == NULL)
if (shipComponentData == nullptr)
{
result += Unicode::narrowToWide (" Loaded NONE\n");
}
@@ -223,7 +223,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S
{
TangibleObject * const component = findTangible (user->getLookAtTarget (), argv, 1);
if (component == NULL)
if (component == nullptr)
{
result += getErrorMessage (argv[0], ERR_INVALID_OBJECT);
return true;
@@ -231,7 +231,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S
ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*component);
if (shipComponentData == NULL)
if (shipComponentData == nullptr)
{
result += Unicode::narrowToWide ("Not a ship component");
return true;
@@ -252,13 +252,13 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S
TangibleObject * const component = findTangible (NetworkId::cms_invalid, argv, 1);
std::string const & slotName = Unicode::wideToNarrow (argv [2]);
if (ship == NULL)
if (ship == nullptr)
{
result += Unicode::narrowToWide ("no ship");
return true;
}
if (component == NULL)
if (component == nullptr)
{
result += Unicode::narrowToWide ("no component");
return true;
@@ -279,14 +279,14 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S
}
ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (ship->getChassisType ());
if (shipChassis == NULL)
if (shipChassis == nullptr)
{
result += Unicode::narrowToWide ("Ship chassis invalid");
return true;
}
ShipChassisSlot const * const slot = shipChassis->getSlot (shipChassisSlotType);
if (slot == NULL)
if (slot == nullptr)
{
result += Unicode::narrowToWide ("Ship chassis does not support that slot");
return true;
@@ -294,7 +294,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S
ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*component);
if (shipComponentData == NULL)
if (shipComponentData == nullptr)
{
result += Unicode::narrowToWide ("Not a ship component");
return true;
@@ -325,7 +325,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S
std::string const & componentName = Unicode::wideToNarrow (argv [1]);
std::string const & slotName = Unicode::wideToNarrow (argv [2]);
if (ship == NULL)
if (ship == nullptr)
{
result += Unicode::narrowToWide ("no ship");
return true;
@@ -334,7 +334,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S
uint32 const componentCrc = Crc::normalizeAndCalculate (componentName.c_str ());
ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc);
if (shipComponentDescriptor == NULL)
if (shipComponentDescriptor == nullptr)
{
result += Unicode::narrowToWide ("Invalid component name");
return true;
@@ -364,13 +364,13 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S
TangibleObject * const targetContainer = findTangible (user->getInventory ()->getNetworkId (), argv, 2);
std::string const & slotName = Unicode::wideToNarrow (argv [1]);
if (ship == NULL)
if (ship == nullptr)
{
result += Unicode::narrowToWide ("no ship");
return true;
}
if (targetContainer == NULL)
if (targetContainer == nullptr)
{
result += Unicode::narrowToWide ("no target container");
return true;
@@ -405,7 +405,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S
ShipObject * const ship = dynamic_cast<ShipObject *>(findTangible (user->getLookAtTarget (), argv, 2));
std::string const & slotName = Unicode::wideToNarrow (argv [1]);
if (ship == NULL)
if (ship == nullptr)
{
result += Unicode::narrowToWide ("no ship");
return true;
@@ -436,14 +436,14 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S
else if (isCommand (argv[0], CommandNames::pseudoDamageShip))
{
ShipObject const * const victimShipObject = user->getPilotedShip();
if (victimShipObject == NULL)
if (victimShipObject == nullptr)
{
result += Unicode::narrowToWide ("You are not piloting a ship.");
return true;
}
ShipObject const * const attackerShipObject = dynamic_cast<ShipObject *>(findTangible (user->getLookAtTarget (), argv, 2));
if (attackerShipObject == NULL)
if (attackerShipObject == nullptr)
{
result += Unicode::narrowToWide ("You don't have attacker ship targeted.");
return true;
@@ -486,12 +486,12 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S
ShipObject const * const idotShip = idot.getShipObject();
if (ship != NULL && ship != idotShip)
if (ship != nullptr && ship != idotShip)
continue;
uint32 const chassisType = idotShip->getChassisType();
ShipChassis const * const chassis = ShipChassis::findShipChassisByCrc(chassisType);
std::string const chassisTypeName = (chassis != NULL) ? chassis->getName().getString() : "<NO VALID CHASSIS>";
std::string const chassisTypeName = (chassis != nullptr) ? chassis->getName().getString() : "<NO VALID CHASSIS>";
float hpCur = 0.0f;
float hpMax = 0.0f;
@@ -522,7 +522,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S
{
ShipObject * const ship = dynamic_cast<ShipObject *>(findTangible (user->getLookAtTarget (), argv, 4));
if (ship == NULL)
if (ship == nullptr)
{
result += Unicode::narrowToWide ("no ship");
return true;
@@ -546,7 +546,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S
{
ShipObject * const ship = dynamic_cast<ShipObject *>(findTangible (user->getLookAtTarget (), argv, 4));
if (ship == NULL)
if (ship == nullptr)
{
result += Unicode::narrowToWide ("no ship");
return true;
@@ -99,7 +99,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const
{
CreatureObject * const creature = findCreature (userId, argv, 2);
if (creature == NULL)
if (creature == nullptr)
{
result += getErrorMessage (argv[0], ERR_INVALID_OBJECT);
}
@@ -107,7 +107,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const
{
const std::string skillName = Unicode::wideToNarrow (argv[1]);
const SkillObject * const skill = SkillManager::getInstance ().getSkill (skillName);
if (skill == NULL)
if (skill == nullptr)
{
result += Unicode::narrowToWide ("unknown skill");
}
@@ -126,7 +126,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const
{
CreatureObject * const creature = findCreature (userId, argv, 3);
if (creature == NULL)
if (creature == nullptr)
{
result += getErrorMessage (argv[0], ERR_INVALID_OBJECT);
}
@@ -146,7 +146,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const
{
CreatureObject * const creature = findCreature (userId, argv, 2);
if (creature == NULL)
if (creature == nullptr)
{
result += getErrorMessage (argv[0], ERR_INVALID_OBJECT);
}
@@ -198,7 +198,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const
{
CreatureObject * const creature = findCreature (userId, argv, 1);
if (creature == NULL)
if (creature == nullptr)
{
result += getErrorMessage (argv[0], ERR_INVALID_OBJECT);
}
@@ -233,7 +233,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const
{
CreatureObject * const creature = findCreature (userId, argv, 1);
if (creature == NULL)
if (creature == nullptr)
{
result += getErrorMessage (argv[0], ERR_INVALID_OBJECT);
}
@@ -262,7 +262,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const
{
CreatureObject * const creature = findCreature (userId, argv, 1);
if (creature == NULL)
if (creature == nullptr)
{
result += getErrorMessage (argv[0], ERR_INVALID_OBJECT);
}
@@ -288,7 +288,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const
{
CreatureObject * const creature = findCreature (userId, argv, 2);
if (creature == NULL)
if (creature == nullptr)
{
result += getErrorMessage (argv[0], ERR_INVALID_OBJECT);
}
@@ -296,7 +296,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const
{
std::string skillName = Unicode::wideToNarrow (argv[1]);
const SkillObject * skill = SkillManager::getInstance ().getSkill (skillName);
if (skill == NULL)
if (skill == nullptr)
{
result += Unicode::narrowToWide ("unknown skill");
}
@@ -317,7 +317,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const
{
CreatureObject * const creature = findCreature (userId, argv, 2);
if (creature == NULL)
if (creature == nullptr)
{
result += getErrorMessage (argv[0], ERR_INVALID_OBJECT);
}
@@ -336,7 +336,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const
{
CreatureObject * const creature = findCreature (userId, argv, 1);
if (creature == NULL)
if (creature == nullptr)
{
result += getErrorMessage (argv[0], ERR_INVALID_OBJECT);
}
@@ -367,7 +367,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const
{
CreatureObject * const creature = findCreature (userId, argv, 2);
if (creature == NULL)
if (creature == nullptr)
{
result += getErrorMessage (argv[0], ERR_INVALID_OBJECT);
}
@@ -384,7 +384,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const
{
CreatureObject * const creature = findCreature (userId, argv, 2);
if (creature == NULL)
if (creature == nullptr)
{
result += getErrorMessage (argv[0], ERR_INVALID_OBJECT);
}
@@ -401,7 +401,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const
{
CreatureObject * const creature = findCreature (userId, argv, 2);
if (creature == NULL)
if (creature == nullptr)
{
result += getErrorMessage (argv[0], ERR_INVALID_OBJECT);
}
@@ -418,7 +418,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const
{
CreatureObject * const creature = findCreature (userId, argv, 2);
if (creature == NULL)
if (creature == nullptr)
{
result += getErrorMessage (argv[0], ERR_INVALID_OBJECT);
}
@@ -435,7 +435,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const
{
CreatureObject * const creature = findCreature (userId, argv, 1);
if (creature == NULL)
if (creature == nullptr)
{
result += getErrorMessage (argv[0], ERR_INVALID_OBJECT);
}
@@ -66,9 +66,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const
AiShipController::setAttackingEnabled(true);
Object * const object = NetworkIdManager::getObjectById(userId);
ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL;
ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr;
if (serverObject != NULL)
if (serverObject != nullptr)
{
Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("[WAR] AI will now attack."), Unicode::emptyString);
}
@@ -80,9 +80,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const
AiShipController::setAttackingEnabled(false);
Object * const object = NetworkIdManager::getObjectById(userId);
ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL;
ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr;
if (serverObject != NULL)
if (serverObject != nullptr)
{
Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("[PEACE] AI will no longer attack."), Unicode::emptyString);
}
@@ -92,20 +92,20 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const
else if (isAbbrev(argv[0], "path"))
{
Object * const object = NetworkIdManager::getObjectById(userId);
ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL;
ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr;
if ( (serverObject != NULL)
if ( (serverObject != nullptr)
&& (argv.size () > 1))
{
NetworkId networkId(Unicode::wideToNarrow(argv[1]));
AiShipController * const aiShipController = AiShipController::getAiShipController(networkId);
if (aiShipController != NULL)
if (aiShipController != nullptr)
{
SpacePath * const spacePath = aiShipController->getPath();
if (spacePath != NULL)
if (spacePath != nullptr)
{
SpacePath::TransformList const & transformList = spacePath->getTransformList();
SpacePath::TransformList::const_iterator iterTransformList = transformList.begin();
@@ -127,7 +127,7 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const
}
else
{
Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("NULL path"), Unicode::emptyString);
Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("nullptr path"), Unicode::emptyString);
}
}
else
@@ -141,9 +141,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const
else if (isAbbrev(argv[0], "reloaddata"))
{
Object * const object = NetworkIdManager::getObjectById(userId);
ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL;
ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr;
if (serverObject != NULL)
if (serverObject != nullptr)
{
AiShipPilotData::reload();
@@ -156,10 +156,10 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const
else if (isAbbrev(argv[0], "clientDebug"))
{
Object * const object = NetworkIdManager::getObjectById(userId);
ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL;
ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr;
int temp;
if (serverObject != NULL)
if (serverObject != nullptr)
{
if ( serverObject->getObjVars().getItem("ai_debug_string", temp)
&& (temp > 0))
@@ -180,7 +180,7 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const
Client * const client = serverObject->getClient();
if (client != NULL)
if (client != nullptr)
{
AiDebugString aiDebugString;
aiDebugString.enableClearClientFlag();
@@ -209,9 +209,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const
else if (isAbbrev(argv[0], "serverDebug"))
{
Object * const object = NetworkIdManager::getObjectById(userId);
ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL;
ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr;
if (serverObject != NULL)
if (serverObject != nullptr)
{
AiShipController::setClientDebugEnabled(!AiShipController::isClientDebugEnabled());
@@ -225,9 +225,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const
else if (isAbbrev(argv[0], "clientDebugText"))
{
Object * const object = NetworkIdManager::getObjectById(userId);
ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL;
ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr;
if (serverObject != NULL)
if (serverObject != nullptr)
{
AiDebugString::setTextEnabled(!AiDebugString::isTextEnabled());
@@ -241,12 +241,12 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const
else if (isAbbrev(argv[0], "maneuver"))
{
Object * const object = NetworkIdManager::getObjectById(userId);
ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL;
CreatureObject const * const creatureObject = serverObject ? serverObject->asCreatureObject() : NULL;
ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr;
CreatureObject const * const creatureObject = serverObject ? serverObject->asCreatureObject() : nullptr;
if (serverObject)
{
if ((creatureObject != NULL) && (argv.size () > 1))
if ((creatureObject != nullptr) && (argv.size () > 1))
{
AiShipController const * const lookAtAiShipController = AiShipController::getAiShipController(creatureObject->getLookAtTarget());
@@ -295,9 +295,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const
else if (isAbbrev(argv[0], "fastAxis"))
{
Object * const object = NetworkIdManager::getObjectById(userId);
ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL;
ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr;
if (serverObject != NULL)
if (serverObject != nullptr)
{
Unicode::String systemMessage;
@@ -42,7 +42,7 @@ bool ConsoleCommandParserVeteran::performParsing (const NetworkId & userId, cons
{
NetworkId targetPlayer(Unicode::wideToNarrow (argv[1]));
ServerObject const * const so = safe_cast<ServerObject const *>(NetworkIdManager::getObjectById(targetPlayer));
Client const * const client = so ? so->getClient() : NULL;
Client const * const client = so ? so->getClient() : nullptr;
if (client)
{
std::string output;
@@ -107,7 +107,7 @@ bool ConsoleCommandParserVeteran::performParsing (const NetworkId & userId, cons
{
NetworkId targetPlayer(Unicode::wideToNarrow(argv[1]));
ServerObject const * const so = safe_cast<ServerObject const *>(NetworkIdManager::getObjectById(targetPlayer));
CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL;
CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr;
if (!playerCreature)
result += getErrorMessage(argv[0],ERR_INVALID_OBJECT);
else
@@ -126,7 +126,7 @@ bool ConsoleCommandParserVeteran::performParsing (const NetworkId & userId, cons
{
std::string url(Unicode::wideToNarrow(argv[1]));
ServerObject const * const so = safe_cast<ServerObject const *>(NetworkIdManager::getObjectById(userId));
Client const * const client = so ? so->getClient() : NULL;
Client const * const client = so ? so->getClient() : nullptr;
if (client)
{
client->launchWebBrowser(url);
@@ -41,14 +41,14 @@
#include "sharedCommandParser/CommandParser.h"
#include "sharedNetworkMessages/ConsoleChannelMessages.h"
CommandParser * ConsoleMgr::ms_parser = NULL;
CommandParser * ConsoleMgr::ms_parser = nullptr;
//-----------------------------------------------------------------------
void ConsoleMgr::install()
{
if (ms_parser == NULL)
if (ms_parser == nullptr)
{
ms_parser = new ConsoleCommandParserDefault();
ms_parser->addSubCommand(new ConsoleCommandParserCombatEngine ());
@@ -80,10 +80,10 @@ void ConsoleMgr::install()
void ConsoleMgr::remove()
{
if (ms_parser != NULL)
if (ms_parser != nullptr)
{
delete ms_parser;
ms_parser = NULL;
ms_parser = nullptr;
}
} // ConsoleMgr::remove
@@ -93,7 +93,7 @@ void ConsoleMgr::processString(const std::string & msg, Client *from, uint32 msg
{
DEBUG_REPORT_LOG_PRINT(true, ("Console Message Received: %s\n",(msg.c_str())));
if (ms_parser == NULL)
if (ms_parser == nullptr)
{
DEBUG_WARNING(true, ("Console command parser has not been created!"));
return;
@@ -17,9 +17,9 @@ public:
static void install();
static void remove();
static void processString(const std::string & msg, Client *from = NULL,uint32 msgId = 0);
static void broadcastString(const std::string & msg, Client *to = NULL, uint32 msgId = 0);
static void broadcastString(const CommandParser::String_t & msg, Client *to = NULL, uint32 msgId = 0);
static void processString(const std::string & msg, Client *from = nullptr,uint32 msgId = 0);
static void broadcastString(const std::string & msg, Client *to = nullptr, uint32 msgId = 0);
static void broadcastString(const CommandParser::String_t & msg, Client *to = nullptr, uint32 msgId = 0);
static void broadcastString(const std::string & msg, NetworkId to, uint32 msgId = 0);
private:
@@ -83,7 +83,7 @@ namespace AiCreatureControllerNamespace
bool s_installed = false;
typedef std::set<Client *> ObserverList;
PersistentCrcString * s_defaultCreatureName = NULL;
PersistentCrcString * s_defaultCreatureName = nullptr;
void remove();
Location getLocation(ServerObject const & serverObject);
@@ -97,7 +97,7 @@ void AiCreatureControllerNamespace::remove()
DEBUG_FATAL(!s_installed, ("Not installed."));
delete s_defaultCreatureName;
s_defaultCreatureName = NULL;
s_defaultCreatureName = nullptr;
s_installed = false;
}
@@ -106,9 +106,9 @@ void AiCreatureControllerNamespace::remove()
Location AiCreatureControllerNamespace::getLocation(ServerObject const & serverObject)
{
CellProperty const * const cellProperty = serverObject.getParentCell();
Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL;
Vector const & positionRelativeToCellOrWorld = (cellObject != NULL) ? serverObject.getPosition_c() : serverObject.getPosition_w();
NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid;
Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr;
Vector const & positionRelativeToCellOrWorld = (cellObject != nullptr) ? serverObject.getPosition_c() : serverObject.getPosition_w();
NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid;
return Location(positionRelativeToCellOrWorld, networkIdForCellOrWorld, Location::getCrcBySceneName(serverObject.getSceneId()));
}
@@ -164,10 +164,10 @@ AICreatureController::~AICreatureController()
Object * const owner = getOwner();
if (owner != NULL && owner->isAuthoritative() && !getHibernate() && m_hibernationDelay.get() > 0 && m_hibernationTimer.get() > 0)
if (owner != nullptr && owner->isAuthoritative() && !getHibernate() && m_hibernationDelay.get() > 0 && m_hibernationTimer.get() > 0)
ObjectTracker::removeDelayedHibernatingAI();
if ( (owner != NULL)
if ( (owner != nullptr)
&& AiLogManager::isLogging(owner->getNetworkId()))
{
AiLogManager::setLogging(owner->getNetworkId(), false);
@@ -205,9 +205,9 @@ void AICreatureController::CreatureNameChangedCallback::modified(AICreatureContr
void AICreatureController::handleMessage (int message, float value, const MessageQueue::Data* const data, uint32 flags)
{
CreatureObject * const owner = static_cast<CreatureObject*>(getOwner());
if (owner == NULL)
if (owner == nullptr)
{
DEBUG_FATAL(true, ("Owner is NULL in AiCreatureController::handleMessage\n"));
DEBUG_FATAL(true, ("Owner is nullptr in AiCreatureController::handleMessage\n"));
return;
}
@@ -219,7 +219,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag
AiMovementMessage const * const msg = safe_cast<const AiMovementMessage *>(data);
if (msg != NULL)
if (msg != nullptr)
{
if (owner->isAuthoritative())
{
@@ -256,7 +256,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetCreatureName) owner(%s)", getDebugInformation().c_str()));
MessageQueueGenericValueType<std::string> const * const msg = safe_cast<MessageQueueGenericValueType<std::string> const *>(data);
if (msg != NULL)
if (msg != nullptr)
{
setCreatureName(msg->getValue());
}
@@ -267,7 +267,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetHomeLocation) owner(%s)", getDebugInformation().c_str()));
MessageQueueGenericValueType<Location> const * const msg = safe_cast<MessageQueueGenericValueType<Location> const *>(data);
if (msg != NULL)
if (msg != nullptr)
{
setHomeLocation(msg->getValue());
}
@@ -278,7 +278,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetFrozen) owner(%s)", getDebugInformation().c_str()));
MessageQueueGenericValueType<bool> const * const msg = safe_cast<MessageQueueGenericValueType<bool> const *>(data);
if (msg != NULL)
if (msg != nullptr)
{
setFrozen(msg->getValue());
}
@@ -289,7 +289,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetRetreating) owner(%s)", getDebugInformation().c_str()));
MessageQueueGenericValueType<bool> const * const msg = safe_cast<MessageQueueGenericValueType<bool> const *>(data);
if (msg != NULL)
if (msg != nullptr)
{
setRetreating(msg->getValue());
}
@@ -300,7 +300,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetLogging) owner(%s)", getDebugInformation().c_str()));
MessageQueueGenericValueType<bool> const * const msg = safe_cast<MessageQueueGenericValueType<bool> const *>(data);
if (msg != NULL)
if (msg != nullptr)
{
setLogging(msg->getValue());
}
@@ -333,7 +333,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag
case CM_setHibernationDelay:
{
MessageQueueGenericValueType<float> const * const msg = safe_cast<MessageQueueGenericValueType<float> const *>(data);
if (msg != NULL)
if (msg != nullptr)
setHibernationDelay(msg->getValue());
}
break;
@@ -469,7 +469,7 @@ float AICreatureController::realAlter(float time)
CreatureObject * const creatureOwner = getCreature();
#ifdef _DEBUG
AiDebugString * aiDebugString = NULL;
AiDebugString * aiDebugString = nullptr;
if (!creatureOwner->getObservers().empty())
{
aiDebugString = new AiDebugString;
@@ -508,7 +508,7 @@ float AICreatureController::realAlter(float time)
if (!creatureOwner->isInWorld() || getHibernate())
{
#ifdef _DEBUG
if (aiDebugString != NULL)
if (aiDebugString != nullptr)
{
sendDebugAiToClients(*aiDebugString);
delete aiDebugString;
@@ -522,8 +522,8 @@ float AICreatureController::realAlter(float time)
// check floating
{
CollisionProperty const * const collision = creatureOwner->getCollisionProperty();
Footprint const * const foot = (collision != NULL) ? collision->getFootprint() : NULL;
bool floating = (foot != NULL) ? foot->isFloating() : false;
Footprint const * const foot = (collision != nullptr) ? collision->getFootprint() : nullptr;
bool floating = (foot != nullptr) ? foot->isFloating() : false;
if (floating)
{
@@ -547,7 +547,7 @@ float AICreatureController::realAlter(float time)
// Update our inPathfindingRegion flag whenever the behavior changes
CityPathGraph const * graph = CityPathGraphManager::getCityGraphFor(creatureOwner);
m_inPathfindingRegion = (graph != NULL);
m_inPathfindingRegion = (graph != nullptr);
applyMovementChange();
}
@@ -589,10 +589,10 @@ float AICreatureController::realAlter(float time)
bool resetHateTimer = false;
CachedNetworkId const & hateTarget = creatureOwner->getHateTarget();
CreatureObject * const hateTargetCreatureObject = CreatureObject::asCreatureObject(hateTarget.getObject());
CreatureController const * const hateTargetCreatureController = (hateTargetCreatureObject != NULL) ? CreatureController::asCreatureController(hateTargetCreatureObject->getController()) : NULL;
CreatureController const * const hateTargetCreatureController = (hateTargetCreatureObject != nullptr) ? CreatureController::asCreatureController(hateTargetCreatureObject->getController()) : nullptr;
if ( (hateTargetCreatureObject != NULL)
&& (hateTargetCreatureController != NULL))
if ( (hateTargetCreatureObject != nullptr)
&& (hateTargetCreatureController != nullptr))
{
float const hateTargetMovementSpeedSquared = hateTargetCreatureController->getCurrentVelocity().magnitudeSquared();
float const hateTargetWalkSpeedSquared = sqr(hateTargetCreatureObject->getWalkSpeed());
@@ -605,7 +605,7 @@ float AICreatureController::realAlter(float time)
{
Object * const combatStartLocationCell = NetworkIdManager::getObjectById(m_combatStartLocation.get().getCell());
Vector const & combatStartPosition_c = m_combatStartLocation.get().getCoordinates();
Vector const & combatStartPosition_w = (combatStartLocationCell != NULL) ? combatStartLocationCell->rotateTranslate_o2w(combatStartPosition_c) : combatStartPosition_c;
Vector const & combatStartPosition_w = (combatStartLocationCell != nullptr) ? combatStartLocationCell->rotateTranslate_o2w(combatStartPosition_c) : combatStartPosition_c;
float const distanceToCombatStartLocationSquared = creatureOwner->getPosition_w().magnitudeBetweenSquared(combatStartPosition_w);
float const aggroRadius = getAggroRadius();
@@ -621,7 +621,7 @@ float AICreatureController::realAlter(float time)
hateTargetCreatureObject->resetHateTimer();
}
}
else if (hateTarget.getObject() != NULL)
else if (hateTarget.getObject() != nullptr)
{
// AI don't need to lose interest in stationary AI
@@ -662,7 +662,7 @@ float AICreatureController::realAlter(float time)
}
#ifdef _DEBUG
if (aiDebugString != NULL)
if (aiDebugString != nullptr)
{
m_movement->addDebug(*aiDebugString);
}
@@ -697,7 +697,7 @@ float AICreatureController::realAlter(float time)
updateMovementType();
#ifdef _DEBUG
if (aiDebugString != NULL)
if (aiDebugString != nullptr)
{
sendDebugAiToClients(*aiDebugString);
delete aiDebugString;
@@ -711,7 +711,7 @@ float AICreatureController::realAlter(float time)
//----------------------------------------------------------------------
void AICreatureController::changeMovement(AiMovementBasePtr newMovement)
{
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::changeMovement() movement(%s)", (newMovement != AiMovementBaseNullPtr) ? AiMovementBase::getMovementString(newMovement->getType()) : "NULL"));
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::changeMovement() movement(%s)", (newMovement != AiMovementBaseNullPtr) ? AiMovementBase::getMovementString(newMovement->getType()) : "nullptr"));
if (getOwner()->isAuthoritative())
{
@@ -876,11 +876,11 @@ void AICreatureController::loiter(CellProperty const * homeCell, Vector const &
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f] Trying to loiter while retreating, failing request.", getDebugInformation().c_str(), ((homeCell != NULL) ? homeCell->getCellName() : "NULL"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay));
WARNING(true, ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f] Trying to loiter while retreating, failing request.", getDebugInformation().c_str(), ((homeCell != nullptr) ? homeCell->getCellName() : "nullptr"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay));
return;
}
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f]", getDebugInformation().c_str(), ((homeCell != NULL) ? homeCell->getCellName() : "NULL"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay));
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f]", getDebugInformation().c_str(), ((homeCell != nullptr) ? homeCell->getCellName() : "nullptr"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay));
AiMovementBasePtr movement(new AiMovementLoiter(this, homeCell, home_p, minDistance, maxDistance, minDelay, maxDelay));
@@ -910,7 +910,7 @@ void AICreatureController::moveTo(CellProperty const * cell, Vector const & targ
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f) Trying to moveTo while retreating, failing request.", getDebugInformation().c_str(), ((cell != NULL) ? cell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z, radius));
WARNING(true, ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f) Trying to moveTo while retreating, failing request.", getDebugInformation().c_str(), ((cell != nullptr) ? cell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z, radius));
return;
}
@@ -918,9 +918,9 @@ void AICreatureController::moveTo(CellProperty const * cell, Vector const & targ
if (getMovementType() == AMT_move)
{
AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : NULL;
AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : nullptr;
if (aiMovementMove != NULL)
if (aiMovementMove != nullptr)
{
AiLocation const & target = aiMovementMove->getTarget();
@@ -935,7 +935,7 @@ void AICreatureController::moveTo(CellProperty const * cell, Vector const & targ
if (!duplicateMovement)
{
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f)", getDebugInformation().c_str(), ((cell != NULL) ? cell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z, radius));
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f)", getDebugInformation().c_str(), ((cell != nullptr) ? cell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z, radius));
AiMovementBasePtr movement(new AiMovementMove(this, cell, target_p, radius));
@@ -957,9 +957,9 @@ void AICreatureController::moveTo(Unicode::String const & targetName)
if (getMovementType() == AMT_move)
{
AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : NULL;
AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : nullptr;
if (aiMovementMove != NULL)
if (aiMovementMove != nullptr)
{
if (aiMovementMove->getTargetName() == targetName)
{
@@ -992,8 +992,8 @@ void AICreatureController::patrol( std::vector<Location> const & locations, bool
if (getMovementType() == AMT_patrol)
{
AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : NULL;
if (aiMovementPatrol != NULL)
AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : nullptr;
if (aiMovementPatrol != nullptr)
{
// if ()
// {
@@ -1026,8 +1026,8 @@ void AICreatureController::patrol( std::vector<Unicode::String> const & location
if (getMovementType() == AMT_patrol)
{
AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : NULL;
if (aiMovementPatrol != NULL)
AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : nullptr;
if (aiMovementPatrol != nullptr)
{
// if ()
// {
@@ -1071,7 +1071,7 @@ bool AICreatureController::faceTo(CellProperty const * targetCell, Vector const
{
if (isRetreating())
{
WARNING(true, ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) Trying to faceTo while retreating, failing faceTo request.", getDebugInformation().c_str(), ((targetCell != NULL) ? targetCell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z));
WARNING(true, ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) Trying to faceTo while retreating, failing faceTo request.", getDebugInformation().c_str(), ((targetCell != nullptr) ? targetCell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z));
return false;
}
@@ -1079,9 +1079,9 @@ bool AICreatureController::faceTo(CellProperty const * targetCell, Vector const
if (getMovementType() == AMT_face)
{
AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : NULL;
AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : nullptr;
if (aiMovementFace != NULL)
if (aiMovementFace != nullptr)
{
AiLocation const & target = aiMovementFace->getTarget();
@@ -1095,7 +1095,7 @@ bool AICreatureController::faceTo(CellProperty const * targetCell, Vector const
if (!duplicateMovement)
{
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f)", getDebugInformation().c_str(), ((targetCell != NULL) ? targetCell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z));
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f)", getDebugInformation().c_str(), ((targetCell != nullptr) ? targetCell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z));
AiMovementBasePtr behavior(new AiMovementFace(this, targetCell, target_p));
@@ -1126,9 +1126,9 @@ bool AICreatureController::faceTo( NetworkId const & targetId )
if (getMovementType() == AMT_face)
{
AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : NULL;
AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : nullptr;
if (aiMovementFace != NULL)
if (aiMovementFace != nullptr)
{
AiLocation const & target = aiMovementFace->getTarget();
@@ -1171,9 +1171,9 @@ bool AICreatureController::follow( NetworkId const & targetId, float minDistance
if (getMovementType() == AMT_follow)
{
AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : NULL;
AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : nullptr;
if (aiMovementFollow != NULL)
if (aiMovementFollow != nullptr)
{
AiLocation const & target = aiMovementFollow->getTarget();
@@ -1219,9 +1219,9 @@ bool AICreatureController::follow( NetworkId const & targetId, Vector const & of
if (getMovementType() == AMT_follow)
{
AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : NULL;
AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : nullptr;
if (aiMovementFollow != NULL)
if (aiMovementFollow != nullptr)
{
AiLocation const & offsetTarget = aiMovementFollow->getOffsetTarget();
@@ -1403,9 +1403,9 @@ void AICreatureController::moveCreature( CellProperty const * newCell, Vector co
CellProperty * currentCell = getOwner()->getParentCell();
CellObject * newCellObject = NULL;
CellObject * newCellObject = nullptr;
if( (newCell != NULL) && (newCell != CellProperty::getWorldCellProperty()) )
if( (newCell != nullptr) && (newCell != CellProperty::getWorldCellProperty()) )
{
newCellObject = const_cast<CellObject*>(safe_cast<CellObject const *>(&newCell->getOwner()));
}
@@ -1422,12 +1422,12 @@ void AICreatureController::moveCreature( CellProperty const * newCell, Vector co
CellProperty const * destCell = getCreatureCell()->getDestinationCell(oldPosition+offset,newPosition+offset,dummy);
if((destCell != NULL) && (destCell != newCell))
if((destCell != nullptr) && (destCell != newCell))
{
newPosition = CollisionUtils::transformToCell(newCell,newPosition,destCell);
newCell = destCell;
newCellObject = NULL;
newCellObject = nullptr;
if(newCell != CellProperty::getWorldCellProperty())
{
@@ -1820,15 +1820,15 @@ AICreatureController * AICreatureController::getAiCreatureController(NetworkId c
{
Object * const object = NetworkIdManager::getObjectById(networkId);
return (object != NULL) ? AICreatureController::asAiCreatureController(object->getController()) : NULL;
return (object != nullptr) ? AICreatureController::asAiCreatureController(object->getController()) : nullptr;
}
// ----------------------------------------------------------------------
AICreatureController * AICreatureController::asAiCreatureController(Controller * controller)
{
CreatureController * const creatureController = (controller != NULL) ? controller->asCreatureController() : NULL;
AICreatureController * const aiCreatureController = (creatureController != NULL) ? creatureController->asAiCreatureController() : NULL;
CreatureController * const creatureController = (controller != nullptr) ? controller->asCreatureController() : nullptr;
AICreatureController * const aiCreatureController = (creatureController != nullptr) ? creatureController->asAiCreatureController() : nullptr;
return aiCreatureController;
}
@@ -1837,8 +1837,8 @@ AICreatureController * AICreatureController::asAiCreatureController(Controller *
AICreatureController const * AICreatureController::asAiCreatureController(Controller const * controller)
{
CreatureController const * const creatureController = (controller != NULL) ? controller->asCreatureController() : NULL;
AICreatureController const * const aiCreatureController = (creatureController != NULL) ? creatureController->asAiCreatureController() : NULL;
CreatureController const * const creatureController = (controller != nullptr) ? controller->asCreatureController() : nullptr;
AICreatureController const * const aiCreatureController = (creatureController != nullptr) ? creatureController->asAiCreatureController() : nullptr;
return aiCreatureController;
}
@@ -1880,7 +1880,7 @@ float AICreatureController::getRespectRadius(NetworkId const & target) const
CreatureObject const * respectCreatureObject = CreatureObject::getCreatureObject(target);
if (respectCreatureObject != NULL)
if (respectCreatureObject != nullptr)
{
// If the target has a master, then use the master's level for the respect calculation
@@ -1893,7 +1893,7 @@ float AICreatureController::getRespectRadius(NetworkId const & target) const
// Respect is only towards players
if ( (respectCreatureObject != NULL)
if ( (respectCreatureObject != nullptr)
&& respectCreatureObject->isPlayerControlled())
{
CreatureObject const * const creatureOwner = getCreature();
@@ -1906,7 +1906,7 @@ float AICreatureController::getRespectRadius(NetworkId const & target) const
}
else
{
WARNING(true, ("AICreatureController::getRespectRadius() owner(%s) master(%s) The owner has a master who is not a player. Why does this happen?", getDebugInformation().c_str(), (respectCreatureObject != NULL) ? respectCreatureObject->getDebugInformation().c_str() : masterId.getValueString().c_str()));
WARNING(true, ("AICreatureController::getRespectRadius() owner(%s) master(%s) The owner has a master who is not a player. Why does this happen?", getDebugInformation().c_str(), (respectCreatureObject != nullptr) ? respectCreatureObject->getDebugInformation().c_str() : masterId.getValueString().c_str()));
}
}
@@ -1942,7 +1942,7 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString)
// Display the name and level
{
aiDebugString.addText(fs.sprintf("%d %s\n", creatureOwner->getLevel(), (getCreatureName().isEmpty() ? "NULL" : getCreatureName().getString())), PackedRgb::solidWhite);
aiDebugString.addText(fs.sprintf("%d %s\n", creatureOwner->getLevel(), (getCreatureName().isEmpty() ? "nullptr" : getCreatureName().getString())), PackedRgb::solidWhite);
}
// Display the look at target
@@ -1990,7 +1990,7 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString)
{
Floor const * const floor = CollisionWorld::getFloorStandingOn(*creatureOwner);
aiDebugString.addText(fs.sprintf("floor (%s)\n", (floor == NULL) ? "none" : floor->getId().getValueString().c_str()), PackedRgb::solidWhite);
aiDebugString.addText(fs.sprintf("floor (%s)\n", (floor == nullptr) ? "none" : floor->getId().getValueString().c_str()), PackedRgb::solidWhite);
}
// Display the AI movement speed
@@ -2008,15 +2008,15 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString)
// Primary Weapon
{
ServerObject const * const primaryServerObject = ServerObject::getServerObject(getPrimaryWeapon());
WeaponObject const * const primaryWeaponObject = (primaryServerObject != NULL) ? primaryServerObject->asWeaponObject() : NULL;
WeaponObject const * const primaryWeaponObject = (primaryServerObject != nullptr) ? primaryServerObject->asWeaponObject() : nullptr;
if (primaryWeaponObject != NULL)
if (primaryWeaponObject != nullptr)
{
aiDebugString.addText(fs.sprintf("%s pri(%s) [%.0f...%.0f] sp(%s)\n", (usingPrimaryWeapon() ? "->" : ""), FileNameUtils::get(primaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), primaryWeaponObject->getMinRange(), primaryWeaponObject->getMaxRange(), m_aiCreatureData->m_primarySpecials.isEmpty() ? "none" : m_aiCreatureData->m_primarySpecials.getString()), PackedRgb::solidWhite);
}
else
{
aiDebugString.addText(fs.sprintf("pri(NULL:ERROR)\n"), PackedRgb::solidWhite);
aiDebugString.addText(fs.sprintf("pri(nullptr:ERROR)\n"), PackedRgb::solidWhite);
}
//if (usingPrimaryWeapon())
@@ -2040,9 +2040,9 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString)
// Secondary Weapon
{
ServerObject const * const secondaryServerObject = ServerObject::getServerObject(getSecondaryWeapon());
WeaponObject const * const secondaryWeaponObject = (secondaryServerObject != NULL) ? secondaryServerObject->asWeaponObject() : NULL;
WeaponObject const * const secondaryWeaponObject = (secondaryServerObject != nullptr) ? secondaryServerObject->asWeaponObject() : nullptr;
if (secondaryWeaponObject != NULL)
if (secondaryWeaponObject != nullptr)
{
aiDebugString.addText(fs.sprintf("%s sec (%s) [%.0f...%.0f] sp(%s)\n", (usingSecondaryWeapon() ? "->" : ""), FileNameUtils::get(secondaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), secondaryWeaponObject->getMinRange(), secondaryWeaponObject->getMaxRange(), m_aiCreatureData->m_secondarySpecials.isEmpty() ? "none" : m_aiCreatureData->m_secondarySpecials.getString()), PackedRgb::solidWhite);
}
@@ -2113,13 +2113,13 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString)
TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject());
float const hate = iterHateList->second;
std::string hateTargetName;
if (hateTargetTangibleObject != NULL)
if (hateTargetTangibleObject != nullptr)
{
hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str();
}
else
{
hateTargetName = "NULL";
hateTargetName = "nullptr";
}
aiDebugString.addText(fs.sprintf("%s:%s(%.1f)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), hate), (iterHateList == hateList.begin()) ? PackedRgb::solidGreen : PackedRgb::solidRed);
@@ -2174,7 +2174,7 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString)
// Only send to the client if the objvar is set
int temp = 0;
if ( (characterObject != NULL)
if ( (characterObject != nullptr)
&& characterObject->getObjVars().getItem("ai_debug_string", temp))
{
if (temp > 0)
@@ -2196,7 +2196,7 @@ void AICreatureController::setHomeLocation(Location const & location)
{
if (getOwner()->isAuthoritative())
{
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::setHomeLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), location.getSceneIdCrc(), (location.getSceneId() != NULL) ? location.getSceneId() : "NULL", location.getCell().getValueString().c_str(), location.getCoordinates().x, location.getCoordinates().y, location.getCoordinates().z));
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::setHomeLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), location.getSceneIdCrc(), (location.getSceneId() != nullptr) ? location.getSceneId() : "nullptr", location.getCell().getValueString().c_str(), location.getCoordinates().x, location.getCoordinates().y, location.getCoordinates().z));
m_homeLocation = location;
}
@@ -2221,7 +2221,7 @@ void AICreatureController::markCombatStartLocation()
{
m_combatStartLocation = getLocation(*creatureOwner);
LOGC(AiLogManager::isLogging(creatureOwner->getNetworkId()), "debug_ai", ("AICreatureController::markCombatStartLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), m_combatStartLocation.get().getSceneIdCrc(), (m_combatStartLocation.get().getSceneId() != NULL) ? m_combatStartLocation.get().getSceneId() : "NULL", m_combatStartLocation.get().getCell().getValueString().c_str(), m_combatStartLocation.get().getCoordinates().x, m_combatStartLocation.get().getCoordinates().y, m_combatStartLocation.get().getCoordinates().z));
LOGC(AiLogManager::isLogging(creatureOwner->getNetworkId()), "debug_ai", ("AICreatureController::markCombatStartLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), m_combatStartLocation.get().getSceneIdCrc(), (m_combatStartLocation.get().getSceneId() != nullptr) ? m_combatStartLocation.get().getSceneId() : "nullptr", m_combatStartLocation.get().getCell().getValueString().c_str(), m_combatStartLocation.get().getCoordinates().x, m_combatStartLocation.get().getCoordinates().y, m_combatStartLocation.get().getCoordinates().z));
m_primaryWeaponActions.reset();
m_secondaryWeaponActions.reset();
@@ -2279,14 +2279,14 @@ void AICreatureController::onCreatureNameChanged(std::string const & creatureNam
AiCreatureCombatProfile const * const primaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_primarySpecials);
if (primaryWeaponCombatProfile != NULL)
if (primaryWeaponCombatProfile != nullptr)
{
m_primaryWeaponActions.setCombatProfile(*creatureOwner, *primaryWeaponCombatProfile);
}
AiCreatureCombatProfile const * const secondaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_secondarySpecials);
if (secondaryWeaponCombatProfile != NULL)
if (secondaryWeaponCombatProfile != nullptr)
{
m_secondaryWeaponActions.setCombatProfile(*creatureOwner, *secondaryWeaponCombatProfile);
}
@@ -2326,7 +2326,7 @@ void AICreatureController::destroyPrimaryWeapon()
{
WeaponObject * const primaryWeapon = WeaponObject::getWeaponObject(getPrimaryWeapon());
if (primaryWeapon != NULL)
if (primaryWeapon != nullptr)
{
unEquipWeapons();
primaryWeapon->permanentlyDestroy(DeleteReasons::God);
@@ -2361,7 +2361,7 @@ void AICreatureController::destroySecondaryWeapon()
{
WeaponObject * const secondaryWeapon = WeaponObject::getWeaponObject(getSecondaryWeapon());
if (secondaryWeapon != NULL)
if (secondaryWeapon != nullptr)
{
unEquipWeapons();
secondaryWeapon->permanentlyDestroy(DeleteReasons::God);
@@ -2372,7 +2372,7 @@ void AICreatureController::destroySecondaryWeapon()
PersistentCrcString const & AICreatureController::getCreatureName() const
{
if (m_aiCreatureData->m_name == NULL)
if (m_aiCreatureData->m_name == nullptr)
{
return *s_defaultCreatureName;
}
@@ -2401,7 +2401,7 @@ NetworkId AICreatureController::createWeapon(char const * const functionName, Cr
CreatureObject * const creatureOwner = getCreature();
ServerObject * const inventory = creatureOwner->getInventory();
if (inventory == NULL)
if (inventory == nullptr)
{
WARNING(true, ("AICreatureController::%s() Unable to find inventory for (%s) to place a weapon(%s)", functionName, getDebugInformation().c_str(), weaponName.getString()));
}
@@ -2440,7 +2440,7 @@ NetworkId AICreatureController::createWeapon(char const * const functionName, Cr
bool const persisted = false;
ServerObject * const newObject = ServerWorld::createNewObject(weaponCrcName.getCrc(), *inventory, persisted);
if (newObject != NULL)
if (newObject != nullptr)
{
result = newObject->getNetworkId();
}
@@ -2464,7 +2464,7 @@ NetworkId AICreatureController::getUnarmedWeapon()
CreatureObject * const creatureOwner = getCreature();
WeaponObject * const defaultWeapon = creatureOwner->getDefaultWeapon();
if (defaultWeapon != NULL)
if (defaultWeapon != nullptr)
{
result = defaultWeapon->getNetworkId();
}
@@ -2492,9 +2492,9 @@ void AICreatureController::equipPrimaryWeapon()
if (!usingPrimaryWeapon())
{
ServerObject * const primaryWeaponServerObject = ServerObject::getServerObject(getPrimaryWeapon());
WeaponObject * const primaryWeaponObject = (primaryWeaponServerObject != NULL) ? primaryWeaponServerObject->asWeaponObject() : NULL;
WeaponObject * const primaryWeaponObject = (primaryWeaponServerObject != nullptr) ? primaryWeaponServerObject->asWeaponObject() : nullptr;
if (primaryWeaponObject != NULL)
if (primaryWeaponObject != nullptr)
{
unEquipWeapons();
@@ -2508,7 +2508,7 @@ void AICreatureController::equipPrimaryWeapon()
{
Container::ContainerErrorCode errorCode;
if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *primaryWeaponServerObject, NULL, errorCode))
if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *primaryWeaponServerObject, nullptr, errorCode))
{
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::equipPrimaryWeapon() owner(%s) primaryWeapon(%s)\n", getDebugInformation().c_str(), primaryWeaponServerObject->getDebugInformation().c_str()));
@@ -2516,7 +2516,7 @@ void AICreatureController::equipPrimaryWeapon()
GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(creatureOwner);
if (gameScriptObject != NULL)
if (gameScriptObject != nullptr)
{
ScriptParams scriptParams;
scriptParams.addParam(primaryWeaponObject->getNetworkId());
@@ -2557,9 +2557,9 @@ void AICreatureController::equipSecondaryWeapon()
if (!usingSecondaryWeapon())
{
ServerObject * const secondaryWeaponServerObject = ServerObject::getServerObject(getSecondaryWeapon());
WeaponObject * const secondaryWeaponObject = (secondaryWeaponServerObject != NULL) ? secondaryWeaponServerObject->asWeaponObject() : NULL;
WeaponObject * const secondaryWeaponObject = (secondaryWeaponServerObject != nullptr) ? secondaryWeaponServerObject->asWeaponObject() : nullptr;
if (secondaryWeaponObject != NULL)
if (secondaryWeaponObject != nullptr)
{
unEquipWeapons();
@@ -2573,7 +2573,7 @@ void AICreatureController::equipSecondaryWeapon()
{
Container::ContainerErrorCode errorCode;
if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *secondaryWeaponServerObject, NULL, errorCode))
if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *secondaryWeaponServerObject, nullptr, errorCode))
{
LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::equipSecondaryWeapon() owner(%s) secondaryWeapon(%s) errorCode(%d)\n", getDebugInformation().c_str(), secondaryWeaponServerObject->getDebugInformation().c_str()));
@@ -2581,7 +2581,7 @@ void AICreatureController::equipSecondaryWeapon()
GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(creatureOwner);
if (gameScriptObject != NULL)
if (gameScriptObject != nullptr)
{
ScriptParams scriptParams;
scriptParams.addParam(secondaryWeaponObject->getNetworkId());
@@ -2631,7 +2631,7 @@ void AICreatureController::unEquipWeapons()
{
ServerObject * const inventory = creatureOwner->getInventory();
if (inventory != NULL)
if (inventory != nullptr)
{
Container::ContainerErrorCode error;
@@ -2648,13 +2648,13 @@ void AICreatureController::unEquipWeapons()
// Equip the default weapon
{
if (defaultWeapon != NULL)
if (defaultWeapon != nullptr)
{
creatureOwner->setCurrentWeapon(*defaultWeapon);
}
else
{
WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) NULL default weapon", getDebugInformation().c_str()));
WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) nullptr default weapon", getDebugInformation().c_str()));
}
}
}
@@ -2690,7 +2690,7 @@ bool AICreatureController::usingPrimaryWeapon()
{
WeaponObject const * const currentWeaponObject = getCreature()->getCurrentWeapon();
if (currentWeaponObject != NULL)
if (currentWeaponObject != nullptr)
{
result = (getPrimaryWeapon() == currentWeaponObject->getNetworkId());
}
@@ -2708,7 +2708,7 @@ bool AICreatureController::usingSecondaryWeapon()
{
WeaponObject const * const currentWeaponObject = getCreature()->getCurrentWeapon();
if (currentWeaponObject != NULL)
if (currentWeaponObject != nullptr)
{
result = (getSecondaryWeapon() == currentWeaponObject->getNetworkId());
}
@@ -2815,7 +2815,7 @@ void AICreatureController::setRetreating(bool const retreating)
{
CellObject const * const cellObject = CellObject::getCellObject(cellId);
if (cellObject != NULL)
if (cellObject != nullptr)
{
CellProperty const * const cellProperty = cellObject->getCellProperty();
@@ -2965,7 +2965,7 @@ time_t AICreatureController::getKnockDownRecoveryTime() const
{
AiCreatureCombatProfile const * const combatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_primarySpecials);
return (combatProfile != NULL) ? combatProfile->m_knockDownRecoveryTime : 0;
return (combatProfile != nullptr) ? combatProfile->m_knockDownRecoveryTime : 0;
}
//-----------------------------------------------------------------------
std::string const AICreatureController::getCombatActionsString()
@@ -2979,7 +2979,7 @@ std::string const AICreatureController::getCombatActionsString()
{
WeaponObject const * const primaryWeaponObject = WeaponObject::getWeaponObject(getPrimaryWeapon());
if (primaryWeaponObject != NULL)
if (primaryWeaponObject != nullptr)
{
result += fs.sprintf("PRIMARY WEAPON >>> %s range[%.0f...%.0f] %s\n", FileNameUtils::get(primaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), primaryWeaponObject->getMinRange(), primaryWeaponObject->getMaxRange(), usingPrimaryWeapon() ? "(active)" : "");
}
@@ -2989,7 +2989,7 @@ std::string const AICreatureController::getCombatActionsString()
}
AiCreatureCombatProfile const * const primaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_primarySpecials);
if (primaryWeaponCombatProfile != NULL)
if (primaryWeaponCombatProfile != nullptr)
{
result += primaryWeaponCombatProfile->toString();
}
@@ -3003,7 +3003,7 @@ std::string const AICreatureController::getCombatActionsString()
{
WeaponObject const * const secondaryWeaponObject = WeaponObject::getWeaponObject(getSecondaryWeapon());
if (secondaryWeaponObject != NULL)
if (secondaryWeaponObject != nullptr)
{
result += fs.sprintf("SECONDARY WEAPON >>> %s range[%.0f...%.0f] %s\n", FileNameUtils::get(secondaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), secondaryWeaponObject->getMinRange(), secondaryWeaponObject->getMaxRange(), usingSecondaryWeapon() ? "(active)" : "");
}
@@ -3014,7 +3014,7 @@ std::string const AICreatureController::getCombatActionsString()
AiCreatureCombatProfile const * const secondaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_secondarySpecials);
if (secondaryWeaponCombatProfile != NULL)
if (secondaryWeaponCombatProfile != nullptr)
{
result += secondaryWeaponCombatProfile->toString();
}
@@ -127,15 +127,15 @@ AiShipController * AiShipController::getAiShipController(NetworkId const & unit)
{
Object * const object = NetworkIdManager::getObjectById(unit);
return (object != NULL) ? AiShipController::asAiShipController(object->getController()) : NULL;
return (object != nullptr) ? AiShipController::asAiShipController(object->getController()) : nullptr;
}
// ----------------------------------------------------------------------
AiShipController * AiShipController::asAiShipController(Controller * const controller)
{
ShipController * const shipController = (controller != NULL) ? controller->asShipController() : NULL;
AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL;
ShipController * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr;
AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr;
return aiShipController;
}
@@ -144,8 +144,8 @@ AiShipController * AiShipController::asAiShipController(Controller * const contr
AiShipController const * AiShipController::asAiShipController(Controller const * const controller)
{
ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL;
AiShipController const * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL;
ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr;
AiShipController const * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr;
return aiShipController;
}
@@ -155,18 +155,18 @@ AiShipController const * AiShipController::asAiShipController(Controller const *
AiShipController::AiShipController(ShipObject * const owner) :
ShipController(owner),
m_pilotData(&AiShipPilotData::getDefaultPilotData()),
m_pendingNonAttackBehavior(NULL),
m_nonAttackBehavior(NULL),
m_pendingAttackBehavior(NULL),
m_attackBehavior(NULL),
m_pendingNonAttackBehavior(nullptr),
m_nonAttackBehavior(nullptr),
m_pendingAttackBehavior(nullptr),
m_attackBehavior(nullptr),
m_shipName(),
m_shipClass(ShipAiReactionManager::SC_invalid),
m_requestedSlowDown(false),
m_squad(NULL),
m_attackSquad(NULL),
m_squad(nullptr),
m_attackSquad(nullptr),
m_formationPosition_l(),
m_attackFormationPosition_l(),
m_path(NULL),
m_path(nullptr),
m_currentPathIndex(0),
m_aggroRadius(200.0f),
m_countermeasureState(CS_none),
@@ -190,22 +190,22 @@ AiShipController::~AiShipController()
// Remove this unit from its squad
if (m_squad != NULL)
if (m_squad != nullptr)
{
// The owner of the squad is SpaceSquadManager
getSquad().removeUnit(getOwner()->getNetworkId());
m_squad = NULL;
m_squad = nullptr;
}
// Remove this unit from its attack squad
if (m_attackSquad != NULL)
if (m_attackSquad != nullptr)
{
// The owner of the attack squad is SpaceSquad
m_attackSquad->removeUnit(getOwner()->getNetworkId());
m_attackSquad = NULL;
m_attackSquad = nullptr;
}
else
{
@@ -215,17 +215,17 @@ AiShipController::~AiShipController()
// Remove path here.
SpacePathManager::release(m_path, getOwner());
m_path = NULL;
m_pilotData = NULL;
m_path = nullptr;
m_pilotData = nullptr;
delete m_nonAttackBehavior;
m_nonAttackBehavior = NULL;
m_nonAttackBehavior = nullptr;
delete m_pendingNonAttackBehavior;
m_pendingNonAttackBehavior = NULL;
m_pendingNonAttackBehavior = nullptr;
delete m_pendingAttackBehavior;
m_pendingAttackBehavior = NULL;
m_pendingAttackBehavior = nullptr;
delete m_attackBehavior;
m_attackBehavior = NULL;
m_attackBehavior = nullptr;
delete m_reactToMissileTimer;
delete m_pilotManagerInfo;
delete m_exclusiveAggroSet;
@@ -234,7 +234,7 @@ AiShipController::~AiShipController()
// ----------------------------------------------------------------------
void AiShipController::endBaselines()
{
DEBUG_FATAL((m_squad != NULL), ("m_squad should be NULL"));
DEBUG_FATAL((m_squad != nullptr), ("m_squad should be nullptr"));
m_squad = SpaceSquadManager::createSquad();
getSquad().addUnit(getOwner()->getNetworkId());
@@ -252,7 +252,7 @@ float AiShipController::realAlter(float const elapsedTime)
#ifdef _DEBUG
AiDebugString * aiDebugString = NULL;
AiDebugString * aiDebugString = nullptr;
if ( s_spaceAiClientDebugEnabled
&& !getShipOwner()->getObservers().empty())
{
@@ -263,25 +263,25 @@ float AiShipController::realAlter(float const elapsedTime)
// We have to have a pending behavior because while in a behavior a trigger can get called which can then kill that behavior, so we have to wait until the next frame to switch behaviors so they don't stomp each other from triggers.
if (m_pendingNonAttackBehavior != NULL)
if (m_pendingNonAttackBehavior != nullptr)
{
delete m_nonAttackBehavior;
m_nonAttackBehavior = m_pendingNonAttackBehavior;
m_pendingNonAttackBehavior = NULL;
m_pendingNonAttackBehavior = nullptr;
}
if (m_pendingDockingBehavior != NULL)
if (m_pendingDockingBehavior != nullptr)
{
delete m_dockingBehavior;
m_dockingBehavior = m_pendingDockingBehavior;
m_pendingDockingBehavior = NULL;
m_pendingDockingBehavior = nullptr;
}
if ( (m_dockingBehavior != NULL)
if ( (m_dockingBehavior != nullptr)
&& (m_dockingBehavior->isDockFinished()))
{
delete m_dockingBehavior;
m_dockingBehavior = NULL;
m_dockingBehavior = nullptr;
}
m_yawPosition = 0.f;
@@ -292,7 +292,7 @@ float AiShipController::realAlter(float const elapsedTime)
ShipObject * const shipOwner = NON_NULL(getShipOwner());
PROFILER_AUTO_BLOCK_DEFINE("behaviors");
if (m_attackBehavior != NULL) // This was added for ships that are contructed for AI but not fully contructed proper using the space_mobile.tab
if (m_attackBehavior != nullptr) // This was added for ships that are contructed for AI but not fully contructed proper using the space_mobile.tab
{
if (isAttacking()) // Capital ships never go into attack mode as such, always follow their non-attacking behavior (although they may fire turrets as they go)
{
@@ -314,7 +314,7 @@ float AiShipController::realAlter(float const elapsedTime)
shipOwner->openWings();
}
if (m_dockingBehavior != NULL)
if (m_dockingBehavior != nullptr)
{
m_dockingBehavior->unDock();
}
@@ -325,7 +325,7 @@ float AiShipController::realAlter(float const elapsedTime)
m_attackBehavior->alter(elapsedTime);
#ifdef _DEBUG
if (aiDebugString != NULL)
if (aiDebugString != nullptr)
{
m_attackBehavior->addDebug(*aiDebugString);
}
@@ -337,9 +337,9 @@ float AiShipController::realAlter(float const elapsedTime)
Object * const leaderObject = getAttackSquad().getLeader().getObject();
ShipController * const leaderShipController = leaderObject->getController()->asShipController();
AiShipController * const leaderAiShipController = (leaderShipController != NULL) ? leaderShipController->asAiShipController() : NULL;
AiShipController * const leaderAiShipController = (leaderShipController != nullptr) ? leaderShipController->asAiShipController() : nullptr;
if (leaderAiShipController != NULL)
if (leaderAiShipController != nullptr)
{
Transform transform(leaderObject->getTransform_o2w());
transform.setPosition_p(leaderAiShipController->getMoveToGoalPosition_w());
@@ -361,7 +361,7 @@ float AiShipController::realAlter(float const elapsedTime)
{
delete m_attackBehavior;
m_attackBehavior = m_pendingAttackBehavior;
m_pendingAttackBehavior = NULL;
m_pendingAttackBehavior = nullptr;
}
}
else if (isBeingDocked())
@@ -370,18 +370,18 @@ float AiShipController::realAlter(float const elapsedTime)
setThrottle(0.0f);
}
else if (m_dockingBehavior != NULL)
else if (m_dockingBehavior != nullptr)
{
m_dockingBehavior->alter(elapsedTime);
#ifdef _DEBUG
if (aiDebugString != NULL)
if (aiDebugString != nullptr)
{
m_dockingBehavior->addDebug(*aiDebugString);
}
#endif // _DEBUG
}
else if (m_nonAttackBehavior != NULL)
else if (m_nonAttackBehavior != nullptr)
{
PROFILER_AUTO_BLOCK_DEFINE("non-attack behaviors");
@@ -413,7 +413,7 @@ float AiShipController::realAlter(float const elapsedTime)
m_nonAttackBehavior->alter(elapsedTime);
#ifdef _DEBUG
if (aiDebugString != NULL)
if (aiDebugString != nullptr)
{
m_nonAttackBehavior->addDebug(*aiDebugString);
}
@@ -425,7 +425,7 @@ float AiShipController::realAlter(float const elapsedTime)
Object * const squadLeader = getSquad().getLeader().getObject();
if (squadLeader != NULL)
if (squadLeader != nullptr)
{
Vector goalPosition_w(Formation::getPosition_w(squadLeader->getTransform_o2w(), getFormationPosition_l()));
@@ -434,9 +434,9 @@ float AiShipController::realAlter(float const elapsedTime)
if (getOwner()->getPosition_w().magnitudeBetweenSquared(goalPosition_w) > sqr(getLargestTurnRadius() * s_slowDownTurnRadiusGain))
{
ShipController * const followedUnitShipController = squadLeader->getController()->asShipController();
AiShipController * const followedUnitAiShipController = (followedUnitShipController != NULL) ? followedUnitShipController->asAiShipController() : NULL;
AiShipController * const followedUnitAiShipController = (followedUnitShipController != nullptr) ? followedUnitShipController->asAiShipController() : nullptr;
if (followedUnitAiShipController != NULL)
if (followedUnitAiShipController != nullptr)
{
followedUnitAiShipController->requestSlowDown();
}
@@ -462,7 +462,7 @@ float AiShipController::realAlter(float const elapsedTime)
}
#ifdef _DEBUG
if (aiDebugString != NULL)
if (aiDebugString != nullptr)
{
m_nonAttackBehavior->addDebug(*aiDebugString);
}
@@ -476,7 +476,7 @@ float AiShipController::realAlter(float const elapsedTime)
}
else
{
DEBUG_WARNING(true, ("debug_ai: There should never be a NULL non-attacking behavior %s", getOwner()->getDebugInformation().c_str()));
DEBUG_WARNING(true, ("debug_ai: There should never be a nullptr non-attacking behavior %s", getOwner()->getDebugInformation().c_str()));
}
}
@@ -551,8 +551,8 @@ float AiShipController::realAlter(float const elapsedTime)
}
#ifdef _DEBUG
if ( (m_attackBehavior != NULL)
&& (aiDebugString != NULL))
if ( (m_attackBehavior != nullptr)
&& (aiDebugString != nullptr))
{
PROFILER_AUTO_BLOCK_DEFINE("sendDebugAiToClients");
sendDebugAiToClients(*aiDebugString);
@@ -574,7 +574,7 @@ void AiShipController::moveTo(Vector const & position_w, float const throttle, f
// If we are not following a unit, see if we need to slow down for someone
if ( (m_nonAttackBehavior != NULL)
if ( (m_nonAttackBehavior != nullptr)
&& (m_nonAttackBehavior->getBehaviorType() != ASBT_follow)
&& m_requestedSlowDown
&& !isAttacking())
@@ -645,16 +645,16 @@ bool AiShipController::addDamageTaken(NetworkId const & attackingUnit, float con
{
ShipObject const * const attackingShipObject = ShipObject::asShipObject(NetworkIdManager::getObjectById(attackingUnit));
if (attackingShipObject != NULL)
if (attackingShipObject != nullptr)
{
CreatureObject const * const attackingPilotCreatureObject = attackingShipObject->getPilot();
if ( (attackingPilotCreatureObject != NULL)
if ( (attackingPilotCreatureObject != nullptr)
&& attackingPilotCreatureObject->isPlayerControlled())
{
GroupObject * const groupObject = attackingPilotCreatureObject->getGroup();
if (groupObject != NULL)
if (groupObject != nullptr)
{
GroupObject::GroupMemberVector const & groupMembers = groupObject->getGroupMembers();
GroupObject::GroupMemberVector::const_iterator iterGroupMembers = groupMembers.begin();
@@ -665,11 +665,11 @@ bool AiShipController::addDamageTaken(NetworkId const & attackingUnit, float con
NetworkId const & groupMemberPilotNetworkId = groupMember.first;
CreatureObject const * const groupMemberPilotCreatureObject = CreatureObject::asCreatureObject(NetworkIdManager::getObjectById(groupMemberPilotNetworkId));
if (groupMemberPilotCreatureObject != NULL)
if (groupMemberPilotCreatureObject != nullptr)
{
ShipObject const * const groupMemberShipObject = groupMemberPilotCreatureObject->getPilotedShip();
if (groupMemberShipObject != NULL)
if (groupMemberShipObject != nullptr)
{
if (groupMemberShipObject != attackingShipObject)
{
@@ -749,24 +749,24 @@ void AiShipController::follow(NetworkId const & followedUnit, Vector const & dir
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::follow() owner(%s) followedUnit(%s) direction_o(%.1f, %.1f, %.1f) offset(%.1f)", getOwner()->getNetworkId().getValueString().c_str(), followedUnit.getValueString().c_str(), direction_l.x, direction_l.y, direction_l.z, distance));
SpacePathManager::release(m_path, getOwner());
m_path = NULL;
m_path = nullptr;
float appearanceRadius = 0.0f;
Object const * const followedObject = NetworkIdManager::getObjectById(followedUnit);
if (followedObject != NULL)
if (followedObject != nullptr)
{
//-- This needs to be improved to cast a ray from this position back towards the ship and get the actual collision position
CollisionProperty const * const ownerCollisionProperty = getOwner()->getCollisionProperty();
CollisionProperty const * const followedObjectCollisionProperty = followedObject->getCollisionProperty();
if (ownerCollisionProperty != NULL)
if (ownerCollisionProperty != nullptr)
{
appearanceRadius += ownerCollisionProperty->getBoundingSphere_l().getRadius();
}
if (followedObjectCollisionProperty != NULL)
if (followedObjectCollisionProperty != nullptr)
{
appearanceRadius += followedObjectCollisionProperty ->getBoundingSphere_l().getRadius();
}
@@ -786,7 +786,7 @@ int AiShipController::getBehaviorType() const
{
AiShipBehaviorType result = ASBT_idle;
if (m_nonAttackBehavior != NULL)
if (m_nonAttackBehavior != nullptr)
{
result = m_nonAttackBehavior->getBehaviorType();
}
@@ -803,7 +803,7 @@ void AiShipController::idle()
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::idle() owner(%s)", getOwner()->getNetworkId().getValueString().c_str()));
SpacePathManager::release(m_path, getOwner());
m_path = NULL;
m_path = nullptr;
delete m_pendingNonAttackBehavior;
m_pendingNonAttackBehavior = new AiShipBehaviorIdle(*this);;
@@ -818,7 +818,7 @@ void AiShipController::track(Object const & target)
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::track() owner(%s) target(%s)", getOwner()->getNetworkId().getValueString().c_str(), target.getNetworkId().getValueString().c_str()));
SpacePathManager::release(m_path, getOwner());
m_path = NULL;
m_path = nullptr;
delete m_pendingNonAttackBehavior;
m_pendingNonAttackBehavior = new AiShipBehaviorTrack(*this, target);
@@ -871,7 +871,7 @@ void AiShipController::clearPatrolPath()
{
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::clearPatrolPath() owner(%s)", getOwner()->getNetworkId().getValueString().c_str()));
if (m_path != NULL)
if (m_path != nullptr)
{
m_path->clear();
}
@@ -896,15 +896,15 @@ void AiShipController::triggerBehaviorChanged(AiShipBehaviorType const newBehavi
{
// Only send the trigger if the new behavior is different from the old behavior
AiShipBehaviorType const oldBehavior = (m_nonAttackBehavior != NULL) ? m_nonAttackBehavior->getBehaviorType() : ASBT_idle;
AiShipBehaviorType const oldBehavior = (m_nonAttackBehavior != nullptr) ? m_nonAttackBehavior->getBehaviorType() : ASBT_idle;
if (oldBehavior != newBehavior)
{
Object * const object = getOwner();
ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL;
GameScriptObject * const gameScriptObject = (serverObject != NULL) ? serverObject->getScriptObject() : NULL;
ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr;
GameScriptObject * const gameScriptObject = (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr;
if (gameScriptObject != NULL)
if (gameScriptObject != nullptr)
{
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::triggerBehaviorChanged() unit(%s) old(%s) new(%s)", getOwner()->getNetworkId().getValueString().c_str(), AiShipBehaviorBase::getBehaviorString(oldBehavior), AiShipBehaviorBase::getBehaviorString(newBehavior)));
@@ -925,10 +925,10 @@ void AiShipController::triggerBehaviorChanged(AiShipBehaviorType const newBehavi
void AiShipController::triggerEnterCombat(NetworkId const & attackTarget)
{
Object * const object = getOwner();
ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL;
GameScriptObject * const gameScriptObject = (serverObject != NULL) ? serverObject->getScriptObject() : NULL;
ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr;
GameScriptObject * const gameScriptObject = (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr;
if (gameScriptObject != NULL)
if (gameScriptObject != nullptr)
{
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::triggerEnterCombat() unit(%s) attackTarget(%s)", getOwner()->getNetworkId().getValueString().c_str(), attackTarget.getValueString().c_str()));
@@ -968,7 +968,7 @@ void AiShipController::setPilotType(std::string const & pilotType)
AiPilotManager::getPilotData(*m_pilotData, *m_pilotManagerInfo);
// Make sure the ship name is set
if (shipObject != NULL)
if (shipObject != nullptr)
{
std::string shipName;
@@ -986,7 +986,7 @@ void AiShipController::setPilotType(std::string const & pilotType)
// Create the attack behavior based on the ship class
delete m_attackBehavior;
m_attackBehavior = NULL;
m_attackBehavior = nullptr;
m_shipClass = ShipAiReactionManager::getShipClass(m_shipName);
@@ -1009,7 +1009,7 @@ void AiShipController::setPilotType(std::string const & pilotType)
setAggroRadius(m_pilotData->m_aggroRadius);
FATAL((m_attackBehavior == NULL), ("The attack behavior can not be NULL."));
FATAL((m_attackBehavior == nullptr), ("The attack behavior can not be nullptr."));
}
// ----------------------------------------------------------------------
@@ -1029,8 +1029,8 @@ CachedNetworkId const & AiShipController::getPrimaryAttackTarget() const
ShipObject const * AiShipController::getPrimaryAttackTargetShipObject() const
{
Object const * const targetObject = getPrimaryAttackTarget().getObject();
ServerObject const * const targetServerObject = (targetObject != NULL) ? targetObject->asServerObject() : NULL;
ShipObject const * const targetShipObject = (targetServerObject != NULL) ? targetServerObject->asShipObject() : NULL;
ServerObject const * const targetServerObject = (targetObject != nullptr) ? targetObject->asServerObject() : nullptr;
ShipObject const * const targetShipObject = (targetServerObject != nullptr) ? targetServerObject->asShipObject() : nullptr;
return targetShipObject;
}
@@ -1097,7 +1097,7 @@ void AiShipController::setSquad(SpaceSquad * const squad)
{
// Remove the unit from its previous squad
if ( (m_squad != NULL)
if ( (m_squad != nullptr)
&& !m_squad->isEmpty())
{
m_squad->removeUnit(getOwner()->getNetworkId());
@@ -1170,7 +1170,7 @@ void AiShipController::setAttackSquad(SpaceAttackSquad * const attackSquad)
{
// Remove the unit from its pervious attack squad
if (m_attackSquad != NULL)
if (m_attackSquad != nullptr)
{
m_attackSquad->removeUnit(getOwner()->getNetworkId());
}
@@ -1210,7 +1210,7 @@ float AiShipController::getShipRadius() const
ShipObject const * const shipObject = getShipOwner();
CollisionProperty const * const shipCollision = shipObject->getCollisionProperty();
if (shipCollision != NULL)
if (shipCollision != nullptr)
{
result = shipCollision->getBoundingSphere_l().getRadius();
}
@@ -1288,9 +1288,9 @@ bool AiShipController::shouldCheckForEnemies() const
void AiShipController::setCurrentPathIndex(unsigned int const index)
{
//LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::setCurrentPathIndex() unit(%s) pathIndex(%u) pathSize(%u)", getOwner()->getNetworkId().getValueString().c_str(), index, (m_path != NULL) ? m_path->getTransformList().size() : 0));
//LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::setCurrentPathIndex() unit(%s) pathIndex(%u) pathSize(%u)", getOwner()->getNetworkId().getValueString().c_str(), index, (m_path != nullptr) ? m_path->getTransformList().size() : 0));
if ( (m_path != NULL)
if ( (m_path != nullptr)
&& !m_path->isEmpty())
{
m_currentPathIndex = index;
@@ -1298,7 +1298,7 @@ void AiShipController::setCurrentPathIndex(unsigned int const index)
else
{
m_currentPathIndex = 0;
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (m_currentPathIndex > 0), "debug_ai", ("AiShipController::setCurrentPathIndex() Setting a non-zero path index(%d) on a NULL or empty path", index));
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (m_currentPathIndex > 0), "debug_ai", ("AiShipController::setCurrentPathIndex() Setting a non-zero path index(%d) on a nullptr or empty path", index));
}
}
@@ -1317,7 +1317,7 @@ float AiShipController::calculateThrottleToPosition_w(Vector const & position_w,
Object const * const object = getOwner();
if (object != NULL)
if (object != nullptr)
{
float const distanceToGoalSquared = object->getPosition_w().magnitudeBetweenSquared(position_w);
@@ -1420,7 +1420,7 @@ void AiShipController::switchToBomberAttack()
bool AiShipController::removeAttackTarget(NetworkId const & unit)
{
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::removeAttackTarget() owner(%s) unit(%s)", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str()));
DEBUG_WARNING((unit == NetworkId::cms_invalid), ("debug_ai: owner(%s) ERROR: Trying to remove a NULL unit(%s) from the attack target list.", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str()));
DEBUG_WARNING((unit == NetworkId::cms_invalid), ("debug_ai: owner(%s) ERROR: Trying to remove a nullptr unit(%s) from the attack target list.", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str()));
return ShipController::removeAttackTarget(unit);
}
@@ -1637,7 +1637,7 @@ void AiShipController::sendDebugAiToClients(AiDebugString & aiDebugString)
bool const checkForEnemies = shouldCheckForEnemies();
float const leashRadius = m_attackBehavior->getLeashRadius();
aiDebugString.addText(formattedString.sprintf("%s agg(%.0f) lsh(%.0f) %s\n", AiShipController::getAttackOrdersString(getAttackOrders()), m_aggroRadius, leashRadius, (m_attackBehavior == NULL) ? " [NO ATTACK BEHAVIOR]" : (checkForEnemies ? " [LFE]" : "")));
aiDebugString.addText(formattedString.sprintf("%s agg(%.0f) lsh(%.0f) %s\n", AiShipController::getAttackOrdersString(getAttackOrders()), m_aggroRadius, leashRadius, (m_attackBehavior == nullptr) ? " [NO ATTACK BEHAVIOR]" : (checkForEnemies ? " [LFE]" : "")));
}
}
@@ -1687,7 +1687,7 @@ void AiShipController::sendDebugAiToClients(AiDebugString & aiDebugString)
// Only send to the client if the objvar is set
int temp = 0;
if ( (characterObject != NULL)
if ( (characterObject != nullptr)
&& characterObject->getObjVars().getItem("ai_debug_string", temp))
{
if (temp > 0)
@@ -1768,8 +1768,8 @@ void AiShipController::addExclusiveAggro(NetworkId const & unit)
// Make sure this is a player
Object * const unitObject = NetworkIdManager::getObjectById(unit);
ServerObject * const unitServerObject = (unitObject != NULL) ? unitObject->asServerObject() : NULL;
CreatureObject * const unitCreatureObject = (unitServerObject != NULL) ? unitServerObject->asCreatureObject() : NULL;
ServerObject * const unitServerObject = (unitObject != nullptr) ? unitObject->asServerObject() : nullptr;
CreatureObject * const unitCreatureObject = (unitServerObject != nullptr) ? unitServerObject->asCreatureObject() : nullptr;
if ( !unitCreatureObject
|| !unitCreatureObject->isPlayerControlled())
@@ -1829,11 +1829,11 @@ bool AiShipController::isExclusiveAggro(CreatureObject const & pilot) const
CreatureObject const * const aggroCreatureObject = CreatureObject::asCreatureObject(aggroCachedNetworkId.getObject());
if (aggroCreatureObject != NULL)
if (aggroCreatureObject != nullptr)
{
GroupObject * const groupObject = aggroCreatureObject->getGroup();
if (groupObject != NULL)
if (groupObject != nullptr)
{
GroupObject::GroupMemberVector const & groupMembers = groupObject->getGroupMembers();
GroupObject::GroupMemberVector::const_iterator iterGroupMembers = groupMembers.begin();
@@ -1871,7 +1871,7 @@ bool AiShipController::isValidTarget(ShipObject const & unit) const
CreatureObject const * const pilotCreatureObject = unit.getPilot();
if (pilotCreatureObject != NULL)
if (pilotCreatureObject != nullptr)
{
if (pilotCreatureObject->isPlayerControlled())
{
@@ -25,7 +25,7 @@ bool AiShipControllerInterface::addDamageTaken(NetworkId const & unit, NetworkId
bool result = false;
AiShipController * const aiShipController = AiShipController::getAiShipController(unit);
if (aiShipController != NULL)
if (aiShipController != nullptr)
{
bool const verifyAttacker = false;
@@ -45,7 +45,7 @@ bool AiShipControllerInterface::setAttackOrders(NetworkId const & unit, AiShipCo
bool result = false;
AiShipController * const aiShipController = AiShipController::getAiShipController(unit);
if (aiShipController != NULL)
if (aiShipController != nullptr)
{
result = true;
aiShipController->setAttackOrders(attackOrders);
@@ -64,7 +64,7 @@ bool AiShipControllerInterface::idle(NetworkId const & unit)
bool result = false;
AiShipController * const aiShipController = AiShipController::getAiShipController(unit);
if (aiShipController != NULL)
if (aiShipController != nullptr)
{
result = true;
aiShipController->idle();
@@ -83,7 +83,7 @@ bool AiShipControllerInterface::track(NetworkId const & unit, Object const & tar
bool result = false;
AiShipController * const aiShipController = AiShipController::getAiShipController(unit);
if (aiShipController != NULL)
if (aiShipController != nullptr)
{
result = true;
aiShipController->track(target);
@@ -102,7 +102,7 @@ bool AiShipControllerInterface::setLeashRadius(NetworkId const & unit, float con
bool result = false;
AiShipController * const aiShipController = AiShipController::getAiShipController(unit);
if (aiShipController != NULL)
if (aiShipController != nullptr)
{
result = true;
aiShipController->setLeashRadius(radius);
@@ -121,7 +121,7 @@ bool AiShipControllerInterface::follow(NetworkId const & unit, NetworkId const &
bool result = false;
AiShipController * const aiShipController = AiShipController::getAiShipController(unit);
if (aiShipController != NULL)
if (aiShipController != nullptr)
{
result = true;
aiShipController->follow(followedUnit, direction_o, direction);
@@ -140,7 +140,7 @@ bool AiShipControllerInterface::addPatrolPath(NetworkId const & unit, SpacePath
bool result = false;
AiShipController * const aiShipController = AiShipController::getAiShipController(unit);
if (aiShipController != NULL)
if (aiShipController != nullptr)
{
result = true;
aiShipController->addPatrolPath(path);
@@ -159,7 +159,7 @@ bool AiShipControllerInterface::clearPatrolPath(NetworkId const & unit)
bool result = false;
AiShipController * const aiShipController = AiShipController::getAiShipController(unit);
if (aiShipController != NULL)
if (aiShipController != nullptr)
{
result = true;
aiShipController->clearPatrolPath();
@@ -178,7 +178,7 @@ bool AiShipControllerInterface::moveTo(NetworkId const & unit, SpacePath * const
bool result = false;
AiShipController * const aiShipController = AiShipController::getAiShipController(unit);
if (aiShipController != NULL)
if (aiShipController != nullptr)
{
result = true;
aiShipController->moveTo(path);
@@ -122,7 +122,7 @@ CreatureController::~CreatureController()
void CreatureController::handleMessage (const int message, const float value, const MessageQueue::Data* const data, const uint32 flags)
{
CreatureObject * const owner = static_cast<CreatureObject*>(getOwner());
DEBUG_FATAL(!owner, ("Owner is NULL in CreatureController::handleMessage\n"));
DEBUG_FATAL(!owner, ("Owner is nullptr in CreatureController::handleMessage\n"));
switch(message)
{
@@ -629,7 +629,7 @@ void CreatureController::handleMessage (const int message, const float value, co
case CM_setIncapacitated:
{
const MessageQueueGenericValueType<std::pair<bool, NetworkId> > * const msg = safe_cast<const MessageQueueGenericValueType<std::pair<bool, NetworkId> > *>(data);
if (msg != NULL)
if (msg != nullptr)
owner->setIncapacitated(msg->getValue().first, msg->getValue().second);
}
break;
@@ -853,7 +853,7 @@ void CreatureController::handleMessage (const int message, const float value, co
if (owner && msg)
owner->setAlternateAppearance(msg->getValue());
else
WARNING(true, ("CreatureController: received CM_setAppearanceFromObjectTemplate but owner or message was NULL."));
WARNING(true, ("CreatureController: received CM_setAppearanceFromObjectTemplate but owner or message was nullptr."));
}
break;
@@ -873,9 +873,9 @@ void CreatureController::handleMessage (const int message, const float value, co
if (msg)
{
ServerObject * defender = safe_cast<ServerObject *>(NetworkIdManager::getObjectById(msg->getDefender()));
if (defender != NULL)
if (defender != nullptr)
{
if (defender->asCreatureObject() != NULL)
if (defender->asCreatureObject() != nullptr)
{
defender->asCreatureObject()->pushedMe(msg->getAttacker(), msg->getAttackerPos(), msg->getDefenderPos(), msg->getDistance());
}
@@ -894,7 +894,7 @@ void CreatureController::handleMessage (const int message, const float value, co
if (msg)
{
ServerObject * target = safe_cast<ServerObject *>(NetworkIdManager::getObjectById(msg->getTarget()));
if (target != NULL && target->asTangibleObject() != NULL)
if (target != nullptr && target->asTangibleObject() != nullptr)
{
if (owner->isAuthoritative())
owner->addSlowDownEffect(*(target->asTangibleObject()), msg->getConeLength(), msg->getConeAngle(), msg->getSlopeAngle(), msg->getExpireTime());
@@ -964,7 +964,7 @@ void CreatureController::handleMessage (const int message, const float value, co
{
MessageQueueCyberneticsChangeRequest const * const msg = safe_cast<MessageQueueCyberneticsChangeRequest const *>(data);
NOT_NULL(msg);
if (msg != NULL)
if (msg != nullptr)
{
NetworkId const & playerId = msg->getTarget();
GameScriptObject * const scriptObject = owner->getScriptObject();
@@ -984,10 +984,10 @@ void CreatureController::handleMessage (const int message, const float value, co
case CM_setCurrentQuest:
{
MessageQueueGenericValueType<uint32> const * const msg = safe_cast<MessageQueueGenericValueType<uint32> const *>(data);
if (msg != NULL)
if (msg != nullptr)
{
PlayerObject * player = PlayerCreatureController::getPlayerObject(owner);
if (player != NULL)
if (player != nullptr)
{
player->setCurrentQuest(msg->getValue());
}
@@ -1003,7 +1003,7 @@ void CreatureController::handleMessage (const int message, const float value, co
case CM_setRegenRate:
{
MessageQueueGenericValueType<std::pair<int, float> > const * const msg = safe_cast<MessageQueueGenericValueType<std::pair<int, float> > const *>(data);
if (msg != NULL)
if (msg != nullptr)
{
owner->setRegenRate(static_cast<Attributes::Enumerator>(msg->getValue().first), msg->getValue().second);
}
@@ -1516,7 +1516,7 @@ void CreatureController::conclude()
// combatants must be adjusted to reflect the server's idea of the post-alter end posture.
// This information was not known at the time the message was constructed.
MessageQueueCombatAction * combatMessage = safe_cast<MessageQueueCombatAction *>(data);
if (combatMessage != NULL)
if (combatMessage != nullptr)
{
//-- Fix up end postures in messages.
@@ -1527,7 +1527,7 @@ void CreatureController::conclude()
combatMessage->getAttacker());
const CreatureObject * attacker = dynamic_cast<const CreatureObject *>(
NetworkIdManager::getObjectById(attackerData.id));
attackerData.endPosture = (attacker != NULL) ? attacker->getPosture() : static_cast<Postures::Enumerator>(0);
attackerData.endPosture = (attacker != nullptr) ? attacker->getPosture() : static_cast<Postures::Enumerator>(0);
// set the defenders' posture
const MessageQueueCombatAction::DefenderDataVector & defenderData =
@@ -1539,7 +1539,7 @@ void CreatureController::conclude()
const_cast<MessageQueueCombatAction::DefenderData &>(*iter);
const CreatureObject * defender = dynamic_cast<const CreatureObject *>(
NetworkIdManager::getObjectById(defenderData.id));
defenderData.endPosture = (defender != NULL) ? defender->getPosture() : static_cast<Postures::Enumerator>(0);
defenderData.endPosture = (defender != nullptr) ? defender->getPosture() : static_cast<Postures::Enumerator>(0);
}
}
}
@@ -1667,7 +1667,7 @@ void CreatureController::handleSecureTradeMessage(const MessageQueueSecureTrade
));
}
}
else if (recipient->getClient() == NULL)
else if (recipient->getClient() == nullptr)
{
// GameServer::getInstance().sendToPlanetServer(
// GenericValueTypeMessage<std::pair<NetworkId, NetworkId> >(
@@ -1862,7 +1862,7 @@ void CreatureController::setAppearanceFromObjectTemplate(std::string const &serv
CreatureObject * owner = dynamic_cast<CreatureObject *>(getOwner());
if (!owner)
{
WARNING(true, ("setAppearanceFromObjectTemplate(): owner is NULL or not a CreatureObject."));
WARNING(true, ("setAppearanceFromObjectTemplate(): owner is nullptr or not a CreatureObject."));
return;
}
@@ -2007,7 +2007,7 @@ void CreatureController::calculateWaterState(bool& isSwimming, bool &isBurning,
if (ownerCreature->getState(States::RidingMount))
{
CreatureObject const *const mountCreature = ownerCreature->getMountedCreature();
CreatureController const *const mountCreatureController = mountCreature ? safe_cast<CreatureController const*>(mountCreature->getController()) : NULL;
CreatureController const *const mountCreatureController = mountCreature ? safe_cast<CreatureController const*>(mountCreature->getController()) : nullptr;
if (mountCreatureController)
{
// Note: we do the real computation for the mount here because the rider gets
@@ -2135,28 +2135,28 @@ CreatureController const * CreatureController::asCreatureController() const
PlayerCreatureController * CreatureController::asPlayerCreatureController()
{
return NULL;
return nullptr;
}
//----------------------------------------------------------------------
PlayerCreatureController const * CreatureController::asPlayerCreatureController() const
{
return NULL;
return nullptr;
}
//----------------------------------------------------------------------
AICreatureController * CreatureController::asAiCreatureController()
{
return NULL;
return nullptr;
}
//----------------------------------------------------------------------
AICreatureController const * CreatureController::asAiCreatureController() const
{
return NULL;
return nullptr;
}
//-----------------------------------------------------------------------
@@ -2170,23 +2170,23 @@ CreatureController * CreatureController::getCreatureController(NetworkId const &
CreatureController * CreatureController::getCreatureController(Object * object)
{
Controller * controller = (object != NULL) ? object->getController() : NULL;
Controller * controller = (object != nullptr) ? object->getController() : nullptr;
return (controller != NULL) ? controller->asCreatureController() : NULL;
return (controller != nullptr) ? controller->asCreatureController() : nullptr;
}
// ----------------------------------------------------------------------
CreatureController * CreatureController::asCreatureController(Controller * controller)
{
return (controller != NULL) ? controller->asCreatureController() : NULL;
return (controller != nullptr) ? controller->asCreatureController() : nullptr;
}
// ----------------------------------------------------------------------
CreatureController const * CreatureController::asCreatureController(Controller const * controller)
{
return (controller != NULL) ? controller->asCreatureController() : NULL;
return (controller != nullptr) ? controller->asCreatureController() : nullptr;
}
// ======================================================================
@@ -61,7 +61,7 @@ void PlanetController::handleMessage (const int message, const float value, cons
case CM_setWeather:
{
const MessageQueueGenericValueType<std::pair<int, Vector> >* const message = safe_cast<const MessageQueueGenericValueType<std::pair<int, Vector> >*> (data);
if (message != NULL)
if (message != nullptr)
{
owner->setWeather(
message->getValue().first,
@@ -280,7 +280,7 @@ void PlanetController::handleMessage (const int message, const float value, cons
const std::map<std::string, int64> & data = message->getValue();
for (std::map<std::string, int64>::const_iterator iter = data.begin(); iter != data.end(); ++iter)
owner->adjustGcwImperialScore("CM_adjustGcwImperialScore", NULL, iter->first, iter->second);
owner->adjustGcwImperialScore("CM_adjustGcwImperialScore", nullptr, iter->first, iter->second);
}
}
break;
@@ -293,7 +293,7 @@ void PlanetController::handleMessage (const int message, const float value, cons
const std::map<std::string, int64> & data = message->getValue();
for (std::map<std::string, int64>::const_iterator iter = data.begin(); iter != data.end(); ++iter)
owner->adjustGcwRebelScore("CM_adjustGcwRebelScore", NULL, iter->first, iter->second);
owner->adjustGcwRebelScore("CM_adjustGcwRebelScore", nullptr, iter->first, iter->second);
}
}
break;
@@ -164,7 +164,7 @@ namespace PlayerCreatureControllerNamespace
if(!mount)
{
LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but getMountedCreature() returns NULL.", static_cast<int>(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str()));
LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but getMountedCreature() returns nullptr.", static_cast<int>(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str()));
return false;
}
@@ -172,7 +172,7 @@ namespace PlayerCreatureControllerNamespace
if(!primaryRider)
{
LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but mount->getPrimaryMountingRider() returns NULL.", static_cast<int>(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str()));
LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but mount->getPrimaryMountingRider() returns nullptr.", static_cast<int>(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str()));
return false;
}
@@ -411,7 +411,7 @@ void PlayerCreatureController::logMoveFailed(char const *reason)
"movement",
(
"move fail - object %s stationId %u - %s",
creature ? creature->getNetworkId().getValueString().c_str() : "<null>",
creature ? creature->getNetworkId().getValueString().c_str() : "<nullptr>",
stationId,
reason));
}
@@ -425,7 +425,7 @@ bool PlayerCreatureController::isLocationValid(Vector const &position_w, CellObj
return false;
TerrainObject const *const terrainObject = TerrainObject::getConstInstance();
if (NULL != terrainObject && (NULL == cell || cell->getCellProperty()->isWorldCell()))
if (nullptr != terrainObject && (nullptr == cell || cell->getCellProperty()->isWorldCell()))
{
if (!terrainObject->isPassableForceChunkCreation(position_w))
return false;
@@ -445,7 +445,7 @@ bool PlayerCreatureController::isLocationValid(Vector const &position_w, CellObj
Sphere testSphere(position_w + localSphere.getCenter(), localSphere.getRadius());
if (CollisionWorld::query(testSphere, NULL))
if (CollisionWorld::query(testSphere, nullptr))
return false;
}
return true;
@@ -464,7 +464,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const
CreatureObject * const creature = NON_NULL(getCreature());
// update the velocity in the serverController
if (creature != NULL)
if (creature != nullptr)
{
Vector moveDistance = m.getPosition_w() - creature->getPosition_w();
moveDistance.y = 0.0f;
@@ -495,8 +495,8 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const
if (!m.isValid())
return handleInvalidMove("invalid destination");
if (creature == NULL)
return handleInvalidMove("creature is null");
if (creature == nullptr)
return handleInvalidMove("creature is nullptr");
if (!m.isAllowed(*creature))
return handleInvalidMove("not allowed in dest cell");
@@ -513,7 +513,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const
PortalProperty const *destPortalProperty = destCell ? ContainerInterface::getContainedByObject(*destCell)->getPortalProperty() : 0;
if (sourcePortalProperty != destPortalProperty)
{
// Moving between pobs. This is only valid if one of these is null, since pobs only connect to the world
// Moving between pobs. This is only valid if one of these is nullptr, since pobs only connect to the world
if (sourcePortalProperty && destPortalProperty)
return handleInvalidMove("tried to move from one pob to another without passing through the world cell");
if (sourcePortalProperty && !sourcePortalProperty->hasPassablePortalToParentCell())
@@ -548,7 +548,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const
Client * const client = creature->getClient();
if (!client)
return handleInvalidMove("Creature's client is NULL");
return handleInvalidMove("Creature's client is nullptr");
uint32 const currentServerSyncStamp = client->getServerSyncStampLong();
@@ -741,7 +741,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const
}
m_lastSpeedCheckFailureTime = ::time(NULL);
m_lastSpeedCheckFailureTime = ::time(nullptr);
++m_speedCheckConsecutiveFailureCount;
// if this is the first validation failure "in a while", let it pass, because it may be a false positive
@@ -1153,11 +1153,11 @@ void PlayerCreatureController::handleMessage (const int message, const float val
NetworkId const & designerId = inMsg->getDesignerId();
NetworkId const & recipientId = inMsg->getRecipientId();
Object const * const designerObj = NetworkIdManager::getObjectById(designerId);
ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : NULL;
CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : NULL;
ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : nullptr;
CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : nullptr;
Object * const recipientObj = NetworkIdManager::getObjectById(recipientId);
ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL;
CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL;
ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr;
CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr;
if(designer && recipient)
{
//designer-sent message, either data to sync to the recipient, or committed data to check and apply
@@ -1167,7 +1167,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val
{
//designer hasn't accepted yet, send change to the client so they can see it before agreeing
Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId());
Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL;
Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr;
if(recipientController)
{
ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage();
@@ -1182,7 +1182,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val
{
//check and apply this data once the recipient also accepts
Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId());
Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL;
Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr;
if(recipientController)
{
ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage();
@@ -1201,7 +1201,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val
//recipient hasn't accepted yet, send the data to the designer to update the recipient-sent amount of money
//designer hasn't accepted yet, send change to the client so they can see it before agreeing
Object * const designerObject = NetworkIdManager::getObjectById(inMsg->getDesignerId());
Controller * const designerController = designerObject ? designerObject->getController() : NULL;
Controller * const designerController = designerObject ? designerObject->getController() : nullptr;
if(designerController)
{
ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage();
@@ -1232,8 +1232,8 @@ void PlayerCreatureController::handleMessage (const int message, const float val
std::string const recipientSpeciesGender = CustomizationManager::getServerSpeciesGender(*recipient);
CustomizationData * const customizationData = recipient->fetchCustomizationData();
ServerObject * const hair = recipient->getHair();
TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : NULL;
CustomizationData * customizationDataHair = NULL;
TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : nullptr;
CustomizationData * customizationDataHair = nullptr;
if(tangibleHair)
customizationDataHair = tangibleHair->fetchCustomizationData();
if(customizationData)
@@ -1285,7 +1285,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val
{
//if the recipient canceled the session, tell the designer
Object const * const designerObject = NetworkIdManager::getObjectById(session.designerId);
ServerObject const * const designer = designerObject ? designerObject->asServerObject() : NULL;
ServerObject const * const designer = designerObject ? designerObject->asServerObject() : nullptr;
if(designer && (owner->getNetworkId() != session.designerId))
Chat::sendSystemMessage(*designer, SharedStringIds::imagedesigner_canceled_by_recip, Unicode::emptyString);
@@ -1304,11 +1304,11 @@ void PlayerCreatureController::handleMessage (const int message, const float val
NetworkId const & bufferId = inMsg->getBufferId();
NetworkId const & recipientId = inMsg->getRecipientId();
Object const * const bufferObj = NetworkIdManager::getObjectById(bufferId);
ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : NULL;
CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : NULL;
ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : nullptr;
CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : nullptr;
Object * const recipientObj = NetworkIdManager::getObjectById(recipientId);
ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL;
CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL;
ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr;
CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr;
if(buffer && recipient)
{
//buffer-sent message, either data to sync to the recipient, or committed data to check and apply
@@ -1318,7 +1318,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val
{
//buffer hasn't accepted yet, send change to the client so they can see it before agreeing
Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId());
Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL;
Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr;
if(recipientController)
{
BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage();
@@ -1333,7 +1333,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val
{
//check and apply this data once the recipient also accepts
Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId());
Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL;
Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr;
if(recipientController)
{
BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage();
@@ -1351,7 +1351,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val
//recipient hasn't accepted yet, send the data to the buffer to update the recipient-sent amount of money
//buffer hasn't accepted yet, send change to the client so they can see it before agreeing
Object * const bufferObject = NetworkIdManager::getObjectById(inMsg->getBufferId());
Controller * const bufferController = bufferObject ? bufferObject->getController() : NULL;
Controller * const bufferController = bufferObject ? bufferObject->getController() : nullptr;
if(bufferController)
{
BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage();
@@ -1425,7 +1425,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val
{
//if the recipient canceled the session, tell the designer
Object const * const bufferObject = NetworkIdManager::getObjectById(session.bufferId);
ServerObject const * const buffer = bufferObject ? bufferObject->asServerObject() : NULL;
ServerObject const * const buffer = bufferObject ? bufferObject->asServerObject() : nullptr;
if(buffer && (owner->getNetworkId() != session.bufferId))
{
@@ -1447,7 +1447,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val
if(msg)
{
Object const * const terminalO = NetworkIdManager::getObjectById(msg->getValue());
ServerObject const * const terminal = terminalO ? terminalO->asServerObject() : NULL;
ServerObject const * const terminal = terminalO ? terminalO->asServerObject() : nullptr;
if(terminal)
{
Client const * const client = owner->getClient();
@@ -1461,7 +1461,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val
if(!client->isGod())
{
Object const * const buildingO = ContainerInterface::getTopmostContainer(*terminal);
ServerObject const * const building = buildingO ? buildingO->asServerObject() : NULL;
ServerObject const * const building = buildingO ? buildingO->asServerObject() : nullptr;
if(building)
{
DynamicVariableList const & buildingObjVars = building->getObjVars();
@@ -1478,13 +1478,13 @@ void PlayerCreatureController::handleMessage (const int message, const float val
for(std::vector<NetworkId>::const_iterator i = ships.begin(); i != ships.end(); ++i)
{
Object const * const shipO = NetworkIdManager::getObjectById(*i);
ServerObject const * const shipSO = shipO ? shipO->asServerObject() : NULL;
ShipObject const * const ship = shipSO ? shipSO->asShipObject() : NULL;
ServerObject const * const shipSO = shipO ? shipO->asServerObject() : nullptr;
ShipObject const * const ship = shipSO ? shipSO->asShipObject() : nullptr;
if(ship)
{
ContainedByProperty const * const contained = ship->getContainedByProperty();
Object const * const containerO = contained ? contained->getContainedBy() : NULL;
ServerObject const * const container = containerO ? containerO->asServerObject() : NULL;
Object const * const containerO = contained ? contained->getContainedBy() : nullptr;
ServerObject const * const container = containerO ? containerO->asServerObject() : nullptr;
if(container)
{
DynamicVariableList const & shipControlDeviceObjVars = container->getObjVars();
@@ -1665,14 +1665,14 @@ void PlayerCreatureController::handleMessage (const int message, const float val
{
MessageQueueCyberneticsChangeRequest const * const msg = dynamic_cast<MessageQueueCyberneticsChangeRequest const *>(data);
NOT_NULL(msg);
if (msg != NULL)
if (msg != nullptr)
{
CreatureObject * const owner = NON_NULL(getCreature());
if(owner)
{
NetworkId const & npcId = msg->getTarget();
Object * const o = NetworkIdManager::getObjectById(npcId);
ServerObject * const so = o ? o->asServerObject() : NULL;
ServerObject * const so = o ? o->asServerObject() : nullptr;
if(so)
{
Controller * const npcController = so->getController();
@@ -1696,10 +1696,10 @@ void PlayerCreatureController::handleMessage (const int message, const float val
case CM_spaceMiningSaleSellResource:
{
MessageQueueSpaceMiningSellResource const * const msg = dynamic_cast<MessageQueueSpaceMiningSellResource const *>(data);
if (msg != NULL)
if (msg != nullptr)
{
ServerObject * const spaceStation = safe_cast<ServerObject *>(NetworkIdManager::getObjectById(msg->m_spaceStationId));
if (NULL == spaceStation)
if (nullptr == spaceStation)
{
WARNING(true, ("PlayerCreatureController CM_spaceMiningSaleSellResource invalid station [%s]", msg->m_spaceStationId.getValueString().c_str()));
}
@@ -1784,7 +1784,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val
DictionaryValueMap::const_iterator itr = valueMap.find(minigameResultTargetName);
if(itr != valueMap.end() && itr->second != NULL)
if(itr != valueMap.end() && itr->second != nullptr)
{
if(itr->second->getType() == ValueTypeObjId::ms_type)
{
@@ -1798,7 +1798,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val
ScriptDictionaryPtr dictionary;
GameScriptObject::makeScriptDictionary(params, dictionary);
if (dictionary.get() != NULL)
if (dictionary.get() != nullptr)
{
dictionary->serialize();
MessageToQueue::getInstance().sendMessageToJava(tableOid,
@@ -1859,7 +1859,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val
params.addParam(paramsDict, "taskDictionary");
ScriptDictionaryPtr dictionary;
GameScriptObject::makeScriptDictionary(params, dictionary);
if (dictionary.get() != NULL)
if (dictionary.get() != nullptr)
{
dictionary->serialize();
MessageToQueue::getInstance().sendMessageToJava(owner->getNetworkId(),
@@ -295,10 +295,10 @@ void PlayerShipController::handleMessage(int const message, float const value, M
case CM_spaceMiningSaleSellResource:
{
MessageQueueSpaceMiningSellResource const * const msg = dynamic_cast<MessageQueueSpaceMiningSellResource const *>(data);
if (msg != NULL)
if (msg != nullptr)
{
ServerObject * const spaceStation = safe_cast<ServerObject *>(NetworkIdManager::getObjectById(msg->m_spaceStationId));
if (NULL == spaceStation)
if (nullptr == spaceStation)
{
WARNING(true, ("PlayerCreatureController CM_spaceMiningSaleSellResource invalid station [%s]", msg->m_spaceStationId.getValueString().c_str()));
}
@@ -376,16 +376,16 @@ float PlayerShipController::realAlter(float const elapsedTime)
if (owner && owner->isInitialized())
{
if (m_pendingDockingBehavior != NULL)
if (m_pendingDockingBehavior != nullptr)
{
delete m_dockingBehavior;
m_dockingBehavior = m_pendingDockingBehavior;
m_pendingDockingBehavior = NULL;
m_pendingDockingBehavior = nullptr;
getShipOwner()->setCondition(static_cast<int>(TangibleObject::C_docking));
Client * const client = owner->getClient();
if (client != NULL)
if (client != nullptr)
{
ShipClientUpdateTracker::queueForUpdate(*client, *owner);
}
@@ -395,16 +395,16 @@ float PlayerShipController::realAlter(float const elapsedTime)
}
}
if ( (m_dockingBehavior != NULL)
if ( (m_dockingBehavior != nullptr)
&& m_dockingBehavior->isDockFinished())
{
delete m_dockingBehavior;
m_dockingBehavior = NULL;
m_dockingBehavior = nullptr;
getShipOwner()->clearCondition(static_cast<int>(TangibleObject::C_docking));
}
if (m_dockingBehavior != NULL)
if (m_dockingBehavior != nullptr)
{
//-- The docking behavior will calculate new values for m_yaw/m_pitch/m_roll/m_throttle[Position] implicitly through calling ShipController members
m_dockingBehavior->alter(elapsedTime);
@@ -806,7 +806,7 @@ void PlayerShipController::setWeaponIndexPlayerControlled(int const weaponIndex,
{
DEBUG_FATAL((weaponIndex < 0), ("Invalid weaponIndex(%d)", weaponIndex));
if (m_turretTargetingSystem != NULL)
if (m_turretTargetingSystem != nullptr)
{
safe_cast<PlayerShipTurretTargetingSystem*>(m_turretTargetingSystem)->setWeaponIndexPlayerControlled(weaponIndex, playerControlled);
}
@@ -55,7 +55,7 @@
CellProperty const * getCell(Object const * obj)
{
if(obj == NULL) return NULL;
if(obj == nullptr) return nullptr;
return obj->getCellProperty();
}
@@ -74,7 +74,7 @@ Vector movePointBetweenCells ( Object const * oldCellObject, Object const * new
Transform toWorld = Transform::identity;
Transform toCell = Transform::identity;
if(oldCellObject != NULL)
if(oldCellObject != nullptr)
{
CellProperty const * oldCell = getCell(oldCellObject);
@@ -84,7 +84,7 @@ Vector movePointBetweenCells ( Object const * oldCellObject, Object const * new
}
}
if(newCellObject != NULL)
if(newCellObject != nullptr)
{
CellProperty const * newCell = getCell(newCellObject);
@@ -115,7 +115,7 @@ Transform moveTransformBetweenCells ( Object const * oldCellObject, Object const
Transform toWorld = Transform::identity;
Transform toCell = Transform::identity;
if(oldCellObject != NULL)
if(oldCellObject != nullptr)
{
CellProperty const * oldCell = getCell(oldCellObject);
@@ -125,7 +125,7 @@ Transform moveTransformBetweenCells ( Object const * oldCellObject, Object const
}
}
if(newCellObject != NULL)
if(newCellObject != nullptr)
{
CellProperty const * newCell = getCell(newCellObject);
@@ -220,7 +220,7 @@ void ServerController::setAuthoritative(bool newAuthoritative)
{
if (!newAuthoritative && m_bHasGoal && m_goalCellObject)
{
m_goalCellObject = NULL;
m_goalCellObject = nullptr;
m_bHasGoal = false;
m_bAtGoal = true;
}
@@ -420,7 +420,7 @@ bool changeCells(ServerObject &object, ServerObject *newCellObject)
// ----------
if (newCellObject == NULL)
if (newCellObject == nullptr)
{
// Object was in a cell and is moving to the world, transfer from cell container to world
@@ -428,7 +428,7 @@ bool changeCells(ServerObject &object, ServerObject *newCellObject)
Transform const &newTransform = oldCellObject->getTransform_o2w().rotateTranslate_l2p(objectTransform);
Container::ContainerErrorCode tmp = Container::CEC_Success;
result = ContainerInterface::transferItemToWorld(object, newTransform, NULL, tmp);
result = ContainerInterface::transferItemToWorld(object, newTransform, nullptr, tmp);
if (!result)
{
@@ -444,13 +444,13 @@ bool changeCells(ServerObject &object, ServerObject *newCellObject)
CellProperty * const pCell = ContainerInterface::getCell(*newCellObject);
DEBUG_REPORT_LOG(pCell == NULL, ("changeCells - Received transform with parent to a non-cell object. This should only happen from the DB\n"));
DEBUG_REPORT_LOG(pCell == nullptr, ("changeCells - Received transform with parent to a non-cell object. This should only happen from the DB\n"));
if (pCell)
{
Transform objectTransform = object.getTransform_o2p();
Container::ContainerErrorCode tmp = Container::CEC_Success;
result = ContainerInterface::transferItemToCell(*newCellObject, object, NULL, tmp);
result = ContainerInterface::transferItemToCell(*newCellObject, object, nullptr, tmp);
if (!result)
{
@@ -537,7 +537,7 @@ void ServerController::handleNetUpdateTransform(const MessageQueueDataTransform&
return;
}
setGoal( message.getTransform(), NULL );
setGoal( message.getTransform(), nullptr );
}
//-----------------------------------------------------------------------
@@ -566,7 +566,7 @@ void ServerController::handleNetUpdateTransformWithParent(const MessageQueueData
#if 1
Transform start = Transform::identity;
start.setPosition_p(ConfigServerGame::getStartingPosition());
setGoal( start, NULL );
setGoal( start, nullptr );
#endif
return;
}
@@ -58,12 +58,12 @@ ShipController::ShipController(ShipObject * newOwner) :
m_pitchPosition(0.0f),
m_rollPosition(0.0f),
m_throttlePosition(0.0f),
m_pendingDockingBehavior(NULL),
m_dockingBehavior(NULL),
m_pendingDockingBehavior(nullptr),
m_dockingBehavior(nullptr),
m_attackTargetList(new AiShipAttackTargetList(newOwner)),
m_attackTargetDecayTimer(new Timer(static_cast<float>(s_maxTargetAge))),
m_enemyCheckQueued(false),
m_turretTargetingSystem(NULL),
m_turretTargetingSystem(nullptr),
m_dockedByList(new DockedByList),
m_aiTargetingMeList(new CachedNetworkIdList)
{
@@ -77,7 +77,7 @@ ShipController::~ShipController()
// The turret targeting system must be deleted before clearAiTargetingMeList(), because
// otherwise it will try to acquire new targets as the list is being cleared
delete m_turretTargetingSystem;
m_turretTargetingSystem = NULL;
m_turretTargetingSystem = nullptr;
clearAiTargetingMeList();
@@ -85,9 +85,9 @@ ShipController::~ShipController()
delete m_dockedByList;
delete m_aiTargetingMeList;
delete m_pendingDockingBehavior;
m_pendingDockingBehavior = NULL;
m_pendingDockingBehavior = nullptr;
delete m_dockingBehavior;
m_dockingBehavior = NULL;
m_dockingBehavior = nullptr;
delete m_attackTargetList;
delete m_attackTargetDecayTimer;
}
@@ -226,7 +226,7 @@ void ShipController::handleMessage (const int message, const float value, const
UNREF(flags);
UNREF(value);
ShipObject * const owner = getShipOwner();
DEBUG_FATAL(!owner, ("Owner is NULL in ShipController::handleMessage\n"));
DEBUG_FATAL(!owner, ("Owner is nullptr in ShipController::handleMessage\n"));
switch(message)
{
case CM_clientLookAtTarget:
@@ -265,7 +265,7 @@ void ShipController::addTurretTargetingSystem(ShipTurretTargetingSystem * newSys
void ShipController::removeTurretTargetingSystem()
{
delete m_turretTargetingSystem;
m_turretTargetingSystem = NULL;
m_turretTargetingSystem = nullptr;
}
// ----------------------------------------------------------------------
@@ -281,7 +281,7 @@ void ShipController::addDockedBy(Object const & unit)
{
IGNORE_RETURN(m_dockedByList->insert(CachedNetworkId(unit)));
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::addDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != NULL) ? getOwner()->getNetworkId().getValueString().c_str() : "NULL", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size()));
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::addDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != nullptr) ? getOwner()->getNetworkId().getValueString().c_str() : "nullptr", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size()));
}
// ----------------------------------------------------------------------
@@ -294,7 +294,7 @@ void ShipController::removeDockedBy(Object const & unit)
{
m_dockedByList->erase(iterDockedByList);
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::removeDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != NULL) ? getOwner()->getNetworkId().getValueString().c_str() : "NULL", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size()));
LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::removeDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != nullptr) ? getOwner()->getNetworkId().getValueString().c_str() : "nullptr", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size()));
}
else
{
@@ -314,7 +314,7 @@ ShipController::DockedByList const & ShipController::getDockedByList() const
void ShipController::addAiTargetingMe(NetworkId const & unit)
{
//LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::addAiTargetingMe() owner(%s) unit(%s) m_aiTargetingMeList->size(%u+1)", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str(), m_aiTargetingMeList->size()));
DEBUG_FATAL((NetworkIdManager::getObjectById(unit) == NULL), ("ShipController::addAiTargetingMe() owner(%s) unit(%s) ERROR: The Ai who is targeting you is not a valid networkId", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str()));
DEBUG_FATAL((NetworkIdManager::getObjectById(unit) == nullptr), ("ShipController::addAiTargetingMe() owner(%s) unit(%s) ERROR: The Ai who is targeting you is not a valid networkId", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str()));
// Make sure this is a valid networkId of an alive object
@@ -346,11 +346,11 @@ void ShipController::removeAiTargetingMe(NetworkId const & unit)
{
ShipObject * const shipOwner = getShipOwner();
if (shipOwner != NULL)
if (shipOwner != nullptr)
{
CreatureObject * const pilotOwner = CreatureObject::asCreatureObject(shipOwner->getPilot());
if ( (pilotOwner != NULL)
if ( (pilotOwner != nullptr)
&& pilotOwner->isPlayerControlled())
{
shipOwner->clearCondition(static_cast<int>(TangibleObject::C_spaceCombatMusic));
@@ -442,7 +442,7 @@ bool ShipController::face(Vector const & goalPosition_w, float elapsedTime)
bool useFastAxis = true;
AiShipController const * const aiShipController = asAiShipController();
if (aiShipController != NULL)
if (aiShipController != nullptr)
{
if ( (aiShipController->getShipClass() == ShipAiReactionManager::SC_capitalShip)
|| (aiShipController->getShipClass() == ShipAiReactionManager::SC_transport)
@@ -620,7 +620,7 @@ float ShipController::getLargestTurnRadius() const
ShipObject const * const shipObject = getShipOwner();
if (shipObject != NULL)
if (shipObject != nullptr)
{
float const maxYawRate = shipObject->getShipActualYawRateMaximum();
float const maxPitchRate = shipObject->getShipActualPitchRateMaximum();
@@ -650,11 +650,11 @@ void ShipController::dock(ShipObject & dockTarget, float const secondsAtDock)
void ShipController::unDock()
{
if (m_pendingDockingBehavior != NULL)
if (m_pendingDockingBehavior != nullptr)
{
m_pendingDockingBehavior->unDock();
}
else if (m_dockingBehavior != NULL)
else if (m_dockingBehavior != nullptr)
{
m_dockingBehavior->unDock();
}
@@ -664,14 +664,14 @@ void ShipController::unDock()
bool ShipController::isDocking() const
{
return (m_dockingBehavior != NULL) || (m_pendingDockingBehavior != NULL);
return (m_dockingBehavior != nullptr) || (m_pendingDockingBehavior != nullptr);
}
// ----------------------------------------------------------------------
bool ShipController::isDocked() const
{
return ((m_dockingBehavior != NULL) && m_dockingBehavior->isDocked());
return ((m_dockingBehavior != nullptr) && m_dockingBehavior->isDocked());
}
// ----------------------------------------------------------------------
@@ -698,28 +698,28 @@ ShipController const * ShipController::asShipController() const
PlayerShipController * ShipController::asPlayerShipController()
{
return NULL;
return nullptr;
}
// ----------------------------------------------------------------------
PlayerShipController const * ShipController::asPlayerShipController() const
{
return NULL;
return nullptr;
}
// ----------------------------------------------------------------------
AiShipController * ShipController::asAiShipController()
{
return NULL;
return nullptr;
}
// ----------------------------------------------------------------------
AiShipController const * ShipController::asAiShipController() const
{
return NULL;
return nullptr;
}
// ----------------------------------------------------------------------
@@ -736,7 +736,7 @@ bool ShipController::addDamageTaken(NetworkId const & attackingUnit, float const
bool result = false;
ShipObject * const attackingUnitShipObject = ShipObject::asShipObject(NetworkIdManager::getObjectById(attackingUnit));
if ( (attackingUnitShipObject != NULL)
if ( (attackingUnitShipObject != nullptr)
&& !attackingUnitShipObject->isDamageAggroImmune())
{
result = verifyAttacker ? Pvp::canAttack(*attackingUnitShipObject, *NON_NULL(getShipOwner())) : true;
@@ -754,7 +754,7 @@ bool ShipController::addDamageTaken(NetworkId const & attackingUnit, float const
bool ShipController::hasTurretTargetingSystem() const
{
return (m_turretTargetingSystem != NULL);
return (m_turretTargetingSystem != nullptr);
}
// ----------------------------------------------------------------------
@@ -792,7 +792,7 @@ bool ShipController::removeAttackTarget(NetworkId const & unit)
void ShipController::onAttackTargetChanged(NetworkId const & target)
{
if (m_turretTargetingSystem != NULL)
if (m_turretTargetingSystem != nullptr)
{
m_turretTargetingSystem->onTargetChanged(target);
}
@@ -802,7 +802,7 @@ void ShipController::onAttackTargetChanged(NetworkId const & target)
void ShipController::onAttackTargetLost(NetworkId const & target)
{
if (m_turretTargetingSystem != NULL)
if (m_turretTargetingSystem != nullptr)
{
m_turretTargetingSystem->onTargetLost(target);
}
@@ -834,12 +834,12 @@ int ShipController::getNumberOfAiUnitsAttackingMe() const
CachedNetworkId const & ai = (*iterAiTargetingMeList);
Object const * const aiObject = ai.getObject();
if (aiObject != NULL)
if (aiObject != nullptr)
{
ShipController const * const shipController = aiObject->getController()->asShipController();
AiShipController const * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL;
AiShipController const * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr;
if (aiShipController != NULL)
if (aiShipController != nullptr)
{
if (aiShipController->getPrimaryAttackTarget() == getOwner()->getNetworkId())
{
@@ -849,7 +849,7 @@ int ShipController::getNumberOfAiUnitsAttackingMe() const
}
else
{
DEBUG_WARNING(true, ("ShipController::getNumberOfAiShipAttackingMe() ERROR: Why am I(%s) being targeted by a NULL object(%s)?", getOwner()->getDebugInformation().c_str(), ai.getValueString().c_str()));
DEBUG_WARNING(true, ("ShipController::getNumberOfAiShipAttackingMe() ERROR: Why am I(%s) being targeted by a nullptr object(%s)?", getOwner()->getDebugInformation().c_str(), ai.getValueString().c_str()));
}
}
@@ -910,11 +910,11 @@ void ShipController::clearAiTargetingMeList()
{
CachedNetworkId const & id = (*iterPurgeList);
if (id.getObject() != NULL)
if (id.getObject() != nullptr)
{
ShipController * const shipController = id.getObject()->getController()->asShipController();
if (shipController != NULL)
if (shipController != nullptr)
{
IGNORE_RETURN(shipController->removeAttackTarget(getOwner()->getNetworkId()));
}
@@ -222,7 +222,7 @@ void TangibleController::handleMessage (const int message, const float value, co
case CM_addHate:
{
const MessageQueueGenericValueType<std::pair<NetworkId, float> > * const msg = safe_cast<const MessageQueueGenericValueType<std::pair<NetworkId, float> > *>(data);
WARNING((msg == NULL), ("TangibleController::handleMessage(CM_addHate) The message data should never be NULL"));
WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_addHate) The message data should never be nullptr"));
if(msg)
{
@@ -233,7 +233,7 @@ void TangibleController::handleMessage (const int message, const float value, co
case CM_setHate:
{
const MessageQueueGenericValueType<std::pair<NetworkId, float> > * const msg = safe_cast<const MessageQueueGenericValueType<std::pair<NetworkId, float> > *>(data);
WARNING((msg == NULL), ("TangibleController::handleMessage(CM_setHate) The message data should never be NULL"));
WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_setHate) The message data should never be nullptr"));
if(msg)
{
@@ -244,7 +244,7 @@ void TangibleController::handleMessage (const int message, const float value, co
case CM_removeHateTarget:
{
const MessageQueueGenericValueType<NetworkId> * const msg = safe_cast<const MessageQueueGenericValueType<NetworkId> *>(data);
WARNING((msg == NULL), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be NULL"));
WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be nullptr"));
if(msg)
{
@@ -265,7 +265,7 @@ void TangibleController::handleMessage (const int message, const float value, co
case CM_forceHateTarget:
{
const MessageQueueGenericValueType<NetworkId> * const msg = safe_cast<const MessageQueueGenericValueType<NetworkId> *>(data);
WARNING((msg == NULL), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be NULL"));
WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be nullptr"));
if(msg)
{
@@ -276,9 +276,9 @@ void TangibleController::handleMessage (const int message, const float value, co
case CM_autoExpireHateListTargetEnabled:
{
const MessageQueueGenericValueType<bool> * const msg = safe_cast<const MessageQueueGenericValueType<bool> *>(data);
WARNING((msg == NULL), ("TangibleController::handleMessage(CM_setHateListExpireTargetEnabled) The message data should never be NULL"));
WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_setHateListExpireTargetEnabled) The message data should never be nullptr"));
if (msg != NULL)
if (msg != nullptr)
{
owner->setHateListAutoExpireTargetEnabled(msg->getValue());
}
@@ -315,7 +315,7 @@ void TangibleController::handleMessage (const int message, const float value, co
if(object)
{
ServerObject * transferer = safe_cast<ServerObject *>(NetworkIdManager::getObjectById(msg->getValue().second));
// transferer is allowed to be null
// transferer is allowed to be nullptr
owner->addObjectToOutputSlot(*object, transferer);
}
}
@@ -576,7 +576,7 @@ void TangibleController::handleMessage (const int message, const float value, co
case CM_addUserToAccessList:
{
MessageQueueGenericValueType<std::pair<int, NetworkId> > const *msg = safe_cast<MessageQueueGenericValueType<std::pair<int, NetworkId> > const *>(data);
WARNING((msg == NULL), ("TangibleController::handleMessage(CM_addUserToAccessList) The message data should never be NULL"));
WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_addUserToAccessList) The message data should never be nullptr"));
if(msg)
{
@@ -590,7 +590,7 @@ void TangibleController::handleMessage (const int message, const float value, co
case CM_removeUserFromAccessList:
{
MessageQueueGenericValueType<std::pair<int, NetworkId> > const *msg = safe_cast<MessageQueueGenericValueType<std::pair<int, NetworkId> > const *>(data);
WARNING((msg == NULL), ("TangibleController::handleMessage(CM_removeUserFromAccessList) The message data should never be NULL"));
WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_removeUserFromAccessList) The message data should never be nullptr"));
if(msg)
{
@@ -722,14 +722,14 @@ TangibleController const * TangibleController::asTangibleController() const
AiTurretController * TangibleController::asAiTurretController()
{
return NULL;
return nullptr;
}
//----------------------------------------------------------------------
AiTurretController const * TangibleController::asAiTurretController() const
{
return NULL;
return nullptr;
}
//========================================================================
@@ -24,7 +24,7 @@ namespace AttribModNameManagerNamespace
std::set<uint32> unknownCrcs;
}
AttribModNameManager * AttribModNameManager::ms_attribModNameManager = NULL;
AttribModNameManager * AttribModNameManager::ms_attribModNameManager = nullptr;
//========================================================================
@@ -65,8 +65,8 @@ AttribModNameManager::~AttribModNameManager()
{
delete m_names;
delete m_crcMap;
m_names = NULL;
m_crcMap = NULL;
m_names = nullptr;
m_crcMap = nullptr;
} // AttribModNameManager::~AttribModNameManager
// ----------------------------------------------------------------------
@@ -76,7 +76,7 @@ AttribModNameManager::~AttribModNameManager()
*/
void AttribModNameManager::install()
{
if (ms_attribModNameManager == NULL)
if (ms_attribModNameManager == nullptr)
{
ms_attribModNameManager = new AttribModNameManager;
ExitChain::add(AttribModNameManager::remove, "AttribModNameManager::remove");
@@ -90,10 +90,10 @@ void AttribModNameManager::install()
*/
void AttribModNameManager::remove()
{
if (ms_attribModNameManager != NULL)
if (ms_attribModNameManager != nullptr)
{
delete ms_attribModNameManager;
ms_attribModNameManager = NULL;
ms_attribModNameManager = nullptr;
}
} // AttribModNameManager::remove
@@ -263,7 +263,7 @@ void AttribModNameManager::sendAllNamesToServer(std::vector<uint32> const & serv
*
* @param crc the crc value to look up
*
* @return the attrib mod name, or NULL if there was no name for the crc
* @return the attrib mod name, or nullptr if there was no name for the crc
*/
const char * AttribModNameManager::getAttribModName(uint32 crc) const
{
@@ -277,7 +277,7 @@ const char * AttribModNameManager::getAttribModName(uint32 crc) const
ServerClock::getInstance().getServerFrame()));
AttribModNameManagerNamespace::unknownCrcs.insert(crc);
}
return NULL;
return nullptr;
} // AttribModNameManager::getAttribModName
// ----------------------------------------------------------------------
@@ -350,7 +350,7 @@ void AttribModNameManager::getAttribModNamesFromBase(uint32 base,
std::vector<const char *> & names) const
{
const char * baseName = getAttribModName(base);
if (baseName != NULL)
if (baseName != nullptr)
getAttribModNamesFromBase(baseName, names);
} // AttribModNameManager::getAttribModNamesFromBase
@@ -366,7 +366,7 @@ void AttribModNameManager::getAttribModCrcsFromBase(uint32 base,
std::vector<uint32> & crcs) const
{
const char * baseName = getAttribModName(base);
if (baseName != NULL)
if (baseName != nullptr)
getAttribModCrcsFromBase(baseName, crcs);
} // AttribModNameManager::getAttribModCrcsFromBase
@@ -133,7 +133,7 @@ void BiographyManager::deleteBiography(const NetworkId &owner)
DEBUG_FATAL(!m_installed, ("BioManager not installed"));
BiographyMessage const msg(owner,NULL);
BiographyMessage const msg(owner,nullptr);
GameServer::getInstance().sendToDatabaseServer(msg);
// Save off the bio for viewing by other players
@@ -55,7 +55,7 @@ namespace CharacterMatchManagerNamespace
// used when invoking LfgDataTable::LfgNode::internalAttributeMatchFunction
struct LfgInternalAttributeMatchFunctionParams
{
LfgInternalAttributeMatchFunctionParams() : param1(NULL), param2(NULL), param3(NULL), param4(NULL), param5(NULL) {}
LfgInternalAttributeMatchFunctionParams() : param1(nullptr), param2(nullptr), param3(nullptr), param4(nullptr), param5(nullptr) {}
void const * param1;
void const * param2;
@@ -151,8 +151,8 @@ bool CharacterMatchManagerNamespace::isMatch(std::map<LfgDataTable::LfgNode cons
std::string guildName(lfgCharacterData.guildName);
std::transform(guildName.begin(), guildName.end(), guildName.begin(), tolower);
if ((strstr(playerName.c_str(), searchSubstring.c_str()) == NULL) &&
(strstr(guildName.c_str(), searchSubstring.c_str()) == NULL))
if ((strstr(playerName.c_str(), searchSubstring.c_str()) == nullptr) &&
(strstr(guildName.c_str(), searchSubstring.c_str()) == nullptr))
{
// fail because couldn't match substring
matchingAttributes.clear();
@@ -176,9 +176,9 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking
++ms_numberOfCharacterMatchRequests;
ServerObject * const requestServerObject = safe_cast<ServerObject *>(NetworkIdManager::getObjectById(networkId));
Client * const requestClient = (requestServerObject ? requestServerObject->getClient() : NULL);
CreatureObject * const requestCreatureObject = (requestServerObject ? requestServerObject->asCreatureObject() : NULL);
PlayerObject * const requestPlayerObject = (requestCreatureObject ? PlayerCreatureController::getPlayerObject(requestCreatureObject) : NULL);
Client * const requestClient = (requestServerObject ? requestServerObject->getClient() : nullptr);
CreatureObject * const requestCreatureObject = (requestServerObject ? requestServerObject->asCreatureObject() : nullptr);
PlayerObject * const requestPlayerObject = (requestCreatureObject ? PlayerCreatureController::getPlayerObject(requestCreatureObject) : nullptr);
if (requestCreatureObject && requestPlayerObject && requestClient)
{
@@ -210,10 +210,10 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking
}
// if "friend" is one of the search criteria, this will contain the requester's friends list
PlayerObject::StringVector const * requestPlayerObjectSortedLowercaseFriendList = NULL;
PlayerObject::StringVector const * requestPlayerObjectSortedLowercaseFriendList = nullptr;
// if "cts_source_galaxy" is one of the search criteria, this will contain the requester's CTS source galaxy list
std::set<std::string> const * requestPlayerObjectCtsSourceGalaxy = NULL;
std::set<std::string> const * requestPlayerObjectCtsSourceGalaxy = nullptr;
// if "in_same_guild" is one of the search criteria, this will contain the requester's guild abbrev
bool inSameGuildSearch = false;
@@ -224,7 +224,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking
std::string requestPlayerObjectCitizenOfCity;
// if "cts_source_galaxy" is one of the search criteria, this will contain the list of matching CTS source galaxy
std::vector<std::string> * matchingCtsSourceGalaxy = NULL;
std::vector<std::string> * matchingCtsSourceGalaxy = nullptr;
// allows search of characters marked anonymous
bool bypassAnonymous = false;
@@ -271,7 +271,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking
// special handling for "friend" search attribute
if (iterLeafNode->second->name == "friend")
{
if (requestPlayerObjectSortedLowercaseFriendList == NULL)
if (requestPlayerObjectSortedLowercaseFriendList == nullptr)
{
requestPlayerObjectSortedLowercaseFriendList = &(requestPlayerObject->getSortedLowercaseFriendList());
}
@@ -284,7 +284,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking
// special handling for "cts_source_galaxy" search attribute
else if (iterLeafNode->second->name == "cts_source_galaxy")
{
if (requestPlayerObjectCtsSourceGalaxy == NULL)
if (requestPlayerObjectCtsSourceGalaxy == nullptr)
{
std::map<NetworkId, LfgCharacterData> const & connectedCharacterLfgData = ServerUniverse::getConnectedCharacterLfgData();
std::map<NetworkId, LfgCharacterData>::const_iterator iterFindLfg = connectedCharacterLfgData.find(networkId);
@@ -292,7 +292,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking
requestPlayerObjectCtsSourceGalaxy = &(iterFindLfg->second.ctsSourceGalaxy);
}
if (matchingCtsSourceGalaxy == NULL)
if (matchingCtsSourceGalaxy == nullptr)
matchingCtsSourceGalaxy = new std::vector<std::string>;
LfgInternalAttributeMatchFunctionParams params;
@@ -421,7 +421,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking
}
else
{
ConsoleMgr::broadcastString("(NULL) (All)", requestClient);
ConsoleMgr::broadcastString("(nullptr) (All)", requestClient);
}
for (std::vector<std::pair<LfgDataTable::LfgNode const *, LfgInternalAttributeMatchFunctionParams> >::const_iterator iterSearchAttribute = iterAnyAllParentNode->second.begin(); iterSearchAttribute != iterAnyAllParentNode->second.end(); ++iterSearchAttribute)
@@ -544,7 +544,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking
if (lfgCharacterData.groupId.isValid() && (mmcr.m_matchingCharacterGroup.count(lfgCharacterData.groupId) == 0))
{
ServerObject const * const soGroupObject = safe_cast<ServerObject const *>(NetworkIdManager::getObjectById(lfgCharacterData.groupId));
GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : NULL);
GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : nullptr);
if (groupObject)
{
std::vector<MatchMakingCharacterResult::MatchMakingCharacterGroupMemberInfo> & groupInfo = mmcr.m_matchingCharacterGroup[lfgCharacterData.groupId];
@@ -263,8 +263,8 @@ Client::Client(ConnectionServerConnection & connection, const NetworkId & charac
{
// Don't ever put the character into a packed house
ServerObject * const serverObject = containerObject->asServerObject();
CellObject * const cellObject = (serverObject ? serverObject->asCellObject() : NULL);
BuildingObject * const buildingObject = (cellObject ? cellObject->getOwnerBuilding() : NULL);
CellObject * const cellObject = (serverObject ? serverObject->asCellObject() : nullptr);
BuildingObject * const buildingObject = (cellObject ? cellObject->getOwnerBuilding() : nullptr);
if ((buildingObject) && (!buildingObject->isInWorld()))
{
@@ -713,8 +713,8 @@ void Client::receiveClientMessage(const GameNetworkMessage & message)
SlottedContainer const * const slottedContainer = ContainerInterface::getSlottedContainer(*containedBy);
ShipObject * const shipObject = ShipObject::getContainingShipObject(containedBy);
if ( (shipObject != NULL)
&& (slottedContainer != NULL)
if ( (shipObject != nullptr)
&& (slottedContainer != nullptr)
&& !shipObject->hasCondition(TangibleObject::C_docking))
{
bool shotOk = false;
@@ -958,7 +958,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message)
const ObjectMenuSelectMessage m (ri);
ServerObject * const target = safe_cast<ServerObject *>(NetworkIdManager::getObjectById (m.getNetworkId()));
GameScriptObject * const scriptObject = target ? target->getScriptObject() : 0;
Object * const targetContainedBy = target ? ContainerInterface::getContainedByObject(*target) : NULL;
Object * const targetContainedBy = target ? ContainerInterface::getContainedByObject(*target) : nullptr;
const int menuType = m.getSelectedItemId();
static int examineMenuType = RadialMenuManager::getMenuTypeByName("EXAMINE");
@@ -1080,7 +1080,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message)
{
// apply the controller message
ServerController * controller = dynamic_cast<ServerController *>(target->getController());
if (controller != NULL)
if (controller != nullptr)
{
uint32 flags = o.getFlags();
flags &= ~GameControllerMessageFlags::SOURCE_REMOTE;
@@ -1096,7 +1096,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message)
if (target)
{
ServerController * controller = dynamic_cast<ServerController *>(target->getController());
if (controller != NULL)
if (controller != nullptr)
{
uint32 flags = o.getFlags();
flags &= ~GameControllerMessageFlags::SOURCE_REMOTE;
@@ -1315,11 +1315,11 @@ void Client::receiveClientMessage(const GameNetworkMessage & message)
{
CreatureObject *creatureObject = dynamic_cast<CreatureObject*>(getCharacterObject());
if (creatureObject != NULL)
if (creatureObject != nullptr)
{
GameScriptObject *gameScriptObject = creatureObject->getScriptObject();
if(gameScriptObject != NULL)
if(gameScriptObject != nullptr)
{
ScriptParams scriptParams;
IGNORE_RETURN(gameScriptObject->trigAllScripts(Scripting::TRIG_STOMACH_UPDATE, scriptParams));
@@ -1964,7 +1964,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message)
GenericValueTypeMessage<std::pair<int32, std::pair<int32, unsigned long> > > const msgPlayTimeInfo(readIterator);
PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(safe_cast<CreatureObject*>(getCharacterObject()));
if (playerObject != NULL)
if (playerObject != nullptr)
{
playerObject->setSessionPlayTimeInfo(msgPlayTimeInfo.getValue().first, msgPlayTimeInfo.getValue().second.first, msgPlayTimeInfo.getValue().second.second);
}
@@ -2222,7 +2222,7 @@ void Client::addObserving(ServerObject* o)
{
IGNORE_RETURN(m_observing.insert(o));
TangibleObject *to = o->asTangibleObject();
if (to && PvpUpdateObserver::satisfyPvpSyncCondition(to->isNonPvpObject(), to->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (o->asCreatureObject() != NULL), to->getPvpFaction()))
if (to && PvpUpdateObserver::satisfyPvpSyncCondition(to->isNonPvpObject(), to->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (o->asCreatureObject() != nullptr), to->getPvpFaction()))
addObservingPvpSync(to);
}
}
@@ -115,7 +115,7 @@ bool ClusterWideDataClient::handleMessage(const MessageDispatch::Emitter &, cons
// locate the callback object
ClusterWideDataClientNamespace::CallbackObjectIdList::iterator iter = ClusterWideDataClientNamespace::callbackObjectIdList.find(msg.getRequestId());
ServerObject * object = NULL;
ServerObject * object = nullptr;
if (iter != ClusterWideDataClientNamespace::callbackObjectIdList.end())
object = dynamic_cast<ServerObject *>(NetworkIdManager::getObjectById(iter->second));
@@ -45,7 +45,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve
AICreatureController const * const defenderAiCreatureController = AICreatureController::asAiCreatureController(defender->getController());
bool const defenderIsInWorldCell = defender->isInWorldCell();
if (defenderAiCreatureController != NULL)
if (defenderAiCreatureController != nullptr)
{
ServerWorld::findObjectsInRange(defender->getPosition_w(), defenderAiCreatureController->getAssistRadius(), unfilteredViewers);
@@ -54,7 +54,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve
bool interested = true;
ServerObject const * const serverObject = *i;
if ( (serverObject == NULL)
if ( (serverObject == nullptr)
|| (serverObject == defender)
|| serverObject->isPlayerControlled()
|| !serverObject->wantSawAttackTriggers())
@@ -65,7 +65,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve
{
TangibleObject const * const tangibleObject = serverObject->asTangibleObject();
if (tangibleObject != NULL)
if (tangibleObject != nullptr)
{
if ( tangibleObject->isInCombat()
|| tangibleObject->isDisabled()
@@ -77,7 +77,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve
{
CreatureObject const * const creatureObject = tangibleObject->asCreatureObject();
if (creatureObject != NULL)
if (creatureObject != nullptr)
{
if ( creatureObject->isIncapacitated()
|| creatureObject->isDead())
@@ -88,7 +88,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve
{
AICreatureController const * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController());
if (aiCreatureController != NULL)
if (aiCreatureController != nullptr)
{
if (aiCreatureController->isRetreating())
{
@@ -138,7 +138,7 @@ void CombatTracker::update()
{
TangibleObject const * const attackerTangibleObject = TangibleObject::asTangibleObject(iterAttackers->getObject());
if (attackerTangibleObject != NULL)
if (attackerTangibleObject != nullptr)
{
localAttackers.push_back(attackerTangibleObject->getNetworkId());
}
@@ -158,7 +158,7 @@ void CombatTracker::update()
ServerObject * const combatViewer = *iterCombatViewers;
GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(combatViewer);
if (gameScriptObject != NULL)
if (gameScriptObject != nullptr)
{
ScriptParams scriptParams;
scriptParams.addParam(defender->getNetworkId());
@@ -42,14 +42,14 @@ using namespace CommunityManagerNameSpace;
//-----------------------------------------------------------------------------
PlayerObject *CommunityManagerNameSpace::getPlayerObject(NetworkId const &networkId)
{
PlayerObject *result = NULL;
PlayerObject *result = nullptr;
Object *object = NetworkIdManager::getObjectById(networkId);
if (object != NULL)
if (object != nullptr)
{
CreatureObject *creatureObject = dynamic_cast<CreatureObject *>(object);
if (creatureObject != NULL)
if (creatureObject != nullptr)
{
result = PlayerCreatureController::getPlayerObject(creatureObject);
}
@@ -61,10 +61,10 @@ PlayerObject *CommunityManagerNameSpace::getPlayerObject(NetworkId const &networ
//-----------------------------------------------------------------------------
ServerObject *CommunityManagerNameSpace::getServerObject(NetworkId const &networkId)
{
ServerObject *result = NULL;
ServerObject *result = nullptr;
Object *object = NetworkIdManager::getObjectById(networkId);
if (object != NULL)
if (object != nullptr)
{
result = dynamic_cast<ServerObject *>(object);
}
@@ -77,11 +77,11 @@ void CommunityManagerNameSpace::sendProseChatMessage(NetworkId const &networkId,
{
Object *object = NetworkIdManager::getObjectById(networkId);
if (object != NULL)
if (object != nullptr)
{
ServerObject *serverObject = dynamic_cast<ServerObject *>(object);
if (serverObject != NULL)
if (serverObject != nullptr)
{
ProsePackage prosePackage;
prosePackage.stringId = stringId;
@@ -117,7 +117,7 @@ void CommunityManager::handleMessage(ChatOnChangeFriendStatus const &message)
PlayerObject *playerObject = getPlayerObject(message.getCharacter());
if (playerObject != NULL)
if (playerObject != nullptr)
{
if (message.getAdd())
{
@@ -170,7 +170,7 @@ void CommunityManager::handleMessage(ChatOnGetFriendsList const &message)
PlayerObject *playerObject = getPlayerObject(message.getCharacter());
if (playerObject != NULL)
if (playerObject != nullptr)
{
typedef std::vector<std::string> StringVector;
StringVector friendList;
@@ -231,7 +231,7 @@ void CommunityManager::handleMessage(ChatOnChangeIgnoreStatus const &message)
PlayerObject *playerObject = getPlayerObject(message.getCharacter());
if (playerObject != NULL)
if (playerObject != nullptr)
{
if (message.getIgnore())
{
@@ -284,7 +284,7 @@ void CommunityManager::handleMessage(ChatOnGetIgnoreList const &message)
PlayerObject *playerObject = getPlayerObject(message.getCharacter());
if (playerObject != NULL)
if (playerObject != nullptr)
{
typedef std::vector<std::string> StringVector;
StringVector ignoreList;
@@ -528,10 +528,10 @@ void ConfigServerGame::install(void)
// GCW score decay time(s)
data->gcwScoreDecayTime.clear();
int index = 0;
char const * dayOfWeek = NULL;
char const * hour = NULL;
char const * minute = NULL;
char const * second = NULL;
char const * dayOfWeek = nullptr;
char const * hour = nullptr;
char const * minute = nullptr;
char const * second = nullptr;
do
{
dayOfWeek = ConfigFile::getKeyString("GameServer", "gcwScoreDecayTimeDayOfWeek", index, 0);
@@ -87,7 +87,7 @@ class ConfigServerGame
int scriptWatcherInterruptTime; // time in ms (after scriptWatcherWarnTime) before we abort a script
int scriptStackErrorLimit; // depth of stack error we assume to be a legit error
int scriptStackErrorLevel; // how we handle a stack error: 0=recover, 1=javacore, 2=fatal
bool disableObjvarNullCheck; // flag to disable the check for a null object when get/setting objvars
bool disableObjvarNullCheck; // flag to disable the check for a nullptr object when get/setting objvars
// throttle to limit how universe data is sent from
// the universe game server to the other game servers;
@@ -68,7 +68,7 @@ namespace ContainerInterfaceNamespace
if (creature->getBank() == lastContainer)
{
//-- if player is passed in non-null, the found creature must match it
//-- if player is passed in non-nullptr, the found creature must match it
if (player && player != creature)
return false;
@@ -340,8 +340,8 @@ namespace ContainerInterfaceNamespace
{
// This item is not contained by anything!
// This means it is in the world!
// Return null for the source container, but succeed.
sourceContainer = NULL;
// Return nullptr for the source container, but succeed.
sourceContainer = nullptr;
return true;
}
@@ -550,7 +550,7 @@ bool ContainerInterface::canTransferTo(ServerObject *destination, ServerObject &
if (transfererCreatureObject->getObjVars().getItem("lotOverlimit.structure_id", lotOverlimitStructure) && lotOverlimitStructure.isValid())
{
// determine the destination type
ServerObject const * topmostDestinationParent = NULL;
ServerObject const * topmostDestinationParent = nullptr;
ServerObject const * destinationParent = destination;
while (destinationParent)
{
@@ -734,8 +734,8 @@ bool ContainerInterface::transferItemToSlottedContainer(ServerObject &destinatio
}
}
ServerObject *sourceObject = NULL;
Container *sourceContainer = NULL;
ServerObject *sourceObject = nullptr;
Container *sourceContainer = nullptr;
if (!sharedTransferBegin(item, sourceObject, sourceContainer, error))
return false;
@@ -829,8 +829,8 @@ bool ContainerInterface::transferItemToVolumeContainer(ServerObject &destination
{
error = Container::CEC_Success;
ServerObject *sourceObject = NULL;
Container *sourceContainer = NULL;
ServerObject *sourceObject = nullptr;
Container *sourceContainer = nullptr;
if (!sharedTransferBegin(item, sourceObject, sourceContainer, error))
return false;
@@ -898,8 +898,8 @@ bool ContainerInterface::transferItemToCell(ServerObject &destination, ServerObj
{
error = Container::CEC_Success;
ServerObject *sourceObject = NULL;
Container *sourceContainer = NULL;
ServerObject *sourceObject = nullptr;
Container *sourceContainer = nullptr;
//check source & item
if (!sharedTransferBegin(item, sourceObject, sourceContainer, error))
@@ -980,13 +980,13 @@ bool ContainerInterface::transferItemToWorld(ServerObject &item, Transform const
return false;
}
if (!canTransferTo(NULL, item, transferer, error))
if (!canTransferTo(nullptr, item, transferer, error))
{
return false;
}
ServerObject *sourceObject = NULL;
Container *sourceContainer = NULL;
ServerObject *sourceObject = nullptr;
Container *sourceContainer = nullptr;
if (!sharedTransferBegin(item, sourceObject, sourceContainer, error))
{
@@ -1009,8 +1009,8 @@ bool ContainerInterface::transferItemToWorld(ServerObject &item, Transform const
item.setTransform_o2p(pos);
item.onContainerTransferComplete(sourceObject, NULL);
handleTransferScripts(item, sourceObject, NULL, transferer, error);
item.onContainerTransferComplete(sourceObject, nullptr);
handleTransferScripts(item, sourceObject, nullptr, transferer, error);
return true;
}
@@ -1084,7 +1084,7 @@ Object *ContainerInterface::getContainedByObject(Object &obj)
ContainedByProperty * const containedBy = getContainedByProperty(obj);
if (containedBy)
return containedBy->getContainedBy();
return NULL;
return nullptr;
}
// ----------------------------------------------------------------------
@@ -1094,7 +1094,7 @@ Object const *ContainerInterface::getContainedByObject(Object const &obj)
ContainedByProperty const * const containedBy = getContainedByProperty(obj);
if (containedBy)
return containedBy->getContainedBy();
return NULL;
return nullptr;
}
// -----------------------------------------------------------------------
@@ -1180,7 +1180,7 @@ Object const *ContainerInterface::getTopmostContainer(Object const &obj)
// -----------------------------------------------------------------------
// Returns the object if it is in the world, or the first parent of the object
// that is in the world. This returns null, if the none of the parents of the object are in the world.
// that is in the world. This returns nullptr, if the none of the parents of the object are in the world.
Object *ContainerInterface::getFirstParentInWorld(Object &obj)
{
@@ -1193,20 +1193,20 @@ Object *ContainerInterface::getFirstParentInWorld(Object &obj)
if (!containedBy)
{
WARNING_STRICT_FATAL(true, ("All objects should have a containedby property"));
return NULL;
return nullptr;
}
// Is my containedBy property empty? If so I am topmost but am not in the world
Object *currentContainer = containedBy->getContainedBy();
if (!currentContainer)
{
return NULL;
return nullptr;
}
// Does my parent expose contents? If it does, then return NULL since I have been removed from the world.
// Does my parent expose contents? If it does, then return nullptr since I have been removed from the world.
if (!getContainer(*currentContainer) || getContainer(*currentContainer)->isContentItemExposedWith(*currentContainer))
{
return NULL;
return nullptr;
}
// Is my parent in the world? If so, he is topmost
@@ -1218,7 +1218,7 @@ Object *ContainerInterface::getFirstParentInWorld(Object &obj)
if (!containedBy)
{
WARNING_STRICT_FATAL(true, ("All objects should have a containedby property"));
return (currentContainer->isInWorld()) ? currentContainer : NULL;
return (currentContainer->isInWorld()) ? currentContainer : nullptr;
}
// Iterate from here.
@@ -1236,12 +1236,12 @@ Object *ContainerInterface::getFirstParentInWorld(Object &obj)
if (!containedBy)
{
WARNING_STRICT_FATAL(true, ("All objects should have a containedby property"));
return NULL;
return nullptr;
}
nextContainer = containedBy->getContainedBy();
}
return currentContainer->isInWorld() ? currentContainer : NULL;
return currentContainer->isInWorld() ? currentContainer : nullptr;
}
// -----------------------------------------------------------------------
@@ -1388,7 +1388,7 @@ bool ContainerInterface::onObjectDestroy(ServerObject& item) // currently only c
return false;
}
handleTransferScripts(item, parentObject, NULL, NULL, error);
handleTransferScripts(item, parentObject, nullptr, nullptr, error);
}
}
return true;
@@ -101,7 +101,7 @@ void FormManagerServer::handleCreateObjectData(NetworkId const & actor, std::str
Transform tr;
tr.setPosition_p(position);
ServerObject * const newObject = ServerWorld::createNewObject(crc, tr, cell, false);
if (newObject == NULL)
if (newObject == nullptr)
return;
if (cellId == NetworkId::cms_invalid)
@@ -114,7 +114,7 @@ void FormManagerServer::handleCreateObjectData(NetworkId const & actor, std::str
{
//tell script to create the object in it's own special manner (since the datatable requests that)
Object * const obj = NetworkIdManager::getObjectById(actor);
ServerObject * const serverObj = obj ? obj->asServerObject() : NULL;
ServerObject * const serverObj = obj ? obj->asServerObject() : nullptr;
if(serverObj)
{
std::vector<char const *> keys;
@@ -151,11 +151,11 @@ void FormManagerServer::handleEditObjectData(NetworkId const & actor, NetworkId
return;
Object * const actorObj = NetworkIdManager::getObjectById(actor);
ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL;
ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr;
if(actorServerObj)
{
Object * const objectToEditObj = NetworkIdManager::getObjectById(objectToEdit);
ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : NULL;
ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : nullptr;
if(objectToEditServerObj)
{
//get matching form
@@ -207,11 +207,11 @@ void FormManagerServer::handleEditObjectData(NetworkId const & actor, NetworkId
void FormManagerServer::requestEditObjectDataForClient(NetworkId const & actor, NetworkId const & objectToEdit)
{
Object * const actorObj = NetworkIdManager::getObjectById(actor);
ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL;
ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr;
if(actorServerObj)
{
Object * const objectToEditObj = NetworkIdManager::getObjectById(objectToEdit);
ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : NULL;
ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : nullptr;
if(objectToEditServerObj)
{
//get matching form
@@ -277,8 +277,8 @@ void FormManagerServer::sendEditObjectDataToClient(NetworkId const & client, Net
return;
Object * const playerObject = NetworkIdManager::getObjectById(client);
ServerObject * const playerServer = playerObject ? playerObject->asServerObject() : NULL;
CreatureObject * const playerCreature = playerServer ? playerServer->asCreatureObject() : NULL;
ServerObject * const playerServer = playerObject ? playerObject->asServerObject() : nullptr;
CreatureObject * const playerCreature = playerServer ? playerServer->asCreatureObject() : nullptr;
if(playerCreature)
{
@@ -317,11 +317,11 @@ namespace GameServerNamespace
bool getConfigSetting(const char *section, const char *key, int & value)
{
const ConfigFile::Section * sec = ConfigFile::getSection(section);
if (sec == NULL)
if (sec == nullptr)
return false;
const ConfigFile::Key * ky = sec->findKey(key);
if (ky == NULL)
if (ky == nullptr)
return false;
value = ky->getAsInt(ky->getCount()-1, value);
@@ -753,7 +753,7 @@ Client * GameServer::getClient(const NetworkId& networkId)
{
return i->second;
}
return NULL;
return nullptr;
}
//-----------------------------------------------------------------------
@@ -837,7 +837,7 @@ void GameServer::loadTerrain ()
terrainObject->setDebugName("terrain");
Appearance * const appearance = AppearanceTemplateList::createAppearance(terrainFileName);
if (appearance != NULL) {
if (appearance != nullptr) {
terrainObject->setAppearance(appearance);
} else {
DEBUG_WARNING(true, ("FIX ME: Appearance template for GameServer::loadTerrain missing for %s.", terrainFileName));
@@ -866,7 +866,7 @@ void GameServer::shutdown()
m_centralService = 0;
m_planetServerConnection = 0;
if (m_customerServiceServerConnection != NULL)
if (m_customerServiceServerConnection != nullptr)
{
m_customerServiceServerConnection->disconnect();
}
@@ -909,7 +909,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M
DEBUG_REPORT_LOG(true, ("GameServer: Creating customer service server connection @ (%s:%d)\n", address.getValue().first.c_str(), address.getValue().second));
if (m_customerServiceServerConnection != NULL)
if (m_customerServiceServerConnection != nullptr)
{
m_customerServiceServerConnection->disconnect();
}
@@ -949,7 +949,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M
std::vector<BatchBaselinesMessageData> const & baselines = m.getData();
ServerObject * lastObject = NULL;
ServerObject * lastObject = nullptr;
for (std::vector<BatchBaselinesMessageData>::const_iterator i=baselines.begin(); i!=baselines.end(); ++i)
{
@@ -1286,7 +1286,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M
if (topmostContainer != object)
{
WARNING(true, ("Denying authority transfer for (%s) from game server (%lu) to game server (%lu) because it is contained by (%s)", object->getDebugInformation().c_str(), GameServer::getInstance().getProcessId(), t.getProcess(), (topmostContainer ? topmostContainer->getDebugInformation().c_str() : "NULL")));
WARNING(true, ("Denying authority transfer for (%s) from game server (%lu) to game server (%lu) because it is contained by (%s)", object->getDebugInformation().c_str(), GameServer::getInstance().getProcessId(), t.getProcess(), (topmostContainer ? topmostContainer->getDebugInformation().c_str() : "nullptr")));
allowed = false;
@@ -1425,11 +1425,11 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M
bool appended = false;
ServerObject * const target = safe_cast<ServerObject *>(NetworkIdManager::getObjectById(c.getNetworkId()));
if (target != NULL)
if (target != nullptr)
{
// valid target, get its controller
ServerController * const controller = safe_cast<ServerController *>(target->getController());
if (controller != NULL)
if (controller != nullptr)
{
uint32 flags = c.getFlags();
if(flags & GameControllerMessageFlags::DEST_AUTH_SERVER)
@@ -1473,7 +1473,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M
ri = static_cast<GameNetworkMessage const &>(message).getByteStream().begin();
EndBaselinesMessage const t(ri);
ServerObject * const object = ServerWorld::findUninitializedObjectByNetworkId(t.getId());
if (object != NULL)
if (object != nullptr)
{
DEBUG_REPORT_LOG(ConfigServerGame::getLogObjectLoading(), ("Received EndBaselinesMessage for %s\n", t.getId().getValueString().c_str()));
ServerController * const controller = dynamic_cast<ServerController *>(object->getController());
@@ -1778,7 +1778,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M
}
else
{
LOG("mounts-bug", ("GS::SceneTransferMessage: server id=[%d],rider id=[%s] has RidingMount state but getMountedCreature() returns NULL.", static_cast<int>(getProcessId()), obj->getNetworkId().getValueString().c_str()));
LOG("mounts-bug", ("GS::SceneTransferMessage: server id=[%d],rider id=[%s] has RidingMount state but getMountedCreature() returns nullptr.", static_cast<int>(getProcessId()), obj->getNetworkId().getValueString().c_str()));
objAsCreature->emergencyDismountForRider();
}
}
@@ -2297,7 +2297,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const
if (creatureObj->isAuthoritative())
{
AICreatureController const * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObj->getController());
if (aiCreatureController == NULL)
if (aiCreatureController == nullptr)
{
continue;
}
@@ -2359,7 +2359,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const
#endif
std::string time = FormattedString<1024>().sprintf("(%3d,%5dms) %30s.%-2lu (%3lu) on %35s:%-7d (%lu) ", ObjectTracker::getNumPlayers(), static_cast<int>(Clock::frameTime()*1000), ServerWorld::getSceneId().c_str(), m_preloadAreaId, m_processId, hostName.c_str(), Os::getProcessId(), ServerClock::getInstance().getGameTimeSeconds());
time += CalendarTime::convertEpochToTimeStringGMT(::time(NULL));
time += CalendarTime::convertEpochToTimeStringGMT(::time(nullptr));
GenericValueTypeMessage<std::pair<uint32, std::pair<std::string, NetworkId> > > rsctr(
"ReportSystemClockTimeResponse", std::make_pair(msg.getValue().first, std::make_pair(time, msg.getValue().second)));
@@ -2378,7 +2378,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const
ri = static_cast<GameNetworkMessage const &>(message).getByteStream().begin();
GenericValueTypeMessage<std::pair<uint32, NetworkId> > const msg(ri);
time_t const timeNow = ::time(NULL);
time_t const timeNow = ::time(nullptr);
std::string time = FormattedString<1024>().sprintf("%30s.%-2lu (%3lu) (%lu) (%ld, ", ServerWorld::getSceneId().c_str(), m_preloadAreaId, m_processId, ServerClock::getInstance().getGameTimeSeconds(), timeNow);
time += CalendarTime::convertEpochToTimeStringGMT(timeNow);
time += ")";
@@ -2404,7 +2404,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const
}
else
{
time += " (terrainObject is NULL)";
time += " (terrainObject is nullptr)";
}
GenericValueTypeMessage<std::pair<uint32, std::pair<std::string, NetworkId> > > rptr(
@@ -2596,7 +2596,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const
bool removeCurrentCitizenDeleted;
bool removeCurrentCitizenInactive;
bool hasDeclaredResidence;
int const timeNow = static_cast<int>(::time(NULL));
int const timeNow = static_cast<int>(::time(nullptr));
bool const citizenInactivePackupActive = (ConfigServerGame::getCityCitizenshipInactivePackupStartTimeEpoch() <= timeNow);
std::map<std::pair<int, NetworkId>, CitizenInfo> const & allCitizens = CityInterface::getAllCitizensInfo();
for (std::map<int, std::set<NetworkId> >::iterator iterCityId = s_clusterStartupResidenceStructureListByCity.begin(); iterCityId != s_clusterStartupResidenceStructureListByCity.end(); ++iterCityId)
@@ -2614,7 +2614,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const
if (currentCityMayor.isValid())
currentCityMayorCitizenInfo = CityInterface::getCitizenInfo(iterCityId->first, currentCityMayor);
else
currentCityMayorCitizenInfo = NULL;
currentCityMayorCitizenInfo = nullptr;
if (currentCityMayorCitizenInfo)
currentCityMayorName = currentCityMayorCitizenInfo->m_citizenName;
@@ -2958,7 +2958,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const
ScriptDictionaryPtr dictionary;
responseObject->getScriptObject()->makeScriptDictionary(params, dictionary);
if (dictionary.get() != NULL)
if (dictionary.get() != nullptr)
{
dictionary->serialize();
MessageToQueue::getInstance().sendMessageToJava(responseObject->getNetworkId(), "foundObject", dictionary->getSerializedData(), 0, false);
@@ -3140,11 +3140,11 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const
CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId);
if (creatureObject != NULL)
if (creatureObject != nullptr)
{
Controller * const controller = creatureObject->getController();
if (controller != NULL)
if (controller != nullptr)
{
DEBUG_LOG("debug_ai", ("GameServer::receiveMessage() Received AiCreatureStateMessage for networkId(%s) movementType(%s)", networkId.getValueString().c_str(), AiMovementBase::getMovementString(movement.getMovementType())));
@@ -3211,7 +3211,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const
Archive::ReadIterator ri = static_cast<GameNetworkMessage const &>(message).getByteStream().begin();
PlayedTimeAccumMessage const ptam(ri);
Object * obj = NetworkIdManager::getObjectById(ptam.getNetworkId());
if (obj != NULL && obj->asServerObject() != NULL && obj->asServerObject()->asCreatureObject() != NULL)
if (obj != nullptr && obj->asServerObject() != nullptr && obj->asServerObject()->asCreatureObject() != nullptr)
{
CreatureObject * target = obj->asServerObject()->asCreatureObject();
PlayerObject *targetPlayer = target->asPlayerObject();
@@ -3260,13 +3260,13 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const
// get the attacker
Object * obj = NetworkIdManager::getObjectById(msg.getSource());
if (obj != NULL && obj->asServerObject() != NULL && obj->asServerObject()->asCreatureObject() != NULL)
if (obj != nullptr && obj->asServerObject() != nullptr && obj->asServerObject()->asCreatureObject() != nullptr)
{
CreatureObject * attacker = obj->asServerObject()->asCreatureObject();
// get the target
obj = NetworkIdManager::getObjectById(msg.getTarget());
if (obj != NULL && obj->asServerObject() != NULL && obj->asServerObject()->asTangibleObject() != NULL)
if (obj != nullptr && obj->asServerObject() != nullptr && obj->asServerObject()->asTangibleObject() != nullptr)
{
TangibleObject * defender = obj->asServerObject()->asTangibleObject();
if (attacker->isAuthoritative())
@@ -3597,7 +3597,7 @@ bool GameServer::isPlanetEnabledForCluster(std::string const &sceneName) const
void GameServerNamespace::broadCastHyperspaceOnWarp(ServerObject const * const owner)
{
// warpingClient can be NULL if the owner is AI
// warpingClient can be nullptr if the owner is AI
Client const * const warpingClient = owner->getClient();
typedef std::map<ConnectionServerConnection *, std::vector<NetworkId> > DistributionList;
@@ -4098,13 +4098,13 @@ void GameServer::sendToConnectionServers(GameNetworkMessage const &message)
void GameServer::sendToCustomerServiceServer(GameNetworkMessage const &message)
{
if (m_customerServiceServerConnection != NULL)
if (m_customerServiceServerConnection != nullptr)
{
m_customerServiceServerConnection->send(message, true);
}
else
{
REPORT_LOG(true, ("GameServer::sendToCustomerServiceServer() ERROR: Unable to send to NULL customer service server connection\n"));
REPORT_LOG(true, ("GameServer::sendToCustomerServiceServer() ERROR: Unable to send to nullptr customer service server connection\n"));
}
}
@@ -4112,12 +4112,12 @@ void GameServer::sendToCustomerServiceServer(GameNetworkMessage const &message)
void GameServer::clearCustomerServiceServerConnection()
{
if (m_customerServiceServerConnection != NULL)
if (m_customerServiceServerConnection != nullptr)
{
m_customerServiceServerConnection->disconnect();
}
m_customerServiceServerConnection = NULL;
m_customerServiceServerConnection = nullptr;
}
// ----------------------------------------------------------------------
@@ -4600,7 +4600,7 @@ void GameServer::handleCharacterCreateNameVerification(const VerifyNameResponse
{
Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp);
Object* appearanceInventory = itemId.getObject();
if(appearanceInventory == NULL)
if(appearanceInventory == nullptr)
{
WARNING(true, ("Player %s has lost their appearance inventory", newCharacterObject->getNetworkId().getValueString().c_str()));
appearanceInventory = ServerWorld::createNewObject(s_appearanceTemplate, *newCharacterObject, slot, false);
@@ -4663,7 +4663,7 @@ void GameServer::handleVerifyAndLockNameVerification(const VerifyNameResponse &v
params.addParam(errorText.c_str(), "reason");
ScriptDictionaryPtr dictionary;
GameScriptObject::makeScriptDictionary(params, dictionary);
if (dictionary.get() != NULL)
if (dictionary.get() != nullptr)
{
dictionary->serialize();
MessageToQueue::getInstance().sendMessageToJava(vrn.getCharacterId(), "renameCharacterNameValidationFail", dictionary->getSerializedData(), 0, false);
@@ -4943,7 +4943,7 @@ bool GameServer::addPendingLoadRequest(NetworkId const & id)
if (s_pendingLoadRequests.find(id) != s_pendingLoadRequests.end())
return false;
s_pendingLoadRequests[id] = (unsigned int)::time(NULL);
s_pendingLoadRequests[id] = (unsigned int)::time(nullptr);
return true;
}
@@ -5113,11 +5113,11 @@ void GameServerNamespace::loadRetroactiveCtsHistory()
{
int index = 0;
char const * pszCtsDataFromConfig = NULL;
char const * pszCtsDataFromConfig = nullptr;
do
{
pszCtsDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactiveCtsHistory", index++, NULL);
if (pszCtsDataFromConfig != NULL)
pszCtsDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactiveCtsHistory", index++, nullptr);
if (pszCtsDataFromConfig != nullptr)
{
ctsDataFromConfig.push_back(pszCtsDataFromConfig);
}
@@ -5196,7 +5196,7 @@ void GameServerNamespace::loadRetroactiveCtsHistory()
else
{
ctsDataFromConfigTokens.clear();
if ((Unicode::tokenize(Unicode::narrowToWide(*iterCtsDataFromConfig), ctsDataFromConfigTokens, &ctsDataFromConfigDelimiter, NULL)) && (ctsDataFromConfigTokens.size() == 7))
if ((Unicode::tokenize(Unicode::narrowToWide(*iterCtsDataFromConfig), ctsDataFromConfigTokens, &ctsDataFromConfigDelimiter, nullptr)) && (ctsDataFromConfigTokens.size() == 7))
{
// sanity check
ctsDataFromConfigParsedData = FormattedString<2048>().sprintf("%s|%s|%s|%s|%s|%s|%s", Unicode::wideToNarrow(ctsDataFromConfigTokens[0]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[1]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[2]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[3]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[4]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[5]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[6]).c_str());
@@ -5225,7 +5225,7 @@ void GameServerNamespace::loadRetroactiveCtsHistory()
FATAL(((sourceCharacterInfo.sourceCharacterBornDate > 0) && (sourceCharacterInfo.sourceCharacterBornDate < 907)), ("source character (%s, %s) has born date (%d) < 907", sourceCharacterInfo.sourceCluster.c_str(), sourceCharacterInfo.sourceCharacterId.getValueString().c_str(), sourceCharacterInfo.sourceCharacterBornDate));
FATAL((sourceCharacterInfo.sourceCharacterBornDate > currentBornDate), ("source character (%s, %s) has born date (%d) > current born date (%d)", sourceCharacterInfo.sourceCluster.c_str(), sourceCharacterInfo.sourceCharacterId.getValueString().c_str(), sourceCharacterInfo.sourceCharacterBornDate, currentBornDate));
std::map<NetworkId, std::vector<CtsSourceCharacterInfo> > * clusterCtsHistory = NULL;
std::map<NetworkId, std::vector<CtsSourceCharacterInfo> > * clusterCtsHistory = nullptr;
#ifdef _DEBUG
IGNORE_RETURN(allCtsSourceCluster.insert(sourceCharacterInfo.sourceCluster));
clusterCtsHistory = &(s_retroactiveCtsHistoryList[targetCluster]);
@@ -5381,11 +5381,11 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime()
{
int index = 0;
char const * pszPlayerCityCreationTimeDataFromConfig = NULL;
char const * pszPlayerCityCreationTimeDataFromConfig = nullptr;
do
{
pszPlayerCityCreationTimeDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactivePlayerCityCreationTime", index++, NULL);
if (pszPlayerCityCreationTimeDataFromConfig != NULL)
pszPlayerCityCreationTimeDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactivePlayerCityCreationTime", index++, nullptr);
if (pszPlayerCityCreationTimeDataFromConfig != nullptr)
{
playerCityCreationTimeDataFromConfig.push_back(pszPlayerCityCreationTimeDataFromConfig);
}
@@ -5427,7 +5427,7 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime()
else
{
playerCityCreationTimeDataFromConfigTokens.clear();
if ((Unicode::tokenize(Unicode::narrowToWide(*iterPlayerCityCreationTimeDataFromConfig), playerCityCreationTimeDataFromConfigTokens, &playerCityCreationTimeDataFromConfigDelimiter, NULL)) && (playerCityCreationTimeDataFromConfigTokens.size() == 3))
if ((Unicode::tokenize(Unicode::narrowToWide(*iterPlayerCityCreationTimeDataFromConfig), playerCityCreationTimeDataFromConfigTokens, &playerCityCreationTimeDataFromConfigDelimiter, nullptr)) && (playerCityCreationTimeDataFromConfigTokens.size() == 3))
{
// sanity check
playerCityCreationTimeDataFromConfigParsedData = FormattedString<2048>().sprintf("%s|%s|%s", Unicode::wideToNarrow(playerCityCreationTimeDataFromConfigTokens[0]).c_str(), Unicode::wideToNarrow(playerCityCreationTimeDataFromConfigTokens[1]).c_str(), Unicode::wideToNarrow(playerCityCreationTimeDataFromConfigTokens[2]).c_str());
@@ -5449,7 +5449,7 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime()
++iterPlayerCityCreationTimeDataFromConfig;
}
std::map<int, time_t> * clusterPlayerCityCreationTimeHistory = NULL;
std::map<int, time_t> * clusterPlayerCityCreationTimeHistory = nullptr;
#ifdef _DEBUG
clusterPlayerCityCreationTimeHistory = &(s_retroactivePlayerCityCreationTime[cluster]);
#else
@@ -5475,7 +5475,7 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime()
bool GameServerNamespace::checkAndSetOutstandingRequestSceneTransfer(ServerObject & object)
{
int const timeNow = static_cast<int>(::time(NULL));
int const timeNow = static_cast<int>(::time(nullptr));
// don't send multiple RequestSceneTransfer message
if (object.getObjVars().hasItem(OBJVAR_HAS_OUTSTANDING_REQUEST_SCENE_TRANSFER) && (object.getObjVars().getType(OBJVAR_HAS_OUTSTANDING_REQUEST_SCENE_TRANSFER) == DynamicVariable::INT))
@@ -5846,7 +5846,7 @@ void GameServerNamespace::handleAccountFeatureIdResponse(AccountFeatureIdRespons
std::string GameServer::getRetroactiveCtsHistory(std::string const & clusterName, NetworkId const & characterId)
{
std::string result;
std::map<NetworkId, std::vector<CtsSourceCharacterInfo> > const * clusterCtsHistory = NULL;
std::map<NetworkId, std::vector<CtsSourceCharacterInfo> > const * clusterCtsHistory = nullptr;
#ifdef _DEBUG
std::map<std::string, std::map<NetworkId, std::vector<CtsSourceCharacterInfo> > >::const_iterator const iterFindCluster = s_retroactiveCtsHistoryList.find(clusterName);
@@ -5901,7 +5901,7 @@ void GameServer::setRetroactiveCtsHistory(CreatureObject & player)
if (!playerObject->isAuthoritative())
return;
std::map<NetworkId, std::vector<CtsSourceCharacterInfo> > const * clusterCtsHistory = NULL;
std::map<NetworkId, std::vector<CtsSourceCharacterInfo> > const * clusterCtsHistory = nullptr;
#ifdef _DEBUG
std::map<std::string, std::map<NetworkId, std::vector<CtsSourceCharacterInfo> > >::const_iterator const iterFindCluster = s_retroactiveCtsHistoryList.find(GameServer::getInstance().getClusterName());
@@ -5990,7 +5990,7 @@ std::vector<std::vector<std::pair<std::string, DynamicVariable> > const *> const
static std::vector<std::vector<std::pair<std::string, DynamicVariable> > const *> returnValue;
returnValue.clear();
std::map<NetworkId, std::vector<CtsSourceCharacterInfo> > const * clusterCtsHistory = NULL;
std::map<NetworkId, std::vector<CtsSourceCharacterInfo> > const * clusterCtsHistory = nullptr;
#ifdef _DEBUG
std::map<std::string, std::map<NetworkId, std::vector<CtsSourceCharacterInfo> > >::const_iterator const iterFindCluster = s_retroactiveCtsHistoryList.find(GameServer::getInstance().getClusterName());
@@ -6028,7 +6028,7 @@ std::vector<std::vector<std::pair<std::string, DynamicVariable> > const *> const
time_t GameServer::getRetroactivePlayerCityCreationTime(std::string const & clusterName, int cityId)
{
std::map<int, time_t> const * clusterPlayerCityCreationTimeHistory = NULL;
std::map<int, time_t> const * clusterPlayerCityCreationTimeHistory = nullptr;
#ifdef _DEBUG
std::map<std::string, std::map<int, time_t> >::const_iterator const iterFindCluster = s_retroactivePlayerCityCreationTime.find(clusterName);
@@ -92,10 +92,10 @@ public:
uint32 getProcessId () const;
uint32 getPreloadAreaId () const;
virtual void receiveMessage (const MessageDispatch::Emitter & source, const MessageDispatch::MessageBase & message);
bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, const char * scriptCallback = NULL, bool forceLoadScreen = false);
bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, const char * scriptCallback = NULL, bool forceLoadScreen = false);
bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, float delayTime, const char * scriptCallback = NULL, bool forceLoadScreen = false);
bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, float delayTime, const char * scriptCallback = NULL, bool forceLoadScreen = false);
bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, const char * scriptCallback = nullptr, bool forceLoadScreen = false);
bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, const char * scriptCallback = nullptr, bool forceLoadScreen = false);
bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, float delayTime, const char * scriptCallback = nullptr, bool forceLoadScreen = false);
bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, float delayTime, const char * scriptCallback = nullptr, bool forceLoadScreen = false);
static void run ();
void sendToCentralServer (GameNetworkMessage const &message);
@@ -20,7 +20,7 @@
// ======================================================================
InstantDeleteList::ListType *InstantDeleteList::ms_theList = NULL;
InstantDeleteList::ListType *InstantDeleteList::ms_theList = nullptr;
// ======================================================================
@@ -47,7 +47,7 @@ void InstantDeleteList::install()
void InstantDeleteList::remove()
{
delete ms_theList;
ms_theList = NULL;
ms_theList = nullptr;
}
// ----------------------------------------------------------------------
@@ -87,7 +87,7 @@ void LogoutTracker::add(NetworkId const &networkId)
}
// set the callback
getScheduler().setCallback(handleLogoutCallback, NULL, ConfigServerGame::getUnsafeLogoutTimeMs());
getScheduler().setCallback(handleLogoutCallback, nullptr, ConfigServerGame::getUnsafeLogoutTimeMs());
}
// ----------------------------------------------------------------------
@@ -223,7 +223,7 @@ ServerObject *LogoutTracker::findPendingCharacterSave(const NetworkId &character
return obj;
}
else
return NULL;
return nullptr;
}
// ======================================================================
@@ -88,7 +88,7 @@ namespace MessageToQueueNamespace
typedef std::set<SchedulerItem, SchedulerItem::IsSoonerThan> SchedulerItemsType;
typedef std::vector<MessageToPayload> FrameMessagesType;
MessageToQueue * ms_instance=NULL;
MessageToQueue * ms_instance=nullptr;
LastKnownLocationsType ms_lastKnownLocations;
ObjectLocatorsType ms_objectLocators;
SchedulerItemsType ms_schedulerItems;
@@ -134,7 +134,7 @@ void MessageToQueue::install()
void MessageToQueue::remove()
{
delete ms_instance;
ms_instance = NULL;
ms_instance = nullptr;
}
// ----------------------------------------------------------------------
@@ -27,7 +27,7 @@
// ======================================================================
NameManager *NameManager::ms_instance = NULL;
NameManager *NameManager::ms_instance = nullptr;
// ======================================================================
@@ -45,14 +45,14 @@ void NameManager::remove()
{
NOT_NULL(ms_instance);
delete ms_instance;
ms_instance = NULL;
ms_instance = nullptr;
}
// ----------------------------------------------------------------------
NameManager::NameManager() :
m_nameGenerators (new NameGeneratorMapType),
m_reservedNames (NULL),
m_reservedNames (nullptr),
m_nameToIdMap (new NameToIdMapType),
m_idToCharacterDataMap(new IdToCharacterDataMapType)
{
@@ -72,20 +72,20 @@ NameManager::~NameManager()
delete i->second;
}
delete m_nameGenerators;
m_nameGenerators = NULL;
m_nameGenerators = nullptr;
delete m_reservedNames;
m_reservedNames = NULL;
m_reservedNames = nullptr;
delete m_nameToIdMap;
m_nameToIdMap = NULL;
m_nameToIdMap = nullptr;
delete m_idToCharacterDataMap;
m_idToCharacterDataMap = NULL;
m_idToCharacterDataMap = nullptr;
}
// ----------------------------------------------------------------------
const NameGenerator & NameManager::getNameGenerator(const std::string &directory, const std::string &nameTable) const
{
NameGenerator *generator=NULL;
NameGenerator *generator=nullptr;
NOT_NULL(m_nameGenerators);
NameGeneratorMapType::const_iterator i=m_nameGenerators->find(NameTableIdentifier(directory,nameTable));
if (i==m_nameGenerators->end())
@@ -204,7 +204,7 @@ void NameManager::addPlayer(const NetworkId &id, uint32 stationId, const std::st
{
createTime = static_cast<time_t>(getPlayerCreateTime(id));
if (createTime <= 0)
createTime = ::time(NULL);
createTime = ::time(nullptr);
}
characterData.createTime = createTime;
@@ -212,7 +212,7 @@ void NameManager::addPlayer(const NetworkId &id, uint32 stationId, const std::st
{
lastLoginTime = static_cast<time_t>(getPlayerLastLoginTime(id));
if (lastLoginTime <= 0)
lastLoginTime = ::time(NULL);
lastLoginTime = ::time(nullptr);
}
characterData.lastLoginTime = lastLoginTime;
@@ -382,7 +382,7 @@ void NameManager::getPlayerWithLastLoginTimeAfterDistribution(std::map<int, std:
for (std::map<int, std::pair<std::string, int> >::iterator iter = result.begin(); iter != result.end(); ++iter)
iter->second.second = 0;
int const timeNow = static_cast<int>(::time(NULL));
int const timeNow = static_cast<int>(::time(nullptr));
for (IdToCharacterDataMapType::const_iterator i = m_idToCharacterDataMap->begin(); i != m_idToCharacterDataMap->end(); ++i)
{
int const lastLoginTimeSecondsAgo = std::max(static_cast<int>(0), static_cast<int>(timeNow - static_cast<int>(i->second.lastLoginTime)));
@@ -439,7 +439,7 @@ void NameManager::getPlayerWithCreateTimeAfterDistribution(std::map<int, std::pa
for (std::map<int, std::pair<std::string, int> >::iterator iter = result.begin(); iter != result.end(); ++iter)
iter->second.second = 0;
int const timeNow = static_cast<int>(::time(NULL));
int const timeNow = static_cast<int>(::time(nullptr));
for (IdToCharacterDataMapType::const_iterator i = m_idToCharacterDataMap->begin(); i != m_idToCharacterDataMap->end(); ++i)
{
int const createTimeSecondsAgo = std::max(static_cast<int>(0), static_cast<int>(timeNow - static_cast<int>(i->second.createTime)));
@@ -257,10 +257,10 @@ void NewbieTutorial::getNonFreeObjectsForDeletion(const Container* const contain
{
const CachedNetworkId & itemId = *i;
ServerObject * item = safe_cast<ServerObject *>(itemId.getObject());
if (item != NULL)
if (item != nullptr)
{
TangibleObject *itemTangible = item->asTangibleObject();
if (itemTangible != NULL)
if (itemTangible != nullptr)
{
const char *templateName = itemTangible->getSharedTemplateName();
if (!FileManifest::contains(templateName))
@@ -273,7 +273,7 @@ void NewbieTutorial::getNonFreeObjectsForDeletion(const Container* const contain
{
// see if the item is a container and go through its contents
const Container * const itemContainer = ContainerInterface::getContainer(*item);
if (itemContainer != NULL)
if (itemContainer != nullptr)
getNonFreeObjectsForDeletion(itemContainer, objectsToDelete, character);
}
}
@@ -81,7 +81,7 @@ NpcConversation::NpcConversation(TangibleObject & player, TangibleObject & npc,
NpcConversation::~NpcConversation()
{
TangibleObject * const player = safe_cast<TangibleObject *>(m_player.getObject());
if (player != NULL)
if (player != nullptr)
{
MessageQueueStopNpcConversation * const message = new MessageQueueStopNpcConversation;
@@ -110,13 +110,13 @@ void NpcConversation::sendMessage(const Response & npcMessage, const Unicode::St
TangibleObject * const player = safe_cast<TangibleObject *>(m_player.getObject());
TangibleObject * const npc = safe_cast<TangibleObject *>(m_npc.getObject());
if (player == NULL)
if (player == nullptr)
{
if (npc != NULL)
if (npc != nullptr)
npc->removeConversation(m_player);
return;
}
if (npc == NULL)
if (npc == nullptr)
{
player->endNpcConversation();
return;
@@ -216,13 +216,13 @@ void NpcConversation::sendResponses()
const int count = static_cast<int>(m_responses->size());
if (player == NULL)
if (player == nullptr)
{
if (npc != NULL)
if (npc != nullptr)
npc->removeConversation(m_player);
return;
}
if (npc == NULL)
if (npc == nullptr)
{
player->endNpcConversation();
return;
@@ -353,14 +353,14 @@ void ObserveTracker::onObjectContainerChanged(ServerObject &obj)
bool isObservedWith = (newContainer->getContainerProperty() ? newContainer->getContainerProperty()->isContentItemObservedWith(obj) : false);
CellProperty * newContainerCell = newContainer->getCellProperty();
ServerObject const * newContainerContainer = safe_cast<ServerObject const *>(ContainerInterface::getContainedByObject(*newContainer));
if (newContainerCell == NULL || newContainerContainer != NULL)
if (newContainerCell == nullptr || newContainerContainer != nullptr)
{
std::set<Client *> const &newObservers = newContainer->getObservers();
for (std::set<Client *>::const_iterator i = newObservers.begin(); i != newObservers.end(); ++i)
{
if (isObservedWith ||
(*i)->getOpenedContainers().count(newContainer) ||
(newContainerCell != NULL && shouldObserveCellContentsDueToClientContainmentChain(**i, *newContainerContainer)))
(newContainerCell != nullptr && shouldObserveCellContentsDueToClientContainmentChain(**i, *newContainerContainer)))
{
IGNORE_RETURN(observe(**i, obj));
}
@@ -122,7 +122,7 @@ bool PlayerCreationManagerServer::setupPlayer(CreatureObject & obj, const std::s
else
{
//Attach insurance variables here:
if (item->asTangibleObject() != NULL)
if (item->asTangibleObject() != nullptr)
item->asTangibleObject()->setUninsurable(true);
}
}
@@ -204,7 +204,7 @@ bool PlayerCreationManagerServer::setupPlayer(CreatureObject & obj, const std::s
for (size_t i = 0; i < numSkills; ++i)
{
const SkillObject * skill = SkillManager::getInstance().getSkill(bounty_skills[i]);
if (skill != NULL)
if (skill != nullptr)
obj.grantSkill(*skill);
}
}
@@ -122,7 +122,7 @@ bool PositionUpdateTracker::shouldSendPositionUpdate(ServerObject const &obj)
return false;
ServerObject const *containedByObj = safe_cast<ServerObject const *>(ContainerInterface::getContainedByObject(obj));
CreatureObject const *creatureContainer = (containedByObj ? containedByObj->asCreatureObject() : NULL);
CreatureObject const *creatureContainer = (containedByObj ? containedByObj->asCreatureObject() : nullptr);
bool const objectIsRidingMount = (creatureContainer && creatureContainer->isMountable());
if (containedByObj && !isContainerConsideredPersisted(obj, *containedByObj) && !objectIsRidingMount)
@@ -204,7 +204,7 @@ void PositionUpdateTracker::sendPositionUpdate(ServerObject &obj)
else
{
ServerObject const * const container = safe_cast<ServerObject const *>(ContainerInterface::getContainedByObject(obj));
CreatureObject const * const creatureContainer = (container ? container->asCreatureObject() : NULL);
CreatureObject const * const creatureContainer = (container ? container->asCreatureObject() : nullptr);
if (creatureContainer && creatureContainer->isMountable())
{
// Riders of mounts persist at the location of the mount
@@ -55,7 +55,7 @@ RegexList::Entry::Entry(char const *pattern, bool matchWords, char const *reason
char const *errorString = 0;
int errorOffset = 0;
m_pcre = pcre_compile(pattern, 0, &errorString, &errorOffset, NULL);
m_pcre = pcre_compile(pattern, 0, &errorString, &errorOffset, nullptr);
WARNING(!m_pcre, ("failed to compile regex pattern [%s] into a pcre regex.", pattern));
}
@@ -175,7 +175,7 @@ bool RegexList::doesStringMatch(const Unicode::String &name, std::string &ruleDe
std::vector<std::string>::iterator nameIter;
for (nameIter = names.begin(); nameIter != names.end(); ++nameIter)
{
int const returnCode = pcre_exec(compiledRegex, NULL, nameIter->c_str(), nameIter->length(), 0, 0, captureData, dataElementCount);
int const returnCode = pcre_exec(compiledRegex, nullptr, nameIter->c_str(), nameIter->length(), 0, 0, captureData, dataElementCount);
if (returnCode >= 0)
{
ruleDescription = entry->getReason();
@@ -187,7 +187,7 @@ bool RegexList::doesStringMatch(const Unicode::String &name, std::string &ruleDe
}
else
{
int const returnCode = pcre_exec(compiledRegex, NULL, testName.c_str(), testName.length(), 0, 0, captureData, dataElementCount);
int const returnCode = pcre_exec(compiledRegex, nullptr, testName.c_str(), testName.length(), 0, 0, captureData, dataElementCount);
if (returnCode >= 0)
{
ruleDescription = entry->getReason();
@@ -247,7 +247,7 @@ void ReportManager::handleMessage(ChatOnRequestLog const &chatOnRequestLog)
CreatureObject * const reportingCreatureObject = CreatureObject::asCreatureObject(NetworkIdManager::getObjectById(reportData.m_reportingNetworkId));
PlayerObject * const reportingPlayerObject = PlayerCreatureController::getPlayerObject(reportingCreatureObject);
if (reportingPlayerObject != NULL)
if (reportingPlayerObject != nullptr)
{
// Make sure the chat log does not have any extra data in it
@@ -297,7 +297,7 @@ void ReportManager::handleMessage(ChatOnRequestLog const &chatOnRequestLog)
}
if ( !foundHarassingPlayer
&& (reportingCreatureObject != NULL))
&& (reportingCreatureObject != nullptr))
{
// No harassing player match
@@ -345,7 +345,7 @@ void ReportManager::handleMessage(ChatOnRequestLog const &chatOnRequestLog)
target.str = reportData.m_harassingName;
prosePackage.target = target;
if (reportingCreatureObject != NULL)
if (reportingCreatureObject != nullptr)
{
Chat::sendSystemMessage(*reportingCreatureObject, prosePackage);
}
@@ -113,7 +113,7 @@ SceneData * SceneGlobalDataNamespace::getSceneDataByName(std::string const & sce
if (i!=ms_SceneDataItems.end())
return i->second;
else
return NULL;
return nullptr;
}
// ======================================================================
@@ -58,7 +58,7 @@ void ServerBuffBuilderManager::remove()
ms_installed = false;
delete ms_callback;
ms_callback = NULL;
ms_callback = nullptr;
}
//-----------------------------------------------------------------------------
@@ -73,12 +73,12 @@ bool ServerBuffBuilderManager::makeChanges(SharedBuffBuilderManager::Session con
NetworkId const & recipientId = session.recipientId;
Object * const recipientObj = NetworkIdManager::getObjectById(recipientId);
ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : NULL;
CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : NULL;
ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : nullptr;
CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : nullptr;
NetworkId const & bufferId = session.bufferId;
Object * const bufferObj = NetworkIdManager::getObjectById(bufferId);
ServerObject * const bufferServerObj = bufferObj ? bufferObj->asServerObject() : NULL;
CreatureObject * const buffer = bufferServerObj ? bufferServerObj->asCreatureObject() : NULL;
ServerObject * const bufferServerObj = bufferObj ? bufferObj->asServerObject() : nullptr;
CreatureObject * const buffer = bufferServerObj ? bufferServerObj->asCreatureObject() : nullptr;
if(buffer && recipient)
{
sendSessionToScript(session, session.bufferId, static_cast<int>(Scripting::TRIG_BUFF_BUILDER_COMPLETED));
@@ -93,11 +93,11 @@ void ServerBuffBuilderManager::sendSessionToScriptForValidation(SharedBuffBuilde
NetworkId const & bufferId = session.bufferId;
NetworkId const & recipientId = session.recipientId;
Object const * const bufferObj = NetworkIdManager::getObjectById(bufferId);
ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : NULL;
CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : NULL;
ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : nullptr;
CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : nullptr;
Object * const recipientObj = NetworkIdManager::getObjectById(recipientId);
ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL;
CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL;
ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr;
CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr;
if(buffer && recipient)
{
sendSessionToScript(session, session.bufferId, static_cast<int>(Scripting::TRIG_BUFF_BUILDER_VALIDATE));
@@ -109,7 +109,7 @@ void ServerBuffBuilderManager::sendSessionToScriptForValidation(SharedBuffBuilde
void ServerBuffBuilderManager::sendSessionToScript(SharedBuffBuilderManager::Session const & session, NetworkId const & objectToTriggerId, int const trigger)
{
Object * const objectToTrigger = NetworkIdManager::getObjectById(objectToTriggerId);
ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : NULL;
ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : nullptr;
if(serverObjectToTrigger)
{
GameScriptObject * const scriptObject = serverObjectToTrigger->getScriptObject();
@@ -144,7 +144,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network
{
//send the cancel message to the buffer
Object * const bufferObject = NetworkIdManager::getObjectById(bufferId);
Controller * const bufferController = bufferObject ? bufferObject->getController() : NULL;
Controller * const bufferController = bufferObject ? bufferObject->getController() : nullptr;
if(bufferController)
{
BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage();
@@ -157,7 +157,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network
//send the cancel message to the recipient
Object * const recipientObject = NetworkIdManager::getObjectById(recipientId);
Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL;
Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr;
if(recipientController && bufferController != recipientController)
{
BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage();
@@ -169,7 +169,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network
}
//send cancel trigger to buffer player
ServerObject * const bufferServerObject = bufferObject ? bufferObject->asServerObject() : NULL;
ServerObject * const bufferServerObject = bufferObject ? bufferObject->asServerObject() : nullptr;
if(bufferServerObject)
{
GameScriptObject * const scriptObject = bufferServerObject->getScriptObject();
@@ -181,7 +181,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network
}
//send cancel trigger to recipient player
ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : NULL;
ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : nullptr;
if(recipientServerObject && recipientServerObject != bufferServerObject)
{
GameScriptObject * const scriptObject = recipientServerObject->getScriptObject();
@@ -81,8 +81,8 @@ namespace ServerBuildoutManagerNamespace
struct ServerEventAreaInfo
{
ServerEventAreaInfo():
buildOut(NULL),
loadedObject(NULL)
buildOut(nullptr),
loadedObject(nullptr)
{
}
@@ -892,7 +892,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf
ServerEventMap::iterator searchIter = s_eventObjects.find(buildoutRow.m_eventRequired);
if(searchIter != s_eventObjects.end())
{
ServerEventAreaInfo newEventObj(&buildoutRow, NULL);
ServerEventAreaInfo newEventObj(&buildoutRow, nullptr);
(*searchIter).second.push_back(newEventObj);
}
else
@@ -947,7 +947,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf
newObject->setAuthority();
if (newObject->asTangibleObject() != NULL)
if (newObject->asTangibleObject() != nullptr)
newObject->asTangibleObject()->initializeVisibility();
//
@@ -1033,7 +1033,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf
{
GameScriptObject * const gso = newObject->getScriptObject();
if (NULL != gso)
if (nullptr != gso)
{
std::string const &scripts = buildoutRow.m_scripts;
unsigned int pos = 0;
@@ -1077,7 +1077,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf
if ( controllerObjectId.isValid() )
{
ServerObject * const controllerObject = safe_cast<ServerObject *>(NetworkIdManager::getObjectById(controllerObjectId));
if (NULL != controllerObject)
if (nullptr != controllerObject)
{
GameScriptObject * const script = controllerObject->getScriptObject();
@@ -1092,7 +1092,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf
{
if (registerWithController)
{
if (NULL != script)
if (nullptr != script)
{
ScriptParams p;
p.addParam(obj->getNetworkId());
@@ -1279,7 +1279,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName)
newObject->setAuthority();
if (newObject->asTangibleObject() != NULL)
if (newObject->asTangibleObject() != nullptr)
newObject->asTangibleObject()->initializeVisibility();
//
@@ -1369,7 +1369,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName)
{
GameScriptObject * const gso = newObject->getScriptObject();
if (NULL != gso)
if (nullptr != gso)
{
std::string const &scripts = buildoutRow.m_scripts;
unsigned int pos = 0;
@@ -1407,7 +1407,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName)
if ( controllerObjectId.isValid() )
{
ServerObject * const controllerObject = safe_cast<ServerObject *>(NetworkIdManager::getObjectById(controllerObjectId));
if (NULL != controllerObject)
if (nullptr != controllerObject)
{
GameScriptObject * const script = controllerObject->getScriptObject();
@@ -1422,7 +1422,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName)
{
if (registerWithController)
{
if (NULL != script)
if (nullptr != script)
{
ScriptParams p;
p.addParam(obj->getNetworkId());
@@ -1483,7 +1483,7 @@ void ServerBuildoutManager::onEventStopped(std::string const & eventName)
object->unload();
(*objIter).loadedObject = NULL;
(*objIter).loadedObject = nullptr;
}
}
}
@@ -56,8 +56,8 @@ namespace ServerImageDesignerManagerNamespace
{
NetworkId const & nid = payload.first;
Object * const o = NetworkIdManager::getObjectById(nid);
ServerObject * const so = o ? o->asServerObject() : NULL;
CreatureObject * const creature = so ? so->asCreatureObject() : NULL;
ServerObject * const so = o ? o->asServerObject() : nullptr;
CreatureObject * const creature = so ? so->asCreatureObject() : nullptr;
if (creature)
{
ObjectTemplate const * const tmp = creature->getSharedTemplate();
@@ -157,7 +157,7 @@ void ServerImageDesignerManager::remove()
ms_genderSpeciesToAllowBald.clear();
delete ms_callback;
ms_callback = NULL;
ms_callback = nullptr;
}
//-----------------------------------------------------------------------------
@@ -172,12 +172,12 @@ bool ServerImageDesignerManager::makeChanges(SharedImageDesignerManager::Session
NetworkId const & recipientId = session.recipientId;
Object * const recipientObj = NetworkIdManager::getObjectById(recipientId);
ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : NULL;
CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : NULL;
ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : nullptr;
CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : nullptr;
NetworkId const & designerId = session.designerId;
Object * const designerObj = NetworkIdManager::getObjectById(designerId);
ServerObject * const designerServerObj = designerObj ? designerObj->asServerObject() : NULL;
CreatureObject * const designer = designerServerObj ? designerServerObj->asCreatureObject() : NULL;
ServerObject * const designerServerObj = designerObj ? designerObj->asServerObject() : nullptr;
CreatureObject * const designer = designerServerObj ? designerServerObj->asCreatureObject() : nullptr;
if(designer && recipient)
{
@@ -332,8 +332,8 @@ bool ServerImageDesignerManager::makeChanges(SharedImageDesignerManager::Session
SlotId const slot = SlotIdManager::findSlotId (ConstCharCrcLowerString (cms_hairSlotName));
Container::ContainerErrorCode tmp = Container::CEC_Success;
Object * const originalHairObject = slotted->getObjectInSlot(slot, tmp).getObject();
ServerObject * const originalHairServerObject = originalHairObject ? originalHairObject->asServerObject() : NULL;
TangibleObject * const orignalHair = originalHairServerObject ? originalHairServerObject->asTangibleObject() : NULL;
ServerObject * const originalHairServerObject = originalHairObject ? originalHairObject->asServerObject() : nullptr;
TangibleObject * const orignalHair = originalHairServerObject ? originalHairServerObject->asTangibleObject() : nullptr;
std::string originalHairCustomizationData;
if(orignalHair)
{
@@ -434,8 +434,8 @@ SharedImageDesignerManager::SkillMods ServerImageDesignerManager::getSkillModsFo
}
Object const * const o = NetworkIdManager::getObjectById(designerId);
ServerObject const * const so = o ? o->asServerObject() : NULL;
CreatureObject const * const designer = so ? so->asCreatureObject() : NULL;
ServerObject const * const so = o ? o->asServerObject() : nullptr;
CreatureObject const * const designer = so ? so->asCreatureObject() : nullptr;
if(designer)
{
skillMods.bodySkillMod = designer->getModValue(SharedImageDesignerManager::cms_bodySkillModName);
@@ -466,7 +466,7 @@ void ServerImageDesignerManager::updateGradualCustomizations(CreatureObject * ta
//do this one immediately
SlotId const slot = SlotIdManager::findSlotId (ConstCharCrcLowerString (cms_hairCustomizationName.c_str()));
ServerObject * const hair = ServerWorld::createNewObject(i->second.templateName, *target, slot, true);
TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : NULL;
TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : nullptr;
if(tangibleHair)
{
//first set hair color to colors from old hair (if any)
@@ -503,11 +503,11 @@ void ServerImageDesignerManager::sendSessionToScriptForValidation(SharedImageDes
NetworkId const & designerId = session.designerId;
NetworkId const & recipientId = session.recipientId;
Object const * const designerObj = NetworkIdManager::getObjectById(designerId);
ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : NULL;
CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : NULL;
ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : nullptr;
CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : nullptr;
Object * const recipientObj = NetworkIdManager::getObjectById(recipientId);
ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL;
CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL;
ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr;
CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr;
if(designer && recipient)
{
sendSessionToScript(session, session.designerId, static_cast<int>(Scripting::TRIG_IMAGE_DESIGN_VALIDATE));
@@ -519,7 +519,7 @@ void ServerImageDesignerManager::sendSessionToScriptForValidation(SharedImageDes
void ServerImageDesignerManager::sendSessionToScript(SharedImageDesignerManager::Session const & session, NetworkId const & objectToTriggerId, int const trigger)
{
Object * const objectToTrigger = NetworkIdManager::getObjectById(objectToTriggerId);
ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : NULL;
ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : nullptr;
if(serverObjectToTrigger)
{
GameScriptObject * const scriptObject = serverObjectToTrigger->getScriptObject();
@@ -571,11 +571,11 @@ CustomizationData * ServerImageDesignerManager::fetchCustomizationDataForCustomi
if(customization.isVarHairColor)
{
ServerObject * const hair = creature.getHair();
TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : NULL;
TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : nullptr;
if(tangibleHair)
objectToQuery = tangibleHair;
else
return NULL;
return nullptr;
}
return objectToQuery->fetchCustomizationData();
}
@@ -586,7 +586,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net
{
//send the cancel message to the designer
Object * const designerObject = NetworkIdManager::getObjectById(designerId);
Controller * const designerController = designerObject ? designerObject->getController() : NULL;
Controller * const designerController = designerObject ? designerObject->getController() : nullptr;
if(designerController)
{
ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage();
@@ -599,7 +599,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net
//send the cancel message to the recipient
Object * const recipientObject = NetworkIdManager::getObjectById(recipientId);
Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL;
Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr;
if(recipientController && designerController != recipientController)
{
ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage();
@@ -611,7 +611,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net
}
//send cancel trigger to designer player
ServerObject * const designerServerObject = designerObject ? designerObject->asServerObject() : NULL;
ServerObject * const designerServerObject = designerObject ? designerObject->asServerObject() : nullptr;
if(designerServerObject)
{
GameScriptObject * const scriptObject = designerServerObject->getScriptObject();
@@ -623,7 +623,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net
}
//send cancel trigger to recipient player
ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : NULL;
ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : nullptr;
if(recipientServerObject && recipientServerObject != designerServerObject)
{
GameScriptObject * const scriptObject = recipientServerObject->getScriptObject();
@@ -644,8 +644,8 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net
std::map<std::string, int> ServerImageDesignerManager::getHairCustomizations(SharedImageDesignerManager::Session const & session)
{
Object * const o = NetworkIdManager::getObjectById(session.recipientId);
ServerObject * const so = o ? o->asServerObject() : NULL;
CreatureObject * const recipient = so ? so->asCreatureObject() : NULL;
ServerObject * const so = o ? o->asServerObject() : nullptr;
CreatureObject * const recipient = so ? so->asCreatureObject() : nullptr;
CustomizationManager::Customization customization;
bool result = false;
std::map<std::string, int> hairCustomizations;
@@ -105,7 +105,7 @@ int ServerUIManager::createPage(const std::string& pageName, const ServerObject&
return pageId;
ServerUIPage * const serverUIPage = ServerUIManager::getPage(pageId);
if (serverUIPage != NULL)
if (serverUIPage != nullptr)
{
serverUIPage->setCallback(callbackFunction);
return pageId;
@@ -153,7 +153,7 @@ ServerUIPage* ServerUIManager::getPage(int pageId)
{
std::map<int, ServerUIPage*>::const_iterator iterFind = m_pages.find(pageId);
if (iterFind == m_pages.end())
return NULL;
return nullptr;
else
return iterFind->second;
}
@@ -163,7 +163,7 @@ ServerUIPage* ServerUIManager::getPage(int pageId)
bool ServerUIManager::showPage(int pageId)
{
ServerUIPage * const page = getPage(pageId);
if (page != NULL)
if (page != nullptr)
return showPage(*page);
WARNING(true, ("ServerUIManager::showPage(%d) invalid page", pageId));
@@ -175,14 +175,14 @@ bool ServerUIManager::showPage(int pageId)
bool ServerUIManager::showPage(ServerUIPage & page)
{
Client * const client = page.getClient();
if (client == NULL)
if (client == nullptr)
{
// WARNING(true, ("ServerUIManager::showPage attempt to show page on null client"));
// WARNING(true, ("ServerUIManager::showPage attempt to show page on nullptr client"));
return false;
}
ServerObject const * const characterObject = client->getCharacterObject();
if (characterObject == NULL)
if (characterObject == nullptr)
{
WARNING(true, ("ServerUIManager::showPage attempt to show page to client with no character object"));
return false;
@@ -219,11 +219,11 @@ bool ServerUIManager::closePage(int pageId)
{
//send close_page message
const ServerUIPage * const page = getPage(pageId);
if(page == NULL)
if(page == nullptr)
return false;
Client * const client = page->getClient();
if(client == NULL)
if(client == nullptr)
return false;
SuiForceClosePage msg;
@@ -239,7 +239,7 @@ bool ServerUIManager::removePage(int pageId)
{
//send close_page message
const ServerUIPage * const page = getPage(pageId);
if(page == NULL)
if(page == nullptr)
return false;
NetworkId const & primaryControlledObject = page->getPrimaryControlledObject();
@@ -275,11 +275,11 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message
int const pageId = suiEventNotification.getPageId();
ServerUIPage const * const page = getPage(pageId);
if (page == NULL)
if (page == nullptr)
return;
Client * const client = page->getClient();
if (client == NULL)
if (client == nullptr)
{
removePage(pageId);
return;
@@ -287,9 +287,9 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message
ServerObject * const characterObject = client->getCharacterObject();
if (characterObject == NULL)
if (characterObject == nullptr)
{
WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for null character object"));
WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for nullptr character object"));
removePage(pageId);
return;
}
@@ -300,15 +300,15 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message
ServerObject * const ownerObject = ServerWorld::findObjectByNetworkId(suiPageDataServer.getOwnerId());
if (ownerObject == NULL)
if (ownerObject == nullptr)
{
WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for null owner object"));
WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for nullptr owner object"));
removePage(pageId);
return;
}
GameScriptObject * const gso = ownerObject->getScriptObject();
if (gso == NULL)
if (gso == nullptr)
{
WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for owner object with no scripts"));
removePage(pageId);
@@ -318,7 +318,7 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message
int const eventIndex = suiEventNotification.getSubscribedEventIndex();
SuiCommand const * const command = suiPageData.findSubscribeToEventCommandByIndex(eventIndex);
if (command == NULL)
if (command == nullptr)
{
WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification invalid notification index [%d]", eventIndex));
return;
@@ -385,7 +385,7 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message
ScriptDictionaryPtr sd;
//it allocates sd, we have to clean it up later
gso->makeScriptDictionary(sp, sd);
if(sd.get() == NULL)
if(sd.get() == nullptr)
return;
//call the script callback function
@@ -36,7 +36,7 @@ m_pageDataServer(pageDataServer)
ServerUIPage::~ServerUIPage()
{
delete m_pageDataServer;
m_pageDataServer = NULL;
m_pageDataServer = nullptr;
}
//-----------------------------------------------------------------------
@@ -52,19 +52,19 @@ Client* ServerUIPage::getClient() const
if(!object)
{
WARNING(true, ("ServerUIPage PrimaryControlledObject doesn't exist"));
return NULL;
return nullptr;
}
ServerObject *const serverObject = object->asServerObject();
if(!serverObject)
{
WARNING(true, ("ServerUIPage PrimaryControlledObject isn't a server object"));
return NULL;
return nullptr;
}
Client * const result = serverObject->getClient();
if(!result)
{
WARNING(true, ("ServerUIPage PrimaryControlledObject has no client yet"));
return NULL;
return nullptr;
}
return result;
}
@@ -74,9 +74,9 @@ Client* ServerUIPage::getClient() const
ServerObject* ServerUIPage::getOwner() const
{
Object * const object = NetworkIdManager::getObjectById(getPageDataServer().getOwnerId());
if (object != NULL)
if (object != nullptr)
return object->asServerObject();
return NULL;
return nullptr;
}
//-----------------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More