summaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2013-03-05 14:17:08 -0800
committerPatrick Davison <snapwilliam@gmail.com>2013-03-05 14:17:08 -0800
commit677b7454a37a0152f50d40993460d8f5a071e181 (patch)
treedc664e700b4aa4d0c1ab54ff7c99798dd9b623da /includes
parentd1209f8d15c83a1d8d29beafc085d927be7d2bcd (diff)
downloadpathery-677b7454a37a0152f50d40993460d8f5a071e181.tar.xz
Map editor 0.1!
Diffstat (limited to 'includes')
-rw-r--r--includes/mapclass.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/includes/mapclass.php b/includes/mapclass.php
index 9e91d3f..bc5a6e5 100644
--- a/includes/mapclass.php
+++ b/includes/mapclass.php
@@ -43,8 +43,15 @@ class map {
public function __construct($code = NULL, $mapID = NULL) {
//TODO: Use new code by default.
if ($mapID !== NULL) $this->ID = $mapID;
- if ($code !== NULL) $this->applyMapFromOldCode($code);
- //$this->applyMapFromCode($code);
+ if ($code !== NULL) {
+ $dimensions = explode('.', explode(':', $code)[0])[0];
+ if (strpos($dimensions, 'x') == true) {
+ $this->applyMapFromOldCode($code);
+ } else {
+ $this->applyMapFromCode($code);
+ }
+ }
+
}
public function applyMapFromOldCode($code) {
@@ -218,8 +225,7 @@ class map {
//Outputs the new code.
public function getCode() {
//If we already have the code on hand...
- if ($this->code)
- return $this->code;
+ //if ($this->code) return $this->code;
//Otherwise we need to build the code:
$headers[0] = $this->width;
$headers[1] = $this->height;