[crossfire] loader mangles item names
Andreas Kirschbaum
kirschbaum at myrealbox.com
Sun Aug 28 08:23:53 CDT 2005
While searching for the source of bug #1059537 (Chainmail mutations) I
discovered that the loader strips out leading material names.
cvs diff -r 1.36 -r 1.37 common/loader contains:
|
Index: common/loader.l
|
===================================================================
|
RCS file: /cvsroot/crossfire/crossfire/common/loader.l,v
|
retrieving revision 1.36
|
retrieving revision 1.37
|
diff -u -r1.36 -r1.37
|
--- common/loader.l 30 Jan 2003 00:07:08 -0000 1.36
|
+++ common/loader.l 7 Feb 2003 06:57:17 -0000 1.37
|
@@ -133,6 +135,22 @@
|
else
|
set_materialname(op, 5);
|
}
|
+ /* back out the materialname from op->name very limited subset of obs */
|
+ if ((IS_WEAPON(op) || IS_ARMOR(op)) && op->name && op->materialname) {
|
+ mt = name_to_material(op->materialname);
|
+ if (mt && strstr(op->name, mt->description) &&
|
+ strstr(op->name, mt->description) == op->name) {
|
+ sprintf(buf, "%s", op->name);
|
+ p = buf + strlen(mt->description) + 1;
|
+ free_string(op->name);
|
+ op->name = add_string(p);
|
+ sprintf(buf, "%s", op->name_pl);
|
+ p = buf + strlen(mt->description) + 1;
|
+ free_string(op->name_pl);
|
+ op->name_pl = add_string(p);
|
+ }
|
+ }
|
+
|
|
/* We changed last_heal to gen_sp_armour, which is what it
|
* really does for many objects. Need to catch any in maps
The log message is:
|
----------------------------
|
revision 1.37
|
date: 2003/02/07 06:57:17; author: garbled; state: Exp; lines: +19 -1
|
Mark clued me in that query_name existed.. and that brought to light that
|
the way I was handling materialnames before was stupid. Back the old
|
code out, and use query_name instead. Put something in the loader to
|
back the names out of the objects I mangled.
|
----------------------------
That is, code to fix object names that have been mangled by a previous
bug now mangles item names of newly created items.
Since this patch is now more than two year old, most item names should
have been fixed by now. Therefore: any objections if I remove this code
fragment again?
More information about the crossfire
mailing list