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

Function mswin_putstr_ex

win/win32/mswproc.c:1011–1047  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1009}
1010
1011void
1012mswin_putstr_ex(winid wid, int attr, const char *text, int app)
1013{
1014 if ((wid >= 0) && (wid < MAXWINDOWS)) {
1015 if (GetNHApp()->windowlist[wid].win == NULL
1016 && GetNHApp()->windowlist[wid].type == NHW_MENU) {
1017 GetNHApp()->windowlist[wid].win =
1018 mswin_init_menu_window(MENU_TYPE_TEXT);
1019 GetNHApp()->windowlist[wid].dead = 0;
1020 }
1021
1022 if (GetNHApp()->windowlist[wid].win != NULL) {
1023 MSNHMsgPutstr data;
1024
1025 ZeroMemory(&data, sizeof(data));
1026 data.attr = attr;
1027 data.text = text;
1028 data.append = app;
1029 SendMessage(GetNHApp()->windowlist[wid].win, WM_MSNH_COMMAND,
1030 (WPARAM) MSNH_MSG_PUTSTR, (LPARAM) &data);
1031 }
1032 /* yield a bit so it gets done immediately */
1033 mswin_get_nh_event();
1034 } else {
1035 char *was = GetNHApp()->saved_text;
1036
1037 // build text to display later in message box
1038 GetNHApp()->saved_text =
1039 realloc(GetNHApp()->saved_text,
1040 strlen(text) + strlen(GetNHApp()->saved_text) + 1);
1041 if (!GetNHApp()->saved_text) {
1042 free(was);
1043 } else {
1044 strcat(GetNHApp()->saved_text, text);
1045 }
1046 }
1047}
1048
1049/* Display the file named str. Complain about missing files
1050 iff complain is TRUE.

Callers 5

mswin_putstrFunction · 0.70
mswin_yn_functionFunction · 0.70
mswin_getlinFunction · 0.70
mswin_get_ext_cmdFunction · 0.70
mswin_putmsghistoryFunction · 0.70

Calls 3

GetNHAppFunction · 0.70
mswin_init_menu_windowFunction · 0.70
mswin_get_nh_eventFunction · 0.70

Tested by

no test coverage detected