Match and link CDependencyGroup

Former-commit-id: e2567bfa9c
This commit is contained in:
2023-01-13 23:55:03 -08:00
parent 026b7f0fa6
commit 73cd98d1f8
7 changed files with 76 additions and 30 deletions

View File

@@ -0,0 +1,40 @@
#include "Kyoto/CDependencyGroup.hpp"
#include "Kyoto/CResFactory.hpp"
#include "Kyoto/Streams/CInputStream.hpp"
CDependencyGroup::CDependencyGroup(CInputStream& in) { ReadFromStream(in); }
void CDependencyGroup::ReadFromStream(CInputStream& in) {
int numTags = in.ReadInt32();
x0_objectTags.reserve(numTags);
for (int i = 0; i < numTags; ++i) {
FourCC type = in.ReadInt32();
CAssetId id = in.ReadInt32();
x0_objectTags.push_back(SObjectTag(type, id));
}
}
int CDependencyGroup::GetCountForResType(FourCC type) const {
int ret = 0;
for (rstl::vector< SObjectTag >::const_iterator it = x0_objectTags.begin();
it != x0_objectTags.end(); ++it) {
if (it->type == type) {
++ret;
}
}
return ret;
}
/* this is such a hack... */
#pragma inline_max_size(250)
template <>
CFactoryFnReturn::CFactoryFnReturn(CDependencyGroup* ptr)
: obj(TToken< CDependencyGroup >::GetIObjObjectFor(rstl::auto_ptr< CDependencyGroup >(ptr))
.release()) {}
CFactoryFnReturn FDependencyGroupFactory(const SObjectTag& tag, CInputStream& in,
const CVParamTransfer& xfer) {
return new CDependencyGroup(in);
}