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.17 by root, Tue Jan 9 01:28:32 2007 UTC

85 PL_OUT (outputs_count); 85 PL_OUT (outputs_count);
86 86
87 freezer.put (KW_usekeys, usekeys == key_inventory ? "key_inventory" : (usekeys == keyrings ? "keyrings" : "containers")); 87 freezer.put (KW_usekeys, usekeys == key_inventory ? "key_inventory" : (usekeys == keyrings ? "keyrings" : "containers"));
88 freezer.put (KW_unapply, unapply == unapply_nochoice ? "unapply_nochoice" : (unapply == unapply_never ? "unapply_never" : "unapply_always")); 88 freezer.put (KW_unapply, unapply == unapply_nochoice ? "unapply_nochoice" : (unapply == unapply_never ? "unapply_never" : "unapply_always"));
89 89
90 if (ob->map) PL_OUT2 (map, ob->map->path); 90 PL_OUT2 (map, maplevel);
91
92 PL_OUT (savebed_map); 91 PL_OUT (savebed_map);
93 PL_OUT (bed_x); 92 PL_OUT (bed_x);
94 PL_OUT (bed_y); 93 PL_OUT (bed_y);
95 PL_OUT (weapon_sp); 94 PL_OUT (weapon_sp);
96 PL_OUT2 (Str, orig_stats.Str); 95 PL_OUT2 (Str, orig_stats.Str);
145{ 144{
146 player *pl = new player; 145 player *pl = new player;
147 146
148 pl->savebed_map = first_map_path; 147 pl->savebed_map = first_map_path;
149 148
149 /* this loads the standard objects values. */
150 pl->set_object (object::create ());
151
150 /* Loop through the file, loading the rest of the values */ 152 /* Loop through the file, loading the rest of the values */
151 for (;;) 153 for (;;)
152 { 154 {
153 keyword kw = thawer.get_kv (); 155 keyword kw = thawer.get_kv ();
154 156
155 switch (kw) 157 switch (kw)
156 { 158 {
157 case KW_EOF: 159 case KW_EOF:
158 LOG (llevError, "%s: unexpected EOF while reading player header\n", thawer.name); 160 LOG (llevError, "%s: unexpected EOF while reading player header\n", thawer.name);
159 delete pl; 161 pl->ob->destroy ();
162 pl->destroy ();
160 return 0; 163 return 0;
161 164
162 case KW_ERROR: 165 case KW_ERROR:
163 LOG (llevError, "%s: error while reading player header, skipping (%s,%s)\n", thawer.name, thawer.last_keyword, thawer.last_value); 166 LOG (llevError, "%s: error while reading player header, skipping (%s,%s)\n", thawer.name, thawer.last_keyword, thawer.last_value);
164 break; 167 break;
220 { 223 {
221 int count = thawer.get_sint32 (); 224 int count = thawer.get_sint32 ();
222 225
223 for (int i = 1; i <= count; i++) 226 for (int i = 1; i <= count; i++)
224 { 227 {
225 char line[128]; 228 char line [32];
226 229
227 fgets (line, 128, thawer); pl->levhp [i] = atoi (line); 230 fgets (line, 32, thawer); pl->levhp [i] = atoi (line);
228 fgets (line, 128, thawer); pl->levsp [i] = atoi (line); 231 fgets (line, 32, thawer); pl->levsp [i] = atoi (line);
229 fgets (line, 128, thawer); pl->levgrace[i] = atoi (line); 232 fgets (line, 32, thawer); pl->levgrace[i] = atoi (line);
230 } 233 }
231 } 234 }
232 break; 235 break;
233 236
234 default: 237 default:
236 break; 239 break;
237 } 240 }
238 } 241 }
239 242
240done: 243done:
241 /* this loads the standard objects values. */
242 pl->set_object (object::create ());
243
244 if (!load_object (thawer, pl->ob, 0)) 244 if (!load_object (thawer, pl->ob, 0))
245 { 245 {
246 pl->ob->destroy (); 246 pl->ob->destroy ();
247 delete pl; 247 pl->destroy ();
248 return 0; 248 return 0;
249 } 249 }
250 250
251 INVOKE_PLAYER (LOAD, pl); 251 INVOKE_PLAYER (LOAD, pl);
252 252

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines