[ScryMUD] SVN Commit Info r731 - branches/version-2-1/mud/grrmud/server
scrymud at wanfear.com
scrymud at wanfear.com
Sat Dec 4 03:09:18 PST 2004
Author: eroper
Date: 2004-12-04 03:09:16 -0800 (Sat, 04 Dec 2004)
New Revision: 731
Modified:
branches/version-2-1/mud/grrmud/server/misc.cc
Log:
The following have been resolved:
* some objects shouldn't stack (i.e. skins/heads/corpses)
* mobs "look" and we shouldn't waste cpu cycles stacking inv. for them.
--Khaav
Modified: branches/version-2-1/mud/grrmud/server/misc.cc
===================================================================
--- branches/version-2-1/mud/grrmud/server/misc.cc 2004-12-04 10:04:29 UTC (rev 730)
+++ branches/version-2-1/mud/grrmud/server/misc.cc 2004-12-04 11:09:16 UTC (rev 731)
@@ -2052,7 +2052,7 @@
object* obj_ptr;
String buf(100);
- String qty_str;
+ String qty_str = "";//important to set this? so it's not undef (if mob)
static int item_counts[NUMBER_OF_ITEMS + 1];
int id_num;
@@ -2073,12 +2073,16 @@
return;
}//if
- //set the counts to zero, then update them all.
- memset(item_counts, 0, sizeof(int) * (NUMBER_OF_ITEMS + 1));
- while ( (obj_ptr = cnt_cell.next()) ) {
- item_counts[obj_ptr->getIdNum()]++;
- }//while
+ //don't bother if it's not a player... yes mobs do call this function.
+ if (pc.isPc()) {
+ //set the counts to zero, then update them all.
+ memset(item_counts, 0, sizeof(int) * (NUMBER_OF_ITEMS + 1));
+ while ( (obj_ptr = cnt_cell.next()) ) {
+ item_counts[obj_ptr->getIdNum()]++;
+ }//while
+ }
+
switch (type_of_list)
{
case ROOM_INV:
@@ -2087,20 +2091,32 @@
if (detect(pc.SEE_BIT, obj_ptr->OBJ_VIS_BIT)) {
id_num = obj_ptr->getIdNum();
- if ( item_counts[id_num] == -1 ) {
- //already done it.
- continue;
- } else if ( item_counts[id_num] > 1 ) {
- Sprintf(qty_str, "(%ix) ", item_counts[id_num]);
- } else {
- qty_str = "";
+
+ //don't bother if it's not a player... yes mobs do call this function.
+ if (pc.isPc()) {
+ if (//these objects should not stack.
+ (id_num == config.corpseObject) ||
+ (id_num == config.pcSkinObject) ||
+ (id_num == config.HeadObject)
+ ) {
+ qty_str = "";
+ } else {
+ if ( item_counts[id_num] == -1 ) {
+ //already done it.
+ continue;
+ } else if ( item_counts[id_num] > 1 ) {
+ Sprintf(qty_str, "(%ix) ", item_counts[id_num]);
+ } else {
+ qty_str = "";
+ }
+ item_counts[id_num] = -1;
+ }//okay to stack
}
- item_counts[id_num] = -1;
if (pc.shouldShowVnums()) {
char tmp[50];
sprintf(tmp, "%p: ", obj_ptr);
- Sprintf(buf, " %s [%i] %P11 %S%S", tmp, obj_ptr->OBJ_NUM,
+ Sprintf(buf, " %s [%i] %P11 %S%S", tmp, id_num,
&qty_str, &(obj_ptr->in_room_desc));
}
else {
@@ -2137,20 +2153,32 @@
if (detect(pc.SEE_BIT, obj_ptr->OBJ_VIS_BIT)) {
id_num = obj_ptr->getIdNum();
- if ( item_counts[id_num] == -1 ) {
- //already done it.
- continue;
- } else if ( item_counts[id_num] > 1 ) {
- Sprintf(qty_str, "(%ix) ", item_counts[id_num]);
- } else {
- qty_str = "";
+
+ //don't bother if it's not a player... yes mobs do call this function.
+ if (pc.isPc()) {
+ if (//these objects should not stack.
+ (id_num == config.corpseObject) ||
+ (id_num == config.pcSkinObject) ||
+ (id_num == config.HeadObject)
+ ) {
+ qty_str = "";
+ } else {
+ if ( item_counts[id_num] == -1 ) {
+ //already done it.
+ continue;
+ } else if ( item_counts[id_num] > 1 ) {
+ Sprintf(qty_str, "(%ix) ", item_counts[id_num]);
+ } else {
+ qty_str = "";
+ }
+ item_counts[id_num] = -1;
+ }//okay to stack
}
- item_counts[id_num] = -1;
if (pc.shouldShowVnums()) {
char tmp[50];
sprintf(tmp, "%p: ", obj_ptr);
- Sprintf(buf, " %s [%i] %P11 %S%S", tmp, obj_ptr->OBJ_NUM,
+ Sprintf(buf, " %s [%i] %P11 %S%S", tmp, id_num,
&qty_str, long_name_of_obj(*obj_ptr, ~0));
}
else {
More information about the ScryMUD
mailing list