[ScryMUD] SVN Commit Info r734 - branches/version-2-1/mud/grrmud/server

scrymud at wanfear.com scrymud at wanfear.com
Sun Dec 5 10:25:16 PST 2004


Author: eroper
Date: 2004-12-05 10:25:15 -0800 (Sun, 05 Dec 2004)
New Revision: 734

Modified:
   branches/version-2-1/mud/grrmud/server/critter.h
   branches/version-2-1/mud/grrmud/server/misc.cc
Log:
fixed critter::isPossessed()
Stack inventory for possesed mobs.


Modified: branches/version-2-1/mud/grrmud/server/critter.h
===================================================================
--- branches/version-2-1/mud/grrmud/server/critter.h	2004-12-04 22:17:43 UTC (rev 733)
+++ branches/version-2-1/mud/grrmud/server/critter.h	2004-12-05 18:25:15 UTC (rev 734)
@@ -1016,7 +1016,7 @@
    int isSleeping() const { return POS == POS_SLEEP; }
    int isStunned() const { return POS == POS_STUN; }
    int isMeditating() const { return POS == POS_MED; }
-   int isPossessed() const { return (!possessed_by); }
+   int isPossessed() const { return (possessed_by > 0); }
    int posnNonTalkative() const { return ((POS > POS_REST) && (POS != POS_PRONE)); }
    int isEdible() const { return mob && MOB_FLAGS.get(5); }
    

Modified: branches/version-2-1/mud/grrmud/server/misc.cc
===================================================================
--- branches/version-2-1/mud/grrmud/server/misc.cc	2004-12-04 22:17:43 UTC (rev 733)
+++ branches/version-2-1/mud/grrmud/server/misc.cc	2004-12-05 18:25:15 UTC (rev 734)
@@ -2121,6 +2121,10 @@
    static int item_counts[NUMBER_OF_ITEMS + 1];
    int id_num;
 
+   // stack if it's a player or possesed mob. Never stack bulletin-board
+   // inventory.
+   int stack = ( ( (pc.isPc() ) || (pc.isPossessed() ) ) && (!is_board) );
+
    mudlog.log(TRC, "In out_inv.\n");
 
    if (pc.isUsingClient()) {
@@ -2138,9 +2142,7 @@
    }//if
 
 
-   //don't bother if it's not a player... yes mobs do call this function.
-   //also dont do this for boards.
-   if ( (pc.isPc()) && (!is_board) ) {
+   if ( stack ) {
       //set the counts to zero, then update them all.
       memset(item_counts, 0, sizeof(int) * (NUMBER_OF_ITEMS + 1));
       while ( (obj_ptr = cell.next()) ) {
@@ -2185,9 +2187,7 @@
 
                id_num = obj_ptr->getIdNum();
 
-               //don't bother if it's not a player... yes mobs do call this function.
-               //don't bother if it's a board
-               if ( (pc.isPc()) && (!is_board) ) {
+               if ( stack ) {
                   if (//these objects should not stack. 
                         (id_num == config.corpseObject) ||
                         (id_num == config.pcSkinObject) ||
@@ -2244,9 +2244,7 @@
          break;
       case OBJ_INV: case CRIT_INV:
          
-         //pc's walk sorted inventory, mobs dont.
-         //boards don't get sorted either.
-         if ( (pc.isPc()) && (!is_board) ) {
+         if ( stack ) {
             lst_ptr = inv_lists[0];
          } else {
             lst_ptr = mob_inv_lists[0];
@@ -2257,7 +2255,7 @@
 
             lst_ptr->head(cell);
 
-            if ( (pc.isPc()) && (!is_board) ) {
+            if ( stack  ) {
                Sprintf(buf, "%s\n", inv_names[lst_idx]);
                pc.show(buf, HL_OBJ_LIST);
             }
@@ -2267,8 +2265,7 @@
 
                   id_num = obj_ptr->getIdNum();
 
-                  //don't bother if it's not a player... yes mobs do call this function.
-                  if ((pc.isPc()) && (!is_board)) {
+                  if ( stack ) {
                      if (//these objects should not stack. 
                            (id_num == config.corpseObject) ||
                            (id_num == config.pcSkinObject) ||
@@ -2324,8 +2321,7 @@
                   pc.show(buf, HL_OBJ_LIST);
                }//if
             }//while
-            lst_idx++;
-            lst_ptr = inv_lists[lst_idx];
+            lst_ptr = inv_lists[++lst_idx];
          }// while lst_ptr
          break;
       default:




More information about the ScryMUD mailing list