MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / Unit_RemoveFromTile

Function Unit_RemoveFromTile

src/unit.c:2533–2545  ·  view source on GitHub ↗

* Removes the Unit from the given packed tile. * * @param unit The Unit to remove. * @param packed The packed tile. */

Source from the content-addressed store, hash-verified

2531 * @param packed The packed tile.
2532 */
2533void Unit_RemoveFromTile(Unit *unit, uint16 packed)
2534{
2535 Tile *t = &g_map[packed];
2536
2537 if (t->hasUnit && Unit_Get_ByPackedTile(packed) == unit && (packed != Tile_PackTile(unit->currentDestination) || unit->o.flags.s.bulletIsBig)) {
2538 t->index = 0;
2539 t->hasUnit = false;
2540 }
2541
2542 Map_MarkTileDirty(packed);
2543
2544 Map_Update(packed, 0, false);
2545}
2546
2547void Unit_AddToTile(Unit *unit, uint16 packed)
2548{

Callers 1

Map_UpdateAroundFunction · 0.85

Calls 3

Unit_Get_ByPackedTileFunction · 0.85
Map_MarkTileDirtyFunction · 0.85
Map_UpdateFunction · 0.85

Tested by

no test coverage detected