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

Array Index out of Bounds (Appears related to BA) 0.43.1 #372

Closed
HammerGS opened this issue Apr 4, 2017 · 8 comments
Closed

Array Index out of Bounds (Appears related to BA) 0.43.1 #372

HammerGS opened this issue Apr 4, 2017 · 8 comments

Comments

@HammerGS
Copy link
Member

HammerGS commented Apr 4, 2017

From this post on the forums:

http://bg.battletech.com/forums/index.php?topic=57002.msg1311231#msg1311231

I'm having some trouble in 4.30 and 4.31. Specifically, it appears that for me the old bug about Battle Armour breaking the save file has returned.

I.e. taking BA into mission and recovering it, or salvaging it, and then saving results in a save file that can't be loaded again. According to a search of the bug tracker, this was meant to be resolved years ago.

Does anyone else have a similar experience in 4.3/4.31?

mekhqlog.txt

Stack Trace:

java.lang.ArrayIndexOutOfBoundsException: -2
	at mekhq.campaign.unit.Unit.initializeParts(Unit.java:1823)
	at mekhq.campaign.Campaign.createCampaignFromXMLFileInputStream(Campaign.java:4192)
	at mekhq.gui.dialog.DataLoadingDialog$Task.doInBackground(DataLoadingDialog.java:188)
	at mekhq.gui.dialog.DataLoadingDialog$Task.doInBackground(DataLoadingDialog.java:115)
	at javax.swing.SwingWorker$1.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at javax.swing.SwingWorker.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
@JenniferinaMAD
Copy link

Hello,
The above log file excerpt is from my install. Here is a zip containing the campaign file, all custom units needed to load it and the full log file again.

The save file was created using 4.30, and neither 4.30 nor 4.31 can open it. I have more save files going bak but the most recent one I can still open is the last one I made before purchasing BA units using the AtB personnel market (which adds BA pilots and a BA unit to the roster with one click).
Campaign-file-customs.zip

@neoancient
Copy link
Member

What's happening here is that some of the equipment does not have its location set properly. Instead of being assigned to a particular trooper, its location is set to none. That much comes from the log file. The campaign file tells me which equipment and which units, but I haven't been able to reproduce it or find any way for it to have been changed to the incorrect value.

I may be grasping at straws here, but knowing more about what led up to this should at least help me focus the investigation.

  1. The offending units are Elemental [AP Gauss], Fenrir [SRM], and Fenrir [ERML]. Is there anything you did differently with these units?
  2. Did you repair or salvage any of these?
  3. Did you resolve the battle directly from MegaMek, or did you save to a mul file and resolve manually?
  4. Did you edit damage to any of the BA during scenario resolution.
  5. Were any of the BA units salvaged from the battle?
  6. Did you perform any refits on BA?

@JenniferinaMAD
Copy link

Hello,

1: Yes, see below (point 6)
2: I repaired various suits, including the elementals but no fenrirs (though i reloaded ammo for some), but most notably I repaired the Gnome [Standard] suits (only squad I'd taken casualties with). You didn't list those as causing trouble, though?
3. I resolved directly from MM every time.
4. I did edit one of the lost Gnome troopers from dead to 5 hits, but I did not edit any suits' damage.
5. No, all of them were purchased through the AtB personnel market.
6. Yes, I refitted the Elementals from Flamers to AP Gauss, one Fenrir suit to SRMs, another to ERMLs, and one to MPLs (but I also purchased other Fenrir squads I did not refit, so I can't say for certain if these are the ones that are causing problems). The MPL squad I know had not seen battle yet, the other two I am unsure if the refitted ones saw battle or whether it was the ones that were purchased already in the SRM or ERML configuration that had seen battle.

@JenniferinaMAD
Copy link

I've played around for a bit with MekHQ 0.4.31

New campaign, AtB, default settings.
Purchase units -> GM Add Fenrir [SL] and Purifier [Laser]
Add funds, hire BA tech, Astechs, BA pilots
Create empty mission, add empty scenario, deploy BA, start scenario, Add Bot (no units), start
use /victory to end mission
Recover BA
Save campaign
Load campaign (works)
Begin refit Fenrir-> [ERML] config
GM-> acquire parts
wait for parts to ship, work to complete
save campaign
load campaign (failure)
Load previous working save
begin refit Purifier -> [NARC] config
GM->acquire parts
wait for parts, wait to complete
save campaign
load campaign (failure)

It appears I can reliably reproduce the issue by refitting BA units?

@Dylan-M
Copy link
Contributor

Dylan-M commented Apr 6, 2017

I sure hope you're not using 0.4.31... there never was such a MekHQ version. I'm guessing you mean 0.40.31?

Anyway, BA have never been fully implemented in MekHQ. It's a work in progress, but expect them not to work correctly and to cause issues like this. I realize I've been telling people this for the past 3 or 4 years, but it's still true. We're working on it, but we advise against using BA outside of just playing around; as they're not in a suitable state for most ongoing campaigns.

At any rate, the bugs are definitely being looked at and worked on by the team. If you search around on both the GH tracker and the old SF tracker, you'll likely find a couple other bugs about them.

@pheonixstorm
Copy link
Collaborator

Best advice if you want to keep using them anyway. Don't salvage them, don't repair them. Manually add, remove, and deduct the cost for the repairs. This should keep you from having another error like this and will also allow for a smoother usage of BA.

@neoancient
Copy link
Member

I haven't been able to create any problems, nor have I seen any problems from repairing or salvaging. It is apparent that this is a bug caused by refits, which I will take a look at. If people don't attempt to use BA normally and report problems it's unlikely that we'll ever get them working properly. So as @Dylan-M said, don't depend on them and use them at your own risk, but please test them and report problems.

@neoancient
Copy link
Member

Since it's pretty obvious that it's caused by refits, I'm going to close this one as a duplicate of #317 and work through the refit code to find the cause. Here is a fixed campaign file.
Starfire Spectres30720421.zip

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

No branches or pull requests

5 participants