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)
{
//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);
obj.pushvalue();
#else
luabind::detail::push(ls.getStatePointer(), value);
#endif
}
@ -649,16 +649,20 @@ void CLuaIHM::luaValueFromReflectedProperty(CLuaState &ls, CReflectable &reflect
break;
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))() );
#if LUABIND_VERSION == 600
obj.pushvalue();
#endif
}
break;
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))());
#if LUABIND_VERSION == 600
obj.pushvalue();
#endif
}
@ -2670,8 +2674,10 @@ int CLuaIHM::runExprAndPushResult(CLuaState &ls, const std::string &expr)
// push a ucstring?
if(mustUseUCString)
{
luabind::object obj(ls.getStatePointer(), ucstr );
#if LUABIND_VERSION == 600
#if LUABIND_VERSION > 600
luabind::detail::push(ls.getStatePointer(), ucstr);
#else
luabind::object obj(ls.getStatePointer(), ucstr);
obj.pushvalue();
#endif
}
@ -2683,10 +2689,10 @@ int CLuaIHM::runExprAndPushResult(CLuaState &ls, const std::string &expr)
}
case CInterfaceExprValue::RGBA:
{
luabind::object obj(ls.getStatePointer(), value.getRGBA());
#if LUABIND_VERSION > 600
obj.push(ls.getStatePointer());
luabind::detail::push(ls.getStatePointer(), value.getRGBA());
#else
luabind::object obj(ls.getStatePointer(), value.getRGBA());
obj.pushvalue();
#endif
break;

View file

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

View file

@ -502,7 +502,7 @@ end
-- default is to look recursively in the 'son select bar container'
function baseClass.getFirstSelectBarSon(this)
local sons = this:getSelectBarSons()
if not sons then return nil end
if not sons then return nil end
for k, v in specPairs(sons) do
if v:displayInSelectBar() then
return v

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2193,7 +2193,7 @@ function r2:updateEquipment(instance, init)
comboBox:resetTexts()
for k1, v1 in v do
for k1, v1 in pairs(v) do
comboBox:addText(ucstring(v1.trad))
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
local tree = self:getContainer():find(treeName .. tostring(i))
local used = false
for index, entry in self:getActTable() do
for index, entry in pairs(self:getActTable()) do
local entryTree = entry.Tree
if macroTree==true then entryTree = entry.MacroTree end
if entryTree == tree then

View file

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

View file

@ -903,7 +903,7 @@ function r2:openActivityMenu()
-- activityMenu:addSubMenu(6)
-- local regionsMenu = activityMenu:getSubMenu(6)
-- 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)
-- end
-- if table.getn(regionsTable) == 0 then