3.6.4 Inventory Work

I just saw Inventory is deprecated, but why?

Unless there is another way to have this functionality…what if you want an game piece to have multiple load outs of weapons and have the user select the loadouts of ammunition?

This seems very handy.

Can you offer more details? What module is this for–did it have legacy custom code? There is nothing in the 3.6.4 release notes about newly-deprecated features.

Perhaps an unintended side effect of:

  • 11041: Inventory windows respond to hide-if-property-true


In the code it’s marked to be removed as of 2021-04-03, which just means they are getting ready to delete it. It’s still there, but it also means it is no longer an priority to be worked on, which also means, it’s buggy. For me adding it to my module, it didn’t pickup any of the game pieces. It’s suppose to find all game pieces in the module and sort them and allow you view their properties.
I may just have to fix it.

So you are correct we can delete this thread, it’s not deprecated, but its still buggy, I’m looking into it.

What specifically are you referring to that’s marked as deprecated? The Inventory class is not deprecated. I’d like to know what you’re looking at.

You are correct I can’t read, just a few of the lines are deprecated to recommend how to code it in the future. My bad, was looking at line 69 in Inventory about the launch button.

1 Like

Ah, I see. That launch button isn’t even gone, it’s just in the superclass now.

1 Like

So I’m tinkering in Inventory because when I lay an game piece down and click the inventory button I get an empty window.

It would seem the code is not capturing all the game pieces to process - I’ve tried also adding break points in IntelliJ and tried debugging Inventory, however the break points never get hit, gotta find where Inventory is invoked.

buildTreeModel() is the method that does most of the work of deciding what to put in the inventory tree. It is invoked from refresh() which is called when you click the refresh button (but also at the very beginning from the initTree method, etc)

Thanks, for me none of those methods get called, neither do breakpoints in those methods.

If you’re running from a built version under the debugger (are you using IntelliJ? Eclipse? Something else?) and you’re getting any inventory window at all but no breakpoints firing in Inventory.java, it sounds to me like something might be off/wrong with your debugging setup? Are there other places you’re able to get breakpoints to fire?

One common debug mishap is if you’re starting the “Module Manager” in the debugger, and then from there you “Open” the module you want to run in the Player. That ends up creating a different process that won’t be attached to your debugger and so you won’t get breakpoints for anything that goes on in THAT window. To properly debug a play session you need to have the debugger start the Player itself directly, with command line info of what module you want to start.

Here is a screenshot of my IntelliJ setup for debugging a run of a module

(Obviously if you already have things set up that way, we can drill down further - but then I’d need to know more about where you CAN set breakpoints successfully)

Sorry yeah, Running IntelliJ on Linux, Still learning the Vassal architecture, When ModuleManager Launches I get breakpoints to work just fine, so IntelliJ seems to be functioning correctly. I can add the Inventory button to the menu just fine, however, after a game piece is added and I click Inventory, empty window, with and without Game Piece clicked on. Refresh seems to not call refresh in Inventory, It seems like there is another Inventory class somewhere.
Thank you

You can’t debug anything but the ModuleManager window by launching ModuleManager.

So you’ll need to launch a "standalone"Player session (VASSAL.launch.Player – see my configuration screen per above – you’ll obviously just replace my big long path with a path to your VMOD module file) with a program argument to load your module. THEN you’ll be able to set & receive breakpoints in Vassal Player elements (such as Inventory).

1 Like

Alright so i created a new extension with a new map. Seems in order to debug from beginning to end, one must create the map in the extension to be debugged.