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

Method Load

src/saveload/animated_tile_sl.cpp:36–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 }
35
36 void Load() const override
37 {
38 /* Before version 80 we did NOT have a variable length animated tile table */
39 if (IsSavegameVersionBefore(SLV_80)) {
40 /* In pre version 6, we has 16bit per tile, now we have 32bit per tile, convert it ;) */
41 TileIndex anim_list[256];
42 SlCopy(anim_list, 256, IsSavegameVersionBefore(SLV_6) ? (SLE_FILE_U16 | SLE_VAR_U32) : SLE_UINT32);
43
44 for (int i = 0; i < 256; i++) {
45 if (anim_list[i] == 0) break;
46 _animated_tiles.push_back(anim_list[i]);
47 }
48 return;
49 }
50
51 if (IsSavegameVersionBefore(SLV_RIFF_TO_ARRAY)) {
52 size_t count = SlGetFieldLength() / sizeof(_animated_tiles.front());
53 _animated_tiles.clear();
54 _animated_tiles.resize(_animated_tiles.size() + count);
55 SlCopy(_animated_tiles.data(), count, SLE_UINT32);
56 return;
57 }
58
59 const std::vector<SaveLoad> slt = SlCompatTableHeader(_animated_tile_desc, _animated_tile_sl_compat);
60
61 if (SlIterateArray() == -1) return;
62 SlGlobList(slt);
63 if (SlIterateArray() != -1) SlErrorCorrupt("Too many ANIT entries");
64 }
65};
66
67

Callers

nothing calls this directly

Calls 12

IsSavegameVersionBeforeFunction · 0.85
SlCopyFunction · 0.85
SlGetFieldLengthFunction · 0.85
SlCompatTableHeaderFunction · 0.85
SlIterateArrayFunction · 0.85
SlGlobListFunction · 0.85
SlErrorCorruptFunction · 0.85
push_backMethod · 0.80
resizeMethod · 0.80
clearMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected