Skip to content

Update freespace.cpp - #7788

Open
wookieejedi wants to merge 1 commit into
scp-fs2open:masterfrom
wookieejedi:fix-diff-level-default-opt
Open

wookieejedi wants to merge 1 commit into
scp-fs2open:masterfrom
wookieejedi:fix-diff-level-default-opt

Conversation

@wookieejedi

Copy link
Copy Markdown
Member

Bug:
"No matter what value I'm setting in default_settings table with the entry below, it doesn't affect any new pilots I create."

Cause:
The skill option's table parser only sets Game_skill_level directly. Every other place that asks for "the default" ignores it and uses the hard-coded DEFAULT_SKILL_LEVEL (1, which is "Easy"), so the tabled value gets overwritten twice:

At startup (freespace.cpp:1919-1920): default_settings_init() sets Game_skill_level from your table. Then loadInitialValues() runs right after. If Game.SkillLevel isn't saved in the ini yet, it falls back to default_func. That returned the constant 1, and bind_to wrote it back over your value.

When a pilot is created (managepilot.cpp:100): init_new_pilot() does Game_skill_level = game_get_default_skill_level(), which also just returned the constant.

Fix:
This PR follows the same strategy of settings like sound volume to allow modders to specify a default setting for difficulty.

Bug:
"No matter what value I'm setting in default_settings table with the entry below, it doesn't affect any new pilots I create."

Cause:
The skill option's table parser only sets Game_skill_level directly. Every other place that asks for "the default" ignores it and uses the hard-coded DEFAULT_SKILL_LEVEL (1, which is "Easy"), so the tabled value gets overwritten twice:

At startup (freespace.cpp:1919-1920): default_settings_init() sets Game_skill_level from your table. Then loadInitialValues() runs right after. If Game.SkillLevel isn't saved in the ini yet, it falls back to default_func. That returned the constant 1, and bind_to wrote it back over your value.
When a pilot is created (managepilot.cpp:100): init_new_pilot() does Game_skill_level = game_get_default_skill_level(), which also just returned the constant.

This PR follows the same strategy of settings like sound volume to allow modders to specify a default setting for difficulty.
@wookieejedi wookieejedi added the fix A fix for bugs, not-a-bugs, and/or regressions. label Sep 15, 2026
@Goober5000 Goober5000 added this to the Release 26.2 milestone Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A fix for bugs, not-a-bugs, and/or regressions.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants