]> git.pond.sub.org Git - empserver/commitdiff
fairland: Show a more useful map
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 17 Aug 2020 10:39:04 +0000 (12:39 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 5 Jan 2021 09:41:35 +0000 (10:41 +0100)
The map fairland shows has absolute 0,0 in the top-left corner, while
POGO's map * has it in the center.  Shift fairland's map to match
POGO's.

The map shows sea as '.', island sectors as '%', capitals as '#',
mountains as '^', and other continental sectors as a letter or digit
that encodes the continent number modulo 62.  When a continent has no
"other" sectors, its continent number is not shown.  Remove this
pathological case by using letter/digit for capitals, and '#' for
other continental sectors.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/util/fairland.c
tests/fairland/fairland.out

index 69963e1ff9b027036fdb231af3f522dbee6f04fb..c6eb29b3b2575846205ad14f36d2b7bfc1516864 100644 (file)
@@ -29,7 +29,7 @@
  *  Known contributors to this file:
  *     Ken Stevens, 1995
  *     Steve McClure, 1998
  *  Known contributors to this file:
  *     Ken Stevens, 1995
  *     Steve McClure, 1998
- *     Markus Armbruster, 2004-2013
+ *     Markus Armbruster, 2004-2020
  */
 
 #include <config.h>
  */
 
 #include <config.h>
@@ -1100,17 +1100,20 @@ write_sects(void)
 static void
 output(void)
 {
 static void
 output(void)
 {
-    int i, j;
+    int sx, sy, x, y;
+
     if (quiet == 0) {
     if (quiet == 0) {
-       for (i = 0; i < WORLD_Y; ++i) {
+       for (sy = -WORLD_Y / 2; sy < WORLD_Y / 2; sy++) {
+           y = YNORM(sy);
            puts("");
            puts("");
-           if (i % 2)
+           if (y % 2)
                printf(" ");
                printf(" ");
-           for (j = i % 2; j < WORLD_X; j += 2) {
-               if (own[j][i] == -1)
+           for (sx = -WORLD_X / 2 + y % 2; sx < WORLD_X / 2; sx += 2) {
+               x = XNORM(sx);
+               if (own[x][y] == -1)
                    printf(". ");
                else {
                    printf(". ");
                else {
-                   printf("%c ", map_symbol(j, i));
+                   printf("%c ", map_symbol(x, y));
                }
            }
        }
                }
            }
        }
@@ -1124,16 +1127,16 @@ output(void)
 static int
 map_symbol(int x, int y)
 {
 static int
 map_symbol(int x, int y)
 {
-    int c, iscap = 0;
+    int c;
 
     for (c = 0; c < nc; ++c)
        if ((x == capx[c] && y == capy[c])
            || (x == new_x(capx[c] + 2) && y == capy[c]))
 
     for (c = 0; c < nc; ++c)
        if ((x == capx[c] && y == capy[c])
            || (x == new_x(capx[c] + 2) && y == capy[c]))
-           iscap = 1;
+           return numletter[own[x][y] % 62];
     if ((elev[x][y] >= HILLMIN && elev[x][y] < PLATMIN)
        || elev[x][y] >= HIGHMIN)
        return '^';
     if ((elev[x][y] >= HILLMIN && elev[x][y] < PLATMIN)
        || elev[x][y] >= HIGHMIN)
        return '^';
-    return own[x][y] >= nc ? '%' : iscap ? '#' : numletter[own[x][y] % 62];
+    return own[x][y] >= nc ? '%' : '#';
 }
 
 /***************************************************************************
 }
 
 /***************************************************************************
index a0d7a9fe3bb9efa8b63bee88b3d244c0c458453c..bce921431b573073e5c2589e415714499d1a20b5 100644 (file)
@@ -22,37 +22,37 @@ adding resources...
 setting coastal flags...
 writing to sectors file...
 
 setting coastal flags...
 writing to sectors file...
 
-. e e e e e . % % % % . . # # i i . . . . . % % % % . . . % % .
- . e e e . e . % % % % . i i i i . . . . . . % % . . . . . % % %
-% . . . . . . % % % . . i i i i . . g g g . . . . . . . . % % %
- % . % % % % . . . . . . i i i . . g g g g . . . . . . . % % % %
-% . % % % % % % % % . . . i i . . g g g g g g . . . . % % % . .
- . % % % . . . % . . . . i i . . g g g # # g g . % % . % % . b .
-b . % % . . a . . a a . . . . % . g g g g g . . % % . . . . b b
- b . . . . a a a a a . . . . % % . g g g g . . . . . . b b b b b
-b b . . . a a # # . . . . . % % % . . . . g . . . . . b b # # b
- b . . . a a a a a a . . . % % % % % % % . . . . . . b b b b b b
-. . . . . . a a a a a a . . % % % % % % % % % . . . . b b b b .
- . . . . . a a a a a a . . . % % % % % % % . . . . . . . b b . .
-. . . . . . . . . . . . . . . . . . . . . . d . . . . . . . . .
- . . . . . . . . . . . . . . . % % % % % . . d . . . . . . . . .
-. . . . . . . . . . % % % % . . % % % % . d . d d d . . . . . .
- . . j . . . . . % % % % % . . % % % % . d d d d d . . . . . . .
-. j j j j j j . % % % % . . . . % % % . d d d # # d . . . . . .
- j j j j j j . . % % % . . . . . % % % . d d d d d d . . . . . .
-j j j # # j j j . . . . . . . . % . % % . d d d d d . . h h . .
j j j j j . . . . . f f . . . . . . % . . d . . d . . . h h . .
-. j j j j . . . . . . f f f f f . . . . . . . . . . . . . h h .
. . . . . . . . f f f f f f f . . . . . . . . . . . . . . h h .
-. . . . . . . . . . f f f f . . . . . c c . . . . . . . . h h h
- h h h . . . . . . f f # # f . . . . . c c c c . . . . . # # h h
-h . . . . . . . . . f f f f f . . . . . c c c . . . % % . h h h
- . . . . . . . . . . . . . f f . . . c # # c . . . . % . h h h h
-h . . . . . . . . . . . . . . . . . c c c c c c . % % % . h h h
- . . . . e e . % % % . . . . . . . . c c c c c . . % % . . . . .
-. . . e e e e . % % . . . . . . . . . c c c c . . . % % . % % .
- . . e # # e . % % . . . . . i . . . . . c c . . . . % . % % % .
-. . e e e e e . % % % . i i i i i . . . . . . . . . . . . . % %
- e e e e e e . % % % % . i i i i i . . . . . . % % % . . % . . .
+% % % . # # # d d # . . . . . . . # # # # # # . % % % % . . . .
+ % % % . # # # # # # . . . . . . # # # # # # . . % % % . . . . .
+% . % % . # # # # # . . # # . . # # # j j # # # . . . . . . . .
+ . . % . . # . . # . . . # # . . # # # # # . . . . . # # . . . .
+. . . . . . . . . . . . . # # . . # # # # . . . . . . # # # # #
+ . . . . . . . . . . . . . # # . . . . . . . . . # # # # # # # .
+. . . # # . . . . . . . . # # # . . . . . . . . . . # # # # . .
+ . . . # # # # . . . . . h h # # # # # . . . . . . # # f f # . .
+. . . . # # # . . . % % . # # # # . . . . . . . . . # # # # # .
+ . . # c c # . . . . % . # # # # . . . . . . . . . . . . . # # .
+. . # # # # # # . % % % . # # # # . . . . . . . . . . . . . . .
+ . . # # # # # . . % % . . . . . . . . . # # . % % % . . . . . .
+. . . # # # # . . . % % . % % . . . . # # # # . % % . . . . . .
+ . . . . # # . . . . % . % % % . . . # e e # . % % . . . . . # .
+# . . . . . . . . . . . . . % % . . # # # # # . % % % . # # # #
+ # . . . . . . % % % . . % . . . # # # # # # . % % % % . # # # #
+# . . . . . % % % % . . . % % . . # # # # # . % % % % . . i i #
+ . . . . . . % % . . . . . % % % . # # # . # . % % % % . # # # #
+. . # # # . . . . . . . . % % % % . . . . . . % % % . . # # # #
. # # # # . . . . . . . % % % % % . % % % % . . . . . . # # # .
+. # # # # # # . . . . % % % . . % . % % % % % % % % . . . # # .
# # # g g # # . % % . % % . # . . % % % . . . % . . . . # # . .
+. # # # # # . . % % . . . . # # # . % % . . # . . # # . . . . %
+ . # # # # . . . . . . # # # # # # . . . . # # # # # . . . . % %
+% . . . . # . . . . . # # b b # # # . . . # # a a . . . . . % %
+ % % % % . . . . . . # # # # # # # . . . # # # # # # . . . % % %
+% % % % % % % . . . . # # # # . . . . . . . # # # # # # . . % %
+ % % % % % . . . . . . . # # . . . . . . . # # # # # # . . . % %
+. . . . . . # . . . . . . . . . . . . . . . . . . . . . . . . .
+ % % % % . . # . . . . . . . . . . . . . . . . . . . . . . . . %
+% % % % . # . # # # . . . . . . . . . . . . . . . . % % % % . .
+ % % % . # # # # # . . . . . . . . . # . . . . . % % % % % . . %
 
 A script for adding all the countries can be found in "sandbox/newcap_script".
 
 A script for adding all the countries can be found in "sandbox/newcap_script".