Repository navigation
refactor: review 0.14 for duplication, deprecated calls and plain docs - #1200
Merged
Merged
Conversation
A review of everything 0.14 changed, against CONTRIBUTING.md. Code: - Mouse.pixelsIn converts the pointer to pixels for the CD player's canvas, the HUD options menu and the scripts' pointer field, which each did the conversion themselves. - recordingStem uses recordings.Kind.of instead of its own loop. - recordings.Source logs a recording it leaves out in one place. - std.mem.print and Allocator.print replace the deprecated std.fmt.bufPrint and std.fmt.allocPrint in 0.14's code. - The CD player's track limit comes from the two digits a row's number has, instead of a bare 8. - A comptime check ties records.room_views' fields to rooms.View. - FFmpeg packets larger than a c_int fail with an error instead of a panic, since a FLAC file is sent whole. Text: - Comments, docs and API strings from 0.14 rewritten in plain English. - "Added by OpenReliant:" replaces the second marker, "Not the game's:".
Follow-up to the 0.14 review, for the code from before 0.14.
- std.mem.print and Allocator.print replace the remaining
std.fmt.bufPrint and std.fmt.allocPrint calls, which Zig 0.17
deprecates.
- Byte sizes written as shifts or products (256 << 20,
16 * 1024 * 1024) use std.fmt.parseIntSizeSuffix, as the 0.14 code
does. Three unnamed limits get names.
- Messages print those sizes with {Bi} instead of spelling them out,
so they can't disagree with the constant.
- The game, player and load scripts share one per-mod memory limit,
runtime.memory_per_mod, and the tests share runtime.testing.options
instead of seven copies of the same options.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A review of the whole 0.14 diff (
v0.13.0..main) for quality, duplication and CONTRIBUTING.md, plus the same clean-ups in the older code.Code from 0.14:
Mouse.pixelsInconverts the pointer to pixels. The CD player's canvas, the HUD options menu and the scripts'pointerfield each did this conversion themselves.recordingStemusesrecordings.Kind.ofinstead of its own loop.recordings.Sourcelogs a recording it leaves out in one place.records.room_views' fields torooms.View.c_intfails with an error instead of a panic, since a FLAC file is sent whole.Across the tree:
std.mem.printandAllocator.printreplace everystd.fmt.bufPrintandstd.fmt.allocPrintcall, which Zig 0.17 deprecates.256 << 20,16 * 1024 * 1024) usestd.fmt.parseIntSizeSuffix, as the 0.14 code does. Three unnamed limits get names.{Bi}instead of spelling them out, so they can't disagree with the constant.runtime.memory_per_mod. The tests shareruntime.testing.optionsinstead of seven copies of the same options.Text:
make definitionsregenerated the reference.No behaviour changes, apart from three messages that now print sizes as
16MiBrather than16777216 bytesor8 MiB.Left as they are: scratch buffers in the dev tools (
[16 << 10]u8) and sizes inside test data, where the arithmetic is the point.