Skip to content

Conversation

@TreadTheDawnGames
Copy link

Fixed the invalid index exception described in #790.

Pings will now snap to nearest valid item (i.e. asteroid if in space.)
Added a check to ensure ping location is valid.
Only draw pings if its location is logically visible. (If in space you can see the pings on the planet, if on the planet you cannot see pings in orbit.)

@SokyranTheDragon
Copy link
Member

Already handled by #794.

There's also a few issues I see with this PR as well:

First, this PR will always snap to nearest world objects when pinging, which may be undesirable when trying to ping near such an object.

Second, this PR assumes that a planet layer with higher ID will be further away from the planet, which simply is not true - it's just merely the order at which those were loaded by the game. It also doesn't handle situations where a planet layer is not related to the planet. Both can be seen with the mod "Layered Atmosphere and Orbit", where you can see that orbital pings can be seen in layers that are closer to the planet. Likewise, planet pings are visible when switching to the moon (those pings are floating above them moon).

Third, the code checks for the layer right before drawing the ping itself, rather than continuing the loop early (like the rest of the code). This is not something major, but this basically means that we need to calculate the center position of the tile even if we don't draw the ping.

And finally, rather than checking for tile validity by checking if its tile ID is -1, the check should use the Valid property of PlanetTile struct. The game assumes that a valid tile IDs aren't negative, so just checking for -1 is insufficient. Using the built-in property would make the code more future-proof as well, in case there's ever extra tile validity checks added.

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