mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-07 22:56:30 -10:00
Ship's implicit move operations compiled but were semantically broken in two ways: moving copied the subsys_list sentinel's links verbatim, leaving the bookend nodes of the intrusive subsystem list pointing at the old sentinel address; and the raw owning warpin_effect / warpout_effect pointers were copied without nulling the source, so a vacated Ships[] slot aliased live WarpEffects that ship::clear() (on slot reuse) or ship_close() (which walks every slot) would delete out from under the destination ship. Fix both at the member level so the compiler-generated moves are correct by composition: - Add ship_subsys_sentinel, derived from ship_subsys, whose move operations re-link the bookend nodes (handling the null-linked, self-referential-empty, and populated source states) and leave the moved-from sentinel as an initialized empty list. Copying is deleted. Public inheritance keeps &ship::subsys_list convertible to ship_subsys*, so list_init, GET_FIRST, and every other call site is unchanged. - Convert warpin_effect and warpout_effect to std::unique_ptr. The delete-and-null blocks in ship::clear(), ship_close(), and ship_set_warp_effects() collapse into reset(); call sites that borrow the pointer into a raw local now use get(). With the members handling themselves, declare ship's special member functions: defaulted default constructor and moves, deleted copies (previously implicit via the unique_ptr members, now stated intent). The moves are deliberately not declared noexcept because members like SCP_map and std::deque do not have standard-guaranteed nothrow moves; the computed exception specification is used instead. Co-Authored-By: Claude Fable 5 <[email protected]>