Allow MICRO and WIN32 code paths to diverge

There's still a lot of overlap for 3.4.1, but not
100% any longer and it facilitates some improvements
- Allow error save files on WIN32
This commit is contained in:
nethack.allison
2002-03-30 19:09:56 +00:00
parent c49130e5bd
commit 51f9892b3b
18 changed files with 84 additions and 72 deletions

View File

@@ -19,7 +19,7 @@ STATIC_DCL void NDECL(do_positionbar);
void
moveloop()
{
#ifdef MICRO
#if defined(MICRO) || defined(WIN32)
char ch;
int abort_lev;
#endif
@@ -315,7 +315,7 @@ moveloop()
flags.move = 1;
if(multi >= 0 && occupation) {
#ifdef MICRO
#if defined(MICRO) || defined(WIN32)
abort_lev = 0;
if (kbhit()) {
if ((ch = Getchar()) == ABORT)
@@ -331,14 +331,14 @@ moveloop()
#endif
occupation = 0;
if(
#ifdef MICRO
#if defined(MICRO) || defined(WIN32)
abort_lev ||
#endif
monster_nearby()) {
stop_occupation();
reset_eat();
}
#ifdef MICRO
#if defined(MICRO) || defined(WIN32)
if (!(++occtime % 7))
display_nhwindow(WIN_MAP, FALSE);
#endif

View File

@@ -56,7 +56,7 @@ register unsigned int lth;
#if defined(MONITOR_HEAP) || defined(WIZARD)
# ifdef MICRO
# if defined(MICRO) || defined(WIN32)
/* we actually want to know which systems have an ANSI run-time library
* to know which support the new %p format for printing pointers.
* due to the presence of things like gcc, NHSTDC is not a good test.

View File

@@ -77,10 +77,12 @@ NEARDATA long yn_number = 0L;
const char disclosure_options[] = "iavgc";
#ifdef MICRO
#if defined(MICRO) || defined(WIN32)
char hackdir[PATHLEN]; /* where rumors, help, record are */
# ifdef MICRO
char levels[PATHLEN]; /* where levels are */
#endif /* MICRO */
# endif
#endif /* MICRO || WIN32 */
#ifdef MFLOPPY

View File

@@ -240,6 +240,10 @@ register struct monst *mtmp;
return;
}
#if defined(WIN32)
#define NOTIFY_NETHACK_BUGS
#endif
/*VARARGS1*/
void
panic VA_DECL(const char *, str)
@@ -260,15 +264,25 @@ panic VA_DECL(const char *, str)
"Program initialization has failed." :
"Suddenly, the dungeon collapses.");
#if defined(WIZARD) && !defined(MICRO)
# if defined(NOTIFY_NETHACK_BUGS)
if (!wizard)
raw_printf("Report error to \"%s\".\n%s.\n",
"nethack-bugs@nethack.org",
!program_state.something_worth_saving ? "" :
"An error save file will be created.\n");
else if (program_state.something_worth_saving)
raw_print("\nAn error save file will be created.\n");
# else
if (!wizard)
raw_printf("Report error to \"%s\"%s.",
# ifdef WIZARD_NAME /*(KR1ED)*/
# ifdef WIZARD_NAME /*(KR1ED)*/
WIZARD_NAME,
# else
# else
WIZARD,
# endif
# endif
!program_state.something_worth_saving ? "" :
" and it may be possible to rebuild.");
# endif
if (program_state.something_worth_saving) {
set_error_savefile();
(void) dosave0();

View File

@@ -238,7 +238,7 @@ int lev;
set_levelfile_name(lock, lev);
fq_lock = fqname(lock, LEVELPREFIX, 0);
#if defined(MICRO)
#if defined(MICRO) || defined(WIN32)
/* Use O_TRUNC to force the file to be shortened if it already
* exists and is currently longer.
*/
@@ -249,7 +249,7 @@ int lev;
# else
fd = creat(fq_lock, FCMASK);
# endif
#endif /* MICRO */
#endif /* MICRO || WIN32 */
if (fd >= 0)
level_info[lev].flags |= LFILE_EXISTS;
@@ -377,7 +377,7 @@ char **bonesid;
file = set_bonestemp_name();
file = fqname(file, BONESPREFIX, 0);
#ifdef MICRO
#if defined(MICRO) || defined(WIN32)
/* Use O_TRUNC to force the file to be shortened if it already
* exists and is currently longer.
*/
@@ -399,7 +399,7 @@ char **bonesid;
*/
(void) chmod(file, FCMASK | 007); /* allow other users full access */
# endif /* VMS && !SECURE */
#endif /* MICRO */
#endif /* MICRO || WIN32*/
return fd;
}
@@ -499,7 +499,7 @@ set_savefile_name()
regularize(SAVEF+7);
Strcat(SAVEF, ";1");
#else
# if defined(MICRO) && !defined(WIN32)
# if defined(MICRO)
Strcpy(SAVEF, SAVEP);
# ifdef AMIGA
strncat(SAVEF, bbs_id, PATHLEN);
@@ -566,7 +566,7 @@ create_savefile()
int fd;
fq_save = fqname(SAVEF, SAVEPREFIX, 0);
#ifdef MICRO
#if defined(MICRO) || defined(WIN32)
fd = open(fq_save, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, FCMASK);
#else
# ifdef MAC
@@ -1112,7 +1112,7 @@ const char *filename;
}
}
#if defined(MICRO) || defined(MAC) || defined(__BEOS__)
#if defined(MICRO) || defined(MAC) || defined(__BEOS__) || defined(WIN32)
if ((fp = fopenp(fqname(configfile, CONFIGPREFIX, 0), "r"))
!= (FILE *)0)
return(fp);
@@ -1538,7 +1538,7 @@ const char *filename;
#define tmp_levels (char *)0
#define tmp_ramdisk (char *)0
#ifdef MICRO
#if defined(MICRO) || defined(WIN32)
#undef tmp_levels
char tmp_levels[PATHLEN];
# ifdef MFLOPPY
@@ -1553,7 +1553,7 @@ const char *filename;
if (!(fp = fopen_config_file(filename))) return;
#ifdef MICRO
#if defined(MICRO) || defined(WIN32)
# ifdef MFLOPPY
# ifndef AMIGA
tmp_ramdisk[0] = 0;
@@ -1735,7 +1735,7 @@ const char *dir;
wait_synch();
}
#endif /* !UNIX && !VMS */
#ifdef MICRO
#if defined(MICRO) || defined(WIN32)
char tmp[PATHLEN];
# ifdef OS2_CODEVIEW /* explicit path on opening for OS/2 */
@@ -1768,7 +1768,7 @@ const char *dir;
(void) close(fd);
} else /* open succeeded */
(void) close(fd);
#else /* MICRO */
#else /* MICRO || WIN32*/
# ifdef MAC
/* Create the "record" file, if necessary */
@@ -1777,7 +1777,7 @@ const char *dir;
if (fd != -1) macclose (fd);
# endif /* MAC */
#endif /* MICRO */
#endif /* MICRO || WIN32*/
}
/* ---------- END SCOREBOARD CREATION ----------- */

