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

Save achievement files with valid and unique names #74419

Merged
merged 35 commits into from
Jun 11, 2024

Conversation

Qrox
Copy link
Contributor

@Qrox Qrox commented Jun 9, 2024

Summary

Bugfixes "Save achievement files with valid and unique names"

Purpose of change

Salvage #71464 and implement the suggestion to improve file name uniqueness in that PR.

Describe the solution

  1. Salvage the part of Make achievement filename correct and unique. #71464 that filters the player character name to form a valid file name.
  2. Record the timestamp of world creation, or the timestamp when a legacy world is found, to act as a (hopefully) unique identifier of the world.
  3. Use the timestamp when saving achievement files, so that achievements of characters from different worlds with the same name can be saved to separate achievement files.

Describe alternatives you've considered

Some more unique identifier of worlds. However, since players may download other's worlds, this identifier has to be unique across the globe, which is probably not possible for a non-online game like this.

Testing

  1. Created a character with special characters (heh) in its name, and saved the character. An achievement file was correctly saved.
  2. Started the game and timestamps were created and saved for legacy worlds. Created a new world and a timestamp was created and saved. All timestamps were unique.
  3. Saved a character and the achievement file contained the character name, the world timestamp, and the character id, which should be unique enough for our purpose.

Additional context

MinGW-w64 with pthread does not provide the std::timespec_get function and TIME_UTC macro from c++17, so POSIX clock_gettime is used if TIME_UTC is not defined. I cannot test the std::timespec_get code, so a unit test is added to test the code in the CI.

akrieger and others added 30 commits February 3, 2024 18:18
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jianxiang Wang (王健翔) <[email protected]>
@github-actions github-actions bot added <Bugfix> This is a fix for a bug (or closes open issue) Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` Character / World Generation Issues and enhancements concerning stages of creating a character or a world labels Jun 9, 2024
Copy link
Contributor

github-actions bot commented Jun 9, 2024

Spell checker encountered unrecognized words in the in-game text added in this pull request. See below for details.

Click to expand
  • world timestamp

This alert is automatically generated. You can simply disregard if this is inaccurate, or (optionally) you can also add the new words to tools/spell_checker/dictionary.txt so they will not trigger an alert next time.

Hints for adding a new word to the dictionary
  • If the word is normally in all lowercase, such as the noun word or the verb does, add it in its lower-case form; if the word is a proper noun, such as the surname George, add it in its initial-caps form; if the word is an acronym or has special letter case, such as the acronym CDDA or the unit mW, add it by preserving the case of all the letters. A word in the dictionary will also match its initial-caps form (if the word is in all lowercase) and all-uppercase form, so a word should be added to the dictionary in its normal letter case even if used in a different letter case in a sentence.
  • For a word to be added to the dictionary, it should either be a real, properly-spelled modern American English word, a foreign loan word (including romanized foreign names), or a foreign or made-up word that is used consistently and commonly enough in the game. Intentional misspelling (including eye dialect) of a word should not be added unless it has become a common terminology in the game, because while someone may have a legitimate use for it, another person may spell it that way accidentally.

@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Jun 9, 2024
@Maleclypse Maleclypse merged commit 00db3bc into CleverRaven:master Jun 11, 2024
23 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Character / World Generation Issues and enhancements concerning stages of creating a character or a world Code: Tests Measurement, self-control, statistics, balancing. json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants