Mercurial > hg > batmud > maputils
changeset 2395:42ee2079a69d
Rename generate_batclient_xml.php to genbcxml.php
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 09 Nov 2021 01:10:36 +0200 |
parents | 4b58028f35ef |
children | ac5a822828d0 |
files | src/genbcxml.php src/generate_batclient_xml.php world/Makefile |
diffstat | 3 files changed, 47 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/genbcxml.php Tue Nov 09 01:10:36 2021 +0200 @@ -0,0 +1,46 @@ +#!/usr/bin/php +<?php +// Prevent non-cli execution +if (php_sapi_name() != "cli" || !empty($_SERVER["REMOTE_ADDR"])) + die("You can only run this script as a commandline application.\n"); + +if (count($argv) < 5) +{ + die("Usage: ".$argv[0]." <path to mkloc> <path to loc files> <path to world.inc.ph> <outputfile.xml>\n"); +} + +// Stub config +$binMkLoc = $argv[1]; +$cfg["pathLocFiles"] = $argv[2]; +$cfg["worldConfig"] = $argv[3]; +$outFilename = $argv[4]; + + +// Check sanity +if (!file_exists($binMkLoc)) + die($binMkLoc." not found. Maputils package not built, or some other error occured.\n"); + +if (!file_exists($cfg["worldConfig"])) + die("Required continent/tradelane configuration file '".$cfg["worldConfig"]."' not found.\n"); + +require $cfg["worldConfig"]; + + +// Build and run command +$tmp = escapeshellcmd($binMkLoc)." -v -o ".escapeshellarg($outFilename)." -G xml "; + +foreach ($continentList as $cname => $cdata) +{ + if ($cdata[CTI_HAS_MAP] && $cdata[CTI_REG_CONT]) + { + // has a map + $tmp .= + "-l ".escapeshellarg($cfg["pathLocFiles"].$cname.".loc")." ". + "-c ".escapeshellarg($cdata[CTI_NAME])." ". + "-x ".escapeshellarg($worldMap["ox"] + $cdata[CTI_XOFFS])." ". + "-y ".escapeshellarg($worldMap["oy"] + $cdata[CTI_YOFFS])." "; + } +} + +passthru($tmp) == 0 or die("Error executing: ".$tmp."\n"); +?>
--- a/src/generate_batclient_xml.php Mon Nov 08 22:37:50 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -#!/usr/bin/php -<?php -// Prevent non-cli execution -if (php_sapi_name() != "cli" || !empty($_SERVER["REMOTE_ADDR"])) - die("You can only run this script as a commandline application.\n"); - -if (count($argv) < 5) -{ - die("Usage: ".$argv[0]." <path to mkloc> <path to loc files> <path to world.inc.ph> <outputfile.xml>\n"); -} - -// Stub config -$binMkLoc = $argv[1]; -$cfg["pathLocFiles"] = $argv[2]; -$cfg["worldConfig"] = $argv[3]; -$outFilename = $argv[4]; - - -// Check sanity -if (!file_exists($binMkLoc)) - die($binMkLoc." not found. Maputils package not built, or some other error occured.\n"); - -if (!file_exists($cfg["worldConfig"])) - die("Required continent/tradelane configuration file '".$cfg["worldConfig"]."' not found.\n"); - -require $cfg["worldConfig"]; - - -// Build and run command -$tmp = escapeshellcmd($binMkLoc)." -v -o ".escapeshellarg($outFilename)." -G xml "; - -foreach ($continentList as $cname => $cdata) -{ - if ($cdata[CTI_HAS_MAP] && $cdata[CTI_REG_CONT]) - { - // has a map - $tmp .= - "-l ".escapeshellarg($cfg["pathLocFiles"].$cname.".loc")." ". - "-c ".escapeshellarg($cdata[CTI_NAME])." ". - "-x ".escapeshellarg($worldMap["ox"] + $cdata[CTI_XOFFS])." ". - "-y ".escapeshellarg($worldMap["oy"] + $cdata[CTI_YOFFS])." "; - } -} - -passthru($tmp) == 0 or die("Error executing: ".$tmp."\n"); -?>
--- a/world/Makefile Mon Nov 08 22:37:50 2021 +0200 +++ b/world/Makefile Tue Nov 09 01:10:36 2021 +0200 @@ -93,7 +93,7 @@ TARGETS += batclient.xml batclient.xml: $(addsuffix .loc,$(WORLD_MAPS)) $(MKLOC_BIN) ../www/world.inc.php - php ../src/generate_batclient_xml.php $(MKLOC_BIN) ./ ../www/world.inc.php $@ + php ../src/genbcxml.php $(MKLOC_BIN) ./ ../www/world.inc.php $@ endif