Skip to content

[GEN][ZH] Replace TheGlobalData macro with inline variable to make debugging easier #1118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Generals/Code/GameEngine/Include/Common/GlobalData.h
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,11 @@ class GlobalData : public SubsystemInterface
// singleton
extern GlobalData* TheWritableGlobalData;

// use TheGlobalData for all read-only accesses
#if __cplusplus >= 201703L
inline const GlobalData* const& TheGlobalData = TheWritableGlobalData;
#else
#define TheGlobalData ((const GlobalData*)TheWritableGlobalData)
#endif

#endif
5 changes: 5 additions & 0 deletions GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,11 @@ class GlobalData : public SubsystemInterface
// singleton
extern GlobalData* TheWritableGlobalData;

// use TheGlobalData for all read-only accesses
#if __cplusplus >= 201703L
inline const GlobalData* const& TheGlobalData = TheWritableGlobalData;
#else
#define TheGlobalData ((const GlobalData*)TheWritableGlobalData)
#endif

#endif
Loading