Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/client/campaign/cp_employee.c b/src/client/campaign/cp_employee.c
- index cd71f4d..4227ba7 100644
- --- a/src/client/campaign/cp_employee.c
- +++ b/src/client/campaign/cp_employee.c
- @@ -56,7 +56,7 @@ employee_t* E_GetNextFromBase (employeeType_t type, employee_t *lastEmployee, co
- {
- employee_t* employee = lastEmployee;
- - while ((employee = E_GetNext(type, employee))) {
- + while ((employee = E_GetNext(type, employee)) != NULL) {
- if (E_IsInBase(employee, base))
- break;
- }
- @@ -82,7 +82,7 @@ employee_t* E_GetNextHired (employeeType_t type, employee_t *lastEmployee)
- {
- employee_t* employee = lastEmployee;
- - while ((employee = E_GetNext(type, employee))) {
- + while ((employee = E_GetNext(type, employee)) != NULL) {
- if (E_IsHired(employee))
- break;
- }
- @@ -290,12 +290,13 @@ void E_ResetEmployees (void)
- */
- employee_t* E_GetEmployeeByIDX (employeeType_t type, int idx)
- {
- - employee_t *employee = NULL;
- + employee_t *employee;
- if (type >= MAX_EMPL || idx < 0)
- return NULL;
- - while ((employee = E_GetNext(type, employee))) {
- + employee = NULL;
- + while ((employee = E_GetNext(type, employee)) != NULL) {
- if (employee->idx == idx)
- return employee;
- }
- @@ -312,12 +313,13 @@ employee_t* E_GetEmployeeByIDX (employeeType_t type, int idx)
- */
- employee_t* E_GetEmployee (const base_t* const base, employeeType_t type, int idx)
- {
- - employee_t *employee = NULL;
- + employee_t *employee;
- if (!base || type >= MAX_EMPL || idx < 0)
- return NULL;
- - while ((employee = E_GetNext(type, employee))) {
- + employee = NULL;
- + while ((employee = E_GetNext(type, employee)) != NULL) {
- if (employee->idx == idx && (!E_IsHired(employee) || E_IsInBase(employee, base)))
- return employee;
- }
- @@ -337,14 +339,15 @@ employee_t* E_GetEmployee (const base_t* const base, employeeType_t type, int id
- static employee_t* E_GetUnhiredEmployee (employeeType_t type, int idx)
- {
- int j = -1; /* The number of found unhired employees. Ignore the minus. */
- - employee_t *employee = NULL;
- + employee_t *employee;
- if (type >= MAX_EMPL) {
- Com_Printf("E_GetUnhiredEmployee: Unknown EmployeeType: %i\n", type);
- return NULL;
- }
- - while ((employee = E_GetNext(type, employee))) {
- + employee = NULL;
- + while ((employee = E_GetNext(type, employee)) != NULL) {
- if (employee->idx == idx) {
- if (E_IsHired(employee)) {
- Com_Printf("E_GetUnhiredEmployee: Warning: employee is already hired!\n");
- @@ -371,7 +374,7 @@ employee_t* E_GetUnhiredRobot (const ugv_t *ugvType)
- {
- employee_t *employee = NULL;
- - while ((employee = E_GetNext(EMPL_ROBOT, employee))) {
- + while ((employee = E_GetNext(EMPL_ROBOT, employee)) != NULL) {
- if (!E_IsHired(employee)) {
- /* If no type was given we return the first ugv we find. */
- if (!ugvType || employee->ugv == ugvType)
- @@ -402,7 +405,7 @@ int E_GetHiredEmployees (const base_t* const base, employeeType_t type, linkedLi
- LIST_Delete(hiredEmployees);
- employee = NULL;
- - while ((employee = E_GetNextHired(type, employee))) {
- + while ((employee = E_GetNextHired(type, employee)) != NULL) {
- if (!employee->transfer && (!base || E_IsInBase(employee, base))) {
- LIST_AddPointer(hiredEmployees, employee);
- }
- @@ -475,7 +478,8 @@ static inline qboolean E_EmployeeIsUnassigned (const employee_t * employee)
- employee_t* E_GetAssignedEmployee (const base_t* const base, const employeeType_t type)
- {
- employee_t *employee = NULL;
- - while ((employee = E_GetNextFromBase(type, employee, base))) {
- +
- + while ((employee = E_GetNextFromBase(type, employee, base)) != NULL) {
- if (!E_EmployeeIsUnassigned(employee))
- return employee;
- }
- @@ -493,7 +497,8 @@ employee_t* E_GetAssignedEmployee (const base_t* const base, const employeeType_
- employee_t* E_GetUnassignedEmployee (const base_t* const base, const employeeType_t type)
- {
- employee_t *employee = NULL;
- - while ((employee = E_GetNextFromBase(type, employee, base))) {
- +
- + while ((employee = E_GetNextFromBase(type, employee, base)) != NULL) {
- if (E_EmployeeIsUnassigned(employee))
- return employee;
- }
- @@ -642,7 +647,7 @@ void E_UnhireAllEmployees (base_t* base, employeeType_t type)
- assert(type < MAX_EMPL);
- employee = NULL;
- - while ((employee = E_GetNextFromBase(type, employee, base))) {
- + while ((employee = E_GetNextFromBase(type, employee, base)) != NULL) {
- E_UnhireEmployee(employee);
- }
- }
- @@ -771,18 +776,14 @@ void E_DeleteAllEmployees (base_t* base)
- employeeType_t type;
- for (type = EMPL_SOLDIER; type < MAX_EMPL; type++) {
- + employee_t *lastEmployee = NULL;
- employee_t *employee = NULL;
- - for (;;) {
- - employee = E_GetNext(type, employee);
- - if (employee == NULL)
- - break;
- - if (base == NULL || E_IsInBase(employee, base)) {
- - /** @todo restart the iterator until we've found a better solution
- - * this is needed because the employee pointer is no longer valid and can't
- - * be used as a base to get the next one */
- - if (E_DeleteEmployee(employee))
- - employee = NULL;
- - }
- +
- + while ((employee = E_GetNext(type, employee)) != NULL) {
- + if ((base == NULL || E_IsInBase(employee, base)) && E_DeleteEmployee(employee))
- + employee = lastEmployee;
- + else
- + lastEmployee = employee;
- }
- }
- }
- @@ -806,22 +807,21 @@ void E_DeleteEmployeesExceedingCapacity (base_t *base)
- /* do a reverse loop in order to finish by soldiers (the most important employees) */
- for (type = MAX_EMPL - 1; type >= 0; type--) {
- - employee_t *employee = NULL;
- + employee_t *employee;
- + employee_t *lastEmployee;
- /* UGV are not stored in Quarters */
- if (type == EMPL_ROBOT)
- continue;
- - while ((employee = E_GetNext(type, employee))) {
- - /* check if the employee is hired on this base */
- - if (!E_IsInBase(employee, base))
- - continue;
- + employee = NULL;
- + lastEmployee = NULL;
- + while ((employee = E_GetNext(type, employee)) != NULL) {
- + if (E_IsInBase(employee, base) && E_DeleteEmployee(employee))
- + employee = lastEmployee;
- + else
- + lastEmployee = employee;
- - /** @todo restart the iterator until we've found a better solution
- - * this is needed because the employee pointer is no longer valid and can't
- - * be used as a base to get the next one */
- - if (E_DeleteEmployee(employee))
- - employee = NULL;
- if (base->capacities[CAP_EMPLOYEES].cur <= base->capacities[CAP_EMPLOYEES].max)
- return;
- }
- @@ -843,7 +843,8 @@ void E_RefreshUnhiredEmployeeGlobalList (const employeeType_t type, const qboole
- const nation_t *happyNations[MAX_NATIONS];
- int numHappyNations = 0;
- int idx, nationIdx;
- - employee_t *employee = NULL;
- + employee_t *lastEmployee;
- + employee_t *employee;
- happyNations[0] = NULL;
- /* get a list of nations, if excludeHappyNations is qtrue then also exclude
- @@ -863,15 +864,18 @@ void E_RefreshUnhiredEmployeeGlobalList (const employeeType_t type, const qboole
- nationIdx = 0;
- /* Fill the global data employee list with employees, evenly distributed
- * between nations in the happyNations list */
- - while ((employee = E_GetNext(type, employee))) {
- + employee = NULL;
- + lastEmployee = NULL;
- + while ((employee = E_GetNext(type, employee)) != NULL) {
- /* we don't want to overwrite employees that have already been hired */
- if (!E_IsHired(employee)) {
- - /** @todo this is not working, employee can't be used as a
- - * base to get the next employee - but we can't set it to NULL
- - * because this while would loop endless */
- E_DeleteEmployee(employee);
- E_CreateEmployee(type, happyNations[nationIdx], NULL);
- nationIdx = (nationIdx + 1) % numHappyNations;
- + /* continue iteration from the last employee, this one is deleted */
- + employee = lastEmployee;
- + } else {
- + lastEmployee = employee;
- }
- }
- }
- @@ -944,7 +948,7 @@ int E_CountHired (const base_t* const base, employeeType_t type)
- int count = 0;
- employee_t *employee = NULL;
- - while ((employee = E_GetNextHired(type, employee))) {
- + while ((employee = E_GetNextHired(type, employee)) != NULL) {
- if (!base || E_IsInBase(employee, base))
- count++;
- }
- @@ -962,7 +966,7 @@ int E_CountHiredRobotByType (const base_t* const base, const ugv_t *ugvType)
- int count = 0;
- employee_t *employee = NULL;
- - while ((employee = E_GetNextHired(EMPL_ROBOT, employee))) {
- + while ((employee = E_GetNextHired(EMPL_ROBOT, employee)) != NULL) {
- if (employee->ugv == ugvType && (!base || E_IsInBase(employee, base)))
- count++;
- }
- @@ -1001,7 +1005,8 @@ int E_CountUnhired (employeeType_t type)
- {
- int count = 0;
- employee_t *employee = NULL;
- - while ((employee = E_GetNext(type, employee))) {
- +
- + while ((employee = E_GetNext(type, employee)) != NULL) {
- if (!E_IsHired(employee))
- count++;
- }
- @@ -1018,7 +1023,7 @@ int E_CountUnhiredRobotsByType (const ugv_t *ugvType)
- int count = 0;
- employee_t *employee = NULL;
- - while ((employee = E_GetNext(EMPL_ROBOT, employee))) {
- + while ((employee = E_GetNext(EMPL_ROBOT, employee)) != NULL) {
- if (!E_IsHired(employee) && employee->ugv == ugvType)
- count++;
- }
- @@ -1040,7 +1045,7 @@ int E_CountUnassigned (const base_t* const base, employeeType_t type)
- count = 0;
- employee = NULL;
- - while ((employee = E_GetNextFromBase(type, employee, base))) {
- + while ((employee = E_GetNextFromBase(type, employee, base)) != NULL) {
- if (E_EmployeeIsUnassigned(employee))
- count++;
- }
- @@ -1094,7 +1099,7 @@ static void E_ListHired_f (void)
- for (emplType = 0; emplType < MAX_EMPL; emplType++) {
- employee_t *employee = NULL;
- - while ((employee = E_GetNextHired(emplType, employee))) {
- + while ((employee = E_GetNextHired(emplType, employee)) != NULL) {
- Com_Printf("Employee: %s (idx: %i) %s at %s\n", E_GetEmployeeString(employee->type), employee->idx,
- employee->chr.name, employee->baseHired->name);
- if (employee->type != emplType)
- @@ -1127,7 +1132,7 @@ employee_t* E_GetEmployeeFromChrUCN (int uniqueCharacterNumber)
- /* MAX_EMPLOYEES and not numWholeTeam - maybe some other soldier died */
- for (j = 0; j < MAX_EMPL; j++) {
- employee_t *employee = NULL;
- - while ((employee = E_GetNext(j, employee))) {
- + while ((employee = E_GetNext(j, employee)) != NULL) {
- if (employee->chr.ucn == uniqueCharacterNumber)
- return employee;
- }
- @@ -1148,33 +1153,33 @@ employee_t* E_GetEmployeeFromChrUCN (int uniqueCharacterNumber)
- */
- qboolean E_SaveXML (mxml_node_t *p)
- {
- - employeeType_t j;
- + employeeType_t emplType;
- Com_RegisterConstList(saveEmployeeConstants);
- - for (j = 0; j < MAX_EMPL; j++) {
- + for (emplType = 0; emplType < MAX_EMPL; emplType++) {
- mxml_node_t *snode = mxml_AddNode(p, SAVE_EMPLOYEE_EMPLOYEES);
- - employee_t *e = NULL;
- + employee_t *employee = NULL;
- - mxml_AddString(snode, SAVE_EMPLOYEE_TYPE, Com_GetConstVariable(SAVE_EMPLOYEETYPE_NAMESPACE, j));
- - while ((e = E_GetNext(j, e))) {
- + mxml_AddString(snode, SAVE_EMPLOYEE_TYPE, Com_GetConstVariable(SAVE_EMPLOYEETYPE_NAMESPACE, emplType));
- + while ((employee = E_GetNext(emplType, employee)) != NULL) {
- mxml_node_t * chrNode;
- mxml_node_t *ssnode = mxml_AddNode(snode, SAVE_EMPLOYEE_EMPLOYEE);
- /** @note e->transfer is not saved here because it'll be restored via TR_Load. */
- - mxml_AddInt(ssnode, SAVE_EMPLOYEE_IDX, e->idx);
- - if (e->baseHired)
- - mxml_AddInt(ssnode, SAVE_EMPLOYEE_BASEHIRED, e->baseHired->idx);
- - if (e->assigned)
- - mxml_AddBool(ssnode, SAVE_EMPLOYEE_ASSIGNED, e->assigned);
- + mxml_AddInt(ssnode, SAVE_EMPLOYEE_IDX, employee->idx);
- + if (employee->baseHired)
- + mxml_AddInt(ssnode, SAVE_EMPLOYEE_BASEHIRED, employee->baseHired->idx);
- + if (employee->assigned)
- + mxml_AddBool(ssnode, SAVE_EMPLOYEE_ASSIGNED, employee->assigned);
- /* Store the nations identifier string. */
- - assert(e->nation);
- - mxml_AddString(ssnode, SAVE_EMPLOYEE_NATION, e->nation->id);
- + assert(employee->nation);
- + mxml_AddString(ssnode, SAVE_EMPLOYEE_NATION, employee->nation->id);
- /* Store the ugv-type identifier string. (Only exists for EMPL_ROBOT). */
- - if (e->ugv)
- - mxml_AddString(ssnode, SAVE_EMPLOYEE_UGV, e->ugv->id);
- + if (employee->ugv)
- + mxml_AddString(ssnode, SAVE_EMPLOYEE_UGV, employee->ugv->id);
- /* Character Data */
- chrNode = mxml_AddNode(ssnode, SAVE_EMPLOYEE_CHR);
- - CL_SaveCharacterXML(chrNode, &e->chr);
- + CL_SaveCharacterXML(chrNode, &employee->chr);
- }
- }
- Com_UnregisterConstList(saveEmployeeConstants);
- diff --git a/src/client/campaign/cp_missions.c b/src/client/campaign/cp_missions.c
- index de4c000..7abe5fd 100644
- --- a/src/client/campaign/cp_missions.c
- +++ b/src/client/campaign/cp_missions.c
- @@ -1215,7 +1215,8 @@ void CP_MissionEnd (const campaign_t *campaign, mission_t* mission, const battle
- base_t *base;
- aircraft_t *aircraft;
- int numberOfSoldiers = 0; /* DEBUG */
- - employee_t *employee = NULL;
- + employee_t *employee;
- + employee_t *lastEmployee;
- if (mission->stage == STAGE_BASE_ATTACK) {
- base = mission->data.base;
- @@ -1241,21 +1242,17 @@ void CP_MissionEnd (const campaign_t *campaign, mission_t* mission, const battle
- /* update stats */
- CL_UpdateCharacterStats(base, aircraft);
- + employee = NULL;
- + lastEmployee = NULL;
- while ((employee = E_GetNext(EMPL_SOLDIER, employee))) {
- if (AIR_IsEmployeeInAircraft(employee, aircraft))
- numberOfSoldiers++;
- - if (E_IsInBase(employee, base)) {
- - const character_t *chr = &(employee->chr);
- - /* if employee is marked as dead */
- - if (chr->HP <= 0) { /** @todo <= -50, etc. (implants) */
- - /** @todo restart the iterator until we've found a better solution
- - * this is needed because the employee pointer is no longer valid and can't
- - * be used as a base to get the next one */
- - if (E_DeleteEmployee(employee))
- - employee = NULL;
- - }
- - }
- + /** @todo replace HP check with some CHRSH->IsDead() function */
- + if (E_IsInBase(employee, base) && (employee->chr.HP <= 0) && E_DeleteEmployee(employee))
- + employee = lastEmployee;
- + else
- + lastEmployee = employee;
- }
- Com_DPrintf(DEBUG_CLIENT, "CP_MissionEnd - num %i\n", numberOfSoldiers);
- diff --git a/src/client/campaign/cp_transfer.c b/src/client/campaign/cp_transfer.c
- index 674cefc..0177bff 100644
- --- a/src/client/campaign/cp_transfer.c
- +++ b/src/client/campaign/cp_transfer.c
- @@ -58,6 +58,37 @@ transfer_t* TR_GetNext (transfer_t *lastTransfer)
- }
- /**
- + * @brief Returns the next transfered employee of a transfer session
- + * @param[in] transfer Pointer to the transfersession to check
- + * @param[in] type The employee type to query
- + * @param[in] lastEmployee Pointer to the last employee to iterate from. call with NULL for the first
- + * @returns NULL, if transfer parameter is NULL or there is no more employee in the transfer, or the pointer of the next employee otherwise
- + */
- +employee_t* TR_GetNextEmployee (transfer_t *transfer, employeeType_t type, employee_t *lastEmployee)
- +{
- + if (!transfer)
- + return NULL;
- + if (type == MAX_EMPL)
- + return NULL;
- +
- + return (employee_t*) LIST_GetNext(transfer->employees[type], (void*) lastEmployee);
- +}
- +
- +/**
- + * @brief Returns the next transfered aircraft of a transfer session
- + * @param[in] transfer Pointer to the transfersession to check
- + * @param[in] lastAircraft Pointer to the last aircraft to iterate from. call with NULL for the first
- + * @returns NULL, if transfer parameter is NULL or there is no more aircraft in the transfer, or the pointer of the next aircraft otherwise
- + */
- +aircraft_t* TR_GetNextAircraft (transfer_t *transfer, aircraft_t *lastAircraft)
- +{
- + if (!transfer)
- + return NULL;
- +
- + return (aircraft_t*) LIST_GetNext(transfer->aircraft, (void*) lastAircraft);
- +}
- +
- +/**
- * @brief Unloads transfer cargo when finishing the transfer or destroys it when no buildings/base.
- * @param[in,out] destination The destination base - might be NULL in case the base
- * is already destroyed
- @@ -101,24 +132,24 @@ static void TR_EmptyTransferCargo (base_t *destination, transfer_t *transfer, qb
- if (transfer->hasEmployees && transfer->srcBase) { /* Employees. (cannot come from a mission) */
- if (!success || !B_GetBuildingStatus(destination, B_QUARTERS)) { /* Employees will be unhired. */
- - int i;
- + employeeType_t i;
- if (success) {
- Com_sprintf(cp_messageBuffer, sizeof(cp_messageBuffer), _("%s does not have Living Quarters, employees got unhired!"), destination->name);
- MSO_CheckAddNewMessage(NT_TRANSFER_LOST, _("Transport mission"), cp_messageBuffer, qfalse, MSG_TRANSFERFINISHED, NULL);
- }
- - for (i = 0; i < MAX_EMPL; i++) {
- + for (i = EMPL_SOLDIER; i < MAX_EMPL; i++) {
- employee_t *employee = NULL;
- - while ((employee = (employee_t*) LIST_GetNext(transfer->employees[i], (void*) employee))) {
- + while ((employee = TR_GetNextEmployee(transfer, i, employee)) != NULL) {
- employee->baseHired = transfer->srcBase; /* Restore back the original baseid. */
- employee->transfer = qfalse;
- E_UnhireEmployee(employee);
- }
- }
- } else {
- - int i;
- - for (i = 0; i < MAX_EMPL; i++) {
- + employeeType_t i;
- + for (i = EMPL_SOLDIER; i < MAX_EMPL; i++) {
- employee_t *employee = NULL;
- - while ((employee = (employee_t*) LIST_GetNext(transfer->employees[i], (void*) employee))) {
- + while ((employee = TR_GetNextEmployee(transfer, i, employee)) != NULL) {
- employee->baseHired = transfer->srcBase; /* Restore back the original baseid. */
- employee->transfer = qfalse;
- E_UnhireEmployee(employee);
- @@ -152,7 +183,7 @@ static void TR_EmptyTransferCargo (base_t *destination, transfer_t *transfer, qb
- if (transfer->hasAircraft && success && transfer->srcBase) { /* Aircraft. Cannot come from mission */
- aircraft_t *aircraft = NULL;
- - while ((aircraft = (aircraft_t*)LIST_GetNext(transfer->aircraft, (void*)aircraft))) {
- + while ((aircraft = TR_GetNextAircraft(transfer, aircraft)) != NULL) {
- if (AIR_CalculateHangarStorage(aircraft->tpl, destination, 0) > 0) {
- /* Move aircraft */
- AIR_MoveAircraftIntoNewHomebase(aircraft, destination);
- @@ -362,7 +393,7 @@ transfer_t* TR_TransferStart (base_t *srcBase, transferData_t *transData)
- employee_t *employee = NULL;
- LIST_Delete(&transfer->employees[i]);
- - while ((employee = (employee_t*) LIST_GetNext(transData->trEmployeesTmp[i], (void*) employee))) {
- + while ((employee = (employee_t*) LIST_GetNext(transData->trEmployeesTmp[i], (void*) employee)) != NULL) {
- assert(E_IsInBase(employee, srcBase));
- transfer->hasEmployees = qtrue;
- @@ -383,7 +414,7 @@ transfer_t* TR_TransferStart (base_t *srcBase, transferData_t *transData)
- }
- }
- LIST_Delete(&transfer->aircraft);
- - while ((aircraft = (aircraft_t*)LIST_GetNext(transData->aircraft, (void *)aircraft))) {
- + while ((aircraft = (aircraft_t*)LIST_GetNext(transData->aircraft, (void *)aircraft)) != NULL) {
- aircraft->status = AIR_TRANSFER;
- AIR_RemoveEmployees(aircraft);
- transfer->hasAircraft = qtrue;
- @@ -408,7 +439,7 @@ void TR_NotifyAircraftRemoved (const aircraft_t *aircraft)
- if (!aircraft)
- return;
- - while ((transfer = TR_GetNext(transfer))) {
- + while ((transfer = TR_GetNext(transfer)) != NULL) {
- if (!transfer->active)
- continue;
- if (!transfer->hasAircraft)
- @@ -425,7 +456,7 @@ void TR_NotifyAircraftRemoved (const aircraft_t *aircraft)
- void TR_TransferRun (void)
- {
- transfer_t *transfer = NULL;
- - while ((transfer = TR_GetNext(transfer))) {
- + while ((transfer = TR_GetNext(transfer)) != NULL) {
- if (!transfer->active)
- continue;
- if (transfer->event.day == ccs.date.day && ccs.date.sec >= transfer->event.sec) {
- @@ -460,7 +491,7 @@ static void TR_ListTransfers_f (void)
- if (!ccs.numTransfers)
- Com_Printf("No active transfers.\n");
- - for (; (transfer = TR_GetNext(transfer)); i++) {
- + for (; (transfer = TR_GetNext(transfer)) != NULL; i++) {
- dateLong_t date;
- if (transIdx >= 0 && i != transIdx)
- @@ -491,12 +522,13 @@ static void TR_ListTransfers_f (void)
- }
- /* Carried Employees */
- if (transfer->hasEmployees) {
- - int j;
- + employeeType_t emplType;
- +
- Com_Printf("...Carried Employee:\n");
- - for (j = 0; j < MAX_EMPL; j++) {
- + for (emplType = EMPL_SOLDIER; emplType < MAX_EMPL; emplType++) {
- employee_t *employee = NULL;
- - while ((employee = (employee_t*) LIST_GetNext(transfer->employees[i], (void*) employee))) {
- + while ((employee = TR_GetNextEmployee(transfer, emplType, employee)) != NULL) {
- if (employee->ugv) {
- /** @todo: improve ugv listing when they're implemented */
- Com_Printf("......ugv: %s [idx: %i]\n", employee->ugv->id, employee->idx);
- @@ -527,7 +559,7 @@ static void TR_ListTransfers_f (void)
- aircraft_t *aircraft = NULL;
- Com_Printf("...Transfered Aircraft:\n");
- - while ((aircraft = (aircraft_t*)LIST_GetNext(transfer->aircraft, (void*)aircraft))) {
- + while ((aircraft = TR_GetNextAircraft(transfer, aircraft)) != NULL) {
- Com_Printf("......%s [idx: %i]\n", (aircraft) ? aircraft->id : "(null)", aircraft->idx);
- }
- }
- @@ -546,7 +578,7 @@ qboolean TR_SaveXML (mxml_node_t *p)
- transfer_t *transfer = NULL;
- mxml_node_t *n = mxml_AddNode(p, SAVE_TRANSFER_TRANSFERS);
- - while ((transfer = TR_GetNext(transfer))) {
- + while ((transfer = TR_GetNext(transfer)) != NULL) {
- int j;
- mxml_node_t *s;
- @@ -596,7 +628,7 @@ qboolean TR_SaveXML (mxml_node_t *p)
- for (j = 0; j < MAX_EMPL; j++) {
- employee_t *employee = NULL;
- - while ((employee = (employee_t*) LIST_GetNext(transfer->employees[j], (void*) employee))) {
- + while ((employee = TR_GetNextEmployee(transfer, j, employee)) != NULL) {
- mxml_node_t *ss = mxml_AddNode(s, SAVE_TRANSFER_EMPLOYEE);
- mxml_AddInt(ss, SAVE_TRANSFER_UCN, employee->chr.ucn);
- }
- @@ -606,7 +638,7 @@ qboolean TR_SaveXML (mxml_node_t *p)
- if (transfer->hasAircraft) {
- aircraft_t *aircraft = NULL;
- - while ((aircraft = (aircraft_t*)LIST_GetNext(transfer->aircraft, (void*)aircraft))) {
- + while ((aircraft = TR_GetNextAircraft(transfer, aircraft)) != NULL) {
- mxml_node_t *ss = mxml_AddNode(s, SAVE_TRANSFER_AIRCRAFT);
- mxml_AddInt(ss, SAVE_TRANSFER_ID, aircraft->idx);
- }
- diff --git a/src/client/campaign/cp_transfer.h b/src/client/campaign/cp_transfer.h
- index a186df8..fe8b69f 100644
- --- a/src/client/campaign/cp_transfer.h
- +++ b/src/client/campaign/cp_transfer.h
- @@ -132,5 +132,7 @@ transfer_t* TR_TransferStart(base_t *srcBase, transferData_t *transData);
- void TR_TransferAlienAfterMissionStart(const base_t *base, aircraft_t *transferAircraft);
- transfer_t* TR_GetNext(transfer_t *lastTransfer);
- +employee_t* TR_GetNextEmployee(transfer_t *transfer, employeeType_t type, employee_t *lastEmployee);
- +aircraft_t* TR_GetNextAircraft(transfer_t *transfer, aircraft_t *lastAircraft);
- #endif /* CLIENT_CL_TRANSFER_H */
- diff --git a/src/client/campaign/save/save_employee.h b/src/client/campaign/save/save_employee.h
- index 738fd9c..935a775 100644
- --- a/src/client/campaign/save/save_employee.h
- +++ b/src/client/campaign/save/save_employee.h
- @@ -70,5 +70,5 @@ DTD:
- >
- ** for <character> check save_character.h
- -
- */
- +
- diff --git a/src/client/campaign/save/save_statistics.h b/src/client/campaign/save/save_statistics.h
- index d6b7bec..90e8724 100644
- --- a/src/client/campaign/save/save_statistics.h
- +++ b/src/client/campaign/save/save_statistics.h
- @@ -79,9 +79,9 @@ DTD:
- <!ELEMENT employeeHad EMPTY>
- <!ATTLIST employeeHad
- - employeeType (soldier, scientist,
- - worker, robot, pilot) #REQUIRED
- + employeeType (soldier|scientist|
- + worker|robot|pilot) #REQUIRED
- employeeCount CDATA '0'
- >
- -
- */
- +
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement