[Client] Fix IsMoving for Client (#2318)

* [Client] Fix IsMoving for client

* Consolidate member vars

* Update client_process.cpp
This commit is contained in:
Chris Miles 2022-07-27 08:51:51 -05:00 committed by GitHub
parent 1089f8139b
commit 7d2f88325a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 15 deletions

View File

@ -349,7 +349,8 @@ Client::Client(EQStreamInterface* ieqs)
m_pp.InnateSkills[i] = InnateDisabled;
temp_pvp = false;
is_client_moving = false;
moving = false;
environment_damage_modifier = 0;
invulnerable_environment_damage = false;

View File

@ -229,8 +229,6 @@ public:
Client(EQStreamInterface * ieqs);
~Client();
bool is_client_moving;
void ReconnectUCS();
void SetDisplayMobInfoWindow(bool display_mob_info_window);

View File

@ -4505,9 +4505,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
rewind_timer.Start(30000, true);
}
is_client_moving = !(cy == m_Position.y && cx == m_Position.x);
SetMoving(!(cy == m_Position.y && cx == m_Position.x));
/**
* Client aggro scanning
@ -4518,11 +4516,11 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
LogAggroDetail(
"ClientUpdate [{}] {}moving, scan timer [{}]",
GetCleanName(),
is_client_moving ? "" : "NOT ",
IsMoving() ? "" : "NOT ",
client_scan_npc_aggro_timer.GetRemainingTime()
);
if (is_client_moving) {
if (IsMoving()) {
if (client_scan_npc_aggro_timer.GetRemainingTime() > client_scan_npc_aggro_timer_moving) {
LogAggroDetail("Client [{}] Restarting with moving timer", GetCleanName());
client_scan_npc_aggro_timer.Disable();
@ -4545,11 +4543,11 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
LogAIScanCloseDetail(
"Client [{}] {}moving, scan timer [{}]",
GetCleanName(),
is_client_moving ? "" : "NOT ",
IsMoving() ? "" : "NOT ",
mob_close_scan_timer.GetRemainingTime()
);
if (is_client_moving) {
if (IsMoving()) {
if (mob_close_scan_timer.GetRemainingTime() > client_mob_close_scan_timer_moving) {
LogAIScanCloseDetail("Client [{}] Restarting with moving timer", GetCleanName());
mob_close_scan_timer.Disable();
@ -4579,7 +4577,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
client_zone_wide_full_position_update_timer.Check() || moved_far_enough_before_bulk_update
);
if (is_client_moving && is_ready_to_update) {
if (IsMoving() && is_ready_to_update) {
LogDebug("[[{}]] Client Zone Wide Position Update NPCs", GetCleanName());
auto &mob_movement_manager = MobMovementManager::Get();
@ -4622,7 +4620,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
}
/* Only feed real time updates when client is moving */
if (is_client_moving || new_heading != m_Position.w || new_animation != animation) {
if (IsMoving() || new_heading != m_Position.w || new_animation != animation) {
animation = ppu->animation;
m_Position.w = new_heading;

View File

@ -124,7 +124,7 @@ bool Client::Process() {
}
/* I haven't naturally updated my position in 10 seconds, updating manually */
if (!is_client_moving && position_update_timer.Check()) {
if (!IsMoving() && position_update_timer.Check()) {
SentPositionPacket(0.0f, 0.0f, 0.0f, 0.0f, 0);
}
@ -291,7 +291,7 @@ bool Client::Process() {
* Used in aggro checks
*/
if (mob_close_scan_timer.Check()) {
entity_list.ScanCloseMobs(close_mobs, this, is_client_moving);
entity_list.ScanCloseMobs(close_mobs, this, IsMoving());
}
bool may_use_attacks = false;