|
From: Crossfire C. r. messages.
<cro...@li...> - 2011-06-29 17:18:49
|
Revision: 14734
http://crossfire.svn.sourceforge.net/crossfire/?rev=14734&view=rev
Author: ryo_saeba
Date: 2011-06-29 17:18:42 +0000 (Wed, 29 Jun 2011)
Log Message:
-----------
Clean function call.
Modified Paths:
--------------
server/trunk/common/loader.l
server/trunk/common/treasure.c
server/trunk/common/utils.c
server/trunk/include/libproto.h
server/trunk/test/bugs/bugtrack/check_1727944.c
Modified: server/trunk/common/loader.l
===================================================================
--- server/trunk/common/loader.l 2011-06-29 17:13:23 UTC (rev 14733)
+++ server/trunk/common/loader.l 2011-06-29 17:18:42 UTC (rev 14734)
@@ -383,10 +383,7 @@
/* objects now have a materialname. try to patch it in */
if (!(IS_WEAPON(op) && op->level > 0)) {
- if (op->map != NULL)
- set_materialname(op, op->map->difficulty, NULL);
- else
- set_materialname(op, 5, NULL);
+ set_materialname(op);
}
/* only do these when program is first run - a bit
* excessive to do this at every run - most of this is
Modified: server/trunk/common/treasure.c
===================================================================
--- server/trunk/common/treasure.c 2011-06-29 17:13:23 UTC (rev 14733)
+++ server/trunk/common/treasure.c 2011-06-29 17:18:42 UTC (rev 14734)
@@ -1133,9 +1133,8 @@
}
/* materialtype modifications. Note we allow this on artifacts. */
+ set_materialname(op);
- set_materialname(op, difficulty, NULL);
-
if (flags>_MINIMAL) {
if (op->type == POTION)
/* Handle healing and magic power potions */
Modified: server/trunk/common/utils.c
===================================================================
--- server/trunk/common/utils.c 2011-06-29 17:13:23 UTC (rev 14733)
+++ server/trunk/common/utils.c 2011-06-29 17:18:42 UTC (rev 14734)
@@ -303,28 +303,23 @@
}
/**
- * Set the materialname and type for an item
+ * Set the material name and type for an item, if not set.
+ * @param op item to set the material for.
*/
-void set_materialname(object *op, int difficulty, materialtype_t *nmt) {
- materialtype_t *mt, *lmt;
+void set_materialname(object *op) {
+ materialtype_t *mt;
if (op->materialname != NULL)
return;
- if (nmt == NULL) {
- lmt = NULL;
- for (mt = materialt; mt != NULL && mt->next != NULL; mt = mt->next) {
- if (op->material&mt->material) {
- lmt = mt;
- break;
- }
+ for (mt = materialt; mt != NULL && mt->next != NULL; mt = mt->next) {
+ if (op->material&mt->material) {
+ break;
}
- } else {
- lmt = nmt;
}
- if (lmt != NULL) {
- op->materialname = add_string(lmt->name);
+ if (mt != NULL) {
+ op->materialname = add_string(mt->name);
return;
}
}
Modified: server/trunk/include/libproto.h
===================================================================
--- server/trunk/include/libproto.h 2011-06-29 17:13:23 UTC (rev 14733)
+++ server/trunk/include/libproto.h 2011-06-29 17:18:42 UTC (rev 14734)
@@ -417,7 +417,7 @@
extern void decay_objects(mapstruct *m);
extern materialtype_t *name_to_material(const char *name);
extern void transmute_materialname(object *op, const object *change);
-extern void set_materialname(object *op, int difficulty, materialtype_t *nmt);
+extern void set_materialname(object *op);
extern const char *strrstr(const char *haystack, const char *needle);
extern void strip_endline(char *buf);
extern void replace(const char *src, const char *key, const char *replacement, char *result, size_t resultsize);
Modified: server/trunk/test/bugs/bugtrack/check_1727944.c
===================================================================
--- server/trunk/test/bugs/bugtrack/check_1727944.c 2011-06-29 17:13:23 UTC (rev 14733)
+++ server/trunk/test/bugs/bugtrack/check_1727944.c 2011-06-29 17:18:42 UTC (rev 14734)
@@ -212,10 +212,7 @@
/* objects now have a materialname. try to patch it in */
if (!(IS_WEAPON(op) && op->level > 0)) {
- if (op->map != NULL)
- set_materialname(op, op->map->difficulty, NULL);
- else
- set_materialname(op, 5, NULL);
+ set_materialname(op);
}
/* only do these when program is first run - a bit
* excessive to do this at every run - most of this is
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|