MCPcopy Create free account
hub / github.com/NetHack/NetHack / tty_ctrl_nhwindow

Function tty_ctrl_nhwindow

win/tty/wintty.c:2849–2911  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2847}
2848
2849win_request_info *
2850tty_ctrl_nhwindow(
2851 winid window UNUSED,
2852 int request,
2853 win_request_info *wri)
2854{
2855#if defined(TTY_PERM_INVENT)
2856 boolean tty_ok /*, show_gold */, inuse_only;
2857 int maxslot;
2858 /* these types are set match the wintty.h field declarations */
2859 long minrow; /* long to match maxrow declaration in wintty.h */
2860 short offx, offy;
2861 long rows, cols, maxrow, maxcol;
2862#endif
2863
2864 if (!wri)
2865 return (win_request_info *) 0;
2866
2867 switch (request) {
2868 case set_mode:
2869 case request_settings:
2870#if defined(TTY_PERM_INVENT)
2871 ttyinvmode = wri->fromcore.invmode;
2872 if (request == set_mode)
2873 break;
2874 /* show_gold = (ttyinvmode & InvShowGold) != 0; */
2875 inuse_only = ((ttyinvmode & InvInUse) != 0);
2876 wri->tocore = zero_tocore;
2877 tty_ok = assesstty(ttyinvmode, &offx, &offy, &rows, &cols, &maxcol,
2878 &minrow, &maxrow);
2879 if (!tty_ok && rows == 0 && cols == 0) {
2880 /* something is terribly wrong, possibly too early in startup */
2881 wri->tocore.tocore_flags |= too_early;
2882 } else {
2883 wri->tocore.needrows = (int) (minrow + 1 + ROWNO + StatusRows());
2884 wri->tocore.needcols = (int) tty_perminv_mincol;
2885 wri->tocore.haverows = (int) ttyDisplay->rows;
2886 wri->tocore.havecols = (int) ttyDisplay->cols;
2887 if (!tty_ok) {
2888#ifdef RESIZABLE
2889 /* terminal isn't big enough right now but player might
2890 * resize it and then use 'm O' to try to set 'perm_invent'
2891 * again
2892 */
2893 wri->tocore.tocore_flags |= too_small;
2894#else
2895 wri->tocore.tocore_flags |= prohibited;
2896#endif
2897 } else {
2898 maxslot = (maxrow - 2) * (!inuse_only ? 2 : 1);
2899 wri->tocore.maxslot = maxslot;
2900 }
2901 }
2902#endif /* TTY_PERM_INVENT */
2903 break;
2904 case set_menu_promptstyle:
2905 tty_menu_promptstyle = wri->fromcore.menu_promptstyle;
2906 break;

Callers

nothing calls this directly

Calls 1

assessttyFunction · 0.85

Tested by

no test coverage detected