zlib support; also internal compression changes

o Add support for zlib compression via ZLIB_COMP in config.h (ZLIB_COMP
  and COMPRESS are mutually exclusive).
o rlecomp and zerocomp are run time options available if RLECOMP and
  ZEROCOMP are defined, but not turned on by default if either COMPRESS
  or ZLIB_COMP are defined.
o Add information to the save file about internal compression options
  used when writing the save file, particularly rlecomp and zerocomp
  support.
o Automatically adjust rlecomp and zerocomp (if support compiled in)
  when reading in an existing savefile that was saved with those options
  turned on.  Still allows writing out of savefile in preferred format.
o In order to support zlib and not conflict with compress and uncompress
  routines there, the NetHack internal functions were changed to
  nh_uncompress and nh_compress as done in the zlib contribution received
  in 1999 from <Someone>.

I tagged the sources NETHACK_3_5_0_PREZLIB prior to applying these
changes.
This commit is contained in:
nethack.allison
2005-01-22 15:28:15 +00:00
parent c40d876c3b
commit ab1872b928
20 changed files with 982 additions and 263 deletions

View File

@@ -106,7 +106,7 @@ int MAIN(int argc, char **argv)
if(yn("Do you want to keep the save file?") == 'n')
(void) delete_savefile();
else {
compress(fqname(SAVEF, SAVEPREFIX, 0));
nh_compress(fqname(SAVEF, SAVEPREFIX, 0));
}
}

View File

@@ -117,7 +117,7 @@ main (void)
if(yn("Do you want to keep the save file?") == 'n')
(void) delete_savefile();
else {
compress(fqname(SAVEF, SAVEPREFIX, 0));
nh_compress(fqname(SAVEF, SAVEPREFIX, 0));
}
}
}

View File

@@ -423,9 +423,12 @@ char *argv[];
update_inventory();
if (discover || wizard) {
if(yn("Do you want to keep the save file?") == 'n'){
if(yn("Do you want to keep the save file?") == 'n')
(void) delete_savefile();
else {
nh_compress(fqname(SAVEF, SAVEPREFIX, 0));
}
}
context.move = 0;

View File

@@ -282,6 +282,9 @@ WINLIB = $(WINTTYLIB)
# IRIX 4.0.x needs -lsun if NIS (YP) is being used for passwd file lookup
# LIBS = -lsun
#
# If ZLIB_COMP is defined in config.h this is necessary to link with zlib.
# LIBS = -lz
#
LIBS =
# make NetHack

View File

@@ -287,7 +287,7 @@ char *argv[];
(void) delete_savefile();
else {
(void) chmod(fq_save,FCMASK); /* back to readable */
compress(fq_save);
nh_compress(fq_save);
}
}
context.move = 0;

View File

@@ -1,5 +1,5 @@
# SCCS Id: @(#)Makefile.msc 3.5 $Date$
# Copyright (c) NetHack PC Development Team 1993-2003
# Copyright (c) NetHack PC Development Team 1993-2005
#
# NetHack 3.5.x Makefile for MS Visual C++ V6.x and above and MS NMAKE
#
@@ -127,6 +127,15 @@ RANDOM = $(OBJ)\random.o
PRECOMPHEAD = N # set to Y if you want to use precomp. headers
#
# If you defined ZLIB_COMP in include/config.h and you need
# to link with the zlib.lib library, uncomment the line below.
# If necessary, prefix explicit path information to the file name
# otherwise it assumes the NetHack src directory.
#
#ZLIB = zlib.lib
#===============================================
#======= End of Modification Section ===========
#===============================================
@@ -578,7 +587,7 @@ $(NHRES): $(NTSYS)\console.rc $(NTSYS)\NetHack.ico
$(GAMEFILE) : $(ALLOBJ) $(NHRES) $(O)gamedir.tag $(WINDLLS)
@if not exist $(GAMEDIR)\*.* mkdir $(GAMEDIR)
@echo Linking....
$(link) $(LFLAGS) user32.lib winmm.lib -out:$@ @<<$(GAME).lnk
$(link) $(LFLAGS) $(ZLIB) user32.lib winmm.lib -out:$@ @<<$(GAME).lnk
$(ALLOBJ:^ =^
) $(NHRES)
<<