Embedding it in d_level_shared_robot_info_state is reasonable from a
relational perspective, but interferes with referencing
d_robot_info_array when only a forward declaration of
d_level_shared_robot_info_state is available.
Iterating over it returns each side number in turn. This allows
converting many loops of the form:
```
for (int i = 0; i < MAX_SIDES_PER_SEGMENT; ++i)
```
to the compact form:
```
for (const auto i : MAX_SIDES_PER_SEGMENT)
```
The compact form brings the usual benefit of range-based for: delegating
iteration to the compiler prevents the loop body from skipping a step,
and makes clear in the code that this is the case.
Push the computation up, so that invocations that differ only in the
length of their expression strings will resolve to the same template.
Rework unchecked_partial_range not to take expression strings if they
will not be used.
Define separate enum values for rotation data in both the high bits,
where it is usually kept, and the low bits, where it is sometimes used
for math or comparisons.
Define an enum value to represent the composite of the index and the
rotation, since the composite is not suitable for use as an array
subscript. Add helper functions to extract the component pieces.
User Nemesis reported an unspecified crash, but never responded to
inquiries to provide more data. Users Tourmeister and Buff Skeleton
reported a fatal exception thrown while paging in a vclip, with initial
triggering conditions matching the report from Nemesis. Both
Tourmeister and Buff Skeleton are using v1.0 Descent 2 data. No one
with more recent data has reported a problem.
Add a try { ... } catch { ... } block to trap the partial_range
exception, log it, and then ignore paging in that vclip. This should
approximate what 0.58.1 did, assuming that the crash is due to a
negative `num_frames`. If the crash is due to a large positive
`num_frames`, this change will still prevent the previously reported
crash, but may only move the crash elsewhere. Various other subsystems
react badly to using a vclip that has not been paged in.
This change is tested not to break an otherwise working game. It is not
tested to confirm that it produces a working game for users who
experienced a crash without it.
Reported-by: Tourmeister <https://forum.dxx-rebirth.com/showthread.php?tid=943&pid=12159#pid12159>
Reported-by: Buff Skeleton <https://forum.dxx-rebirth.com/showthread.php?tid=943&pid=12290#pid12290>
References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/371>