forked from github/server
Merge pull request #193 from badgerman/feature-gmtool-upgrades
misc gmtool upgrades
This commit is contained in:
commit
053adda3b4
2
critbit
2
critbit
|
@ -1 +1 @@
|
|||
Subproject commit 61989d93368022602a2a7ac4218c83f254701f0f
|
||||
Subproject commit b38f6f8acdc2ce5b0613a4bb2ff8082051a25ac3
|
39
src/gmtool.c
39
src/gmtool.c
|
@ -761,6 +761,29 @@ static void select_regions(state * st, int selectmode)
|
|||
st->wnd_map->update |= 3;
|
||||
}
|
||||
|
||||
void loaddata(state *st) {
|
||||
char datafile[MAX_PATH];
|
||||
|
||||
askstring(st->wnd_status->handle, "save as:", datafile, sizeof(datafile));
|
||||
if (strlen(datafile) > 0) {
|
||||
create_backup(datafile);
|
||||
readgame(datafile, false);
|
||||
st->modified = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void savedata(state *st) {
|
||||
char datafile[MAX_PATH];
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
static void handlekey(state * st, int c)
|
||||
{
|
||||
window *wnd;
|
||||
|
@ -816,17 +839,11 @@ static void handlekey(state * st, int c)
|
|||
case 'S':
|
||||
case KEY_SAVE:
|
||||
case KEY_F(2):
|
||||
/* if (st->modified) */ {
|
||||
char datafile[MAX_PATH];
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
savedata(st);
|
||||
break;
|
||||
case KEY_F(3):
|
||||
case KEY_OPEN:
|
||||
loaddata(st);
|
||||
break;
|
||||
case 'B':
|
||||
/*
|
||||
|
|
|
@ -1348,7 +1348,7 @@ void writefaction(struct gamedata *data, const faction * f)
|
|||
write_spellbook(f->spellbook, data->store);
|
||||
}
|
||||
|
||||
int readgame(const char *filename, int backup)
|
||||
int readgame(const char *filename, bool backup)
|
||||
{
|
||||
int n, p, nread;
|
||||
faction *f, **fp;
|
||||
|
|
|
@ -44,7 +44,7 @@ extern "C" {
|
|||
|
||||
int readorders(const char *filename);
|
||||
int creategame(void);
|
||||
int readgame(const char *filename, int backup);
|
||||
int readgame(const char *filename, bool backup);
|
||||
int writegame(const char *filename);
|
||||
|
||||
/* Versionsänderungen: */
|
||||
|
|
|
@ -15,7 +15,7 @@ static void test_readwrite_data(CuTest * tc)
|
|||
test_cleanup();
|
||||
sprintf(path, "%s/%s", datapath(), filename);
|
||||
CuAssertIntEquals(tc, 0, writegame(filename));
|
||||
CuAssertIntEquals(tc, 0, readgame(filename, 0));
|
||||
CuAssertIntEquals(tc, 0, readgame(filename, false));
|
||||
CuAssertIntEquals(tc, RELEASE_VERSION, global.data_version);
|
||||
CuAssertIntEquals(tc, 0, remove(path));
|
||||
test_cleanup();
|
||||
|
|
542
src/report.c
542
src/report.c
File diff suppressed because it is too large
Load Diff
2
storage
2
storage
|
@ -1 +1 @@
|
|||
Subproject commit bcc2874cf289a1d0fc9cc79ff3ed271403b2e24c
|
||||
Subproject commit 48768e4bef7ff28365487e047d3b910127c716d0
|
Loading…
Reference in New Issue