From: Holger Schemel Date: Sat, 8 Sep 2018 23:12:25 +0000 (+0200) Subject: cleanup of network level function names and parameters X-Git-Tag: 4.1.1.0~40 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=d643b3820fbeb5d3c8a731dbdad2785047cb3bb2;p=rocksndiamonds.git cleanup of network level function names and parameters --- diff --git a/src/files.c b/src/files.c index 266ef708..79c77879 100644 --- a/src/files.c +++ b/src/files.c @@ -6620,21 +6620,21 @@ void LoadLevelTemplate(int nr) LoadLevelTemplate_LoadAndInit(); } -static void LoadLevelTemplateFromNetwork(struct LevelFileInfo *lfi_network_template) +static void LoadNetworkLevelTemplate(struct NetworkLevelInfo *network_level) { - copyLevelFileInfo(lfi_network_template, &level_template.file_info); + copyLevelFileInfo(&network_level->tmpl_info, &level_template.file_info); LoadLevelTemplate_LoadAndInit(); } -static void LoadLevel_LoadAndInit(struct LevelFileInfo *lfi_network_template) +static void LoadLevel_LoadAndInit(struct NetworkLevelInfo *network_level) { LoadLevelFromFileInfo(&level, &level.file_info, FALSE); if (level.use_custom_template) { - if (lfi_network_template != NULL) - LoadLevelTemplateFromNetwork(lfi_network_template); + if (network_level != NULL) + LoadNetworkLevelTemplate(network_level); else LoadLevelTemplate(-1); } @@ -6662,12 +6662,14 @@ void LoadLevelInfoOnly(int nr) LoadLevelFromFileInfo(&level, &level.file_info, TRUE); } -void LoadLevelFromNetwork(struct LevelFileInfo *lfi_network_level, - struct LevelFileInfo *lfi_network_template) +void LoadNetworkLevel(struct NetworkLevelInfo *network_level) { - copyLevelFileInfo(lfi_network_level, &level.file_info); + SetLevelSetInfo(network_level->leveldir_identifier, + network_level->file_info.nr); - LoadLevel_LoadAndInit(lfi_network_template); + copyLevelFileInfo(&network_level->file_info, &level.file_info); + + LoadLevel_LoadAndInit(network_level); } static int SaveLevel_VERS(FILE *file, struct LevelInfo *level) diff --git a/src/files.h b/src/files.h index f823e1f2..9200e538 100644 --- a/src/files.h +++ b/src/files.h @@ -37,7 +37,7 @@ void LoadLevelFromFilename(struct LevelInfo *, char *); void LoadLevel(int); void LoadLevelTemplate(int); void LoadLevelInfoOnly(int); -void LoadLevelFromNetwork(struct LevelFileInfo *, struct LevelFileInfo *); +void LoadNetworkLevel(struct NetworkLevelInfo *); void SaveLevel(int); void SaveLevelTemplate(); void SaveNativeLevel(struct LevelInfo *); diff --git a/src/main.h b/src/main.h index cea0249e..f722f9c4 100644 --- a/src/main.h +++ b/src/main.h @@ -3125,6 +3125,17 @@ struct LevelInfo boolean use_action_after_change_bug; }; +struct NetworkLevelInfo +{ + char *leveldir_identifier; /* network levelset identifier */ + + struct LevelFileInfo file_info; /* file info for level file */ + struct LevelFileInfo tmpl_info; /* file info for level template */ + + boolean use_network_level_files; /* use levels from network server */ + boolean use_custom_template; /* use CEs from level template */ +}; + struct GlobalInfo { char *autoplay_leveldir; diff --git a/src/network.c b/src/network.c index d0c15619..dcd92594 100644 --- a/src/network.c +++ b/src/network.c @@ -38,15 +38,6 @@ static struct NetworkClientPlayerInfo first_player = NULL }; -struct NetworkLevelFileInfo -{ - char *leveldir_identifier; - struct LevelFileInfo file_info; - struct LevelFileInfo tmpl_info; - boolean use_network_level_files; - boolean use_custom_template; -}; - /* server stuff */ static TCPsocket sfd; /* TCP server socket */ @@ -60,7 +51,7 @@ static boolean stop_network_game = FALSE; static boolean stop_network_client = FALSE; static char stop_network_client_message[MAX_OUTPUT_LINESIZE + 1]; -static struct NetworkLevelFileInfo network_level; +static struct NetworkLevelInfo network_level; static void DrawNetworkTextExt(char *message, int font_nr, boolean initialize) { @@ -699,16 +690,13 @@ static void Handle_OP_START_PLAYING() level_nr = new_level_nr; } - SetLevelSetInfo(new_leveldir_identifier, new_level_nr); - /* needed if level set of network game changed graphics, sounds or music */ ReloadCustomArtwork(0); TapeErase(); if (network_level.use_network_level_files) - LoadLevelFromNetwork(&network_level.file_info, - &network_level.tmpl_info); + LoadNetworkLevel(&network_level); else LoadLevel(level_nr);