artifact tracking again
Redo the recent artifact creation stuff by replacing several nearly identical routines with one more general one. Also adds a tracking bit for one or two more creation methods. That changed artiexist[] from an array of structs holding 8 or less bits to one holding 9, so bump EDITLEVEL in case the total size changed.
This commit is contained in:
@@ -1300,16 +1300,18 @@ do_oname(register struct obj *obj)
|
||||
a valid artifact name */
|
||||
u.uconduct.literate++;
|
||||
}
|
||||
obj = oname(obj, buf, ONAME_VIA_NAMING);
|
||||
obj = oname(obj, buf, ONAME_VIA_NAMING | ONAME_KNOW_ARTI);
|
||||
}
|
||||
|
||||
struct obj *
|
||||
oname(struct obj *obj, const char *name, unsigned oflgs)
|
||||
oname(
|
||||
struct obj *obj, /* item to assign name to */
|
||||
const char *name, /* name to assign */
|
||||
unsigned oflgs) /* flags for artifact creation; otherwise ignored */
|
||||
{
|
||||
int lth;
|
||||
char buf[PL_PSIZ];
|
||||
boolean via_naming = (oflgs & ONAME_VIA_NAMING) != 0,
|
||||
found_arti = (oflgs & ONAME_FOUND_ARTI) != 0;
|
||||
boolean via_naming = (oflgs & ONAME_VIA_NAMING) != 0;
|
||||
|
||||
lth = *name ? (int) (strlen(name) + 1) : 0;
|
||||
if (lth > PL_PSIZ) {
|
||||
@@ -1329,7 +1331,7 @@ oname(struct obj *obj, const char *name, unsigned oflgs)
|
||||
Strcpy(ONAME(obj), name);
|
||||
|
||||
if (lth)
|
||||
artifact_exists(obj, name, TRUE, via_naming || found_arti);
|
||||
artifact_exists(obj, name, TRUE, oflgs);
|
||||
if (obj->oartifact) {
|
||||
/* can't dual-wield with artifact as secondary weapon */
|
||||
if (obj == uswapwep)
|
||||
@@ -1341,8 +1343,6 @@ oname(struct obj *obj, const char *name, unsigned oflgs)
|
||||
if (obj->unpaid)
|
||||
alter_cost(obj, 0L);
|
||||
if (via_naming) {
|
||||
(void) artifact_named(obj, TRUE);
|
||||
|
||||
/* violate illiteracy conduct since successfully wrote arti-name */
|
||||
if (!u.uconduct.literate++)
|
||||
livelog_printf(LL_CONDUCT | LL_ARTIFACT,
|
||||
|
||||
Reference in New Issue
Block a user