Qt on Win32: changes needed for Win32
* Fix an include directory * Use strchr instead of index * play_usersound conflicts with another function
This commit is contained in:
committed by
Pasi Kallinen
parent
7de9266b04
commit
3479c471dd
+8
-6
@@ -18,7 +18,7 @@ extern "C" {
|
|||||||
#undef max
|
#undef max
|
||||||
|
|
||||||
#include <QtGui/QtGui>
|
#include <QtGui/QtGui>
|
||||||
#include <QStringList>
|
#include <QtCore/QStringList>
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWidgets/QtWidgets>
|
#include <QtWidgets/QtWidgets>
|
||||||
#include <QtMultimedia/QSound>
|
#include <QtMultimedia/QSound>
|
||||||
@@ -350,9 +350,9 @@ void NetHackQtBind::qt_display_file(const char *filename, BOOLEAN_P must_exist)
|
|||||||
complain = must_exist;
|
complain = must_exist;
|
||||||
} else {
|
} else {
|
||||||
while (dlb_fgets(buf, BUFSZ, f)) {
|
while (dlb_fgets(buf, BUFSZ, f)) {
|
||||||
if ((cr = index(buf, '\n')) != 0) *cr = 0;
|
if ((cr = strchr(buf, '\n')) != 0) *cr = 0;
|
||||||
#ifdef MSDOS
|
#ifdef MSDOS
|
||||||
if ((cr = index(buf, '\r')) != 0) *cr = 0;
|
if ((cr = strchr(buf, '\r')) != 0) *cr = 0;
|
||||||
#endif
|
#endif
|
||||||
window->PutStr(ATR_NONE, tabexpand(buf));
|
window->PutStr(ATR_NONE, tabexpand(buf));
|
||||||
}
|
}
|
||||||
@@ -508,8 +508,8 @@ char NetHackQtBind::qt_yn_function(const char *question_, const char *choices, C
|
|||||||
message = QString("%1 [%2] ").arg(question, choicebuf);
|
message = QString("%1 [%2] ").arg(question, choicebuf);
|
||||||
if (def) message += QString("(%1) ").arg(QChar(def));
|
if (def) message += QString("(%1) ").arg(QChar(def));
|
||||||
// escape maps to 'q' or 'n' or default, in that order
|
// escape maps to 'q' or 'n' or default, in that order
|
||||||
yn_esc_map = (index(choices, 'q') ? 'q' :
|
yn_esc_map = (strchr(choices, 'q') ? 'q' :
|
||||||
(index(choices, 'n') ? 'n' : def));
|
(strchr(choices, 'n') ? 'n' : def));
|
||||||
} else {
|
} else {
|
||||||
message = question;
|
message = question;
|
||||||
}
|
}
|
||||||
@@ -542,7 +542,7 @@ char NetHackQtBind::qt_yn_function(const char *question_, const char *choices, C
|
|||||||
char ch=NetHackQtBind::qt_nhgetch();
|
char ch=NetHackQtBind::qt_nhgetch();
|
||||||
if (ch=='\033') {
|
if (ch=='\033') {
|
||||||
result=yn_esc_map;
|
result=yn_esc_map;
|
||||||
} else if (choices && !index(choices,ch)) {
|
} else if (choices && !strchr(choices,ch)) {
|
||||||
if (def && (ch==' ' || ch=='\r' || ch=='\n')) {
|
if (def && (ch==' ' || ch=='\r' || ch=='\n')) {
|
||||||
result=def;
|
result=def;
|
||||||
} else {
|
} else {
|
||||||
@@ -800,6 +800,7 @@ struct window_procs Qt_procs = {
|
|||||||
genl_can_suspend_yes,
|
genl_can_suspend_yes,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
extern "C" void play_usersound(const char* filename, int volume)
|
extern "C" void play_usersound(const char* filename, int volume)
|
||||||
{
|
{
|
||||||
#ifdef USER_SOUNDS
|
#ifdef USER_SOUNDS
|
||||||
@@ -808,3 +809,4 @@ extern "C" void play_usersound(const char* filename, int volume)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user