static naRef propNodeGhostCreate(naContext c, SGPropertyNode* n)
{
+ if(!n) return naNil();
SGPropertyNode_ptr* ghost = new SGPropertyNode_ptr(n);
return naNewGhost(c, &PropNodeGhostType, ghost);
}
static naRef f_setIntValue(naContext c, naRef args)
{
NODEARG();
- int iv = (int)naNumValue(naVec_get(args, 0)).num;
+ // Original code:
+ // int iv = (int)naNumValue(naVec_get(args, 0)).num;
+
+ // Junk to pacify the gcc-2.95.3 optimizer:
+ naRef tmp0 = naVec_get(args, 0);
+ naRef tmp1 = naNumValue(tmp0);
+ double tmp2 = tmp1.num;
+ int iv = (int)tmp2;
+
(*node)->setIntValue(iv);
return naNil();
}
NODEARG();
naRef child = naVec_get(args, 0);
if(!naIsString(child)) return naNil();
- SGPropertyNode* n = (*node)->getChild(naStr_data(child));
+ naRef idx = naNumValue(naVec_get(args, 1));
+ SGPropertyNode* n;
+ if(naIsNil(idx) || !naIsNum(idx)) {
+ n = (*node)->getChild(naStr_data(child));
+ } else {
+ n = (*node)->getChild(naStr_data(child), (int)idx.num);
+ }
if(!n) return naNil();
return propNodeGhostCreate(c, n);
}
if(!naIsString(name)) return naNil();
vector<SGPropertyNode_ptr> children
= (*node)->getChildren(naStr_data(name));
- for(int i=0; i<children.size(); i++)
+ for(unsigned int i=0; i<children.size(); i++)
naVec_append(result, propNodeGhostCreate(c, children[i]));
}
return result;