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

Function Gem_getlin

outdated/win/gem/wingem1.c:2975–3019  ·  view source on GitHub ↗
(ques, input)

Source from the content-addressed store, hash-verified

2973/************************* getlin *******************************/
2974
2975void
2976Gem_getlin(ques, input)
2977const char *ques;
2978char *input;
2979{
2980 OBJECT *z_ob = zz_oblist[LINEGET];
2981 int d_exit, length;
2982 char *pr[2], *tmp;
2983
2984 if (WIN_MESSAGE != WIN_ERR && Gem_nhwindow[WIN_MESSAGE].gw_window)
2985 mar_display_nhwindow(WIN_MESSAGE);
2986
2987 z_ob[LGPROMPT].ob_type = G_USERDEF;
2988 z_ob[LGPROMPT].ob_spec.userblk = &ub_prompt;
2989 z_ob[LGPROMPT].ob_height = 2 * gr_ch;
2990
2991 length = z_ob[LGPROMPT].ob_width / gr_cw;
2992 if (strlen(ques) > length) {
2993 tmp = ques + length;
2994 while (*tmp != ' ' && tmp >= ques) {
2995 tmp--;
2996 }
2997 if (tmp <= ques)
2998 tmp = ques + length; /* Mar -- Oops, what a word :-) */
2999 pr[0] = ques;
3000 *tmp = 0;
3001 pr[1] = ++tmp;
3002 } else {
3003 pr[0] = ques;
3004 pr[1] = NULL;
3005 }
3006 ub_prompt.ub_parm = (long) pr;
3007
3008 ob_clear_edit(z_ob);
3009 d_exit = xdialog(z_ob, nullstr, NULL, NULL, mar_ob_mapcenter(z_ob), FALSE,
3010 DIALOG_MODE);
3011 Event_Timer(0, 0, TRUE);
3012
3013 if (d_exit == W_CLOSED || d_exit == W_ABANDON
3014 || (d_exit & NO_CLICK) == QLG) {
3015 *input = '\033';
3016 input[1] = 0;
3017 } else
3018 strncpy(input, ob_get_text(z_ob, LGREPLY, 0), length);
3019}
3020
3021/************************* ask_direction *******************************/
3022

Callers 1

Inv_HandlerFunction · 0.85

Calls 2

mar_display_nhwindowFunction · 0.85
mar_ob_mapcenterFunction · 0.85

Tested by

no test coverage detected