Skip to content

Commit 52b6eb0

Browse files
authored
[GEN][ZH] Replace TheGlobalData macro with inline variable to make debugging easier (#1118)
1 parent 2389b09 commit 52b6eb0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,11 @@ class GlobalData : public SubsystemInterface
560560
// singleton
561561
extern GlobalData* TheWritableGlobalData;
562562

563+
// use TheGlobalData for all read-only accesses
564+
#if __cplusplus >= 201703L
565+
inline const GlobalData* const& TheGlobalData = TheWritableGlobalData;
566+
#else
563567
#define TheGlobalData ((const GlobalData*)TheWritableGlobalData)
568+
#endif
564569

565570
#endif

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,11 @@ class GlobalData : public SubsystemInterface
573573
// singleton
574574
extern GlobalData* TheWritableGlobalData;
575575

576+
// use TheGlobalData for all read-only accesses
577+
#if __cplusplus >= 201703L
578+
inline const GlobalData* const& TheGlobalData = TheWritableGlobalData;
579+
#else
576580
#define TheGlobalData ((const GlobalData*)TheWritableGlobalData)
581+
#endif
577582

578583
#endif

0 commit comments

Comments
 (0)