Skip to content

Mod change from iterator to walker to allow trees#3266

Merged
IntegratedQuantum merged 16 commits into
PixelGuys:masterfrom
Wunka:mod_renaming
Jul 5, 2026
Merged

Mod change from iterator to walker to allow trees#3266
IntegratedQuantum merged 16 commits into
PixelGuys:masterfrom
Wunka:mod_renaming

Conversation

@Wunka

@Wunka Wunka commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

In preparation for moving other _list.zig this implements my understanding of #1630 (comment) for the rotations. (It doesn't anymore, as we saw a problem with it)

@Wunka Wunka moved this to Easy to Review in PRs to review Jun 20, 2026
Comment thread mods/cubyz/rotations.zig Outdated
@Wunka Wunka changed the title Rotation Mod renaming Mod change from iterator to walker to allow trees Jun 20, 2026

@IntegratedQuantum IntegratedQuantum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you think you could also sort these alphabetically? The file system order is usually not sorted.

@IntegratedQuantum IntegratedQuantum moved this from Easy to Review to In review in PRs to review Jun 21, 2026
@Wunka

Wunka commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Do you think you could also sort these alphabetically? The file system order is usually not sorted.

Added.

@Wunka

Wunka commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

I didn't like how different "mods" were cramped together so I did this:

// MARK: anti-cubyz
pub const @"anti-cubyz:branch" = @import("anti-cubyz/rotations/branch.zig");
pub const @"anti-cubyz:carpet" = @import("anti-cubyz/rotations/carpet.zig");
pub const @"anti-cubyz:decayable" = @import("anti-cubyz/rotations/decayable.zig");
...

// MARK: cubyz
pub const @"cubyz:branch" = @import("cubyz/rotations/branch.zig");
pub const @"cubyz:carpet" = @import("cubyz/rotations/carpet.zig");
pub const @"cubyz:decayable" = @import("cubyz/rotations/decayable.zig");
...

Comment thread build.zig Outdated
Comment thread build.zig Outdated
}.lessThanFn);

try featureList.appendSlice(step.owner.allocator, step.owner.fmt(
\\

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you also remove the empty line at the start of the file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of blindly discarding the first character at the end, I'd prefer a conditional here:

if (featureList.items.len != 0) featureList.append('\n');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread build.zig
Comment thread build.zig Outdated
\\// MARK: {s}
\\
, .{modEntry.name}));
try featureList.appendSlice(step.owner.allocator, try std.mem.join(step.owner.allocator, "\n", modFeatureList.items));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please just use a for loops instead of making a needless intermediate allocation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't quite get what you exactly mean? Do you want me to use a [][]const u8 completly and only join at the end or what? I cannot operate directly on the slice going to the file as I am sorting on the [][]const u8 and not []const u8

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I mean to call appendSlice in a for loop instead of using join to prevent the needless intermediate allocation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ohhh. I see now. Yeah it does a needless intermediate allocation. I made it now into a for loop

Comment thread build.zig Outdated
@IntegratedQuantum IntegratedQuantum merged commit 585c4c3 into PixelGuys:master Jul 5, 2026
1 check passed
@Wunka Wunka deleted the mod_renaming branch July 5, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants