|
From: Crossfire C. r. messages.
<cro...@li...> - 2011-06-29 17:13:29
|
Revision: 14733
http://crossfire.svn.sourceforge.net/crossfire/?rev=14733&view=rev
Author: ryo_saeba
Date: 2011-06-29 17:13:23 +0000 (Wed, 29 Jun 2011)
Log Message:
-----------
Remove NEW_MATERIAL_CODE support.
Modified Paths:
--------------
server/trunk/ChangeLog
server/trunk/common/item.c
server/trunk/common/utils.c
server/trunk/include/config.h
Modified: server/trunk/ChangeLog
===================================================================
--- server/trunk/ChangeLog 2011-06-28 20:23:11 UTC (rev 14732)
+++ server/trunk/ChangeLog 2011-06-29 17:13:23 UTC (rev 14733)
@@ -14,6 +14,9 @@
else. With this, include the file(s) that you changed.
------------------------------------------------------------------------------
+Remove NEW_MATERIAL_CODE support.
+Nicolas Weeger 2011-06-29
+
Fix crash with detect monster on custom monsters.
Reference count wasn't uptodate, thus archetype would be freed.
Nicolas Weeger 2011-06-28
Modified: server/trunk/common/item.c
===================================================================
--- server/trunk/common/item.c 2011-06-28 20:23:11 UTC (rev 14732)
+++ server/trunk/common/item.c 2011-06-29 17:13:23 UTC (rev 14733)
@@ -615,22 +615,9 @@
*/
void query_name(const object *op, char *buf, size_t size) {
size_t len = 0;
-#ifdef NEW_MATERIAL_CODE
- materialtype_t *mt;
-#endif
buf[0] = '\0';
-#ifdef NEW_MATERIAL_CODE
- if ((IS_ARMOR(op) || IS_WEAPON(op) || IS_SHIELD(op)) && op->materialname) {
- mt = name_to_material(op->materialname);
- if (mt) {
- safe_strcat(buf, mt->description, &len, size);
- safe_strcat(buf, " ", &len, size);
- }
- }
-#endif
-
query_short_name(op, buf+len, size-len);
len += strlen(buf+len);
@@ -718,9 +705,6 @@
*/
void query_base_name(const object *op, int plural, char *buf, size_t size) {
size_t len;
-#ifdef NEW_MATERIAL_CODE
- materialtype_t *mt;
-#endif
if ((!plural && !op->name)
|| (plural && !op->name_pl)) {
@@ -735,27 +719,9 @@
buf[0] = '\0';
-#ifdef NEW_MATERIAL_CODE
- if ((IS_ARMOR(op) || IS_WEAPON(op)) && op->materialname)
- mt = name_to_material(op->materialname);
- else
- mt = NULL;
+ snprintf(buf, size, "%s", plural ? op->name_pl : op->name);
+ len = strlen(buf);
- if (mt
- && op->arch->clone.materialname != mt->name
- && !(op->material&M_SPECIAL)) {
- snprintf(buf, size, "%s", mt->description);
- len = strlen(buf);
- safe_strcat(buf, " ", &len, size);
- safe_strcat(buf, plural ? op->name_pl : op->name, &len, size);
- } else {
-#endif
- snprintf(buf, size, "%s", plural ? op->name_pl : op->name);
- len = strlen(buf);
-#ifdef NEW_MATERIAL_CODE
- }
-#endif
-
if (op->title && QUERY_FLAG(op, FLAG_IDENTIFIED)) {
safe_strcat(buf, " ", &len, size);
safe_strcat(buf, op->title, &len, size);
Modified: server/trunk/common/utils.c
===================================================================
--- server/trunk/common/utils.c 2011-06-28 20:23:11 UTC (rev 14732)
+++ server/trunk/common/utils.c 2011-06-29 17:13:23 UTC (rev 14733)
@@ -313,65 +313,19 @@
if (nmt == NULL) {
lmt = NULL;
-#ifndef NEW_MATERIAL_CODE
for (mt = materialt; mt != NULL && mt->next != NULL; mt = mt->next) {
if (op->material&mt->material) {
lmt = mt;
break;
}
}
-#else
- for (mt = materialt; mt != NULL && mt->next != NULL; mt = mt->next) {
- if (op->material&mt->material
- && rndm(1, 100) <= mt->chance
- && difficulty >= mt->difficulty
- && (op->magic >= mt->magic || mt->magic == 0)) {
- lmt = mt;
- if (!(IS_WEAPON(op) || IS_ARMOR(op) || IS_SHIELD(op) || op->type == GIRDLE || op->type == GLOVES || op->type == CLOAK))
- break;
- }
- }
-#endif
} else {
lmt = nmt;
}
if (lmt != NULL) {
-#ifndef NEW_MATERIAL_CODE
op->materialname = add_string(lmt->name);
return;
-#else
-
- if (op->stats.dam && IS_WEAPON(op)) {
- op->stats.dam += lmt->damage;
- if (op->stats.dam < 1)
- op->stats.dam = 1;
- }
- if (op->stats.sp && op->type == BOW)
- op->stats.sp += lmt->sp;
- if (op->stats.wc && IS_WEAPON(op))
- op->stats.wc += lmt->wc;
- if (IS_ARMOR(op) || IS_SHIELD(op) || op->type == GIRDLE || op->type == GLOVES || op->type == CLOAK) {
- int j;
-
- if (op->stats.ac)
- op->stats.ac += lmt->ac;
- for (j = 0; j < NROFATTACKS; j++)
- if (op->resist[j] != 0) {
- op->resist[j] += lmt->mod[j];
- if (op->resist[j] > 100)
- op->resist[j] = 100;
- if (op->resist[j] < -100)
- op->resist[j] = -100;
- }
- }
- op->materialname = add_string(lmt->name);
- /* dont make it unstackable if it doesn't need to be */
- if (IS_WEAPON(op) || IS_ARMOR(op) || IS_SHIELD(op) || op->type == GIRDLE || op->type == GLOVES || op->type == CLOAK) {
- op->weight = (op->weight*lmt->weight)/100;
- op->value = (op->value*lmt->value)/100;
- }
-#endif
}
}
Modified: server/trunk/include/config.h
===================================================================
--- server/trunk/include/config.h 2011-06-28 20:23:11 UTC (rev 14732)
+++ server/trunk/include/config.h 2011-06-29 17:13:23 UTC (rev 14733)
@@ -327,17 +327,6 @@
#endif
-/**
- * Enable the new material code - it needs some work. You can
- * enable this, and things will work, just you'll see a whole
- * bunch more materials show up, and thus a whole bunch more materials
- * in your inventory, and the sorting for them isn't really good.
- */
-
-/*
-#define NEW_MATERIAL_CODE
-*/
-
/***********************************************************************
* SECTION 2 - Machine/Compiler specific stuff.
*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|