Core/Spline: Improve error output for SpineInitArgs check

by Schmoozerd
This commit is contained in:
Shocker
2012-10-31 18:39:05 +02:00
parent 9d81c763fe
commit cd55d64364
3 changed files with 7 additions and 4 deletions

View File

@@ -19,6 +19,7 @@
#include "MoveSpline.h"
#include <sstream>
#include "Log.h"
#include "Unit.h"
namespace Movement{
@@ -195,12 +196,12 @@ MoveSpline::MoveSpline() : m_Id(0), time_passed(0),
/// ============================================================================================
bool MoveSplineInitArgs::Validate() const
bool bool MoveSplineInitArgs::Validate(Unit* unit) const
{
#define CHECK(exp) \
if (!(exp))\
{\
sLog->outError(LOG_FILTER_GENERAL, "MoveSplineInitArgs::Validate: expression '%s' failed", #exp);\
sLog->outError(LOG_FILTER_GENERAL, "MoveSplineInitArgs::Validate: expression '%s' failed for %u", #exp, unit->GetGUIDLow());\
return false;\
}
CHECK(path.size() > 1);

View File

@@ -98,7 +98,7 @@ namespace Movement
if (!args.HasVelocity)
args.velocity = unit.GetSpeed(SelectSpeedType(moveFlags));
if (!args.Validate())
if (!args.Validate(&unit))
return;
if (moveFlags & MOVEMENTFLAG_ROOT)

View File

@@ -22,6 +22,8 @@
#include "MoveSplineFlag.h"
#include <G3D/Vector3.h>
class Unit;
namespace Movement
{
typedef std::vector<Vector3> PointsArray;
@@ -61,7 +63,7 @@ namespace Movement
bool TransformForTransport;
/** Returns true to show that the arguments were configured correctly and MoveSpline initialization will succeed. */
bool Validate() const;
bool Validate(Unit* unit) const;
private:
bool _checkPathBounds() const;
};