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

Remove code smells from stonesense, pt. 2 #128

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open

Remove code smells from stonesense, pt. 2 #128

wants to merge 25 commits into from

Conversation

ab9rf
Copy link
Member

@ab9rf ab9rf commented Jan 12, 2025

Further work toward modernizing stonesense's codebase

ab9rf added 7 commits January 12, 2025 19:39
use std::filesystem::path instead of allegro routines. this also fixes an issue that could arise if a user used (on windows) a drive path that started with a drive letter
also use `const std::string&` in a couple functions instead of `const char*`
rewritten to use std::find_if
also does not force the use of `const char *` (all of the types in current use are actually using `std::string` so this pushes the conversion out to the call site instead of inside the iteration)
eliminated code duplication (and fixed spelling error) in `lookupIndexedPointerType`
iterate a const list instead of repeated code in `loadGraphicsFromDisk` and `flushImgFiles`

ideally this would be a destructor, but not there yet

this removes a leak on unload
eliminates uses of `ALLEGRO_PATH` in favor of `std::filesystem::path`

also works (unlike the prior commit)
remove `using namespace std`
push local functions into anonymous namespace
partially rewrite the image list and image cache with more reasonable data structures (not fully done)
dedup code n `getImgFile`
ab9rf added 18 commits January 12, 2025 19:45
fix type error
remove lots of dead code
`std::filesystem::path` does the same thing but more cleanly
this whole section of code sucks but trying to do this incrementally
only used in one place and could be reduced to a single template so this was done
simplify repetitive code
remove a ton of dead code
remove `using namespace std`
convert `#define` to `constexpr`
remove `using namespace std`
remove some random useless casting
remove `using namespace std`
use a proper constructor
change building x/y/z to signed to match DF
remove dead code
@ab9rf ab9rf marked this pull request as ready for review January 13, 2025 06:16
@ab9rf
Copy link
Member Author

ab9rf commented Jan 13, 2025

Releasing pt. 2 for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

1 participant