X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Flibgame%2Fsetup.c;h=50060391060a25c04d79acd2b1e55695fe4984e3;hp=802c673a54d232db51dc336d6b0de18e0878eb7c;hb=30eb586d06bc4d1ee7388dced1c20e530292aa93;hpb=c3e9cc5a7524e88ca789982a803b805272448c0b diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 802c673a..50060391 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -157,7 +157,7 @@ static char *getLevelSetupDir(char *level_subdir) return levelsetup_dir; } -static char *getCacheDir() +static char *getCacheDir(void) { static char *cache_dir = NULL; @@ -167,7 +167,7 @@ static char *getCacheDir() return cache_dir; } -static char *getNetworkDir() +static char *getNetworkDir(void) { static char *network_dir = NULL; @@ -224,12 +224,12 @@ char *getNetworkLevelDir(char *level_subdir) return network_level_dir; } -char *getCurrentLevelDir() +char *getCurrentLevelDir(void) { return getLevelDirFromTreeInfo(leveldir_current); } -char *getNewUserLevelSubdir() +char *getNewUserLevelSubdir(void) { static char *new_level_subdir = NULL; char *subdir_prefix = getLoginName(); @@ -267,7 +267,7 @@ static char *getTapeDir(char *level_subdir) return tape_dir; } -static char *getSolutionTapeDir() +static char *getSolutionTapeDir(void) { static char *tape_dir = NULL; char *data_dir = getCurrentLevelDir(); @@ -339,7 +339,7 @@ static char *getClassicArtworkDir(int type) getDefaultMusicDir(MUS_CLASSIC_SUBDIR) : ""); } -static char *getUserGraphicsDir() +static char *getUserGraphicsDir(void) { static char *usergraphics_dir = NULL; @@ -349,7 +349,7 @@ static char *getUserGraphicsDir() return usergraphics_dir; } -static char *getUserSoundsDir() +static char *getUserSoundsDir(void) { static char *usersounds_dir = NULL; @@ -359,7 +359,7 @@ static char *getUserSoundsDir() return usersounds_dir; } -static char *getUserMusicDir() +static char *getUserMusicDir(void) { static char *usermusic_dir = NULL; @@ -569,12 +569,14 @@ char *getScoreFilename(int nr) checked_free(filename); sprintf(basename, "%03d.%s", nr, SCOREFILE_EXTENSION); - filename = getPath2(getScoreDir(leveldir_current->subdir), basename); + + /* used instead of "leveldir_current->subdir" (for network games) */ + filename = getPath2(getScoreDir(levelset.identifier), basename); return filename; } -char *getSetupFilename() +char *getSetupFilename(void) { static char *filename = NULL; @@ -585,12 +587,12 @@ char *getSetupFilename() return filename; } -char *getDefaultSetupFilename() +char *getDefaultSetupFilename(void) { return program.config_filename; } -char *getEditorSetupFilename() +char *getEditorSetupFilename(void) { static char *filename = NULL; @@ -606,7 +608,7 @@ char *getEditorSetupFilename() return filename; } -char *getHelpAnimFilename() +char *getHelpAnimFilename(void) { static char *filename = NULL; @@ -617,7 +619,7 @@ char *getHelpAnimFilename() return filename; } -char *getHelpTextFilename() +char *getHelpTextFilename(void) { static char *filename = NULL; @@ -628,7 +630,7 @@ char *getHelpTextFilename() return filename; } -char *getLevelSetInfoFilename() +char *getLevelSetInfoFilename(void) { static char *filename = NULL; char *basenames[] = @@ -657,7 +659,7 @@ char *getLevelSetInfoFilename() return NULL; } -char *getLevelSetTitleMessageBasename(int nr, boolean initial) +static char *getLevelSetTitleMessageBasename(int nr, boolean initial) { static char basename[32]; @@ -1061,7 +1063,7 @@ void InitScoreDirectory(char *level_subdir) createDirectory(getScoreDir(level_subdir), "level score", permissions); } -static void SaveUserLevelInfo(); +static void SaveUserLevelInfo(void); void InitUserLevelDirectory(char *level_subdir) { @@ -1093,7 +1095,7 @@ void InitLevelSetupDirectory(char *level_subdir) createDirectory(getLevelSetupDir(level_subdir), "level setup", PERMS_PRIVATE); } -void InitCacheDirectory() +static void InitCacheDirectory(void) { createDirectory(getUserGameDataDir(), "user data", PERMS_PRIVATE); createDirectory(getCacheDir(), "cache data", PERMS_PRIVATE); @@ -1104,7 +1106,7 @@ void InitCacheDirectory() /* some functions to handle lists of level and artwork directories */ /* ------------------------------------------------------------------------- */ -TreeInfo *newTreeInfo() +TreeInfo *newTreeInfo(void) { return checked_calloc(sizeof(TreeInfo)); } @@ -1238,8 +1240,8 @@ TreeInfo *getTreeInfoFromIdentifier(TreeInfo *node, char *identifier) return NULL; } -TreeInfo *cloneTreeNode(TreeInfo **node_top, TreeInfo *node_parent, - TreeInfo *node, boolean skip_sets_without_levels) +static TreeInfo *cloneTreeNode(TreeInfo **node_top, TreeInfo *node_parent, + TreeInfo *node, boolean skip_sets_without_levels) { TreeInfo *node_new; @@ -1266,7 +1268,7 @@ TreeInfo *cloneTreeNode(TreeInfo **node_top, TreeInfo *node_parent, return node_new; } -void cloneTree(TreeInfo **ti_new, TreeInfo *ti, boolean skip_empty_sets) +static void cloneTree(TreeInfo **ti_new, TreeInfo *ti, boolean skip_empty_sets) { TreeInfo *ti_cloned = cloneTreeNode(ti_new, NULL, ti, skip_empty_sets); @@ -1431,7 +1433,7 @@ void sortTreeInfo(TreeInfo **node_first) #define FILE_PERMS_PUBLIC_ALL (MODE_R_ALL | MODE_W_ALL) -char *getHomeDir() +char *getHomeDir(void) { static char *dir = NULL; @@ -1520,7 +1522,7 @@ char *getUserGameDataDir(void) return user_game_data_dir; } -char *getSetupDir() +char *getSetupDir(void) { return getUserGameDataDir(); } @@ -1543,7 +1545,7 @@ static int posix_mkdir(const char *pathname, mode_t mode) #endif } -static boolean posix_process_running_setgid() +static boolean posix_process_running_setgid(void) { #if defined(PLATFORM_UNIX) return (getgid() != getegid()); @@ -1586,7 +1588,7 @@ void createDirectory(char *dir, char *text, int permission_class) posix_umask(last_umask); /* restore previous umask */ } -void InitUserDataDirectory() +void InitUserDataDirectory(void) { createDirectory(getUserGameDataDir(), "user data", PERMS_PRIVATE); } @@ -1830,7 +1832,7 @@ static int keys_are_equal(void *key1, void *key2) return (strEqual((char *)key1, (char *)key2)); } -SetupFileHash *newSetupFileHash() +SetupFileHash *newSetupFileHash(void) { SetupFileHash *new_hash = create_hashtable(16, 0.75, get_hash_from_key, keys_are_equal); @@ -2205,7 +2207,7 @@ static boolean loadSetupFileData(void *setup_file_data, char *filename, return TRUE; } -void saveSetupFileHash(SetupFileHash *hash, char *filename) +static void saveSetupFileHash(SetupFileHash *hash, char *filename) { FILE *file; @@ -2789,7 +2791,7 @@ static TreeInfo *createTopTreeInfoNode(TreeInfo *node_first) /* functions for handling level and custom artwork info cache */ /* -------------------------------------------------------------------------- */ -static void LoadArtworkInfoCache() +static void LoadArtworkInfoCache(void) { InitCacheDirectory(); @@ -2811,7 +2813,7 @@ static void LoadArtworkInfoCache() artworkinfo_cache_new = newSetupFileHash(); } -static void SaveArtworkInfoCache() +static void SaveArtworkInfoCache(void) { char *filename = getPath2(getCacheDir(), ARTWORKINFO_CACHE_FILE); @@ -3166,7 +3168,7 @@ static void LoadLevelInfoFromLevelDir(TreeInfo **node_first, level_directory); } -boolean AdjustGraphicsForEMC() +boolean AdjustGraphicsForEMC(void) { boolean settings_changed = FALSE; @@ -3176,7 +3178,7 @@ boolean AdjustGraphicsForEMC() return settings_changed; } -void LoadLevelInfo() +void LoadLevelInfo(void) { InitUserLevelDirectory(getLoginName()); @@ -3421,7 +3423,7 @@ static TreeInfo *getDummyArtworkInfo(int type) return artwork_new; } -void LoadArtworkInfo() +void LoadArtworkInfo(void) { LoadArtworkInfoCache(); @@ -3501,8 +3503,8 @@ void LoadArtworkInfo() #endif } -void LoadArtworkInfoFromLevelInfo(ArtworkDirTree **artwork_node, - LevelDirTree *level_node) +static void LoadArtworkInfoFromLevelInfo(ArtworkDirTree **artwork_node, + LevelDirTree *level_node) { int type = (*artwork_node)->type; @@ -3557,7 +3559,7 @@ void LoadArtworkInfoFromLevelInfo(ArtworkDirTree **artwork_node, } } -void LoadLevelArtworkInfo() +void LoadLevelArtworkInfo(void) { print_timestamp_init("LoadLevelArtworkInfo"); @@ -3702,7 +3704,7 @@ TreeInfo *getArtworkTreeInfoForUserLevelSet(int type) return getTreeInfoFromIdentifier(artwork_first_node, artwork_set); } -boolean checkIfCustomArtworkExistsForCurrentLevelSet() +boolean checkIfCustomArtworkExistsForCurrentLevelSet(void) { char *graphics_set = getArtworkIdentifierForUserLevelSet(ARTWORK_TYPE_GRAPHICS); @@ -3861,7 +3863,7 @@ boolean CreateUserLevelSet(char *level_subdir, char *level_name, return TRUE; } -static void SaveUserLevelInfo() +static void SaveUserLevelInfo(void) { CreateUserLevelSet(getLoginName(), getLoginName(), getRealName(), 100, FALSE); } @@ -3973,7 +3975,7 @@ char *getSetupLine(struct TokenInfo *token_info, char *prefix, int token_nr) return line; } -void LoadLevelSetup_LastSeries() +void LoadLevelSetup_LastSeries(void) { /* ----------------------------------------------------------------------- */ /* ~/./levelsetup.conf */ @@ -4053,17 +4055,17 @@ static void SaveLevelSetup_LastSeries_Ext(boolean deactivate_last_level_series) free(filename); } -void SaveLevelSetup_LastSeries() +void SaveLevelSetup_LastSeries(void) { SaveLevelSetup_LastSeries_Ext(FALSE); } -void SaveLevelSetup_LastSeries_Deactivate() +void SaveLevelSetup_LastSeries_Deactivate(void) { SaveLevelSetup_LastSeries_Ext(TRUE); } -static void checkSeriesInfo() +static void checkSeriesInfo(void) { static char *level_directory = NULL; Directory *dir; @@ -4085,7 +4087,7 @@ static void checkSeriesInfo() closeDirectory(dir); } -void LoadLevelSetup_SeriesInfo() +void LoadLevelSetup_SeriesInfo(void) { char *filename; SetupFileHash *level_setup_hash = NULL; @@ -4183,7 +4185,7 @@ void LoadLevelSetup_SeriesInfo() free(filename); } -void SaveLevelSetup_SeriesInfo() +void SaveLevelSetup_SeriesInfo(void) { char *filename; char *level_subdir = leveldir_current->subdir;