MegaMek / mekhq

MekHQ is a java helper program for the MegaMek game that allows users to load a list of entities from an XML file, perform repairs and customizations, and then save the new entities to another XML file that can be loaded into MegaMek.
http://megamek.org
134 stars 173 forks source link

Unable to load atb campaign due to heat sinks? #1193

Closed MarcJC closed 5 years ago

MarcJC commented 5 years ago

loaderror.zip

Playing HQ ATB 45.4 and after finishing a mission I saved before starting the second mission.
When opening the second mission all mech icons were missing, although bot vehicles still showed.
Closed out MegaMek and reloaded but no change.

Tried rebooting my laptop to see if that would fix the issue but was unable to load the most recent or even a day or two back in the campaign.

Attached Log files saves, last autosave, and customs in zip for debugging.

Looking at the log file on loading I see this

mod_weapons failed for Starfire SF-1X (Prototype) - Invalid quirk! java.lang.ClassCastException: mekhq.campaign.parts.equipment.HeatSink cannot be cast to mekhq.campaign.parts.Armor at mekhq.campaign.io.CampaignXmlParser.parse(CampaignXmlParser.java:590) at mekhq.campaign.CampaignFactory.createCampaign(CampaignFactory.java:88) at mekhq.gui.dialog.DataLoadingDialog$Task.doInBackground(DataLoadingDialog.java:210) at mekhq.gui.dialog.DataLoadingDialog$Task.doInBackground(DataLoadingDialog.java:129) 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)

I am not using a starfire at all and I have no idea why it's heat sinks would cause any type of error.

Any help in recovering my saves would be much appreciated.

sixlettervariables commented 5 years ago

This is related to a refit actually, the message above that is a red herring. It appears the armor allocated for a refit somehow got mixed up with a heat sink? Not sure why. I'm going to look into restoring your CPNX.

sixlettervariables commented 5 years ago

I've added new logging and it looks like two refits are the issue:

21:33:17,604 ERROR [mekhq.campaign.io.CampaignXmlParser] {SwingWorker-pool-1-thread-1} 
[Campain Load] Refit for unit Bombardier BMB-10D #2 (0d672614-6c6f-46b2-80cb-2dfcd11e7b03) references armor supplies that are incorrect; ignoring.

21:33:17,609 ERROR [mekhq.campaign.io.CampaignXmlParser] {SwingWorker-pool-1-thread-1} 
[Campain Load] Refit for unit Centurion CN9-AL (ef420008-fb1e-4c0a-9a5b-d5d4bd125589) references armor supplies that are incorrect; ignoring.
MarcJC commented 5 years ago

That new logging looks helpful I hope it goes into the build soon.

Is there a tool that will quickly delete those two mechs from the save file?
Or do I need to try mucking with things manually?

sixlettervariables commented 5 years ago

Ok, so for the Bombardier it's armor was listed as part ID 46005. The Centurion's was listed as 46015.

Bizarrely enough the Centurion's new heat sink is listed as ID 46005, and your Blackjack's new head is listed as ID 46015.

MarcJC commented 5 years ago

Also I was able to find a previous save that worked would you want that to see if the error is reproduceable?

sixlettervariables commented 5 years ago

There appears to be a bug with refits, perhaps with multiple refits going at once. I'd love to see the older save that works!

MarcJC commented 5 years ago

Ulric's Behemoths30571113.zip

Going back this is the last save I had that works and the oldest one that is broken

sixlettervariables commented 5 years ago

Thanks for those, I'm not sure if I'll find the root of it tonight.

Do you have a save from the day before the 24th?

MarcJC commented 5 years ago

I just appreciate you taking a look at it

Gonna have to talk to the techs about trying to cool a Centurion via a Blackjack head It is a novel approach to say the least

sixlettervariables commented 5 years ago

Looking at it more I noticed a change from the working one to the failed one for the Bombardier:

  1. kitFound becomes true
  2. customJob becomes false
  3. The tech changed.
  4. A quirk was added.

Same for the Centurion, except for (4).

MarcJC commented 5 years ago

Ulric's Behemoths30571210x2.zip

Attached the most current save file that I modified in notepad to try to make a working file.
the x2 file removes all references to the Bombardier's id the x3 file also removes all references to the Centurion's id and the X4 file also removes all references to the Blackjack's id

However none of the files are able to be loaded.
I was hoping the advanced logging you had might give a few hints if you have time to run these files through them.

sixlettervariables commented 5 years ago

I'm tentatively closing this as fixed in #1216. This will land in either 0.45.5 or 0.46.

MarcJC commented 5 years ago

so there is no hope of recovering the save file?

sixlettervariables commented 5 years ago

I'll make an attempt at it today.

MarcJC commented 5 years ago

Thank you Let me know if I can provide any assistance or support

Also the other thread didn't really say what the issue or the fix was, can you let me know just for my knowledge?

sixlettervariables commented 5 years ago

Sure, MekHQ attempts to "consolidate" like parts with like parts when you load a save game. This is what gives you the correct quantities in your warehouse. What I think is happening, is a part that is tagged for a refit is getting consolidated with something else. The next time a load occurs the armor's part ID is no longer being used for a refit, but is now some other piece of equipment (because the ID changed).

The fix tracks those consolidations and attempts to update the ID's when necessary.

SilverSword775 commented 5 years ago

Unable to load a campaign after customizing a Fortress dropship, using refit kit.

4 campaign files, 2 before 2 after 1 custom ship file

campaigns.zip Fortress SilverSword.zip

Thanks!

MarcJC commented 5 years ago

SilverSword I have no idea why you posted this here

Sixletterveriables was there any luck on the file recovery?

sixlettervariables commented 5 years ago

@marcjc he's got the same issue as you do. Going to work on his CPNX too.

I corrected two of the units, have one more to do.

sixlettervariables commented 5 years ago

@MarcJC try this. Ulric's Behemoths30571210-Repaired.cpnx.zip

I had to remove the three units, the units didn't work correctly after my manual attempts to "correct" them.

MarcJC commented 5 years ago

The Repaired file fails to load on my machine

sixlettervariables commented 5 years ago

Can you include the log file?

MarcJC commented 5 years ago

Yeah the log would be helpful.

Looks like the XML has a typo.

Log attached below

mekhqlog.txt

[Fatal Error] :140192:13: XML document structures must start and end within the same entity. mekhq.campaign.io.CampaignXmlParseException: org.xml.sax.SAXParseException; lineNumber: 140192; columnNumber: 13; XML document structures must start and end within the same entity. at mekhq.campaign.io.CampaignXmlParser.parse(CampaignXmlParser.java:157) at mekhq.campaign.CampaignFactory.createCampaign(CampaignFactory.java:88) at mekhq.gui.dialog.DataLoadingDialog$Task.doInBackground(DataLoadingDialog.java:210) at mekhq.gui.dialog.DataLoadingDialog$Task.doInBackground(DataLoadingDialog.java:129) 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) at java.lang.Thread.run(Unknown Source) Caused by: org.xml.sax.SAXParseException; lineNumber: 140192; columnNumber: 13; XML document structures must start and end within the same entity. at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source) at javax.xml.parsers.DocumentBuilder.parse(Unknown Source) at mekhq.campaign.io.CampaignXmlParser.parse(CampaignXmlParser.java:153)

sixlettervariables commented 5 years ago

I redownloaded that CPNX from github and it did not ZIP correctly at all. Crazy.

Ulric's Behemoths30571210-Repaired.zip

Try this one.

MarcJC commented 5 years ago

That file works correctly Thank you so much for all the hard work