Commit e94a2e03 authored by Chen Bill's avatar Chen Bill

update class SingleMode, ReplayMode

parent 36e4dfe5
...@@ -873,15 +873,10 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -873,15 +873,10 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
} }
return true; return true;
} }
void ReplayMode::ReloadLocation(int player, int location, int flag, std::vector<unsigned char>& queryBuffer) { inline void ReplayMode::ReloadLocation(int player, int location, int flag, std::vector<unsigned char>& queryBuffer) {
query_field_card(pduel, player, location, flag, queryBuffer.data(), 0); query_field_card(pduel, player, location, flag, queryBuffer.data(), 0);
mainGame->dField.UpdateFieldCard(mainGame->LocalPlayer(player), location, queryBuffer.data()); mainGame->dField.UpdateFieldCard(mainGame->LocalPlayer(player), location, queryBuffer.data());
} }
void ReplayMode::RefreshLocation(int player, int location, int flag) {
std::vector<unsigned char> queryBuffer;
queryBuffer.resize(SIZE_QUERY_BUFFER);
ReloadLocation(player, location, flag, queryBuffer);
}
void ReplayMode::ReplayRefresh(int flag) { void ReplayMode::ReplayRefresh(int flag) {
std::vector<byte> queryBuffer; std::vector<byte> queryBuffer;
queryBuffer.resize(SIZE_QUERY_BUFFER); queryBuffer.resize(SIZE_QUERY_BUFFER);
...@@ -892,17 +887,22 @@ void ReplayMode::ReplayRefresh(int flag) { ...@@ -892,17 +887,22 @@ void ReplayMode::ReplayRefresh(int flag) {
ReloadLocation(0, LOCATION_HAND, flag, queryBuffer); ReloadLocation(0, LOCATION_HAND, flag, queryBuffer);
ReloadLocation(1, LOCATION_HAND, flag, queryBuffer); ReloadLocation(1, LOCATION_HAND, flag, queryBuffer);
} }
void ReplayMode::ReplayRefreshHand(int player, int flag) { void ReplayMode::ReplayRefreshLocation(int player, int location, int flag) {
RefreshLocation(player, LOCATION_HAND, flag); std::vector<unsigned char> queryBuffer;
queryBuffer.resize(SIZE_QUERY_BUFFER);
ReloadLocation(player, location, flag, queryBuffer);
}
inline void ReplayMode::ReplayRefreshHand(int player, int flag) {
ReplayRefreshLocation(player, LOCATION_HAND, flag);
} }
void ReplayMode::ReplayRefreshGrave(int player, int flag) { inline void ReplayMode::ReplayRefreshGrave(int player, int flag) {
RefreshLocation(player, LOCATION_GRAVE, flag); ReplayRefreshLocation(player, LOCATION_GRAVE, flag);
} }
void ReplayMode::ReplayRefreshDeck(int player, int flag) { inline void ReplayMode::ReplayRefreshDeck(int player, int flag) {
RefreshLocation(player, LOCATION_DECK, flag); ReplayRefreshLocation(player, LOCATION_DECK, flag);
} }
void ReplayMode::ReplayRefreshExtra(int player, int flag) { inline void ReplayMode::ReplayRefreshExtra(int player, int flag) {
RefreshLocation(player, LOCATION_EXTRA, flag); ReplayRefreshLocation(player, LOCATION_EXTRA, flag);
} }
void ReplayMode::ReplayRefreshSingle(int player, int location, int sequence, int flag) { void ReplayMode::ReplayRefreshSingle(int player, int location, int sequence, int flag) {
unsigned char queryBuffer[0x1000]; unsigned char queryBuffer[0x1000];
......
...@@ -20,6 +20,7 @@ private: ...@@ -20,6 +20,7 @@ private:
static int skip_turn; static int skip_turn;
static int current_step; static int current_step;
static int skip_step; static int skip_step;
static void ReloadLocation(int player, int location, int flag, std::vector<unsigned char>& queryBuffer);
public: public:
static Replay cur_replay; static Replay cur_replay;
...@@ -37,9 +38,8 @@ public: ...@@ -37,9 +38,8 @@ public:
static void Undo(); static void Undo();
static bool ReplayAnalyze(unsigned char* msg, unsigned int len); static bool ReplayAnalyze(unsigned char* msg, unsigned int len);
inline static void ReloadLocation(int player, int location, int flag, std::vector<unsigned char>& queryBuffer);
inline static void RefreshLocation(int player, int location, int flag);
static void ReplayRefresh(int flag = 0xf81fff); static void ReplayRefresh(int flag = 0xf81fff);
static void ReplayRefreshLocation(int player, int location, int flag);
static void ReplayRefreshHand(int player, int flag = 0x781fff); static void ReplayRefreshHand(int player, int flag = 0x781fff);
static void ReplayRefreshGrave(int player, int flag = 0x181fff); static void ReplayRefreshGrave(int player, int flag = 0x181fff);
static void ReplayRefreshDeck(int player, int flag = 0x181fff); static void ReplayRefreshDeck(int player, int flag = 0x181fff);
......
...@@ -774,15 +774,10 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -774,15 +774,10 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
} }
return is_continuing; return is_continuing;
} }
void SingleMode::ReloadLocation(int player, int location, int flag, std::vector<unsigned char>& queryBuffer) { inline void SingleMode::ReloadLocation(int player, int location, int flag, std::vector<unsigned char>& queryBuffer) {
query_field_card(pduel, player, location, flag, queryBuffer.data(), 0); query_field_card(pduel, player, location, flag, queryBuffer.data(), 0);
mainGame->dField.UpdateFieldCard(mainGame->LocalPlayer(player), location, queryBuffer.data()); mainGame->dField.UpdateFieldCard(mainGame->LocalPlayer(player), location, queryBuffer.data());
} }
void SingleMode::RefreshLocation(int player, int location, int flag) {
std::vector<unsigned char> queryBuffer;
queryBuffer.resize(SIZE_QUERY_BUFFER);
ReloadLocation(player, location, flag, queryBuffer);
}
void SingleMode::SinglePlayRefresh(int flag) { void SingleMode::SinglePlayRefresh(int flag) {
std::vector<unsigned char> queryBuffer; std::vector<unsigned char> queryBuffer;
queryBuffer.resize(SIZE_QUERY_BUFFER); queryBuffer.resize(SIZE_QUERY_BUFFER);
...@@ -793,17 +788,22 @@ void SingleMode::SinglePlayRefresh(int flag) { ...@@ -793,17 +788,22 @@ void SingleMode::SinglePlayRefresh(int flag) {
ReloadLocation(0, LOCATION_HAND, flag, queryBuffer); ReloadLocation(0, LOCATION_HAND, flag, queryBuffer);
ReloadLocation(1, LOCATION_HAND, flag, queryBuffer); ReloadLocation(1, LOCATION_HAND, flag, queryBuffer);
} }
void SingleMode::SinglePlayRefreshHand(int player, int flag) { void SingleMode::SingleRefreshLocation(int player, int location, int flag) {
RefreshLocation(player, LOCATION_HAND, flag); std::vector<unsigned char> queryBuffer;
queryBuffer.resize(SIZE_QUERY_BUFFER);
ReloadLocation(player, location, flag, queryBuffer);
}
inline void SingleMode::SinglePlayRefreshHand(int player, int flag) {
SingleRefreshLocation(player, LOCATION_HAND, flag);
} }
void SingleMode::SinglePlayRefreshGrave(int player, int flag) { inline void SingleMode::SinglePlayRefreshGrave(int player, int flag) {
RefreshLocation(player, LOCATION_GRAVE, flag); SingleRefreshLocation(player, LOCATION_GRAVE, flag);
} }
void SingleMode::SinglePlayRefreshDeck(int player, int flag) { inline void SingleMode::SinglePlayRefreshDeck(int player, int flag) {
RefreshLocation(player, LOCATION_DECK, flag); SingleRefreshLocation(player, LOCATION_DECK, flag);
} }
void SingleMode::SinglePlayRefreshExtra(int player, int flag) { inline void SingleMode::SinglePlayRefreshExtra(int player, int flag) {
RefreshLocation(player, LOCATION_EXTRA, flag); SingleRefreshLocation(player, LOCATION_EXTRA, flag);
} }
void SingleMode::SinglePlayRefreshSingle(int player, int location, int sequence, int flag) { void SingleMode::SinglePlayRefreshSingle(int player, int location, int sequence, int flag) {
unsigned char queryBuffer[0x1000]; unsigned char queryBuffer[0x1000];
......
...@@ -12,6 +12,7 @@ private: ...@@ -12,6 +12,7 @@ private:
static intptr_t pduel; static intptr_t pduel;
static bool is_closing; static bool is_closing;
static bool is_continuing; static bool is_continuing;
static void ReloadLocation(int player, int location, int flag, std::vector<unsigned char>& queryBuffer);
public: public:
static bool StartPlay(); static bool StartPlay();
...@@ -20,9 +21,8 @@ public: ...@@ -20,9 +21,8 @@ public:
static int SinglePlayThread(); static int SinglePlayThread();
static bool SinglePlayAnalyze(unsigned char* msg, unsigned int len); static bool SinglePlayAnalyze(unsigned char* msg, unsigned int len);
inline static void ReloadLocation(int player, int location, int flag, std::vector<unsigned char>& queryBuffer);
inline static void RefreshLocation(int player, int location, int flag);
static void SinglePlayRefresh(int flag = 0xf81fff); static void SinglePlayRefresh(int flag = 0xf81fff);
static void SingleRefreshLocation(int player, int location, int flag);
static void SinglePlayRefreshHand(int player, int flag = 0x781fff); static void SinglePlayRefreshHand(int player, int flag = 0x781fff);
static void SinglePlayRefreshGrave(int player, int flag = 0x181fff); static void SinglePlayRefreshGrave(int player, int flag = 0x181fff);
static void SinglePlayRefreshDeck(int player, int flag = 0x181fff); static void SinglePlayRefreshDeck(int player, int flag = 0x181fff);
......
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