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

Restructure stonesense state and configuration stores #155

Merged
merged 8 commits into from
Jan 21, 2025
Merged

Conversation

ab9rf
Copy link
Member

@ab9rf ab9rf commented Jan 20, 2025

The purpose of this PR is to arrange the internal state in Stonesense so that the user-controlled configuration is clearly delineated from other tool state, in order to facilitate switching to a better approach for handling persistent user configuration

ab9rf added 5 commits January 19, 2025 19:34
Phase 1:

Ensure that every setting in the configuration file corresponds to a variable in `GameConfiguration`, and segregate the variables in `GameConfiguration` that are set from the configuration file from the other stuff in the structure
derived from the settings in the standard `init.txt`
@myk002
Copy link
Member

myk002 commented Jan 20, 2025

a branch update will solve the docs build failure -- I merged the relocating of the keybinds file

ab9rf added 2 commits January 20, 2025 15:57
now instead of updating the "live" config while parsing the config, the config is parsed in full, generating a new config, and the generated config applied in place of the existing one after parsing is complete
@ab9rf
Copy link
Member Author

ab9rf commented Jan 21, 2025

I think this is ready to go; the next phase is to convert the loader to use TOML, which should be in a separate PR.

@ab9rf ab9rf marked this pull request as ready for review January 21, 2025 03:49
Config.cpp Outdated
@@ -5,7 +5,7 @@
#include "common.h"
#include "commonTypes.h"
#include "Config.h"
#include "GameConfiguration.h"
#include "Config.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snarf?

Config.h Outdated
Comment on lines 12 to 13
constexpr int DEFAULT_SIZE = /*20*/ 70;
constexpr int DEFAULT_SIZE_Z = /*6*/ 4;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed: these are better defaults. can remove commented values?

Config.h Outdated
constexpr int DEFAULT_SIZE_Z = /*6*/ 4;

class Config {
// constexpr auto GFXMODE = GFX_AUTODETECT_WINDOWED;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it's a relic of days gone by, if someone wants to find it there's always git history

Config.h Outdated
TRACKING_NONE,
TRACKING_CENTER,
TRACKING_FOCUS,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's how it was in the original 🤷‍♀️

bool names_use_nick = true;
bool names_use_species = true;
bool show_osd = false;
bool cache_images = false;
Copy link
Member

@myk002 myk002 Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this matches the default config, but I wonder why cache_images is off by default

Copy link
Member Author

@ab9rf ab9rf Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because Stonesense was written in 2012 when the average graphics card had maybe 2 GB of VRAM and a lot of DF players were likely using GPUs with less than 1GB of VRAM, often much less, and using the image cache on such systems would make the baby GPU cry sadly for mercy.

I'm leery of turning it on by default simply because it's been off by default for so long and so the caching code hasn't been very well tested as a result.

@myk002 myk002 merged commit 7759275 into master Jan 21, 2025
7 checks passed
@myk002 myk002 deleted the configuration branch January 21, 2025 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants