00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00027 #include <global.h>
00028 #include <ob_methods.h>
00029 #include <ob_types.h>
00030 #include <sounds.h>
00031 #include <sproto.h>
00032
00033 static method_ret savebed_type_apply(ob_methods *context, object *op, object *applier, int aflags);
00034 static void apply_savebed(object *pl);
00035
00039 void init_type_savebed(void) {
00040 register_apply(SAVEBED, savebed_type_apply);
00041 }
00042
00052 static method_ret savebed_type_apply(ob_methods *context, object *op, object *applier, int aflags) {
00053 if (applier->type == PLAYER)
00054 apply_savebed(applier);
00055 return METHOD_OK;
00056 }
00057
00064 static void apply_savebed(object *pl) {
00065
00066 execute_global_event(EVENT_LOGOUT, pl->contr, pl->contr->socket.host);
00067
00068
00069 terminate_all_pets(pl);
00070 remove_ob(pl);
00071 pl->direction = 0;
00072 draw_ext_info_format(NDI_UNIQUE|NDI_ALL|NDI_DK_ORANGE, 5, pl, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_PLAYER,
00073 "%s leaves the game.",
00074 "%s leaves the game.",
00075 pl->name);
00076
00077
00078 strcpy(pl->contr->savebed_map, pl->map->path);
00079 pl->contr->bed_x = pl->x;
00080 pl->contr->bed_y = pl->y;
00081
00082 strcpy(pl->contr->killer, "left");
00083 check_score(pl, 0);
00084 (void)save_player(pl, 0);
00085 #if MAP_MAXTIMEOUT
00086 MAP_SWAP_TIME(pl->map) = MAP_TIMEOUT(pl->map);
00087 #endif
00088 play_again(pl);
00089 pl->speed = 0;
00090 update_ob_speed(pl);
00091 }