changeset 307:0c370efd753b gmap2

Use modern PHP array syntax.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 11 Sep 2017 13:37:05 +0300
parents 2f472f65d80a
children c0bac5a78724
files tools/makegmaps.php
diffstat 1 files changed, 68 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/tools/makegmaps.php	Mon Sep 11 13:25:48 2017 +0300
+++ b/tools/makegmaps.php	Mon Sep 11 13:37:05 2017 +0300
@@ -12,20 +12,20 @@
 
 
 // Paths and files
-$cfgDefaults = array(
-  "binConvert" => array(1, "convert", "Path of 'convert' binary from ImageMagick or GraphicsMagick."),
-  "binMercurial" => array(1, "hg", "Path of 'hg' binary of Mercurial DVCS."),
-  "binMake" => array(1, "make", "Path of 'make', preferably GNU make."),
+$cfgDefaults = [
+  "binConvert" => [1, "convert", "Path of 'convert' binary from ImageMagick or GraphicsMagick."],
+  "binMercurial" => [1, "hg", "Path of 'hg' binary of Mercurial DVCS."],
+  "binMake" => [1, "make", "Path of 'make', preferably GNU make."],
 
-  "pathMapUtils" => array(2, "maputils/", "Path for maputils directory tree."),
-  "pathImageCache" => array(2, "cache/", "Image cache directory."),
-  "pathGMap" => array(2, "../", "Path to map main directory and marker data files."),
-  "pathTileData" => array(2, "../tiles/", "Path to map tiles directory structure."),
+  "pathMapUtils" => [2, "maputils/", "Path for maputils directory tree."],
+  "pathImageCache" => [2, "cache/", "Image cache directory."],
+  "pathGMap" => [2, "../", "Path to map main directory and marker data files."],
+  "pathTileData" => [2, "../tiles/", "Path to map tiles directory structure."],
 
-  "pathRawMaps" => array(3, FALSE, "Path to the raw ASCII maps."),
-  "pathLocFiles" => array(3, FALSE, "Path to the location data LOC files."),
-  "worldConfig" => array(3, FALSE, "Path of the world configuration file 'world.inc.php' from MapUtils."),
-);
+  "pathRawMaps" => [3, FALSE, "Path to the raw ASCII maps."],
+  "pathLocFiles" => [3, FALSE, "Path to the location data LOC files."],
+  "worldConfig" => [3, FALSE, "Path of the world configuration file 'world.inc.php' from MapUtils."],
+];
 
 
 $fontFile = "./lucon.ttf";
@@ -38,57 +38,57 @@
 $maxZoom = 10;
 
 // Font sizes
-$fontSize = array();
+$fontSize = [];
 $fontSize[ 8] = 7;
 $fontSize[16] = 13;
 $fontSize[32] = 26;
 
-$modes = array(
-  "xml"     => array("batclient.xml"     , 0, 0),
-  "json"    => array("markers.json"      , 0, 0),
-);
+$modes = [
+  "xml"     => ["batclient.xml"     , 0, 0],
+  "json"    => ["markers.json"      , 0, 0],
+];
 
