ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/exp.C
(Generate patch)

Comparing deliantra/server/common/exp.C (file contents):
Revision 1.30 by root, Thu Apr 15 04:56:46 2010 UTC vs.
Revision 1.34 by root, Wed Apr 28 20:51:58 2010 UTC

25#include <stdio.h> 25#include <stdio.h>
26#include <global.h> 26#include <global.h>
27 27
28sint64 levels[MAXNUMLEVELS]; 28sint64 levels[MAXNUMLEVELS];
29 29
30static float exp_att_mult[NROFATTACKS + 2] = { 30static const float exp_att_mult[NROFATTACKS + 2] = {
31 0.0, /* AT_PHYSICAL */ 31 0.0, /* AT_PHYSICAL */
32 0.0, /* AT_MAGIC */ 32 0.0, /* AT_MAGIC */
33 0.0, /* AT_FIRE */ 33 0.0, /* AT_FIRE */
34 0.0, /* AT_ELECTRICITY */ 34 0.0, /* AT_ELECTRICITY */
35 0.0, /* AT_COLD */ 35 0.0, /* AT_COLD */
48 0.0, /* AT_DEATH */ 48 0.0, /* AT_DEATH */
49 0.0, /* AT_CHAOS */ 49 0.0, /* AT_CHAOS */
50 0.0 /* AT_COUNTERSPELL */ 50 0.0 /* AT_COUNTERSPELL */
51}; 51};
52 52
53static float exp_prot_mult[NROFATTACKS + 2] = { 53static const float exp_prot_mult[NROFATTACKS + 2] = {
54 0.4, /* AT_PHYSICAL */ 54 0.4, /* AT_PHYSICAL */
55 0.5, /* AT_MAGIC */ 55 0.5, /* AT_MAGIC */
56 0.1, /* AT_FIRE */ 56 0.1, /* AT_FIRE */
57 0.1, /* AT_ELECTRICITY */ 57 0.1, /* AT_ELECTRICITY */
58 0.1, /* AT_COLD */ 58 0.1, /* AT_COLD */
163 * state. 163 * state.
164 */ 164 */
165void 165void
166init_experience () 166init_experience ()
167{ 167{
168 char buf[MAX_BUF], *cp;
169 int lastlevel = 0, comp; 168 int lastlevel = 0;
170 sint64 lastexp = -1, tmpexp; 169 sint64 lastexp = -1;
171 170
172 sprintf (buf, "%s/exp_table", settings.confdir); 171 object_thawer thawer (settings.datadir, "exp_table");
173
174 object_thawer thawer (buf);
175 172
176 if (!thawer) 173 if (!thawer)
177 { 174 {
178 LOG (llevError, "unable to parse experience table file"); 175 LOG (llevError, "unable to parse experience table file");
179 return; 176 return;
180 } 177 }
181 178
182 if (thawer.kw != KW_max_level) 179 if (thawer.kw != KW_max_level)
183 { 180 {
184 thawer.parse_error ("experience table file", "max_level"); 181 thawer.parse_error ("experience table file");
185 return; 182 return;
186 } 183 }
187 184
188 thawer.get (settings.max_level); 185 thawer.get (settings.max_level);
189 186
190 sint64 newlevels [MAXNUMLEVELS]; 187 sint64 newlevels [MAXNUMLEVELS];
191 188
192 while (thawer.next_line ()) 189 while (thawer.next_line ())
193 { 190 {
191 sint64 tmpexp;
194 thawer.get (tmpexp); 192 thawer.get (tmpexp);
195 193
196 /* Do some sanity checking - if value is bogus, just exit because 194 /* Do some sanity checking - if value is bogus, just exit because
197 * the table otherwise is probably in an inconsistent state 195 * the table otherwise is probably in an inconsistent state
198 */ 196 */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines