[Circle] Mob Memory Code [Warning: Long Text]

From: Demetrius Harris (ldh1@Archive.MsState.Edu)
Date: 08/04/96


I believe that this file contains all the changes i made to allow memory 
handling for mobs.  If you get any errors as a result of my code just email 
me an I will be glad to try and solve it with you.

Shame the Imp SliceMUD -- [Lotus.Cim.MsState.Edu 4000]
 	   		      [130.18.216.23 4000]

In structs.h:
  goto: struct memory_rec_struct
  add: char *name; 
       after long id;

In interpreter.c:
  goto: prototypes for all do_xx
  add: ACMD(depiss);
  add: ACMD(repiss);

  goto: struct command_info cmd_info[] = {
  add: { "depiss"  , POS_DEAD,  do_depiss,  LVL_GOD, 0} 
  add: { "repiss"  , POS_DEAD,  do_repiss,  LVL_GOD, 0} 

In mobact.c:
  goto: void remember(.....)
  add: tmp->name = GET_NAME(victim);
       after tmp->id = GET_IDNUM(victim);

  goto: void forget(....)
  change: while (curr && curr->id != GET_IDNUM(victim)) { 
  to: while ((curr && curr->id != GET_IDNUM(victim)) ||
             (curr && curr->name != GET_NAME(victim))) {

In act.wizard.c:
  add: the following code:


ACMD(do_depiss)
{
  void forget(struct char_data * ch, struct char_data * victim);

  char buf3[80];
  struct char_data *vic = 0;
  struct char_data *mob  = 0;

  two_arguments(argument, buf1, buf2);

  if (!*buf1 || !*buf2) {
    send_to_char("Usage: depiss <player> <mobile>\r\n", ch);
    return;
  }


  if (((vic = get_char_vis(ch, buf1))) && (!IS_NPC(vic))) {
    if (((mob = get_char_vis(ch, buf2))) && (IS_NPC(mob))) {
      if (MOB_FLAGGED(mob, MOB_MEMORY)) 
        forget(mob, vic);
      else {
        send_to_char("Mobile does not have the memory flag set!\r\n", ch);
        return;
      }
    }
    else {
      send_to_char("Sorry, Player Not Found!\r\n", ch);
      return;
    }
  } 
  else {
    send_to_char("Sorry, Mobile Not Found!\r\n", ch);
    return;
  }
  sprintf(buf3, "%s has been removed from %s pissed list.\r\n", 
          GET_NAME(vic), GET_NAME(mob));
  send_to_char(buf3, ch);
}

ACMD(do_repiss)
{
  void remember(struct char_data * ch, struct char_data * victim);

  char buf3[80];
  struct char_data *vic = 0;
  struct char_data *mob  = 0;

  two_arguments(argument, buf1, buf2);

  if (!*buf1 || !*buf2) {
    send_to_char("Usage: repiss <player> <mobile>\r\n", ch);
    return;
  }

  if (((vic = get_char_vis(ch, buf1))) && (!IS_NPC(vic))) {
    if (((mob = get_char_vis(ch, buf2))) && (IS_NPC(mob))) {
      if (MOB_FLAGGED(mob, MOB_MEMORY)) 
        remember(mob, vic);
      else {
        send_to_char("Mobile does not have the memory flag set!\r\n", ch);
        return;
      }
    }
    else {
      send_to_char("Sorry, Player Not Found!\r\n", ch);
      return;
    }
  } 
  else {
    send_to_char("Sorry, Mobile Not Found!\r\n", ch);
    return;
  }
  sprintf(buf3, "%s has been added to %s pissed list.\r\n", 
          GET_NAME(vic), GET_NAME(mob));
  send_to_char(buf3, ch);
}

If you don't mind give some credit to Shame the Imp of SliceMUD  
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/07/00 PST