View File

@@ -62,7 +62,7 @@ static struct Bool_Opt
#else
{"checkspace", (boolean *)0, FALSE, SET_IN_FILE},
#endif
# ifdef MICRO
# if defined(MICRO) || defined(WIN32)
{"color", &iflags.wc_color,TRUE, SET_IN_GAME}, /*WC*/
# else /* systems that support multiple terminals, many monochrome */
{"color", &iflags.wc_color, FALSE, SET_IN_GAME}, /*WC*/
@@ -144,7 +144,7 @@ static struct Bool_Opt
{"prayconfirm", &flags.prayconfirm, TRUE, SET_IN_GAME},
{"preload_tiles", &iflags.wc_preload_tiles, TRUE, DISP_IN_GAME}, /*WC*/
{"pushweapon", &flags.pushweapon, FALSE, SET_IN_GAME},
#if defined(MICRO) && !defined(AMIGA) && !defined(MSWIN_GRAPHICS)
#if defined(MICRO) && !defined(AMIGA)
{"rawio", &iflags.rawio, FALSE, DISP_IN_GAME},
#else
{"rawio", (boolean *)0, FALSE, SET_IN_FILE},
@@ -2198,7 +2198,7 @@ map_menu_cmd(ch)
}
#if defined(MICRO) || defined(MAC)
#if defined(MICRO) || defined(MAC) || defined(WIN32)
# define OPTIONS_HEADING "OPTIONS"
#else
# define OPTIONS_HEADING "NETHACKOPTIONS"

View File

@@ -6,7 +6,7 @@
#include "lev.h"
#include "tcap.h" /* for TERMLIB and ASCIIGRAPH */
#ifdef MICRO
#if defined(MICRO)
extern int dotcnt; /* shared with save */
extern int dotrow; /* shared with save */
#endif

View File

@@ -37,7 +37,7 @@ static long final_fpos;
#define POINTSMIN 1 /* must be > 0 */
#define ENTRYMAX 100 /* must be >= 10 */
#if !defined(MICRO) && !defined(MAC)
#if !defined(MICRO) && !defined(MAC) && !defined(WIN32)
#define PERS_IS_UID /* delete for PERSMAX per name; now per uid */
#endif
struct toptenentry {