return NULL;
}
- for (y=0; y<H; y++) {
- for (x=0; x<W; x++) {
+ for (y=0; y<MAPH; y++) {
+ for (x=0; x<MAPW; x++) {
map->map[y][x] = fgetc(fp);
}
if (fgetc(fp) != '\n') {
int x, y;
char c;
- for (y=0; y<H; y++) {
- for (x=0; x<W; x++) {
+ for (y=0; y<MAPH; y++) {
+ for (x=0; x<MAPW; x++) {
c = map->map[y][x];
if (c != '#') {
continue;
map->map[y][x] = getnewchar(map, y, x);
}
}
- for (y=0; y<H; y++) {
- for (x=0; x<W; x++) {
+ for (y=0; y<MAPH; y++) {
+ for (x=0; x<MAPW; x++) {
c = map->map[y][x];
if (c == '#') {
map->map[y][x] = ' ';
l = strchr(WALLCHARS, l) ? '#' : ' ';
r = x+1 > W ? '#' : map->map[y][x+1];
r = strchr(WALLCHARS, r) ? '#' : ' ';
- a = y-1 < T ? '#' : map->map[y-1][x];
+ a = y-1 < 0 ? '#' : map->map[y-1][x];
a = strchr(WALLCHARS, a) ? '#' : ' ';
b = y+1 > H ? '#' : map->map[y+1][x];
b = strchr(WALLCHARS, b) ? '#' : ' ';
int y, x;
for (y=ypos-SEEDIST; y <= ypos+SEEDIST; y++) {
- if (y<T || y>=H) {
+ if (y<0 || y>=MAPH) {
continue;
}
for (x=xpos-SEEDIST; x <= xpos+SEEDIST; x++) {
- if (x<0 || x>=W) {
+ if (x<0 || x>=MAPW) {
continue;
}
- mvaddch(y, x, map->map[y][x]);
+ mvwaddch(w_map, y, x, map->map[y][x]);
}
}
- move(ypos, xpos);
+ wmove(w_map, ypos, xpos);
}
void
{
int y, x;
- for (y=0; y<H; y++) {
- for (x=0; x<W; x++) {
+ for (y=0; y<MAPH; y++) {
+ for (x=0; x<MAPW; x++) {
if (map->map[y][x] == c) {
*yret = y;
*xret = x;
{
int x, y;
- mvprintw(0, 60, "map: %s", map->name);
- for (y=T; y<H; y++) {
- for (x=0; x<W; x++) {
- mvaddch(y, x, map->map[y][x]);
+ mvwprintw(w_info, 1, 20, "map: %s", map->name);
+ for (y=0; y<MAPH; y++) {
+ for (x=0; x<MAPW; x++) {
+ mvwaddch(w_map, y, x, map->map[y][x]);
}
}
}