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

Allow exit from load menu after trying to load empty save #650

Merged
merged 2 commits into from
Jul 3, 2024

Conversation

Pinemarten
Copy link
Contributor

@Pinemarten Pinemarten commented Jul 2, 2024

It's not possible to exit the load menu if you try to load an empty save game slot (stumbled upon this accidentally).

This PR fixes it. In case loading save failed, the closeFlag is not set to true.
Also minor refactor to use string_frm instead of std::snprintf.

@Try
Copy link
Owner

Try commented Jul 2, 2024

Hi, @Pinemarten and thanks for the fix!

Also minor refactor to use std::format (available in C++20) instead of std::snprintf (I guess some left-over?).

Not all C++ compilers de facto support std::format, unfortunately:

[ 94%] Building CXX object CMakeFiles/Gothic2Notr.dir/game/ui/gamemenu.cpp.o
/Users/appveyor/projects/opengothic/game/ui/gamemenu.cpp:922:37: error: no member named 'format' in namespace 'std'
  const std::string fileName = std::format("save_slot_{}.sav",int(id));
                               ~~~~~^
1 error generated.
make[3]: *** [CMakeFiles/Gothic2Notr.dir/game/ui/gamemenu.cpp.o] Error 

Note, that opengothic has it's own square wheel for string formation: string_frm .

@Pinemarten
Copy link
Contributor Author

I see. The GCC and clang on CI still doesn't support it. I'll use string_frm.

@Try Try merged commit cb05494 into Try:master Jul 3, 2024
1 check passed
@Try
Copy link
Owner

Try commented Jul 3, 2024

Merged, thanks!

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

Successfully merging this pull request may close these issues.

2 participants