| 573 | /* Move text cursor to specified coordinates in the given NetHack window */ |
| 574 | |
| 575 | void |
| 576 | curses_move_cursor(winid wid, int x, int y) |
| 577 | { |
| 578 | int sx, sy, ex, ey; |
| 579 | int xadj = 0; |
| 580 | int yadj = 0; |
| 581 | |
| 582 | #ifndef PDCURSES |
| 583 | WINDOW *win = curses_get_nhwin(MAP_WIN); |
| 584 | #endif |
| 585 | |
| 586 | if (wid != MAP_WIN) { |
| 587 | return; |
| 588 | } |
| 589 | #ifdef PDCURSES |
| 590 | /* PDCurses seems to not handle wmove correctly, so we use move and |
| 591 | physical screen coordinates instead */ |
| 592 | curses_get_window_xy(wid, &xadj, &yadj); |
| 593 | #endif |
| 594 | curs_x = x + xadj; |
| 595 | curs_y = y + yadj; |
| 596 | curses_map_borders(&sx, &sy, &ex, &ey, x, y); |
| 597 | |
| 598 | if (curses_window_has_border(wid)) { |
| 599 | curs_x++; |
| 600 | curs_y++; |
| 601 | } |
| 602 | |
| 603 | if (x >= sx && x <= ex && y >= sy && y <= ey) { |
| 604 | /* map column #0 isn't used; shift column #1 to first screen column */ |
| 605 | curs_x -= (sx + 1); |
| 606 | curs_y -= sy; |
| 607 | #ifdef PDCURSES |
| 608 | move(curs_y, curs_x); |
| 609 | #else |
| 610 | wmove(win, curs_y, curs_x); |
| 611 | #endif |
| 612 | } |
| 613 | } |
| 614 | |
| 615 | /* update the ncurses stdscr cursor to where the cursor in our map is */ |
| 616 | void |
no test coverage detected