Fix for invalid handling of heading criteria in Client::Handle_OP_ClientUpdate()

This commit is contained in:
Uleat 2014-08-16 18:12:21 -04:00
parent 8ef17f2ccd
commit 9e1549b61b
3 changed files with 15 additions and 3 deletions

View File

@ -1,5 +1,14 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 08/16/2014 ==
Uleat (Noudness): Fixed a floating-point comparison error that led to the notorious 'client bounce' (this is not related to the
'mob falling' due to not having maps installed.) This fix also eliminates a sizeable amount of unnecessary out-going packets due
to invalid orientation corrections.
Note: This patch is probably of significant enough importance that admins may wish to manually apply this to older server builds.
The number of packets reduced per second should be approximately (num_stationary_close_clients * (num_close_clients - 1)). This will
likely have the most effect in zones like: Nexus, Bazaar, Guilds (Halls) and RAID INSTANCES - where players don't move around a lot.
== 08/15/2014 ==
Uleat: Reactivated the Bot::Spawn() code for sending post-spawn wear change updates..temporary until I can sort out the proper usage.

View File

@ -103,7 +103,8 @@ int NewFloatToEQ13(float d);
int FloatToEQ19(float d);
int FloatToEQH(float d);
// macro to catch fp errors (provided by noudness)
#define FCMP(a,b) (fabs(a-b) < FLT_EPSILON)
#define _ITOA_BUFLEN 25
const char *itoa(int num); //not thread safe

View File

@ -1231,7 +1231,6 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
delta_y = ppu->delta_y;
delta_z = ppu->delta_z;
delta_heading = ppu->delta_heading;
heading = EQ19toFloat(ppu->heading);
if(IsTracking() && ((x_pos!=ppu->x_pos) || (y_pos!=ppu->y_pos))){
if(MakeRandomFloat(0, 100) < 70)//should be good
@ -1257,12 +1256,15 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
}
// Outgoing client packet
if (ppu->y_pos != y_pos || ppu->x_pos != x_pos || ppu->heading != heading || ppu->animation != animation)
float tmpheading = EQ19toFloat(ppu->heading);
if (!FCMP(ppu->y_pos, y_pos) || !FCMP(ppu->x_pos, x_pos) || !FCMP(tmpheading, heading) || ppu->animation != animation)
{
x_pos = ppu->x_pos;
y_pos = ppu->y_pos;
z_pos = ppu->z_pos;
animation = ppu->animation;
heading = tmpheading;
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
PlayerPositionUpdateServer_Struct* ppu = (PlayerPositionUpdateServer_Struct*)outapp->pBuffer;