This commit is contained in:
aozhiwei 2024-09-09 16:40:30 +08:00
parent 9bd4b6acbd
commit 3f77a2cfb9
4 changed files with 11 additions and 9 deletions

View File

@ -1033,7 +1033,7 @@ void Player::_CMMove(f8::MsgHdr* hdr, const cs::CMMove& msg)
tmp_pos.z
});
#endif
Pullback();
SyncServerPos(0);
} else {
move_target_pos_ = tmp_pos;
}
@ -1046,7 +1046,7 @@ void Player::_CMMove(f8::MsgHdr* hdr, const cs::CMMove& msg)
tmp_pos.z
});
#endif
Pullback();
SyncServerPos(0);
}
}
} else {
@ -2024,17 +2024,18 @@ void Player::SetShotHold(bool hold)
shot_hold = hold;
}
void Player::Pullback()
void Player::SyncServerPos(int reason)
{
#ifdef MYDEBUG
a8::XPrintf("pullback %f,%f,%f\n",
a8::XPrintf("SyncServerPos %f,%f,%f\n",
{
GetPos().GetX(),
GetPos().GetY(),
GetPos().GetZ(),
});
#endif
cs::SMPullback msg;
cs::SMServerSyncPos msg;
msg.set_reason(reason);
TypeConvert::ToPb(GetPos().ToGlmVec3(), msg.mutable_pos());
SendNotifyMsg(msg);
}

View File

@ -151,7 +151,7 @@ class Player : public Human
void _CMMobaBattleData(f8::MsgHdr* hdr, const cs::CMMobaBattleData& msg);
virtual void SetAttackDir(const glm::vec3& attack_dir) override;
void AsyncRequestWatchWar(bool send_rsp_msg);
void Pullback();
void SyncServerPos(int reason);
protected:
Player();

View File

@ -77,5 +77,5 @@ enum SMMessageId_e
_SMBattlePreInfoUpdate = 1034;
_SMAddBattleHint = 1035;
_SMDelBattleHint = 1036;
_SMPullback = 1037;
_SMServerSyncPos = 1037;
}

View File

@ -2149,8 +2149,9 @@ message SMDelBattleHint
optional int32 uniid = 1; //id
}
//-
message SMPullback
//
message SMServerSyncPos
{
optional int32 reason = 1; //0:
optional MFVec3 pos = 2; //
}