diff --git a/src/content/subgames.cpp b/src/content/subgames.cpp index 14aa9259c..8f18694c4 100644 --- a/src/content/subgames.cpp +++ b/src/content/subgames.cpp @@ -212,14 +212,18 @@ SubgameSpec findSubgame(const std::string &id) if (conf.exists("release")) game_release = conf.getS32("release"); + std::string gameid_alias; + if (conf.exists("gameid_alias")) + gameid_alias = conf.get("gameid_alias"); + std::string menuicon_path; #ifndef SERVER menuicon_path = getImagePath( game_path + DIR_DELIM + "menu" + DIR_DELIM + "icon.png"); #endif - SubgameSpec spec(idv, game_path, gamemod_path, mods_paths, game_title, - menuicon_path, game_author, game_release); + SubgameSpec spec(id, game_path, gamemod_path, mods_paths, game_title, + menuicon_path, game_author, game_release, gameid_alias); if (conf.exists("name") && !conf.exists("title")) spec.deprecation_msgs.push_back("\"name\" setting in game.conf is deprecated, please use \"title\" instead"); diff --git a/src/content/subgames.h b/src/content/subgames.h index d5d168243..1395426ef 100644 --- a/src/content/subgames.h +++ b/src/content/subgames.h @@ -34,6 +34,7 @@ struct SubgameSpec int release; std::string path; std::string gamemods_path; + std::string gameid_alias; /** * Map from virtual path to mods path @@ -49,11 +50,12 @@ struct SubgameSpec const std::unordered_map &addon_mods_paths = {}, const std::string &title = "", const std::string &menuicon_path = "", - const std::string &author = "", int release = 0) : + const std::string &author = "", int release = 0, + const std::string &gameid_alias = "") : id(id), title(title), author(author), release(release), path(path), gamemods_path(gamemods_path), addon_mods_paths(addon_mods_paths), - menuicon_path(menuicon_path) + menuicon_path(menuicon_path), gameid_alias(gameid_alias) { } diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index a5913e807..4906adb76 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -332,6 +332,10 @@ int ModApiMainMenu::l_get_games(lua_State *L) lua_pushstring(L, game.menuicon_path.c_str()); lua_settable(L, top_lvl2); + lua_pushstring(L, "aliases"); + lua_pushstring(L, game.gameid_alias.c_str()); + lua_settable(L, top_lvl2); + lua_pushstring(L, "addon_mods_paths"); lua_newtable(L); int table2 = lua_gettop(L);