| 50 | } |
| 51 | |
| 52 | void Load() const override |
| 53 | { |
| 54 | std::vector<SaveLoad> slt = SlCompatTableHeader(_cheats_desc, _cheats_sl_compat); |
| 55 | |
| 56 | if (IsSavegameVersionBefore(SLV_TABLE_CHUNKS)) { |
| 57 | size_t count = SlGetFieldLength(); |
| 58 | std::vector<SaveLoad> oslt; |
| 59 | |
| 60 | /* Cheats were added over the years without a savegame bump. They are |
| 61 | * stored as 2 SLE_BOOLs per entry. "count" indicates how many SLE_BOOLs |
| 62 | * are stored for this savegame. So read only "count" SLE_BOOLs (and in |
| 63 | * result "count / 2" cheats). */ |
| 64 | for (auto &sld : slt) { |
| 65 | count--; |
| 66 | oslt.push_back(sld); |
| 67 | |
| 68 | if (count == 0) break; |
| 69 | } |
| 70 | slt = std::move(oslt); |
| 71 | } |
| 72 | |
| 73 | if (!IsSavegameVersionBefore(SLV_RIFF_TO_ARRAY) && SlIterateArray() == -1) return; |
| 74 | SlObject(&_cheats, slt); |
| 75 | if (!IsSavegameVersionBefore(SLV_RIFF_TO_ARRAY) && SlIterateArray() != -1) SlErrorCorrupt("Too many CHTS entries"); |
| 76 | } |
| 77 | }; |
| 78 | |
| 79 | static const CHTSChunkHandler CHTS; |
nothing calls this directly
no test coverage detected