Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unit Market Help

First time happening to me. In ATB mode, entering a new month, no errors in the log. When I open the Unit Market, the window failed to display properly. In the error log, I saw this.

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 12
at mekhq.gui.model.UnitMarketTableModel.getValueAt(

Transferred the campaign file to mekhq-0.3.19-windows, repeat the same process. It was working. Saved the working campaign, transferred back to 0.3.21 and it can open normally. What have I done wrong? Btw, I'm using customized RATs for ATB.

Hope someone can help.
Might require a saved game that can reproduce the issue.
I might have migrated my campaign wrongly. Can you roughy tell what's the error about?  My save file is 70+ MB.
I haven't looked at the MekHQ code, but basically what's happening is that there's something wrong with the UnitMarketTableModel.  The model is basically what stores information about the table behind the scene (like how many entries there are, what information is in each entry, etc). 

The complete stack trace may help but likely not.  Looking at the code may make it obvious, but as it is, it's hard for me to tell what the root cause is.
I looked at the source code.  Here's the offending code:

        if(col == COL_WEIGHTCLASS) {
            return UnitTableData.weightNames[o.unitWeight];

weightNames is a String array with 4 entries.  Based on your stack trace, o.unitWeight is 12 for some unit.  unitWeight is a value that just keeps track of the weight class.  It seems like somehow an incorrect value got added.  How or why, I can't say.
Looking at the code deeper, offers are rolled off of RATS.  The UnitMarketTableModel only supports the weight classes of light, medium, heavy and assault (0-3).  When offers are created, the unit's weight class is retrieved from MechSummary.getWeightClass.  This uses the defines from EntityWeightClass, which range from 0-14.  Code in MHQ subtractes 1 from the MechSummary.getWeightClass value for a MarketOffer's weight class.  Based on your stack trace, a value of 12 + 1 = 13 is a medium support vehicle.

It's entirely possible that you rolled a medium support vehicle from a RAT.  I'm not sure how RATs for market offers get picked, but it seems like if you roll support vehicles off of RATs, you'll run into this issue.
Ultimately, this looks like a bug in the AtB code and should be written up as such.
I went thru all the vehicles in my RATs, many of them are considered Medium Support Vehicles including a few MBT (why MBT called support vehicle?). I've seen most of them listed in the Unit Market without problem previously. But there were 3 units with weird weight class as shown in the hanger tab of MHQ.

Cobra VTOL Transport (Standard) - !EntityWeightClass.SV.1!
Silverfin Coastal Cutter (Standard) - !EntityWeightClass.SV.0!
Strike Falcon Attack VTOL (Standard) - !EntityWeightClass.SV.1!

I've seen Cobra in the unit market, not using Silverfin in the market, Strike Falcon.. I don't recall seeing it in the market.. those EntityWeightClass errors shown in the Hanger tab, could it be related?

Anyway, I'll be sending you the XML file.
So I got your campaign files via email.  I was able to recreate the bug.  You had mentioned again that the issue didn't crop up in 3.19, which made me think it was a newly introduced issue.  I looked through the commit log for MekHQ since 3.19, and I found the culprit.  This bug was introduced in [ef5168] (which happened after the 3.19 release).
Alright.  I created a bug report for this here:

I've fixed the bug and added notes.
Thanks a lot.

Forum Jump:

Users browsing this thread: 1 Guest(s)