Commit 1ff39351 authored by Chen Bill's avatar Chen Bill Committed by GitHub

DuelMode change: fix the declaration of Analyze (#2609)

parent cc9497b7
...@@ -208,26 +208,25 @@ inline unsigned int GetPosition(unsigned char* qbuf, int offset) { ...@@ -208,26 +208,25 @@ inline unsigned int GetPosition(unsigned char* qbuf, int offset) {
class DuelMode { class DuelMode {
public: public:
virtual ~DuelMode() {} DuelMode() = default;
virtual void Chat(DuelPlayer* dp, unsigned char* pdata, int len) {} virtual ~DuelMode() = default;
virtual void JoinGame(DuelPlayer* dp, unsigned char* pdata, bool is_creater) {} virtual void Chat(DuelPlayer* dp, unsigned char* pdata, int len) = 0;
virtual void LeaveGame(DuelPlayer* dp) {} virtual void JoinGame(DuelPlayer* dp, unsigned char* pdata, bool is_creater) = 0;
virtual void ToDuelist(DuelPlayer* dp) {} virtual void LeaveGame(DuelPlayer* dp) = 0;
virtual void ToObserver(DuelPlayer* dp) {} virtual void ToDuelist(DuelPlayer* dp) = 0;
virtual void PlayerReady(DuelPlayer* dp, bool is_ready) {} virtual void ToObserver(DuelPlayer* dp) = 0;
virtual void PlayerKick(DuelPlayer* dp, unsigned char pos) {} virtual void PlayerReady(DuelPlayer* dp, bool is_ready) = 0;
virtual void UpdateDeck(DuelPlayer* dp, unsigned char* pdata, int len) {} virtual void PlayerKick(DuelPlayer* dp, unsigned char pos) = 0;
virtual void StartDuel(DuelPlayer* dp) {} virtual void UpdateDeck(DuelPlayer* dp, unsigned char* pdata, int len) = 0;
virtual void HandResult(DuelPlayer* dp, unsigned char res) {} virtual void StartDuel(DuelPlayer* dp) = 0;
virtual void TPResult(DuelPlayer* dp, unsigned char tp) {} virtual void HandResult(DuelPlayer* dp, unsigned char res) = 0;
virtual void Process() {} virtual void TPResult(DuelPlayer* dp, unsigned char tp) = 0;
virtual int Analyze(char* msgbuffer, unsigned int len) { virtual void Process() = 0;
return 0; virtual int Analyze(unsigned char* msgbuffer, unsigned int len) = 0;
} virtual void Surrender(DuelPlayer* dp) = 0;
virtual void Surrender(DuelPlayer* dp) {} virtual void GetResponse(DuelPlayer* dp, unsigned char* pdata, unsigned int len) = 0;
virtual void GetResponse(DuelPlayer* dp, unsigned char* pdata, unsigned int len) {} virtual void TimeConfirm(DuelPlayer* dp) = 0;
virtual void TimeConfirm(DuelPlayer* dp) {} virtual void EndDuel() = 0;
virtual void EndDuel() {}
public: public:
event* etimer { nullptr }; event* etimer { nullptr };
......
...@@ -10,24 +10,24 @@ namespace ygo { ...@@ -10,24 +10,24 @@ namespace ygo {
class SingleDuel: public DuelMode { class SingleDuel: public DuelMode {
public: public:
SingleDuel(bool is_match); SingleDuel(bool is_match);
virtual ~SingleDuel(); ~SingleDuel() override;
virtual void Chat(DuelPlayer* dp, unsigned char* pdata, int len); void Chat(DuelPlayer* dp, unsigned char* pdata, int len) override;
virtual void JoinGame(DuelPlayer* dp, unsigned char* pdata, bool is_creater); void JoinGame(DuelPlayer* dp, unsigned char* pdata, bool is_creater) override;
virtual void LeaveGame(DuelPlayer* dp); void LeaveGame(DuelPlayer* dp) override;
virtual void ToDuelist(DuelPlayer* dp); void ToDuelist(DuelPlayer* dp) override;
virtual void ToObserver(DuelPlayer* dp); void ToObserver(DuelPlayer* dp) override;
virtual void PlayerReady(DuelPlayer* dp, bool ready); void PlayerReady(DuelPlayer* dp, bool ready) override;
virtual void PlayerKick(DuelPlayer* dp, unsigned char pos); void PlayerKick(DuelPlayer* dp, unsigned char pos) override;
virtual void UpdateDeck(DuelPlayer* dp, unsigned char* pdata, int len); void UpdateDeck(DuelPlayer* dp, unsigned char* pdata, int len) override;
virtual void StartDuel(DuelPlayer* dp); void StartDuel(DuelPlayer* dp) override;
virtual void HandResult(DuelPlayer* dp, unsigned char res); void HandResult(DuelPlayer* dp, unsigned char res) override;
virtual void TPResult(DuelPlayer* dp, unsigned char tp); void TPResult(DuelPlayer* dp, unsigned char tp) override;
virtual void Process(); void Process() override;
virtual void Surrender(DuelPlayer* dp); void Surrender(DuelPlayer* dp) override;
virtual int Analyze(unsigned char* msgbuffer, unsigned int len); int Analyze(unsigned char* msgbuffer, unsigned int len) override;
virtual void GetResponse(DuelPlayer* dp, unsigned char* pdata, unsigned int len); void GetResponse(DuelPlayer* dp, unsigned char* pdata, unsigned int len) override;
virtual void TimeConfirm(DuelPlayer* dp); void TimeConfirm(DuelPlayer* dp) override;
virtual void EndDuel(); void EndDuel() override;
void DuelEndProc(); void DuelEndProc();
void WaitforResponse(int playerid); void WaitforResponse(int playerid);
......
...@@ -10,24 +10,24 @@ namespace ygo { ...@@ -10,24 +10,24 @@ namespace ygo {
class TagDuel: public DuelMode { class TagDuel: public DuelMode {
public: public:
TagDuel(); TagDuel();
virtual ~TagDuel(); ~TagDuel() override;
virtual void Chat(DuelPlayer* dp, unsigned char* pdata, int len); void Chat(DuelPlayer* dp, unsigned char* pdata, int len) override;
virtual void JoinGame(DuelPlayer* dp, unsigned char* pdata, bool is_creater); void JoinGame(DuelPlayer* dp, unsigned char* pdata, bool is_creater) override;
virtual void LeaveGame(DuelPlayer* dp); void LeaveGame(DuelPlayer* dp) override;
virtual void ToDuelist(DuelPlayer* dp); void ToDuelist(DuelPlayer* dp) override;
virtual void ToObserver(DuelPlayer* dp); void ToObserver(DuelPlayer* dp) override;
virtual void PlayerReady(DuelPlayer* dp, bool ready); void PlayerReady(DuelPlayer* dp, bool ready) override;
virtual void PlayerKick(DuelPlayer* dp, unsigned char pos); void PlayerKick(DuelPlayer* dp, unsigned char pos) override;
virtual void UpdateDeck(DuelPlayer* dp, unsigned char* pdata, int len); void UpdateDeck(DuelPlayer* dp, unsigned char* pdata, int len) override;
virtual void StartDuel(DuelPlayer* dp); void StartDuel(DuelPlayer* dp) override;
virtual void HandResult(DuelPlayer* dp, unsigned char res); void HandResult(DuelPlayer* dp, unsigned char res) override;
virtual void TPResult(DuelPlayer* dp, unsigned char tp); void TPResult(DuelPlayer* dp, unsigned char tp) override;
virtual void Process(); void Process() override;
virtual void Surrender(DuelPlayer* dp); void Surrender(DuelPlayer* dp) override;
virtual int Analyze(unsigned char* msgbuffer, unsigned int len); int Analyze(unsigned char* msgbuffer, unsigned int len) override;
virtual void GetResponse(DuelPlayer* dp, unsigned char* pdata, unsigned int len); void GetResponse(DuelPlayer* dp, unsigned char* pdata, unsigned int len) override;
virtual void TimeConfirm(DuelPlayer* dp); void TimeConfirm(DuelPlayer* dp) override;
virtual void EndDuel(); void EndDuel() override;
void DuelEndProc(); void DuelEndProc();
void WaitforResponse(int playerid); void WaitforResponse(int playerid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment