Skip to content

Commit

Permalink
Merge pull request #72 from tomassedovic/GGalizzi-box_new
Browse files Browse the repository at this point in the history
Update to rust master
  • Loading branch information
tomassedovic committed Jan 9, 2015
2 parents c5e4971 + 30e9548 commit 649047d
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 173 deletions.
8 changes: 4 additions & 4 deletions examples/astar-path-finding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extern crate tcod;
use tcod::AStarPath;

fn create_path() -> AStarPath<'static> {
let chess_board: [[int; 8]; 8] = [
let chess_board: [[isize; 8]; 8] = [
[1, 0, 1, 0, 1, 0, 1, 0],
[0, 1, 0, 1, 0, 1, 0, 1],
[1, 0, 1, 0, 1, 0, 1, 0],
Expand All @@ -16,10 +16,10 @@ fn create_path() -> AStarPath<'static> {
[0, 1, 0, 1, 0, 1, 0, 1],
];
// Movement like in Checkers: you can only move to the square of the same colour
let can_move = move |&mut: from: (int, int), to: (int, int)| -> f32 {
let can_move = move |&mut: from: (isize, isize), to: (isize, isize)| -> f32 {
let (fx, fy) = from;
let (tx, ty) = to;
if chess_board[fy as uint][fx as uint] == chess_board[ty as uint][tx as uint] {
if chess_board[fy as usize][fx as usize] == chess_board[ty as usize][tx as usize] {
1.0
} else {
0.0
Expand Down Expand Up @@ -58,7 +58,7 @@ fn main() {

// Walk the path (consuming it):
for pos in path.walk() {
println!("Walking to {}", pos)
println!("Walking to {:?}", pos);
}

assert_eq!(path.len(), 0);
Expand Down
12 changes: 6 additions & 6 deletions examples/dijkstra-path-finding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extern crate tcod;
use tcod::DijkstraPath;

fn create_path() -> DijkstraPath<'static> {
let chess_board: [[int; 8]; 8] = [
let chess_board: [[isize; 8]; 8] = [
[1, 0, 1, 0, 1, 0, 1, 0],
[0, 1, 0, 1, 0, 1, 0, 1],
[1, 0, 1, 0, 1, 0, 1, 0],
Expand All @@ -16,10 +16,10 @@ fn create_path() -> DijkstraPath<'static> {
[0, 1, 0, 1, 0, 1, 0, 1],
];
// Movement like in Checkers: you can only move to the square of the same colour
let can_move = move |&mut: from: (int, int), to: (int, int)| -> f32 {
let can_move = move |&mut: from: (isize, isize), to: (isize, isize)| -> f32 {
let (fx, fy) = from;
let (tx, ty) = to;
if chess_board[fy as uint][fx as uint] == chess_board[ty as uint][tx as uint] {
if chess_board[fy as usize][fx as usize] == chess_board[ty as usize][tx as usize] {
1.0
} else {
0.0
Expand All @@ -28,12 +28,12 @@ fn create_path() -> DijkstraPath<'static> {
DijkstraPath::new_from_callback(8, 8, can_move, 1.0)
}

fn walk_from(path: &mut DijkstraPath, origin: (int, int)) {
fn walk_from(path: &mut DijkstraPath, origin: (isize, isize)) {
path.find(origin);
path.reverse();
println!("Starting from: {}", origin);
println!("Starting from: {:?}", origin);
for pos in path.walk() {
println!("Walking to: {}", pos);
println!("Walking to: {:?}", pos);
}
println!("Arrived at the destination!\n");
}
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ fn main() {
while !Console::window_closed() {
Console::flush();
let key = Console::wait_for_keypress(true);
println!("Pressed key: {}", key);
println!("Pressed key: {:?}", key);
}
}
Loading

0 comments on commit 649047d

Please sign in to comment.