mirror of
https://github.com/glest/glest-source.git
synced 2025-09-30 01:18:58 +02:00
- added new lua function to display playername:
getPlayerName(i)
This commit is contained in:
@@ -176,6 +176,7 @@ void ScriptManager::init(World* world, GameCamera *gameCamera){
|
||||
luaScript.registerFunction(getGameWon, "gameWon");
|
||||
|
||||
luaScript.registerFunction(getSystemMacroValue, "getSystemMacroValue");
|
||||
luaScript.registerFunction(getPlayerName, "getPlayerName");
|
||||
|
||||
luaScript.registerFunction(loadScenario, "loadScenario");
|
||||
|
||||
@@ -1032,6 +1033,12 @@ const string ScriptManager::getSystemMacroValue(const string &key) {
|
||||
return world->getSystemMacroValue(key);
|
||||
}
|
||||
|
||||
const string ScriptManager::getPlayerName(int factionIndex) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
return world->getPlayerName(factionIndex);
|
||||
}
|
||||
|
||||
void ScriptManager::loadScenario(const string &name, bool keepFactions) {
|
||||
//printf("[%s:%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
@@ -1484,6 +1491,12 @@ int ScriptManager::getSystemMacroValue(LuaHandle* luaHandle) {
|
||||
return luaArguments.getReturnCount();
|
||||
}
|
||||
|
||||
int ScriptManager::getPlayerName(LuaHandle* luaHandle) {
|
||||
LuaArguments luaArguments(luaHandle);
|
||||
luaArguments.returnString(thisScriptManager->getPlayerName(luaArguments.getInt(-1)));
|
||||
return luaArguments.getReturnCount();
|
||||
}
|
||||
|
||||
int ScriptManager::getUnitCount(LuaHandle* luaHandle){
|
||||
LuaArguments luaArguments(luaHandle);
|
||||
luaArguments.returnInt(thisScriptManager->getUnitCount(luaArguments.getInt(-1)));
|
||||
|
Reference in New Issue
Block a user