Fixed: #912 Arrays not initialized and other minor bugs

This commit is contained in:
kervala 2010-05-18 12:01:37 +02:00
parent 488d2d42a7
commit a37082ba43
12 changed files with 26 additions and 20 deletions

View file

@ -289,11 +289,11 @@ bool CLuaIHM::getUCStringOnStack(CLuaState &ls, sint index, ucstring &dest)
void CLuaIHM::push(CLuaState &ls, const ucstring &value) void CLuaIHM::push(CLuaState &ls, const ucstring &value)
{ {
//H_AUTO(Lua_CLuaIHM_push) //H_AUTO(Lua_CLuaIHM_push)
#if LUABIND_VERSION == 600 #if LUABIND_VERSION > 600
luabind::detail::push(ls.getStatePointer(), value);
#else
luabind::object obj(ls.getStatePointer(), value); luabind::object obj(ls.getStatePointer(), value);
obj.pushvalue(); obj.pushvalue();
#else
luabind::detail::push(ls.getStatePointer(), value);
#endif #endif
} }
@ -649,16 +649,20 @@ void CLuaIHM::luaValueFromReflectedProperty(CLuaState &ls, CReflectable &reflect
break; break;
case CReflectedProperty::UCString: case CReflectedProperty::UCString:
{ {
#if LUABIND_VERSION > 600
luabind::detail::push(ls.getStatePointer(), (reflectedObject.*(property.GetMethod.GetUCString))() );
#else
luabind::object obj(ls.getStatePointer(), (reflectedObject.*(property.GetMethod.GetUCString))() ); luabind::object obj(ls.getStatePointer(), (reflectedObject.*(property.GetMethod.GetUCString))() );
#if LUABIND_VERSION == 600
obj.pushvalue(); obj.pushvalue();
#endif #endif
} }
break; break;
case CReflectedProperty::RGBA: case CReflectedProperty::RGBA:
{ {
#if LUABIND_VERSION > 600
luabind::detail::push(ls.getStatePointer(), (reflectedObject.*(property.GetMethod.GetRGBA))() );
#else
luabind::object obj(ls.getStatePointer(), (reflectedObject.*(property.GetMethod.GetRGBA))()); luabind::object obj(ls.getStatePointer(), (reflectedObject.*(property.GetMethod.GetRGBA))());
#if LUABIND_VERSION == 600
obj.pushvalue(); obj.pushvalue();
#endif #endif
} }
@ -2670,8 +2674,10 @@ int CLuaIHM::runExprAndPushResult(CLuaState &ls, const std::string &expr)
// push a ucstring? // push a ucstring?
if(mustUseUCString) if(mustUseUCString)
{ {
#if LUABIND_VERSION > 600
luabind::detail::push(ls.getStatePointer(), ucstr);
#else
luabind::object obj(ls.getStatePointer(), ucstr); luabind::object obj(ls.getStatePointer(), ucstr);
#if LUABIND_VERSION == 600
obj.pushvalue(); obj.pushvalue();
#endif #endif
} }
@ -2683,10 +2689,10 @@ int CLuaIHM::runExprAndPushResult(CLuaState &ls, const std::string &expr)
} }
case CInterfaceExprValue::RGBA: case CInterfaceExprValue::RGBA:
{ {
luabind::object obj(ls.getStatePointer(), value.getRGBA());
#if LUABIND_VERSION > 600 #if LUABIND_VERSION > 600
obj.push(ls.getStatePointer()); luabind::detail::push(ls.getStatePointer(), value.getRGBA());
#else #else
luabind::object obj(ls.getStatePointer(), value.getRGBA());
obj.pushvalue(); obj.pushvalue();
#endif #endif
break; break;

View file

@ -1078,7 +1078,7 @@ function r2.activities:initActivityMenu()
activityMenu:addSubMenu(activitiesNb) activityMenu:addSubMenu(activitiesNb)
local zonesMenu = activityMenu:getSubMenu(activitiesNb) local zonesMenu = activityMenu:getSubMenu(activitiesNb)
local zonesTable = r2.Scenario:getAllInstancesByType(zone) local zonesTable = r2.Scenario:getAllInstancesByType(zone)
for key, z in zonesTable do for key, z in pairs(zonesTable) do
uc_activity:fromUtf8(z.Name) uc_activity:fromUtf8(z.Name)
zonesMenu:addLine(uc_activity, "lua", "r2.activities:setActivityType('"..actType.."', '".. z.InstanceId .."')", z.InstanceId) zonesMenu:addLine(uc_activity, "lua", "r2.activities:setActivityType('"..actType.."', '".. z.InstanceId .."')", z.InstanceId)
end end

View file

@ -380,7 +380,7 @@ function r2.events:filterEvents(logicEntityId)
end end
table.insert(allLogicEntities, r2.Scenario) table.insert(allLogicEntities, r2.Scenario)
for k0, entity in allLogicEntities do for k0, entity in pairs(allLogicEntities) do
local behavior = self:getBehavior(entity) local behavior = self:getBehavior(entity)
if not self.memberManagement then -- TEMP if not self.memberManagement then -- TEMP

View file

@ -248,7 +248,7 @@ end
function component.initLogicEntitiesInstancesMenu(this, subMenu, calledFunction) function component.initLogicEntitiesInstancesMenu(this, subMenu, calledFunction)
local entitiesTable = r2.Scenario:getAllInstancesByType(this.Name) local entitiesTable = r2.Scenario:getAllInstancesByType(this.Name)
for key, entity in entitiesTable do for key, entity in pairs(entitiesTable) do
local uc_name = ucstring() local uc_name = ucstring()
uc_name:fromUtf8(entity.Name) uc_name:fromUtf8(entity.Name)
subMenu:addLine(uc_name, "lua", calledFunction.."('".. entity.InstanceId .."')", entity.InstanceId) subMenu:addLine(uc_name, "lua", calledFunction.."('".. entity.InstanceId .."')", entity.InstanceId)

View file

@ -786,7 +786,7 @@ Logic.Components.ChatSequence = {
initLogicEntitiesInstancesMenu = function(this, subMenu, calledFunction) initLogicEntitiesInstancesMenu = function(this, subMenu, calledFunction)
local entitiesTable = r2.Scenario:getAllInstancesByType(this.Name) local entitiesTable = r2.Scenario:getAllInstancesByType(this.Name)
for key, entity in entitiesTable do for key, entity in pairs(entitiesTable) do
local uc_name = ucstring() local uc_name = ucstring()
uc_name:fromUtf8(entity.Name) uc_name:fromUtf8(entity.Name)
subMenu:addLine(uc_name, "lua", calledFunction.."('".. entity.InstanceId .."')", entity.InstanceId) subMenu:addLine(uc_name, "lua", calledFunction.."('".. entity.InstanceId .."')", entity.InstanceId)

View file

@ -298,7 +298,7 @@ end
--function logicEntity.initLogicEntitiesInstancesMenu(this, subMenu, calledFunction) --function logicEntity.initLogicEntitiesInstancesMenu(this, subMenu, calledFunction)
-- --
-- local entitiesTable = r2.Scenario:getAllInstancesByType(this.Name) -- local entitiesTable = r2.Scenario:getAllInstancesByType(this.Name)
-- for key, entity in entitiesTable do -- for key, entity in pairs(entitiesTable) do
-- local uc_name = ucstring() -- local uc_name = ucstring()
-- uc_name:fromUtf8(entity.Name) -- uc_name:fromUtf8(entity.Name)
-- subMenu:addLine(uc_name, "lua", calledFunction.."('".. entity.InstanceId .."')", entity.InstanceId) -- subMenu:addLine(uc_name, "lua", calledFunction.."('".. entity.InstanceId .."')", entity.InstanceId)

View file

@ -83,7 +83,7 @@ function r2.ContextualCommands:update()
end end
-- if one of the command is highlighted, let it highlighted after the toolbar has been rebuilt -- if one of the command is highlighted, let it highlighted after the toolbar has been rebuilt
--local highlightedCommand --local highlightedCommand
--for index, button in self.IndexToButton do --for index, button in pairs(self.IndexToButton) do
-- if button == r2.ToolUI:getActiveToolUI() then -- if button == r2.ToolUI:getActiveToolUI() then
-- debugInfo("highlighted command found") -- debugInfo("highlighted command found")
-- highlightedCommand = self.CurrentCommands[index] -- highlightedCommand = self.CurrentCommands[index]

View file

@ -2193,7 +2193,7 @@ function r2:updateEquipment(instance, init)
comboBox:resetTexts() comboBox:resetTexts()
for k1, v1 in v do for k1, v1 in pairs(v) do
comboBox:addText(ucstring(v1.trad)) comboBox:addText(ucstring(v1.trad))
end end
end end

View file

@ -722,7 +722,7 @@ r2.ActUIDisplayer.LastSelfCreatedActInstanceId = nil -- id of the last act creat
for i = 0, r2:getMaxNumberOfAdditionnalActs() - 1 do for i = 0, r2:getMaxNumberOfAdditionnalActs() - 1 do
local tree = self:getContainer():find(treeName .. tostring(i)) local tree = self:getContainer():find(treeName .. tostring(i))
local used = false local used = false
for index, entry in self:getActTable() do for index, entry in pairs(self:getActTable()) do
local entryTree = entry.Tree local entryTree = entry.Tree
if macroTree==true then entryTree = entry.MacroTree end if macroTree==true then entryTree = entry.MacroTree end
if entryTree == tree then if entryTree == tree then

View file

@ -1889,7 +1889,7 @@ function r2:buildAllPropertySheetsAndForms()
--debugInfo('building forms') --debugInfo('building forms')
if r2.Forms ~= nil then if r2.Forms ~= nil then
for formName, form in r2.Forms do for formName, form in pairs(r2.Forms) do
local mustRebuild = true local mustRebuild = true
if r2FormsCache[formName] ~= nil then if r2FormsCache[formName] ~= nil then
if isEqualIgnoreFunctions(r2FormsCache[formName], form.Prop) then if isEqualIgnoreFunctions(r2FormsCache[formName], form.Prop) then

View file

@ -903,7 +903,7 @@ function r2:openActivityMenu()
-- activityMenu:addSubMenu(6) -- activityMenu:addSubMenu(6)
-- local regionsMenu = activityMenu:getSubMenu(6) -- local regionsMenu = activityMenu:getSubMenu(6)
-- local regionsTable = r2.Scenario:getAllInstancesByType("Region") -- local regionsTable = r2.Scenario:getAllInstancesByType("Region")
-- for key, region in regionsTable do -- for key, region in pairs(regionsTable) do
-- regionsMenu:addLine(ucstring(region.Name), "lua", "r2:setActivity('Deploy', '".. region.InstanceId .."')", region.InstanceId) -- regionsMenu:addLine(ucstring(region.Name), "lua", "r2:setActivity('Deploy', '".. region.InstanceId .."')", region.InstanceId)
-- end -- end
-- if table.getn(regionsTable) == 0 then -- if table.getn(regionsTable) == 0 then