@@ -232,6 +232,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
232232 break ;
233233 }
234234 case BUTTON_LOAD_REPLAY : {
235+ int start_turn = 1 ;
235236 if (open_file) {
236237 ReplayMode::cur_replay.OpenReplay (open_file_name);
237238 open_file = false ;
@@ -243,6 +244,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
243244 myswprintf (replay_path, L" ./replay/%ls" , mainGame->lstReplayList ->getListItem (selected));
244245 if (!ReplayMode::cur_replay.OpenReplay (replay_path))
245246 break ;
247+ start_turn = std::wcstol (mainGame->ebRepStartTurn ->getText (), nullptr , 10 );
246248 }
247249 mainGame->ClearCardInfo ();
248250 mainGame->wCardImg ->setVisible (true );
@@ -257,7 +259,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
257259 mainGame->dField .Clear ();
258260 mainGame->HideElement (mainGame->wReplay );
259261 mainGame->device ->setEventReceiver (&mainGame->dField );
260- unsigned int start_turn = std::wcstol (mainGame->ebRepStartTurn ->getText (), nullptr , 10 );
261262 if (start_turn == 1 )
262263 start_turn = 0 ;
263264 ReplayMode::StartReplay (start_turn);
@@ -526,27 +527,27 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
526527 break ;
527528 wchar_t replay_path[256 ]{};
528529 myswprintf (replay_path, L" ./replay/%ls" , mainGame->lstReplayList ->getListItem (sel));
529- if (!ReplayMode::cur_replay .OpenReplay (replay_path)) {
530+ if (!temp_replay .OpenReplay (replay_path)) {
530531 mainGame->stReplayInfo ->setText (L" Error" );
531532 break ;
532533 }
533534 wchar_t infobuf[256 ]{};
534535 std::wstring repinfo;
535536 time_t curtime;
536- if (ReplayMode::cur_replay .pheader .flag & REPLAY_UNIFORM )
537- curtime = ReplayMode::cur_replay .pheader .start_time ;
537+ if (temp_replay .pheader .flag & REPLAY_UNIFORM )
538+ curtime = temp_replay .pheader .start_time ;
538539 else
539- curtime = ReplayMode::cur_replay .pheader .seed ;
540+ curtime = temp_replay .pheader .seed ;
540541 std::wcsftime (infobuf, sizeof infobuf / sizeof infobuf[0 ], L" %Y/%m/%d %H:%M:%S\n " , std::localtime (&curtime));
541542 repinfo.append (infobuf);
542- if (ReplayMode::cur_replay .pheader .flag & REPLAY_SINGLE_MODE ) {
543+ if (temp_replay .pheader .flag & REPLAY_SINGLE_MODE ) {
543544 wchar_t path[256 ]{};
544- BufferIO::DecodeUTF8 (ReplayMode::cur_replay .script_name .c_str (), path);
545+ BufferIO::DecodeUTF8 (temp_replay .script_name .c_str (), path);
545546 repinfo.append (path);
546547 repinfo.append (L" \n " );
547548 }
548- const auto & player_names = ReplayMode::cur_replay .players ;
549- if (ReplayMode::cur_replay .pheader .flag & REPLAY_TAG )
549+ const auto & player_names = temp_replay .players ;
550+ if (temp_replay .pheader .flag & REPLAY_TAG )
550551 myswprintf (infobuf, L" %ls\n %ls\n ===VS===\n %ls\n %ls\n " , player_names[0 ].c_str (), player_names[1 ].c_str (), player_names[2 ].c_str (), player_names[3 ].c_str ());
551552 else
552553 myswprintf (infobuf, L" %ls\n ===VS===\n %ls\n " , player_names[0 ].c_str (), player_names[1 ].c_str ());
0 commit comments