[Question][Code] Furniture

From: Dust (dustlos@hotmail.com)
Date: 04/11/01


OK, now it seems to like crashing in places that really don't make much
sense... If anyone can help itd be greatly appreciated, im at my wits end
this used to crash at like the first line of the commented out code, the }
or somewhere in the else

#0  0x8050471 in show_obj_to_char (object=0x83730a0, ch=0x841cac0, mode=0)
at act.informative.c:163
163         sprintf(buf, "%s",QGRN);


-------------------------
void show_obj_to_char(struct obj_data * object, struct char_data * ch, int
mode)
{

//  struct char_data *temp = NULL;
  int found = 0;

  *buf = '\0';
  if ((mode == 0) && object->description) {
//    if ( (GET_OBJ_TYPE(object) == ITEM_CHAIR && GET_OBJ_VAL(object, 1) ==
0) || !OBJ_SAT_IN_BY(object)) {
      sprintf(buf, "%s", QGRN);
      strcpy(buf + strlen(buf), object->description);
      sprintf(buf + strlen(buf), "%s", QNRM);
//    }
/*    else {
      temp = OBJ_SAT_IN_BY(object);
      for (temp = OBJ_SAT_IN_BY(object); temp; temp = NEXT_SITTING(temp)) {
        if (temp == ch)
          found = 1;
      }
      if (found == 1) {
          if (GET_POS(ch) == POS_SITTING)
            sprintf(buf, "&gYou are sitting %s %s.&n",
furniture_bits[GET_OBJ_VAL(object, 2)], (CAN_SEE_OBJ(ch, object) ?
object->short_description : "something"));
          else if (GET_POS(ch) == POS_RESTING)
            sprintf(buf, "&gYou are resting %s %s.&n",
furniture_bits[GET_OBJ_VAL(object, 2)], (CAN_SEE_OBJ(ch, object) ?
object->short_description : "something"));
          else
            sprintf(buf, "&gYou are sleeping %s %s.&n",
furniture_bits[GET_OBJ_VAL(object, 2)], (CAN_SEE_OBJ(ch, object) ?
object->short_description : "something"));
      }
      else {
        sprintf(buf, "%s", QGRN);
        strcpy(buf + strlen(buf), object->description);
        sprintf(buf + strlen(buf), "%s", QNRM);
      }
    }
*/
  }
  else if (object->short_description && ((mode == 1) || (mode == 2) || (mode
== 3) || (mode == 4))) {
    sprintf(buf, "%s",QGRN);
    strcpy(buf + strlen(buf), object->short_description);
    sprintf(buf + strlen(buf), "%s", QNRM);
  }
  else if (mode == 5) {
    if (GET_OBJ_TYPE(object) == ITEM_NOTE) {
      if (object->action_description) {
 strcpy(buf, "There is something written upon it:\r\n\r\n");
 strcat(buf, object->action_description);
 page_string(ch->desc, buf, 1);
      } else
 act("It's blank.", FALSE, ch, 0, 0, TO_CHAR);
      return;
    } else if (GET_OBJ_TYPE(object) != ITEM_DRINKCON) {
      strcpy(buf, "You see nothing special..");
    } else   /* ITEM_TYPE == ITEM_DRINKCON||FOUNTAIN */
      strcpy(buf, "It looks like a drink container.");
  }
  if (mode != 3) {
    found = 0;
    if (IS_OBJ_STAT(object, ITEM_INVISIBLE)) {
      strcat(buf, " (invisible)");
      found = 1;
    }
    if (IS_OBJ_STAT(object, ITEM_BURIED) && PRF_FLAGGED(ch, PRF_HOLYLIGHT))
{
      strcat(buf, " (buried)");
      found = 1;
    }
    if (IS_OBJ_STAT(object, ITEM_BLESS) && AFF_FLAGGED(ch,
AFF_DETECT_ALIGN)) {
      strcat(buf, " ..It glows blue!");
      found = 1;
    }
    if (IS_OBJ_STAT(object, ITEM_MAGIC) && AFF_FLAGGED(ch,
AFF_DETECT_MAGIC)) {
      sprintf(buf + strlen(buf), " %s..It glows yellow!%s", CCYEL(ch,
C_CMP), QNRM);
      found = 1;
    }
    if (IS_OBJ_STAT(object, ITEM_GLOW)) {
      sprintf(buf + strlen(buf), " %s..It has a soft glowing aura!%s", QCYN,
QNRM);
      found = 1;
    }
    if (IS_OBJ_STAT(object, ITEM_HUM)) {
      sprintf(buf + strlen(buf), " %s..It emits a faint humming sound!%s",
QRED, QNRM);
      found = 1;
    }
  }
  strcat(buf, "\r\n");
  page_string(ch->desc, buf, TRUE);
}

---------------

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/05/01 PST