Merge branch 'master' of https://rodney.nethack.org:20040/git/NHsource
This commit is contained in:
@@ -1952,6 +1952,8 @@ new players if it detects some anticipated mistakes (default on).
|
||||
.lp "confirm "
|
||||
Have user confirm attacks on pets, shopkeepers, and other
|
||||
peaceable creatures (default on).
|
||||
.lp dark_room
|
||||
Show out-of-sight areas of lit rooms (default off).
|
||||
.lp disclose
|
||||
Controls what information the program reveals when the game ends.
|
||||
Value is a space separated list of prompting/category pairs
|
||||
|
||||
@@ -2363,6 +2363,9 @@ players if it detects some anticipated mistakes (default on).
|
||||
Have user confirm attacks on pets, shopkeepers, and other
|
||||
peaceable creatures (default on).
|
||||
%.lp
|
||||
%.lp
|
||||
\item[\ib{dark\_room}]
|
||||
Show out-of-sight areas of lit rooms (default off).
|
||||
\item[\ib{disclose}]
|
||||
Controls what information the program reveals when the game ends.
|
||||
Value is a space separated list of prompting/category pairs
|
||||
|
||||
@@ -1151,6 +1151,7 @@ adopt/adapt/improve the Paranoid_Quit patch; default is paranoid_confirm:pray
|
||||
adopt/adapt/improve Dungeon Overview
|
||||
Aardvark Joe's Extended Logfile
|
||||
Michael Deutschmann's use_darkgray
|
||||
Clive Crous' dark_room
|
||||
|
||||
|
||||
Code Cleanup and Reorganization
|
||||
|
||||
@@ -743,6 +743,7 @@ E boolean NDECL(recover_savefile);
|
||||
#ifdef SYSCF_FILE
|
||||
E void NDECL(assure_syscf_file);
|
||||
#endif
|
||||
E int FDECL(nhclose, (int));
|
||||
#ifdef HOLD_LOCKFILE_OPEN
|
||||
E void NDECL(really_close);
|
||||
#endif
|
||||
|
||||
@@ -23,6 +23,7 @@ struct flag {
|
||||
boolean biff; /* enable checking for mail */
|
||||
boolean bones; /* allow saving/loading bones */
|
||||
boolean confirm; /* confirm before hitting tame monsters */
|
||||
boolean dark_room; /* show shadows in lit rooms */
|
||||
boolean debug; /* in debugging mode */
|
||||
#define wizard flags.debug
|
||||
boolean end_own; /* list all own scores */
|
||||
|
||||
156
include/rm.h
156
include/rm.h
@@ -128,98 +128,102 @@
|
||||
#define S_bars 17 /* KMH -- iron bars */
|
||||
#define S_tree 18 /* KMH */
|
||||
#define S_room 19
|
||||
#define S_corr 20
|
||||
#define S_litcorr 21
|
||||
#define S_upstair 22
|
||||
#define S_dnstair 23
|
||||
#define S_upladder 24
|
||||
#define S_dnladder 25
|
||||
#define S_altar 26
|
||||
#define S_grave 27
|
||||
#define S_throne 28
|
||||
#define S_sink 29
|
||||
#define S_fountain 30
|
||||
#define S_pool 31
|
||||
#define S_ice 32
|
||||
#define S_lava 33
|
||||
#define S_vodbridge 34
|
||||
#define S_hodbridge 35
|
||||
#define S_vcdbridge 36 /* closed drawbridge, vertical wall */
|
||||
#define S_hcdbridge 37 /* closed drawbridge, horizontal wall */
|
||||
#define S_air 38
|
||||
#define S_cloud 39
|
||||
#define S_water 40
|
||||
#define S_darkroom 20
|
||||
#define S_corr 21
|
||||
#define S_litcorr 22
|
||||
#define S_upstair 23
|
||||
#define S_dnstair 24
|
||||
#define S_upladder 25
|
||||
#define S_dnladder 26
|
||||
#define S_altar 27
|
||||
#define S_grave 28
|
||||
#define S_throne 29
|
||||
#define S_sink 30
|
||||
#define S_fountain 31
|
||||
#define S_pool 32
|
||||
#define S_ice 33
|
||||
#define S_lava 34
|
||||
#define S_vodbridge 35
|
||||
#define S_hodbridge 36
|
||||
#define S_vcdbridge 37 /* closed drawbridge, vertical wall */
|
||||
#define S_hcdbridge 38 /* closed drawbridge, horizontal wall */
|
||||
#define S_air 39
|
||||
#define S_cloud 40
|
||||
#define S_water 41
|
||||
|
||||
/* end dungeon characters, begin traps */
|
||||
|
||||
#define S_arrow_trap 41
|
||||
#define S_dart_trap 42
|
||||
#define S_falling_rock_trap 43
|
||||
#define S_squeaky_board 44
|
||||
#define S_bear_trap 45
|
||||
#define S_land_mine 46
|
||||
#define S_rolling_boulder_trap 47
|
||||
#define S_sleeping_gas_trap 48
|
||||
#define S_rust_trap 49
|
||||
#define S_fire_trap 50
|
||||
#define S_pit 51
|
||||
#define S_spiked_pit 52
|
||||
#define S_hole 53
|
||||
#define S_trap_door 54
|
||||
#define S_teleportation_trap 55
|
||||
#define S_level_teleporter 56
|
||||
#define S_magic_portal 57
|
||||
#define S_web 58
|
||||
#define S_statue_trap 59
|
||||
#define S_magic_trap 60
|
||||
#define S_anti_magic_trap 61
|
||||
#define S_polymorph_trap 62
|
||||
#define S_arrow_trap 42
|
||||
#define S_dart_trap 43
|
||||
#define S_falling_rock_trap 44
|
||||
#define S_squeaky_board 45
|
||||
#define S_bear_trap 46
|
||||
#define S_land_mine 47
|
||||
#define S_rolling_boulder_trap 48
|
||||
#define S_sleeping_gas_trap 49
|
||||
#define S_rust_trap 50
|
||||
#define S_fire_trap 51
|
||||
#define S_pit 52
|
||||
#define S_spiked_pit 53
|
||||
#define S_hole 54
|
||||
#define S_trap_door 55
|
||||
#define S_teleportation_trap 56
|
||||
#define S_level_teleporter 57
|
||||
#define S_magic_portal 58
|
||||
#define S_web 59
|
||||
#define S_statue_trap 60
|
||||
#define S_magic_trap 61
|
||||
#define S_anti_magic_trap 62
|
||||
#define S_polymorph_trap 63
|
||||
|
||||
/* end traps, begin special effects */
|
||||
|
||||
#define S_vbeam 63 /* The 4 zap beam symbols. Do NOT separate. */
|
||||
#define S_hbeam 64 /* To change order or add, see function */
|
||||
#define S_lslant 65 /* zapdir_to_glyph() in display.c. */
|
||||
#define S_rslant 66
|
||||
#define S_digbeam 67 /* dig beam symbol */
|
||||
#define S_flashbeam 68 /* camera flash symbol */
|
||||
#define S_boomleft 69 /* thrown boomerang, open left, e.g ')' */
|
||||
#define S_boomright 70 /* thrown boomerand, open right, e.g. '(' */
|
||||
#define S_ss1 71 /* 4 magic shield glyphs */
|
||||
#define S_ss2 72
|
||||
#define S_ss3 73
|
||||
#define S_ss4 74
|
||||
#define S_poisoncloud 75
|
||||
#define S_vbeam 64 /* The 4 zap beam symbols. Do NOT separate. */
|
||||
#define S_hbeam 65 /* To change order or add, see function */
|
||||
#define S_lslant 66 /* zapdir_to_glyph() in display.c. */
|
||||
#define S_rslant 67
|
||||
#define S_digbeam 68 /* dig beam symbol */
|
||||
#define S_flashbeam 69 /* camera flash symbol */
|
||||
#define S_boomleft 70 /* thrown boomerang, open left, e.g ')' */
|
||||
#define S_boomright 71 /* thrown boomerand, open right, e.g. '(' */
|
||||
#define S_ss1 72 /* 4 magic shield glyphs */
|
||||
#define S_ss2 73
|
||||
#define S_ss3 74
|
||||
#define S_ss4 75
|
||||
#define S_poisoncloud 76
|
||||
#define S_goodpos 77 /* valid position for targeting */
|
||||
|
||||
/* The 8 swallow symbols. Do NOT separate. To change order or add, see */
|
||||
/* the function swallow_to_glyph() in display.c. */
|
||||
#define S_sw_tl 76 /* swallow top left [1] */
|
||||
#define S_sw_tc 77 /* swallow top center [2] Order: */
|
||||
#define S_sw_tr 78 /* swallow top right [3] */
|
||||
#define S_sw_ml 79 /* swallow middle left [4] 1 2 3 */
|
||||
#define S_sw_mr 80 /* swallow middle right [6] 4 5 6 */
|
||||
#define S_sw_bl 81 /* swallow bottom left [7] 7 8 9 */
|
||||
#define S_sw_bc 82 /* swallow bottom center [8] */
|
||||
#define S_sw_br 83 /* swallow bottom right [9] */
|
||||
#define S_sw_tl 78 /* swallow top left [1] */
|
||||
#define S_sw_tc 79 /* swallow top center [2] Order: */
|
||||
#define S_sw_tr 80 /* swallow top right [3] */
|
||||
#define S_sw_ml 81 /* swallow middle left [4] 1 2 3 */
|
||||
#define S_sw_mr 82 /* swallow middle right [6] 4 5 6 */
|
||||
#define S_sw_bl 83 /* swallow bottom left [7] 7 8 9 */
|
||||
#define S_sw_bc 84 /* swallow bottom center [8] */
|
||||
#define S_sw_br 85 /* swallow bottom right [9] */
|
||||
|
||||
#define S_explode1 84 /* explosion top left */
|
||||
#define S_explode2 85 /* explosion top center */
|
||||
#define S_explode3 86 /* explosion top right Ex. */
|
||||
#define S_explode4 87 /* explosion middle left */
|
||||
#define S_explode5 88 /* explosion middle center /-\ */
|
||||
#define S_explode6 89 /* explosion middle right |@| */
|
||||
#define S_explode7 90 /* explosion bottom left \-/ */
|
||||
#define S_explode8 91 /* explosion bottom center */
|
||||
#define S_explode9 92 /* explosion bottom right */
|
||||
#define S_explode1 86 /* explosion top left */
|
||||
#define S_explode2 87 /* explosion top center */
|
||||
#define S_explode3 88 /* explosion top right Ex. */
|
||||
#define S_explode4 89 /* explosion middle left */
|
||||
#define S_explode5 90 /* explosion middle center /-\ */
|
||||
#define S_explode6 91 /* explosion middle right |@| */
|
||||
#define S_explode7 92 /* explosion bottom left \-/ */
|
||||
#define S_explode8 93 /* explosion bottom center */
|
||||
#define S_explode9 94 /* explosion bottom right */
|
||||
|
||||
/* end effects */
|
||||
|
||||
#define MAXPCHARS 93 /* maximum number of mapped characters */
|
||||
#define MAXDCHARS 41 /* maximum of mapped dungeon characters */
|
||||
#define MAXPCHARS 95 /* maximum number of mapped characters */
|
||||
#define MAXDCHARS 42 /* maximum of mapped dungeon characters */
|
||||
#define MAXTCHARS 22 /* maximum of mapped trap characters */
|
||||
#define MAXECHARS 30 /* maximum of mapped effects characters */
|
||||
#define MAXECHARS 31 /* maximum of mapped effects characters */
|
||||
#define MAXEXPCHARS 9 /* number of explosion characters */
|
||||
|
||||
#define DARKROOMSYM (Is_rogue_level(&u.uz) ? S_stone : S_darkroom)
|
||||
|
||||
struct symdef {
|
||||
uchar sym;
|
||||
const char *explanation;
|
||||
|
||||
@@ -1396,7 +1396,7 @@ display_jump_positions(state)
|
||||
int state;
|
||||
{
|
||||
if (state == 0) {
|
||||
tmp_at(DISP_BEAM, cmap_to_glyph(S_flashbeam));
|
||||
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
|
||||
} else if (state == 1) {
|
||||
int x,y, dx, dy;
|
||||
for (dx = -4; dx <= 4; dx++)
|
||||
@@ -2605,7 +2605,7 @@ display_polearm_positions(state)
|
||||
int state;
|
||||
{
|
||||
if (state == 0) {
|
||||
tmp_at(DISP_BEAM, cmap_to_glyph(S_flashbeam));
|
||||
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
|
||||
} else if (state == 1) {
|
||||
int x,y, dx,dy;
|
||||
for (dx = -4; dx <= 4; dx++)
|
||||
|
||||
@@ -331,7 +331,7 @@ struct obj *corpse;
|
||||
clear_bypasses();
|
||||
fd = open_bonesfile(&u.uz, &bonesid);
|
||||
if (fd >= 0) {
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
if (wizard) {
|
||||
if (yn("Bones file already exists. Replace it?") == 'y') {
|
||||
if (delete_bonesfile(&u.uz)) goto make_bones;
|
||||
@@ -504,7 +504,7 @@ struct obj *corpse;
|
||||
if (bytes_counted > freediskspace(bones)) { /* not enough room */
|
||||
if (wizard)
|
||||
pline("Insufficient space to create bones file.");
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
cancel_bonesfile();
|
||||
return;
|
||||
}
|
||||
@@ -551,7 +551,7 @@ getbones()
|
||||
ok = TRUE;
|
||||
if(wizard) {
|
||||
if(yn("Get bones?") == 'n') {
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
compress_bonesfile();
|
||||
return(0);
|
||||
}
|
||||
@@ -595,7 +595,7 @@ getbones()
|
||||
resetobjs(level.buriedobjlist,TRUE);
|
||||
}
|
||||
}
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
sanitize_engravings();
|
||||
u.uroleplay.numbones++;
|
||||
|
||||
|
||||
@@ -764,11 +764,11 @@ newsym(x,y)
|
||||
* These checks and changes must be here and not in back_to_glyph().
|
||||
* They are dependent on the position being out of sight.
|
||||
*/
|
||||
else if (!lev->waslit) {
|
||||
else if (!lev->waslit || (flags.dark_room && iflags.use_color)) {
|
||||
if (lev->glyph == cmap_to_glyph(S_litcorr) && lev->typ == CORR)
|
||||
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr));
|
||||
else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM)
|
||||
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_stone));
|
||||
show_glyph(x, y, lev->glyph = cmap_to_glyph(DARKROOMSYM));
|
||||
else
|
||||
goto show_mem;
|
||||
} else {
|
||||
|
||||
4
src/do.c
4
src/do.c
@@ -945,7 +945,7 @@ currentlevel_rewrite()
|
||||
|
||||
#ifdef MFLOPPY
|
||||
if (!savelev(fd, ledger_no(&u.uz), COUNT_SAVE)) {
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
delete_levelfile(ledger_no(&u.uz));
|
||||
pline("NetHack is out of disk space for making levels!");
|
||||
You("can save, quit, or continue playing.");
|
||||
@@ -1160,7 +1160,7 @@ boolean at_stairs, falling, portal;
|
||||
}
|
||||
minit(); /* ZEROCOMP */
|
||||
getlev(fd, hackpid, new_ledger, FALSE);
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
oinit(); /* reassign level dependent obj probabilities */
|
||||
}
|
||||
/* do this prior to level-change pline messages */
|
||||
|
||||
@@ -238,6 +238,7 @@ const char *goal;
|
||||
if (glyph_is_cmap(k) &&
|
||||
(IS_DOOR(levl[tx][ty].typ) ||
|
||||
glyph_to_cmap(k) == S_room ||
|
||||
glyph_to_cmap(k) == S_darkroom ||
|
||||
glyph_to_cmap(k) == S_corr ||
|
||||
glyph_to_cmap(k) == S_litcorr)) {
|
||||
/* what the hero remembers to be at tx,ty */
|
||||
|
||||
@@ -156,7 +156,8 @@ const struct symdef defsyms[MAXPCHARS] = {
|
||||
{'#', "iron bars", C(HI_METAL)}, /* bars */
|
||||
{'#', "tree", C(CLR_GREEN)}, /* tree */
|
||||
{'.', "floor of a room",C(CLR_GRAY)}, /* room */
|
||||
/*20*/ {'#', "corridor", C(CLR_GRAY)}, /* dark corr */
|
||||
/*20*/ {'.', "dark part of a room",C(CLR_BLACK)}, /* dark room */
|
||||
{'#', "corridor", C(CLR_GRAY)}, /* dark corr */
|
||||
{'#', "lit corridor", C(CLR_GRAY)}, /* lit corr (see mapglyph.c) */
|
||||
{'<', "staircase up", C(CLR_GRAY)}, /* upstair */
|
||||
{'>', "staircase down", C(CLR_GRAY)}, /* dnstair */
|
||||
@@ -165,8 +166,8 @@ const struct symdef defsyms[MAXPCHARS] = {
|
||||
{'_', "altar", C(CLR_GRAY)}, /* altar */
|
||||
{'|', "grave", C(CLR_GRAY)}, /* grave */
|
||||
{'\\', "opulent throne",C(HI_GOLD)}, /* throne */
|
||||
{'#', "sink", C(CLR_GRAY)}, /* sink */
|
||||
/*30*/ {'{', "fountain", C(CLR_BLUE)}, /* fountain */
|
||||
/*30*/ {'#', "sink", C(CLR_GRAY)}, /* sink */
|
||||
{'{', "fountain", C(CLR_BLUE)}, /* fountain */
|
||||
{'}', "water", C(CLR_BLUE)}, /* pool */
|
||||
{'.', "ice", C(CLR_CYAN)}, /* ice */
|
||||
{'}', "molten lava", C(CLR_RED)}, /* lava */
|
||||
@@ -175,8 +176,8 @@ const struct symdef defsyms[MAXPCHARS] = {
|
||||
{'#', "raised drawbridge",C(CLR_BROWN)}, /* vcdbridge */
|
||||
{'#', "raised drawbridge",C(CLR_BROWN)}, /* hcdbridge */
|
||||
{' ', "air", C(CLR_CYAN)}, /* open air */
|
||||
{'#', "cloud", C(CLR_GRAY)}, /* [part of] a cloud */
|
||||
/*40*/ {'}', "water", C(CLR_BLUE)}, /* under water */
|
||||
/*40*/ {'#', "cloud", C(CLR_GRAY)}, /* [part of] a cloud */
|
||||
{'}', "water", C(CLR_BLUE)}, /* under water */
|
||||
{'^', "arrow trap", C(HI_METAL)}, /* trap */
|
||||
{'^', "dart trap", C(HI_METAL)}, /* trap */
|
||||
{'^', "falling rock trap",C(CLR_GRAY)}, /* trap */
|
||||
@@ -185,8 +186,8 @@ const struct symdef defsyms[MAXPCHARS] = {
|
||||
{'^', "land mine", C(CLR_RED)}, /* trap */
|
||||
{'^', "rolling boulder trap", C(CLR_GRAY)}, /* trap */
|
||||
{'^', "sleeping gas trap",C(HI_ZAP)}, /* trap */
|
||||
{'^', "rust trap", C(CLR_BLUE)}, /* trap */
|
||||
/*50*/ {'^', "fire trap", C(CLR_ORANGE)}, /* trap */
|
||||
/*50*/ {'^', "rust trap", C(CLR_BLUE)}, /* trap */
|
||||
{'^', "fire trap", C(CLR_ORANGE)}, /* trap */
|
||||
{'^', "pit", C(CLR_BLACK)}, /* trap */
|
||||
{'^', "spiked pit", C(CLR_BLACK)}, /* trap */
|
||||
{'^', "hole", C(CLR_BROWN)}, /* trap */
|
||||
@@ -195,8 +196,8 @@ const struct symdef defsyms[MAXPCHARS] = {
|
||||
{'^', "level teleporter", C(CLR_MAGENTA)}, /* trap */
|
||||
{'^', "magic portal", C(CLR_BRIGHT_MAGENTA)}, /* trap */
|
||||
{'"', "web", C(CLR_GRAY)}, /* web */
|
||||
{'^', "statue trap", C(CLR_GRAY)}, /* trap */
|
||||
/*60*/ {'^', "magic trap", C(HI_ZAP)}, /* trap */
|
||||
/*60*/ {'^', "statue trap", C(CLR_GRAY)}, /* trap */
|
||||
{'^', "magic trap", C(HI_ZAP)}, /* trap */
|
||||
{'^', "anti-magic field", C(HI_ZAP)}, /* trap */
|
||||
{'^', "polymorph trap", C(CLR_BRIGHT_GREEN)}, /* trap */
|
||||
{'|', "wall", C(CLR_GRAY)}, /* vbeam */
|
||||
@@ -205,29 +206,30 @@ const struct symdef defsyms[MAXPCHARS] = {
|
||||
{'/', "wall", C(CLR_GRAY)}, /* rslant */
|
||||
{'*', "", C(CLR_WHITE)}, /* dig beam */
|
||||
{'!', "", C(CLR_WHITE)}, /* camera flash beam */
|
||||
{')', "", C(HI_WOOD)}, /* boomerang open left */
|
||||
/*70*/ {'(', "", C(HI_WOOD)}, /* boomerang open right */
|
||||
/*70*/ {')', "", C(HI_WOOD)}, /* boomerang open left */
|
||||
{'(', "", C(HI_WOOD)}, /* boomerang open right */
|
||||
{'0', "", C(HI_ZAP)}, /* 4 magic shield symbols */
|
||||
{'#', "", C(HI_ZAP)},
|
||||
{'@', "", C(HI_ZAP)},
|
||||
{'*', "", C(HI_ZAP)},
|
||||
{'#', "poison cloud", C(CLR_BRIGHT_GREEN)}, /* [part of] a poison cloud */
|
||||
{'?', "valid position", C(CLR_BRIGHT_GREEN)}, /* valid position for targeting */
|
||||
{'/', "", C(CLR_GREEN)}, /* swallow top left */
|
||||
{'-', "", C(CLR_GREEN)}, /* swallow top center */
|
||||
{'\\', "", C(CLR_GREEN)}, /* swallow top right */
|
||||
/*80*/ {'\\', "", C(CLR_GREEN)}, /* swallow top right */
|
||||
{'|', "", C(CLR_GREEN)}, /* swallow middle left */
|
||||
{'|', "", C(CLR_GREEN)}, /* swallow middle right */
|
||||
/*80*/ {'\\', "", C(CLR_GREEN)}, /* swallow bottom left */
|
||||
{'\\', "", C(CLR_GREEN)}, /* swallow bottom left */
|
||||
{'-', "", C(CLR_GREEN)}, /* swallow bottom center*/
|
||||
{'/', "", C(CLR_GREEN)}, /* swallow bottom right */
|
||||
{'/', "", C(CLR_ORANGE)}, /* explosion top left */
|
||||
{'-', "", C(CLR_ORANGE)}, /* explosion top center */
|
||||
{'\\', "", C(CLR_ORANGE)}, /* explosion top right */
|
||||
{'|', "", C(CLR_ORANGE)}, /* explosion middle left */
|
||||
{' ', "", C(CLR_ORANGE)}, /* explosion middle center*/
|
||||
/*90*/ {' ', "", C(CLR_ORANGE)}, /* explosion middle center*/
|
||||
{'|', "", C(CLR_ORANGE)}, /* explosion middle right */
|
||||
{'\\', "", C(CLR_ORANGE)}, /* explosion bottom left */
|
||||
/*90*/ {'-', "", C(CLR_ORANGE)}, /* explosion bottom center*/
|
||||
{'-', "", C(CLR_ORANGE)}, /* explosion bottom center*/
|
||||
{'/', "", C(CLR_ORANGE)}, /* explosion bottom right */
|
||||
};
|
||||
|
||||
@@ -647,6 +649,7 @@ struct symparse loadsyms[] = {
|
||||
{SYM_PCHAR, S_flashbeam, "S_flashbeam"},
|
||||
{SYM_PCHAR, S_boomleft, "S_boomleft"},
|
||||
{SYM_PCHAR, S_boomright, "S_boomright"},
|
||||
{SYM_PCHAR, S_goodpos, "S_goodpos"},
|
||||
{SYM_PCHAR, S_ss1, "S_ss1"},
|
||||
{SYM_PCHAR, S_ss2, "S_ss2"},
|
||||
{SYM_PCHAR, S_ss3, "S_ss3"},
|
||||
|
||||
77
src/files.c
77
src/files.c
@@ -641,12 +641,12 @@ really_close()
|
||||
lftrack.fd = -1;
|
||||
lftrack.oflag = 0;
|
||||
if (fd != -1)
|
||||
(void)_close(fd);
|
||||
(void)close(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
close(fd)
|
||||
nhclose(fd)
|
||||
int fd;
|
||||
{
|
||||
if (lftrack.fd == fd) {
|
||||
@@ -655,10 +655,17 @@ int fd;
|
||||
lftrack.nethack_thinks_it_is_open = FALSE;
|
||||
return 0;
|
||||
}
|
||||
return _close(fd);
|
||||
return close(fd);
|
||||
}
|
||||
#else
|
||||
int
|
||||
nhclose(fd)
|
||||
int fd;
|
||||
{
|
||||
return close(fd);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* ---------- END LEVEL FILE HANDLING ----------- */
|
||||
|
||||
|
||||
@@ -996,7 +1003,7 @@ restore_saved_game()
|
||||
if ((fd = open_savefile()) < 0) return fd;
|
||||
|
||||
if (validate(fd, fq_save) != 0) {
|
||||
(void) close(fd), fd = -1;
|
||||
(void) nhclose(fd), fd = -1;
|
||||
(void) delete_savefile();
|
||||
}
|
||||
return fd;
|
||||
@@ -1021,7 +1028,7 @@ const char* filename;
|
||||
get_plname_from_file(fd, tplname);
|
||||
result = dupstr(tplname);
|
||||
}
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
}
|
||||
nh_compress(SAVEF);
|
||||
|
||||
@@ -1777,7 +1784,7 @@ const char *filename;
|
||||
if (unlink(lockname) < 0)
|
||||
HUP raw_printf("Can't unlink %s.", lockname);
|
||||
# ifdef NO_FILE_LINKS
|
||||
(void) close(lockfd);
|
||||
(void) nhclose(lockfd);
|
||||
# endif
|
||||
|
||||
#endif /* UNIX || VMS */
|
||||
@@ -2936,9 +2943,9 @@ const char *dir UNUSED_if_not_OS2_CODEVIEW;
|
||||
wait_synch();
|
||||
}
|
||||
# endif
|
||||
(void) close(fd); /* RECORD is accessible */
|
||||
(void) nhclose(fd); /* RECORD is accessible */
|
||||
} else if ((fd = open(fq_record, O_CREAT|O_RDWR, FCMASK)) >= 0) {
|
||||
(void) close(fd); /* RECORD newly created */
|
||||
(void) nhclose(fd); /* RECORD newly created */
|
||||
# if defined(VMS) && !defined(SECURE)
|
||||
/* Re-protect RECORD with world:read+write+execute+delete access. */
|
||||
(void) chmod(fq_record, FCMASK | 007);
|
||||
@@ -2978,9 +2985,9 @@ const char *dir UNUSED_if_not_OS2_CODEVIEW;
|
||||
raw_printf("Warning: cannot write record %s", tmp);
|
||||
wait_synch();
|
||||
} else
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
} else /* open succeeded */
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
#else /* MICRO || WIN32*/
|
||||
|
||||
# ifdef MAC
|
||||
@@ -3064,14 +3071,14 @@ recover_savefile()
|
||||
if (read(gfd, (genericptr_t) &hpid, sizeof hpid) != sizeof hpid) {
|
||||
raw_printf(
|
||||
"\nCheckpoint data incompletely written or subsequently clobbered. Recovery impossible.");
|
||||
(void)close(gfd);
|
||||
(void)nhclose(gfd);
|
||||
return FALSE;
|
||||
}
|
||||
if (read(gfd, (genericptr_t) &savelev, sizeof(savelev))
|
||||
!= sizeof(savelev)) {
|
||||
raw_printf("\nCheckpointing was not in effect for %s -- recovery impossible.\n",
|
||||
lock);
|
||||
(void)close(gfd);
|
||||
(void)nhclose(gfd);
|
||||
return FALSE;
|
||||
}
|
||||
if ((read(gfd, (genericptr_t) savename, sizeof savename)
|
||||
@@ -3085,7 +3092,7 @@ recover_savefile()
|
||||
(read(gfd, (genericptr_t) &tmpplbuf, pltmpsiz)
|
||||
!= pltmpsiz)) {
|
||||
raw_printf("\nError reading %s -- can't recover.\n", lock);
|
||||
(void)close(gfd);
|
||||
(void)nhclose(gfd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -3101,15 +3108,15 @@ recover_savefile()
|
||||
sfd = create_savefile();
|
||||
if (sfd < 0) {
|
||||
raw_printf("\nCannot recover savefile %s.\n", SAVEF);
|
||||
(void)close(gfd);
|
||||
(void)nhclose(gfd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lfd = open_levelfile(savelev, errbuf);
|
||||
if (lfd < 0) {
|
||||
raw_printf("\n%s\n", errbuf);
|
||||
(void)close(gfd);
|
||||
(void)close(sfd);
|
||||
(void)nhclose(gfd);
|
||||
(void)nhclose(sfd);
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3117,8 +3124,8 @@ recover_savefile()
|
||||
if (write(sfd, (genericptr_t) &version_data, sizeof version_data)
|
||||
!= sizeof version_data) {
|
||||
raw_printf("\nError writing %s; recovery failed.", SAVEF);
|
||||
(void)close(gfd);
|
||||
(void)close(sfd);
|
||||
(void)nhclose(gfd);
|
||||
(void)nhclose(sfd);
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3128,8 +3135,8 @@ recover_savefile()
|
||||
raw_printf(
|
||||
"\nError writing %s; recovery failed (savefile_info).\n",
|
||||
SAVEF);
|
||||
(void)close(gfd);
|
||||
(void)close(sfd);
|
||||
(void)nhclose(gfd);
|
||||
(void)nhclose(sfd);
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3139,8 +3146,8 @@ recover_savefile()
|
||||
raw_printf(
|
||||
"Error writing %s; recovery failed (player name size).\n",
|
||||
SAVEF);
|
||||
(void)close(gfd);
|
||||
(void)close(sfd);
|
||||
(void)nhclose(gfd);
|
||||
(void)nhclose(sfd);
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3150,28 +3157,28 @@ recover_savefile()
|
||||
raw_printf(
|
||||
"Error writing %s; recovery failed (player name).\n",
|
||||
SAVEF);
|
||||
(void)close(gfd);
|
||||
(void)close(sfd);
|
||||
(void)nhclose(gfd);
|
||||
(void)nhclose(sfd);
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!copy_bytes(lfd, sfd)) {
|
||||
(void) close(lfd);
|
||||
(void) close(sfd);
|
||||
(void) nhclose(lfd);
|
||||
(void) nhclose(sfd);
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
(void)close(lfd);
|
||||
(void)nhclose(lfd);
|
||||
processed[savelev] = 1;
|
||||
|
||||
if (!copy_bytes(gfd, sfd)) {
|
||||
(void) close(lfd);
|
||||
(void) close(sfd);
|
||||
(void) nhclose(lfd);
|
||||
(void) nhclose(sfd);
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
(void)close(gfd);
|
||||
(void)nhclose(gfd);
|
||||
processed[0] = 1;
|
||||
|
||||
for (lev = 1; lev < 256; lev++) {
|
||||
@@ -3185,17 +3192,17 @@ recover_savefile()
|
||||
levc = (xchar) lev;
|
||||
write(sfd, (genericptr_t) &levc, sizeof(levc));
|
||||
if (!copy_bytes(lfd, sfd)) {
|
||||
(void) close(lfd);
|
||||
(void) close(sfd);
|
||||
(void) nhclose(lfd);
|
||||
(void) nhclose(sfd);
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
(void)close(lfd);
|
||||
(void)nhclose(lfd);
|
||||
processed[lev] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
(void)close(sfd);
|
||||
(void)nhclose(sfd);
|
||||
|
||||
#ifdef HOLD_LOCKFILE_OPEN
|
||||
really_close();
|
||||
|
||||
@@ -116,7 +116,7 @@ unsigned *ospecial;
|
||||
color = CLR_MAGENTA;
|
||||
else if (offset == S_corr || offset == S_litcorr)
|
||||
color = CLR_GRAY;
|
||||
else if (offset >= S_room && offset <= S_water)
|
||||
else if (offset >= S_room && offset <= S_water && offset != S_darkroom)
|
||||
color = CLR_GREEN;
|
||||
else
|
||||
color = NO_COLOR;
|
||||
|
||||
@@ -753,7 +753,7 @@ char *buf;
|
||||
break;
|
||||
}
|
||||
(void) write(fd, buf, strlen(buf));
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
}
|
||||
}
|
||||
#endif /* UNIX386MUSIC */
|
||||
|
||||
@@ -105,6 +105,7 @@ static struct Bool_Opt
|
||||
{"color", &iflags.wc_color, FALSE, SET_IN_GAME}, /*WC*/
|
||||
# endif
|
||||
{"confirm",&flags.confirm, TRUE, SET_IN_GAME},
|
||||
{"dark_room", &flags.dark_room, TRUE, SET_IN_GAME},
|
||||
{"eight_bit_tty", &iflags.wc_eight_bit_input, FALSE, SET_IN_GAME}, /*WC*/
|
||||
#ifdef TTY_GRAPHICS
|
||||
{"extmenu", &iflags.extmenu, FALSE, SET_IN_GAME},
|
||||
@@ -496,6 +497,35 @@ STATIC_OVL boolean FDECL(wc2_supported, (const char *));
|
||||
STATIC_DCL void FDECL(remove_autopickup_exception, (struct autopickup_exception *));
|
||||
STATIC_OVL int FDECL(count_ape_maps, (int *, int *));
|
||||
|
||||
|
||||
void
|
||||
reglyph_darkroom()
|
||||
{
|
||||
xchar x,y;
|
||||
for (x = 0; x < COLNO; x++)
|
||||
for (y = 0; y < ROWNO; y++) {
|
||||
struct rm *lev = &levl[x][y];
|
||||
if (!flags.dark_room) {
|
||||
if (lev->glyph == cmap_to_glyph(S_darkroom))
|
||||
lev->glyph = lev->waslit ? cmap_to_glyph(S_room) : cmap_to_glyph(S_stone);
|
||||
} else {
|
||||
if (lev->glyph == cmap_to_glyph(S_room) &&
|
||||
lev->seenv &&
|
||||
lev->waslit && !cansee(x,y))
|
||||
lev->glyph = cmap_to_glyph(S_darkroom);
|
||||
else if (lev->glyph == cmap_to_glyph(S_stone) &&
|
||||
lev->typ == ROOM &&
|
||||
lev->seenv &&
|
||||
!cansee(x,y))
|
||||
lev->glyph = cmap_to_glyph(S_darkroom);
|
||||
}
|
||||
}
|
||||
if (flags.dark_room && iflags.use_color)
|
||||
showsyms[S_darkroom]=showsyms[S_room];
|
||||
else
|
||||
showsyms[S_darkroom]=showsyms[S_stone];
|
||||
}
|
||||
|
||||
/* check whether a user-supplied option string is a proper leading
|
||||
substring of a particular option name; option string might have
|
||||
a colon or equals sign and arbitrary value appended to it */
|
||||
@@ -704,6 +734,8 @@ initoptions_finish()
|
||||
/* result in the player's preferred fruit [better than "\033"]. */
|
||||
obj_descr[SLIME_MOLD].oc_name = "fruit";
|
||||
|
||||
reglyph_darkroom();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2810,7 +2842,8 @@ goodfruit:
|
||||
else if ((boolopt[i].addr) == &flags.invlet_constant) {
|
||||
if (flags.invlet_constant) reassign();
|
||||
}
|
||||
else if ((boolopt[i].addr) == &flags.lit_corridor) {
|
||||
else if (((boolopt[i].addr) == &flags.lit_corridor) ||
|
||||
((boolopt[i].addr) == &flags.dark_room)) {
|
||||
/*
|
||||
* All corridor squares seen via night vision or
|
||||
* candles & lamps change. Update them by calling
|
||||
@@ -2820,6 +2853,7 @@ goodfruit:
|
||||
*/
|
||||
vision_recalc(2); /* shut down vision */
|
||||
vision_full_recalc = 1; /* delayed recalc */
|
||||
if (iflags.use_color) need_redraw = TRUE; /* darkroom refresh */
|
||||
}
|
||||
else if ((boolopt[i].addr) == &iflags.use_inverse ||
|
||||
(boolopt[i].addr) == &flags.showrace ||
|
||||
@@ -3149,8 +3183,10 @@ doset()
|
||||
}
|
||||
|
||||
destroy_nhwindow(tmpwin);
|
||||
if (need_redraw)
|
||||
if (need_redraw) {
|
||||
reglyph_darkroom();
|
||||
(void) doredraw();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ lookat(x, y, buf, monbuf)
|
||||
int tnum = what_trap(glyph_to_trap(glyph));
|
||||
Strcpy(buf, defsyms[trap_to_defsym(tnum)].explanation);
|
||||
} else if(!glyph_is_cmap(glyph)) {
|
||||
Strcpy(buf,"dark part of a room");
|
||||
Strcpy(buf,"unexplored area");
|
||||
} else switch(glyph_to_cmap(glyph)) {
|
||||
case S_altar:
|
||||
Sprintf(buf, "%s %saltar",
|
||||
@@ -557,8 +557,8 @@ const char **firstmatch;
|
||||
x_str = defsyms[i].explanation;
|
||||
if (sym == ((looked) ?
|
||||
showsyms[i] : defsyms[i].sym) && *x_str) {
|
||||
/* avoid "an air", "a water", or "a floor of a room" */
|
||||
int article = (i == S_room) ? 2 : /* 2=>"the" */
|
||||
/* avoid "an air", "a water", "a floor of a room", "a dark part of a room" */
|
||||
int article = ((i == S_room)||(i == S_darkroom)) ? 2 : /* 2=>"the" */
|
||||
!(strcmp(x_str, "air") == 0 || /* 1=>"an" */
|
||||
strcmp(x_str, "water") == 0); /* 0=>(none)*/
|
||||
|
||||
|
||||
@@ -886,7 +886,7 @@ display_stinking_cloud_positions(state)
|
||||
int state;
|
||||
{
|
||||
if (state == 0) {
|
||||
tmp_at(DISP_BEAM, cmap_to_glyph(S_flashbeam));
|
||||
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
|
||||
} else if (state == 1) {
|
||||
int x,y, dx, dy;
|
||||
int dist = 6;
|
||||
|
||||
@@ -718,7 +718,7 @@ xchar ltmp;
|
||||
|
||||
/* Remove levels and bones that may have been created.
|
||||
*/
|
||||
(void) close(nfd);
|
||||
(void) nhclose(nfd);
|
||||
# ifdef AMIGA
|
||||
clearlocks();
|
||||
# else
|
||||
@@ -767,7 +767,7 @@ register int fd;
|
||||
if (!restgamestate(fd, &stuckid, &steedid)) {
|
||||
display_nhwindow(WIN_MESSAGE, TRUE);
|
||||
savelev(-1, 0, FREE_SAVE); /* discard current level */
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
(void) delete_savefile();
|
||||
restoring = FALSE;
|
||||
return(0);
|
||||
@@ -841,7 +841,7 @@ register int fd;
|
||||
get_plname_from_file(fd, plname);
|
||||
|
||||
getlev(fd, 0, (xchar)0, FALSE);
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
|
||||
/* Now set the restore settings to match the
|
||||
* settings used by the save file output routines
|
||||
@@ -1558,7 +1558,7 @@ register unsigned int len;
|
||||
} else {
|
||||
pline("Read %d instead of %u bytes.", rlen, len);
|
||||
if(restoring) {
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
(void) delete_savefile();
|
||||
error("Error restoring old game.");
|
||||
}
|
||||
|
||||
18
src/save.c
18
src/save.c
@@ -162,7 +162,7 @@ dosave0()
|
||||
nh_uncompress(fq_save);
|
||||
fd = open_savefile();
|
||||
if (fd > 0) {
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
clear_nhwindow(WIN_MESSAGE);
|
||||
There("seems to be an old save file.");
|
||||
if (yn("Overwrite the old file?") == 'n') {
|
||||
@@ -218,7 +218,7 @@ dosave0()
|
||||
pline("Require %ld bytes but only have %ld.", needed, fds);
|
||||
}
|
||||
flushout();
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
(void) delete_savefile();
|
||||
return 0;
|
||||
}
|
||||
@@ -265,7 +265,7 @@ dosave0()
|
||||
ofd = open_levelfile(ltmp, whynot);
|
||||
if (ofd < 0) {
|
||||
HUP pline1(whynot);
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
(void) delete_savefile();
|
||||
HUP Strcpy(killer.name, whynot);
|
||||
HUP done(TRICKED);
|
||||
@@ -273,7 +273,7 @@ dosave0()
|
||||
}
|
||||
minit(); /* ZEROCOMP */
|
||||
getlev(ofd, hackpid, ltmp, FALSE);
|
||||
(void) close(ofd);
|
||||
(void) nhclose(ofd);
|
||||
bwrite(fd, (genericptr_t) <mp, sizeof ltmp); /* level number*/
|
||||
savelev(fd, ltmp, WRITE_SAVE | FREE_SAVE); /* actual level*/
|
||||
delete_levelfile(ltmp);
|
||||
@@ -404,7 +404,7 @@ savestateinlock()
|
||||
Strcpy(killer.name, whynot);
|
||||
done(TRICKED);
|
||||
}
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
|
||||
fd = create_levelfile(0, whynot);
|
||||
if (fd < 0) {
|
||||
@@ -742,7 +742,7 @@ def_bclose(fd)
|
||||
bw_FILE = 0;
|
||||
} else
|
||||
#endif
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -879,7 +879,7 @@ zerocomp_bclose(fd)
|
||||
int fd;
|
||||
{
|
||||
zerocomp_bufoff(fd);
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
return;
|
||||
}
|
||||
#endif /* ZEROCOMP */
|
||||
@@ -1443,8 +1443,8 @@ char *from, *to;
|
||||
if (nto != nfrom)
|
||||
panic("Copyfile failed!");
|
||||
} while (nfrom == BUFSIZ);
|
||||
(void) close(fdfrom);
|
||||
(void) close(fdto);
|
||||
(void) nhclose(fdfrom);
|
||||
(void) nhclose(fdto);
|
||||
# endif /* TOS */
|
||||
}
|
||||
|
||||
|
||||
@@ -405,7 +405,7 @@ char *argv[];
|
||||
hackpid = 1;
|
||||
#endif
|
||||
write(fd, (genericptr_t) &hackpid, sizeof(hackpid));
|
||||
close(fd);
|
||||
nhclose(fd);
|
||||
}
|
||||
#ifdef MFLOPPY
|
||||
level_info[0].where = ACTIVE;
|
||||
|
||||
@@ -282,7 +282,7 @@ int start;
|
||||
if (sysflags.asksavedisk) {
|
||||
/* Don't prompt if you can find the save file */
|
||||
if ((fd = open_savefile()) >= 0) {
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
return 1;
|
||||
}
|
||||
clear_nhwindow(WIN_MESSAGE);
|
||||
@@ -335,7 +335,7 @@ comspec_exists()
|
||||
|
||||
if ((comspec = getcomspec()))
|
||||
if ((fd = open(comspec, O_RDONLY)) >= 0) {
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
@@ -150,7 +150,7 @@ getlock()
|
||||
error("Cannot open %s", fq_lock);
|
||||
}
|
||||
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
|
||||
if(iflags.window_inited) {
|
||||
# ifdef SELF_RECOVER
|
||||
@@ -248,7 +248,7 @@ gotlock:
|
||||
# endif
|
||||
error("cannot write lock (%s)", fq_lock);
|
||||
}
|
||||
if(close(fd) == -1) {
|
||||
if(nhclose(fd) == -1) {
|
||||
# if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||
chdirx(orgdir, 0);
|
||||
# endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 wintty.c $NHDT-Date: 1427667623 2015/03/29 22:20:23 $ $NHDT-Branch: master $:$NHDT-Revision: 1.75 $ */
|
||||
/* NetHack 3.5 wintty.c $NHDT-Date: 1428394244 2015/04/07 08:10:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.84 $ */
|
||||
/* NetHack 3.5 wintty.c $Date: 2012/01/22 06:27:09 $ $Revision: 1.66 $ */
|
||||
/* Copyright (c) David Cohrs, 1991 */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -1770,7 +1770,7 @@ struct WinDesc *cw;
|
||||
if (i == cw->maxrow) {
|
||||
#ifdef H2344_BROKEN
|
||||
if(cw->type == NHW_TEXT){
|
||||
tty_curs(BASE_WINDOW, 0, (int)ttyDisplay->cury+1);
|
||||
tty_curs(BASE_WINDOW, 1, (int)ttyDisplay->cury+1);
|
||||
cl_eos();
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user