mirror of
https://github.com/glest/glest-source.git
synced 2025-10-04 03:11:53 +02:00
- applied patch from MuwuM
This commit is contained in:
@@ -309,6 +309,7 @@ void ScriptManager::init(World* world, GameCamera *gameCamera, const XmlNode *ro
|
||||
luaScript.registerFunction(setUnitPosition, "setUnitPosition");
|
||||
|
||||
luaScript.registerFunction(getUnitFaction, "unitFaction");
|
||||
luaScript.registerFunction(getUnitName, "unitName");
|
||||
luaScript.registerFunction(getResourceAmount, "resourceAmount");
|
||||
|
||||
luaScript.registerFunction(getLastCreatedUnitName, "lastCreatedUnitName");
|
||||
@@ -1258,6 +1259,11 @@ int ScriptManager::getUnitFaction(int unitId) {
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
return world->getUnitFactionIndex(unitId);
|
||||
}
|
||||
const string ScriptManager::getUnitName(int unitId) {
|
||||
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->getUnitName(unitId);
|
||||
}
|
||||
|
||||
int ScriptManager::getResourceAmount(const string &resourceName, int factionIndex) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
@@ -1781,6 +1787,12 @@ int ScriptManager::getUnitFaction(LuaHandle* luaHandle){
|
||||
luaArguments.returnInt(factionIndex);
|
||||
return luaArguments.getReturnCount();
|
||||
}
|
||||
int ScriptManager::getUnitName(LuaHandle* luaHandle){
|
||||
LuaArguments luaArguments(luaHandle);
|
||||
const string unitname = thisScriptManager->getUnitName(luaArguments.getInt(-1));
|
||||
luaArguments.returnString(unitname);
|
||||
return luaArguments.getReturnCount();
|
||||
}
|
||||
|
||||
int ScriptManager::getResourceAmount(LuaHandle* luaHandle){
|
||||
LuaArguments luaArguments(luaHandle);
|
||||
|
Reference in New Issue
Block a user