| 1066 | } |
| 1067 | |
| 1068 | void NetHackQtBind::qt_putmsghistory(const char *msg, boolean is_restoring) |
| 1069 | { |
| 1070 | NetHackQtMessageWindow *window = main->GetMessageWindow(); |
| 1071 | if (!window) |
| 1072 | return; |
| 1073 | |
| 1074 | if (is_restoring && !msgs_initd) { |
| 1075 | /* we're restoring history from the previous session, but new |
| 1076 | messages have already been issued this session */ |
| 1077 | int i = 0; |
| 1078 | const char *str; |
| 1079 | |
| 1080 | while ((str = window->GetStr((bool) (i == 0))) != 0) { |
| 1081 | msgs_strings->append(str); |
| 1082 | i++; |
| 1083 | } |
| 1084 | msgs_initd = true; |
| 1085 | msgs_saved = (i > 0); |
| 1086 | window->ClearMessages(); |
| 1087 | } |
| 1088 | |
| 1089 | if (msg) { |
| 1090 | //raw_printf("msg='%s'", msg); |
| 1091 | window->PutStr(ATR_NONE, QString::fromLatin1(msg)); |
| 1092 | #ifdef DUMPLOG_CORE |
| 1093 | dumplogmsg(msg); |
| 1094 | #endif |
| 1095 | } else if (msgs_saved) { |
| 1096 | /* restore strings */ |
| 1097 | for (int i = 0; i < msgs_strings->size(); ++i) { |
| 1098 | const QString &nxtmsg = msgs_strings->at(i); |
| 1099 | window->PutStr(ATR_NONE, nxtmsg); |
| 1100 | #ifdef DUMPLOG_CORE |
| 1101 | dumplogmsg(nxtmsg.toLatin1().constData()); |
| 1102 | #endif |
| 1103 | } |
| 1104 | delete msgs_strings; |
| 1105 | msgs_initd = false; |
| 1106 | } |
| 1107 | } |
| 1108 | |
| 1109 | // event loop callback |
| 1110 | bool NetHackQtBind::notify(QObject *receiver, QEvent *event) |
nothing calls this directly
no test coverage detected