Difference for server/c_wiz.c from version 1.17 to 1.18


version 1.17 version 1.18
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_c_wiz_c =   * static char *rcsid_c_wiz_c =
  *   "$Id: c_wiz.c,v 1.17 2002/01/03 22:02:34 garbled Exp $";   *   "$Id: c_wiz.c,v 1.18 2002/01/04 06:37:09 garbled Exp $";
  */   */
 /*  /*
     CrossFire, A Multiplayer game for X-windows      CrossFire, A Multiplayer game for X-windows
Line 250
 
Line 250
 int command_create (object *op, char *params)  int command_create (object *op, char *params)
 {  {
       object *tmp=NULL;        object *tmp=NULL;
       int nrof,i, magic, set_magic = 0, set_nrof = 0;        int nrof,i, magic, set_magic = 0, set_nrof = 0, gotquote, gotspace;
       char buf[MAX_BUF], *cp, *bp = buf;        char buf[MAX_BUF], *cp, *bp = buf, *bp2, *bp3, *bp4, *obp;
       archetype *at;        archetype *at;
       artifact *art=NULL;        artifact *art=NULL;
   
Line 259
 
Line 259
  return 0;   return 0;
   
     if (params == NULL) {      if (params == NULL) {
         new_draw_info(NDI_UNIQUE, 0,op, "Usage: create [nr] [magic] <archetype> [ of <artifact>]");          new_draw_info(NDI_UNIQUE, 0, op,
        "Usage: create [nr] [magic] <archetype> [ of <artifact>]"
        " [variable_to_patch setting]");
         return 1;          return 1;
     }      }
     bp = params;      bp = params;
            
     if(sscanf(bp, "%d ", &nrof)) {      if(sscanf(bp, "%d ", &nrof)) {
  if ((bp = strchr(params, ' ')) == NULL) {   if ((bp = strchr(params, ' ')) == NULL) {
      new_draw_info(NDI_UNIQUE, 0,op, "Usage: create [nr] [magic] <archetype> [ of <artifact>]");       new_draw_info(NDI_UNIQUE, 0, op,
    "Usage: create [nr] [magic] <archetype> [ of <artifact>]"
        " [variable_to_patch setting]");
      return 1;       return 1;
  }   }
         bp++;          bp++;
         set_nrof = 1;          set_nrof = 1;
         LOG(llevDebug, "(%d) %s\n", nrof, buf);          LOG(llevDebug, "%s creates: (%d) %s\n", op->name, nrof, bp);
     }      }
     if (sscanf(bp, "%d ", &magic)) {      if (sscanf(bp, "%d ", &magic)) {
  if ((bp = strchr(bp, ' ')) == NULL) {   if ((bp = strchr(bp, ' ')) == NULL) {
      new_draw_info(NDI_UNIQUE, 0,op, "Usage: create [nr] [magic] <archetype> [ of <artifact>]");       new_draw_info(NDI_UNIQUE, 0, op,
    "Usage: create [nr] [magic] <archetype> [ of <artifact>]"
        " [variable_to_patch setting]");
      return 1;       return 1;
  }   }
  bp++;   bp++;
         set_magic = 1;          set_magic = 1;
         LOG(llevDebug, "(%d) (%d) %s\n", nrof, magic, buf);          LOG(llevDebug, "%s creates: (%d) (%d) %s\n", op->name, nrof, magic, bp);
     }      }
     if ((cp = strstr(bp, " of ")) != NULL) {      if ((cp = strstr(bp, " of ")) != NULL) {
  *cp = '\0';   *cp = '\0';
         cp += 4;          cp += 4;
     }      }
   
       for (bp2=bp; *bp2; bp2++)
    if (*bp2 == ' ') {
        *bp2 = '\0';
        bp2++;
        break;
    }
   
     if((at=find_archetype(bp))==NULL) {      if((at=find_archetype(bp))==NULL) {
  new_draw_info(NDI_UNIQUE, 0,op,"No such archetype.");   new_draw_info(NDI_UNIQUE, 0,op,"No such archetype.");
         return 1;          return 1;
Line 309
 
Line 322
      "No such artifact ([%d] of %s)", at->clone.type, cp);       "No such artifact ([%d] of %s)", at->clone.type, cp);
      }       }
  }   }
         LOG(llevDebug, "(%d) (%d) (%s) of (%s)\n",          LOG(llevDebug, "%s creates: (%d) (%d) (%s) of (%s)\n", op->name,
             set_nrof ? nrof : 0, set_magic ? magic : 0 , bp, cp);              set_nrof ? nrof : 0, set_magic ? magic : 0 , bp, cp);
     } /* if cp */      } /* if cp */
   
