(map, draw_map): Remove undocumented feature that lets deities run map

as another country.  It appeared around Chainsaw 3.0 and never fully
worked.  See also #1335316.
This commit is contained in:
Markus Armbruster 2005-10-23 08:32:49 +00:00
parent 01c80490b9
commit f5a1430bcf
5 changed files with 22 additions and 57 deletions

View file

@ -306,7 +306,7 @@ extern void loginit(char *);
extern void logerror(char *, ...) ATTRIBUTE((format (printf, 1, 2))); extern void logerror(char *, ...) ATTRIBUTE((format (printf, 1, 2)));
extern int oops(char *, char *, int); extern int oops(char *, char *, int);
/* maps.c */ /* maps.c */
extern int draw_map(int, s_char, int, struct nstr_sect *, int); extern int draw_map(int, s_char, int, struct nstr_sect *);
extern int unit_map(int, int, struct nstr_sect *, s_char *); extern int unit_map(int, int, struct nstr_sect *, s_char *);
extern int bmaps_intersect(natid, natid); extern int bmaps_intersect(natid, natid);
extern int share_bmap(natid, natid, struct nstr_sect *, s_char, s_char *); extern int share_bmap(natid, natid, struct nstr_sect *, s_char, s_char *);

View file

@ -57,7 +57,6 @@ map(void)
int as_country; int as_country;
int map_flags = 0; int map_flags = 0;
int i; int i;
int where = 2;
s_char what[64]; s_char what[64];
s_char buf[1024]; s_char buf[1024];
@ -103,7 +102,6 @@ map(void)
} }
b = player->argp[2]; b = player->argp[2];
while (b != (s_char *)0 && (*b)) { while (b != (s_char *)0 && (*b)) {
where = 3;
switch (*b) { switch (*b) {
case 's': case 's':
case 'S': case 'S':
@ -124,18 +122,6 @@ map(void)
case '*': case '*':
map_flags |= MAP_ALL; map_flags |= MAP_ALL;
break; break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
where = 2;
break;
case 't': case 't':
if (bmap != EF_BMAP) if (bmap != EF_BMAP)
goto bad_flag; goto bad_flag;
@ -156,15 +142,5 @@ map(void)
b++; b++;
} }
as_country = player->cnum; return draw_map(bmap, origin, map_flags, &ns);
if (player->god) {
if (player->argp[where] != (s_char *)0) {
as_country = atoi(player->argp[where]);
if ((as_country < 0) || (as_country > MAXNOC)) {
as_country = player->cnum;
}
}
}
return draw_map(bmap, origin, map_flags, &ns, as_country);
} }

View file

