diff options
author | rubidium <rubidium@openttd.org> | 2012-01-02 21:57:29 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2012-01-02 21:57:29 +0000 |
commit | 8371ecc9229c91066d0d933020598b07ad3e4400 (patch) | |
tree | 0af83dd25535a9274715f62bea0fe09d4c52bbc0 /src/network | |
parent | 37b136576df138bc4409ca23c59a8379b83ddafb (diff) | |
download | openttd-8371ecc9229c91066d0d933020598b07ad3e4400.tar.xz |
(svn r23719) -Fix [FS#4930]: extraction of music packs failed
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/network_content.cpp | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp index fe0921b5e..53672c5ec 100644 --- a/src/network/network_content.cpp +++ b/src/network/network_content.cpp @@ -544,49 +544,49 @@ void ClientNetworkContentSocketHandler::AfterDownload() if (GunzipFile(this->curInfo)) { unlink(GetFullFilename(this->curInfo, true)); + Subdirectory sd = NO_DIRECTORY; + switch (this->curInfo->type) { + case CONTENT_TYPE_AI: + sd = AI_DIR; + break; + + case CONTENT_TYPE_AI_LIBRARY: + sd = AI_LIBRARY_DIR; + break; + + case CONTENT_TYPE_GAME: + sd = GAME_DIR; + break; + + case CONTENT_TYPE_GAME_LIBRARY: + sd = GAME_LIBRARY_DIR; + break; + + case CONTENT_TYPE_BASE_GRAPHICS: + case CONTENT_TYPE_BASE_SOUNDS: + case CONTENT_TYPE_BASE_MUSIC: + sd = BASESET_DIR; + break; + + case CONTENT_TYPE_NEWGRF: + sd = NEWGRF_DIR; + break; + + case CONTENT_TYPE_SCENARIO: + case CONTENT_TYPE_HEIGHTMAP: + sd = SCENARIO_DIR; + break; + + default: NOT_REACHED(); + } + + TarScanner ts; + ts.AddFile(sd, GetFullFilename(this->curInfo, false)); + if (this->curInfo->type == CONTENT_TYPE_BASE_MUSIC) { /* Music can't be in a tar. So extract the tar! */ ExtractTar(GetFullFilename(this->curInfo, false), BASESET_DIR); unlink(GetFullFilename(this->curInfo, false)); - } else { - Subdirectory sd = NO_DIRECTORY; - switch (this->curInfo->type) { - case CONTENT_TYPE_AI: - sd = AI_DIR; - break; - - case CONTENT_TYPE_AI_LIBRARY: - sd = AI_LIBRARY_DIR; - break; - - case CONTENT_TYPE_GAME: - sd = GAME_DIR; - break; - - case CONTENT_TYPE_GAME_LIBRARY: - sd = GAME_LIBRARY_DIR; - break; - - case CONTENT_TYPE_BASE_GRAPHICS: - case CONTENT_TYPE_BASE_SOUNDS: - case CONTENT_TYPE_BASE_MUSIC: - sd = BASESET_DIR; - break; - - case CONTENT_TYPE_NEWGRF: - sd = NEWGRF_DIR; - break; - - case CONTENT_TYPE_SCENARIO: - case CONTENT_TYPE_HEIGHTMAP: - sd = SCENARIO_DIR; - break; - - default: NOT_REACHED(); - } - - TarScanner ts; - ts.AddFile(sd, GetFullFilename(this->curInfo, false)); } this->OnDownloadComplete(this->curInfo->id); |