Example #1
0
/**
 * @brief Will remove those actors that should not be used in the team
 * @sa GAME_ToggleActorForTeam_f
 */
void GAME_SaveTeamState_f (void)
{
	int i = 0;
	LIST_Foreach(chrDisplayList, character_t, chr) {
		if (!characterActive[i++])
			LIST_Remove(&chrDisplayList, chr);
	}
}
Example #2
0
/**
 * @brief Destroys an installation
 * @param[in,out] installation Pointer to the installation to be destroyed
 */
void INS_DestroyInstallation (installation_t *installation)
{
	if (!installation)
		return;
	/* Disable radar */
	RADAR_UpdateInstallationRadarCoverage(installation, 0, 0);
	/* Destroy stored UFOs */
	if (installation->ufoCapacity.max > 0) {
		installation->ufoCapacity.max = 0;
		US_RemoveUFOsExceedingCapacity(installation);
	}
	CP_MissionNotifyInstallationDestroyed(installation);

	Com_sprintf(cp_messageBuffer, sizeof(cp_messageBuffer), _("Installation %s was destroyed."), installation->name);
	MSO_CheckAddNewMessage(NT_INSTALLATION_DESTROY, _("Installation destroyed"), cp_messageBuffer, qfalse, MSG_CONSTRUCTION, NULL);

	LIST_Remove(&ccs.installations, installation);
	Cvar_Set("mn_installation_count", va("%i", INS_GetCount()));
}
Example #3
0
/**
 * @brief Callback every time the parent window is closed (pop from the active window stack)
 */
void uiCvarNode::onWindowClosed (uiNode_t* node)
{
    cvar_t* var;

    var = Cvar_FindVar(node->name);
    if (var == nullptr)
        return;

    cvarChangeListener_t* l = var->changeListener;
    while (l) {
        if (l->exec == UI_CvarListenerNodeCallback) {
            LIST_Remove(reinterpret_cast<linkedList_t**>(&l->data), node);
            if (LIST_IsEmpty(static_cast<linkedList_t*>(l->data))) {
                Cvar_UnRegisterChangeListener(node->name, UI_CvarListenerNodeCallback);
            }
            break;
        }
        l = l->next;
    }
}
Example #4
0
/**
 * @brief Removes the employee completely from the game (buildings + global list).
 * @param[in] employee The pointer to the employee you want to remove.
 * @return True if the employee was removed successfully, otherwise false.
 * @sa E_CreateEmployee
 * @sa E_ResetEmployees
 * @sa E_UnhireEmployee
 * @note This function has the side effect, that the global employee number for
 * the given employee type is reduced by one, also the ccs.employees pointers are
 * moved to fill the gap of the removed employee. Thus pointers like acTeam in
 * the aircraft can point to wrong employees now. This has to be taken into
 * account
 */
qboolean E_DeleteEmployee (employee_t *employee)
{
	employeeType_t type;

	if (!employee)
		return qfalse;

	type = employee->type;

	/* Fire the employee. This will also:
	 * 1) remove him from buildings&work
	 * 2) remove his inventory */

	if (employee->baseHired) {
		/* make sure that this employee is really unhired */
		employee->transfer = qfalse;
		E_UnhireEmployee(employee);
	}

	/* Remove the employee from the global list. */
	return LIST_Remove(&ccs.employees[type], (void*) employee);
}