void EndUIPlan( ) { int cnt; SOLDIERTYPE *pSoldier; // Zero out any planned soldiers for( cnt = MAX_NUM_SOLDIERS; cnt < TOTAL_SOLDIERS; cnt++ ) { pSoldier = MercPtrs[ cnt ]; if ( pSoldier->bActive ) { if ( pSoldier->sPlannedTargetX != -1 ) { SetRenderFlags(RENDER_FLAG_FULL ); } TacticalRemoveSoldier( pSoldier->ubID ); } } gfInUIPlanMode = FALSE; gusSelectedSoldier = gpUIStartPlannedSoldier->ubID; gfPlotNewMovement = TRUE; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Leaving Planning Mode" ); }
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 ); }
//This function is called when the game is REstarted. Things that need to be reinited are placed in here void ReStartingGame() { UINT16 cnt; //Pause the game gfGamePaused = TRUE; //Reset the sectors gWorldSectorX = gWorldSectorY = 0; gbWorldSectorZ = -1; SoundStopAll( ); //we are going to restart a game so initialize the variable so we can initialize a new game InitNewGame( TRUE ); //Deletes all the Temp files in the Maps\Temp directory InitTacticalSave( TRUE ); //Loop through all the soldier and delete them all for( cnt=0; cnt< TOTAL_SOLDIERS; cnt++) { TacticalRemoveSoldier( cnt ); } // Re-init overhead... InitOverhead( ); //Reset the email list ShutDownEmailList(); //Reinit the laptopn screen variables InitLaptopAndLaptopScreens(); LaptopScreenInit(); //Reload the Merc profiles LoadMercProfiles( ); // Reload quote files ReloadAllQuoteFiles(); //Initialize the ShopKeeper Interface ( arms dealer inventory, etc. ) ShopKeeperScreenInit(); //Delete the world info TrashWorld(); //Init the help screen system InitHelpScreenSystem(); EmptyDialogueQueue( ); if ( InAirRaid( ) ) { EndAirRaid( ); } #ifdef JA2TESTVERSION //Reset so we can use the 'cheat key' to start with mercs TempHiringOfMercs( 0, TRUE ); #endif //Make sure the game starts in the TEAM panel ( it wasnt being reset ) gsCurInterfacePanel = TEAM_PANEL; //Delete all the strategic events DeleteAllStrategicEvents(); //This function gets called when ur in a game a click the quit to main menu button, therefore no game is in progress gTacticalStatus.fHasAGameBeenStarted = FALSE; // Reset timer callbacks gpCustomizableTimerCallback = NULL; gubCheatLevel = STARTING_CHEAT_LEVEL; }