From ee6968d6fde0072e4bdb1e7b1b047189a6c7157e Mon Sep 17 00:00:00 2001 From: mo k Date: Mon, 13 Feb 2012 16:46:57 -0700 Subject: clone the current location --- lib/terrain.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/terrain.rb b/lib/terrain.rb index 795bf6d..f3a1a60 100755 --- a/lib/terrain.rb +++ b/lib/terrain.rb @@ -4,7 +4,7 @@ class Terrain end def move_forward( heading, location) - new_location = heading.forward(location) + new_location = heading.forward(location.clone) if( new_location[:x] < @map[:x] && new_location[:x] > 0 && new_location[:y] < @map[:y] && new_location[:y] > 0) location[:x] = new_location[:x] location[:y] = new_location[:y] -- cgit v1.2.3