diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2013-01-26 01:31:40 -0800 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2013-01-26 01:31:40 -0800 |
commit | 0879eecfe919597de05895087327bfb0b1a6e9bd (patch) | |
tree | c3187a582ce488b58afaebcf07ecbb4e7cf0003a /includes | |
parent | 8e348cfd94360aee814a2dd629b4279818ddfc58 (diff) | |
download | pathery-0879eecfe919597de05895087327bfb0b1a6e9bd.tar.xz |
Tiny bit of cleanup
Diffstat (limited to 'includes')
-rw-r--r-- | includes/mapclass.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/includes/mapclass.php b/includes/mapclass.php index 21c7778..fa4d865 100644 --- a/includes/mapclass.php +++ b/includes/mapclass.php @@ -39,9 +39,10 @@ class map { public $code; public function __construct($code = NULL) { + //TODO: Use new code by default. if ($code !== NULL) $this->applyMapFromOldCode($code); - //echo "Construct complete"; + //$this->applyMapFromCode($code); } public function applyMapFromOldCode($code) { @@ -125,7 +126,8 @@ class map { //From the newer mapcode. public function applyMapFromCode($code) { - //echo "decoding mapcode: [$code]"; + //TODO: Uncomment this when testing is complete; to boost getCode() speed; + //$this->$code = $code; unset($this->tiles); $tmp = explode( ":", $code); @@ -149,9 +151,9 @@ class map { $this->checkpoints = 0; $distance = -1; - $index = 0; //First Element + $index = 0; $codePart = explode(',', $splitCode[$index]); $next = $codePart[0]; @@ -201,7 +203,10 @@ class map { for ($y = 0; $y < $this->height; $y++) { //Number of Rows for ($x = 0; $x < $this->width; $x++) { //Number of Columns if ($this->tiles[$y][$x][TileType] !== TileEmpty) { - $code .= $position.','.$this->tiles[$y][$x][TileType].$this->tiles[$y][$x][TileValue].'.'; + $positionOutput = $position; + if ($position == 0) + $positionOutput = ''; + $code .= $positionOutput.','.$this->tiles[$y][$x][TileType].$this->tiles[$y][$x][TileValue].'.'; $position = -1; } $position++; |