version 1.5 | | version 1.6 |
---|
| | |
/* | | /* |
* static char *rcsid_arch_c = | | * static char *rcsid_arch_c = |
* "$Id: exp.c,v 1.5 2002/09/11 06:21:46 mwedel Exp $"; | | * "$Id: exp.c,v 1.6 2003/03/08 05:35:32 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
#include <stdio.h> | | #include <stdio.h> |
#include <global.h> | | #include <global.h> |
| | |
uint32 levels[MAXLEVEL+1]={ | | sint64 *levels; |
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 |
| | |
* on the ability of a monster. | | * on the ability of a monster. |
* It's far from perfect, and doesn't consider everything which | | * It's far from perfect, and doesn't consider everything which |
* can be considered, thus it's only used in debugging. | | * can be considered, thus it's only used in debugging. |
| | * this is only used with one of the dumpflags, |
| | * and not anyplace in the code. |
*/ | | */ |
| | |
int new_exp(object *ob) { | | int new_exp(object *ob) { |
| | |
void init_experience() | | void init_experience() |
{ | | { |
char buf[MAX_BUF], *cp; | | char buf[MAX_BUF], *cp; |
int lastlevel=0, lastexp=-1, tmpexp, comp; | | int lastlevel=0, comp; |
| | sint64 lastexp=-1, tmpexp; |
FILE *fp; | | FILE *fp; |
| | |
| | |
| | |
if (buf[0] == 0) continue; | | if (buf[0] == 0) continue; |
cp = buf; | | cp = buf; |
while (isspace(*cp) && *cp!=0) cp++; | | while (isspace(*cp) && *cp!=0) cp++; |
| | if (!strncasecmp(cp, "max_level",9)) { |
| | if (settings.max_level) { |
| | LOG(llevDebug, "Got more than one max_level value from exp_table file?\n"); |
| | free(levels); |
| | } |
| | settings.max_level = atoi(cp+9); |
| | if (!settings.max_level) { |
| | LOG(llevDebug, "Got invalid max_level from exp_table file? %s\n", buf); |
| | } else { |
| | levels = calloc(settings.max_level +1, sizeof(sint64)); |
| | } |
| | } |
while (isdigit(*cp) && *cp!=0) { | | while (isdigit(*cp) && *cp!=0) { |
tmpexp = atoi(cp); | | if (!settings.max_level) { |
| | LOG(llevError, "max_level is not set in exp_table file. Did you remember to update it?\n"); |
| | exit(1); |
| | } |
| | |
| | tmpexp = atoll(cp); |
/* Do some sanity checking - if value is bogus, just exit because | | /* Do some sanity checking - if value is bogus, just exit because |
* the table otherwise is probably in an inconsistent state | | * the table otherwise is probably in an inconsistent state |
*/ | | */ |
if (tmpexp <= lastexp) { | | if (tmpexp <= lastexp) { |
LOG(llevError,"Experience for level %d is lower than previous level (%d <= %d)\n", | | LOG(llevError,"Experience for level %d is lower than previous level (%lld <= %lld)\n", |
lastlevel + 1, tmpexp, lastexp); | | lastlevel + 1, tmpexp, lastexp); |
exit(1); | | exit(1); |
} | | } |
lastlevel++; | | lastlevel++; |
if (lastlevel > MAXLEVEL) { | | if (lastlevel > settings.max_level) { |
LOG(llevError,"Too many levels specified in table (%d > %d)\n", | | LOG(llevError,"Too many levels specified in table (%d > %d)\n", |
lastlevel, MAXLEVEL); | | lastlevel, settings.max_level); |
exit(1); | | exit(1); |
} | | } |
levels[lastlevel] = tmpexp; | | levels[lastlevel] = tmpexp; |
| | |
} | | } |
} | | } |
close_and_delete(fp, comp); | | close_and_delete(fp, comp); |
if (lastlevel != MAXLEVEL && lastlevel != 0) { | | if (lastlevel != settings.max_level && lastlevel != 0) { |
LOG(llevError,"Warning: exp_table does not have %d entries (%d)\n", | | LOG(llevError,"Warning: exp_table does not have %d entries (%d)\n", |
MAXLEVEL, lastlevel); | | settings.max_level, lastlevel); |
exit(1); | | exit(1); |
} | | } |
} | | } |
| | |
{ | | { |
int i; | | int i; |
| | |
for (i=1; i<= MAXLEVEL; i++) { | | for (i=1; i<= settings.max_level; i++) { |
fprintf(logfile,"%4d %20d\n", i, levels[i]); | | fprintf(logfile,"%4d %20lld\n", i, levels[i]); |
} | | } |
exit(0); | | exit(0); |
} | | } |