Skip to content

Refactor blackmarket vehicles#858

Open
jwoodruff40 wants to merge 5 commits intoAntistasi-Ultimate-Community:unstablefrom
jwoodruff40:refactor-blackmarket-vehicles
Open

Refactor blackmarket vehicles#858
jwoodruff40 wants to merge 5 commits intoAntistasi-Ultimate-Community:unstablefrom
jwoodruff40:refactor-blackmarket-vehicles

Conversation

@jwoodruff40
Copy link
Copy Markdown

What type of PR is this?

  • Bug
  • Change
  • Feature
  • Miscellaneous
Sub-categories:
  • Template
  • Map
  • Config
  • Function
  • Localization

What have you changed, and why?

Information:

Refactors code around populating black market vehicles from config and populating vehicle black market UI for significant speed improvements and easier code readability.

Notable changes:

  • A3U_blackMarketStock is now a hashmap of hashmaps for each vehicle type instead of a giant array
  • Vehicle black market tabs are now populated the first time they're loaded instead of all tabs populating on load of the main dialog, and cached for the duration of time spent in the UI
  • Tabs switch on LB selection for the vehicle type dropdown instead of needing to click the select button
  • players can interact with (re: scroll through / purchase vehicles from) the UI even while still populating the UI without breaking anything
  • some excess control cleanup
  • a lot of excess / nested loop cleanup

In general, the code for blackmarket is still a convoluted mess though. Probably needs a full replacement at some point.

Potential TO-DO:

  • Add search bar

Basic Perf Data:

// unstable
diag_codePerformance [A3U_fnc_grabBlackMarketVehicles, 0, 1000, true] // ! [9.07187,1000]
diag_codePerformance [SCRT_fnc_ui_populateBlackMarket, ["all"], 1000, true] // ! [30.7359,1000]
diag_codePerformance [A3A_fnc_blackMarketDialog, ["onLoad"], 1000] // ! Got tired of waiting after 10min

// this PR
diag_codePerformance [A3U_fnc_grabBlackMarketVehicles, 0, 1000, true] // ! [6.76934,1000]
diag_codePerformance [SCRT_fnc_ui_populateBlackMarket, ["all"], 1000, true] // ! [0.0038857,1000]
diag_codePerformance [A3A_fnc_blackMarketDialog, ["onLoad"], 1000] // ! [0.0463963,1000]

How can your changes be tested, or reproduced?

Basically just load a save / black market and see the improvements

  • Ensure vehicle black market still respects game setup parameters (vanilla arms dealer enabled / disabled, DLC content enabled / not enabled)
  • Ensure old double vehicle placement / destruction bug when placing vehicle bought from black market doesn't return

Does this PR include changes not authored by you?

  • No
  • Yes (See below)
Further info:
  • I confirm that I, and by extension this repository, can legally use these third-party changes. (Provide links or author attribution.)

...

Please verify the following (If possible).

* - Mandatory

  • These changes are my own, or I have written permission to use them. *
  • These changes are ready for review, or will be marked as a draft. *
  • I have loaded the mission in LAN host.
  • I have loaded the mission on a dedicated server.

Is further work needed?

  • Needs further testing.
  • Needs further changes.
  • Needs to be converted to a draft.

Please specify which Issue this PR Resolves (If Applicable).

This PR closes #XYZ.


Notes:

...

@jwoodruff40 jwoodruff40 added this to the v11.10.0 milestone Mar 23, 2026
@jwoodruff40 jwoodruff40 added enhancement New feature or request misc A miscellaneous change labels Mar 23, 2026
@wersal454
Copy link
Copy Markdown

Tested it with all CDLC and OPTRE loaded (and enabled) and menu populated preeeeeetty fast, still took some time to display every item available, but no one will be able to scroll THAT fast anyway (unless they are using the scrollbar).

Tried all four variants:

  • enabling the dlc without enabling vanilla - worked (except for Tanks dlc, that's probably just a config error)
  • enabling the cdlc without enabling vanilla - worked (enabling base dlc and cdlc also worked fine, except above)
  • disabling everything including vanilla param - worked, only OPTRE stuff showed up, as it should
  • enabling vanilla param without dlc - worked, OPTRE and Vanilla vehicles showed up (and dlc vehicles, but that is config issue for sure, addressed in 877)

Didn't encounter destruction during placement thing, though both this and loading times should probably be tested on less capable machines then mine.

@wersal454
Copy link
Copy Markdown

Potential TO-DO:

  • Add search bar

On that topic. Search bar similar to parameter one is a nice idea. Also I think it would be neat to have an addon selector first and then display all the available categories for it. Having stuff displayed from every addon loaded at the same time can be... a bit overwhelming.

Selector would fit very nicely in the gear shop ui, there just a place for it right above the list with categories. Not a ton of place for the search bar not to mention additional selector in the vehicle ui though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request misc A miscellaneous change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants