Skip to content

修复非自律寻敌模式下不检查潜艇职能的问题 - #790

Closed
oloadCloud wants to merge 2 commits into
wess09:devfrom
oloadCloud:pull
Closed

修复非自律寻敌模式下不检查潜艇职能的问题#790
oloadCloud wants to merge 2 commits into
wess09:devfrom
oloadCloud:pull

Conversation

@oloadCloud

@oloadCloud oloadCloud commented Aug 19, 2026

Copy link
Copy Markdown

Fixes #144

Summary by Sourcery

Bug Fixes:

  • 确保自动敌方搜索设置仅在清图模式下进行处理,同时在关闭自动搜索时仍允许启用潜艇的舰队继续出击。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Ensure automatic enemy-search settings are processed only in clear-map mode while still allowing submarine-enabled fleets to proceed when automatic search is disabled.
Original summary in English

Summary by Sourcery

Bug Fixes:

  • 确保自动敌方搜索设置仅在清图模式下进行处理,同时在关闭自动搜索时仍允许启用潜艇的舰队继续出击。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Ensure automatic enemy-search settings are processed only in clear-map mode while still allowing submarine-enabled fleets to proceed when automatic search is disabled.
Original summary in English

Summary by Sourcery

Bug Fixes:

  • 确保自动敌方搜索设置仅在清图模式下进行处理,同时在关闭自动搜索时仍允许启用潜艇的舰队继续出击。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Ensure automatic enemy-search settings are processed only in clear-map mode while still allowing submarine-enabled fleets to proceed when automatic search is disabled.
Original summary in English

Summary by Sourcery

Bug Fixes:

  • 确保自动敌方搜索设置仅在清图模式下进行处理,同时在关闭自动搜索时仍允许启用潜艇的舰队继续出击。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Ensure automatic enemy-search settings are processed only in clear-map mode while still allowing submarine-enabled fleets to proceed when automatic search is disabled.

@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown

CI 检查报告

检查结果

检查 结果 耗时
Post PR report ➖ unknown -

导入冒烟测试

  • 结果:✅
  • 扫描模块:499(通过 496,已知失败 3,意外失败 0,过期白名单 0)

@sourcery-ai

sourcery-ai Bot commented Aug 19, 2026

Copy link
Copy Markdown
审阅者指南(在小型 PR 上折叠)

审阅者指南

调整自动搜索处理逻辑:在“清理模式”下提前返回;在“非自动搜索模式”下仅在启用潜艇功能时继续执行,从而修复在非自动敌人搜索配置中缺失的潜艇检查问题。

更新后的 handle_auto_search_setting 逻辑流程图

flowchart TD
    A[handle_auto_search_setting] --> B[check map_is_clear_mode]
    B -->|False| C[return False]
    B -->|True| D[check map_is_auto_search]
    D -->|True| E[logger.info 自动搜索设置]
    D -->|False| F[check config.SUBMARINE]
    F -->|False| C
    F -->|True| E
Loading

文件级变更

变更 详情 文件
更正自动搜索设置的保护条件,使其遵循清理模式和潜艇配置。
  • 在地图不处于清理模式时,为自动搜索处理添加提前返回。
  • 要求在继续自动搜索设置前,必须启用自动搜索模式或潜艇配置中的任意一个。
  • 在通过新的保护条件后,保留自动搜索配置的日志记录。
module/handler/fast_forward.py

可能关联的问题


技巧与命令

