X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=map.c;fp=map.c;h=2dedb2dcd757efea1e43443d0b5e33dc4fec556a;hb=cccecbe0c0861ecef1cb511378132f9e981056e6;hp=4b948ff699e6329e6ece47827f88c184bbcdf587;hpb=36829587f6a6c375aa2912d955f84871a098c254;p=dungeon1 diff --git a/map.c b/map.c index 4b948ff..2dedb2d 100644 --- a/map.c +++ b/map.c @@ -31,12 +31,68 @@ readmap(char *fname) return map; } +struct map * +getblackmap(void) +{ + struct map *map; + + map = calloc(1, sizeof(struct map)); + map->name = strdup("(BLACK)"); + memset(map->map, BLANKCHAR, sizeof(map->map)); + return map; +} + +void +see(struct map *map, int ypos, int xpos) +{ + int y, x; + + for (y=ypos-SEEDIST; y <= ypos+SEEDIST; y++) { + if (yH) { + continue; + } + for (x=xpos-SEEDIST; x <= xpos+SEEDIST; x++) { + if (x<0 || x>W) { + continue; + } + mvaddch(y, x, map->map[y][x]); + } + } + move(ypos, xpos); +} + +void +freemap(struct map *map) +{ + if (!map) { + return; + } + free(map->name); + free(map); +} + +void +findchar(struct map *map, char c, int *yret, int *xret) +{ + int y, x; + + for (y=0; ymap[y][x] == c) { + *yret = y; + *xret = x; + return; + } + } + } +} + void -showmap(struct map* map) +showmap(struct map *map) { int x, y; - mvprintw(0, 50, "map: %s", map->name); + mvprintw(0, 60, "map: %s", map->name); for (y=T; ymap[y][x]);