Skip to content
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

[Enhancement] Decouple all global variables from extern in true singleton #325

Merged
merged 14 commits into from
Apr 24, 2022

Conversation

beats-dh
Copy link
Collaborator

@beats-dh beats-dh commented Apr 20, 2022

All the global variables * g_* were decoupled to true singletons, reducing the dependencies between the objects and simplifying the amount of calls and instances. They used to be partial singletons mixed with global variables, that way we have one, and only one instance that is accessed via the getInstance methods, that are now the * g_* functions.

Changes:

  • g_actions
  • g_chat
  • g_config
  • g_creatureEvents
  • g_database
  • g_databaseTasks
  • g_decay
  • g_dispatcher
  • g_events
  • g_game
  • g_globalEvents
  • g_luaEnvironment
  • g_modules
  • g_monsters
  • g_moveEvents
  • g_npc
  • g_npcs
  • g_RSA
  • g_scheduler
  • g_scripts
  • g_spells
  • g_talkActions
  • g_vocations
  • g_weapons

The * g_luaEnvironment has been decoupled using inline, new feature of c++17

@beats-dh beats-dh added Priority: Low Minor impact Status: Pending Review This PR or Issue requires a review Status: Pending Test This PR or Issue requires more testing labels Apr 20, 2022
@beats-dh beats-dh changed the title Decouple extern in true singleton [Enhancement] Decouple extern in true singleton Apr 20, 2022
@beats-dh beats-dh requested a review from gpedro April 20, 2022 03:59
@beats-dh beats-dh added the Type: Enhancement New feature or request label Apr 20, 2022
@dudantas dudantas changed the title [Enhancement] Decouple extern in true singleton [Enhancement] Decouple all global variables from extern in true singleton Apr 23, 2022
@sonarcloud
Copy link

sonarcloud bot commented Apr 23, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 26 Code Smells

0.0% 0.0% Coverage
0.9% 0.9% Duplication

@dudantas dudantas merged commit b87372f into opentibiabr:main Apr 24, 2022
@beats-dh beats-dh deleted the Decouple-extern-in-true-singleton branch June 7, 2022 00:28
luan pushed a commit that referenced this pull request Jul 11, 2023
…eton (#325)

All the global variables * g_* were decoupled to true singletons, reducing the dependencies between the objects and simplifying the amount of calls and instances. They used to be partial singletons mixed with global variables, that way we have one, and only one instance that is accessed via the getInstance methods, that are now the * g_* functions.

Changes:

g_actions
g_chat
g_config
g_creatureEvents
g_database
g_databaseTasks
g_decay
g_dispatcher
g_events
g_game
g_globalEvents
g_luaEnvironment
g_modules
g_monsters
g_moveEvents
g_npc
g_npcs
g_RSA
g_scheduler
g_scripts
g_spells
g_talkActions
g_vocations
g_weapons

The * g_luaEnvironment has been decoupled using inline, new feature of c++17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Source Priority: Low Minor impact Status: Pending Review This PR or Issue requires a review Status: Pending Test This PR or Issue requires more testing Type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants