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.35 by root, Mon Dec 25 17:11:17 2006 UTC vs.
Revision 1.36 by root, Sat Dec 30 10:16:11 2006 UTC

28#include <define.h> 28#include <define.h>
29 29
30extern void sub_weight (object *, signed long); 30extern void sub_weight (object *, signed long);
31extern void add_weight (object *, signed long); 31extern void add_weight (object *, signed long);
32extern long pticks; 32extern long pticks;
33
34/* If flag is non zero, it means that we want to try and save everyone, but
35 * keep the game running. Thus, we don't want to free any information.
36 */
37void
38emergency_save (int flag)
39{
40 trying_emergency_save = 1;
41
42 LOG (llevError, "Emergency save: ");
43 for_all_players (pl)
44 {
45 if (!pl->ob)
46 {
47 LOG (llevError, "No name, ignoring this.\n");
48 continue;
49 }
50
51 LOG (llevError, "%s ", &pl->ob->name);
52 new_draw_info (NDI_UNIQUE, 0, pl->ob, "Emergency save...");
53
54 /* If we are not exiting the game (ie, this is sort of a backup save), then
55 * don't change the location back to the village. Note that there are other
56 * options to have backup saves be done at the starting village
57 */
58 if (!flag)
59 {
60 strcpy (pl->maplevel, first_map_path);
61
62 pl->ob->map = 0;
63 pl->ob->x = -1;
64 pl->ob->y = -1;
65 }
66
67 pl->save (1);
68 }
69
70 LOG (llevError, "\n");
71}
72 33
73/* Delete character with name. if new is set, also delete the new 34/* Delete character with name. if new is set, also delete the new
74 * style directory, otherwise, just delete the old style playfile 35 * style directory, otherwise, just delete the old style playfile
75 * (needed for transition) 36 * (needed for transition)
76 */ 37 */
162 /* Match the enumerations but in string form */ 123 /* Match the enumerations but in string form */
163 fprintf (freezer, "unapply %s\n", unapply == unapply_nochoice ? "unapply_nochoice" : 124 fprintf (freezer, "unapply %s\n", unapply == unapply_nochoice ? "unapply_nochoice" :
164 (unapply == unapply_never ? "unapply_never" : "unapply_always")); 125 (unapply == unapply_never ? "unapply_never" : "unapply_always"));
165 126
166 if (ob->map) 127 if (ob->map)
167 fprintf (freezer, "map %s\n", ob->map->path); 128 fprintf (freezer, "map %s\n", &ob->map->path);
168 else
169 fprintf (freezer, "map %s\n", settings.emergency_mapname);
170 129
171 fprintf (freezer, "savebed_map %s\n", savebed_map); 130 fprintf (freezer, "savebed_map %s\n", savebed_map);
172 fprintf (freezer, "bed_x %d\nbed_y %d\n", bed_x, bed_y); 131 fprintf (freezer, "bed_x %d\nbed_y %d\n", bed_x, bed_y);
173 fprintf (freezer, "weapon_sp %f\n", weapon_sp); 132 fprintf (freezer, "weapon_sp %f\n", weapon_sp);
174 fprintf (freezer, "Str %d\n", orig_stats.Str); 133 fprintf (freezer, "Str %d\n", orig_stats.Str);
342 } 301 }
343 302
344 /* this loads the standard objects values. */ 303 /* this loads the standard objects values. */
345 load_object (thawer, pl->ob, 0); 304 load_object (thawer, pl->ob, 0);
346 305
347 /* If the map where the person was last saved does not exist,
348 * restart them on their home-savebed. This is good for when
349 * maps change between versions
350 * First, we check for partial path, then check to see if the full
351 * path (for unique player maps)
352 */
353 if (!has_been_loaded (pl->maplevel)
354 && check_path (pl->maplevel, 1) == -1
355 && check_path (pl->maplevel, 0) == -1)
356 {
357 strcpy (pl->maplevel, pl->savebed_map);
358 pl->ob->x = pl->bed_x, pl->ob->y = pl->bed_y;
359 }
360
361 pl->last_save_tick = pticks; 306 pl->last_save_tick = pticks;
362 307
363 INVOKE_PLAYER (LOAD, pl, ARG_STRING (path)); 308 INVOKE_PLAYER (LOAD, pl, ARG_STRING (path));
364 309
365 return pl; 310 return pl;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines