OasisOLC & MobProgs

From: Edward Almasy (almasy@axis.com)
Date: 04/14/96


For those of you using (or wanting to use) OasisOLC who are also using
mobprogs, here's an addition to medit_save_to_disk() (in medit.c) that
preserves any mobprogs attached when the mobs for a zone are saved.  It
goes in right after the line with "fprintf(mob_file, "E\n");" on it.

  {
    MPROG_DATA *pstMProg;
    char       *pcSrc;
    char       *pcDst;

    /* write out mobprogs (if any) */
    pstMProg = mob_index[rmob_num].mobprogs;
    while (pstMProg != NULL)
    {
      pcSrc = pstMProg->comlist;
      pcDst = buf;
      while (*pcSrc != '\0')
      {
        if (*pcSrc != '\r')
        {
          *pcDst = *pcSrc;
          pcDst++;
        }
        pcSrc++;
      }
      *pcDst = '\0';

      fprintf(mob_file, ">%s%s~\n%s~\n",
          ((pstMProg->type == IN_FILE_PROG) ?   "in_file_prog" :
          ((pstMProg->type == ACT_PROG) ?       "act_prog" :
          ((pstMProg->type == SPEECH_PROG) ?    "speech_prog" :
          ((pstMProg->type == RAND_PROG) ?      "rand_prog" :
          ((pstMProg->type == FIGHT_PROG) ?     "fight_prog" :
          ((pstMProg->type == HITPRCNT_PROG) ?  "hitprcnt_prog" :
          ((pstMProg->type == DEATH_PROG) ?     "death_prog" :
          ((pstMProg->type == ENTRY_PROG) ?     "entry_prog" :
          ((pstMProg->type == GREET_PROG) ?     "greet_prog" :
          ((pstMProg->type == ALL_GREET_PROG) ? "all_greet_prog" :
          ((pstMProg->type == GIVE_PROG) ?      "give_prog" :
          ((pstMProg->type == BRIBE_PROG) ?     "bribe_prog" : "ERROR")))))))))))),
          pstMProg->arglist, buf);
   
      pstMProg = pstMProg->next;
    }
    if (mob_index[rmob_num].mobprogs != NULL) fprintf(mob_file, "|\n");
  }


 \_\_\_     _/ \_\_\_  axis data: specializing in online system setup & design
 \_  \_     _/ \_  \_    Edward Almasy                       almasy@axis.com  
 \_\_\_     _/ \_\_\_    President: Axis Data       Proprietor: NineJackNine
     \_ _/  _/     \_    608-256-5732 (voice)            608-256-5697 (data)
 \_\_\_ _/_/_/ \_\_\_  9jack9: on the bleeding edges of culture and technology
  Nine   Jack   Nine      33 University Square  Suite 131  Madison WI 53715



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