Skip to content

fix: Switching to manage views from popup causing crash#971

Merged
OH296 merged 3 commits intoAdeptus-Dominus:mainfrom
OH296:switch_manage_views_issue
Aug 16, 2025
Merged

fix: Switching to manage views from popup causing crash#971
OH296 merged 3 commits intoAdeptus-Dominus:mainfrom
OH296:switch_manage_views_issue

Conversation

@OH296
Copy link
Copy Markdown
Collaborator

@OH296 OH296 commented Aug 14, 2025

Purpose and Description

  • Self-descriptive.

Testing done

  • None, and I understand the risks.

Related things and/or additional context

@github-actions github-actions bot added Size: Tiny Type: Fix This is a fix for a bug labels Aug 14, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Aug 14, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Standardised menu state handling across Manage, Event Log, Apothecarion, and Reclusiam screens for more consistent behaviour.
  • Bug Fixes
    • Improved reliability when returning to the Manage screen from various flows (e.g., missions/ancient ruins).
    • More consistent UI refreshes and navigation, reducing intermittent mismatches between screen state and displayed content.

Walkthrough

By the Omnissiah’s logic-engine: numeric menu codes are replaced with named constants across UI and controller scripts. One popup path is simplified to a single toggle call. No public interfaces are altered. A minor double-assignment appears in scr_ui_manage but still resolves to MENU.Manage.

Changes

Cohort / File(s) Summary
Manage menu constant standardisation
objects/obj_controller/Mouse_50.gml, scripts/scr_ui_manage/scr_ui_manage.gml
Replace hard-coded menu value 1 with MENU.Manage across click/selection paths and UI transitions; includes a chained assignment “menu = menu = MENU.Manage;;” in scr_ui_manage().
Other menu constant replacements
objects/obj_event_log/Draw_0.gml, scripts/scr_controller_helpers/scr_controller_helpers.gml, scripts/scr_ui_advisors/scr_ui_advisors.gml
Substitute literals with named constants: 17 → Manage.EventLog; 11 → MENU.Apothecarion; 12 → MENU.Reclusiam. Logic flow unchanged.
Popup ancient_ruins path simplification
objects/obj_popup/Step_0.gml
Replace inline controller/menu updates and UI refresh calls with scr_toggle_manage(); retain subsequent cleanup and exits.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

PR: Fix, Size: Medium

Suggested reviewers

  • Blogaugis
  • EttyKitty

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🔭 Outside diff range comments (2)
objects/obj_event_log/Draw_0.gml (1)

6-10: Wrong constant namespace and comparator; will misroute logic (and possibly crash).

  • Manage.EventLog likely does not exist; elsewhere you use MENU.EventLog.
  • '=' assigns instead of compares, subverting menu flow.
  • Same for 'if (bad = 0)' below.

Apply this sanctified patch:

-        if (obj_controller.menu = Manage.EventLog) {
+        if (obj_controller.menu == MENU.EventLog) {
             bad = 0;
         }
     }