Line 330
 
Line 343
      SET_FLAG(tmp, FLAG_IDENTIFIED);       SET_FLAG(tmp, FLAG_IDENTIFIED);
      CLEAR_FLAG(tmp, FLAG_KNOWN_MAGICAL);       CLEAR_FLAG(tmp, FLAG_KNOWN_MAGICAL);
  }   }
    while (*bp2) {
        /* find the first quote */
        for (bp3=bp2, gotquote=0, gotspace=0; *bp3 && gotspace < 2; bp3++) {
    if (*bp3 == '"') {
        *bp3 = ' ';
        gotquote++;
        bp3++;
        for (bp4=bp3; *bp4; bp4++)
    if (*bp4 == '"') {
        *bp4 = '\0';
        break;
    }
        break;
    } else if (*bp3 == ' ')
         gotspace++;
               }
        if (!gotquote) { /* then find the second space */
    for (bp3=bp2; *bp3; bp3++) {
        if (*bp3 == ' ') {
    bp3++;
    for (bp4=bp3; *bp4; bp4++) {
        if (*bp4 == ' ') {
    *bp4 = '\0';
    break;
        }
    }
    break;
        }
    }
        }
        /* now bp3 should be the argument, and bp2 the whole command */
        if(set_variable(tmp, bp2) == -1)   
    new_draw_info_format(NDI_UNIQUE, 0, op,
        "Unknown variable %s", bp2);
        else
    new_draw_info_format(NDI_UNIQUE, 0, op,
        "(%s#%d)->%s=%s", tmp->name, tmp->count, bp2, bp3);
        if (gotquote)
    bp2=bp4+2;
        else
    bp2=bp4+1;
        if (obp == bp2)
    break; /* invalid params */
        obp=bp2;
    }
         tmp = insert_ob_in_ob(tmp,op);          tmp = insert_ob_in_ob(tmp,op);
  esrv_send_item(op, tmp);   esrv_send_item(op, tmp);
         return 1;          return 1;
Line 355
 
Line 413
  SET_FLAG(tmp, FLAG_IDENTIFIED);   SET_FLAG(tmp, FLAG_IDENTIFIED);
  CLEAR_FLAG(tmp, FLAG_KNOWN_MAGICAL);   CLEAR_FLAG(tmp, FLAG_KNOWN_MAGICAL);
      }       }
        while (*bp2) {
    /* find the first quote */
    for (bp3=bp2, gotquote=0, gotspace=0; *bp3 && gotspace < 2;
         bp3++) {
        if (*bp3 == '"') {
    *bp3 = ' ';
    gotquote++;
    bp3++;
    for (bp4=bp3; *bp4; bp4++)
        if (*bp4 == '"') {
    *bp4 = '\0';
    break;
        }
    break;
        } else if (*bp3 == ' ')
            gotspace++;
                   }
    if (!gotquote) { /* then find the second space */
        for (bp3=bp2; *bp3; bp3++) {
    if (*bp3 == ' ') {
        bp3++;
        for (bp4=bp3; *bp4; bp4++) {
    if (*bp4 == ' ') {
        *bp4 = '\0';
        break;
    }
        }
        break;
    }
        }
            }
    /* now bp3 should be the argument, and bp2 the whole command */
    if(set_variable(tmp, bp2) == -1)   
        new_draw_info_format(NDI_UNIQUE, 0, op,
    "Unknown variable %s", bp2);
    else
        new_draw_info_format(NDI_UNIQUE, 0, op,
    "(%s#%d)->%s=%s", tmp->name, tmp->count, bp2, bp3);
    if (gotquote)
        bp2=bp4+2;
    else
        bp2=bp4+1;
    if (obp == bp2)
        break; /* invalid params */
    obp=bp2;
        }
      if(head!=tmp)       if(head!=tmp)
  tmp->head=head,prev->more=tmp;   tmp->head=head,prev->more=tmp;
      prev=tmp;       prev=tmp;


Legend:
line(s) removed in v.1.17 
line(s) changed
 line(s) added in v.1.18

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:30