Rename x/y step fields to step_x, step_y

This makes things more consistent with Board's `enter_x` and `enter_y`,
and it prevents autocomplete prefix collisions with Stat's `x` and `y`.
This commit is contained in:
2026-03-20 23:04:56 -07:00
parent 24d20ae01f
commit cfb4518a53
2 changed files with 43 additions and 44 deletions
@@ -1,6 +1,5 @@
---
source: src/world.rs
assertion_line: 589
expression: world
---
World {
@@ -56,8 +55,8 @@ World {
Stat {
x: 1,
y: 1,
x_step: 0,
y_step: 0,
step_x: 0,
step_y: 0,
cycle: 1,
p1: 0,
p2: 0,
@@ -97,8 +96,8 @@ World {
Stat {
x: 1,
y: 1,
x_step: 0,
y_step: 0,
step_x: 0,
step_y: 0,
cycle: 1,
p1: 0,
p2: 0,
@@ -138,8 +137,8 @@ World {
Stat {
x: 1,
y: 1,
x_step: 0,
y_step: 0,
step_x: 0,
step_y: 0,
cycle: 1,
p1: 0,
p2: 0,
@@ -179,8 +178,8 @@ World {
Stat {
x: 1,
y: 1,
x_step: 0,
y_step: 0,
step_x: 0,
step_y: 0,
cycle: 1,
p1: 0,
p2: 0,
@@ -199,8 +198,8 @@ World {
Stat {
x: 3,
y: 2,
x_step: 0,
y_step: 0,
step_x: 0,
step_y: 0,
cycle: 3,
p1: 51,
p2: 0,
@@ -219,8 +218,8 @@ World {
Stat {
x: 20,
y: 4,
x_step: 0,
y_step: 0,
step_x: 0,
step_y: 0,
cycle: 0,
p1: 0,
p2: 0,
@@ -239,8 +238,8 @@ World {
Stat {
x: 5,
y: 2,
x_step: 0,
y_step: 0,
step_x: 0,
step_y: 0,
cycle: 1,
p1: 49,
p2: 1,
@@ -259,8 +258,8 @@ World {
Stat {
x: 7,
y: 2,
x_step: 0,
y_step: 0,
step_x: 0,
step_y: 0,
cycle: 3,
p1: 64,
p2: 0,
@@ -279,8 +278,8 @@ World {
Stat {
x: 10,
y: 2,
x_step: 0,
y_step: 0,
step_x: 0,
step_y: 0,
cycle: 3,
p1: 9,
p2: 0,
@@ -320,8 +319,8 @@ World {
Stat {
x: 1,
y: 1,
x_step: 0,
y_step: 0,
step_x: 0,
step_y: 0,
cycle: 1,
p1: 0,
p2: 0,
@@ -340,8 +339,8 @@ World {
Stat {
x: 3,
y: 2,
x_step: 0,
y_step: -1,
step_x: 0,
step_y: -1,
cycle: 4,
p1: 0,
p2: 0,
@@ -360,8 +359,8 @@ World {
Stat {
x: 5,
y: 2,
x_step: 0,
y_step: 1,
step_x: 0,
step_y: 1,
cycle: 4,
p1: 0,
p2: 0,
@@ -380,8 +379,8 @@ World {
Stat {
x: 7,
y: 2,
x_step: 1,
y_step: 0,
step_x: 1,
step_y: 0,
cycle: 4,
p1: 0,
p2: 0,
@@ -400,8 +399,8 @@ World {
Stat {
x: 9,
y: 2,
x_step: -1,
y_step: 0,
step_x: -1,
step_y: 0,
cycle: 4,
p1: 0,
p2: 0,
@@ -420,8 +419,8 @@ World {
Stat {
x: 3,
y: 4,
x_step: 0,
y_step: 0,
step_x: 0,
step_y: 0,
cycle: 2,
p1: 4,
p2: 4,
@@ -440,8 +439,8 @@ World {
Stat {
x: 4,
y: 4,
x_step: 0,
y_step: 0,
step_x: 0,
step_y: 0,
cycle: 2,
p1: 0,
p2: 0,
@@ -460,8 +459,8 @@ World {
Stat {
x: 5,
y: 4,
x_step: 0,
y_step: 0,
step_x: 0,
step_y: 0,
cycle: 2,
p1: 0,
p2: 0,
+9 -9
View File
@@ -267,9 +267,9 @@ pub struct Stat {
/// are possible and are useful for advanced techniques, but care must be taken to ensure that
/// they are safe; ZZT's bounds checking code assumes step distances will never exceed 1, so
/// steps larger than that may go off-board and cause memory corruption.
pub x_step: i16,
pub step_x: i16,
/// Vertical step delta.
pub y_step: i16,
pub step_y: i16,
/// How often this stat is updated, in game ticks.
///
/// Roughly speaking, stats update every 1/cycle game ticks. A cycle 1 object will run its code
@@ -330,8 +330,8 @@ impl Default for Stat {
Stat {
x: 0,
y: 0,
x_step: 0,
y_step: 0,
step_x: 0,
step_y: 0,
cycle: 0,
p1: 0,
p2: 0,
@@ -625,7 +625,7 @@ impl Board {
impl Stat {
fn parse(input: &[u8]) -> IResult<&[u8], Self, DecodeError> {
let (input, (x, y, x_step, y_step)) = (le_u8, le_u8, le_i16, le_i16).parse(input)?;
let (input, (x, y, step_x, step_y)) = (le_u8, le_u8, le_i16, le_i16).parse(input)?;
let (input, (cycle, p1, p2, p3)) = (le_i16, le_u8, le_u8, le_u8).parse(input)?;
let (input, (follower, leader)) = (le_i16, le_i16).parse(input)?;
let (input, (under_element, under_color)) = (le_u8, le_u8).parse(input)?;
@@ -650,8 +650,8 @@ impl Stat {
Stat {
x,
y,
x_step,
y_step,
step_x,
step_y,
follower,
leader,
cycle,
@@ -672,8 +672,8 @@ impl Stat {
let mut result = vec![];
result.push(self.x);
result.push(self.y);
result.push_i16(self.x_step);
result.push_i16(self.y_step);
result.push_i16(self.step_x);
result.push_i16(self.step_y);
result.push_i16(self.cycle);
result.push(self.p1);
result.push(self.p2);