X Tutup
Skip to content

Fix location recovery#5801

Merged
sturnclaw merged 1 commit intopioneerspacesim:masterfrom
Gliese852:recover-sbody-indexing
Apr 27, 2024
Merged

Fix location recovery#5801
sturnclaw merged 1 commit intopioneerspacesim:masterfrom
Gliese852:recover-sbody-indexing

Conversation

@Gliese852
Copy link
Contributor

@Gliese852 Gliese852 commented Mar 16, 2024

It turned out that the index of the system body in the path does not always coincide with its index in the save file, because when saving there is a separate indexing.

In addition, if there are gravpoints in the system, the numbering of physical bodies and system bodies also differs, what was not taken into account.

(This led to errors when recovering the location.)

Fortunately, the physical body (planet or station) has a reference to the serializable index of the system body (index_for_system_body), and this way the reliable connection can be found.

It turned out that the index of the system body in the path does not
always coincide with its index in the save file, because when saving
there is a separate indexing.

In addition, if there are gravpoints in the system, the numbering of
physical bodies and system bodies also differs, what was not taken into
account.

Fortunately, the physical body (planet or station) has a reference to
the serializable index of the system body (index_for_system_body), and
this way the reliable connection can be found.
Copy link
Member

@sturnclaw sturnclaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending testing. Technically, it's more efficient to calculate systemBodies only after checking for dockedToBody ~= 0, but that's not a big deal in my opinion.

@Gliese852
Copy link
Contributor Author

@Web-eWorks in fact, it is also needed in the opposite case, in the implicit else, if the ship is saved in space.

@sturnclaw sturnclaw merged commit 5807c21 into pioneerspacesim:master Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

X Tutup