@ -118,11 +118,11 @@ march(void)
++cp; ++cp;
if (cp[-1] == 'M') { if (cp[-1] == 'M') {
unit_map(EF_LAND, lnd->lnd_uid, &ns, &origin); unit_map(EF_LAND, lnd->lnd_uid, &ns, &origin);
draw_map(0, origin, 0, &ns, player->cnum); draw_map(0, origin, 0, &ns);
skip = 1; skip = 1;
} else if (cp[-1] == 'B') { } else if (cp[-1] == 'B') {
unit_map(EF_LAND, lnd->lnd_uid, &ns, &origin); unit_map(EF_LAND, lnd->lnd_uid, &ns, &origin);
draw_map(EF_BMAP, origin, 0, &ns, player->cnum); draw_map(EF_BMAP, origin, 0, &ns);
skip = 1; skip = 1;
} else if (cp[-1] == 'f') { } else if (cp[-1] == 'f') {
struct emp_qelem *qp; struct emp_qelem *qp;

View file

@ -140,11 +140,11 @@ navi(void)
++cp; ++cp;
if (cp[-1] == 'M') { if (cp[-1] == 'M') {
unit_map(EF_SHIP, shp->shp_uid, &ns, &origin); unit_map(EF_SHIP, shp->shp_uid, &ns, &origin);
draw_map(0, origin, MAP_SHIP, &ns, player->cnum); draw_map(0, origin, MAP_SHIP, &ns);
skip = 1; skip = 1;
} else if (cp[-1] == 'B') { } else if (cp[-1] == 'B') {
unit_map(EF_SHIP, shp->shp_uid, &ns, &origin); unit_map(EF_SHIP, shp->shp_uid, &ns, &origin);
draw_map(EF_BMAP, origin, MAP_SHIP, &ns, player->cnum); draw_map(EF_BMAP, origin, MAP_SHIP, &ns);
skip = 1; skip = 1;
} else if (cp[-1] == 'f') { } else if (cp[-1] == 'f') {
struct emp_qelem *qp; struct emp_qelem *qp;

View file

@ -52,8 +52,7 @@ static int bmnxtsct(struct nstr_sect *);
static s_char map_char(u_char type, natid own, int owner_or_god); static s_char map_char(u_char type, natid own, int owner_or_god);
int int
draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp, draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp)
int country)
{ {
struct natstr *np; struct natstr *np;
struct range range; struct range range;
@ -98,7 +97,7 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp,
player->command->c_form); player->command->c_form);
player->command->c_flags |= C_MOD; player->command->c_flags |= C_MOD;
} }
np = getnatp(country); np = getnatp(player->cnum);
/* zap any conditionals */ /* zap any conditionals */
nsp->ncond = 0; nsp->ncond = 0;
xyrelrange(np, &nsp->range, &range); xyrelrange(np, &nsp->range, &range);
@ -132,19 +131,16 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp,
{ {
struct sctstr sect; struct sctstr sect;
if ((!player->god || country)) { if (!player->god) {
memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8); memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
bitinit2(nsp, bitmap, country); bitinit2(nsp, bitmap, player->cnum);
} }
while (nxtsct(nsp, &sect) && !player->aborted) { while (nxtsct(nsp, &sect) && !player->aborted) {
if ((!player->god || country) && if (!player->god && !emp_getbit(nsp->x, nsp->y, bitmap))
!emp_getbit(nsp->x, nsp->y, bitmap)) { continue;
if (!player->god)
continue;
}
wmap[nsp->dy][nsp->dx] wmap[nsp->dy][nsp->dx]
= map_char(sect.sct_newtype, sect.sct_own, = map_char(sect.sct_newtype, sect.sct_own,
sect.sct_own == country || player->god); player->owner);
} }
break; break;
} }
@ -154,18 +150,14 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp,
s_char mapch; s_char mapch;
int changed = 0; int changed = 0;
if ((!player->god || country)) { if (!player->god) {
memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8); memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
bitinit2(nsp, bitmap, country); bitinit2(nsp, bitmap, player->cnum);
} }
while (nxtsct(nsp, &sect) && !player->aborted) { while (nxtsct(nsp, &sect) && !player->aborted) {
if ((!player->god || country) if (!player->god && !emp_getbit(nsp->x, nsp->y, bitmap))
&& !emp_getbit(nsp->x, nsp->y, bitmap)) { continue;
if (!player->god) mapch = map_char(sect.sct_type, sect.sct_own, player->owner);
continue;
}
mapch = map_char(sect.sct_type, sect.sct_own,
sect.sct_own == country || player->god);
wmap[nsp->dy][nsp->dx] = mapch; wmap[nsp->dy][nsp->dx] = mapch;
changed |= map_set(player->cnum, nsp->x, nsp->y, mapch, 0); changed |= map_set(player->cnum, nsp->x, nsp->y, mapch, 0);
} }
@ -224,16 +216,13 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp,
struct sctstr sect; struct sctstr sect;
snxtsct_rewind(nsp); snxtsct_rewind(nsp);
if ((!player->god || country)) { if (!player->god) {
memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8); memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
bitinit2(nsp, bitmap, country); bitinit2(nsp, bitmap, player->cnum);
} }
while (nxtsct(nsp, &sect) && !player->aborted) { while (nxtsct(nsp, &sect) && !player->aborted) {
if ((!player->god || country) && if (!player->god && !emp_getbit(nsp->x, nsp->y, bitmap))
!emp_getbit(nsp->x, nsp->y, bitmap)) { continue;
if (!player->god)
continue;
}
ptr = &wmap[nsp->dy][nsp->dx]; ptr = &wmap[nsp->dy][nsp->dx];
if (sect.sct_own == player->cnum) if (sect.sct_own == player->cnum)
*ptr |= 0x80; *ptr |= 0x80;