The function should be (I think) checking the dependencies of the given hit point, but instead it checks the dependencies of every other hit point.
For example:
"hithull" on vehicles is most of the time dependent on "Total". Total being the value returned by damage _vehicle. So you would expect that if you run the following code that "hithull" will get set to the maximum value of "Total" and the new "hithull":
[_vehicle, "hithull", _damage, true] call BIS_fnc_setHitPointDamage;
What happens instead is that every other part with dependencies gets set to the max of their damage and their dependencies. On the RHS MI24P the only two hit points with dependencies are the engine and the hull. When using the above function call on that vehicle, the engine gets set but not the hull. But if you replace the "hithull" with "hitengine", the hull hit point will get set.