Qt tiles loading failure
For Qt, if unable to load either nhfiles.bmp or x11tiles, quit after giving the can't-load-tiles feedback instead of continuing on and eventually triggering a segfault.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.250 $ $NHDT-Date: 1595006054 2020/07/17 17:14:14 $
|
||||
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.251 $ $NHDT-Date: 1595102359 2020/07/18 19:59:19 $
|
||||
|
||||
General Fixes and Modified Features
|
||||
-----------------------------------
|
||||
@@ -310,6 +310,7 @@ curses: for vertical status, line up conditions in columns; usually two but
|
||||
used to align entries in their columns--that's a feature...]
|
||||
msdos: add -DSTATUES_LOOK_LIKE_MONSTERS to Makefile1.cross so the VESA mode
|
||||
can display statue glyphs
|
||||
Qt: quit if can't load tiles file instead of continuing and then segfaulting
|
||||
tiles: add indicator of thonged portion to aklys tile
|
||||
tty: role and race selection menus weren't filtering out potential choices
|
||||
which got excluded by OPTIONS=align:!lawful or !neutral or !chaotic
|
||||
|
||||
@@ -25,6 +25,7 @@ extern "C" {
|
||||
#endif
|
||||
#include "qt_post.h"
|
||||
#include "qt_glyph.h"
|
||||
#include "qt_bind.h"
|
||||
#include "qt_set.h"
|
||||
#include "qt_str.h"
|
||||
|
||||
@@ -47,6 +48,7 @@ static int tilefile_tile_H=16;
|
||||
NetHackQtGlyphs::NetHackQtGlyphs()
|
||||
{
|
||||
const char* tile_file = PIXMAPDIR "/nhtiles.bmp";
|
||||
|
||||
if ( iflags.wc_tile_file )
|
||||
tile_file = iflags.wc_tile_file;
|
||||
|
||||
@@ -54,13 +56,17 @@ NetHackQtGlyphs::NetHackQtGlyphs()
|
||||
tile_file = PIXMAPDIR "/x11tiles";
|
||||
if (!img.load(tile_file)) {
|
||||
QString msg;
|
||||
msg.sprintf("Cannot load x11tiles or nhtiles.bmp");
|
||||
|
||||
msg.sprintf("Cannot load 'nhtiles.bmp' or 'x11tiles'.");
|
||||
QMessageBox::warning(0, "IO Error", msg);
|
||||
NetHackQtBind::qt_exit_nhwindows((const char *) 0);
|
||||
nh_terminate(EXIT_FAILURE);
|
||||
} else {
|
||||
tiles_per_row = TILES_PER_ROW;
|
||||
if (img.width()%tiles_per_row) {
|
||||
impossible("Tile file \"%s\" has %d columns, not multiple of row count (%d)",
|
||||
tile_file, img.width(), tiles_per_row);
|
||||
if (img.width() % tiles_per_row) {
|
||||
impossible(
|
||||
"Tile file \"%s\" has %d columns, not multiple of row count (%d)",
|
||||
tile_file, img.width(), tiles_per_row);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user