mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-27 08:09:31 +00:00
Issue found with PVS-Studio:
Many instances where we would create a object via a new call, and then check that it was non-null. This is redundant, as if we ever were in a situation where new failed, we'd be crashing left and right already, so the additional check is wasted processing.
This commit is contained in:
parent
db532c0e1a
commit
527c3790d6
15 changed files with 164 additions and 262 deletions
|
|
@ -725,24 +725,20 @@ bool AIPlayer::setPathDestination(const Point3F &pos)
|
|||
|
||||
// Create a new path.
|
||||
NavPath *path = new NavPath();
|
||||
if(path)
|
||||
|
||||
path->mMesh = getNavMesh();
|
||||
path->mFrom = getPosition();
|
||||
path->mTo = pos;
|
||||
path->mFromSet = path->mToSet = true;
|
||||
path->mAlwaysRender = true;
|
||||
path->mLinkTypes = mLinkTypes;
|
||||
path->mXray = true;
|
||||
// Paths plan automatically upon being registered.
|
||||
if(!path->registerObject())
|
||||
{
|
||||
path->mMesh = getNavMesh();
|
||||
path->mFrom = getPosition();
|
||||
path->mTo = pos;
|
||||
path->mFromSet = path->mToSet = true;
|
||||
path->mAlwaysRender = true;
|
||||
path->mLinkTypes = mLinkTypes;
|
||||
path->mXray = true;
|
||||
// Paths plan automatically upon being registered.
|
||||
if(!path->registerObject())
|
||||
{
|
||||
delete path;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
delete path;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(path->success())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue