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

Comparing deliantra/server/server/login.C (file contents):
Revision 1.30 by root, Fri Dec 22 16:34:00 2006 UTC vs.
Revision 1.35 by root, Mon Dec 25 17:11:17 2006 UTC

35 * keep the game running. Thus, we don't want to free any information. 35 * keep the game running. Thus, we don't want to free any information.
36 */ 36 */
37void 37void
38emergency_save (int flag) 38emergency_save (int flag)
39{ 39{
40 player *pl;
41
42 trying_emergency_save = 1; 40 trying_emergency_save = 1;
43 41
44 LOG (llevError, "Emergency save: "); 42 LOG (llevError, "Emergency save: ");
45 for (pl = first_player; pl != NULL; pl = pl->next) 43 for_all_players (pl)
46 { 44 {
47 if (!pl->ob) 45 if (!pl->ob)
48 { 46 {
49 LOG (llevError, "No name, ignoring this.\n"); 47 LOG (llevError, "No name, ignoring this.\n");
50 continue; 48 continue;
59 */ 57 */
60 if (!flag) 58 if (!flag)
61 { 59 {
62 strcpy (pl->maplevel, first_map_path); 60 strcpy (pl->maplevel, first_map_path);
63 61
64 if (pl->ob->map != NULL)
65 pl->ob->map = NULL; 62 pl->ob->map = 0;
66
67 pl->ob->x = -1; 63 pl->ob->x = -1;
68 pl->ob->y = -1; 64 pl->ob->y = -1;
69 } 65 }
70 66
71 pl->save (1); 67 pl->save (1);
135 131
136 INVOKE_PLAYER (SAVE, ob->contr); 132 INVOKE_PLAYER (SAVE, ob->contr);
137 133
138 object_freezer freezer; 134 object_freezer freezer;
139 135
140 int wiz = ob->flags [FLAG_WIZ]; 136 int wiz = ob->flag [FLAG_WIZ];
141 137
142 /* Eneq(@csd.uu.se): If we have an open container hide it. */ 138 /* Eneq(@csd.uu.se): If we have an open container hide it. */
143 container = ob->container; 139 container = ob->container;
144 ob->container = 0; 140 ob->container = 0;
145 141
196 192
197 fprintf (freezer, "endplst\n"); 193 fprintf (freezer, "endplst\n");
198 194
199 SET_FLAG (ob, FLAG_NO_FIX_PLAYER); 195 SET_FLAG (ob, FLAG_NO_FIX_PLAYER);
200 CLEAR_FLAG (ob, FLAG_WIZ); 196 CLEAR_FLAG (ob, FLAG_WIZ);
201 save_object (freezer, ob, 3); /* don't check and don't remove */ 197 save_object (freezer, ob, 1); /* don't check and don't remove */
202 198
203 char filename[MAX_BUF]; 199 char filename[MAX_BUF];
204 200
205 sprintf (filename, "%s/%s/%s/%s.pl", settings.localdir, settings.playerdir, &ob->name, &ob->name); 201 sprintf (filename, "%s/%s/%s/%s.pl", settings.localdir, settings.playerdir, &ob->name, &ob->name);
206 make_path_to_file (filename); 202 make_path_to_file (filename);
209 CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER); 205 CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER);
210 206
211 /* Eneq(@csd.uu.se): Reveal the container if we have one. */ 207 /* Eneq(@csd.uu.se): Reveal the container if we have one. */
212 ob->container = container; 208 ob->container = container;
213 209
214 ob->flags [FLAG_WIZ] = wiz; 210 ob->flag [FLAG_WIZ] = wiz;
215 211
216 enable_save = !final; 212 enable_save = !final;
217} 213}
218 214
219player * 215player *
232 228
233 char buf[MAX_BUF], bufall[MAX_BUF]; 229 char buf[MAX_BUF], bufall[MAX_BUF];
234 230
235 pl->set_object (object::create ()); 231 pl->set_object (object::create ());
236 pl->last_save_time = time (0); 232 pl->last_save_time = time (0);
237 pl->name_changed = 1;
238 233
239 assign (pl->savebed_map, first_map_path); 234 assign (pl->savebed_map, first_map_path);
240 235
241 /* Loop through the file, loading the rest of the values */ 236 /* Loop through the file, loading the rest of the values */
242 while (fgets (bufall, MAX_BUF, thawer)) 237 while (fgets (bufall, MAX_BUF, thawer))
361 { 356 {
362 strcpy (pl->maplevel, pl->savebed_map); 357 strcpy (pl->maplevel, pl->savebed_map);
363 pl->ob->x = pl->bed_x, pl->ob->y = pl->bed_y; 358 pl->ob->x = pl->bed_x, pl->ob->y = pl->bed_y;
364 } 359 }
365 360
366 /* make sure he's a player -- needed because of class change. */
367 pl->name_changed = 1;
368 pl->last_save_tick = pticks; 361 pl->last_save_tick = pticks;
369 362
370 INVOKE_PLAYER (LOAD, pl, ARG_STRING (path)); 363 INVOKE_PLAYER (LOAD, pl, ARG_STRING (path));
371 364
372 return pl; 365 return pl;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines