BOOLEAN RecruitEPC( UINT8 ubCharNum ) { SOLDIERTYPE *pSoldier, *pNewSoldier; // Get soldier pointer pSoldier = FindSoldierByProfileID( ubCharNum, FALSE ); if (!pSoldier) { return( FALSE ); } // OK, set recruit flag.. gMercProfiles[ ubCharNum ].ubMiscFlags |= PROFILE_MISC_FLAG_EPCACTIVE; gMercProfiles[ ubCharNum ].ubMiscFlags3 &= ~PROFILE_MISC_FLAG3_PERMANENT_INSERTION_CODE; // Add this guy to our team! pNewSoldier = ChangeSoldierTeam( pSoldier, gbPlayerNum ); pNewSoldier->ubWhatKindOfMercAmI = MERC_TYPE__EPC; // Try putting them into the current squad if ( AddCharacterToSquad( pNewSoldier, (INT8)CurrentSquad( ) ) == FALSE ) { AddCharacterToAnySquad( pNewSoldier ); } ResetDeadSquadMemberList( pNewSoldier->bAssignment ); DirtyMercPanelInterface( pNewSoldier, DIRTYLEVEL2 ); // Make the interface panel dirty.. // This will dirty the panel next frame... gfRerenderInterfaceFromHelpText = TRUE; // If we are a robot, look to update controller.... if ( pNewSoldier->uiStatusFlags & SOLDIER_ROBOT ) { UpdateRobotControllerGivenRobot( pNewSoldier ); } // Set whatkind of merc am i pNewSoldier->ubWhatKindOfMercAmI = MERC_TYPE__EPC; UpdateTeamPanelAssignments( ); return( TRUE ); }
BOOLEAN UnRecruitEPC( UINT8 ubCharNum ) { SOLDIERTYPE *pSoldier, *pNewSoldier; // Get soldier pointer pSoldier = FindSoldierByProfileID( ubCharNum, FALSE ); if (!pSoldier) { return( FALSE ); } if (pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__EPC) { return( FALSE ); } if ( pSoldier->bAssignment < ON_DUTY ) { ResetDeadSquadMemberList( pSoldier->bAssignment ); } // Rmeove from squad.... RemoveCharacterFromSquads( pSoldier ); // O< check if this is the only guy in the sector.... if ( gusSelectedSoldier == pSoldier->ubID ) { gusSelectedSoldier = NOBODY; } // OK, UN set recruit flag.. gMercProfiles[ ubCharNum ].ubMiscFlags &= (~PROFILE_MISC_FLAG_EPCACTIVE); // update sector values to current // check to see if this person should disappear from the map after this if ( (ubCharNum == JOHN || ubCharNum == MARY) && pSoldier->sSectorX == 13 && pSoldier->sSectorY == MAP_ROW_B && pSoldier->bSectorZ == 0 ) { gMercProfiles[ ubCharNum ].sSectorX = 0; gMercProfiles[ ubCharNum ].sSectorY = 0; gMercProfiles[ ubCharNum ].bSectorZ = 0; } else { gMercProfiles[ ubCharNum ].sSectorX = pSoldier->sSectorX; gMercProfiles[ ubCharNum ].sSectorY = pSoldier->sSectorY; gMercProfiles[ ubCharNum ].bSectorZ = pSoldier->bSectorZ; } // how do we decide whether or not to set this? gMercProfiles[ ubCharNum ].fUseProfileInsertionInfo = TRUE; gMercProfiles[ ubCharNum ].ubMiscFlags3 |= PROFILE_MISC_FLAG3_PERMANENT_INSERTION_CODE; // Add this guy to CIV team! pNewSoldier = ChangeSoldierTeam( pSoldier, CIV_TEAM ); UpdateTeamPanelAssignments( ); return( TRUE ); }
BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier ) { UINT8 ubHistoryCode=0; if ( gfInContractMenuFromRenewSequence ) { EndCurrentContractRenewal( ); } // ATE: Determine which HISTORY ENTRY to use... if ( pSoldier->ubLeaveHistoryCode == 0 ) { // Default use contract expired reason... pSoldier->ubLeaveHistoryCode = HISTORY_MERC_CONTRACT_EXPIRED; } ubHistoryCode = pSoldier->ubLeaveHistoryCode; //if the soldier is DEAD if( pSoldier->stats.bLife <= 0 ) { AddCharacterToDeadList( pSoldier ); } //else if the merc was fired else if( ubHistoryCode == HISTORY_MERC_FIRED || pSoldier->bAssignment == ASSIGNMENT_POW ) { AddCharacterToFiredList( pSoldier ); } //The merc is leaving for some other reason else { AddCharacterToOtherList( pSoldier ); } if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__NPC ) { SetupProfileInsertionDataForSoldier( pSoldier ); } if (IsVehicle(pSoldier)) { // for some reason, vehicles have their own idea of handling group ids RemovePlayerFromGroup(pVehicleList[ pSoldier->bVehicleID ].ubMovementGroup, pSoldier); } //remove him from the soldier structure if( pSoldier->bAssignment >= ON_DUTY ) { // is he/she in a mvt group, if so, remove and destroy the group if( pSoldier->ubGroupID ) { if ( pSoldier->bAssignment != VEHICLE ) { //Can only remove groups if they aren't persistant (not in a squad or vehicle) RemoveGroup( pSoldier->ubGroupID ); } else { // remove him from any existing merc slot he could be in RemoveMercSlot( pSoldier ); TakeSoldierOutOfVehicle( pSoldier ); } } } else { RemoveCharacterFromSquads( pSoldier ); } // if the merc is not dead if( gMercProfiles[ pSoldier->ubProfile ].bMercStatus != MERC_IS_DEAD ) { //Set the status to returning home ( delay the merc for rehire ) gMercProfiles[ pSoldier->ubProfile ].bMercStatus = MERC_RETURNING_HOME; // specify how long the merc will continue to be unavailable gMercProfiles[ pSoldier->ubProfile ].uiDayBecomesAvailable = 1 + Random(2); // 1-2 days HandleSoldierLeavingWithLowMorale( pSoldier ); HandleSoldierLeavingForAnotherContract( pSoldier ); } //add an entry in the history page for the firing/quiting of the merc // ATE: Don't do this if they are already dead! if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) ) { AddHistoryToPlayersLog( ubHistoryCode, pSoldier->ubProfile, GetWorldTotalMin(), pSoldier->sSectorX, pSoldier->sSectorY ); } //if the merc was a POW, remember it becuase the merc cant show up in AIM or MERC anymore if( pSoldier->bAssignment == ASSIGNMENT_POW ) { gMercProfiles[ pSoldier->ubProfile ].bMercStatus = MERC_FIRED_AS_A_POW; } //else the merc CAN get his medical deposit back else { //Determine how much of a Medical deposit is going to be refunded to the player CalculateMedicalDepositRefund( pSoldier ); } //remove the merc from the tactical TacticalRemoveSoldier( pSoldier->ubID ); // Check if we should remove loaded world... CheckAndHandleUnloadingOfCurrentWorld(); if ( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) { ReBuildCharactersList( ); } fMapPanelDirty = TRUE; fTeamPanelDirty = TRUE; fCharacterInfoPanelDirty = TRUE; // stop time compression so player can react to the departure StopTimeCompression(); // WDS: This allows for replacing dead IMP mercs. See "BtnIMPBeginScreenDoneCallback" in "IMP Begin Screen.cpp" if( ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__PLAYER_CHARACTER ) && ( gMercProfiles[ pSoldier->ubProfile ].bMercStatus == MERC_IS_DEAD ) ) { // Replace the name with an empty string wcsncpy( gMercProfiles[ pSoldier->ubProfile ].zName, L"", 1 ); } // ATE: update team panels.... UpdateTeamPanelAssignments( ); // And unpause the @#$@#$ interface UnLockPauseState(); UnPauseGame(); if (is_client) send_dismiss(pSoldier->ubID); return( TRUE ); }