Create a window of type "type" which can be NHW_MESSAGE (top line) NHW_STATUS (bottom lines) NHW_MAP (main dungeon) NHW_MENU (inventory or other "corner" windows) NHW_TEXT (help/text, full screen paged window) */
| 702 | NHW_TEXT (help/text, full screen paged window) |
| 703 | */ |
| 704 | winid |
| 705 | mswin_create_nhwindow(int type) |
| 706 | { |
| 707 | winid i = 0; |
| 708 | MSNHMsgAddWnd data; |
| 709 | |
| 710 | logDebug("mswin_create_nhwindow(%d)\n", type); |
| 711 | |
| 712 | /* Return the next available winid |
| 713 | */ |
| 714 | |
| 715 | for (i = 1; i < MAXWINDOWS; i++) |
| 716 | if (GetNHApp()->windowlist[i].win == NULL |
| 717 | && !GetNHApp()->windowlist[i].dead) |
| 718 | break; |
| 719 | if (i == MAXWINDOWS) |
| 720 | panic("ERROR: No windows available...\n"); |
| 721 | |
| 722 | switch (type) { |
| 723 | case NHW_MAP: { |
| 724 | GetNHApp()->windowlist[i].win = mswin_init_map_window(); |
| 725 | GetNHApp()->windowlist[i].type = type; |
| 726 | GetNHApp()->windowlist[i].dead = 0; |
| 727 | break; |
| 728 | } |
| 729 | case NHW_MESSAGE: { |
| 730 | GetNHApp()->windowlist[i].win = mswin_init_message_window(); |
| 731 | GetNHApp()->windowlist[i].type = type; |
| 732 | GetNHApp()->windowlist[i].dead = 0; |
| 733 | break; |
| 734 | } |
| 735 | case NHW_STATUS: { |
| 736 | GetNHApp()->windowlist[i].win = mswin_init_status_window(); |
| 737 | GetNHApp()->windowlist[i].type = type; |
| 738 | GetNHApp()->windowlist[i].dead = 0; |
| 739 | break; |
| 740 | } |
| 741 | case NHW_MENU: { |
| 742 | GetNHApp()->windowlist[i].win = NULL; // will create later |
| 743 | GetNHApp()->windowlist[i].type = type; |
| 744 | GetNHApp()->windowlist[i].dead = 1; |
| 745 | break; |
| 746 | } |
| 747 | case NHW_TEXT: { |
| 748 | GetNHApp()->windowlist[i].win = mswin_init_text_window(); |
| 749 | GetNHApp()->windowlist[i].type = type; |
| 750 | GetNHApp()->windowlist[i].dead = 0; |
| 751 | break; |
| 752 | } |
| 753 | } |
| 754 | |
| 755 | ZeroMemory(&data, sizeof(data)); |
| 756 | data.wid = i; |
| 757 | SendMessage(GetNHApp()->hMainWnd, WM_MSNH_COMMAND, |
| 758 | (WPARAM) MSNH_MSG_ADDWND, (LPARAM) &data); |
| 759 | return i; |
| 760 | } |
| 761 |
no test coverage detected