changeset 1828:4789d26f274f

Merge.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 30 Oct 2017 16:52:57 +0200
parents 5df0021836bc (current diff) 75ad82af5c66 (diff)
children 68d9ad08c15c
files mapsearch.c
diffstat 17 files changed, 52 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/colormap.c	Mon Oct 30 11:20:41 2017 +0200
+++ b/colormap.c	Mon Oct 30 16:52:57 2017 +0200
@@ -1,7 +1,7 @@
 /*
  * Convert BatMUD ASCII map to different formats
- * Programmed by Matti 'ccr' Hämäläinen (Ggr Pupunen)
- * (C) Copyright 2006-2015 Tecnic Software productions (TNSP)
+ * Programmed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
+ * (C) Copyright 2006-2017 Tecnic Software productions (TNSP)
  */
 #include "libmaputils.h"
 #include "th_args.h"
--- a/combine.c	Mon Oct 30 11:20:41 2017 +0200
+++ b/combine.c	Mon Oct 30 16:52:57 2017 +0200
@@ -1,7 +1,6 @@
 /*
- * combine - Combine several maps into one bigger
- *
- * Programmed by Matti 'ccr' Hämäläinen (Ggr Pupunen)
+ * Combine several maps into one bigger
+ * Programmed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
  * (C) Copyright 2006-2015 Tecnic Software productions (TNSP)
  */
 #include "libmaputils.h"
@@ -9,7 +8,7 @@
 #include "th_string.h"
 
 
-#define    MAX_FILES    (256)
+#define SET_MAX_FILES    (256)
 
 
 typedef struct
--- a/diffmap.c	Mon Oct 30 11:20:41 2017 +0200
+++ b/diffmap.c	Mon Oct 30 16:52:57 2017 +0200
@@ -1,6 +1,6 @@
 /*
- * diffmap - Compute 'diff' between two maps
- * Programmed by Matti 'ccr' Hämäläinen (Ggr Pupunen)
+ * Compute 'diff' between two maps
+ * Programmed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
  * (C) Copyright 2006-2015 Tecnic Software productions (TNSP)
  */
 #include "libmaputils.h"
@@ -8,15 +8,19 @@
 #include "th_args.h"
 #include "th_string.h"
 
-#define DEF_FILTER "C?%"
+
+#define SET_DEF_FILTER "C?%"
 
+
+/* Variables
+ */
 char    *srcFilename1 = NULL,
         *srcFilename2 = NULL,
         *destFilename = NULL;
 BOOL    optUseOldFormat = FALSE,
         optAlwaysDiff = FALSE;
 char    *optFilter1 = "",
-        *optFilter2 = DEF_FILTER;
+        *optFilter2 = SET_DEF_FILTER;
 
 
 /* Arguments
@@ -29,7 +33,7 @@
     { 3, 'O', "old-format", "Input using old symbols/colors", OPT_NONE },
     { 4, 'o', "output",     "Output filename", OPT_ARGREQ },
     { 5, 'F', NULL,         "Filter chars (none) for mapfile #1", OPT_ARGREQ },
-    { 6, 'f', NULL,         "Filter chars (" DEF_FILTER ") for mapfile #2", OPT_ARGREQ },
+    { 6, 'f', NULL,         "Filter chars (" SET_DEF_FILTER ") for mapfile #2", OPT_ARGREQ },
     { 7, 'a', "always",     "Always output diff file even when no changes", OPT_NONE },
 };
 
--- a/liblocfile.c	Mon Oct 30 11:20:41 2017 +0200
+++ b/liblocfile.c	Mon Oct 30 16:52:57 2017 +0200
@@ -1,6 +1,6 @@
 /*
  * liblocfile - Location file format handling
- * Programmed by Matti 'ccr' Hämäläinen (Ggr Pupunen)
+ * Programmed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
  * (C) Copyright 2006-2017 Tecnic Software productions (TNSP)
  */
 #include "liblocfile.h"
--- a/liblocfile.h	Mon Oct 30 11:20:41 2017 +0200
+++ b/liblocfile.h	Mon Oct 30 16:52:57 2017 +0200
@@ -1,6 +1,6 @@
 /*
  * liblocfile - Location file format handling
- * Programmed by Matti 'ccr' Hämäläinen (Ggr Pupunen)
+ * Programmed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
  * (C) Copyright 2006-2017 Tecnic Software productions (TNSP)
  */
 #ifndef LIBLOCFILE_H
--- a/libmaputils.c	Mon Oct 30 11:20:41 2017 +0200
+++ b/libmaputils.c	Mon Oct 30 16:52:57 2017 +0200
@@ -1,6 +1,6 @@
 /*
  * maputils - Generic functions/tables for maputils package
- * Programmed by Matti 'ccr' Hämäläinen (Ggr Pupunen)
+ * Programmed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
  * (C) Copyright 2006-2017 Tecnic Software productions (TNSP)
  */
 #include "libmaputils.h"
