| 9567 | } |
| 9568 | |
| 9569 | void cFodder::Game_Load() { |
| 9570 | auto Files = g_ResourceMan->GetSaves(); |
| 9571 | std::vector<sSavedGame> SaveFiles; |
| 9572 | |
| 9573 | SaveFiles = Game_Load_Filter(Files); |
| 9574 | Files.clear(); |
| 9575 | |
| 9576 | |
| 9577 | const std::string File = GUI_Select_File("SELECT SAVED GAME", SaveFiles, Files); |
| 9578 | if (!File.size()) |
| 9579 | return; |
| 9580 | |
| 9581 | auto SaveData = g_ResourceMan->FileReadStr(g_ResourceMan->GetSave(File)); |
| 9582 | |
| 9583 | // Load the game data from the JSONstd::string((char*)SaveData->data(), SaveData->size())) |
| 9584 | if (!mGame_Data.FromJson(SaveData)) { |
| 9585 | return; |
| 9586 | } |
| 9587 | |
| 9588 | // If the game was saved on a different platform, lets look for it and attempt to switch |
| 9589 | if (mGame_Data.mSavedVersion.mPlatform != mVersionCurrent->mPlatform) { |
| 9590 | |
| 9591 | VersionSwitch( mVersions->GetForCampaign(mGame_Data.mCampaignName, mGame_Data.mSavedVersion.mPlatform) ); |
| 9592 | } |
| 9593 | |
| 9594 | mMouse_Exit_Loop = false; |
| 9595 | |
| 9596 | for (int16 x = 0; x < 8; ++x) |
| 9597 | mMission_Troops_SpritePtrs[x] = INVALID_SPRITE_PTR; |
| 9598 | |
| 9599 | for (auto& Troop : mGame_Data.mSoldiers_Allocated) |
| 9600 | Troop.mSprite = INVALID_SPRITE_PTR; |
| 9601 | |
| 9602 | GameData_Backup(); |
| 9603 | GameData_Restore(); |
| 9604 | } |
| 9605 | |
| 9606 | std::vector<sSavedGame> cFodder::Game_Load_Filter(const std::vector<std::string>& pFiles) { |
| 9607 | std::vector<sSavedGame> Results; |
nothing calls this directly
no test coverage detected