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

Function Unit_RemovePlayer

src/unit.c:2440–2459  ·  view source on GitHub ↗

* Check if the Unit belonged the the current human, and do some extra tasks. * * @param unit The Unit to operate on. */

Source from the content-addressed store, hash-verified

2438 * @param unit The Unit to operate on.
2439 */
2440void Unit_RemovePlayer(Unit *unit)
2441{
2442 if (unit == NULL) return;
2443 if (Unit_GetHouseID(unit) != g_playerHouseID) return;
2444 if (!unit->o.flags.s.allocated) return;
2445
2446 unit->o.flags.s.allocated = false;
2447 Unit_RemoveFromTeam(unit);
2448
2449 if (unit != g_unitSelected) return;
2450
2451 if (g_selectionType == SELECTIONTYPE_TARGET) {
2452 g_unitActive = NULL;
2453 g_activeAction = 0xFFFF;
2454
2455 GUI_ChangeSelectionType(SELECTIONTYPE_STRUCTURE);
2456 }
2457
2458 Unit_Select(NULL);
2459}
2460
2461/**
2462 * Update the map around the Unit depending on the type (entering tile, leaving, staying).

Callers 2

Unit_DamageFunction · 0.85
Script_Unit_FireFunction · 0.85

Calls 4

Unit_GetHouseIDFunction · 0.85
Unit_RemoveFromTeamFunction · 0.85
GUI_ChangeSelectionTypeFunction · 0.85
Unit_SelectFunction · 0.85

Tested by

no test coverage detected