--- a/libmaputils.h	Mon Oct 30 11:20:41 2017 +0200
+++ b/libmaputils.h	Mon Oct 30 16:52:57 2017 +0200
@@ -1,6 +1,6 @@
 /*
- * maputils - Generic functions/tables for maputils package
- * Programmed by Matti 'ccr' Hämäläinen (Ggr Pupunen)
+ * libmaputils - Generic functions/tables for maputils package
+ * Programmed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
  * (C) Copyright 2006-2017 Tecnic Software productions (TNSP)
  */
 #ifndef LIBMAPUTILS_H
@@ -18,6 +18,7 @@
 
 #define BLOCK_SCAN_ALIGN	8
 
+
 /* Typedefs
  */
 typedef struct
--- a/map2ppm.c	Mon Oct 30 11:20:41 2017 +0200
+++ b/map2ppm.c	Mon Oct 30 16:52:57 2017 +0200
@@ -1,6 +1,6 @@
 /*
  * Convert BatMUD ASCII map to PPM or PNG image file
- * Programmed by Matti 'ccr' Hämäläinen (Ggr Pupunen)
+ * Programmed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
  * (C) Copyright 2006-2015 Tecnic Software productions (TNSP)
  */
 #include "libmaputils.h"
--- a/mapsearch.c	Mon Oct 30 11:20:41 2017 +0200
+++ b/mapsearch.c	Mon Oct 30 16:52:57 2017 +0200
@@ -1,6 +1,6 @@
 /*
  * PupuMaps Search WebSockets server
- * Written by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
+ * Programmed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
  * (C) Copyright 2017 Tecnic Software productions (TNSP)
  */
 #include "th_args.h"
@@ -93,7 +93,7 @@
     { 2, 'l', "listen",        "Listen to interface (see below)", OPT_ARGREQ },
     { 3,   0, "ssl-ciphers",   "Specify list of SSL/TLS ciphers", OPT_ARGREQ },
     { 4,   0, "clean-chars",   "String of characters to 'clean up' from map blocks.", OPT_ARGREQ },
-    { 5, 'w', "world-origin",  "Specify the world origin <x, y> which map offsets relate to.", OPT_ARGREQ },
+    { 5, 'w', "world-origin",  "Specify the world origin <x:y> which map offsets relate to.", OPT_ARGREQ },
 };
 
 static const int optListN = sizeof(optList) / sizeof(optList[0]);
@@ -120,6 +120,9 @@
         "\n"
         "Maps and location files for each map are specified as follows:\n"
         "<filename.map>:<locfilename.loc>:<map/continent name>[:<world x-offset>:<world y-offset>]\n"
+        "\n"
+        "All the map offsets are relative to world origin coordinates, which are 0,0 by default.\n"
+        "-w 8192:8192\n"
     );
 }
 
