Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug 511 - Ammo Reload Bug
#1
I have been tracking this down for a few days now and have figured the following out. Up until r1673 reloads worked fine (right after the 0.3.3 release). r1674 though introduced a new megamek.jar that broke the ability to save and reload with whatever ammo reloads you had left. As we all know while HQ is running there are no problems, it is not until you save and reload that it shows up.  If you look in the saved campaign file under any of the ammo bins it will show as being full even if they weren't.

Now on to megamek. Finding which revision of megamek had the bug was a bit tricky as AWT was removed part way through. Once I got both in sync though I was able to determine that it was r9981 that broke HQ. This is about where someone else needs to take over as I do not really understand a lot of the back and forth code. I do know however that Mount.java seems to be the common factor in this. So, can someone PLEASE get a fix for this soon. I know it is driving a lot of people batty. Pretty please?????

BTW I am not on my main comp and don't remember my sf.net password or would have posted there.
Reply
#2
I'm pretty sure this is all related to http://sourceforge.net/p/megamek/bugs/4162/ which as far as I know has been fixed. So hopefully bringing in the latest version of MM will fix the issue. While MHQ campaigns aren't mul files, they do save/load the info the same way as far as I know, so this should be what is causing the mess up.

Unless there's a different issue I haven't noticed with ammo in MHQ currently.
Reply
#3
#4162 only applies with loading MUL files in MM.  I don't think that's what phoenix is talking about.  It's not clear to me what the problem is.  Steps to reproduce would be useful. 
Reply
#4
1. Clean campaign, buy mech (I have been testing with 2r archers), get tech team.
2. Edit damage for ammo bin, replace ammo bin.
3. Save (ammo reload should still be listed in repair bay).
4. Close HQ, Re-open and load save.
5. Free ammo as you no longer have to manually reload them.

Problem: When you save the it does not save shotsneeded as being 6

So HQ r1674 using MM r9980 gives
Code:
        <part id="49" type="mekhq.campaign.parts.equipment.AmmoBin">
            <id>49</id>
            <name>LRM 20 Ammo Bin</name>
            <unitTonnage>70</unitTonnage>
            <hits>0</hits>
            <difficulty>0</difficulty>
            <time>0</time>
            <timeSpent>0</timeSpent>
            <mode>0</mode>
            <skillMin>1</skillMin>
            <unitId>b505d1e3-992a-42dc-a5d9-b1a0dbea8d51</unitId>
            <salvaging>false</salvaging>
            <workingOvertime>false</workingOvertime>
            <shorthandedMod>0</shorthandedMod>
            <refitId>null</refitId>
            <daysToArrival>0</daysToArrival>
            <brandNew>false</brandNew>
            <quantity>1</quantity>
            <daysToWait>0</daysToWait>
            <replacementId>-1</replacementId>
            <quality>3</quality>
            <equipmentNum>5</equipmentNum>
            <typeName>IS Ammo LRM-20</typeName>
            <munition>0</munition>
            <shotsNeeded>6</shotsNeeded>
            <checkedToday>false</checkedToday>
            <oneShot>false</oneShot>
        </part>

HQ r1674 using MM r9981 would give you
Code:
        <part id="49" type="mekhq.campaign.parts.equipment.AmmoBin">
            <id>49</id>
            <name>LRM 20 Ammo Bin</name>
            <unitTonnage>70</unitTonnage>
            <hits>0</hits>
            <difficulty>0</difficulty>
            <time>0</time>
            <timeSpent>0</timeSpent>
            <mode>0</mode>
            <skillMin>1</skillMin>
            <unitId>b505d1e3-992a-42dc-a5d9-b1a0dbea8d51</unitId>
            <salvaging>false</salvaging>
            <workingOvertime>false</workingOvertime>
            <shorthandedMod>0</shorthandedMod>
            <refitId>null</refitId>
            <daysToArrival>0</daysToArrival>
            <brandNew>false</brandNew>
            <quantity>1</quantity>
            <daysToWait>0</daysToWait>
            <replacementId>-1</replacementId>
            <quality>3</quality>
            <equipmentNum>5</equipmentNum>
            <typeName>IS Ammo LRM-20</typeName>
            <munition>0</munition>
            <shotsNeeded>0</shotsNeeded>
            <checkedToday>false</checkedToday>
            <oneShot>false</oneShot>
        </part>

The working code shows 6 shots are needed while the broken code says 0

So not sure what else to say. I know Ammobin.java deals with this and the class calls EquipmentType and AmmoType from megamek but I had no clue how it passes the data back and forth as I can't track down the actual data points. I see lots of function { return shots; } that take me in circles.
Reply
#5
(07-01-2014, 08:39 PM)Arlith link Wrote:#4162 only applies with loading MUL files in MM.  I don't think that's what phoenix is talking about.  It's not clear to me what the problem is.  Steps to reproduce would be useful.

Ammo for all vehicles [with more than one ammo type] is/was screwed up in MHQ because of that issue. I'm assuming it should be fixed with that change.

But this is apparently a different issue I wasn't aware of.
Reply
#6
(07-02-2014, 08:50 AM)Jayof9s link Wrote:[quote author=Arlith link=topic=1698.msg10907#msg10907 date=1404261565]
#4162 only applies with loading MUL files in MM.  I don't think that's what phoenix is talking about.  It's not clear to me what the problem is.  Steps to reproduce would be useful.

Ammo for all vehicles [with more than one ammo type] is/was screwed up in MHQ because of that issue. I'm assuming it should be fixed with that change.

But this is apparently a different issue I wasn't aware of.
[/quote]

This issue is probably stll related. Simply because the same parser that is used for MULs is used for MHQ's campaign files.
Reply
#7
I'm not so sure it has to do with the MUL parser.  At the very least, what phoenix was saying doesn't have anything to do with the MUL parser, or the parts of the MUL parser related to #4162.  If he's right on the commit that caused the issue, that's also well before the MUL parser changes. 
Reply
#8
As I said, this wasn't an issue I was aware of, so I agree this may not be related since the MUL issue was mostly affecting tanks.

That said, have you seen this issue occur with a unit coming off the field?

I'm wondering if the example you gave with a new Archer, that was fully loaded, takes damage to just the ammo bin (impossible in MM but possible via GM-> Edit Damage and also in 0.3.4 when all ammo bins were being destroyed). So when you repair the bin and then save/exit/reload and it is full again, I'm thinking this is because the mech entry in the campaign file was still listing full ammo. In that case the issue might just be with the Edit->Damage command (and the issue from in 0.3.4 where all ammo bins were getting 'destroyed').

I.e. the unit entry in the campaign file is still showing full ammo for the Archer, so that ends up overriding what is tracked in the part entry for the damaged/replaced (via GM) ammo bin. Which would make sense, when a 'Mech comes back from the field, the ammo bins should be updated to reflect missing ammo (and I'm guessing reloading a campaign has the same code in there).

Edit: If I'm right, the way to fix this would be to add code that updates the entry for the 'Mech (or other unit type) to remove the ammo when an ammo bin is marked as destroyed.
Reply
#9
Yes, this applies to all ammo reloads both full and partial. The example I gave was purely testing but the majority of the complaints are for after battle repairs/reloads that disappear after you reload a campaign. In either case though import from battle or a replaced ammo bin it will call getshotsneeded().

What has me a bit stumped is how HQ knows how many shots a unit needs after a battle or a bin replacement but doesn't know how many it needs to write to the campaign file.
Reply
#10
Regardless, it should be an easy fix. I know I'll be doing a lot with MHQ soon. I had hoped to do it today and get a release out that includes the stable MM, but meh.
Reply
#11
Good to know, take your time though if not done with the move or other RL issues. Maybe it will give me a chance to fix and upload a patch for a few bugs (HA that would be the day).
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Cannot reload ammo cementblade 0 719 06-12-2012, 05:36 AM
Last Post: cementblade
  Reload Ammo problem Alemnyr 3 1,307 12-16-2011, 11:26 AM
Last Post: Taharqa

Forum Jump:


Users browsing this thread: 1 Guest(s)