Difference for common/exp.c from version 1.4 to 1.5


version 1.4 version 1.5
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_arch_c =   * static char *rcsid_arch_c =
  *   "$Id: exp.c,v 1.4 2002/07/15 04:57:11 mwedel Exp $";   *   "$Id: exp.c,v 1.5 2002/09/11 06:21:46 mwedel Exp $";
  */   */
   
 /*  /*
Line 29
 
Line 29
 #include <stdio.h>  #include <stdio.h>
 #include <global.h>  #include <global.h>
   
   uint32 levels[MAXLEVEL+1]={
   0,
   0,2000,4000, 8000,
   16000,32000,64000,125000,250000,                /* 9 */
   500000,900000,1400000,2000000,2600000,
   3300000,4100000,4900000,5700000,6600000,        /* 19 */
   7500000,8400000,9300000,10300000,11300000,
   12300000,13300000,14400000,15500000,16600000,   /* 29 */
   17700000,18800000,19900000,21100000,22300000,
   23500000,24700000,25900000,27100000,28300000,   /* 39 */
   29500000,30800000,32100000,33400000,34700000,
   36000000,37300000,38600000,39900000,41200000,   /* 49 */
   42600000,44000000,45400000,46800000,48200000,
   49600000,51000000,52400000,53800000,55200000,   /* 59 */
   56600000,58000000,59400000,60800000,62200000,
   63700000,65200000,66700000,68200000,69700000,   /* 69 */
   71200000,72700000,74200000,75700000,77200000,
   78700000,80200000,81700000,83200000,84700000,   /* 79 */
   86200000,87700000,89300000,90900000,92500000,
   94100000,95700000,97300000,98900000,100500000,  /* 89 */
   102100000,103700000,105300000,106900000,108500000,
   110100000,111700000,113300000,114900000,116500000,      /* 99 */
   118100000,119700000,121300000,122900000,124500000,
   126100000,127700000,129300000,130900000,785400000,
   1570800000      /* 110 */
   };
   
   
 #define TRUE 1  #define TRUE 1
 #define FALSE 0  #define FALSE 0
   
Line 139
 
Line 167
   
   return FALSE;    return FALSE;
 }  }
   
   /* This loads the experience table from the exp_table
    * file.  This tends to exit on any errors, since it
    * populates the table as it goes along, so if there
    * are errors, the table is likely in an inconsistent
    * state.
    */
   void init_experience()
   {
       char buf[MAX_BUF], *cp;
       int lastlevel=0, lastexp=-1, tmpexp, comp;
       FILE *fp;
      
   
       sprintf(buf,"%s/exp_table",settings.confdir);
   
       if ((fp = open_and_uncompress(buf, 0, &comp)) == NULL) {
           return;
       }
       while (fgets(buf, MAX_BUF-1, fp) != NULL) {
    if (buf[0] == '#') continue;
   
    /* eliminate newline */
    if ((cp=strrchr(buf,'\n'))!=NULL) *cp='\0';
   
    /* Skip over empty lines */
    if (buf[0] == 0) continue;
    cp = buf;
    while (isspace(*cp) && *cp!=0) cp++;
    while (isdigit(*cp) && *cp!=0) {
        tmpexp = atoi(cp);
        /* Do some sanity checking - if value is bogus, just exit because
         * the table otherwise is probably in an inconsistent state
         */
        if (tmpexp <= lastexp) {
    LOG(llevError,"Experience for level %d is lower than previous level (%d <= %d)\n",
        lastlevel + 1, tmpexp, lastexp);
    exit(1);
        }
        lastlevel++;
        if (lastlevel > MAXLEVEL) {
    LOG(llevError,"Too many levels specified in table (%d > %d)\n",
        lastlevel, MAXLEVEL);
    exit(1);
        }
        levels[lastlevel] = tmpexp;
        lastexp = tmpexp;
        /* First, skip over the number we just processed. Then skip over
         * any spaces, commas, etc.
         */
        while (isdigit(*cp) && *cp!=0) cp++;
        while (!isdigit(*cp) && *cp!=0) cp++;
    }
       }
       close_and_delete(fp, comp);
       if (lastlevel != MAXLEVEL && lastlevel != 0) {
    LOG(llevError,"Warning: exp_table does not have %d entries (%d)\n",
        MAXLEVEL, lastlevel);
    exit(1);
       }
   }
   
   /* Dump the table - useful in terms of debugging to make sure the
    * format of the exp_table is correct.
    */
   
   void dump_experience()
   {
       int i;
   
       for (i=1; i<= MAXLEVEL; i++) {
    fprintf(logfile,"%4d %20d\n", i, levels[i]);
       }
       exit(0);
   }


Legend:
line(s) removed in v.1.4 
line(s) changed
 line(s) added in v.1.5

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