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.31 by root, Thu Apr 15 19:12:29 2010 UTC vs.
Revision 1.36 by root, Thu May 6 22:35:41 2010 UTC

155 else 155 else
156 return levels [min (level, settings.max_level)]; 156 return levels [min (level, settings.max_level)];
157} 157}
158 158
159/* This loads the experience table from the exp_table 159/* This loads the experience table from the exp_table
160 * file. This tends to exit on any errors, since it 160 * file.
161 * populates the table as it goes along, so if there
162 * are errors, the table is likely in an inconsistent
163 * state.
164 */ 161 */
165void 162void
166init_experience () 163reload_exp_table ()
167{ 164{
168 char buf[MAX_BUF], *cp;
169 int lastlevel = 0, comp; 165 int lastlevel = 0;
170 sint64 lastexp = -1, tmpexp; 166 sint64 lastexp = -1;
171 167
172 sprintf (buf, "%s/exp_table", settings.confdir); 168 object_thawer thawer (settings.datadir, "exp_table");
173
174 object_thawer thawer (buf);
175 169
176 if (!thawer) 170 if (!thawer)
177 { 171 {
178 LOG (llevError, "unable to parse experience table file"); 172 LOG (llevError, "unable to load experience table file");
179 return; 173 return;
180 } 174 }
181 175
182 if (thawer.kw != KW_max_level) 176 if (thawer.kw != KW_max_level)
183 { 177 {
184 thawer.parse_error ("experience table file", "max_level"); 178 thawer.parse_error ("experience table file");
185 return; 179 return;
186 } 180 }
187 181
188 thawer.get (settings.max_level); 182 thawer.get (settings.max_level);
189 183
190 sint64 newlevels [MAXNUMLEVELS]; 184 sint64 newlevels [MAXNUMLEVELS];
191 185
192 while (thawer.next_line ()) 186 while (thawer.next_line ())
193 { 187 {
188 sint64 tmpexp;
194 thawer.get (tmpexp); 189 thawer.get (tmpexp);
195 190
196 /* Do some sanity checking - if value is bogus, just exit because 191 /* Do some sanity checking - if value is bogus, just exit because
197 * the table otherwise is probably in an inconsistent state 192 * the table otherwise is probably in an inconsistent state
198 */ 193 */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines