From ae6eeec22ad877e6ba1b13ccc9e63c57c2b18282 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 22 Apr 2015 19:47:55 -0700 Subject: [PATCH] statue glyph save/restore Remove the code that converted statues shown as monsters into stautes shown as big rocks when saving and then reversed the effect when restoring. It was done to preserve save file compatability with 3.4.3 where statue-as-monster glyphs didn't exist, so is no longer useful. --- include/display.h | 14 +------------- src/restore.c | 11 +---------- src/save.c | 35 +++++++---------------------------- 3 files changed, 9 insertions(+), 51 deletions(-) diff --git a/include/display.h b/include/display.h index 5be06d08a..622a90282 100644 --- a/include/display.h +++ b/include/display.h @@ -1,4 +1,4 @@ -/* NetHack 3.5 display.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 display.h $NHDT-Date: 1429757270 2015/04/23 02:47:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.19 $ */ /* NetHack 3.5 display.h $Date: 2009/05/06 10:44:38 $ $Revision: 1.14 $ */ /* SCCS Id: @(#)display.h 3.5 2005/06/21 */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ @@ -308,16 +308,6 @@ (int) (obj)->otyp + GLYPH_OBJ_OFF) -#define obj_to_glyph_vanilla(obj) \ - (Hallucination ? \ - ((otg_temp = random_object()) == CORPSE ? \ - random_monster() + GLYPH_BODY_OFF : \ - otg_temp + GLYPH_OBJ_OFF) : \ - ((obj)->otyp == CORPSE ? \ - (int) (obj)->corpsenm + GLYPH_BODY_OFF : \ - (int) (obj)->otyp + GLYPH_OBJ_OFF)) - - /* MRKR: Statues now have glyphs corresponding to the monster they */ /* brepresent and look like monsters when you are hallucinating. */ @@ -405,8 +395,6 @@ #define glyph_is_statue(glyph) \ ((glyph) >= GLYPH_STATUE_OFF && (glyph) < (GLYPH_STATUE_OFF+NUMMONS)) -#define GLYPH_STATUE_VANILLA ((int) GLYPH_OBJ_OFF + STATUE) -#define glyph_is_statue_vanilla(glyph) ( glyph == GLYPH_STATUE_VANILLA) #define glyph_is_ridden_monster(glyph) \ ((glyph) >= GLYPH_RIDDEN_OFF && (glyph) < (GLYPH_RIDDEN_OFF+NUMMONS)) diff --git a/src/restore.c b/src/restore.c index 094820208..c7fc31c07 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 restore.c $NHDT-Date: 1426465439 2015/03/16 00:23:59 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.77 $ */ +/* NetHack 3.5 restore.c $NHDT-Date: 1429757270 2015/04/23 02:47:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.93 $ */ /* NetHack 3.5 restore.c $Date: 2012/02/16 02:40:24 $ $Revision: 1.71 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -124,15 +124,6 @@ find_lev_obj() fobjtmp = otmp->nobj; place_object(otmp, otmp->ox, otmp->oy); } - - /* statue patch: imagine we're loading a vanilla nh file */ - for(x=0; xotyp == STATUE && - glyph_is_statue_vanilla(levl[x][y].glyph)) { - levl[x][y].glyph = obj_to_glyph(level.objects[x][y]); - } } /* Things that were marked "in_use" when the game was saved (ex. via the diff --git a/src/save.c b/src/save.c index fb695d1ed..7069a8eca 100644 --- a/src/save.c +++ b/src/save.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 save.c $NHDT-Date: 1426496455 2015/03/16 09:00:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */ +/* NetHack 3.5 save.c $NHDT-Date: 1429757271 2015/04/23 02:47:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.82 $ */ /* NetHack 3.5 save.c $Date: 2012/02/16 02:40:24 $ $Revision: 1.53 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -82,23 +82,6 @@ static long nulls[sizeof(struct trap) + sizeof(struct fruit)]; #define HUP #endif - -/* compute object glyphs for vanilla nethack -- statue patch */ -void -make_glyphs_vanilla(lev) -xchar lev; -{ - int x,y; - - for (x = 0; x < COLNO; x++) - for (y = 0; y < ROWNO; y++) - if ( level.objects[x][y] != 0 && - level.objects[x][y]->otyp == STATUE && - glyph_is_statue(levl[x][y].glyph)) - levl[x][y].glyph = obj_to_glyph_vanilla(level.objects[x][y]); -} - - /* need to preserve these during save to avoid accessing freed memory */ static unsigned ustuck_id = 0, usteed_id = 0; @@ -487,20 +470,16 @@ int mode; short tlev; #endif - /* make remembered glyphs correct fo rloading into vanilla nh */ - make_glyphs_vanilla(lev); - /* if we're tearing down the current level without saving anything (which happens upon entrance to the endgame or after an aborted restore attempt) then we don't want to do any actual I/O */ if (mode == FREE_SAVE) goto skip_lots; - if (iflags.purge_monsters) { - /* purge any dead monsters (necessary if we're starting - * a panic save rather than a normal one, or sometimes - * when changing levels without taking time -- e.g. - * create statue trap then immediately level teleport) */ - dmonsfree(); - } + + /* purge any dead monsters (necessary if we're starting + a panic save rather than a normal one, or sometimes + when changing levels without taking time -- e.g. + create statue trap then immediately level teleport) */ + if (iflags.purge_monsters) dmonsfree(); if(fd < 0) panic("Save on bad file!"); /* impossible */ #ifdef MFLOPPY