aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChaz Brown <iamparadox@netscape.net>2009-08-07 02:47:25 -0400
committerChaz Brown <iamparadox@netscape.net>2009-08-07 02:47:25 -0400
commitd7f7862d96c8086e3ea432e90530a329841317dc (patch)
tree00d576e4a0cdfc7f18a5ad1a37c76fde08ce6eeb
parent0aef1a9a486f4262540d10c331a5cb0115d3e11e (diff)
Fix knockback effect cause the creature's position client-server sync problem - By smellbee
Details and comments on this patch found here: http://www.trinitycore.org/forum/project.php?issueid=4689 --HG-- branch : trunk
-rw-r--r--src/game/DestinationHolderImp.h11
-rw-r--r--src/game/TargetedMovementGenerator.cpp4
2 files changed, 10 insertions, 5 deletions
diff --git a/src/game/DestinationHolderImp.h b/src/game/DestinationHolderImp.h
index c84ce19a96d..3d3adc94340 100644
--- a/src/game/DestinationHolderImp.h
+++ b/src/game/DestinationHolderImp.h
@@ -119,10 +119,10 @@ DestinationHolder<TRAVELLER>::UpdateTraveller(TRAVELLER &traveller, uint32 diff,
if(!traveller.GetTraveller().hasUnitState(UNIT_STAT_MOVING | UNIT_STAT_IN_FLIGHT))
return true;
- if(traveller.GetTraveller().hasUnitState(UNIT_STAT_IN_FLIGHT))
+ if(traveller.GetTraveller().hasUnitState(UNIT_STAT_IN_FLIGHT) || traveller.GetTraveller().IsFlying())
GetLocationNow(traveller.GetTraveller().GetBaseMap() ,x, y, z, true); // Should reposition Object with right Coord, so I can bypass some Grid Relocation
else
- GetLocationNow(traveller.GetTraveller().GetBaseMap(), x, y, z, false);
+ GetLocationNow(traveller.GetTraveller().GetMap(), x, y, z, false);
if( x == -431602080 )
return false;
@@ -175,13 +175,16 @@ DestinationHolder<TRAVELLER>::GetLocationNow(const Map * map, float &x, float &y
z = z2;
else
{
- //That part is good for mob Walking on the floor. But the floor is not always what we thought.
+ /*//That part is good for mob Walking on the floor. But the floor is not always what we thought.
z = map->GetHeight(x,y,i_fromZ,false); // Disable cave check
const float groundDist = sqrt(distanceX*distanceX + distanceY*distanceY);
const float zDist = fabs(i_fromZ - z) + 0.000001f;
const float slope = groundDist / zDist;
if(slope < 1.0f) // This prevents the ground returned by GetHeight to be used when in cave
- z = z2; // a climb or jump of more than 45 is denied
+ z = z2; // a climb or jump of more than 45 is denied*/
+ float ground = map->GetHeight(x,y,MAX_HEIGHT,true);
+ float floor = map->GetHeight(x,y,z2,true);
+ z = (fabs(ground - z2) <= fabs(floor - z2)) ? ground:floor;
}
}
}
diff --git a/src/game/TargetedMovementGenerator.cpp b/src/game/TargetedMovementGenerator.cpp
index c1c601921b3..da7b5cc41fe 100644
--- a/src/game/TargetedMovementGenerator.cpp
+++ b/src/game/TargetedMovementGenerator.cpp
@@ -205,7 +205,9 @@ TargetedMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
return true;
}
- if (i_destinationHolder.UpdateTraveller(traveller, time_diff))
+ bool update_traveller = (owner.GetTypeId() == TYPEID_UNIT && !((Creature*)&owner)->isPet())? i_destinationHolder.UpdateTraveller(traveller, time_diff, true) : i_destinationHolder.UpdateTraveller(traveller, time_diff, false);
+ //if (i_destinationHolder.UpdateTraveller(traveller, time_diff))
+ if(update_traveller)
{
// put targeted movement generators on a higher priority
//if (owner.GetObjectSize())