/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2004, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
*
* ---
*
- * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- * related information and legal notices. It is expected that any future
- * projects/authors will amend these files as needed.
+ * See files README, COPYING and CREDITS in the root of the source
+ * tree for related information and legal notices. It is expected
+ * that future projects/authors will amend these files as needed.
*
* ---
*
* border.c: Create a border around a map
- *
+ *
* Known contributors to this file:
- *
+ *
*/
-#include "misc.h"
-#include "nat.h"
-#include "file.h"
-#include "xy.h"
-#include "prototypes.h"
+#include <config.h>
+
+#include "map.h"
#include "optlist.h"
+#include "prototypes.h"
+#include "xy.h"
+
+/*
+ * space-fill a map or radar scan;
+ * null terminate
+ */
+void
+blankfill(char *ptr, struct range *range, int size)
+{
+ char *p;
+ int row;
+ int col;
+
+ for (row = 0; row < range->height; row++) {
+ col = (range->width + 1) * (size + 1) / 2 - 1;
+ p = ptr;
+ while (--col >= 0)
+ *p++ = ' ';
+ *p++ = 0;
+ ptr += MAPWIDTH(size);
+ }
+}
void
-border(struct range *rp, s_char *prefstr, s_char *sep)
+border(struct range *rp, char *prefstr, char *sep)
/* prefixes each line */
/* separates the numbers */
{
- register int posi;
- register int n;
- register int x;
+ int posi, n, x;
if ((WORLD_X / 2) >= 100) {
- if (rp->lx + rp->width > 99 || rp->hx - rp->width < -99) {
+ if (rp->lx + rp->width > 100 || rp->hx - rp->width < -100) {
/*
* hundreds
*/
- pr(prefstr);
+ pr("%s", prefstr);
for (x = rp->lx, n = 0; n < rp->width; n++, x++) {
if (x >= WORLD_X / 2)
x -= WORLD_X;
- pr(sep);
+ pr("%s", sep);
if (x < 0 && x > -100) {
pr("-");
} else {
/*
* tens
*/
- pr(prefstr);
+ pr("%s", prefstr);
for (x = rp->lx, n = 0; n < rp->width; n++, x++) {
if (x >= WORLD_X / 2)
x -= WORLD_X;
- pr(sep);
+ pr("%s", sep);
if (x < 0 && x > -10) {
pr("-");
} else {
/*
* units...
*/
- pr(prefstr);
+ pr("%s", prefstr);
for (x = rp->lx, n = 0; n < rp->width; n++, x++) {
if (x >= WORLD_X / 2)
x -= WORLD_X;