Fix subtract with overflow bug.
This commit is contained in:
parent
b119775293
commit
aaae17c6b2
@ -31,11 +31,11 @@ impl Hex {
|
||||
|
||||
pub fn from_tile(tile:u8) -> Self
|
||||
{
|
||||
let mut x = 0;
|
||||
let mut x = 0i32;
|
||||
while tile >= ROWS[x as usize + 1] { x += 1; }
|
||||
let y = tile - ROWS[x as usize] + ((x > 4) as u8 * (x - 4));
|
||||
let y = tile - ROWS[x as usize] + ((x > 4) as i32 * (x - 4)) as u8;
|
||||
Self {
|
||||
x,
|
||||
x:x as u8,
|
||||
y,
|
||||
tile,
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="application-name" content="Omen">
|
||||
<meta name="description" content="Abstract strategy wargame.">
|
||||
<meta name="description" content="Strategy board game played on a hexagon grid.">
|
||||
<link rel="icon" href="/favicon.png">
|
||||
<link rel="stylesheet" href=".css">
|
||||
<script src=".js"></script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user