refactor: group hard-coded settings into config.h - #9
Merged
Conversation
The server address/port, the window framerate cap and the default resolution/fps/volume were scattered as bare literals across connection.c, start_game.c and create/window.c. Collect them in config.h (SERVER_IP/PORT/TIMEOUT, DEFAULT_FPS, FPS_CAP, DEFAULT_VOLUME, DEFAULT_WIDTH/HEIGHT/BPP). Values are unchanged, so behaviour is identical; the hard-coded server IP flagged in the audit is now in one named place ready to be made configurable when networking is hardened.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The server address/port, the framerate cap and the default resolution / fps /
volume were bare literals scattered across
connection.c,start_game.candcreate/window.c. The hard-coded server IP in particular was flagged in theaudit.
What
New
config.h:SERVER_IP,SERVER_PORT,SERVER_TIMEOUTDEFAULT_FPS,FPS_CAP,DEFAULT_VOLUME,DEFAULT_WIDTH,DEFAULT_HEIGHT,DEFAULT_BPPValues are identical to before, so no behaviour change — this just gives the
settings one named home, ready to become a real config source when networking is
re-enabled and hardened.
Verification
make re: warning-free.config.hclean (full project stays at 0).make tests_run: 20/20 passing.Note
Per-widget sizes and the raycasting projection constants (e.g. the
1920used inthe FOV math) are intentionally left alone — they are not configuration.