From 4312f3b7eedbf6cdbe012be6eea1d45afd82de12 Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Sun, 21 Mar 2021 18:29:09 +0100 Subject: start using constants for the tilesheet indexes --- src/cell.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/cell.rs') diff --git a/src/cell.rs b/src/cell.rs index 6b42fdf..1659289 100644 --- a/src/cell.rs +++ b/src/cell.rs @@ -11,7 +11,7 @@ pub enum Occupant { Green, Yellow, Red, - Diamond, + Blue, Explosion, } @@ -24,12 +24,12 @@ impl Default for Occupant { impl Occupant { pub fn to_index(&self) -> u32 { match self { - Occupant::Green => 0, - Occupant::Yellow => 1, - Occupant::Red => 2, - Occupant::Diamond => 3, - Occupant::Explosion => 4, - Occupant::None => 13, + Occupant::Green => constants::TILESHEET_GREEN, + Occupant::Yellow => constants::TILESHEET_YELLOW, + Occupant::Red => constants::TILESHEET_RED, + Occupant::Blue => constants::TILESHEET_BLUE, + Occupant::Explosion => constants::TILESHEET_EXPLOSION1, + Occupant::None => constants::TILESHEET_NONE1, } } } @@ -39,7 +39,7 @@ impl Distribution for Standard { match rng.gen_range(0..=3) { 0 => Occupant::Green, 1 => Occupant::Yellow, - 2 => Occupant::Diamond, + 2 => Occupant::Blue, 3 => Occupant::Red, _ => Occupant::None, } -- cgit v1.2.3