Skip to content

Commit

Permalink
fix overflow in get_x/get_y methods
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksa2808 committed Dec 14, 2023
1 parent d155adb commit f619daa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ use crate::{
};

pub fn get_x(x: i8) -> f32 {
TILE_WIDTH as f32 / 2.0 + (x * TILE_WIDTH as i8) as f32
TILE_WIDTH as f32 / 2.0 + (x as i32 * TILE_WIDTH as i32) as f32
}

pub fn get_y(y: i8) -> f32 {
-(TILE_HEIGHT as f32 / 2.0 + (y * TILE_HEIGHT as i8) as f32)
-(TILE_HEIGHT as f32 / 2.0 + (y as i32 * TILE_HEIGHT as i32) as f32)
}

pub fn decode(input: &str) -> String {
Expand Down

0 comments on commit f619daa

Please sign in to comment.