Commit e082f6e0 authored by Chen Bill's avatar Chen Bill

add DuelInfo.Clear()

parent ee5fea7e
......@@ -1190,6 +1190,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
mainGame->showcard = 0;
mainGame->gMutex.lock();
mainGame->dField.Clear();
mainGame->dInfo.Clear();
int playertype = BufferIO::ReadInt8(pbuf);
mainGame->dInfo.isFirst = (playertype & 0xf) ? false : true;
if(playertype & 0xf0)
......
......@@ -16,6 +16,38 @@ namespace ygo {
Game* mainGame;
void DuelInfo::Clear() {
isStarted = false;
isFinished = false;
isReplay = false;
isReplaySkiping = false;
isFirst = false;
isTag = false;
isSingleMode = false;
is_shuffling = false;
tag_player[0] = false;
tag_player[1] = false;
isReplaySwapped = false;
lp[0] = 0;
lp[1] = 0;
start_lp = 0;
duel_rule = 0;
turn = 0;
curMsg = 0;
hostname[0] = 0;
clientname[0] = 0;
hostname_tag[0] = 0;
clientname_tag[0] = 0;
strLP[0][0] = 0;
strLP[1][0] = 0;
vic_string = 0;
player_type = 0;
time_player = 0;
time_limit = 0;
time_left[0] = 0;
time_left[1] = 0;
}
bool Game::Initialize() {
LoadConfig();
irr::SIrrlichtCreationParameters params = irr::SIrrlichtCreationParameters();
......
......@@ -91,6 +91,8 @@ struct DuelInfo {
unsigned char time_player{ 0 };
unsigned short time_limit{ 0 };
unsigned short time_left[2]{ 0 };
void Clear();
};
struct BotInfo {
......
......@@ -57,6 +57,7 @@ bool ReplayMode::ReadReplayResponse() {
}
int ReplayMode::ReplayThread() {
const ReplayHeader& rh = cur_replay.pheader;
mainGame->dInfo.Clear();
mainGame->dInfo.isFirst = true;
mainGame->dInfo.isTag = !!(rh.flag & REPLAY_TAG);
mainGame->dInfo.isSingleMode = !!(rh.flag & REPLAY_SINGLE_MODE);
......
......@@ -92,6 +92,7 @@ int SingleMode::SinglePlayThread() {
mainGame->btnLeaveGame->setText(dataManager.GetSysString(1210));
mainGame->wPhase->setVisible(true);
mainGame->dField.Clear();
mainGame->dInfo.Clear();
mainGame->dInfo.isFirst = true;
mainGame->dInfo.isStarted = true;
mainGame->dInfo.isFinished = false;
......
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