All pastes #631333 Raw Edit

Miscellany

public text v1 · immutable
#631333 ·published 2007-07-23 21:36 UTC
rendered paste body
Index: src/game/GridDefines.h
===================================================================
--- src/game/GridDefines.h	(revision 4153)
+++ src/game/GridDefines.h	(working copy)
@@ -19,6 +19,8 @@
 #ifndef MANGOS_GRIDDEFINES_H
 #define MANGOS_GRIDDEFINES_H
 
+#include "Common.h"
+
 #include "GameSystem/NGrid.h"
 
 #include "zthread/CountedPtr.h"
@@ -54,7 +56,7 @@
 #define MAP_SIZE                (SIZE_OF_GRIDS*MAX_NUMBER_OF_GRIDS)
 #define MAP_HALFSIZE            (MAP_SIZE/2)
 
-// Creature used instead pet to simplify *::Visit templates (not requared duplicate code for Creature->Pet case)
+// Creature used instead pet to simplify *::Visit templates (not required duplicate code for Creature->Pet case)
 typedef TYPELIST_3(Player, Creature/*pets*/, Corpse/*resurrectable*/)                   AllWorldObjectTypes;
 typedef TYPELIST_4(GameObject, Creature/*except pets*/, DynamicObject, Corpse/*Bones*/) AllGridObjectTypes;
 
@@ -153,7 +155,7 @@
 
     inline bool IsValidMapCoord(float c)
     {
-        return (std::abs(c) < MAP_HALFSIZE - 0.5);
+        return !isnan(c) && (std::fabs(c) < MAP_HALFSIZE - 0.5);
     }
 
     inline bool IsValidMapCoord(float x, float y)
Index: src/game/TargetedMovementGenerator.cpp
===================================================================
--- src/game/TargetedMovementGenerator.cpp	(revision 4153)
+++ src/game/TargetedMovementGenerator.cpp	(working copy)
@@ -21,7 +21,6 @@
 #include "Errors.h"
 #include "Creature.h"
 #include "MapManager.h"
-#include "Spell.h"
 #include "DestinationHolderImp.h"
 
 #define SMALL_ALPHA 0.05
@@ -149,62 +148,3 @@
     }
     return true;
 }
-
-void TargetedMovementGenerator::_spellAtack(Creature &owner, SpellEntry* spellInfo)
-{
-    if(!spellInfo)
-        return;
-    owner.StopMoving();
-    owner->Idle();
-    if(owner.m_currentSpell)
-    {
-        if(owner.m_currentSpell->m_spellInfo->Id == spellInfo->Id )
-            return;
-        else
-        {
-            owner.m_currentSpell->cancel();
-        }
-    }
-    Spell *spell = new Spell(&owner, spellInfo, false, 0);
-    spell->SetAutoRepeat(true);
-    //owner.addUnitState(UNIT_STAT_ATTACKING);
-    owner.Attack(&owner);                                   //??
-    owner.clearUnitState(UNIT_STAT_CHASE);
-    SpellCastTargets targets;
-    targets.setUnitTarget( i_target.getTarget() );
-    spell->prepare(&targets);
-    owner.m_canMove = false;
-    DEBUG_LOG("Spell Attack.");
-}
-
-void TargetedMovementGenerator::spellAtack(Creature &owner,Unit &who,uint32 spellId)
-{
-    SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId );
-
-    if(!spellInfo)
-    {
-        sLog.outError("WORLD: unknown spell id %i\n", spellId);
-        return;
-    }
-
-    owner.StopMoving();
-    owner->Idle();
-    if(owner.m_currentSpell)
-    {
-        if(owner.m_currentSpell->m_spellInfo->Id == spellInfo->Id )
-            return;
-        else
-        {
-            owner.m_currentSpell->cancel();
-        }
-    }
-    Spell *spell = new Spell(&owner, spellInfo, false, 0);
-    spell->SetAutoRepeat(false);
-    //owner.addUnitState(UNIT_STAT_ATTACKING);
-    //owner.clearUnitState(UNIT_STAT_CHASE);
-    SpellCastTargets targets;
-    targets.setUnitTarget( &who );
-    spell->prepare(&targets);
-    owner.m_canMove = false;
-    DEBUG_LOG("Spell Attack.");
-}
Index: src/game/TargetedMovementGenerator.h
===================================================================
--- src/game/TargetedMovementGenerator.h	(revision 4153)
+++ src/game/TargetedMovementGenerator.h	(working copy)
@@ -24,8 +24,6 @@
 #include "Traveller.h"
 #include "FollowerReference.h"
 
-class Unit;
-
 class MANGOS_DLL_SPEC TargetedMovementGenerator : public MovementGenerator
 {
     public:
@@ -39,12 +37,10 @@
         bool Update(Creature &, const uint32 &);
         MovementGeneratorType GetMovementGeneratorType() { return TARGETED_MOTION_TYPE; }
 
-        void spellAtack(Creature &,Unit &,uint32 spellId);
         void stopFollowing() { };
 
     private:
 
-        void _spellAtack(Creature &owner, SpellEntry* spellInfo);
         void _setTargetLocation(Creature &);
 
         FollowerReference i_target;
Index: src/shared/Common.h
===================================================================
--- src/shared/Common.h	(revision 4153)
+++ src/shared/Common.h	(working copy)
@@ -100,6 +100,8 @@
 
 #if COMPILER == COMPILER_MICROSOFT
 
+#include <float.h>
+
 #define I64FMT "%016I64X"
 #define I64FMTD "%I64u"
 #define SI64FMTD "%I64d"
@@ -107,6 +109,7 @@
 #define atoll __atoi64
 #define vsnprintf _vsnprintf
 #define strdup _strdup
+#define isnan(X) _isnan(X)
 
 #else
 
@@ -115,6 +118,7 @@
 #define I64FMT "%016llX"
 #define I64FMTD "%llu"
 #define SI64FMTD "%lld"
+
 #endif
 
 #define GUID_HIPART(x)   (uint32)((x) >> 32)
Index: src/shared/Config/dotconfpp/dotconfpp.cpp
===================================================================
--- src/shared/Config/dotconfpp/dotconfpp.cpp	(revision 4153)
+++ src/shared/Config/dotconfpp/dotconfpp.cpp	(working copy)
@@ -1,4 +1,5 @@
 
+#include "Common.h"
 
 #include "dotconfpp.h"
 
Index: src/shared/Database/SqlOperations.h
===================================================================
--- src/shared/Database/SqlOperations.h	(revision 4153)
+++ src/shared/Database/SqlOperations.h	(working copy)
@@ -19,6 +19,8 @@
 #ifndef __SQLOPERATIONS_H
 #define __SQLOPERATIONS_H
 
+#include "Common.h"
+
 #include "zthread/LockedQueue.h"
 #include "zthread/FastMutex.h"
 #include <queue>