Return a reference to the RecordPtr from operator[] for consistency

RecordListT is supposed to be a list of RecordPtrT objects.
pull/21/head
Chris Robinson 13 years ago
parent 7e8c146de6
commit 645b507ba0

@ -205,8 +205,8 @@ void NiSkinInstance::post(NIFFile *nif)
for(size_t i=0; i<bnum; i++)
{
if(!bones.has(i))
if(bones[i].empty())
nif->fail("Oops: Missing bone! Don't know how to handle this.");
bones[i].makeBone(i, data->bones[i]);
bones[i]->makeBone(i, data->bones[i]);
}
}

@ -151,8 +151,8 @@ struct NiNode : Node
for(size_t i = 0;i < children.length();i++)
{
// Why would a unique list of children contain empty refs?
if(children.has(i))
children[i].parent = this;
if(!children[i].empty())
children[i]->parent = this;
}
}
};

@ -114,11 +114,8 @@ public:
list[i].post(nif);
}
X& operator[](size_t index) const
{ return list.at(index).get(); }
bool has(size_t index) const
{ return !list.at(index).empty(); }
const Ptr& operator[](size_t index) const
{ return list.at(index); }
size_t length() const
{ return list.size(); }

@ -138,9 +138,9 @@ bool ManualBulletShapeLoader::hasRootCollisionNode(Nif::Node* node)
int n = list.length();
for (int i=0; i<n; i++)
{
if (list.has(i))
if (!list[i].empty())
{
if(hasRootCollisionNode(&list[i])) return true;;
if(hasRootCollisionNode(list[i].getPtr())) return true;;
}
}
}
@ -222,9 +222,9 @@ void ManualBulletShapeLoader::handleNode(Nif::Node *node, int flags,
int n = list.length();
for (int i=0; i<n; i++)
{
if (list.has(i))
if (!list[i].empty())
{
handleNode(&list[i], flags,&node->trafo,hasCollisionNode,isCollisionNode,raycastingOnly);
handleNode(list[i].getPtr(), flags,&node->trafo,hasCollisionNode,isCollisionNode,raycastingOnly);
}
}
}
@ -239,8 +239,8 @@ void ManualBulletShapeLoader::handleNode(Nif::Node *node, int flags,
int n = list.length();
for (int i=0; i<n; i++)
{
if (list.has(i))
handleNode(&list[i], flags,&node->trafo, hasCollisionNode,true,raycastingOnly);
if (!list[i].empty())
handleNode(list[i].getPtr(), flags,&node->trafo, hasCollisionNode,true,raycastingOnly);
}
}
}

@ -649,10 +649,9 @@ void NIFLoader::handleNiTriShape(NiTriShape *shape, int flags, BoundsFinder &bou
for (int i=0; i<n; i++)
{
// Entries may be empty
if (!list.has(i)) continue;
Property *pr = &list[i];
if (list[i].empty()) continue;
Property *pr = list[i].getPtr();
if (pr->recType == RC_NiTexturingProperty)
t = static_cast<NiTexturingProperty*>(pr);
else if (pr->recType == RC_NiMaterialProperty)
@ -803,13 +802,13 @@ void NIFLoader::handleNiTriShape(NiTriShape *shape, int flags, BoundsFinder &bou
{
if(mSkel.isNull())
{
std::cout << "No skeleton for :" << shape->skin->bones[boneIndex].name << std::endl;
std::cout << "No skeleton for :" << shape->skin->bones[boneIndex]->name << std::endl;
break;
}
//get the bone from bones array of skindata
if(!mSkel->hasBone(shape->skin->bones[boneIndex].name))
if(!mSkel->hasBone(shape->skin->bones[boneIndex]->name))
std::cout << "We don't have this bone";
bonePtr = mSkel->getBone(shape->skin->bones[boneIndex].name);
bonePtr = mSkel->getBone(shape->skin->bones[boneIndex]->name);
// final_vector = old_vector + old_rotation*new_vector*old_scale
@ -817,7 +816,7 @@ void NIFLoader::handleNiTriShape(NiTriShape *shape, int flags, BoundsFinder &bou
Nif::NiSkinData::BoneInfoCopy boneinfocopy;
boneinfocopy.trafo.rotation = it->trafo.rotation;
boneinfocopy.trafo.trans = it->trafo.trans;
boneinfocopy.bonename = shape->skin->bones[boneIndex].name;
boneinfocopy.bonename = shape->skin->bones[boneIndex]->name;
boneinfocopy.bonehandle = bonePtr->getHandle();
copy.boneinfo.push_back(boneinfocopy);
for (unsigned int i=0; i<it->weights.size(); i++)
@ -1138,9 +1137,8 @@ void NIFLoader::handleNode(Nif::Node *node, int flags,
int n = list.length();
for (int i = 0; i<n; i++)
{
if (list.has(i))
handleNode(&list[i], flags, &node->trafo, bounds, bone, boneSequence);
if (!list[i].empty())
handleNode(list[i].getPtr(), flags, &node->trafo, bounds, bone, boneSequence);
}
}
else if (node->recType == RC_NiTriShape && bNiTri)

Loading…
Cancel
Save