Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use original vessel index as ID in bounty console #3043

Conversation

arimah
Copy link
Contributor

@arimah arimah commented Mar 7, 2025

About the PR

In the bounty console, use the original vessel index as the dropdown item ID, not the new index.

Why / Balance

Just two lines above where the vessels are added, we sometimes skip items:

if (string.IsNullOrWhiteSpace(_vessels[i]))
    continue;

VesselSelector.AddItem(_vessels[i], listIndex);
listIndex++;

Unfortunately, later on in GetVessel, we use the item ID as an index into _vessels:

var id = VesselSelector.SelectedId;
if (id < _vessels.Count)
    vessel = _vessels[id];

If an item has indeed been skipped, the ID will point to the wrong index in _vessels! The simplest solution of all is to skip the listIndex dance and just use the original index, which allows us to get back to the right value in _vessels with no hassle of any kind. Easy peasy.

It appears index 1 is often something with an empty name. Unsure if this is a new bug or not, but it was recently discovered at any rate.

How to test

  1. Create bounties with many different vessels.
  2. Ensure the vessel is always corect.

Media

N/A

Requirements

Breaking changes

No.

Changelog
🆑

  • fix: The Bounty Contracts PDA app should now choose the right vessel when you create a bounty.

Copy link
Contributor

@whatston3 whatston3 left a comment

Choose a reason for hiding this comment

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

Works.

The entity with the empty string is for the sector's records. That's what gets used in the criminal records computer.

@dvir001 dvir001 merged commit f1b0401 into new-frontiers-14:master Mar 7, 2025
14 checks passed
FrontierATC added a commit that referenced this pull request Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants