MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / LoadCommon

Method LoadCommon

src/saveload/gamelog_sl.cpp:380–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378 GLOGChunkHandler() : ChunkHandler('GLOG', CH_TABLE) {}
379
380 void LoadCommon(Gamelog &gamelog) const
381 {
382 assert(gamelog.data->action.empty());
383
384 const std::vector<SaveLoad> slt = SlCompatTableHeader(_gamelog_desc, _gamelog_sl_compat);
385
386 if (IsSavegameVersionBefore(SLV_RIFF_TO_ARRAY)) {
387 uint8_t type;
388 while ((type = SlReadByte()) != GLAT_NONE) {
389 if (type >= GLAT_END) SlErrorCorrupt("Invalid gamelog action type");
390
391 LoggedAction &la = gamelog.data->action.emplace_back();
392 la.at = (GamelogActionType)type;
393 SlObject(&la, slt);
394 }
395 return;
396 }
397
398 while (SlIterateArray() != -1) {
399 LoggedAction &la = gamelog.data->action.emplace_back();
400 SlObject(&la, slt);
401 }
402 }
403
404 void Save() const override
405 {

Callers 2

LoadMethod · 0.95
LoadCheckMethod · 0.95

Calls 7

SlCompatTableHeaderFunction · 0.85
IsSavegameVersionBeforeFunction · 0.85
SlReadByteFunction · 0.85
SlErrorCorruptFunction · 0.85
SlObjectFunction · 0.85
SlIterateArrayFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected