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

Fix invalid avatar when we have old memorial #71328

Merged
merged 6 commits into from
Jan 31, 2024

Conversation

rtxyd
Copy link
Contributor

@rtxyd rtxyd commented Jan 29, 2024

Summary

Bugfixes "Fix invalid avatar when we have old memorials"

Purpose of change

Fix Strange: player is already assigned to mission 1 through 10
#67277

Describe the solution

Add a check to this function.

...(loading data)
if( u.getID() != character_id( -1 ) ){
...(do something)
}

Load game if there's an old memorial that don't have event_type::game_avatar_new, or event_type::game_start,
will cause "strange: player is already assigned to mission 1", actually, this is because, the player ID hasn't been set by game,
and the value is -1, and when we trigger event_type::game_avatar_new, game will assign misson to player, but at this time the target player id of the mission is also -1, so we got this bug.
Snipaste_2024-01-28_18-54-33
Snipaste_2024-01-28_18-54-16

the u ID is the player ID in current world, so if we load an existed save, this should not happen,
and when we load memorial, the same function will be invoke, so it may happen at this situation.

if the player ID don't set yet, it's -1, this situation only occurs when we have an old memorial without event_type::game_avatar_new or event_type::start_game,
and if the player ID set, then this function need to be done for old savefiles.

Describe alternatives you've considered

Maybe, we can optimize event function.

Testing

try file from the issue not trigger the case.

Steps to reproduce:

  1. Download memorial.zip, decompress and put memorial folder in game folder
  2. Launch game, start a new game: New Game -> Play Now!
  3. Bug

Additional context

This is how the bug works.

Snipaste_2024-01-29_19-04-38

Snipaste_2024-01-29_18-56-31

Tell me if the code's anything wrong.

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Jan 29, 2024
@Maleclypse Maleclypse merged commit ddcfaff into CleverRaven:master Jan 31, 2024
28 of 32 checks passed
@rtxyd rtxyd deleted the fix_invalid_avatar_id branch February 1, 2024 01:22
@Procyonae Procyonae added the 0.H Backport PR to backport to the 0.H stable release canddiate label May 20, 2024
Procyonae pushed a commit to Procyonae/Cataclysm-DDA that referenced this pull request May 20, 2024
@Procyonae Procyonae mentioned this pull request May 20, 2024
dseguin added a commit that referenced this pull request May 22, 2024
@Procyonae Procyonae added 0.H Backported and removed 0.H Backport PR to backport to the 0.H stable release canddiate labels May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.H Backported 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` json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Strange: player is already assigned to mission 1 through 10
3 participants