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

Ship stop command now executes every time #292

Merged
merged 1 commit into from
Sep 15, 2024

Conversation

charles-m-knox
Copy link

@charles-m-knox charles-m-knox commented Sep 15, 2024

When in space, the "stop" command works once, but under some conditions it does not work after the first time.

This is because the m_stop flag is set to true once a stop command is processed, but because it doesn't always get reset back to false later, the Stop() command just returns early due to its if (m_stop) return; check. Unfortunately, the ship continues moving.

Given that Destiny's Stop() method seems harmless to repeatedly execute, I've made the change in this PR to remove the return statements that were preventing the stop command from triggering if m_stop was true.

Now my ship stops as expected in the client.

Summary by Sourcery

Ensure the ship stop command executes every time by removing early return conditions in the Stop() method, allowing repeated execution of the stop command.

Bug Fixes:

  • Fix the issue where the ship stop command only executes once by removing the early return statements in the Stop() method.

Copy link

sourcery-ai bot commented Sep 15, 2024

Reviewer's Guide by Sourcery

This pull request modifies the Stop() method in the DestinyManager class to ensure that the stop command executes every time it's called, addressing an issue where it would sometimes fail to work after the first execution.

File-Level Changes

Change Details Files
Removed early return statements based on the m_stop flag in the Stop() method
  • Removed the initial check and return if m_stop is true
  • Removed the early return after setting m_stop to true when user speed fraction is 0
  • Kept the m_stop = true assignment when user speed fraction is 0
src/eve-server/system/DestinyManager.cpp
Improved code structure and comments in the Stop() method
  • Removed unnecessary comment about global actions
  • Updated comment for autopilot clearing
  • Added braces to the if statement for autopilot clearing
src/eve-server/system/DestinyManager.cpp

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @charles-m-knox - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a comment explaining why it's safe to allow multiple executions of the Stop() method. This will help future maintainers understand the reasoning behind removing the early return statements.
  • It might be helpful to add some debug logging to track how often Stop() is called in various scenarios. This could help identify any potential issues with repeated executions in the future.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@jdhirst
Copy link
Contributor

jdhirst commented Sep 15, 2024

lgtm <3

@jdhirst jdhirst merged commit ede9146 into EvEmu-Project:staging Sep 15, 2024
2 checks passed
@charles-m-knox charles-m-knox deleted the fix-ship-stopping branch September 15, 2024 17:57
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