diff --git a/include/global.h b/include/global.h index 037e09dfc..b52d14b3c 100644 --- a/include/global.h +++ b/include/global.h @@ -352,6 +352,14 @@ struct savefile_info { #define MAXMONNO 120 /* extinct monst after this number created */ #define MHPMAX 500 /* maximum monster hp */ +/* + * Version 3.7.x has aspirations of portable file formats. We + * make a distinction between MAIL functionality and MAIL_STRUCTURES + * so that the underlying structures are consistent, whether MAIL is + * defined or not. + */ +#define MAIL_STRUCTURES + /* PANICTRACE: Always defined for NH_DEVEL_STATUS != NH_STATUS_RELEASED but only for supported platforms. */ #ifdef UNIX diff --git a/src/bones.c b/src/bones.c index b57d592a8..1e55db088 100644 --- a/src/bones.c +++ b/src/bones.c @@ -135,7 +135,7 @@ boolean restore; if (otmp->otyp == SLIME_MOLD) { goodfruit(otmp->spe); -#ifdef MAIL +#ifdef MAIL_STRUCTURES } else if (otmp->otyp == SCR_MAIL) { /* 0: delivered in-game via external event; 1: from bones or wishing; 2: written with marker */ diff --git a/src/dogmove.c b/src/dogmove.c index e74c0a418..a70c9c70a 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -432,7 +432,7 @@ int udist; } else { if ((obj = g.level.objects[omx][omy]) != 0 && !index(nofetch, obj->oclass) -#ifdef MAIL +#ifdef MAIL_STRUCTURES && obj->otyp != SCR_MAIL #endif ) { diff --git a/src/eat.c b/src/eat.c index abad8bf9c..85f07348f 100644 --- a/src/eat.c +++ b/src/eat.c @@ -2104,7 +2104,7 @@ eatspecial() return; } if (objects[otmp->otyp].oc_material == PAPER) { -#ifdef MAIL +#ifdef MAIL_STRUCTURES if (otmp->otyp == SCR_MAIL) /* no nutrition */ pline("This junk mail is less than satisfying."); @@ -2550,7 +2550,7 @@ doeat() /* oc_nutrition is usually weight anyway */ else basenutrit = objects[otmp->otyp].oc_nutrition; -#ifdef MAIL +#ifdef MAIL_STRUCTURES if (otmp->otyp == SCR_MAIL) { basenutrit = 0; nodelicious = TRUE; diff --git a/src/exper.c b/src/exper.c index ab5a84348..73bfe9f4b 100644 --- a/src/exper.c +++ b/src/exper.c @@ -128,7 +128,7 @@ register int nk; if (mtmp->m_lev > 8) tmp += 50; -#ifdef MAIL +#ifdef MAIL_STRUCTURES /* Mail daemons put up no fight. */ if (mtmp->data == &mons[PM_MAIL_DAEMON]) tmp = 1; diff --git a/src/mail.c b/src/mail.c index 839e030a4..a6ec5ddc6 100644 --- a/src/mail.c +++ b/src/mail.c @@ -10,8 +10,12 @@ # include # include #endif /* SIMPLE_MAIL */ +#endif /* MAIL */ +#ifdef MAIL_STRUCTURES #include "mail.h" +#endif +#ifdef MAIL /* * Notify user when new mail has arrived. Idea by Merlyn Leroy. * diff --git a/src/makemon.c b/src/makemon.c index 5d74c1c96..dfe7940e4 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1623,7 +1623,7 @@ int mndx, mvflagsmask, genomask; return FALSE; if (is_placeholder(ptr)) return FALSE; -#ifdef MAIL +#ifdef MAIL_STRUCTURES /* special levels might ask for random demon type; reject this one */ if (ptr == &mons[PM_MAIL_DAEMON]) return FALSE; diff --git a/src/mkobj.c b/src/mkobj.c index 29f44a91b..54416100e 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -980,7 +980,7 @@ boolean artif; break; case POTION_CLASS: /* note: potions get some additional init below */ case SCROLL_CLASS: -#ifdef MAIL +#ifdef MAIL_STRUCTURES if (otmp->otyp != SCR_MAIL) #endif blessorcurse(otmp, 4); diff --git a/src/mon.c b/src/mon.c index fd030dbee..3edeac039 100644 --- a/src/mon.c +++ b/src/mon.c @@ -2038,7 +2038,7 @@ register struct monst *mtmp; /* if it's a (possibly polymorphed) quest leader, mark him as dead */ if (mtmp->m_id == g.quest_status.leader_m_id) g.quest_status.leader_is_dead = TRUE; -#ifdef MAIL +#ifdef MAIL_STRUCTURES /* if the mail daemon dies, no more mail delivery. -3. */ if (tmp == PM_MAIL_DAEMON) g.mvitals[tmp].mvflags |= G_GENOD; @@ -2412,7 +2412,7 @@ int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */ if (nocorpse || LEVEL_SPECIFIC_NOCORPSE(mdat)) goto cleanup; -#ifdef MAIL +#ifdef MAIL_STRUCTURES if (mdat == &mons[PM_MAIL_DAEMON]) { stackobj(mksobj_at(SCR_MAIL, x, y, FALSE, FALSE)); } diff --git a/src/monmove.c b/src/monmove.c index 0e805492c..3ec0afef9 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -925,7 +925,7 @@ register int after; mmoved = 0; } -#ifdef MAIL +#ifdef MAIL_STRUCTURES if (ptr == &mons[PM_MAIL_DAEMON]) { if (!Deaf && canseemon(mtmp)) verbalize("I'm late!"); diff --git a/src/monst.c b/src/monst.c index 4c798aec3..23af5d298 100644 --- a/src/monst.c +++ b/src/monst.c @@ -2589,7 +2589,7 @@ struct permonst _mons2[] = { M3_INFRAVISIBLE | M3_INFRAVISION | M3_DISPLACES, 34, HI_LORD), /* other demons */ -#ifdef MAIL +#ifdef MAIL_STRUCTURES MON("mail daemon", S_DEMON, LVL(56, 24, 10, 127, 0), (G_NOGEN | G_NOCORPSE), A(NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), diff --git a/src/objects.c b/src/objects.c index 984a67e3e..adb86dc80 100644 --- a/src/objects.c +++ b/src/objects.c @@ -876,7 +876,7 @@ SCROLL(None, "STRC PRST SKRZ KRK", 1, 0, 100), /* Czech and Slovak tongue-twister */ /* These must come last because they have special fixed descriptions. */ -#ifdef MAIL +#ifdef MAIL_STRUCTURES SCROLL("mail", "stamped", 0, 0, 0), #endif SCROLL("blank paper", "unlabeled", 0, 28, 60), diff --git a/src/objnam.c b/src/objnam.c index 079de1bbf..cc95bc653 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1013,7 +1013,7 @@ unsigned doname_flags; || ((!known || !objects[obj->otyp].oc_charged || obj->oclass == ARMOR_CLASS || obj->oclass == RING_CLASS) -#ifdef MAIL +#ifdef MAIL_STRUCTURES && obj->otyp != SCR_MAIL #endif && obj->otyp != FAKE_AMULET_OF_YENDOR @@ -1326,7 +1326,7 @@ struct obj *otmp; return FALSE; /* always fully ID'd */ /* check fundamental ID hallmarks first */ if (!otmp->known || !otmp->dknown -#ifdef MAIL +#ifdef MAIL_STRUCTURES || (!otmp->bknown && otmp->otyp != SCR_MAIL) #else || !otmp->bknown @@ -3861,7 +3861,7 @@ struct obj *no_wish; case STATUE: /* otmp->cobj already done in mksobj() */ break; -#ifdef MAIL +#ifdef MAIL_STRUCTURES case SCR_MAIL: /* 0: delivered in-game via external event (or randomly for fake mail); 1: from bones or wishing; 2: written with marker */ @@ -3909,7 +3909,7 @@ struct obj *no_wish; break; case FIGURINE: if (!(mons[mntmp].geno & G_UNIQ) && !is_human(&mons[mntmp]) -#ifdef MAIL +#ifdef MAIL_STRUCTURES && mntmp != PM_MAIL_DAEMON #endif ) diff --git a/src/options.c b/src/options.c index 5c18d6521..e4cc893d0 100644 --- a/src/options.c +++ b/src/options.c @@ -151,7 +151,7 @@ static const struct Bool_Opt { { "legacy", &flags.legacy, TRUE, DISP_IN_GAME }, { "lit_corridor", &flags.lit_corridor, FALSE, SET_IN_GAME }, { "lootabc", &flags.lootabc, FALSE, SET_IN_GAME }, -#ifdef MAIL +#ifdef MAIL_STRUCTURES { "mail", &flags.biff, TRUE, SET_IN_GAME }, #else { "mail", (boolean *) 0, TRUE, SET_IN_FILE }, diff --git a/src/role.c b/src/role.c index 487999ac7..349c736b8 100644 --- a/src/role.c +++ b/src/role.c @@ -2084,7 +2084,7 @@ struct monst *mtmp; return "Aloha"; /* Hawaiian */ case PM_VALKYRIE: return -#ifdef MAIL +#ifdef MAIL_STRUCTURES (mtmp && mtmp->data == &mons[PM_MAIL_DAEMON]) ? "Hallo" : #endif "Velkommen"; /* Norse */ diff --git a/src/trap.c b/src/trap.c index dfb06a258..119589a47 100644 --- a/src/trap.c +++ b/src/trap.c @@ -3455,7 +3455,7 @@ struct obj *obj; grease_protect(obj, (char *) 0, victim); } else if (obj->oclass == SCROLL_CLASS && obj->otyp != SCR_BLANK_PAPER) { if (obj->otyp != SCR_BLANK_PAPER -#ifdef MAIL +#ifdef MAIL_STRUCTURES && obj->otyp != SCR_MAIL #endif ) { @@ -3531,7 +3531,7 @@ boolean force; return ER_NOTHING; } else if (obj->oclass == SCROLL_CLASS) { if (obj->otyp == SCR_BLANK_PAPER -#ifdef MAIL +#ifdef MAIL_STRUCTURES || obj->otyp == SCR_MAIL #endif ) return 0; diff --git a/src/write.c b/src/write.c index be48b67b5..a21fc816c 100644 --- a/src/write.c +++ b/src/write.c @@ -18,7 +18,7 @@ register struct obj *otmp; return (10 * objects[otmp->otyp].oc_level); switch (otmp->otyp) { -#ifdef MAIL +#ifdef MAIL_STRUCTURES case SCR_MAIL: return 2; #endif @@ -333,7 +333,7 @@ found: } new_obj->blessed = (curseval > 0); new_obj->cursed = (curseval < 0); -#ifdef MAIL +#ifdef MAIL_STRUCTURES if (new_obj->otyp == SCR_MAIL) /* 0: delivered in-game via external event (or randomly for fake mail); 1: from bones or wishing; 2: written with marker */ diff --git a/src/zap.c b/src/zap.c index a98ce852e..be7c85464 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1231,7 +1231,7 @@ int mat, minwt; continue; if (obj_resists(otmp, 0, 0)) continue; /* preserve unique objects */ -#ifdef MAIL +#ifdef MAIL_STRUCTURES if (otmp->otyp == SCR_MAIL) continue; #endif @@ -1358,7 +1358,7 @@ struct obj *obj; { long i; -#ifdef MAIL +#ifdef MAIL_STRUCTURES if (obj->otyp == SCR_MAIL) return; #endif @@ -1456,7 +1456,7 @@ int id; /* preserve inventory letter if in inventory */ if (obj_location == OBJ_INVENT) otmp->invlet = obj->invlet; -#ifdef MAIL +#ifdef MAIL_STRUCTURES /* You can't send yourself 100 mail messages and then * polymorph them into useful scrolls */ diff --git a/util/makedefs.c b/util/makedefs.c index 953fdddd1..608491894 100644 --- a/util/makedefs.c +++ b/util/makedefs.c @@ -1111,7 +1111,7 @@ make_version() version.feature_set = (unsigned long) (0L /* levels and/or topology (0..4) */ /* monsters (5..9) */ -#ifdef MAIL +#ifdef MAIL_STRUCTURES | (1L << 6) #endif /* objects (10..14) */ @@ -1561,7 +1561,7 @@ static const char *build_opts[] = { #ifdef PANICLOG "errors and warnings log file", #endif -#ifdef MAIL +#ifdef MAIL_STRUCTURES "mail daemon", #endif #ifdef GNUDOS diff --git a/win/share/tilemap.c b/win/share/tilemap.c index 39f3d4fc3..6651332e9 100644 --- a/win/share/tilemap.c +++ b/win/share/tilemap.c @@ -54,7 +54,7 @@ struct conditionals { #ifndef CHARON /* not supported yet */ { MON_GLYPH, PM_CROESUS, "Charon" }, #endif -#ifndef MAIL +#ifndef MAIL_STRUCTURES { MON_GLYPH, PM_FAMINE, "mail daemon" }, #endif /* commented out in monst.c at present */ @@ -69,7 +69,7 @@ struct conditionals { /* allow slime mold to look like slice of pizza, since we * don't know what a slime mold should look like when renamed anyway */ -#ifndef MAIL +#ifndef MAIL_STRUCTURES { OBJ_GLYPH, SCR_STINKING_CLOUD + EXTRA_SCROLL_DESCR_COUNT, "stamped / mail" }, #endif