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

Function Unit_Remove

src/unit.c:897–914  ·  view source on GitHub ↗

* Remove the Unit from the game, doing all required administration for it, like * deselecting it, remove it from the radar count, stopping scripts, .. * * @param u The Unit to remove. */

Source from the content-addressed store, hash-verified

895 * @param u The Unit to remove.
896 */
897void Unit_Remove(Unit *u)
898{
899 if (u == NULL) return;
900
901 u->o.flags.s.allocated = true;
902 Unit_UntargetMe(u);
903
904 if (u == g_unitSelected) Unit_Select(NULL);
905
906 u->o.flags.s.bulletIsBig = true;
907 Unit_UpdateMap(0, u);
908
909 Unit_HouseUnitCount_Remove(u);
910
911 Script_Reset(&u->o.script, g_scriptUnit);
912
913 Unit_Free(u);
914}
915
916/**
917 * Gets the best target unit for the given unit.

Callers 9

Structure_PlaceFunction · 0.85
Structure_DestroyFunction · 0.85
Map_Bloom_ExplodeSpiceFunction · 0.85
Unit_MoveFunction · 0.85
Unit_CreateWrapperFunction · 0.85
Unit_EnterStructureFunction · 0.85
Script_Unit_DieFunction · 0.85
Script_Unit_FireFunction · 0.85
Script_Unit_MCVDeployFunction · 0.85

Calls 6

Unit_UntargetMeFunction · 0.85
Unit_SelectFunction · 0.85
Unit_UpdateMapFunction · 0.85
Script_ResetFunction · 0.85
Unit_FreeFunction · 0.85

Tested by

no test coverage detected