Commit 7f54f3c8 authored by mercury233's avatar mercury233

exclude reading replay in server mode

parent bd68750c
...@@ -145,6 +145,7 @@ void Replay::SaveReplay(const wchar_t* name) { ...@@ -145,6 +145,7 @@ void Replay::SaveReplay(const wchar_t* name) {
std::fwrite(comp_data, comp_size, 1, rfp); std::fwrite(comp_data, comp_size, 1, rfp);
std::fclose(rfp); std::fclose(rfp);
} }
#ifndef YGOPRO_SERVER_MODE
bool Replay::OpenReplay(const wchar_t* name) { bool Replay::OpenReplay(const wchar_t* name) {
FILE* rfp = mywfopen(name, "rb"); FILE* rfp = mywfopen(name, "rb");
if(!rfp) { if(!rfp) {
...@@ -260,6 +261,7 @@ void Replay::Rewind() { ...@@ -260,6 +261,7 @@ void Replay::Rewind() {
data_position = 0; data_position = 0;
can_read = true; can_read = true;
} }
#endif // YGOPRO_SERVER_MODE
void Replay::Reset() { void Replay::Reset() {
is_recording = false; is_recording = false;
is_replaying = false; is_replaying = false;
...@@ -273,6 +275,7 @@ void Replay::Reset() { ...@@ -273,6 +275,7 @@ void Replay::Reset() {
decks.clear(); decks.clear();
script_name.clear(); script_name.clear();
} }
#ifndef YGOPRO_SERVER_MODE
void Replay::SkipInfo(){ void Replay::SkipInfo(){
if (data_position == 0) if (data_position == 0)
data_position += info_offset; data_position += info_offset;
...@@ -330,5 +333,6 @@ bool Replay::ReadInfo() { ...@@ -330,5 +333,6 @@ bool Replay::ReadInfo() {
} }
return true; return true;
} }
#endif // YGOPRO_SERVER_MODE
} }
...@@ -83,6 +83,9 @@ public: ...@@ -83,6 +83,9 @@ public:
return deck_index; return deck_index;
} }
} }
#ifdef YGOPRO_SERVER_MODE
void Reset();
#else
bool OpenReplay(const wchar_t* name); bool OpenReplay(const wchar_t* name);
bool ReadNextResponse(unsigned char resp[]); bool ReadNextResponse(unsigned char resp[]);
bool ReadName(wchar_t* data); bool ReadName(wchar_t* data);
...@@ -99,6 +102,7 @@ public: ...@@ -99,6 +102,7 @@ public:
void Reset(); void Reset();
void SkipInfo(); void SkipInfo();
bool IsReplaying() const; bool IsReplaying() const;
#endif // YGOPRO_SERVER_MODE
FILE* fp{ nullptr }; FILE* fp{ nullptr };
#ifdef _WIN32 #ifdef _WIN32
...@@ -116,7 +120,9 @@ public: ...@@ -116,7 +120,9 @@ public:
std::string script_name; // 2 bytes, script name (max: 256 bytes) std::string script_name; // 2 bytes, script name (max: 256 bytes)
private: private:
#ifndef YGOPRO_SERVER_MODE
bool ReadInfo(); bool ReadInfo();
#endif
unsigned char* replay_data; unsigned char* replay_data;
size_t replay_size{}; size_t replay_size{};
......
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