Skip to content

Commit c3e3178

Browse files
committed
refactor: Move archive setting to the recorder class
1 parent 4267258 commit c3e3178

File tree

10 files changed

+16
-10
lines changed

10 files changed

+16
-10
lines changed

Generals/Code/GameEngine/Include/Common/GlobalData.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ class GlobalData : public SubsystemInterface
392392
smaller area within the rectangle to order the gather. */
393393

394394
Int m_antiAliasBoxValue; ///< value of selected antialias from combo box in options menu
395-
Bool m_archiveReplays; ///< if true, each replay is archived to the replay archive folder after recording
396395
Bool m_languageFilterPref; ///< Bool if user wants to filter language
397396
Bool m_loadScreenDemo; ///< Bool if true, run the loadscreen demo movie
398397
Bool m_disableRender; ///< if true, no rendering!

Generals/Code/GameEngine/Include/Common/Recorder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ class RecorderClass : public SubsystemInterface {
169169
Bool m_wasDesync;
170170

171171
Bool m_doingAnalysis;
172+
Bool m_archiveReplays; ///< if true, each replay is archived to the replay archive folder after recording
172173

173174
Int m_originalGameMode; // valid in replays
174175

Generals/Code/GameEngine/Source/Common/GlobalData.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,6 @@ GlobalData::GlobalData()
920920
m_standardPublicBones.clear();
921921

922922
m_antiAliasBoxValue = 0;
923-
m_archiveReplays = false;
924923

925924
// m_languageFilterPref = false;
926925
m_languageFilterPref = true;
@@ -1175,7 +1174,6 @@ void GlobalData::parseGameDataDefinition( INI* ini )
11751174

11761175
// override INI values with user preferences
11771176
OptionPreferences optionPref;
1178-
TheWritableGlobalData->m_archiveReplays = optionPref.getArchiveReplaysEnabled();
11791177
TheWritableGlobalData->m_useAlternateMouse = optionPref.getAlternateMouseModeEnabled();
11801178
TheWritableGlobalData->m_keyboardScrollFactor = optionPref.getScrollFactor();
11811179
TheWritableGlobalData->m_drawScrollAnchor = optionPref.getDrawScrollAnchor();

Generals/Code/GameEngine/Source/Common/Recorder.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "GameLogic/GameLogic.h"
4646
#include "Common/RandomValue.h"
4747
#include "Common/CRCDebug.h"
48+
#include "Common/UserPreferences.h"
4849
#include "Common/version.h"
4950

5051
constexpr const char s_genrep[] = "GENREP";
@@ -370,6 +371,7 @@ RecorderClass::RecorderClass()
370371
//Added By Sadullah Nader
371372
//Initializtion(s) inserted
372373
m_doingAnalysis = FALSE;
374+
m_archiveReplays = FALSE;
373375
m_nextFrame = 0;
374376
m_wasDesync = FALSE;
375377
//
@@ -406,6 +408,9 @@ void RecorderClass::init() {
406408
m_wasDesync = FALSE;
407409
m_doingAnalysis = FALSE;
408410
m_playbackFrameCount = 0;
411+
412+
OptionPreferences optionPref;
413+
m_archiveReplays = optionPref.getArchiveReplaysEnabled();
409414
}
410415

411416
/**
@@ -727,7 +732,7 @@ void RecorderClass::stopRecording() {
727732
m_file->close();
728733
m_file = NULL;
729734

730-
if (TheGlobalData->m_archiveReplays)
735+
if (m_archiveReplays)
731736
archiveReplay(m_fileName);
732737
}
733738
m_fileName.clear();

Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ Bool OptionPreferences::getArchiveReplaysEnabled() const
314314
{
315315
OptionPreferences::const_iterator it = find("ArchiveReplays");
316316
if (it == end())
317-
return TheGlobalData->m_archiveReplays;
317+
return FALSE;
318318

319319
if (stricmp(it->second.str(), "yes") == 0) {
320320
return TRUE;

GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ class GlobalData : public SubsystemInterface
400400
smaller area within the rectangle to order the gather. */
401401

402402
Int m_antiAliasBoxValue; ///< value of selected antialias from combo box in options menu
403-
Bool m_archiveReplays; ///< if true, each replay is archived to the replay archive folder after recording
404403
Bool m_languageFilterPref; ///< Bool if user wants to filter language
405404
Bool m_loadScreenDemo; ///< Bool if true, run the loadscreen demo movie
406405
Bool m_disableRender; ///< if true, no rendering!

GeneralsMD/Code/GameEngine/Include/Common/Recorder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ class RecorderClass : public SubsystemInterface {
169169
Bool m_wasDesync;
170170

171171
Bool m_doingAnalysis;
172+
Bool m_archiveReplays; ///< if true, each replay is archived to the replay archive folder after recording
172173

173174
Int m_originalGameMode; // valid in replays
174175

GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,6 @@ GlobalData::GlobalData()
929929
m_standardPublicBones.clear();
930930

931931
m_antiAliasBoxValue = 0;
932-
m_archiveReplays = false;
933932

934933
// m_languageFilterPref = false;
935934
m_languageFilterPref = true;
@@ -1201,7 +1200,6 @@ void GlobalData::parseGameDataDefinition( INI* ini )
12011200

12021201
// override INI values with user preferences
12031202
OptionPreferences optionPref;
1204-
TheWritableGlobalData->m_archiveReplays = optionPref.getArchiveReplaysEnabled();
12051203
TheWritableGlobalData->m_useAlternateMouse = optionPref.getAlternateMouseModeEnabled();
12061204
TheWritableGlobalData->m_clientRetaliationModeEnabled = optionPref.getRetaliationModeEnabled();
12071205
TheWritableGlobalData->m_doubleClickAttackMove = optionPref.getDoubleClickAttackMoveEnabled();

GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "GameLogic/GameLogic.h"
4646
#include "Common/RandomValue.h"
4747
#include "Common/CRCDebug.h"
48+
#include "Common/UserPreferences.h"
4849
#include "Common/version.h"
4950

5051
constexpr const char s_genrep[] = "GENREP";
@@ -370,6 +371,7 @@ RecorderClass::RecorderClass()
370371
//Added By Sadullah Nader
371372
//Initializtion(s) inserted
372373
m_doingAnalysis = FALSE;
374+
m_archiveReplays = FALSE;
373375
m_nextFrame = 0;
374376
m_wasDesync = FALSE;
375377
//
@@ -406,6 +408,9 @@ void RecorderClass::init() {
406408
m_wasDesync = FALSE;
407409
m_doingAnalysis = FALSE;
408410
m_playbackFrameCount = 0;
411+
412+
OptionPreferences optionPref;
413+
m_archiveReplays = optionPref.getArchiveReplaysEnabled();
409414
}
410415

411416
/**
@@ -729,7 +734,7 @@ void RecorderClass::stopRecording() {
729734
m_file->close();
730735
m_file = NULL;
731736

732-
if (TheGlobalData->m_archiveReplays)
737+
if (m_archiveReplays)
733738
archiveReplay(m_fileName);
734739
}
735740
m_fileName.clear();

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ Bool OptionPreferences::getArchiveReplaysEnabled() const
323323
{
324324
OptionPreferences::const_iterator it = find("ArchiveReplays");
325325
if (it == end())
326-
return TheGlobalData->m_archiveReplays;
326+
return FALSE;
327327

328328
if (stricmp(it->second.str(), "yes") == 0) {
329329
return TRUE;

0 commit comments

Comments
 (0)