与 Sourcery 交互

  • 触发新的审阅: 在 pull request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub issue: 通过回复审阅评论请求 Sourcery 从中创建一个 issue。你也可以在审阅评论中回复 @sourcery-ai issue 来从该评论创建 issue。
  • 生成 pull request 标题: 在 pull request 标题中的任意位置写入 @sourcery-ai,即可在任何时候生成标题。你也可以在 pull request 中评论 @sourcery-ai title 以在任何时候(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文中的任意位置写入 @sourcery-ai summary,即可在你想要的位置生成 PR 摘要。你也可以在 pull request 中评论 @sourcery-ai summary 以在任何时候(重新)生成摘要。
  • 生成审阅者指南: 在 pull request 中评论 @sourcery-ai guide,即可在任何时候(重新)生成审阅者指南。
  • 解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,这将非常有用。
  • 撤销所有 Sourcery 审阅: 在 pull request 中评论 @sourcery-ai dismiss,即可撤销所有现有的 Sourcery 审阅。如果你想以一次全新的审阅重新开始,这将尤其有用——别忘了再评论 @sourcery-ai review 来触发新的审阅!

自定义你的体验

访问你的 dashboard 以:

  • 启用或禁用审阅特性,例如 Sourcery 生成的 pull request 摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、删除或编辑自定义审阅说明。
  • 调整其他审阅设置。

获取帮助

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the auto-search handling logic so that in clear mode it returns early, and in non-auto-search mode it only proceeds when submarine functionality is enabled, fixing missing submarine checks in non-autonomous enemy search configuration.

Flow diagram for updated handle_auto_search_setting logic

flowchart TD
    A[handle_auto_search_setting] --> B[check map_is_clear_mode]
    B -->|False| C[return False]
    B -->|True| D[check map_is_auto_search]
    D -->|True| E[logger.info 自动搜索设置]
    D -->|False| F[check config.SUBMARINE]
    F -->|False| C
    F -->|True| E
Loading

File-Level Changes

Change Details Files
Correct auto-search settings guard conditions to respect clear mode and submarine configuration.
  • Add an early return when the map is not in clear mode for auto-search handling.
  • Require either auto-search mode or submarine configuration to be enabled before proceeding with automatic search settings.
  • Preserve logging of automatic search configuration after passing new guard conditions.
module/handler/fast_forward.py

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - 我在这里提供了一些整体反馈:

  • 新增的在 not self.map_is_clear_mode 条件下的提前返回改变了非清图模式下的行为;建议重新组织这个条件(例如和 map_is_auto_search/SUBMARINE 的检查合并),或者加一条简短的内联注释,让后续读代码的人更容易理解预期的控制流程。
给 AI Agent 的提示
请根据这次代码评审中的评论进行修改:

## 整体评论
- 新增的在 `not self.map_is_clear_mode` 条件下的提前返回改变了非清图模式下的行为;建议重新组织这个条件(例如和 `map_is_auto_search`/`SUBMARINE` 的检查合并),或者加一条简短的内联注释,让后续读代码的人更容易理解预期的控制流程。

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English

Hey - I've left some high level feedback:

  • The new early return on not self.map_is_clear_mode changes the behavior for non-clear maps; consider restructuring the condition (e.g., combining it with the map_is_auto_search/SUBMARINE checks) or adding a brief inline comment to make the intended control flow clearer to future readers.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new early return on `not self.map_is_clear_mode` changes the behavior for non-clear maps; consider restructuring the condition (e.g., combining it with the `map_is_auto_search`/`SUBMARINE` checks) or adding a brief inline comment to make the intended control flow clearer to future readers.

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 and I'll use the feedback to improve your reviews.

@wess09

wess09 commented Aug 19, 2026

Copy link
Copy Markdown
Owner

@sourcery-ai review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - 我在这里给出一些总体反馈:

  • 针对 not self.map_is_clear_mode 新增的提前返回会改变非清图(non-clear maps)的行为;建议确认这个处理器在这些情况下确实不会被调用,或者添加注释解释为什么在这里必须进行短路返回。
  • 条件 if not self.map_is_auto_search and not self.config.SUBMARINE 有点不直观;可以考虑重构或补充注释来澄清意图(例如说明潜艇模式在自动搜索关闭时仍然允许继续执行)。
面向 AI Agent 的提示
Please address the comments from this code review:

## Overall Comments
- The new early return on `not self.map_is_clear_mode` changes behavior for non-clear maps; consider confirming this handler is never expected to run in those cases or add a comment explaining why it must short-circuit there.
- The condition `if not self.map_is_auto_search and not self.config.SUBMARINE` is a bit counterintuitive; consider refactoring or commenting to make the intent clear (e.g., that submarine mode allows proceeding even when auto search is off).

Sourcery 对开源项目免费——如果你觉得我们的代码审查有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈改进后续代码审查。
Original comment in English

Hey - I've left some high level feedback:

  • The new early return on not self.map_is_clear_mode changes behavior for non-clear maps; consider confirming this handler is never expected to run in those cases or add a comment explaining why it must short-circuit there.
  • The condition if not self.map_is_auto_search and not self.config.SUBMARINE is a bit counterintuitive; consider refactoring or commenting to make the intent clear (e.g., that submarine mode allows proceeding even when auto search is off).
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new early return on `not self.map_is_clear_mode` changes behavior for non-clear maps; consider confirming this handler is never expected to run in those cases or add a comment explaining why it must short-circuit there.
- The condition `if not self.map_is_auto_search and not self.config.SUBMARINE` is a bit counterintuitive; consider refactoring or commenting to make the intent clear (e.g., that submarine mode allows proceeding even when auto search is off).

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 and I'll use the feedback to improve your reviews.

Repository owner deleted a comment from Beatrice-betty Aug 19, 2026
@wess09

wess09 commented Aug 19, 2026

Copy link
Copy Markdown
Owner

请进行足够的测试以表明此修改不会影响现有功能

而且此issue为功能请求 不是bug修复 请测试功能是否正确 同时通过sourcery-ai的审查

@wess09 wess09 added the 需要修改 / Request changes Changes required in PR label Aug 19, 2026
@oloadCloud

Copy link
Copy Markdown
Author

因为不使用自律寻敌,所以不检查职能,导致职能不按用户配置勾选→潜艇意外每战出击,这确实浪费了石油,对用户造成影响,从这点来说我认为这算是BUG,官源也是这个问题。
当既没有第二支水面舰队也没有潜艇舰队时,当然只能唯一一支的水面舰队包揽全部战斗了,此时“职能”的设置才会失去意义,这是最初的思路,同时我平时几乎不用非周回模式,确实没考虑到非周回模式没有职能按钮而报错的情况。
我最初的代码(6月)并不是为了解决该issue,而是为了实现非自律寻敌中途开启自律寻敌,所以最开始用的是 FLEET_2 判断条件,虽然2个月测试没有遇到相关报错,但解决该issue提到的问题并不需要 FLEET_2 ,所以缩小判断范围用 map_is_auto_search 。
虽然我用了2个月,但正如我所说,我没办法测试没考虑到、无法想象到的场景,如果觉得不合适合并那还是关了吧,就当提供个思路。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

需要修改 / Request changes Changes required in PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants