MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / addToDrawnTiles

Method addToDrawnTiles

game/state/tilemap/tileobject_projectile.cpp:67–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void TileObjectProjectile::addToDrawnTiles(Tile *)
68{
69 auto p = this->projectile.lock();
70 if (!p)
71 {
72 LogError("Called with no owning projectile object");
73 return;
74 }
75 Vec3<float> maxCoords = {-1, -1, -1};
76 for (auto &pos : p->spritePositions)
77 {
78
79 // Projectiles are drawn in the tile that contains their point that is closest to camera
80 if (maxCoords.z * 1000 + maxCoords.x + maxCoords.y < pos.z * 1000 + pos.x + pos.y)
81 {
82 maxCoords = {pos.x, pos.y, pos.z};
83 }
84 }
85 TileObject::addToDrawnTiles(map.getTile(maxCoords));
86}
87
88sp<Projectile> TileObjectProjectile::getProjectile() const { return projectile.lock(); }
89

Callers

nothing calls this directly

Calls 1

getTileMethod · 0.80

Tested by

no test coverage detected