From 12102f87911e31453714cabb56f53c3fa7c97455 Mon Sep 17 00:00:00 2001 From: titison Date: Sun, 8 Mar 2015 01:36:16 +0100 Subject: [PATCH] Specific Tileset on map-preview option Tell the game a specific tileset to use together with the --preview-map option. The Tileset is optional. Default is forest. ! EVEN IF FOREST DOES NOT EXIST ! (like before) ./start_megaglest --preview-map=Map,Tileset --- source/glest_game/main/main.cpp | 10 ++++++++-- source/shared_lib/include/platform/sdl/platform_main.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 82118f11..380afbcb 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -5044,11 +5044,17 @@ int glestMain(int argc, char** argv) { vector paramPartTokens; Tokenize(mapName,paramPartTokens,"="); if(paramPartTokens.size() >= 2 && paramPartTokens[1].length() > 0) { - string autoloadMapName = paramPartTokens[1]; + vector paramPartTokens2; + string tileset="forest"; + Tokenize(paramPartTokens[1],paramPartTokens2,","); + if(paramPartTokens2.size() >= 2 && paramPartTokens2[1].length() > 0) { + tileset = paramPartTokens2[1]; + } + string autoloadMapName = paramPartTokens2[0]; GameSettings *gameSettings = &startupGameSettings; gameSettings->setMap(autoloadMapName); - gameSettings->setTileset("forest"); + gameSettings->setTileset(tileset); gameSettings->setTech("megapack"); gameSettings->setDefaultUnits(false); gameSettings->setDefaultResources(false); diff --git a/source/shared_lib/include/platform/sdl/platform_main.h b/source/shared_lib/include/platform/sdl/platform_main.h index 70a3eda0..9fb65886 100644 --- a/source/shared_lib/include/platform/sdl/platform_main.h +++ b/source/shared_lib/include/platform/sdl/platform_main.h @@ -251,7 +251,7 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) { printf("\n%s=x\t\t\tAuto load a mod by mod pathname.",GAME_ARGS[GAME_ARG_MOD]); // "================================================================================" - printf("\n%s=x\t\t\tAuto Preview a map by map name.",GAME_ARGS[GAME_ARG_PREVIEW_MAP]); + printf("\n%s=Map,Tileset\tAuto Preview a map by map name. (tileset is optional)",GAME_ARGS[GAME_ARG_PREVIEW_MAP]); printf("\n%s\t\t\tdisplays the version string of this program.",GAME_ARGS[GAME_ARG_VERSION]); printf("\n%s\t\t\tdisplays your video driver's OpenGL info.",GAME_ARGS[GAME_ARG_OPENGL_INFO]); printf("\n%s\t\t\tdisplays your SDL version information.",GAME_ARGS[GAME_ARG_SDL_INFO]);