savegame.c: consistent indentation

This commit is contained in:
wdlkmpx 2021-01-14 23:21:06 +08:00
parent 7c49070107
commit 565348506b

View File

@ -17,15 +17,15 @@
#include "game.h"
gint parse_save_game(gchar *sgame, gchar **rules, gint *score, gint **board, gint **next) {
gint parse_save_game(gchar *sgame, gchar **rules, gint *score, gint **board, gint **next)
{
struct stat buf;
gchar *sdata, *psdata, *srules;
FILE *f;
gint i, val;
gint rw, rh, rc, rn, rd, rlen;
if(stat(sgame, &buf) != 0 || !S_ISREG(buf.st_mode) || buf.st_size < 20 ||
(f = fopen(sgame, "r")) == NULL) {
if (stat(sgame, &buf) != 0 || !S_ISREG(buf.st_mode) || buf.st_size < 20 || (f = fopen(sgame, "r")) == NULL) {
return 0;
}
@ -84,9 +84,11 @@ gint parse_save_game(gchar *sgame, gchar **rules, gint *score, gint **board, gin
return 1;
}
/* check that save game name is in form YYYY-MM-DD-HHMMSS.sav and have correct content
return string "DD.MM.YYYY HH:MM:SS (score)" on success, NULL on failure */
gchar *is_valid_save_game(gchar *name, gchar *path) {
gchar *is_valid_save_game(gchar *name, gchar *path)
{
guint i, y, m, d, h, min, s;
gint score, *board, *next;
gchar *sgame;
@ -118,7 +120,9 @@ gchar *is_valid_save_game(gchar *name, gchar *path) {
*/
}
gint get_saved_games(gchar ***gamelist) {
gint get_saved_games(gchar ***gamelist)
{
gchar *datapath;
struct stat buf;
struct dirent *dir_entry;
@ -136,7 +140,8 @@ gint get_saved_games(gchar ***gamelist) {
g_free (datapath);
return -1;
}
if((directory = opendir(datapath))) {
if ((directory = opendir(datapath)))
{
while ((dir_entry = readdir(directory))) {
if ((game = is_valid_save_game(dir_entry->d_name, datapath)) != NULL) {
num++;
@ -152,7 +157,9 @@ gint get_saved_games(gchar ***gamelist) {
return num;
}
gchar *save_game(gchar *rules, gint score, gint *board, gint *nextcolors) {
gchar *save_game(gchar *rules, gint score, gint *board, gint *nextcolors)
{
FILE *f;
gchar *fname;
time_t nowtime;