MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / DisplayRevert

Method DisplayRevert

engine/Poseidon/UI/OptionsUIImpl.cpp:1785–1811  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1783 RString dir = GetTmpSaveDirectory();
1784 char buffer[512];
1785 snprintf(buffer, sizeof(buffer), "%s%s.sqc", (const char*)dir, (const char*)campaign.campaignName);
1786
1787 ParamArchiveSave ar(UserInfoVersion);
1788 // const_cast because SerializeClass::Serialize is non-const but this
1789 // path is logically read-only — it's the standard write idiom used
1790 // elsewhere by SaveParams.
1791 CampaignHistory& nonConst = const_cast<CampaignHistory&>(campaign);
1792 if (ar.Serialize("Campaign", nonConst, 1) != LSOK)
1793 return false;
1794 return ar.Save(buffer) == LSOK;
1795}
1796
1797// Bridge for DebugCheats::Cmd_UnlockCampaign — unlocks every campaign
1798// found on disk (subdirs of Campaigns/ + .pb? banks), works regardless
1799// of which display is currently active. When DisplayCampaignLoad is
1800// open we also refresh its in-memory _campaigns so the visible list
1801// updates immediately; otherwise the .sqc files we just wrote will be
1802// picked up on the next Campaign Load open.
1803bool DebugUnlockAllCampaigns()
1804{
1805 AutoArray<RString> names;
1806
1807 // Subdirectories under Campaigns/ (same scan as LoadCampaigns).
1808 _finddata_t info;
1809 intptr_t h = _findfirst("Campaigns\\*.*", &info);
1810 if (h != -1)
1811 {
1812 do
1813 {
1814 if ((info.attrib & _A_SUBDIR) != 0 && info.name[0] != '.')

Callers

nothing calls this directly

Calls 4

GetCtrlFunction · 0.85
ShowCtrlMethod · 0.80
OpenMethod · 0.45
FormatTextMethod · 0.45

Tested by

no test coverage detected