mirror of
https://github.com/glest/glest-source.git
synced 2025-10-01 01:46:42 +02:00
- added new lua method to get system macro values:
dofile(getSystemMacroValue("$SCENARIO_PATH") .. "unit.ai.class.lua")
This commit is contained in:
@@ -175,6 +175,8 @@ void ScriptManager::init(World* world, GameCamera *gameCamera){
|
||||
|
||||
luaScript.registerFunction(getGameWon, "gameWon");
|
||||
|
||||
luaScript.registerFunction(getSystemMacroValue, "getSystemMacroValue");
|
||||
|
||||
luaScript.registerFunction(loadScenario, "loadScenario");
|
||||
|
||||
//load code
|
||||
@@ -1024,6 +1026,12 @@ int ScriptManager::getUnitCountOfType(int factionIndex, const string &typeName)
|
||||
return world->getUnitCountOfType(factionIndex, typeName);
|
||||
}
|
||||
|
||||
const string ScriptManager::getSystemMacroValue(const string &key) {
|
||||
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->getSystemMacroValue(key);
|
||||
}
|
||||
|
||||
void ScriptManager::loadScenario(const string &name, bool keepFactions) {
|
||||
//printf("[%s:%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
@@ -1470,6 +1478,12 @@ int ScriptManager::getLastAttackingUnitId(LuaHandle* luaHandle) {
|
||||
return luaArguments.getReturnCount();
|
||||
}
|
||||
|
||||
int ScriptManager::getSystemMacroValue(LuaHandle* luaHandle) {
|
||||
LuaArguments luaArguments(luaHandle);
|
||||
luaArguments.returnString(thisScriptManager->getSystemMacroValue(luaArguments.getString(-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