-    if (bad = 0) {
+    if (bad == 0) {
objects/obj_popup/Step_0.gml (1)

712-720: Omnissiah’s verdict — update inline comment; scr_toggle_manage runs in obj_controller (no wrapping needed); cooldown missing

Verified: scr_toggle_manage() already executes its logic inside with(obj_controller) (scripts/scr_controller_helpers/scr_controller_helpers.gml, ~lines 174–183). It does NOT set a cooldown, so wrapping the call is unnecessary — add a cooldown only if you want parity with other toggles.

Files to change:

  • objects/obj_popup/Step_0.gml (lines 712–720) — update the stale comment.
  • scripts/scr_controller_helpers/scr_controller_helpers.gml (lines 174–183) — confirms with(obj_controller) usage.

Suggested diffs:

Comment correction (required):

-            // Nothing
+            // Switch to Manage UI (centralised toggle)

Optional cooldown (if you want a short controller cooldown after toggling):

-            scr_toggle_manage();
+            scr_toggle_manage();
+            // Optional: prevent rapid re-toggles
+            with (obj_controller) {
+                cooldown = 10;
+            }

Omnissiah approves the centralised toggle; please apply the comment fix and decide whether to add the cooldown.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b24c3d and 42420fa.

📒 Files selected for processing (6)
  • objects/obj_controller/Mouse_50.gml (2 hunks)
  • objects/obj_event_log/Draw_0.gml (1 hunks)
  • objects/obj_popup/Step_0.gml (1 hunks)
  • scripts/scr_controller_helpers/scr_controller_helpers.gml (1 hunks)
  • scripts/scr_ui_advisors/scr_ui_advisors.gml (1 hunks)
  • scripts/scr_ui_manage/scr_ui_manage.gml (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.gml

⚙️ CodeRabbit Configuration File

**/*.gml: - Macro constants require a space between the constant name and value. Without it, the compiler will throw an error. I.e. #macro ARR_body_parts["arm"] will crash the game, because there is no space between the array and the name of the macro.

Files:

  • scripts/scr_ui_advisors/scr_ui_advisors.gml
  • scripts/scr_controller_helpers/scr_controller_helpers.gml
  • objects/obj_popup/Step_0.gml
  • scripts/scr_ui_manage/scr_ui_manage.gml
  • objects/obj_event_log/Draw_0.gml
  • objects/obj_controller/Mouse_50.gml
**/*.*

⚙️ CodeRabbit Configuration File

**/*.*: - Having humanly understandable and maintainable code is always the top most priority.

Files:

  • scripts/scr_ui_advisors/scr_ui_advisors.gml
  • scripts/scr_controller_helpers/scr_controller_helpers.gml
  • objects/obj_popup/Step_0.gml
  • scripts/scr_ui_manage/scr_ui_manage.gml
  • objects/obj_event_log/Draw_0.gml
  • objects/obj_controller/Mouse_50.gml
🧠 Learnings (2)
📚 Learning: 2025-04-18T13:33:54.167Z
Learnt from: EttyKitty
PR: Adeptus-Dominus/ChapterMaster#0
File: :0-0
Timestamp: 2025-04-18T13:33:54.167Z
Learning: In obj_new_button/Step_0.gml, when using scr_click_left() for detecting clicks on menu buttons, it should be called with parameter 0 (scr_click_left(0)) to disable the default cooldown of 60 steps. Using the default cooldown can cause menu buttons to appear unresponsive since it prevents subsequent clicks from being detected.

Applied to files:

  • objects/obj_popup/Step_0.gml
  • objects/obj_controller/Mouse_50.gml
📚 Learning: 2025-04-16T09:51:55.065Z
Learnt from: EttyKitty
PR: Adeptus-Dominus/ChapterMaster#0
File: :0-0
Timestamp: 2025-04-16T09:51:55.065Z
Learning: In obj_ingame_menu/Step_0.gml, the line "if (effect=14){instance_create(0,0,obj_fade);fading=0.1;}" must not be commented out, as it's critical for menu button transitions. When clicking the Exit button, it sets effect=14, but without this handler creating the fade effect object, no transition occurs.

Applied to files:

  • objects/obj_popup/Step_0.gml
🔇 Additional comments (4)
scripts/scr_controller_helpers/scr_controller_helpers.gml (1)

212-216: Good replacement of magic number with MENU enum.

Using MENU.Apothecarion instead of a hard-coded literal is the correct, more readable approach. No functional regressions detected in this hunk.

objects/obj_controller/Mouse_50.gml (2)

230-233: Enum usage upgrade acknowledged.

Switching the back button target to MENU.Manage is correct and aligns with the new constant set. Cooldown logic unaffected.


262-266: Enum replacement: sound and cog-toothed.

The Chapter Master back arrow now returns to MENU.Manage appropriately. Minor, but consistent with the refactor.

scripts/scr_ui_manage/scr_ui_manage.gml (1)

82-83: LGTM: return-to-Manage after load is correct.

Setting menu to MENU.Manage post-load (when not reloading) is consistent with expected UX and the enum migration.

@OH296 OH296 merged commit 26d5414 into Adeptus-Dominus:main Aug 16, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size: Tiny Type: Fix This is a fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant