Skip to content

Remove redundant m_pos from CJumpNode; add GetRadius() accessor#7431

Open
Goober5000 wants to merge 1 commit intoscp-fs2open:masterfrom
Goober5000:claude/CJumpNode_enhancement
Open

Remove redundant m_pos from CJumpNode; add GetRadius() accessor#7431
Goober5000 wants to merge 1 commit intoscp-fs2open:masterfrom
Goober5000:claude/CJumpNode_enhancement

Conversation

@Goober5000
Copy link
Copy Markdown
Contributor

CJumpNode stored a private m_pos field that duplicated the position already held by its Objects[] entry. The field was set once during construction and never updated afterward, so any subsequent movement (e.g. FRED dragging) would leave m_pos stale while Objects[m_objnum].pos held the authoritative value. Every external caller already used GetSCPObject()->pos instead; GetPosition() had zero call sites.

  • Remove the m_pos field and its initialization in both constructors, the move constructor, and the move-assignment operator.
  • Pass the constructor's position argument directly to obj_create() instead of routing through m_pos.
  • Repoint GetPosition() at Objects[m_objnum].pos so it always returns the live, up-to-date position.
  • Add GetRadius() to expose the cached m_radius, and use it in jumpnode_get_which_in() instead of the redundant model_get_radius() call.

@Goober5000 Goober5000 added the cleanup A modification or rewrite of code to make it more understandable or easier to maintain. label May 7, 2026
@Goober5000 Goober5000 marked this pull request as draft May 7, 2026 06:41
@Goober5000 Goober5000 force-pushed the claude/CJumpNode_enhancement branch from 8bce708 to cf5c3b7 Compare May 7, 2026 06:45
@Goober5000 Goober5000 marked this pull request as ready for review May 7, 2026 06:46
@Goober5000 Goober5000 force-pushed the claude/CJumpNode_enhancement branch from cf5c3b7 to 22d3bff Compare May 7, 2026 19:18
CJumpNode stored a private m_pos field that duplicated the position
already held by its Objects[] entry.  The field was set once during
construction and never updated afterward, so any subsequent movement
(e.g. FRED dragging) would leave m_pos stale while Objects[m_objnum].pos
held the authoritative value.  Every external caller already used
GetSCPObject()->pos instead; GetPosition() had zero call sites.

- Remove the m_pos field and its initialization in both constructors,
  the move constructor, and the move-assignment operator.
- Pass the constructor's position argument directly to obj_create()
  instead of routing through m_pos.
- Repoint GetPosition() at Objects[m_objnum].pos so it always returns
  the live, up-to-date position.
- Add GetRadius() to expose the cached m_radius, and use it in
  jumpnode_get_which_in() instead of the redundant model_get_radius()
  call.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Goober5000 Goober5000 force-pushed the claude/CJumpNode_enhancement branch from 22d3bff to a644d94 Compare May 8, 2026 05:06
Goober5000 added a commit to Goober5000/fs2open.github.com that referenced this pull request May 8, 2026
Jump nodes previously used SCP_list; refactor to use SCP_vector.

Follow-up to scp-fs2open#7431.
Goober5000 added a commit to Goober5000/fs2open.github.com that referenced this pull request May 8, 2026
Jump nodes previously used SCP_list; refactor to use SCP_vector.

Follow-up to scp-fs2open#7431.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup A modification or rewrite of code to make it more understandable or easier to maintain.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant