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

Function graphGetValueFromPointer

src/OpenLoco/src/Ui/Chart.cpp:9–25  ·  view source on GitHub ↗

TODO: replace with templated functions

Source from the content-addressed store, hash-verified

7{
8 // TODO: replace with templated functions
9 static int64_t graphGetValueFromPointer(const std::byte* dataPtr, const uint8_t dataTypeSize)
10 {
11 switch (dataTypeSize)
12 {
13 case 2:
14 return *reinterpret_cast<const int16_t*>(dataPtr);
15
16 case 4:
17 return *reinterpret_cast<const int32_t*>(dataPtr);
18
19 case 6:
20 return reinterpret_cast<const currency48_t*>(dataPtr)->asInt64();
21
22 default:
23 return 0;
24 }
25 }
26
27 // 0x004CF869
28 static int64_t graphGetMaxValue(const GraphSettings& gs)

Callers 2

graphGetMaxValueFunction · 0.85
drawGraphLineSegmentsFunction · 0.85

Calls 1

asInt64Method · 0.80

Tested by

no test coverage detected