1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-21 21:49:10 +00:00

(svn r23612) -Add: allow importing libraries in the same way as AI does, only with GS prefix (and in game/library)

This commit is contained in:
truebrain
2011-12-19 20:56:59 +00:00
parent 83f2785f54
commit 963802e9a7
14 changed files with 214 additions and 27 deletions

View File

@@ -33,6 +33,7 @@ enum ContentType {
CONTENT_TYPE_BASE_SOUNDS = 7, ///< The content consists of base sounds
CONTENT_TYPE_BASE_MUSIC = 8, ///< The content consists of base music
CONTENT_TYPE_GAME = 9, ///< The content consists of a game script
CONTENT_TYPE_GAME_LIBRARY = 10, ///< The content consists of a GS library
CONTENT_TYPE_END, ///< Helper to mark the end of the types
};

View File

@@ -14,6 +14,7 @@
#include "../stdafx.h"
#include "../rev.h"
#include "../ai/ai.hpp"
#include "../game/game.hpp"
#include "../window_func.h"
#include "../error.h"
#include "../base_media_base.h"
@@ -104,6 +105,14 @@ bool ClientNetworkContentSocketHandler::Receive_SERVER_INFO(Packet *p)
proc = AI::HasAILibrary; break;
break;
case CONTENT_TYPE_GAME:
proc = Game::HasGame; break;
break;
case CONTENT_TYPE_GAME_LIBRARY:
proc = Game::HasGameLibrary; break;
break;
case CONTENT_TYPE_SCENARIO:
case CONTENT_TYPE_HEIGHTMAP:
proc = HasScenario;
@@ -183,6 +192,7 @@ void ClientNetworkContentSocketHandler::RequestContentList(ContentType type)
this->RequestContentList(CONTENT_TYPE_AI);
this->RequestContentList(CONTENT_TYPE_AI_LIBRARY);
this->RequestContentList(CONTENT_TYPE_GAME);
this->RequestContentList(CONTENT_TYPE_GAME_LIBRARY);
this->RequestContentList(CONTENT_TYPE_NEWGRF);
return;
}
@@ -386,6 +396,7 @@ static char *GetFullFilename(const ContentInfo *ci, bool compressed)
case CONTENT_TYPE_SCENARIO: dir = SCENARIO_DIR; break;
case CONTENT_TYPE_HEIGHTMAP: dir = HEIGHTMAP_DIR; break;
case CONTENT_TYPE_GAME: dir = GAME_DIR; break;
case CONTENT_TYPE_GAME_LIBRARY: dir = GAME_LIBRARY_DIR; break;
}
static char buf[MAX_PATH];
@@ -552,6 +563,10 @@ void ClientNetworkContentSocketHandler::AfterDownload()
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: