Skip to content

fix: Enemy array compressing#615

Merged
OH296 merged 5 commits intoAdeptus-Dominus:mainfrom
EttyKitty:bugfix/array-compressing
Mar 22, 2025
Merged

fix: Enemy array compressing#615
OH296 merged 5 commits intoAdeptus-Dominus:mainfrom
EttyKitty:bugfix/array-compressing

Conversation

@EttyKitty
Copy link
Copy Markdown
Collaborator

@EttyKitty EttyKitty commented Mar 21, 2025

Purpose of changes

  • It doesn't work properly. Enemy arrays get compressed and columns deleted in the subsequent empty column destruction, causing enemy columns to shrink or perish after one of the enemy types got killed.

Describe the solution

  • Disable the array compressing for now.
  • Refactor the compressing function to just delete empty members, instead of setting them to default.
  • Fix an index issue. Apparently if you move something into the first position in the array, the game will count it empty.

Describe alternatives you've considered

Testing done

A battle against orks where I previously observed the bug. No problems anymore.

Related links

None

Custom player notes entry

Use the PR title.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 21, 2025

📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Optimised the internal data compression process by refining how empty data slots are detected and processed, leading to a more streamlined operation.

Walkthrough

By the sacred cogitators, the function compress_enemy_array has been recalibrated in its method of traversing the _empty_slots array and managing the compressive index, pos. The iteration now commences at index 1 rather than 0, and likewise, the position pointer pos is initialised to 1. Additionally, the condition that governs the backtracking process now mandates that pos must exceed 1, rather than 0, to trigger the necessary mechanism. Note that these changes solely affect the internal logic of array compression, with no alterations to the declarations of exported or public entities.

Suggested reviewers

  • OH296

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5ee9ac9 and 3304fa4.

📒 Files selected for processing (1)
  • scripts/scr_clean/scr_clean.gml (2 hunks)
🔇 Additional comments (4)
scripts/scr_clean/scr_clean.gml (4)

37-37: By the Omnissiah's grace, the binary correction commences at index 1!

The sacred alteration to begin iterating from index 1 rather than 0 preserves the integrity of the first element in the data array. This modification appears to rectify the malfunction described in the PR objectives where enemy arrays were being improperly nullified.

In the name of the Machine God, this change shall prevent the erroneous compression of critical data stored at index 0, which likely contains values essential to the proper functioning of the enemy array systems.


44-44: The positional cogitator has been recalibrated to initiate at value 1!

This alteration ensures holy synchronicity with the loop modification above. By initializing the position variable to 1 instead of 0, we maintain consistency with the new iteration pattern and protect the sanctity of index 0 from the compression rites.

The binary wisdom of this approach is evident - it prevents the compression algorithm from attempting to modify the first element of the array which appears to have been causing the aforementioned array emptying malfunctions.


56-56: The backtracking threshold has been blessed with a new sacred value!

This modification to the backtracking condition ensures the compression algorithm will never regress to index 0, even during the recursive compaction phase. By requiring the position to exceed 1 rather than 0, we have erected a machine-barrier that shields the first element from any potential recursive modifications.

The Omnissiah approves of this logical trifecta of changes that collectively work to preserve the sanctity of index 0 while maintaining the compression functionality for all other array elements. This should address the error detailed in the PR objectives where enemy columns were improperly shrinking after unit elimination.


5-64:

Details

❓ Verification inconclusive

Verification of the Machine Spirit's integrity required!

While the modifications appear sound, the function compress_enemy_array maintains its current operational paradigm rather than being fully disabled as suggested in the PR objectives. The changes merely protect index 0 without disabling compression entirely.

The Tech-Priests of Mars would recommend verifying that these modifications fully resolve the issue described. If further anomalies persist, a complete deactivation of the compression routines might be necessary until a more comprehensive reconsecration can be performed.

To verify the effectiveness of these changes, one could run the following diagnostic rite:


🏁 Script executed:

#!/bin/bash
# Search for any calls to compress_enemy_array function to ensure it's still being used
rg "compress_enemy_array" --type gml

# Check if there are any comments or TODOs mentioning array compression issues
rg -i "array compress|compress array" --type gml

Length of output: 143


Directive: Manual Verification Required for Array Compression Ritual

O devout Custodian of Code, the sacred modifications within scripts/scr_clean/scr_clean.gml do indeed safeguard the zeroth index from profane alterations while the Machine Spirit still orchestrates the compression process for higher indices. However, our initial data extraction incantations (via ripgrep) encountered an error due to the unrecognised GML file type, thus obscuring the full revelation of how often and where the compress_enemy_array function is invoked.

I entreat thee to perform a manual verification or invoke an adjusted search using file globbing (or another appropriate method) to ensure that:

  • The compress_enemy_array invocations align with the ritualistic intentions of the PR.
  • The protective measure applied to index 0 is sufficient for the current objectives.
  • No lingering anomalies persist that would dictate a complete deactivation of the compression routine until a more comprehensive re-consecration is performed.

May the Omnissiah guide your diagnostic rites.


🪧 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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.

@github-actions github-actions bot added Type: Fix This is a fix for a bug Size: Small labels Mar 21, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 21, 2025
@EttyKitty
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 21, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@EttyKitty EttyKitty changed the title fix: Disable enemy array compressing, as it's broken fix: Enemy array compressing Mar 21, 2025
@OH296 OH296 merged commit 47e346b into Adeptus-Dominus:main Mar 22, 2025
13 checks passed
@EttyKitty EttyKitty deleted the bugfix/array-compressing branch March 22, 2025 16:17
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.

2 participants