Migrate ACT_CRAFT to activity actors, fix activity actor migration, allow activity actors to specify specific progress messages #42794
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.
Summary
SUMMARY: None
Purpose of change
Migrate ACT_CRAFT to be an activity actor, fix bugs that sprung up while doing so.
Describe the solution
Fix actor migration cancelling
f683059
The check for whether or not the activity needed to be cancelled due to being migrated to an activity actor was incorrect - the function to serialize a player_activity would not omit the member if the actor was null, it would write out a null.
That is, for all activities saved from versions after activity actors were introduced, so also keep the old check for the member not existing.
After fixing this, I noticed that it still wasn't working - so check if the type is a cancel activity in player_activity::do_turn, and cancel if so.
Allow activity actors to specify progress messages
39fb139
Instead of the hardcoded map of id->message, let actors specify whatever message they want for the progress message. Utilize this for the two existing actors using it.
Migrate ACT_CRAFT to actors
feccd57
Change some pointers to references, refactor out a function or two for cleanliness, but mostly just moving code around.
Testing
Crafting from hands, examine menu, and crafting menu to completion works correctly. Crafting repeatedly from the examine menu works correctly.
Loading a savegame with an existing craft action in progress cancels correctly.
Additional context
Yak-shaving for future work involving recipes.