Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2018-09-14 18:27:53 -04:00
9 changed files with 88 additions and 40 deletions

View File

@@ -490,6 +490,10 @@ NetHackQtMainWindow::NetHackQtMainWindow(NetHackQtKeyBuffer& ks) :
addToolBar(toolbar);
menubar = menuBar();
QCoreApplication::setOrganizationName("The NetHack DevTeam");
QCoreApplication::setOrganizationDomain("nethack.org");
QCoreApplication::setApplicationName("NetHack");
setWindowTitle("Qt NetHack");
if ( qt_compact_mode )
setWindowIcon(QIcon(QPixmap(nh_icon_small)));

View File

@@ -36,10 +36,11 @@ int qt_compact_mode = 0;
namespace nethack_qt4 {
#define TILEWMIN 1
#define TILEHMIN 1
#define TILEWMIN 6
#define TILEHMIN 6
NetHackQtSettings::NetHackQtSettings(int w, int h) :
settings(),
tilewidth(this),
tileheight(this),
widthlbl("&Width:",this),
@@ -63,9 +64,9 @@ NetHackQtSettings::NetHackQtSettings(int w, int h) :
heightlbl.setBuddy(&tileheight);
tileheight.setRange(TILEHMIN, 128);
default_fontsize=2;
tilewidth.setValue(16);
tileheight.setValue(16);
tilewidth.setValue(settings.value("tilewidth", 16).toInt());
tileheight.setValue(settings.value("tileheight", 16).toInt());
default_fontsize = settings.value("fontsize", 2).toInt();
// Tile/font sizes read from .nethackrc
if (qt_tilewidth != NULL) {
@@ -100,7 +101,7 @@ NetHackQtSettings::NetHackQtSettings(int w, int h) :
fontsize.addItem("Small");
fontsize.addItem("Tiny");
fontsize.setCurrentIndex(default_fontsize);
connect(&fontsize,SIGNAL(activated(int)),this,SIGNAL(fontChanged()));
connect(&fontsize,SIGNAL(activated(int)),this,SLOT(changedFont()));
QGridLayout* grid = new QGridLayout(this);
grid->addWidget(&whichsize, 0, 0, 1, 2);
@@ -126,11 +127,19 @@ NetHackQtGlyphs& NetHackQtSettings::glyphs()
return *theglyphs;
}
void NetHackQtSettings::changedFont()
{
settings.setValue("fontsize", fontsize.currentIndex());
emit fontChanged();
}
void NetHackQtSettings::resizeTiles()
{
int w = tilewidth.value();
int h = tileheight.value();
settings.setValue("tilewidth", tilewidth.value());
settings.setValue("tileheight", tileheight.value());
theglyphs->setSize(w,h);
emit tilesChanged();
}

View File

@@ -33,6 +33,7 @@ public slots:
void setGlyphSize(bool);
private:
QSettings settings;
QSpinBox tilewidth;
QSpinBox tileheight;
QLabel widthlbl;
@@ -48,6 +49,7 @@ private:
private slots:
void resizeTiles();
void changedFont();
};
extern NetHackQtSettings* qt_settings;

View File

@@ -3837,7 +3837,8 @@ int *topsz, *bottomsz;
tty_status[NOW][idx].y = row;
tty_status[NOW][idx].x = col;
/* evaluate */
/* On a change to the field length, everything
further to the right must be updated as well */
if (tty_status[NOW][idx].lth != tty_status[BEFORE][idx].lth)
update_right = TRUE;
@@ -4129,16 +4130,11 @@ render_status(VOID_ARGS)
for (i = 0; fieldorder[row][i] != BL_FLUSH; ++i) {
int fldidx = fieldorder[row][i];
if (do_field_opt && !tty_status[NOW][fldidx].redraw)
continue;
/*
* Ignore zero length fields. check_fields() didn't count
* them in either.
*/
if (!tty_status[NOW][fldidx].lth && fldidx != BL_CONDITION)
if (!status_activefields[fldidx])
continue;
if (status_activefields[fldidx]) {
if ((tty_status[NOW][fldidx].lth || fldidx == BL_CONDITION)
&& (tty_status[NOW][fldidx].redraw || !do_field_opt)) {
int coloridx = tty_status[NOW][fldidx].color;
int attridx = tty_status[NOW][fldidx].attr;
int x = tty_status[NOW][fldidx].x;
@@ -4296,15 +4292,16 @@ render_status(VOID_ARGS)
End_Attr(attridx);
}
}
/* reset .redraw and .dirty now that they've been rendered */
tty_status[NOW][fldidx].dirty = FALSE;
tty_status[NOW][fldidx].redraw = FALSE;
/*
* Make a copy of the entire tty_status struct for comparison
* of current and previous.
*/
tty_status[BEFORE][fldidx] = tty_status[NOW][fldidx];
}
/* reset .redraw and .dirty now that they've been rendered */
tty_status[NOW][fldidx].dirty = FALSE;
tty_status[NOW][fldidx].redraw = FALSE;
/*
* Make a copy of the entire tty_status struct for comparison
* of current and previous.
*/
tty_status[BEFORE][fldidx] = tty_status[NOW][fldidx];
}
}
if (cond_disp_width[NOW] < cond_width_at_shrink) {