act() different 'const' qualifiers?

From: David Cole (tiznor@softhome.net)
Date: 04/11/02


Hello,

Many thanks to Deidril, Consent works great now! :)

I have a new one now, rewriting all CAN_SEE and the likes to functions in
utils.c, similar to the grayhawk code (if any of you have looked, you will
unstand what i'm talking about, either was I am attaching the code).

Anyways I get errors as follows, but I don't quite understand the errors
being as there are no const anywhere in act.

D:\Circle\comm.c(1428) : warning C4090: '=' : different 'const' qualifiers

char *perform_act(char *orig, struct char_data *ch, struct obj_data *obj,
void *vict_obj, struct char_data *to)
{
  register char *i = NULL, *buf;
  static char lbuf[MAX_STRING_LENGTH];
  struct char_data *dg_victim = NULL;
  struct obj_data *dg_target = NULL;
  char *dg_arg = NULL;

  buf = lbuf;
<--stuff-->
case 'N':
CHECK_NULL(vict_obj, PERS((struct char_data *) vict_obj, to)); // 1428
dg_victim = (struct char_data *) vict_obj;
break;

I have removed all const's within preform_act and act, and PERS and CAN_SEE
are now functions in utils.c, shown below:

int CanSee(struct char_data *sub, struct char_data *obj)
{
  if (GET_POS(sub) == POS_SLEEPING)
 return(0);

  if (GET_INVIS_LEV(obj) >= GET_LEVEL(sub))
    return(0);

  if (AFF_FLAGGED(sub, AFF_BLIND))
    return(0);

  if (AFF_FLAGGED(obj, AFF_HIDE) && (obj != sub))
    return(0);

  if (IS_DARK(IN_ROOM(obj)) && AFF_FLAGGED((sub), AFF_INFRAVISION)) {
    if (IS_UNDEAD(obj))
      return(0);
    else
      return(1);
  } else if (IS_DARK(IN_ROOM(sub)))
    return(0);

  if (GET_LEVEL(sub) >= LVL_IMMORT && PRF_FLAGGED(sub, PRF_HOLYLIGHT))
 return(1);

  if (IS_AFFECTED(obj, AFF_INVISIBLE) && !affected_by_spell(sub,
SPELL_DETECT_INVISIBILITY)) {
    return(0);
  }

  return(1);
}


char *PERS(struct char_data *ch, struct char_data *vict)
{
  static char buf1[80];

  if (!CAN_SEE(vict, ch)) {
    strcpy(buf1, "someone");
    return(buf1);
  }
  if (IS_DARK(ch->in_room) && GET_LEVEL(vict) < LVL_IMMORT) {
    if (IS_AFFECTED(vict, AFF_INFRAVISION)) {
      send_to_char(red_shape_name[GET_SIZE(ch)], ch);
      send_to_char("\r\n", ch);
      return(buf1);
    } else {
      strcpy(buf1, "someone");
      return(buf1);
    }
  }
  if (IS_NPC(ch))
    return (ch->player.short_descr);
  else {
    return (ch->player.name);

    return buf1;
  }
}

This is all I have changed, minus #define CAN_SEE(sub, obj) (CanSee(sub),
(obj)) and commenting out the define for PERS in utils.h But no errors with
CanSee, everything is booming in preform_act() and act(), what am i over
looking? Any help would be great. :)

Thanks,
Dave

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT