Jump to content

[patch][5895] Small Optimization


Guest edoz
 Share

Recommended Posts

hi everyone, this is one of my typical optimization patches, as i'm not good enough to fix major things :D

Index: AggressorAI.cpp
===================================================================
--- AggressorAI.cpp        (revision 5884)
+++ AggressorAI.cpp        (working copy)
@@ -123,10 +123,10 @@

        i_victimGuid = i_creature.getVictim()->GetGUID();

-        if( i_creature.IsWithinDistInMap(i_creature.getVictim(), ATTACK_DISTANCE))
+        if( i_creature.isAttackReady() )
        {
-                if( i_creature.isAttackReady() )
-                {
+                if( i_creature.IsWithinDistInMap(i_creature.getVictim(), ATTACK_DISTANCE))
+                {                
                        i_creature.AttackerStateUpdate(i_creature.getVictim());
                        i_creature.resetAttackTimer();
                }
Index: GuardAI.cpp
===================================================================
--- GuardAI.cpp        (revision 5884)
+++ GuardAI.cpp        (working copy)
@@ -110,10 +110,10 @@

        i_victimGuid = i_creature.getVictim()->GetGUID();

-        if( i_creature.IsWithinDistInMap(i_creature.getVictim(), ATTACK_DISTANCE))
+        if( i_creature.isAttackReady() )
        {
-                if( i_creature.isAttackReady() )
-                {
+                if( i_creature.IsWithinDistInMap(i_creature.getVictim(), ATTACK_DISTANCE))
+                {                
                        i_creature.AttackerStateUpdate(i_creature.getVictim());
                        i_creature.resetAttackTimer();
                }
Index: ReactorAI.cpp
===================================================================
--- ReactorAI.cpp        (revision 5884)
+++ ReactorAI.cpp        (working copy)
@@ -72,10 +72,10 @@

        i_victimGuid = i_creature.getVictim()->GetGUID();

-        if( i_creature.IsWithinDistInMap(i_creature.getVictim(), ATTACK_DISTANCE))
+        if( i_creature.isAttackReady() )
        {
-                if( i_creature.isAttackReady() )
-                {
+                if( i_creature.IsWithinDistInMap(i_creature.getVictim(), ATTACK_DISTANCE))
+                {                
                        i_creature.AttackerStateUpdate(i_creature.getVictim());
                        i_creature.resetAttackTimer();
                }

download: http://rapidshare.com/files/115840766/opti...tion.patch.html

edit: forgot to say why this patch. well, i think checking if something is near something else in the map is longer than checking if a variable is == 0 (that's what isattacking returns)

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use