Added Lua function SetMenuRace which set race of cursor in main menu

This commit is contained in:
Pali Rohár 2010-08-13 15:40:25 +02:00
parent 170df2525d
commit 842e9d832e
3 changed files with 15 additions and 1 deletions

View file

@ -227,6 +227,7 @@ extern std::string GameName; /// Name of the game
extern std::string FullGameName; /// Full Name of the game
extern std::string ClickMissile; /// Missile to show when you click
extern std::string DamageMissile; /// Missile to show damage caused
extern std::string MenuRace;
extern int SpeedBuild; /// Speed factor for building
extern int SpeedTrain; /// Speed factor for training

View file

@ -337,6 +337,13 @@ static int CclGetStratagusHomepage(lua_State *l)
return 1;
}
static int CclSetMenuRace(lua_State *l)
{
LuaCheckArgs(l, 1);
MenuRace = LuaToString(l, 1);
return 0;
}
/**
** Get the directory of the current lua file
*/
@ -2449,6 +2456,7 @@ void InitCcl(void)
lua_register(Lua, "LoadBuffer", CclLoadBuffer);
lua_register(Lua, "GetCurrentLuaPath", CclGetCurrentLuaPath);
lua_register(Lua, "SavedGameInfo", CclSavedGameInfo);
lua_register(Lua, "SetMenuRace", CclSetMenuRace);
lua_register(Lua, "GetStratagusVersion", CclGetStratagusVersion);
lua_register(Lua, "GetStratagusHomepage", CclGetStratagusHomepage);

View file

@ -254,6 +254,7 @@ const char NameLine[] =
std::string CliMapName; /// Filename of the map given on the command line
std::string CompileOptions; /// Compile options.
static std::vector<gcn::Container *> Containers;
std::string MenuRace;
/*----------------------------------------------------------------------------
-- Speedups FIXME: Move to some other more logic place
@ -325,7 +326,11 @@ void PreMenuSetup(void)
InitVideoCursors();
LoadCursors(PlayerRaces.Name[0]);
if (MenuRace.empty())
LoadCursors(PlayerRaces.Name[0]);
else
LoadCursors(MenuRace);
InitSettings();
InitUserInterface();