* Check if the Unit belonged the the current human, and do some extra tasks. * * @param unit The Unit to operate on. */
| 2438 | * @param unit The Unit to operate on. |
| 2439 | */ |
| 2440 | void 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). |
no test coverage detected