-
Notifications
You must be signed in to change notification settings - Fork 23
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
Refactor Configuration and Connection Handling for Consistency #268
base: master
Are you sure you want to change the base?
Conversation
This change updates the LoginServer connection string to be loaded from server.ini instead of Version.ini. This ensures all server files share a unified configuration source, improving maintainability. This adjustment also fixes twostars changes in PR #226. Future improvements to better structure sections across server files will follow in a separate commit.
This change introduces src/common/Ini.cpp and Ini.h to centralize configuration management. Redundant ini file handling code has been removed, such as in AIServer/Ini.cpp and Ini.h, reducing duplication and improving maintainability. Key changes: - New centralized ini file handling in src/common. - Updates to vcxproj files to reference the new implementation. - Modifications across multiple components to use the shared logic. This refactor prepares the codebase for future portability, enabling a smoother transition to a cross-platform library in place of Windows APIs for ini file management.
This change centralizes connection string construction, ensuring it is done in one place for consistency and maintainability. It also implements lazy loading to defer construction until needed, improving performance by reducing redundant computations. Key changes: - Refactored connection string logic across multiple components. - Updated AIServerDlg, AujardDlg, DBAgent, and others to use the new centralized implementation. - Ensured a cleaner and more efficient mechanism for managing connection strings. This simplifies the codebase and optimizes runtime efficiency, making future changes easier to manage.
This update standardizes the naming of connection strings across various server components for improved readability and consistency. Changes include renaming connection strings in files like AIServerDlg, MagicTableSet, and MakeItemTableSet, among others. The concise naming improves code clarity and adheres to the project's conventions.
This update introduces a unified ini file management class to ensure cross-platform compatibility and consistent behavior across the project. The changes leverage the SimpleIni library, which was added by updating the vendor submodule. Key changes: - Refactored and enhanced src/common/Ini.cpp and Ini.h for centralized ini file handling. - Updated various vcxproj files (e.g., KnightOnLine, AIServer, Aujard) to integrate the new implementation. - Simplified and standardized ini file logic to replace platform-specific handling. This improvement sets the stage for portable and maintainable configuration management across all components.
3e517e1
to
65b9b82
Compare
if (iServerCount > 0) { | ||
iServer = rand() % iServerCount; | ||
szServerIpAddr = vIpAddrs[rand() % iServerCount]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add srand(static_cast<unsigned>(time(0)));
before this line to get a different value every time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CIni
class is impressive in its functionality, efficiently handling configuration tasks while ensuring cross-platform compatibility through the use of SimpleIni. Additionally, employing the Singleton design pattern enhances build performance by reducing overhead.
Description
This pull request refactors configuration and connection string handling across the project to improve maintainability, readability, and portability. Key changes include:
These updates lay the groundwork for a more maintainable and portable codebase, ensuring consistency across all server components while improving runtime efficiency and adaptability.