return levelsetup_dir;
}
-static char *getCacheDir()
+static char *getCacheDir(void)
{
static char *cache_dir = NULL;
return cache_dir;
}
+static char *getNetworkDir(void)
+{
+ static char *network_dir = NULL;
+
+ if (network_dir == NULL)
+ network_dir = getPath2(getUserGameDataDir(), NETWORK_DIRECTORY);
+
+ return network_dir;
+}
+
static char *getLevelDirFromTreeInfo(TreeInfo *node)
{
static char *level_dir = NULL;
return userlevel_dir;
}
-char *getCurrentLevelDir()
+char *getNetworkLevelDir(char *level_subdir)
+{
+ static char *network_level_dir = NULL;
+ char *data_dir = getNetworkDir();
+ char *networklevel_subdir = LEVELS_DIRECTORY;
+
+ checked_free(network_level_dir);
+
+ if (level_subdir != NULL)
+ network_level_dir = getPath3(data_dir, networklevel_subdir, level_subdir);
+ else
+ network_level_dir = getPath2(data_dir, networklevel_subdir);
+
+ return network_level_dir;
+}
+
+char *getCurrentLevelDir(void)
{
return getLevelDirFromTreeInfo(leveldir_current);
}
-char *getNewUserLevelSubdir()
+char *getNewUserLevelSubdir(void)
{
static char *new_level_subdir = NULL;
char *subdir_prefix = getLoginName();
return tape_dir;
}
-static char *getSolutionTapeDir()
+static char *getSolutionTapeDir(void)
{
static char *tape_dir = NULL;
char *data_dir = getCurrentLevelDir();
getDefaultMusicDir(MUS_CLASSIC_SUBDIR) : "");
}
-static char *getUserGraphicsDir()
+static char *getUserGraphicsDir(void)
{
static char *usergraphics_dir = NULL;
return usergraphics_dir;
}
-static char *getUserSoundsDir()
+static char *getUserSoundsDir(void)
{
static char *usersounds_dir = NULL;
return usersounds_dir;
}
-static char *getUserMusicDir()
+static char *getUserMusicDir(void)
{
static char *usermusic_dir = NULL;
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;
return filename;
}
-char *getDefaultSetupFilename()
+char *getDefaultSetupFilename(void)
{
return program.config_filename;
}
-char *getEditorSetupFilename()
+char *getEditorSetupFilename(void)
{
static char *filename = NULL;
return filename;
}
-char *getHelpAnimFilename()
+char *getHelpAnimFilename(void)
{
static char *filename = NULL;
return filename;
}
-char *getHelpTextFilename()
+char *getHelpTextFilename(void)
{
static char *filename = NULL;
return filename;
}
-char *getLevelSetInfoFilename()
+char *getLevelSetInfoFilename(void)
{
static char *filename = NULL;
char *basenames[] =
return NULL;
}
-char *getLevelSetTitleMessageBasename(int nr, boolean initial)
+static char *getLevelSetTitleMessageBasename(int nr, boolean initial)
{
static char basename[32];
createDirectory(getScoreDir(level_subdir), "level score", permissions);
}
-static void SaveUserLevelInfo();
+static void SaveUserLevelInfo(void);
void InitUserLevelDirectory(char *level_subdir)
{
}
}
+void InitNetworkLevelDirectory(char *level_subdir)
+{
+ if (!directoryExists(getNetworkLevelDir(level_subdir)))
+ {
+ createDirectory(getUserGameDataDir(), "user data", PERMS_PRIVATE);
+ createDirectory(getNetworkDir(), "network data", PERMS_PRIVATE);
+ createDirectory(getNetworkLevelDir(NULL), "main network level", PERMS_PRIVATE);
+ createDirectory(getNetworkLevelDir(level_subdir), "network level", PERMS_PRIVATE);
+ }
+}
+
void InitLevelSetupDirectory(char *level_subdir)
{
createDirectory(getUserGameDataDir(), "user data", PERMS_PRIVATE);
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);
/* some functions to handle lists of level and artwork directories */
/* ------------------------------------------------------------------------- */
-TreeInfo *newTreeInfo()
+TreeInfo *newTreeInfo(void)
{
return checked_calloc(sizeof(TreeInfo));
}
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;
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);
#define FILE_PERMS_PUBLIC_ALL (MODE_R_ALL | MODE_W_ALL)
-char *getHomeDir()
+char *getHomeDir(void)
{
static char *dir = NULL;
return user_game_data_dir;
}
-char *getSetupDir()
+char *getSetupDir(void)
{
return getUserGameDataDir();
}
#endif
}
-static boolean posix_process_running_setgid()
+static boolean posix_process_running_setgid(void)
{
#if defined(PLATFORM_UNIX)
return (getgid() != getegid());
posix_umask(last_umask); /* restore previous umask */
}
-void InitUserDataDirectory()
+void InitUserDataDirectory(void)
{
createDirectory(getUserGameDataDir(), "user data", PERMS_PRIVATE);
}
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);
return TRUE;
}
-void saveSetupFileHash(SetupFileHash *hash, char *filename)
+static void saveSetupFileHash(SetupFileHash *hash, char *filename)
{
FILE *file;
/* functions for handling level and custom artwork info cache */
/* -------------------------------------------------------------------------- */
-static void LoadArtworkInfoCache()
+static void LoadArtworkInfoCache(void)
{
InitCacheDirectory();
artworkinfo_cache_new = newSetupFileHash();
}
-static void SaveArtworkInfoCache()
+static void SaveArtworkInfoCache(void)
{
char *filename = getPath2(getCacheDir(), ARTWORKINFO_CACHE_FILE);
level_directory);
}
-boolean AdjustGraphicsForEMC()
+boolean AdjustGraphicsForEMC(void)
{
boolean settings_changed = FALSE;
return settings_changed;
}
-void LoadLevelInfo()
+void LoadLevelInfo(void)
{
InitUserLevelDirectory(getLoginName());
return artwork_new;
}
-void LoadArtworkInfo()
+void LoadArtworkInfo(void)
{
LoadArtworkInfoCache();
#endif
}
-void LoadArtworkInfoFromLevelInfo(ArtworkDirTree **artwork_node,
- LevelDirTree *level_node)
+static void LoadArtworkInfoFromLevelInfo(ArtworkDirTree **artwork_node,
+ LevelDirTree *level_node)
{
int type = (*artwork_node)->type;
}
}
-void LoadLevelArtworkInfo()
+void LoadLevelArtworkInfo(void)
{
print_timestamp_init("LoadLevelArtworkInfo");
return getTreeInfoFromIdentifier(artwork_first_node, artwork_set);
}
-boolean checkIfCustomArtworkExistsForCurrentLevelSet()
+boolean checkIfCustomArtworkExistsForCurrentLevelSet(void)
{
char *graphics_set =
getArtworkIdentifierForUserLevelSet(ARTWORK_TYPE_GRAPHICS);
return TRUE;
}
-static void SaveUserLevelInfo()
+static void SaveUserLevelInfo(void)
{
CreateUserLevelSet(getLoginName(), getLoginName(), getRealName(), 100, FALSE);
}
return line;
}
-void LoadLevelSetup_LastSeries()
+void LoadLevelSetup_LastSeries(void)
{
/* ----------------------------------------------------------------------- */
/* ~/.<program>/levelsetup.conf */
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;
closeDirectory(dir);
}
-void LoadLevelSetup_SeriesInfo()
+void LoadLevelSetup_SeriesInfo(void)
{
char *filename;
SetupFileHash *level_setup_hash = NULL;
free(filename);
}
-void SaveLevelSetup_SeriesInfo()
+void SaveLevelSetup_SeriesInfo(void)
{
char *filename;
char *level_subdir = leveldir_current->subdir;