| 49 | } |
| 50 | |
| 51 | void UserConfig::LoadFromParamFile(const ParamFile& cfg) |
| 52 | { |
| 53 | DifficultyDesc* descs = GetDifficultyDescs(); |
| 54 | for (int i = 0; i < DTN; i++) |
| 55 | { |
| 56 | RString name = RString("diff") + RString(descs[i].name); |
| 57 | const ParamEntry* cfgEntry = cfg.FindEntry(name); |
| 58 | if (cfgEntry) |
| 59 | { |
| 60 | // Restore both modes unconditionally: SaveToParamFile writes cadet AND veteran for |
| 61 | // every flag and the difficulty UI lets either mode be edited, so gating the veteran |
| 62 | // read on enabledInVeteran silently drops persisted veteran values — e.g. "enemy info" |
| 63 | // (EnemyTag, enabledInVeteran=false) enabled in veteran mode reverts to default on reload. |
| 64 | cadetDifficulty[i] = (*cfgEntry)[0]; |
| 65 | veteranDifficulty[i] = (*cfgEntry)[1]; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | const ParamEntry* entry = cfg.FindEntry("showTitles"); |
| 70 | if (entry) |
| 71 | showTitles = *entry; |
| 72 | |
| 73 | entry = cfg.FindEntry("easyMode"); |
| 74 | if (entry) |
| 75 | easyMode = *entry; |
| 76 | |
| 77 | entry = cfg.FindEntry("fovTop"); |
| 78 | if (entry) |
| 79 | fovTop = (float)*entry; |
| 80 | |
| 81 | entry = cfg.FindEntry("fovLeft"); |
| 82 | if (entry) |
| 83 | fovLeft = (float)*entry; |
| 84 | } |
| 85 | |
| 86 | void UserConfig::SaveToParamFile(ParamFile& cfg) const |
| 87 | { |
nothing calls this directly
no test coverage detected