From: Markus Armbruster Date: Mon, 17 Aug 2020 10:39:04 +0000 (+0200) Subject: fairland: Show a more useful map X-Git-Tag: v4.4.1~155 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=c4441014e33ea24f88ed21915b1bd08f3540c6bc fairland: Show a more useful map 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 --- diff --git a/src/util/fairland.c b/src/util/fairland.c index 69963e1ff..c6eb29b3b 100644 --- a/src/util/fairland.c +++ b/src/util/fairland.c @@ -29,7 +29,7 @@ * Known contributors to this file: * Ken Stevens, 1995 * Steve McClure, 1998 - * Markus Armbruster, 2004-2013 + * Markus Armbruster, 2004-2020 */ #include @@ -1100,17 +1100,20 @@ write_sects(void) static void output(void) { - int i, j; + int sx, sy, x, y; + if (quiet == 0) { - for (i = 0; i < WORLD_Y; ++i) { + for (sy = -WORLD_Y / 2; sy < WORLD_Y / 2; sy++) { + y = YNORM(sy); puts(""); - if (i % 2) + if (y % 2) 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("%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) { - 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])) - iscap = 1; + return numletter[own[x][y] % 62]; 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 ? '%' : '#'; } /*************************************************************************** diff --git a/tests/fairland/fairland.out b/tests/fairland/fairland.out index a0d7a9fe3..bce921431 100644 --- a/tests/fairland/fairland.out +++ b/tests/fairland/fairland.out @@ -22,37 +22,37 @@ adding resources... 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".