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

Function allocateOrders

src/OpenLoco/src/Vehicles/OrderManager.cpp:251–267  ·  view source on GitHub ↗

0x00470312

Source from the content-addressed store, hash-verified

249
250 // 0x00470312
251 void allocateOrders(VehicleHead& head)
252 {
253 OrderEnd end{};
254 constexpr auto insOrderLength = kOrderSizes[enumValue(OrderEnd::kType)];
255
256 head.orderTableOffset = orderTableLength();
257 // Bookkeeping: change order table size
258 orderTableLength() += insOrderLength;
259
260 head.currentOrder = 0;
261 head.sizeOfOrderTable = insOrderLength;
262
263 // Calculate destination offset and copy data
264 auto rawOrder = end.getRaw();
265 auto dest = reinterpret_cast<uint8_t*>(orders() + head.orderTableOffset);
266 std::memcpy(dest, &rawOrder, insOrderLength);
267 }
268
269 // 0x00470B76
270 std::pair<World::Pos3, std::string> generateOrderUiStringAndLoc(uint32_t orderOffset, uint8_t orderNum)

Callers 1

createHeadFunction · 0.85

Calls 3

enumValueFunction · 0.85
ordersFunction · 0.85
getRawMethod · 0.45

Tested by

no test coverage detected