From 97fdc3f3e488aed1b2bf8c63f92fd3120900fef1 Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 29 Jan 2019 11:31:41 -0500 Subject: [PATCH 1/3] build bits - mostly for Windows Allow sys/share/random.c to be included in the build always, even if USE_ISAAC64 is defined, by making most of its contents conditional in that case. That avoids Makefile tinkering when going back and forth between USE_ISAAC64 and not during testing. --- sys/share/random.c | 6 ++++++ sys/winnt/Makefile.msc | 8 ++------ win/win32/vs2017/NetHack.vcxproj | 1 + win/win32/vs2017/NetHackW.vcxproj | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/share/random.c b/sys/share/random.c index 6d3d5e45c..cc865c4e5 100644 --- a/sys/share/random.c +++ b/sys/share/random.c @@ -38,6 +38,8 @@ #include "hack.h" +#if defined(USE_ISAAC64) && !defined(RANDOM) +#else #ifdef LIBC_SCCS #ifndef lint static char sccsid[] = "@(#)random.c 5.5 (Berkeley) 7/6/88"; @@ -377,3 +379,7 @@ random() } return (i); } +#endif /* else defined(USE_ISAAC64) && !defined(RANDOM) */ + + + diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 97001da6e..9dd482218 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -129,13 +129,9 @@ OBJ = o # (see pcconf.h). Set to nothing if not used. # -RANDOM = $(OBJ)\isaac64.o -#RANDOM = $(OBJ)\random.o +RANDOM = $(OBJ)\random.o #RANDOM = -BCRYPT= -! IF ("$(RANDOM)"=="$(OBJ)\isaac64.o") BCRYPT=bcrypt.lib -! ENDIF WINPFLAG= -DTILES -DMSWIN_GRAPHICS -DWIN32CON # To store all the level files, @@ -223,7 +219,7 @@ VOBJ10 = $(O)mail.o $(O)makemon.o $(O)mapglyph.o $(O)mcastu.o VOBJ11 = $(O)mhitm.o $(O)mhitu.o $(O)minion.o $(O)mklev.o VOBJ12 = $(O)mkmap.o $(O)mkmaze.o $(O)mkobj.o $(O)mkroom.o VOBJ13 = $(O)mon.o $(O)mondata.o $(O)monmove.o $(O)monst.o -VOBJ14 = $(O)mplayer.o $(O)mthrowu.o $(O)muse.o +VOBJ14 = $(O)mplayer.o $(O)mthrowu.o $(O)muse.o $(O)isaac64.o VOBJ15 = $(O)music.o $(O)o_init.o $(O)objects.o $(O)objnam.o VOBJ16 = $(O)options.o $(O)pager.o $(O)pickup.o $(O)pline.o VOBJ17 = $(O)polyself.o $(O)potion.o $(O)pray.o $(O)priest.o diff --git a/win/win32/vs2017/NetHack.vcxproj b/win/win32/vs2017/NetHack.vcxproj index 3a4412efe..be83d0a86 100644 --- a/win/win32/vs2017/NetHack.vcxproj +++ b/win/win32/vs2017/NetHack.vcxproj @@ -152,6 +152,7 @@ + diff --git a/win/win32/vs2017/NetHackW.vcxproj b/win/win32/vs2017/NetHackW.vcxproj index e801b1583..a50dccb3a 100644 --- a/win/win32/vs2017/NetHackW.vcxproj +++ b/win/win32/vs2017/NetHackW.vcxproj @@ -147,6 +147,7 @@ + TTYSTUB; From f93533128547e70e1bfd47ce806ba4536c93ee8a Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 29 Jan 2019 17:07:00 -0500 Subject: [PATCH 2/3] try fix for Qt4 using a core macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../win/Qt4/qt4inv.cpp:41:26: error: macro "obj_to_glyph" requires 2 arguments, but only 1 given glyph=obj_to_glyph(nhobj); ^ ../win/Qt4/qt4inv.cpp: In member function ‘void nethack_qt4::NetHackQtInvUsageWindow::drawWorn(QPainter&, obj*, int, int, bool)’: ../win/Qt4/qt4inv.cpp:41:8: error: ‘obj_to_glyph’ was not declared in this scope glyph=obj_to_glyph(nhobj); ^ --- win/Qt4/qt4inv.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/Qt4/qt4inv.cpp b/win/Qt4/qt4inv.cpp index f753ad097..6d1a201b4 100644 --- a/win/Qt4/qt4inv.cpp +++ b/win/Qt4/qt4inv.cpp @@ -38,7 +38,7 @@ void NetHackQtInvUsageWindow::drawWorn(QPainter& painter, obj* nhobj, int x, int { short int glyph; if (nhobj) - glyph=obj_to_glyph(nhobj); + glyph=obj_to_glyph(nhobj, rn2_on_display_rng); else if (canbe) glyph=cmap_to_glyph(S_room); else From ccc14a038b3484197c4180bc452d25a2482cc443 Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 29 Jan 2019 17:21:55 -0500 Subject: [PATCH 3/3] more window port code uses of obj_to_glyph() --- win/Qt/qt_win.cpp | 2 +- win/gnome/gnworn.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/win/Qt/qt_win.cpp b/win/Qt/qt_win.cpp index bd281d3c5..28a68207a 100644 --- a/win/Qt/qt_win.cpp +++ b/win/Qt/qt_win.cpp @@ -3461,7 +3461,7 @@ void NetHackQtInvUsageWindow::drawWorn(QPainter& painter, obj* nhobj, int x, int { short int glyph; if (nhobj) - glyph=obj_to_glyph(nhobj); + glyph=obj_to_glyph(nhobj, rn2_on_display_rng); else if (canbe) glyph=cmap_to_glyph(S_room); else diff --git a/win/gnome/gnworn.c b/win/gnome/gnworn.c index 04c4e4772..4d7303d15 100644 --- a/win/gnome/gnworn.c +++ b/win/gnome/gnworn.c @@ -75,7 +75,7 @@ image_of_worn_object(struct obj *o) GdkImlibImage *im; if (o) - glyph = obj_to_glyph(o); + glyph = obj_to_glyph(o, rn2_on_display_rng); else glyph = cmap_to_glyph(S_stone);