GOLDOBJ compat (main trunk only)

This patch gives game and savefile compatibility
whether GOLDOBJ is defined or not.

You can build with GOLDOBJ defined or not, and
still load your saved games. Rebuild with the
opposite, and load the same game.

That way GOLDOBJ can be experimented with
more easily.

1. Leave the "you" struct and the "monst"
   struct the same under the hood between
   GOLDOBJ and !GOLDOBJ.

2. Always write out gold as an
   object on the player and monster
   inventory chains.

On a restore of the savefile with GOLDOBJ
not defined,  take the gold objects out of
the inventory chains and put it into u.ugold
or mtmp->mgold as appropriate.

On a restore of the savefile with GOLDOBJ
defined, nothing special is done.
This commit is contained in:
nethack.allison
2003-04-11 22:32:08 +00:00
parent b39599719e
commit e1aa6d5148
7 changed files with 83 additions and 6 deletions

View File

@@ -1672,6 +1672,9 @@ E int FDECL(mread, (int,genericptr_t,unsigned int));
#else
E void FDECL(mread, (int,genericptr_t,unsigned int));
#endif
#ifndef GOLDOBJ
E void FDECL(put_gold_back, (struct obj **,long *));
#endif
/* ### rip.c ### */

View File

@@ -130,8 +130,9 @@ struct monst {
long mtrapseen; /* bitmap of traps we've been trapped in */
long mlstmv; /* for catching up with lost time */
long mspare1;
#ifndef GOLDOBJ
long mgold;
#define mgold mspare1
#endif
struct obj *minvent;

View File

@@ -13,7 +13,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 0
#define EDITLEVEL 1
#define COPYRIGHT_BANNER_A \
"NetHack, Copyright 1985-2003"

View File

@@ -337,10 +337,11 @@ struct you {
int ugangr; /* if the gods are angry at you */
int ugifts; /* number of artifacts bestowed */
int ublessed, ublesscnt; /* blessing/duration from #pray */
#ifndef GOLDOBJ
long ugold, ugold0;
#else
long umoney0;
long uspare1;
#ifndef GOLDOBJ
#define ugold uspare1
#define ugold0 umoney0
#endif
long uexp, urexp;
long ucleansed; /* to record moves when player was cleansed */