(map, draw_map, MAP_HIGH): New map command flag `h' to highlight own

sectors; from Marc Olzheim.
This commit is contained in:
Markus Armbruster 2004-01-21 14:54:56 +00:00
parent 727be2e126
commit f841200923
4 changed files with 28 additions and 1 deletions

View file

@ -52,6 +52,7 @@ extern void border(struct range *, s_char *, s_char *);
#define MAP_SHIP bit(0)
#define MAP_LAND bit(1)
#define MAP_PLANE bit(2)
#define MAP_HIGH bit(3)
#define MAP_ALL MAP_SHIP | MAP_LAND | MAP_PLANE
struct mapstr {

View file

@ -60,6 +60,8 @@ the same for a ship.
.s1
If you give an 's' flag, all your ships will be shown on the map.
An 'l' flag does the same for land units, and a 'p' for planes.
'*' gives all of the above.
'*' shows all in this order: land units, ships, planes.
To highlight sectors owned by yourself, use the 'h' flag.
.s1
.SA "census, commodity, radar, realm, route, update, Maps"

View file

@ -118,6 +118,10 @@ map(void)
case 'P':
map_flags |= MAP_PLANE;
break;
case 'h':
case 'H':
map_flags |= MAP_HIGH;
break;
case '*':
map_flags |= MAP_ALL;
break;

View file

@ -259,6 +259,26 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp,
wmap[y][x] = (*lchr[(int)land.lnd_type].l_name) & ~0x20;
}
}
if (map_flags & MAP_HIGH) {
register s_char *ptr;
struct sctstr sect;
snxtsct_rewind(nsp);
if ((!player->god || country)) {
memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
bitinit2(nsp, bitmap, country);
}
while (nxtsct(nsp, &sect) && !player->aborted) {
if ((!player->god || country) &&
!emp_getbit(nsp->x, nsp->y, bitmap)) {
if (!player->god)
continue;
}
ptr = &wmap[nsp->dy][nsp->dx];
if (sect.sct_own == player->cnum)
*ptr |= 0x80;
}
}
if (origin)
wmap[5][10] = origin & ~0x20;
for (y = nsp->range.ly, i = 0; i < nsp->range.height; y++, i++) {