<commit_before>#include "Runtime/MP1/CMainFlow.hpp"

#include "NESEmulator/CNESEmulator.hpp"

#include "Runtime/CArchitectureQueue.hpp"
#include "Runtime/CResFactory.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/Character/CCharLayoutInfo.hpp"
#include "Runtime/MP1/CCredits.hpp"
#include "Runtime/MP1/CFrontEndUI.hpp"
#include "Runtime/MP1/CMFGame.hpp"
#include "Runtime/MP1/CPlayMovie.hpp"
#include "Runtime/MP1/CPreFrontEnd.hpp"
#include "Runtime/MP1/CQuitGameScreen.hpp"
#include "Runtime/MP1/CSaveGameScreen.hpp"
#include "Runtime/MP1/CStateSetterFlow.hpp"
#include "Runtime/MP1/MP1.hpp"

namespace urde::MP1 {

void CMainFlow::AdvanceGameState(CArchitectureQueue& queue) {
  switch (x14_gameState) {
  case EClientFlowStates::Game:
    SetGameState(EClientFlowStates::GameExit, queue);
    break;
  case EClientFlowStates::PreFrontEnd:
    SetGameState(EClientFlowStates::FrontEnd, queue);
    break;
  case EClientFlowStates::FrontEnd:
    SetGameState(EClientFlowStates::Game, queue);
    break;
  case EClientFlowStates::GameExit: {
    MP1::CMain* main = static_cast<MP1::CMain*>(g_Main);
    if (main->GetFlowState() != EFlowState::None && main->GetFlowState() != EFlowState::StateSetter)
      main->SetX30(true);
    [[fallthrough]];
  }
  case EClientFlowStates::Unspecified:
    SetGameState(EClientFlowStates::PreFrontEnd, queue);
    break;
  }
}

void CMainFlow::SetGameState(EClientFlowStates state, CArchitectureQueue& queue) {
  x14_gameState = state;
  MP1::CMain* main = static_cast<MP1::CMain*>(g_Main);

  switch (state) {
  case EClientFlowStates::GameExit: {
    switch (main->GetFlowState()) {
    case EFlowState::WinBad:
    case EFlowState::WinGood:
    case EFlowState::WinBest:
      queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, std::make_shared<CCredits>()));
      break;
    case EFlowState::LoseGame:
      queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11,
                                            std::make_shared<CPlayMovie>(CPlayMovie::EWhichMovie::LoseGame)));
      break;
    default:
      break;
    }
    break;
  }
  case EClientFlowStates::PreFrontEnd: {
    if (main->GetFlowState() == EFlowState::None)
      return;
    queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, std::make_shared<CPreFrontEnd>()));
    break;
  }
  case EClientFlowStates::FrontEnd: {
    std::shared_ptr<CIOWin> nextIOWin;
    switch (main->GetFlowState()) {
    case EFlowState::StateSetter:
      nextIOWin = std::make_shared<CStateSetterFlow>();
      break;
    case EFlowState::WinBad:
    case EFlowState::WinGood:
    case EFlowState::WinBest:
    case EFlowState::LoseGame:
    case EFlowState::Default:
      nextIOWin = std::make_shared<CFrontEndUI>();
      break;
    default:
      return;
    }

    queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, std::move(nextIOWin)));
    break;
  }
  case EClientFlowStates::Game: {
    g_GameState->GameOptions().EnsureSettings();
    std::shared_ptr<CMFGameLoader> gameLoader = std::make_shared<CMFGameLoader>();
    main->SetFlowState(EFlowState::Default);
    queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 10, 1000, gameLoader));
    break;
  }
  default:
    break;
  }
}

} // namespace urde::MP1<commit_msg>CMainFlow: std::move shared_ptr in SetGameState<commit_after>#include "Runtime/MP1/CMainFlow.hpp"

#include "NESEmulator/CNESEmulator.hpp"

#include "Runtime/CArchitectureQueue.hpp"
#include "Runtime/CResFactory.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/Character/CCharLayoutInfo.hpp"
#include "Runtime/MP1/CCredits.hpp"
#include "Runtime/MP1/CFrontEndUI.hpp"
#include "Runtime/MP1/CMFGame.hpp"
#include "Runtime/MP1/CPlayMovie.hpp"
#include "Runtime/MP1/CPreFrontEnd.hpp"
#include "Runtime/MP1/CQuitGameScreen.hpp"
#include "Runtime/MP1/CSaveGameScreen.hpp"
#include "Runtime/MP1/CStateSetterFlow.hpp"
#include "Runtime/MP1/MP1.hpp"

namespace urde::MP1 {

void CMainFlow::AdvanceGameState(CArchitectureQueue& queue) {
  switch (x14_gameState) {
  case EClientFlowStates::Game:
    SetGameState(EClientFlowStates::GameExit, queue);
    break;
  case EClientFlowStates::PreFrontEnd:
    SetGameState(EClientFlowStates::FrontEnd, queue);
    break;
  case EClientFlowStates::FrontEnd:
    SetGameState(EClientFlowStates::Game, queue);
    break;
  case EClientFlowStates::GameExit: {
    MP1::CMain* main = static_cast<MP1::CMain*>(g_Main);
    if (main->GetFlowState() != EFlowState::None && main->GetFlowState() != EFlowState::StateSetter)
      main->SetX30(true);
    [[fallthrough]];
  }
  case EClientFlowStates::Unspecified:
    SetGameState(EClientFlowStates::PreFrontEnd, queue);
    break;
  }
}

void CMainFlow::SetGameState(EClientFlowStates state, CArchitectureQueue& queue) {
  x14_gameState = state;
  MP1::CMain* main = static_cast<MP1::CMain*>(g_Main);

  switch (state) {
  case EClientFlowStates::GameExit: {
    switch (main->GetFlowState()) {
    case EFlowState::WinBad:
    case EFlowState::WinGood:
    case EFlowState::WinBest:
      queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, std::make_shared<CCredits>()));
      break;
    case EFlowState::LoseGame:
      queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11,
                                            std::make_shared<CPlayMovie>(CPlayMovie::EWhichMovie::LoseGame)));
      break;
    default:
      break;
    }
    break;
  }
  case EClientFlowStates::PreFrontEnd: {
    if (main->GetFlowState() == EFlowState::None)
      return;
    queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, std::make_shared<CPreFrontEnd>()));
    break;
  }
  case EClientFlowStates::FrontEnd: {
    std::shared_ptr<CIOWin> nextIOWin;
    switch (main->GetFlowState()) {
    case EFlowState::StateSetter:
      nextIOWin = std::make_shared<CStateSetterFlow>();
      break;
    case EFlowState::WinBad:
    case EFlowState::WinGood:
    case EFlowState::WinBest:
    case EFlowState::LoseGame:
    case EFlowState::Default:
      nextIOWin = std::make_shared<CFrontEndUI>();
      break;
    default:
      return;
    }

    queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, std::move(nextIOWin)));
    break;
  }
  case EClientFlowStates::Game: {
    g_GameState->GameOptions().EnsureSettings();
    auto gameLoader = std::make_shared<CMFGameLoader>();
    main->SetFlowState(EFlowState::Default);
    queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 10, 1000, std::move(gameLoader)));
    break;
  }
  default:
    break;
  }
}

} // namespace urde::MP1
{'fraction_non_alphanumeric': 0.13489342674019975, 'fraction_numerical': 0.01341481591891489, 'mean_word_length': 4.749785775492716, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4118108', 'n_tokens_mistral': 2352, 'n_tokens_neox': 2301, 'n_words': 331}