From: <bee...@us...> - 2011-02-24 19:13:26
|
Revision: 8164 http://megamek.svn.sourceforge.net/megamek/?rev=8164&view=rev Author: beerockxs Date: 2011-02-24 19:13:19 +0000 (Thu, 24 Feb 2011) Log Message: ----------- + Bug 3177368: one-shot ammo counting for tank slots Modified Paths: -------------- trunk/megamek/docs/history.txt trunk/megamek/src/megamek/common/Tank.java trunk/megamek/src/megamek/common/loaders/BLKFile.java Modified: trunk/megamek/docs/history.txt =================================================================== --- trunk/megamek/docs/history.txt 2011-02-24 18:39:03 UTC (rev 8163) +++ trunk/megamek/docs/history.txt 2011-02-24 19:13:19 UTC (rev 8164) @@ -62,6 +62,7 @@ + VTOL Jet Boosters + Bug 3177375: Dual turret tank armor type bug + Bug 3176934: fire/smoke + changing wind null pointer exceptions ++ Bug 3177368: one-shot ammo counting for tank slots v0.35.21 (2011-01-06, 21:45 UTC+1) + Added more LRT/SRT look up names following another LRM/SRM naming convention. Modified: trunk/megamek/src/megamek/common/Tank.java =================================================================== --- trunk/megamek/src/megamek/common/Tank.java 2011-02-24 18:39:03 UTC (rev 8163) +++ trunk/megamek/src/megamek/common/Tank.java 2011-02-24 19:13:19 UTC (rev 8164) @@ -2316,7 +2316,9 @@ int availableSlots = getTotalSlots(); int usedSlots = 0; for (Mounted mount : this.getEquipment()) { - usedSlots += mount.getType().getTankslots(this); + if (!(mount.getType() instanceof AmmoType)) { + usedSlots += mount.getType().getTankslots(this); + } } // JJs take just 1 slot if (this.getJumpMP(false) > 0) { @@ -2349,6 +2351,10 @@ // submunition type Map<String, Boolean> foundAmmo = new HashMap<String, Boolean>(); for (Mounted ammo : getAmmo()) { + // don't count oneshot ammo + if ((ammo.getLocation() == Entity.LOC_NONE) && (ammo.getShotsLeft() == 1)) { + continue; + } AmmoType at = (AmmoType) ammo.getType(); if (foundAmmo.get(at.getAmmoType() + ":" + at.getRackSize()) == null) { usedSlots++; Modified: trunk/megamek/src/megamek/common/loaders/BLKFile.java =================================================================== --- trunk/megamek/src/megamek/common/loaders/BLKFile.java 2011-02-24 18:39:03 UTC (rev 8163) +++ trunk/megamek/src/megamek/common/loaders/BLKFile.java 2011-02-24 19:13:19 UTC (rev 8164) @@ -256,7 +256,6 @@ blk.writeBlockData("UnitType", "Aero"); } - blk.writeBlockData("blockversion", 1); blk.writeBlockData("Name", t.getChassis()); blk.writeBlockData("Model", t.getModel()); blk.writeBlockData("year", t.getYear()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |