save slots into game/saves if game/saves exists

This commit is contained in:
p.kosyh 2009-12-13 08:48:41 +00:00
parent 928bef5af5
commit ed5631e6d4
3 changed files with 23 additions and 1 deletions

3
debian/changelog vendored
View file

@ -1,7 +1,8 @@
instead (1.0.4) unstable; urgency=low
* xref hl optimization
* now, write save slots in game/saves if game/saves exist
-- Peter Kosyh <p.kosyh@gmail.com> Tue, 12 Dec 2009 17:15:00 +0300
instead (1.0.3) unstable; urgency=low

View file

@ -86,6 +86,15 @@ char *game_save_path(int cr, int nr)
struct passwd *pw;
if (!curgame_dir)
return NULL;
if (!access("saves", R_OK)) {
if (nr)
snprintf(save_path, sizeof(save_path) - 1, "saves/save%d", nr);
else
snprintf(save_path, sizeof(save_path) - 1, "saves/autosave");
return save_path;
}
pw = getpwuid(getuid());
if (!pw)
return NULL;

View file

@ -132,6 +132,18 @@ char *game_cfg_path( void )
char *game_save_path( int cr, int nr )
{
char appdir[PATH_MAX];
if (!curgame_dir)
return NULL;
if (!access("saves", R_OK)) {
if (nr)
snprintf(save_path, sizeof(save_path) - 1, "saves/save%d", nr);
else
snprintf(save_path, sizeof(save_path) - 1, "saves/autosave");
return save_path;
}
strcpy( appdir, app_dir() );
snprintf(save_path, sizeof(save_path) - 1 , "%s/instead", appdir);