Question

From: Chris Powell (darkness@CHESHIRE.GATOR.NET)
Date: 04/15/98


Here is my version of a pseudo Xedit save all.  I'm sure there is a better
way of doing this and I'd really appreciate any suggestions.  I know it
can be better cause as it lags the mud for a couple seconds when you run
it, I know this is caued by my use of the for loop.


ACMD(do_allsave)
{
  int i;
  const char *type = NULL;


   switch (subcmd) {
     case SCMD_RSAVE: type = "room"; break;
     case SCMD_ZSAVE: type = "zone"; break;
     case SCMD_SSAVE: type = "shop"; break;
     case SCMD_MSAVE: type = "mobile"; break;
     case SCMD_OSAVE: type = "object"; break;
     }

   if (!type) {
       send_to_char("Oops, I forgot what you wanted to save.\r\n", ch);
    return;
  }

   for (i = 0; i <= top_of_zone_table; i++ ) {
     switch (subcmd) {
     case SCMD_RSAVE: redit_save_to_disk(i); break;
     case SCMD_ZSAVE: zedit_save_to_disk(i); break;
     case SCMD_OSAVE: oedit_save_to_disk(i); break;
     case SCMD_MSAVE: medit_save_to_disk(i); break;
     case SCMD_SSAVE: sedit_save_to_disk(i); break;
     }
}

     mudlogf(CMP, MAX(LVL_BUILD, GET_INVIS_LEV(ch)), TRUE,
             "OLC: %s saves %s info for every zone.", GET_NAME(ch), type);
     sprintf(buf, "Saving all %ss in every zone.\r\n", type);
     send_to_char(buf, ch);

}


Chris Powell           * I don't have bugs, I have   * I don't crash, I
http://patch.gator.net * randomly developed features * have random reboots


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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