From be1f338bd338ac8db0cf3d152f6afd608d83cb41 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 13 May 2019 13:58:10 +0800 Subject: [PATCH] 1 --- server/gameserver/player.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server/gameserver/player.cc b/server/gameserver/player.cc index a5f2296..e656c7e 100644 --- a/server/gameserver/player.cc +++ b/server/gameserver/player.cc @@ -811,10 +811,14 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg) #endif if (!a8::HasBitFlag(status, HS_Fly)) { if (msg.has_attack_dir()) { - if (std::abs(msg.attack_dir().x()) > 0.000001f || - std::abs(msg.attack_dir().y()) > 0.000001f) { - attack_dir.FromPB(&msg.attack_dir()); - attack_dir.Normalize(); + if (!std::isfinite(msg.attack_dir().x()) && + !std::isfinite(msg.attack_dir().y()) && + !std::isnan(msg.attack_dir().x()) && + !std::isnan(msg.attack_dir().y()) + ) + { + attack_dir.FromPB(&msg.attack_dir()); + attack_dir.Normalize(); } } else { if (moving) {