MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / readTutorialFile

Function readTutorialFile

src/OpenLoco/src/Tutorial.cpp:32–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30 }
31
32 static std::vector<uint16_t> readTutorialFile(fs::path filename)
33 {
34 std::ifstream file(filename, std::ios::in | std::ios::binary);
35 file.unsetf(std::ios::skipws);
36 if (!file)
37 {
38 throw;
39 }
40
41 std::vector<uint16_t> tutorial;
42 auto start = std::istream_iterator<uint8_t>(file);
43 auto const end = std::istream_iterator<uint8_t>();
44
45 for (auto it = start; it != end; ++it)
46 {
47 auto const firstByte = *it;
48 ++it;
49
50 // We expect an even number of bytes
51 if (it == end)
52 {
53 throw;
54 }
55
56 auto const secondByte = *it;
57 tutorial.push_back(secondByte << 8 | firstByte);
58 }
59
60 return tutorial;
61 }
62
63 // 0x0043C590
64 void start(int16_t tutorialNumber)

Callers 1

startFunction · 0.85

Calls 1

push_backMethod · 0.80

Tested by

no test coverage detected