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

Method moveTo

src/OpenLoco/src/Entities/Entity.cpp:14–42  ·  view source on GitHub ↗

0x0046FC83

Source from the content-addressed store, hash-verified

12
13 // 0x0046FC83
14 void EntityBase::moveTo(const World::Pos3& loc)
15 {
16 // Pre invalidation.
17 if (position.x != Location::null)
18 {
19 invalidateSprite();
20 }
21
22 EntityManager::moveSpatialEntry(*this, loc);
23
24 // Update position
25 position = loc;
26
27 // Update sprite boundaries
28 if (position.x == Location::null)
29 {
30 spriteLeft = Location::null;
31 return;
32 }
33
34 const auto vpPos = World::gameToScreen(loc, Ui::WindowManager::getCurrentRotation());
35 spriteLeft = vpPos.x - spriteWidth;
36 spriteRight = vpPos.x + spriteWidth;
37 spriteTop = vpPos.y - spriteHeightNegative;
38 spriteBottom = vpPos.y + spriteHeightPositive;
39
40 // Post invalidation.
41 invalidateSprite();
42 }
43
44 // 0x004CBB01
45 void EntityBase::invalidateSprite()

Callers 15

updateSpatialIndexFunction · 0.80
tweenMethod · 0.80
restoreMethod · 0.80
createMethod · 0.80
createMethod · 0.80
createMethod · 0.80
createMethod · 0.80
createMethod · 0.80
createMethod · 0.80
createMethod · 0.80
movePlaneToMethod · 0.80
moveBoatToMethod · 0.80

Calls 3

moveSpatialEntryFunction · 0.85
gameToScreenFunction · 0.85
getCurrentRotationFunction · 0.85

Tested by

no test coverage detected