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

[common] [arcana] Resolve potential race condition in crafting_magic_routine #7038

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vtcifer
Copy link
Contributor

@vtcifer vtcifer commented Jan 3, 2025

No description provided.

Comment on lines +839 to 844
if checkcastrt > 0
return
elsif !XMLData.prepared_spell.eql?('None') && checkcastrt == 0
spell = XMLData.prepared_spell
data = training_spells.find { |_skill, info| info['name'] == spell }.last
crafting_cast_spell(data, settings)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if checkcastrt > 0
return
elsif !XMLData.prepared_spell.eql?('None') && checkcastrt == 0
spell = XMLData.prepared_spell
data = training_spells.find { |_skill, info| info['name'] == spell }.last
crafting_cast_spell(data, settings)
unless XMLData.prepared_spell.eql?('None') && checkcastrt == 0
return
else
spell = XMLData.prepared_spell
data = training_spells.find { |_skill, info| info['name'] == spell }.last
crafting_cast_spell(data, settings)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me we want to return in all cases where we have no spell prepped. If that's correct, I prefer an unless else, versus and if/elsif not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me we want to return in all cases where we have no spell prepped. If that's correct, I prefer an unless else, versus and if/elsif not.

No, we want to fall through to preparing a spell if none are prepared.

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