* returns TRUE if things are ok */
| 3555 | * returns TRUE if things are ok |
| 3556 | */ |
| 3557 | static boolean |
| 3558 | assesstty( |
| 3559 | enum inv_modes invmode, |
| 3560 | short *offx, short *offy, long *rows, long *cols, |
| 3561 | long *maxcol, long *minrow, long *maxrow) |
| 3562 | { |
| 3563 | boolean inuse_only = ((int) invmode & (int) InvInUse) != 0, |
| 3564 | show_gold = ((int) invmode & (int) InvShowGold) != 0 |
| 3565 | && !inuse_only; |
| 3566 | int perminv_minrow = tty_perminv_minrow + (show_gold ? 1 : 0); |
| 3567 | |
| 3568 | if (!ttyDisplay) { |
| 3569 | /* too early */ |
| 3570 | *offx = *offy = *rows = *cols = 0; |
| 3571 | *maxcol = 0; |
| 3572 | *minrow = *maxrow = 0; |
| 3573 | return !(*rows < perminv_minrow || *cols < tty_perminv_mincol); |
| 3574 | } |
| 3575 | |
| 3576 | *offx = 0; |
| 3577 | /* topline + map rows + status lines */ |
| 3578 | *offy = 1 + ROWNO + StatusRows(); /* 1 + 21 + (2 or 3) */ |
| 3579 | *rows = (ttyDisplay->rows - *offy); |
| 3580 | *cols = ttyDisplay->cols; |
| 3581 | *minrow = perminv_minrow; |
| 3582 | #define SMALL_INUSE_WINDOW |
| 3583 | #ifdef SMALL_INUSE_WINDOW |
| 3584 | #undef SMALL_INUSE_WINDOW |
| 3585 | /* simplify testing by not requiring a small font to have enough room */ |
| 3586 | if (inuse_only) |
| 3587 | *minrow = 1 + 8 + 1; |
| 3588 | #else |
| 3589 | /* "normal" max for items in use would be 3 weapon + 7 armor + 4 |
| 3590 | accessories == 14, but lit lamps/candles and attached leashes are |
| 3591 | also included; if hero ends up with more than 15 in-use items, |
| 3592 | some will be left out */ |
| 3593 | if (inuse_only) |
| 3594 | *minrow = 1 + 15 + 1; /* top border + 15 lines + bottom border */ |
| 3595 | #endif |
| 3596 | *maxrow = min(*rows, perminv_minrow); |
| 3597 | *maxcol = *cols; |
| 3598 | return !(*rows < *minrow || *cols < tty_perminv_mincol); |
| 3599 | } |
| 3600 | |
| 3601 | |
| 3602 | #endif /* TTY_PERM_INVENT */ |
no outgoing calls
no test coverage detected