mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-18 06:00:10 -04:00
*Massive cleanup (\n\n -> \n, *\n -> \n, cleanup for(...) to for (...), and some other cleanups by hand)
*Fix a possible crash in Spell::DoAllEffectOnTarget --HG-- branch : trunk
This commit is contained in:
@@ -17,16 +17,12 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "BaseModel.h"
|
||||
#include "VMapTools.h"
|
||||
|
||||
using namespace G3D;
|
||||
|
||||
namespace VMAP
|
||||
{
|
||||
//==========================================================
|
||||
|
||||
void BaseModel::getMember(Array<TriangleBox>& pMembers)
|
||||
{
|
||||
for(unsigned int i=0; i<iNTriangles; i++)
|
||||
@@ -34,15 +30,12 @@ namespace VMAP
|
||||
pMembers.append(iTriangles[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================
|
||||
BaseModel::BaseModel(unsigned int pNNodes, unsigned int pNTriangles)
|
||||
{
|
||||
init(pNNodes, pNTriangles);
|
||||
};
|
||||
|
||||
//==========================================================
|
||||
|
||||
void BaseModel::init(unsigned int pNNodes, unsigned int pNTriangles)
|
||||
{
|
||||
iNNodes = pNNodes;
|
||||
@@ -52,21 +45,16 @@ namespace VMAP
|
||||
if(iNNodes >0) iTreeNodes = new TreeNode[iNNodes];
|
||||
if(iNTriangles >0) iTriangles = new TriangleBox[iNTriangles];
|
||||
}
|
||||
|
||||
//==========================================================
|
||||
|
||||
void BaseModel::free()
|
||||
{
|
||||
if(getTriangles() != 0) delete [] getTriangles(); setNTriangles(0);
|
||||
if(getTreeNodes() != 0) delete [] getTreeNodes(); setNNodes(0);
|
||||
}
|
||||
|
||||
//==========================================================
|
||||
|
||||
void BaseModel::intersect(const G3D::AABox& pBox, const G3D::Ray& pRay, float& pMaxDist, G3D::Vector3& pOutLocation, G3D::Vector3& /*pOutNormal*/) const
|
||||
{
|
||||
bool isInside = false;
|
||||
|
||||
float d = MyCollisionDetection::collisionLocationForMovingPointFixedAABox(
|
||||
pRay.origin, pRay.direction,
|
||||
pBox,
|
||||
@@ -76,9 +64,7 @@ namespace VMAP
|
||||
pMaxDist = d;
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================
|
||||
|
||||
bool BaseModel::intersect(const G3D::AABox& pBox, const G3D::Ray& pRay, float& pMaxDist) const
|
||||
{
|
||||
// See if the ray will ever hit this node or its children
|
||||
@@ -87,12 +73,9 @@ namespace VMAP
|
||||
bool rayWillHitBounds =
|
||||
MyCollisionDetection::collisionLocationForMovingPointFixedAABox(
|
||||
pRay.origin, pRay.direction, pBox, location, alreadyInsideBounds);
|
||||
|
||||
bool canHitThisNode = (alreadyInsideBounds ||
|
||||
(rayWillHitBounds && ((location - pRay.origin).squaredLength() < (pMaxDist * pMaxDist))));
|
||||
|
||||
return canHitThisNode;
|
||||
}
|
||||
|
||||
} // VMAP
|
||||
|
||||
|
||||
Reference in New Issue
Block a user