]> git.pond.sub.org Git - empserver/commitdiff
(map, draw_map, MAP_HIGH): New map command flag `h' to highlight own
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 21 Jan 2004 14:54:56 +0000 (14:54 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 21 Jan 2004 14:54:56 +0000 (14:54 +0000)
sectors; from Marc Olzheim.

include/map.h
info/Commands/map.t
src/lib/commands/map.c
src/lib/common/maps.c

index 9eba300917bc80173766f06b25ea57fef9489d0a..6c45786a12137a470da4713502d0c5f861b4487c 100644 (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 {
index 54011d70374d3542676d6d5fe43592bbddb0a1d0..a543ba971997493171e98e97804a769ae4b31406 100644 (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"
index 1b540ac34db7bf2022afe4269907087666f9752a..406807503e1443cb091fd7a88f115273ffac6470 100644 (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;
index 9544a781e7c4a4e7d33c49b7fd4bf87c97a6acd2..6eda23926a9b85e9f2cea35b99dcaf67177b5f53 100644 (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++) {