@@ -564,8 +564,7 @@ SaveCode GameState::saveGame( AsciiString filename, UnicodeString desc,
564564 xferSave.open ( filepath );
565565 } catch (...) {
566566 // print error message to the user
567- if (TheGlobalData && !TheGlobalData->m_headless )
568- TheInGameUI->message ( " GUI:Error" );
567+ TheInGameUI->message ( " GUI:Error" );
569568 DEBUG_LOG (( " Error opening file '%s'" , filepath.str () ));
570569 return SC_ERROR;
571570 }
@@ -595,16 +594,13 @@ SaveCode GameState::saveGame( AsciiString filename, UnicodeString desc,
595594 catch ( ... )
596595 {
597596
598- if (TheGlobalData && !TheGlobalData->m_headless )
599- {
600- UnicodeString ufilepath;
601- ufilepath.translate (filepath);
597+ UnicodeString ufilepath;
598+ ufilepath.translate (filepath);
602599
603- UnicodeString msg;
604- msg.format ( TheGameText->fetch (" GUI:ErrorSavingGame" ), ufilepath.str () );
600+ UnicodeString msg;
601+ msg.format ( TheGameText->fetch (" GUI:ErrorSavingGame" ), ufilepath.str () );
605602
606- MessageBoxOk (TheGameText->fetch (" GUI:Error" ), msg, nullptr );
607- }
603+ MessageBoxOk (TheGameText->fetch (" GUI:Error" ), msg, nullptr );
608604
609605 // close the file and get out of here
610606 xferSave.close ();
@@ -616,11 +612,8 @@ SaveCode GameState::saveGame( AsciiString filename, UnicodeString desc,
616612 xferSave.close ();
617613
618614 // print message to the user for game successfully saved
619- if (TheGlobalData && !TheGlobalData->m_headless )
620- {
621- UnicodeString msg = TheGameText->fetch ( " GUI:GameSaveComplete" );
622- TheInGameUI->message ( msg );
623- }
615+ UnicodeString msg = TheGameText->fetch ( " GUI:GameSaveComplete" );
616+ TheInGameUI->message ( msg );
624617
625618 return SC_OK;
626619
@@ -727,16 +720,13 @@ SaveCode GameState::loadGame( AvailableGameInfo gameInfo )
727720 TheGameEngine->reset ();
728721
729722 // print error message to the user
730- if (TheGlobalData && !TheGlobalData->m_headless )
731- {
732- UnicodeString ufilepath;
733- ufilepath.translate (filepath);
723+ UnicodeString ufilepath;
724+ ufilepath.translate (filepath);
734725
735- UnicodeString msg;
736- msg.format ( TheGameText->fetch (" GUI:ErrorLoadingGame" ), ufilepath.str () );
726+ UnicodeString msg;
727+ msg.format ( TheGameText->fetch (" GUI:ErrorLoadingGame" ), ufilepath.str () );
737728
738- MessageBoxOk (TheGameText->fetch (" GUI:Error" ), msg, nullptr );
739- }
729+ MessageBoxOk (TheGameText->fetch (" GUI:Error" ), msg, nullptr );
740730
741731 return SC_INVALID_DATA; // you can't use a naked "throw" outside of a catch statement!
742732
@@ -1383,17 +1373,6 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which )
13831373 continue ;
13841374 }
13851375
1386- // Skip visual-only blocks when saving in headless mode
1387- if ( TheGlobalData && TheGlobalData->m_headless &&
1388- (blockName.compareNoCase ( " CHUNK_TerrainVisual" ) == 0 ||
1389- blockName.compareNoCase ( " CHUNK_TacticalView" ) == 0 ||
1390- blockName.compareNoCase ( " CHUNK_ParticleSystem" ) == 0 ||
1391- blockName.compareNoCase ( " CHUNK_GhostObject" ) == 0 ) )
1392- {
1393- DEBUG_LOG ((" Skipping block '%s' in headless mode" , blockName.str ()));
1394- continue ;
1395- }
1396-
13971376 //
13981377 // for mission save files, we only save the game state block and campaign manager
13991378 // because anything else is not needed.
0 commit comments