-$mapPalette = array();
-$mapPalette["!"]  = array(204,255,255);
-$mapPalette["%"]  = array(  0,170,170);
-$mapPalette["-"]  = array( 51, 51, 51);
-$mapPalette["|"]  = array( 51, 51, 51);
-$mapPalette["/"]  = array( 51, 51, 51);
-$mapPalette["+"]  = array( 51, 51, 51);
-$mapPalette["\\"] = array( 51, 51, 51);
-$mapPalette["="]  = array( 72, 67, 57);
-$mapPalette["@"]  = array(255,107,  0);
-$mapPalette["F"]  = array(  0,136,  0);
-$mapPalette["L"]  = array(255, 80,  0);
-$mapPalette["S"]  = array( 68,204,204);
-$mapPalette["^"]  = array(113,130,146);
-$mapPalette["c"]  = array( 95, 86, 85);
-$mapPalette["f"]  = array(  0,182,  0);
-$mapPalette["i"]  = array(255,255,255);
-$mapPalette["l"]  = array(100,100,255);
-$mapPalette["s"]  = array(157,168, 10);
-$mapPalette["v"]  = array( 34,221, 34);
-$mapPalette["x"]  = array(138,131, 96);
-$mapPalette["z"]  = array(177,164,133);
-$mapPalette["#"]  = array( 79, 54, 69);
-$mapPalette["."]  = array( 85,146,  0);
-$mapPalette[","]  = array(140, 87, 56);
-$mapPalette["?"]  = array(255,255,  0);
-$mapPalette["C"]  = array(153,153,  0);
-$mapPalette["H"]  = array(102, 63,  0);
-$mapPalette["R"]  = array( 51,102,255);
-$mapPalette["V"]  = array(255, 51,  0);
-$mapPalette["b"]  = array(207,196,165);
-$mapPalette["d"]  = array(238,187, 34);
-$mapPalette["h"]  = array(153,102,  0);
-$mapPalette["j"]  = array( 19,150, 54);
-$mapPalette["r"]  = array(102,153,255);
-$mapPalette["t"]  = array( 97,195,162);
-$mapPalette["w"]  = array(119,170,255);
-$mapPalette["y"]  = array(167,204, 20);
-$mapPalette["~"]  = array( 51, 51,170);
-$mapPalette["1"]  = array(255,102, 16);
-$mapPalette[3]    = array(0,0, 0);
+$mapPalette = [];
+$mapPalette["!"]  = [ 204, 255, 255];
+$mapPalette["%"]  = [   0, 170, 170];
+$mapPalette["-"]  = [  51,  51,  51];
+$mapPalette["|"]  = [  51,  51,  51];
+$mapPalette["/"]  = [  51,  51,  51];
+$mapPalette["+"]  = [  51,  51,  51];
+$mapPalette["\\"] = [  51,  51,  51];
+$mapPalette["="]  = [  72,  67,  57];
+$mapPalette["@"]  = [ 255, 107,   0];
+$mapPalette["F"]  = [   0, 136,   0];
+$mapPalette["L"]  = [ 255,  80,   0];
+$mapPalette["S"]  = [  68, 204, 204];
+$mapPalette["^"]  = [ 113, 130, 146];
+$mapPalette["c"]  = [  95,  86,  85];
+$mapPalette["f"]  = [   0, 182,   0];
+$mapPalette["i"]  = [ 255, 255, 255];
+$mapPalette["l"]  = [ 100, 100, 255];
+$mapPalette["s"]  = [ 157, 168,  10];
+$mapPalette["v"]  = [  34, 221,  34];
+$mapPalette["x"]  = [ 138, 131,  96];
+$mapPalette["z"]  = [ 177, 164, 133];
+$mapPalette["#"]  = [  79,  54,  69];
+$mapPalette["."]  = [  85, 146,   0];
+$mapPalette[","]  = [ 140,  87,  56];
+$mapPalette["?"]  = [ 255, 255,   0];
+$mapPalette["C"]  = [ 153, 153,   0];
+$mapPalette["H"]  = [ 102,  63,   0];
+$mapPalette["R"]  = [  51, 102, 255];
+$mapPalette["V"]  = [ 255,  51,   0];
+$mapPalette["b"]  = [ 207, 196, 165];
+$mapPalette["d"]  = [ 238, 187,  34];
+$mapPalette["h"]  = [ 153, 102,   0];
+$mapPalette["j"]  = [  19, 150,  54];
+$mapPalette["r"]  = [ 102, 153, 255];
+$mapPalette["t"]  = [  97, 195, 162];
+$mapPalette["w"]  = [ 119, 170, 255];
+$mapPalette["y"]  = [ 167, 204,  20];
+$mapPalette["~"]  = [  51,  51, 170];
+$mapPalette["1"]  = [ 255, 102,  16];
+$mapPalette[3]    = [   0,   0,   0];
 
 
 //
@@ -323,7 +323,7 @@
 $rawAltSuffix = ".map";
 
 /*
-foreach (array("." => 0600, $cfg["pathMapUtils"] => 0600) as $spath => $sperm)
+foreach (["." => 0600, $cfg["pathMapUtils"] => 0600] as $spath => $sperm)
 {
   if (chmod($spath, $sperm) === FALSE)
     echo "Could not set permissions for '".$spath."'.\n");
@@ -450,7 +450,7 @@
 
 echo "\nCreating tradelane waypoint data '".$tradelaneOut."' ...\n";
 
-$qdata = array();
+$qdata = [];
 
 foreach ($tradelanePoints as $name => $data)
 {
@@ -459,7 +459,7 @@
   if (!stGetWorldCoords($data[0], $data[1], $data[2], $xc, $yc))
     die("Invalid tradelane waypoint '".$name."', continent '".$data[0]."' not defined.\n");
 
-  $qdata[] = array(
+  $qdata[] = [
     "x" => $xc,
     "y" => $yc,
     "name" => $name,
@@ -467,7 +467,7 @@
     "continent" => "",
     "type" => "tradelane",
     "flags" => 0,
-  );
+  ];
 }
 
 stOutputToJSONFile($tradelaneOut, $qdata);
@@ -480,20 +480,20 @@
 if (!isset($tradelaneDefs))
   die("PHP array \$tradelaneDefs not set, '".$cfg["worldConfig"]."' is old or incompatible.\n");
 
-$qdata = array();
+$qdata = [];
 foreach ($tradelaneDefs as $index => $points)
 {
-  $qline = array();
+  $qline = [];
 
   foreach ($points as $point)
   {
     if (!stGetWaypointCoords($point, $xc, $yc))
       die("Invalid tradelane definition #$index: waypoint '".$point."' not defined.\n");
 
-    $qline[] = array(
+    $qline[] = [
       "x" => $xc,
       "y" => $yc
-    );
+    ];
   }
   
   $qdata[] = $qline;
@@ -614,7 +614,7 @@
  * Generate small versions
  */
 echo "\nGenerating scaled small map data...\n";
-$mapScales = array("50", "25", "12.5", "6.25", "3.125");
+$mapScales = ["50", "25", "12.5", "6.25", "3.125"];
 foreach ($continentList as $name => $data)
 if ($data[4] && $data[7])
 {
@@ -762,7 +762,7 @@
 
 echo "\nBuilding tiles data for all zoom levels ...\n";
 
-$mapData = array();
+$mapData = [];
 
 for ($zoom = $minZoom; $zoom <= $maxZoom; $zoom++)
 {