Browse Source

add support for horse values of network tag

tkas 1 year ago
parent
commit
a3f460ef2f
1 changed files with 13 additions and 9 deletions
  1. 13 9
      map/php/func.php

+ 13 - 9
map/php/func.php

@@ -20,7 +20,8 @@ const NODES_WAYS_EDGE = 12;
  * @return array
  */
 function getNetworkValueList(){
-    return array(array("lwn", "rwn", "nwn"), array("lcn", "rcn", "ncn"));
+    return array(array("lwn", "rwn", "nwn"), array("lcn", "rcn", "ncn"),
+    array("lhn", "rhn", "nhn", "ihn"));
 }
 
 /**
@@ -172,7 +173,7 @@ function checkTagsValidValues($tags, $kctKey){
  */
 function checkTagNetwork($network){
     $netList = getNetworkValueList();
-    return in_array($network, $netList[0]) || in_array($network, $netList[1]) ? 0 : 1;
+    return (in_array($network, $netList[0]) || in_array($network, $netList[1]) || in_array($network, $netList[2])) ? 0 : 1;
 }
 
 /**
@@ -245,15 +246,18 @@ function checkTagNetworkKct($network, $kct){
     if(!in_array($kct,getKctValueList())){
         return 1;
     }
-    if($kct!='bicycle'){
-        if(!in_array($network, $networkList[0])){
-            return 1;
-        }
-        $table = getNetworkKctTable();
-        return $table[$kct][$network] == 1 ? 0 : 1;
-    } else {
+    if($kct=='bicycle'){
         return in_array($network, $networkList[1]) ? 0 : 1;
     }
+    if($kct=='horse'){
+        return in_array($network, $networkList[2]) ? 0 : 1;
+    }
+    //pesi trasy
+    if(!in_array($network, $networkList[0])){
+        return 1;
+    }
+    $table = getNetworkKctTable();
+    return $table[$kct][$network] == 1 ? 0 : 1;
 }
 
 /**