forked from github/server
remove unused and broken backup functionality
This commit is contained in:
parent
2b07ae810c
commit
03a94d1264
|
@ -19,7 +19,7 @@ void eressea_free_game(void) {
|
|||
}
|
||||
|
||||
int eressea_read_game(const char * filename) {
|
||||
return readgame(filename, false);
|
||||
return readgame(filename);
|
||||
}
|
||||
|
||||
int eressea_write_game(const char * filename) {
|
||||
|
|
|
@ -823,8 +823,7 @@ void loaddata(state *st) {
|
|||
|
||||
askstring(st->wnd_status->handle, "save as:", datafile, sizeof(datafile));
|
||||
if (strlen(datafile) > 0) {
|
||||
create_backup(datafile);
|
||||
readgame(datafile, false);
|
||||
readgame(datafile);
|
||||
st->modified = 0;
|
||||
}
|
||||
}
|
||||
|
@ -834,7 +833,6 @@ void savedata(state *st) {
|
|||
|
||||
askstring(st->wnd_status->handle, "save as:", datafile, sizeof(datafile));
|
||||
if (strlen(datafile) > 0) {
|
||||
create_backup(datafile);
|
||||
remove_empty_units();
|
||||
writegame(datafile);
|
||||
st->modified = 0;
|
||||
|
|
|
@ -378,22 +378,6 @@ race_t typus2race(unsigned char typus)
|
|||
return NORACE;
|
||||
}
|
||||
|
||||
void create_backup(char *file)
|
||||
{
|
||||
#ifdef HAVE_LINK
|
||||
char bfile[MAX_PATH];
|
||||
int c = 1;
|
||||
|
||||
if (access(file, R_OK) == 0)
|
||||
return;
|
||||
do {
|
||||
sprintf(bfile, "%s.backup%d", file, c);
|
||||
c++;
|
||||
} while (access(bfile, R_OK) == 0);
|
||||
link(file, bfile);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void read_alliances(struct gamedata *data)
|
||||
{
|
||||
storage *store = data->store;
|
||||
|
@ -1476,7 +1460,7 @@ static int cb_sb_maxlevel(spellbook_entry *sbe, void *cbdata) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int readgame(const char *filename, bool backup)
|
||||
int readgame(const char *filename)
|
||||
{
|
||||
int n;
|
||||
char path[MAX_PATH];
|
||||
|
@ -1490,10 +1474,6 @@ int readgame(const char *filename, bool backup)
|
|||
log_debug("- reading game data from %s", filename);
|
||||
join_path(datapath(), filename, path, sizeof(path));
|
||||
|
||||
if (backup) {
|
||||
create_backup(path);
|
||||
}
|
||||
|
||||
F = fopen(path, "rb");
|
||||
if (!F) {
|
||||
perror(path);
|
||||
|
|
|
@ -45,7 +45,7 @@ extern "C" {
|
|||
|
||||
int readorders(const char *filename);
|
||||
int creategame(void);
|
||||
int readgame(const char *filename, bool backup);
|
||||
int readgame(const char *filename);
|
||||
int writegame(const char *filename);
|
||||
|
||||
int current_turn(void);
|
||||
|
@ -65,8 +65,6 @@ extern "C" {
|
|||
void write_ship(struct gamedata *data, const struct ship *sh);
|
||||
struct ship *read_ship(struct gamedata *data);
|
||||
|
||||
void create_backup(char *file);
|
||||
|
||||
int write_game(struct gamedata *data);
|
||||
int read_game(struct gamedata *data);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ static void test_readwrite_data(CuTest * tc)
|
|||
char path[MAX_PATH];
|
||||
test_setup();
|
||||
CuAssertIntEquals(tc, 0, writegame(filename));
|
||||
CuAssertIntEquals(tc, 0, readgame(filename, false));
|
||||
CuAssertIntEquals(tc, 0, readgame(filename));
|
||||
join_path(datapath(), filename, path, sizeof(path));
|
||||
CuAssertIntEquals(tc, 0, remove(path));
|
||||
test_cleanup();
|
||||
|
|
Loading…
Reference in New Issue