@@ -732,7 +735,7 @@
     int entropy = mapBlockGetEntropy(pattern, optCleanChars, strlen(optCleanChars));
 
     if ((entropy < 2 && width < 10 && height < 10) ||
-        (entropy < 3 && width * height < 6))
+        (entropy < 3 && width * height < 4))
     {
         *verr = "Search block entropy insufficient.";
         goto out;
@@ -763,8 +766,8 @@
                 MAPMatch *match = &matches[nmatches++];
 
                 match->map = info->locFile.continent;
-                match->mx = ox + centerX;
-                match->my = oy + centerY;
+                match->mx = ox + centerX + 1;
+                match->my = oy + centerY + 1;
                 match->wx = optWorldXC + info->locFile.x + ox + centerX;
                 match->wy = optWorldYC + info->locFile.y + oy + centerY;
                 match->accuracy = accuracy;
--- a/mapstats.c	Mon Oct 30 11:20:41 2017 +0200
+++ b/mapstats.c	Mon Oct 30 16:52:57 2017 +0200
@@ -1,6 +1,6 @@
 /*
  * Calculate terrain type (and other) statistics from ASCII map
- * Programmed by Matti 'ccr' Hämäläinen (Ggr Pupunen)
+ * Programmed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
  * (C) Copyright 2007 Tecnic Software productions (TNSP)
  */
 #include "libmaputils.h"
--- a/mkcitymap.c	Mon Oct 30 11:20:41 2017 +0200
+++ b/mkcitymap.c	Mon Oct 30 16:52:57 2017 +0200
@@ -1,6 +1,6 @@
 /*
- * mkcitymap - Create interactive XHTML+CSS+JS map from input
- * Programmed by Matti 'ccr' Hämäläinen (Ggr Pupunen)
+ * Create interactive XHTML+CSS+JS map from input
+ * Programmed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
  * (C) Copyright 2006-2015 Tecnic Software productions (TNSP)
  */
 #include "libmaputils.h"
--- a/mkloc.c	Mon Oct 30 11:20:41 2017 +0200
+++ b/mkloc.c	Mon Oct 30 16:52:57 2017 +0200
@@ -1,7 +1,6 @@
 /*
- * mkloc - Manipulate and convert BatMUD location data files
- *
- * Programmed by Matti 'ccr' Hämäläinen (Ggr Pupunen)
+ * Manipulate and convert BatMUD location data files
+ * Programmed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
  * (C) Copyright 2006-2015 Tecnic Software productions (TNSP)
  */
 #include "libmaputils.h"
--- a/mkspecial.c	Mon Oct 30 11:20:41 2017 +0200
+++ b/mkspecial.c	Mon Oct 30 16:52:57 2017 +0200
@@ -2,7 +2,7 @@
  * mkspecial - Compute complete ASCII map by stitching pieces
  * together based on a matcher and coordinates
  *
- * Programmed by Matti 'ccr' Hämäläinen (Ggr Pupunen)
+ * Programmed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
  * (C) Copyright 2006-2015 Tecnic Software productions (TNSP)
  */
 #include "libmaputils.h"
--- a/patchmap.c	Mon Oct 30 11:20:41 2017 +0200
+++ b/patchmap.c	Mon Oct 30 16:52:57 2017 +0200
@@ -1,6 +1,6 @@
 /*
- * patchmap - Patch a map with given diff file
- * Programmed by Matti 'ccr' Hämäläinen (Ggr Pupunen)
+ * Patch a map with given diff file
+ * Programmed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
  * (C) Copyright 2008-2015 Tecnic Software productions (TNSP)
  */
 #include "libmaputils.h"
@@ -8,6 +8,7 @@
 #include "th_args.h"
 #include "th_string.h"
 
+
 char    *mapFilename = NULL,
         *patchFilename = NULL,
         *destFilename = NULL;
--- a/tooltip.js	Mon Oct 30 11:20:41 2017 +0200
+++ b/tooltip.js	Mon Oct 30 16:52:57 2017 +0200
@@ -1,6 +1,6 @@
 //
 // Tooltip and other utility functions in JavaScript for BatMUD maps
-// Written by Matti 'ccr' Hamalainen <ccr@tnsp.org>
+// Programmed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
 // (C) Copyright 2006-2017 Tecnic Software productions (TNSP)
 //
 var myhl = -1;
--- a/util.js	Mon Oct 30 11:20:41 2017 +0200
+++ b/util.js	Mon Oct 30 16:52:57 2017 +0200
@@ -1,6 +1,6 @@
 //
 // Positioning utility functions in JavaScript for BatMUD maps
-// Written by Matti 'ccr' Hamalainen <ccr@tnsp.org>
+// Programmed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
 // (C) Copyright 2007-2017 Tecnic Software productions (TNSP)
 //
 
--- a/www/search.html	Mon Oct 30 11:20:41 2017 +0200
+++ b/www/search.html	Mon Oct 30 16:52:57 2017 +0200
@@ -33,19 +33,17 @@
       background: #eee;
       display: inline-block;
       vertical-align: top;
-      width: 35%;
+      min-width: 35%;
       border-radius:0.3em;
       padding: 0.5em;
+      margin: auto;
     }
 
     #resultsBox {
-      width: 60%;
-      height: 100%;
-      margin: auto;
     }
 
     #logBox {
-       display: inline-block;
+       display: block;
        vertical-align: top;
        padding: 0.5em;
        margin-top: 0.5em;
@@ -96,11 +94,6 @@
 <body onload="mapInitSearch()">
 
 <h1>Pupunen Map search (DEMO/ALPHA)</h1>
-<div id="note">
-NOTICE: This is a TEMPORARY test page only. Not on-line/available all the time.
-The map pattern parser is not very tolerant currently, best is to have
-strictly "square" or one-line patterns.
-</div>
 <noscript>
   <div id="error">
   This page requires JavaScript to be enabled to work.
@@ -123,6 +116,15 @@
   <div id="results"></div>
 </div>
 
+<div id="note">
+NOTICE: This is a TEMPORARY test page only. Not on-line/available all the time.
+The search ignores following characters (they act as wildcards):
+<b>*, @, ?, %, C</b> and
+whitespace, thus searching <b>exact</b> matches for player cities (C), shrine
+(%) and location markers (?) is not possible. "*" and "@" will be used to center the search coordinates
+if they are present in the pattern.
+</div>
+
 <div id="logBox">
   <h2>Log</h2>
   <div id="log"></div>