Commit 37c06613 authored by Chen Bill's avatar Chen Bill

Replay: add SkipInfo

parent ce9439c2
...@@ -138,6 +138,8 @@ bool Replay::OpenReplay(const wchar_t* name) { ...@@ -138,6 +138,8 @@ bool Replay::OpenReplay(const wchar_t* name) {
Reset(); Reset();
return false; return false;
} }
info_offset = data_position;
data_position = 0;
return true; return true;
} }
bool Replay::CheckReplay(const wchar_t* name) { bool Replay::CheckReplay(const wchar_t* name) {
...@@ -218,11 +220,15 @@ void Replay::Reset() { ...@@ -218,11 +220,15 @@ void Replay::Reset() {
replay_size = 0; replay_size = 0;
comp_size = 0; comp_size = 0;
data_position = 0; data_position = 0;
info_offset = 0;
players.clear(); players.clear();
params = { 0 }; params = { 0 };
decks.clear(); decks.clear();
script_name.clear(); script_name.clear();
} }
void Replay::SkipInfo(){
data_position += info_offset;
}
bool Replay::ReadInfo() { bool Replay::ReadInfo() {
int player_count = (pheader.flag & REPLAY_TAG) ? 4 : 2; int player_count = (pheader.flag & REPLAY_TAG) ? 4 : 2;
for (int i = 0; i < player_count; ++i) { for (int i = 0; i < player_count; ++i) {
......
...@@ -80,6 +80,7 @@ public: ...@@ -80,6 +80,7 @@ public:
int32_t ReadInt32(); int32_t ReadInt32();
void Rewind(); void Rewind();
void Reset(); void Reset();
void SkipInfo();
FILE* fp{ nullptr }; FILE* fp{ nullptr };
#ifdef _WIN32 #ifdef _WIN32
...@@ -102,6 +103,7 @@ private: ...@@ -102,6 +103,7 @@ private:
unsigned char* replay_data; unsigned char* replay_data;
size_t replay_size{}; size_t replay_size{};
size_t data_position{}; size_t data_position{};
size_t info_offset{};
bool is_recording{}; bool is_recording{};
bool is_replaying{}; bool is_replaying{};
bool can_read{}; bool can_read{};
......
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