--- deliantra/server/server/main.C 2006/12/21 23:37:06 1.52 +++ deliantra/server/server/main.C 2006/12/22 16:34:00 1.53 @@ -610,13 +610,9 @@ * indicated otherwise. */ if (exit_ob->map->templatemap && (resultname[0] != '/')) - { - new_map_name = path_combine_and_normalize (exit_ob->map->path, resultname); - } + new_map_name = path_combine_and_normalize (exit_ob->map->path, resultname); else - { - new_map_name = create_template_pathname (resultname); - } + new_map_name = create_template_pathname (resultname); new_map = ready_map_name (new_map_name, MAP_PLAYER_UNIQUE); if (!new_map) @@ -876,7 +872,7 @@ strcpy (op->contr->savebed_map, path_combine_and_normalize (exit_ob->map->path, EXIT_PATH (exit_ob))); op->contr->bed_x = EXIT_X (exit_ob), op->contr->bed_y = EXIT_Y (exit_ob); - save_player (op, 1); + op->contr->save (); /* LOG(llevDebug,"enter_exit: Taking damned exit %s to (%d,%d) on map %s\n", * exit_ob->name?exit_ob->name:"(none)", exit_ob->x, exit_ob->y, * path_combine_and_normalize(exit_ob->map->path, EXIT_PATH(exit_ob))); */ @@ -970,7 +966,7 @@ */ if ((pl->last_save_tick + AUTOSAVE) < (uint32) pticks && pl->ns->state == ST_PLAYING) { - save_player (pl->ob, 1); + pl->ob->contr->save (); pl->last_save_tick = pticks; } #endif @@ -1199,10 +1195,10 @@ if (init_done) { - for (player *pl = first_player; pl != NULL; pl = pl->next) - save_player (pl->ob, 0); + for (player *pl = first_player; pl; pl = pl->next) + pl->save (1); - for (player *pl = first_player; pl != NULL; pl = pl->next) + for (player *pl = first_player; pl; pl = pl->next) if (!QUERY_FLAG (pl->ob, FLAG_REMOVED)) leave_map (pl->ob); @@ -1223,20 +1219,13 @@ { if (pl) { - /* We do this so that the socket handling routine can do the final - * cleanup. We also leave that loop to actually handle the freeing - * of the data. - */ - if (pl->ns) - pl->ns->destroy (); - if (pl->ob->type != DEAD_OBJECT) { /* If a hidden dm dropped connection do not create * inconsistencies by showing that they have left the game */ if (!(QUERY_FLAG (pl->ob, FLAG_WIZ) && pl->ob->contr->hidden) - && draw_exit && (pl->ns->state != ST_GET_NAME && pl->ns->state != ST_GET_PASSWORD && pl->ns->state != ST_CONFIRM_PASSWORD)) + && draw_exit) { if (pl->ob->map) { @@ -1247,7 +1236,7 @@ char buf[MAX_BUF]; sprintf (buf, "%s left the game.", &pl->ob->name); - new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, buf); + new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, 0, buf); } if (!QUERY_FLAG (pl->ob, FLAG_REMOVED)) @@ -1255,6 +1244,14 @@ pl->ob->type = DEAD_OBJECT; /* To avoid problems with inventory window */ } + + /* We do this so that the socket handling routine can do the final + * cleanup. We also leave that loop to actually handle the freeing + * of the data. + */ + if (pl->ns) + pl->ns->destroy (); + } }