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

Function mswin_select_map_mode

outdated/sys/wince/mhmain.c:1000–1075  ·  view source on GitHub ↗

Set map display mode */

Source from the content-addressed store, hash-verified

998
999/* Set map display mode */
1000void
1001mswin_select_map_mode(int mode)
1002{
1003 HMENU hmenuMap;
1004 PNHMainWindow data;
1005 winid map_id;
1006
1007 map_id = WIN_MAP;
1008 data = (PNHMainWindow) GetWindowLong(GetNHApp()->hMainWnd, GWL_USERDATA);
1009#if defined(WIN_CE_SMARTPHONE)
1010 /* Smartphone manu has only 2 items */
1011 hmenuMap = _get_main_menu(ID_VIEW);
1012#else
1013 hmenuMap = _get_main_menu(ID_MAP);
1014#endif
1015
1016 /* override for Rogue level */
1017 if (Is_rogue_level(&u.uz) && !IS_MAP_ASCII(mode))
1018 return;
1019
1020 /* set map mode menu mark */
1021 if (IS_MAP_ASCII(mode)) {
1022 CheckMenuRadioItem(hmenuMap, IDM_MAP_TILES, IDM_MAP_FIT_TO_SCREEN,
1023 mapmode2menuid(IS_MAP_FIT_TO_SCREEN(mode)
1024 ? data->mapAcsiiModeSave
1025 : mode),
1026 MF_BYCOMMAND);
1027 } else {
1028 CheckMenuRadioItem(hmenuMap, IDM_MAP_TILES, IDM_MAP_FIT_TO_SCREEN,
1029 mapmode2menuid(MAP_MODE_TILES), MF_BYCOMMAND);
1030 }
1031
1032#if defined(WIN_CE_SMARTPHONE)
1033 /* update "Fit To Screen" item text */
1034 {
1035 TCHAR wbuf[BUFSZ];
1036 TBBUTTONINFO tbbi;
1037
1038 ZeroMemory(wbuf, sizeof(wbuf));
1039 if (!LoadString(GetNHApp()->hApp,
1040 (IS_MAP_FIT_TO_SCREEN(mode) ? IDS_CAP_NORMALMAP
1041 : IDS_CAP_ENTIREMAP),
1042 wbuf, BUFSZ)) {
1043 panic("cannot load main menu strings");
1044 }
1045
1046 ZeroMemory(&tbbi, sizeof(tbbi));
1047 tbbi.cbSize = sizeof(tbbi);
1048 tbbi.dwMask = TBIF_TEXT;
1049 tbbi.pszText = wbuf;
1050 if (!SendMessage(GetNHApp()->hMenuBar, TB_SETBUTTONINFO,
1051 IDM_MAP_FIT_TO_SCREEN, (LPARAM) &tbbi)) {
1052 error("Cannot update IDM_MAP_FIT_TO_SCREEN menu item.");
1053 }
1054 }
1055#else
1056 /* set fit-to-screen mode mark */
1057 CheckMenuItem(hmenuMap, IDM_MAP_FIT_TO_SCREEN,

Callers 4

MainWndProcFunction · 0.70
onMSNHCommandFunction · 0.70
onWMCommandFunction · 0.70
mswin_preference_updateFunction · 0.70

Calls 7

_get_main_menuFunction · 0.85
GetNHAppFunction · 0.70
mapmode2menuidFunction · 0.70
mswin_map_modeFunction · 0.70
mswin_hwnd_from_winidFunction · 0.70
panicFunction · 0.50
errorFunction · 0.50

Tested by

no test coverage detected