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

Comparing deliantra/server/common/player.C (file contents):
Revision 1.15 by root, Mon Jan 8 18:18:35 2007 UTC vs.
Revision 1.16 by root, Mon Jan 8 19:25:52 2007 UTC

145{ 145{
146 player *pl = new player; 146 player *pl = new player;
147 147
148 pl->savebed_map = first_map_path; 148 pl->savebed_map = first_map_path;
149 149
150 /* this loads the standard objects values. */
151 pl->set_object (object::create ());
152
150 /* Loop through the file, loading the rest of the values */ 153 /* Loop through the file, loading the rest of the values */
151 for (;;) 154 for (;;)
152 { 155 {
153 keyword kw = thawer.get_kv (); 156 keyword kw = thawer.get_kv ();
154 157
155 switch (kw) 158 switch (kw)
156 { 159 {
157 case KW_EOF: 160 case KW_EOF:
158 LOG (llevError, "%s: unexpected EOF while reading player header\n", thawer.name); 161 LOG (llevError, "%s: unexpected EOF while reading player header\n", thawer.name);
159 delete pl; 162 pl->ob->destroy ();
163 pl->destroy ();
160 return 0; 164 return 0;
161 165
162 case KW_ERROR: 166 case KW_ERROR:
163 LOG (llevError, "%s: error while reading player header, skipping (%s,%s)\n", thawer.name, thawer.last_keyword, thawer.last_value); 167 LOG (llevError, "%s: error while reading player header, skipping (%s,%s)\n", thawer.name, thawer.last_keyword, thawer.last_value);
164 break; 168 break;
220 { 224 {
221 int count = thawer.get_sint32 (); 225 int count = thawer.get_sint32 ();
222 226
223 for (int i = 1; i <= count; i++) 227 for (int i = 1; i <= count; i++)
224 { 228 {
225 char line[128]; 229 char line [32];
226 230
227 fgets (line, 128, thawer); pl->levhp [i] = atoi (line); 231 fgets (line, 32, thawer); pl->levhp [i] = atoi (line);
228 fgets (line, 128, thawer); pl->levsp [i] = atoi (line); 232 fgets (line, 32, thawer); pl->levsp [i] = atoi (line);
229 fgets (line, 128, thawer); pl->levgrace[i] = atoi (line); 233 fgets (line, 32, thawer); pl->levgrace[i] = atoi (line);
230 } 234 }
231 } 235 }
232 break; 236 break;
233 237
234 default: 238 default:
236 break; 240 break;
237 } 241 }
238 } 242 }
239 243
240done: 244done:
241 /* this loads the standard objects values. */
242 pl->set_object (object::create ());
243
244 if (!load_object (thawer, pl->ob, 0)) 245 if (!load_object (thawer, pl->ob, 0))
245 { 246 {
246 pl->ob->destroy (); 247 pl->ob->destroy ();
247 delete pl; 248 pl->destroy ();
248 return 0; 249 return 0;
249 } 250 }
250 251
251 INVOKE_PLAYER (LOAD, pl); 252 INVOKE_PLAYER (LOAD, pl);
252 253

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines