Page 1 of 2

Feature #1616: Body part record verifier

Posted: 07 Aug 2014, 14:58
by Jiub
Gonna investigate this one.
Can I have any additional info about the feature?
And can I assign on issues by myself?

Re: Feature #1616: Body part record verifier

Posted: 07 Aug 2014, 16:21
by Zini
Can I have any additional info about the feature?
Works like any other record verifier (plenty of examples in the code base). Check that the body part records don't contain nonsense (out of range value, references to things that don't exist, missing mandatory data, missing mandatory records) and report any findings through the provided interface.
And can I assign on issues by myself?
Now you can.

Re: Feature #1616: Body part record verifier

Posted: 12 Aug 2014, 05:14
by Jiub
I'm stuck.

mw_esm.txt states only this:

Code: Select all

20: BODY =  1125 (    75,     92.73,    103)
	Body Parts
	BYDT = Body part data (4 bytes)
		byte Part
			0 = Head
			1 = Hair
			2 = Neck
			3 = Chest
			4 = Groin
			5 = Hand
			6 = Wrist
			7 = Forearm
			8 = Upperarm
			9 = Foot
			10 = Ankle
			11 = Knee
			12 = Upperleg
			13 = Clavicle
			14 = Tail
		byte Vampire
		byte Flags
			1 = Female
			2 = Playable
		byte PartType
			0 = Skin
			1 = Clothing
			2 = Armor
But according to /components/esm/loadbody.cpp there are also:

Code: Select all

mModel = esm.getHNString("MODL");
mRace = esm.getHNOString("FNAM");
My question is do I needed to check any of BYDT fields (for accepted range?) or just check that MODL & FNAM reference to existent objects.

And could you be so kind to point me on where models and races objects are stored in code?

Re: Feature #1616: Body part record verifier

Posted: 12 Aug 2014, 09:09
by Zini
mw_esm.txt states only this:
This is a good source of information about the esx format, but it is neither complete nor fully accurate in all cases. When in doubt, use the code.
My question is do I needed to check any of BYDT fields (for accepted range?
Let's be thorough and check it anyway.
And could you be so kind to point me on where models and races objects are stored in code?
- CSMWorld::Data::getResources (CSMWorld::UniversalId::Type_Meshes)
- CSMWorld::Data::getRaces()

Re: Feature #1616: Body part record verifier

Posted: 16 Aug 2014, 18:55
by Jiub
Got in troubles with
Zini wrote:CSMWorld::Data::getResources (CSMWorld::UniversalId::Type_Meshes)
Since:

Code: Select all

const CSMWorld::Resources& CSMWorld::Data::getResources (const UniversalId& id) const
{
    return mResourcesManager.get (UniversalId::getParentType (id.getType()));
}
I call:

Code: Select all

getResources(CSMWorld::UniversalId( CSMWorld::UniversalId::Type_Mesh ))
getParentType() converts Type_Mesh to Type_Meshes, and in mResourcesManager there is no Type_Meshes, only:

Code: Select all

addResources (Resources ("meshes", UniversalId::Type_Mesh, sMeshTypes));
So, all I left with is "std::logic_error ("Unknown resource type");".

Re: Feature #1616: Body part record verifier

Posted: 17 Aug 2014, 11:20
by Zini
The resources management system in OpenCS is new and hasn't been tested extensively. Possible that it still has bugs. I will look into it.

Re: Feature #1616: Body part record verifier

Posted: 17 Aug 2014, 13:26
by Zini
Fix is in master. Note that you need to use the resource collection type (e.g. Type_Meshes) instead of the type for individual resoruces (e.h. Type_Mesh).

Re: Feature #1616: Body part record verifier

Posted: 27 Aug 2014, 08:24
by Jiub
Done!

Re: Feature #1616: Body part record verifier

Posted: 27 Aug 2014, 09:48
by Zini
Good. Merged.

Are you sufficiently bored with the verifier task that you want to do something else or can I give you another one of these?

Re: Feature #1616: Body part record verifier

Posted: 27 Aug 2014, 14:34
by Jiub
Something else would be better, but I can do this boring stuff again :­)