2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2018, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure, Markus Armbruster
6 * Empire is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * See files README, COPYING and CREDITS in the root of the source
22 * tree for related information and legal notices. It is expected
23 * that future projects/authors will amend these files as needed.
27 * border.c: Create a border around a map
29 * Known contributors to this file:
37 #include "prototypes.h"
41 * space-fill a map or radar scan;
45 blankfill(char *ptr, struct range *range, int size)
51 for (row = 0; row < range->height; row++) {
52 col = (range->width + 1) * (size + 1) / 2 - 1;
57 ptr += MAPWIDTH(size);
62 border(struct range *rp, char *prefstr, char *sep)
64 /* prefixes each line */
65 /* separates the numbers */
69 if ((WORLD_X / 2) >= 100) {
70 if (rp->lx + rp->width > 100 || rp->hx - rp->width < -100) {
75 for (x = rp->lx, n = 0; n < rp->width; n++, x++) {
79 if (x < 0 && x > -100) {
82 posi = (x < 0 ? -x : x) / 100;
93 for (x = rp->lx, n = 0; n < rp->width; n++, x++) {
97 if (x < 0 && x > -10) {
100 posi = (x < 0 ? -x : x) / 10;
109 for (x = rp->lx, n = 0; n < rp->width; n++, x++) {
110 if (x >= WORLD_X / 2)
112 posi = (x < 0 ? -x : x);
113 pr("%s%d", sep, posi % 10);