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

Function Inv_Handler

outdated/win/gem/wingem1.c:1878–2045  ·  view source on GitHub ↗
(xev)

Source from the content-addressed store, hash-verified

1876
1877static long count = 0;
1878int
1879Inv_Handler(xev)
1880XEVENT *xev;
1881{
1882 int ev = xev->ev_mwich;
1883 Gem_menu_item *it;
1884 GRECT area;
1885 OBJECT *z_ob = zz_oblist[LINES];
1886
1887 ob_pos(z_ob, LINESLIST, &area);
1888 if (ev & MU_MESAG) {
1889 int *buf = xev->ev_mmgpbuf, y_wo, i;
1890
1891 if (*buf == FONT_CHANGED) {
1892 if (buf[3] >= 0) {
1893 mar_set_fontbyid(NHW_MENU, buf[4], buf[5]);
1894 FontAck(buf[1], 1);
1895 }
1896 } else if (*buf == OBJC_CHANGED && buf[3] == LINESLIST) {
1897 ob_undostate(z_ob, LINESLIST, SELECTED);
1898 mouse(NULL, &y_wo);
1899 y_wo = (y_wo - area.g_y) / menu_font.ch + scroll_menu.vpos;
1900 for (it = invent_list, i = 0; i < y_wo && it;
1901 it = it->Gmi_next, i++)
1902 ;
1903 if (it->Gmi_identifier) {
1904 it->Gmi_selected = !it->Gmi_selected;
1905 it->Gmi_count = count == 0L ? -1L : count;
1906 count = 0L;
1907 if (Inv_how != PICK_ANY) {
1908 /*my_close_dialog(Inv_dialog,TRUE);*/
1909 send_return();
1910 } else {
1911 area.g_x = (area.g_x + 23 + 2 * menu_font.cw) & ~7;
1912 area.g_w = menu_font.cw;
1913 area.g_h = menu_font.ch;
1914 area.g_y += (y_wo - scroll_menu.vpos) * menu_font.ch;
1915 ob_draw_chg(Inv_dialog, LINESLIST, &area, FAIL);
1916 } /* how != PICK_ANY */
1917 } /* identifier */
1918 } else /* LINESLIST changed */
1919 ev &= ~MU_MESAG; /* unknown message not used */
1920 } /* MU_MESAG */
1921
1922 if (ev & MU_KEYBD) {
1923 char ch = (char) (xev->ev_mkreturn & 0x00FF);
1924
1925 if (!scroll_top_dialog(ch)) {
1926 switch (ch) {
1927 case '0': /* special 0 is also groupaccelerator for balls */
1928 if (count <= 0)
1929 goto find_acc;
1930 case '1':
1931 case '2':
1932 case '3':
1933 case '4':
1934 case '5':
1935 case '6':

Callers

nothing calls this directly

Calls 9

mar_set_fontbyidFunction · 0.85
send_returnFunction · 0.85
scroll_top_dialogFunction · 0.85
my_close_dialogFunction · 0.85
Gem_getlinFunction · 0.85
clipbrd_saveFunction · 0.85
unset_all_on_pageFunction · 0.70
set_all_on_pageFunction · 0.70
invert_all_on_pageFunction · 0.70

Tested by

no test coverage detected