45 const char *savefile_options;
56 if (!savefile_options) {
57 log_error(
"Missing savefile options. Can not load the savegame.");
67 log_verbose(
"loading savefile in 2.3 - 2.6 format ...");
70 log_error(
"Too old savegame format not supported any more.");
142void save_game(
const char *orig_filename,
const char *save_reason,
145 char *dot, *filename;
146 struct timer *timer_cpu, *timer_user;
154 if (!orig_filename) {
159 if ((filename = strrchr(stdata->
filepath,
'/'))) {
166 for (dot = filename;
'.' == *dot; dot++) {
174 char *strip_extensions[] = {
175 ".sav",
".gz",
".bz2",
".xz",
".zst", NULL };
176 bool stripped =
TRUE;
178 while ((end_dot = strrchr(dot,
'.')) && stripped) {
183 for (i = 0; strip_extensions[i] != NULL && !stripped; i++) {
184 if (!strcmp(end_dot, strip_extensions[i])) {
194 if (filename[0] ==
'\0') {
220#ifdef FREECIV_HAVE_LIBZ
226#ifdef FREECIV_HAVE_LIBBZ2
232#ifdef FREECIV_HAVE_LIBLZMA
238#ifdef FREECIV_HAVE_LIBZSTD
247 log_error(
_(
"Unsupported compression type %d."),
250 _(
"Unsupported compression type %d."),
263 log_error(
_(
"Can't create saves directory %s!"),
267 _(
"Can't create saves directory!"));
281 log_error(
_(
"Can't create scenario saves directory %s!"),
285 _(
"Can't create scenario saves directory!"));
297 if (tmpname[0] !=
'\0') {
#define CALL_FUNC_EACH_AI(_func,...)
#define CALL_PLR_AI_FUNC(_func, _player,...)
bool has_capabilities(const char *us, const char *them)
#define city_list_iterate(citylist, pcity)
#define city_list_iterate_end
void con_write(enum rfc_status rfc_status, const char *message,...)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
int fc_thread_start(fc_thread *thread, void(*function)(void *arg), void *arg)
void fc_thread_wait(fc_thread *thread)
const struct ft_color ftc_warning
int generate_save_name(const char *format, char *buf, int buflen, const char *reason)
#define fc_assert_ret(condition)
#define log_verbose(message,...)
#define log_debug(message,...)
#define log_error(message,...)
void notify_conn(struct conn_list *dest, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
#define players_iterate_end
#define players_iterate(_pplayer)
struct section_file * secfile_new(bool allow_duplicates)
const char * secfile_error(void)
void secfile_destroy(struct section_file *secfile)
const char * secfile_lookup_str(const struct section_file *secfile, const char *path,...)
bool secfile_save(const struct section_file *secfile, const char *filename, int compression_level, enum fz_method compression_method)
void savegame2_load(struct section_file *file)
void savegame3_save(struct section_file *sfile, const char *save_reason, bool scenario)
void savegame3_load(struct section_file *file)
void savegame_load(struct section_file *sfile)
void savegame_save(struct section_file *sfile, const char *save_reason, bool scenario)
void save_system_close(void)
static void save_thread_run(void *arg)
static void save_thread_data_free(struct save_thread_data *stdata)
void save_game(const char *orig_filename, const char *save_reason, bool scenario)
static fc_thread * save_thread
bool make_dir(const char *pathname)
bool path_is_absolute(const char *filename)
struct server_arguments srvarg
struct civ_game::@30::@34 server
char save_name[MAX_LEN_NAME]
enum fz_method save_compress_type
enum fz_method save_compress_type
struct section_file * sfile
char * scenarios_pathname
#define sz_strlcpy(dest, src)
#define sz_strlcat(dest, src)
struct timer * timer_new(enum timer_timetype type, enum timer_use use)
void timer_destroy(struct timer *t)
void timer_start(struct timer *t)
void timer_stop(struct timer *t)
double timer_read_seconds(struct timer *t)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end