'struct former' -> 'struct ebones'
Some variants were already using a similar approach using a struct called 'ebones', so adopt the same naming so NetHack-3.7, hardfought, and some variants are using the same name. As before there are fields in the struct that are not currently used by NetHack-3.7, but the intent is that hardfought save and bones files can be loaded by NetHack-3.7 without code modification, for debugging bug reports. This invalidates existing save and bones files.
This commit is contained in:
59
src/bones.c
59
src/bones.c
@@ -502,16 +502,39 @@ savebones(int how, time_t when, struct obj *corpse)
|
||||
(void) obj_attach_mid(corpse, mtmp->m_id);
|
||||
}
|
||||
if (mtmp) {
|
||||
int i;
|
||||
|
||||
mtmp->m_lev = (u.ulevel ? u.ulevel : 1);
|
||||
mtmp->mhp = mtmp->mhpmax = u.uhpmax;
|
||||
mtmp->female = flags.female;
|
||||
mtmp->msleeping = 1;
|
||||
if (!has_former(mtmp))
|
||||
newformer(mtmp);
|
||||
if (has_former(mtmp)) {
|
||||
FORMER(mtmp)->rank.lev = mtmp->m_lev;
|
||||
FORMER(mtmp)->rank.mnum = Role_switch;
|
||||
FORMER(mtmp)->rank.female = flags.female;
|
||||
|
||||
if (!has_ebones(mtmp))
|
||||
newebones(mtmp);
|
||||
if (has_ebones(mtmp)) {
|
||||
for (i = 0; i <= NUM_ROLES; ++i) {
|
||||
if (!strcmp(gu.urole.name.m, roles[i].name.m)) {
|
||||
EBONES(mtmp)->role = i;
|
||||
break;
|
||||
}
|
||||
/* impossible("savebones: bad gu.urole.name.m \"%s\"",
|
||||
gu.urole.name.m); */
|
||||
}
|
||||
for (i = 0; i <= NUM_RACES; ++i) {
|
||||
if (!strcmp(gu.urace.noun, races[i].noun)) {
|
||||
EBONES(mtmp)->race = i;
|
||||
break;
|
||||
}
|
||||
/* impossible("savebones: bad gu.urace.noun \"%s\"",
|
||||
gu.urace.noun); */
|
||||
}
|
||||
EBONES(mtmp)->oldalign = u.ualign;
|
||||
EBONES(mtmp)->deathlevel = u.ulevel;
|
||||
EBONES(mtmp)->luck = u.uluck; /* moreluck not included */
|
||||
EBONES(mtmp)->mnum = Role_switch;
|
||||
EBONES(mtmp)->female = flags.female;
|
||||
EBONES(mtmp)->demigod = u.uevent.udemigod;
|
||||
EBONES(mtmp)->crowned = u.uevent.uhand_of_elbereth;
|
||||
}
|
||||
}
|
||||
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
|
||||
@@ -783,4 +806,28 @@ fix_ghostly_obj(struct obj *obj)
|
||||
obj->ghostly = 0;
|
||||
}
|
||||
|
||||
void
|
||||
newebones(struct monst *mtmp)
|
||||
{
|
||||
if (!mtmp->mextra)
|
||||
mtmp->mextra = newmextra();
|
||||
if (!EBONES(mtmp)) {
|
||||
EBONES(mtmp) = (struct ebones *) alloc(
|
||||
sizeof(struct ebones *));
|
||||
(void) memset((genericptr_t) EBONES(mtmp), 0,
|
||||
sizeof(struct ebones *));
|
||||
EBONES(mtmp)->parentmid = mtmp->m_id;
|
||||
}
|
||||
}
|
||||
|
||||
/* this is not currently used */
|
||||
void
|
||||
free_ebones(struct monst *mtmp)
|
||||
{
|
||||
if (mtmp->mextra && EBONES(mtmp)) {
|
||||
free((genericptr_t) EBONES(mtmp));
|
||||
EBONES(mtmp) = (struct ebones *) 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*bones.c*/
|
||||
|
||||
Reference in New Issue
Block a user