From 8f855156039442e30a567429c8cd29970b03cbc3 Mon Sep 17 00:00:00 2001 From: "Karl \"Galaxy613\" Nyborg" Date: Wed, 2 Dec 2020 18:26:30 -0500 Subject: [PATCH 001/126] Update README.md We should REALLY specify which version of Java we are targeting, or at least using for development. Luckily the current version of OpenJDK worked for me, but we should still note it somewhere. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 88d92a85..342815dc 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ desired directory. You can then launch the various applications by double clicki `java -jar SSW.jar`. More detailed install instructions can be found in [this repository's wiki](https://github.com/Solaris-Skunk-Werks/solarisskunkwerks/wiki/How-to-download-and-install-the-SSW-apps) ## Building From Source -This project uses the gradle build system and requires gradle to be installed to be able to compile from source. If you +This project uses the gradle build system and requires gradle and a JDK of version 8 or higher to be installed to be able to compile from source. If you intend to develop the project with an IDE, you'll need one with gradle support. Intellij IDEA and Netbeans 11.x have been tested and both have gradle support out of the box. Netbeans earlier than 11.x should work but you may need to install the gradle plugin. From 31df52cb1da893defc56870c91ab1687c013e487 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Wed, 9 Dec 2020 21:08:55 -0600 Subject: [PATCH 002/126] Added Ignores for paths/files added by VSCode --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index a23cba54..8a88304f 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,9 @@ gradle-app.setting */Data/ # End of https://www.gitignore.io/api/gradle,intellij Logs/ + +# VSCode Adds +.classpath +.project +.settings +bin/ From b264c88ee42de216278b1bdebfba6b8595358b53 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Wed, 9 Dec 2020 21:18:43 -0600 Subject: [PATCH 003/126] Type restrict Vectors Long() -> Long.valueOf() Type restrict Hashtable --- .../main/java/ssw/filehandlers/HMPReader.java | 1485 +++++++++-------- 1 file changed, 743 insertions(+), 742 deletions(-) diff --git a/ssw/src/main/java/ssw/filehandlers/HMPReader.java b/ssw/src/main/java/ssw/filehandlers/HMPReader.java index 993cc46a..35199c30 100644 --- a/ssw/src/main/java/ssw/filehandlers/HMPReader.java +++ b/ssw/src/main/java/ssw/filehandlers/HMPReader.java @@ -52,7 +52,7 @@ public class HMPReader { private Hashtable Sphere = new Hashtable(); private Hashtable Clan = new Hashtable(); private Hashtable Unused = new Hashtable(); - private Vector Errors = new Vector(); + private Vector Errors = new Vector(); public HMPReader() { BuildHash(); @@ -122,6 +122,7 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws int EnhanceTechBase = TechBase; int TCTechBase = TechBase; int ArmorTechBase = TechBase; + if ( TechBase == AvailableCode.TECH_BOTH ) { // We've got a total of 7 shorts here. // The first one is the mech's "base" chassis technology type. @@ -576,7 +577,7 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws LocationIndex[] Stealth = null; if( ArmorLookup.equals( "Stealth Armor" ) ) { long test = 0x23; - Vector STLocs = new Vector(); + Vector STLocs = new Vector(); for( int i = 0; i < 8; i++ ) { for( int j = 0; j < 12; j++ ) { // for every instance of Stealth Armor, mark the location @@ -664,7 +665,7 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws // since the only structure that HMP has with more than 1 crit is // Endo-Steel, we'll look for it directly. long test = 0x14; - Vector ISLocs = new Vector(); + Vector ISLocs = new Vector(); for( int i = 0; i < 8; i++ ) { for( int j = 0; j < 12; j++ ) { // for every instance of Endo-Steel, mark the location @@ -698,7 +699,7 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws ArmorNum = 0x23; } if( ArmorNum == 0 ) { throw new Exception( "An armor type with critical spaces was specified but we can't find where to put them.\nLoading aborted." ); } - Vector ARLocs = new Vector(); + Vector ARLocs = new Vector(); for( int i = 0; i < 8; i++ ) { for( int j = 0; j < 12; j++ ) { // for every instance of Endo-Steel, mark the location @@ -718,7 +719,7 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws // on to jump jets if( m.GetJumpJets().GetNumJJ() > 0 ) { long test = 0x0B; - Vector JJLocs = new Vector(); + Vector JJLocs = new Vector(); boolean improved = m.GetJumpJets().IsImproved(); for( int i = 0; i < 8; i++ ) { for( int j = 0; j < 12; j++ ) { @@ -755,7 +756,7 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws } else { test = 0x09; } - Vector HSLocs = new Vector(); + Vector HSLocs = new Vector(); for( int i = 0; i < 8; i++ ) { for( int j = 0; j < 12; j++ ) { if( Criticals[i][j] == test ) { @@ -807,7 +808,7 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws } } else { test = 0x16; // TSM (of either sort, apparently) - Vector TSMLocs = new Vector(); + Vector TSMLocs = new Vector(); for( int i = 0; i < 8; i++ ) { for( int j = 0; j < 12; j++ ) { if( Criticals[i][j] == test ) { @@ -924,7 +925,7 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws // now for equipment. // get the secondary hash table for lookups - Hashtable Other = null; + Hashtable Other = null; if( IntStrucTechBase == AvailableCode.TECH_CLAN ) { Other = Clan; } else { @@ -1181,770 +1182,770 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws } private void BuildHash() { - Unused.put(new Long(0x25), "IS2 Compact Heat Sinks"); + Unused.put(Long.valueOf(0x25), "IS2 Compact Heat Sinks"); // cockpit -// BFB.Common.put(new Long(0x0C), "Life Support"); -// BFB.Common.put(new Long(0x0D), "Sensors"); -// BFB.Common.put(new Long(0x0E), "Cockpit"); +// BFB.Common.put(Long.valueOf(0x0C), "Life Support"); +// BFB.Common.put(Long.valueOf(0x0D), "Sensors"); +// BFB.Common.put(Long.valueOf(0x0E), "Cockpit"); // targeting computers and FCS -// BFB.Common.put(new Long(0x12), "Targeting Computer"); -// BFB.Common.put(new Long(0x18), "Artemis IV"); +// BFB.Common.put(Long.valueOf(0x12), "Targeting Computer"); +// BFB.Common.put(Long.valueOf(0x18), "Artemis IV"); // specialty equipment - Common.put(new Long(0x20), "Supercharger"); - Common.put(new Long(0x27), "Null Signature System"); - Common.put(new Long(0x28), "Coolant Pod"); + Common.put(Long.valueOf(0x20), "Supercharger"); + Common.put(Long.valueOf(0x27), "Null Signature System"); + Common.put(Long.valueOf(0x28), "Coolant Pod"); // industrial equipment - Common.put(new Long(0xF8), "Combine"); - Common.put(new Long(0xF9), "Lift Hoist"); - Common.put(new Long(0xFA), "Chainsaw"); - Common.put(new Long(0x130), "Backhoe"); - Common.put(new Long(0x131), "Drill"); - Common.put(new Long(0x132), "Rock Cutter"); + Common.put(Long.valueOf(0xF8), "Combine"); + Common.put(Long.valueOf(0xF9), "Lift Hoist"); + Common.put(Long.valueOf(0xFA), "Chainsaw"); + Common.put(Long.valueOf(0x130), "Backhoe"); + Common.put(Long.valueOf(0x131), "Drill"); + Common.put(Long.valueOf(0x132), "Rock Cutter"); // physical weapons - Sphere.put(new Long(0x11), "Hatchet"); - Sphere.put(new Long(0x1F), "Sword"); + Sphere.put(Long.valueOf(0x11), "Hatchet"); + Sphere.put(Long.valueOf(0x1F), "Sword"); // generic equipment - Sphere.put(new Long(0x36), "(IS) Laser Anti-Missile System"); - Sphere.put(new Long(0xAF), "(CL) Laser Anti-Missile System"); - Sphere.put(new Long(0x42), "(IS) Anti-Missile System"); - Sphere.put(new Long(0xB4), "(CL) Anti-Missile System"); - Sphere.put(new Long(0x5C), "A-Pod"); - Sphere.put(new Long(0xCA), "A-Pod"); - Sphere.put(new Long(0x64), "Light Active Probe"); - Sphere.put(new Long(0x73), "Beagle Active Probe"); - Sphere.put(new Long(0x74), "Bloodhound Active Probe"); - Sphere.put(new Long(0xCB), "Active Probe"); - Sphere.put(new Long(0x72), "Angel ECM"); - Sphere.put(new Long(0xB3), "Angel ECM"); - Sphere.put(new Long(0x78), "Guardian ECM Suite"); - Sphere.put(new Long(0xCC), "ECM Suite"); - Sphere.put(new Long(0x7A), "TAG"); - Sphere.put(new Long(0xCE), "TAG"); - Sphere.put(new Long(0x65), "Light TAG"); - Sphere.put(new Long(0x75), "C3 Computer (Master)"); - Sphere.put(new Long(0x76), "C3 Computer (Slave)"); - Sphere.put(new Long(0x77), "Improved C3 Computer"); - Clan.put(new Long(0x86), "(IS) Laser Anti-Missile System"); - Clan.put(new Long(0x3B), "(CL) Laser Anti-Missile System"); - Clan.put(new Long(0x92), "(IS) Anti-Missile System"); - Clan.put(new Long(0x40), "(CL) Anti-Missile System"); - Clan.put(new Long(0xAC), "A-Pod"); - Clan.put(new Long(0x56), "A-Pod"); - Clan.put(new Long(0x57), "Active Probe"); - Clan.put(new Long(0xAF), "Light Active Probe"); - Clan.put(new Long(0xC3), "Beagle Active Probe"); - Clan.put(new Long(0xC4), "Bloodhound Active Probe"); - Clan.put(new Long(0xC2), "Angel ECM"); - Clan.put(new Long(0x3F), "Angel ECM"); - Clan.put(new Long(0xC8), "Guardian ECM Suite"); - Clan.put(new Long(0x58), "ECM Suite"); - Clan.put(new Long(0xCA), "TAG"); - Clan.put(new Long(0x5A), "TAG"); - Clan.put(new Long(0xB4), "Light TAG"); - Clan.put(new Long(0xC5), "C3 Computer (Master)"); - Clan.put(new Long(0xC6), "C3 Computer (Slave)"); - Clan.put(new Long(0xC7), "Improved C3 Computer"); + Sphere.put(Long.valueOf(0x36), "(IS) Laser Anti-Missile System"); + Sphere.put(Long.valueOf(0xAF), "(CL) Laser Anti-Missile System"); + Sphere.put(Long.valueOf(0x42), "(IS) Anti-Missile System"); + Sphere.put(Long.valueOf(0xB4), "(CL) Anti-Missile System"); + Sphere.put(Long.valueOf(0x5C), "A-Pod"); + Sphere.put(Long.valueOf(0xCA), "A-Pod"); + Sphere.put(Long.valueOf(0x64), "Light Active Probe"); + Sphere.put(Long.valueOf(0x73), "Beagle Active Probe"); + Sphere.put(Long.valueOf(0x74), "Bloodhound Active Probe"); + Sphere.put(Long.valueOf(0xCB), "Active Probe"); + Sphere.put(Long.valueOf(0x72), "Angel ECM"); + Sphere.put(Long.valueOf(0xB3), "Angel ECM"); + Sphere.put(Long.valueOf(0x78), "Guardian ECM Suite"); + Sphere.put(Long.valueOf(0xCC), "ECM Suite"); + Sphere.put(Long.valueOf(0x7A), "TAG"); + Sphere.put(Long.valueOf(0xCE), "TAG"); + Sphere.put(Long.valueOf(0x65), "Light TAG"); + Sphere.put(Long.valueOf(0x75), "C3 Computer (Master)"); + Sphere.put(Long.valueOf(0x76), "C3 Computer (Slave)"); + Sphere.put(Long.valueOf(0x77), "Improved C3 Computer"); + Clan.put(Long.valueOf(0x86), "(IS) Laser Anti-Missile System"); + Clan.put(Long.valueOf(0x3B), "(CL) Laser Anti-Missile System"); + Clan.put(Long.valueOf(0x92), "(IS) Anti-Missile System"); + Clan.put(Long.valueOf(0x40), "(CL) Anti-Missile System"); + Clan.put(Long.valueOf(0xAC), "A-Pod"); + Clan.put(Long.valueOf(0x56), "A-Pod"); + Clan.put(Long.valueOf(0x57), "Active Probe"); + Clan.put(Long.valueOf(0xAF), "Light Active Probe"); + Clan.put(Long.valueOf(0xC3), "Beagle Active Probe"); + Clan.put(Long.valueOf(0xC4), "Bloodhound Active Probe"); + Clan.put(Long.valueOf(0xC2), "Angel ECM"); + Clan.put(Long.valueOf(0x3F), "Angel ECM"); + Clan.put(Long.valueOf(0xC8), "Guardian ECM Suite"); + Clan.put(Long.valueOf(0x58), "ECM Suite"); + Clan.put(Long.valueOf(0xCA), "TAG"); + Clan.put(Long.valueOf(0x5A), "TAG"); + Clan.put(Long.valueOf(0xB4), "Light TAG"); + Clan.put(Long.valueOf(0xC5), "C3 Computer (Master)"); + Clan.put(Long.valueOf(0xC6), "C3 Computer (Slave)"); + Clan.put(Long.valueOf(0xC7), "Improved C3 Computer"); // Energy Weapons - Unused.put(new Long(0x128), "Clan Plasma Rifle"); - Sphere.put(new Long(0x33), "(IS) ER Large Laser"); - Sphere.put(new Long(0x34), "(IS) ER PPC"); - Sphere.put(new Long(0x35), "(IS) Flamer"); - Sphere.put(new Long(0x37), "(IS) Large Laser"); - Sphere.put(new Long(0x38), "(IS) Medium Laser"); - Sphere.put(new Long(0x39), "(IS) Small Laser"); - Sphere.put(new Long(0x3A), "(IS) PPC"); - Sphere.put(new Long(0x3B), "(IS) Large Pulse Laser"); - Sphere.put(new Long(0x3C), "(IS) Medium Pulse Laser"); - Sphere.put(new Long(0x3D), "(IS) Small Pulse Laser"); - Sphere.put(new Long(0x48), "(IS) Large X-Pulse Laser"); - Sphere.put(new Long(0x49), "(IS) Medium X-Pulse Laser"); - Sphere.put(new Long(0x4A), "(IS) Small X-Pulse Laser"); - Sphere.put(new Long(0x52), "Heavy Flamer"); - //Sphere.put(new Long(0x53), "ISPPCCapacitor"); // HMP uses this code for ERPPC - Sphere.put(new Long(0x58), "(CL) ER Micro Laser"); - //Sphere.put(new Long(0x59), "ISPPCCapacitor"); // HMP uses this code for standard PPC - Sphere.put(new Long(0x5A), "(IS) ER Medium Laser"); - Sphere.put(new Long(0x5B), "(IS) ER Small Laser"); - Sphere.put(new Long(0x85), "Vehicle Flamer"); - Sphere.put(new Long(0xA7), "(CL) ER Large Laser"); - Sphere.put(new Long(0xA8), "(CL) ER Medium Laser"); - Sphere.put(new Long(0xA9), "(CL) ER Small Laser"); - Sphere.put(new Long(0xAA), "(CL) ER PPC"); - Sphere.put(new Long(0xAB), "(CL) Flamer"); - Sphere.put(new Long(0xB0), "(CL) Large Pulse Laser"); - Sphere.put(new Long(0xB1), "(CL) Medium Pulse Laser"); - Sphere.put(new Long(0xB2), "(CL) Small Pulse Laser"); - Sphere.put(new Long(0xF4), "(CL) Heavy Large Laser"); - Sphere.put(new Long(0xF5), "(CL) Heavy Medium Laser"); - Sphere.put(new Long(0xF6), "(CL) Heavy Small Laser"); - Sphere.put(new Long(0xDA), "Vehicle Flamer"); - Clan.put(new Long(0x33), "(CL) ER Large Laser"); - Clan.put(new Long(0x34), "(CL) ER Medium Laser"); - Clan.put(new Long(0x35), "(CL) ER Small Laser"); - Clan.put(new Long(0x36), "(CL) ER PPC"); - Clan.put(new Long(0x37), "(CL) Flamer"); - Clan.put(new Long(0x38), "(CL) ER Large Pulse Laser"); - Clan.put(new Long(0x39), "(CL) ER Medium Pulse Laser"); - Clan.put(new Long(0x3A), "(CL) ER Small Pulse Laser"); - Clan.put(new Long(0x3C), "(CL) Large Pulse Laser"); - Clan.put(new Long(0x3D), "(CL) Medium Pulse Laser"); - Clan.put(new Long(0x3E), "(CL) Small Pulse Laser"); - Clan.put(new Long(0x5B), "(CL) ER Micro Laser"); - Clan.put(new Long(0x66), "Vehicle Flamer"); - Clan.put(new Long(0x80), "(CL) Heavy Large Laser"); - Clan.put(new Long(0x81), "(CL) Heavy Medium Laser"); - Clan.put(new Long(0x82), "(CL) Heavy Small Laser"); - Clan.put(new Long(0x83), "(IS) ER Large Laser"); - Clan.put(new Long(0x84), "(IS) ER PPC"); - Clan.put(new Long(0x85), "(IS) Flamer"); - Clan.put(new Long(0x87), "(IS) Large Laser"); - Clan.put(new Long(0x88), "(IS) Medium Laser"); - Clan.put(new Long(0x89), "(IS) Small Laser"); - Clan.put(new Long(0x8A), "(IS) PPC"); - Clan.put(new Long(0x8B), "(IS) Large Pulse Laser"); - Clan.put(new Long(0x8C), "(IS) Medium Pulse Laser"); - Clan.put(new Long(0x8D), "(IS) Small Pulse Laser"); - Clan.put(new Long(0x98), "(IS) Large X-Pulse Laser"); - Clan.put(new Long(0x99), "(IS) Medium X-Pulse Laser"); - Clan.put(new Long(0x9A), "(IS) Small X-Pulse Laser"); - //Clan.put(new Long(0xA3), "ISPPCCapacitor"); // HMP uses this code for ERPPC - Clan.put(new Long(0xA8), "(CL) Micro Pulse Laser"); - //Clan.put(new Long(0xA9), "ISPPCCapacitor"); // HMP uses this code for PPC - Clan.put(new Long(0xAA), "(IS) ER Medium Laser"); - Clan.put(new Long(0xAB), "(IS) ER Small Laser"); - Clan.put(new Long(0xD5), "Vehicle Flamer"); + Unused.put(Long.valueOf(0x128), "Clan Plasma Rifle"); + Sphere.put(Long.valueOf(0x33), "(IS) ER Large Laser"); + Sphere.put(Long.valueOf(0x34), "(IS) ER PPC"); + Sphere.put(Long.valueOf(0x35), "(IS) Flamer"); + Sphere.put(Long.valueOf(0x37), "(IS) Large Laser"); + Sphere.put(Long.valueOf(0x38), "(IS) Medium Laser"); + Sphere.put(Long.valueOf(0x39), "(IS) Small Laser"); + Sphere.put(Long.valueOf(0x3A), "(IS) PPC"); + Sphere.put(Long.valueOf(0x3B), "(IS) Large Pulse Laser"); + Sphere.put(Long.valueOf(0x3C), "(IS) Medium Pulse Laser"); + Sphere.put(Long.valueOf(0x3D), "(IS) Small Pulse Laser"); + Sphere.put(Long.valueOf(0x48), "(IS) Large X-Pulse Laser"); + Sphere.put(Long.valueOf(0x49), "(IS) Medium X-Pulse Laser"); + Sphere.put(Long.valueOf(0x4A), "(IS) Small X-Pulse Laser"); + Sphere.put(Long.valueOf(0x52), "Heavy Flamer"); + //Sphere.put(Long.valueOf(0x53), "ISPPCCapacitor"); // HMP uses this code for ERPPC + Sphere.put(Long.valueOf(0x58), "(CL) ER Micro Laser"); + //Sphere.put(Long.valueOf(0x59), "ISPPCCapacitor"); // HMP uses this code for standard PPC + Sphere.put(Long.valueOf(0x5A), "(IS) ER Medium Laser"); + Sphere.put(Long.valueOf(0x5B), "(IS) ER Small Laser"); + Sphere.put(Long.valueOf(0x85), "Vehicle Flamer"); + Sphere.put(Long.valueOf(0xA7), "(CL) ER Large Laser"); + Sphere.put(Long.valueOf(0xA8), "(CL) ER Medium Laser"); + Sphere.put(Long.valueOf(0xA9), "(CL) ER Small Laser"); + Sphere.put(Long.valueOf(0xAA), "(CL) ER PPC"); + Sphere.put(Long.valueOf(0xAB), "(CL) Flamer"); + Sphere.put(Long.valueOf(0xB0), "(CL) Large Pulse Laser"); + Sphere.put(Long.valueOf(0xB1), "(CL) Medium Pulse Laser"); + Sphere.put(Long.valueOf(0xB2), "(CL) Small Pulse Laser"); + Sphere.put(Long.valueOf(0xF4), "(CL) Heavy Large Laser"); + Sphere.put(Long.valueOf(0xF5), "(CL) Heavy Medium Laser"); + Sphere.put(Long.valueOf(0xF6), "(CL) Heavy Small Laser"); + Sphere.put(Long.valueOf(0xDA), "Vehicle Flamer"); + Clan.put(Long.valueOf(0x33), "(CL) ER Large Laser"); + Clan.put(Long.valueOf(0x34), "(CL) ER Medium Laser"); + Clan.put(Long.valueOf(0x35), "(CL) ER Small Laser"); + Clan.put(Long.valueOf(0x36), "(CL) ER PPC"); + Clan.put(Long.valueOf(0x37), "(CL) Flamer"); + Clan.put(Long.valueOf(0x38), "(CL) ER Large Pulse Laser"); + Clan.put(Long.valueOf(0x39), "(CL) ER Medium Pulse Laser"); + Clan.put(Long.valueOf(0x3A), "(CL) ER Small Pulse Laser"); + Clan.put(Long.valueOf(0x3C), "(CL) Large Pulse Laser"); + Clan.put(Long.valueOf(0x3D), "(CL) Medium Pulse Laser"); + Clan.put(Long.valueOf(0x3E), "(CL) Small Pulse Laser"); + Clan.put(Long.valueOf(0x5B), "(CL) ER Micro Laser"); + Clan.put(Long.valueOf(0x66), "Vehicle Flamer"); + Clan.put(Long.valueOf(0x80), "(CL) Heavy Large Laser"); + Clan.put(Long.valueOf(0x81), "(CL) Heavy Medium Laser"); + Clan.put(Long.valueOf(0x82), "(CL) Heavy Small Laser"); + Clan.put(Long.valueOf(0x83), "(IS) ER Large Laser"); + Clan.put(Long.valueOf(0x84), "(IS) ER PPC"); + Clan.put(Long.valueOf(0x85), "(IS) Flamer"); + Clan.put(Long.valueOf(0x87), "(IS) Large Laser"); + Clan.put(Long.valueOf(0x88), "(IS) Medium Laser"); + Clan.put(Long.valueOf(0x89), "(IS) Small Laser"); + Clan.put(Long.valueOf(0x8A), "(IS) PPC"); + Clan.put(Long.valueOf(0x8B), "(IS) Large Pulse Laser"); + Clan.put(Long.valueOf(0x8C), "(IS) Medium Pulse Laser"); + Clan.put(Long.valueOf(0x8D), "(IS) Small Pulse Laser"); + Clan.put(Long.valueOf(0x98), "(IS) Large X-Pulse Laser"); + Clan.put(Long.valueOf(0x99), "(IS) Medium X-Pulse Laser"); + Clan.put(Long.valueOf(0x9A), "(IS) Small X-Pulse Laser"); + //Clan.put(Long.valueOf(0xA3), "ISPPCCapacitor"); // HMP uses this code for ERPPC + Clan.put(Long.valueOf(0xA8), "(CL) Micro Pulse Laser"); + //Clan.put(Long.valueOf(0xA9), "ISPPCCapacitor"); // HMP uses this code for PPC + Clan.put(Long.valueOf(0xAA), "(IS) ER Medium Laser"); + Clan.put(Long.valueOf(0xAB), "(IS) ER Small Laser"); + Clan.put(Long.valueOf(0xD5), "Vehicle Flamer"); // Ballistics - Common.put(new Long(0x121), "(IS) Rotary AC/2"); - Common.put(new Long(0x122), "(IS) Rotary AC/5"); - Common.put(new Long(0x124), "(CL) Rotary AC/2"); - Common.put(new Long(0x125), "(CL) Rotary AC/5"); - Sphere.put(new Long(0x3E), "(IS) Autocannon/2"); - Sphere.put(new Long(0x3F), "(IS) Autocannon/5"); - Sphere.put(new Long(0x40), "(IS) Autocannon/10"); - Sphere.put(new Long(0x41), "(IS) Autocannon/20"); - Sphere.put(new Long(0x43), "Long Tom Artillery Cannon"); - Sphere.put(new Long(0x44), "Sniper Artillery Cannon"); - Sphere.put(new Long(0x45), "Thumper Artillery Cannon"); - Sphere.put(new Long(0x46), "(IS) Light Gauss Rifle"); - Sphere.put(new Long(0x47), "(IS) Gauss Rifle"); - Sphere.put(new Long(0x4B), "(IS) LB 2-X AC"); - Sphere.put(new Long(0x4C), "(IS) LB 5-X AC"); - Sphere.put(new Long(0x4D), "(IS) LB 10-X AC"); - Sphere.put(new Long(0x4E), "(IS) LB 20-X AC"); - Sphere.put(new Long(0x4F), "(IS) Machine Gun"); - Sphere.put(new Long(0x50), "(IS) Light AC/2"); - Sphere.put(new Long(0x51), "(IS) Light AC/5"); - Sphere.put(new Long(0x54), "(IS) Ultra AC/2"); - Sphere.put(new Long(0x55), "(IS) Ultra AC/5"); - Sphere.put(new Long(0x56), "(IS) Ultra AC/10"); - Sphere.put(new Long(0x57), "(IS) Ultra AC/20"); - Sphere.put(new Long(0x5E), "(CL) Light Machine Gun"); - Sphere.put(new Long(0x5F), "(CL) Heavy Machine Gun"); - Sphere.put(new Long(0xB5), "(CL) Gauss Rifle"); - Sphere.put(new Long(0xB6), "(CL) LB 2-X AC"); - Sphere.put(new Long(0xB7), "(CL) LB 5-X AC"); - Sphere.put(new Long(0xB8), "(CL) LB 10-X AC"); - Sphere.put(new Long(0xB9), "(CL) LB 20-X AC"); - Sphere.put(new Long(0xBA), "(CL) Machine Gun"); - Sphere.put(new Long(0xBB), "(CL) Ultra AC/2"); - Sphere.put(new Long(0xBC), "(CL) Ultra AC/5"); - Sphere.put(new Long(0xBD), "(CL) Ultra AC/10"); - Sphere.put(new Long(0xBE), "(CL) Ultra AC/20"); - Sphere.put(new Long(0x123), "(IS) Heavy Gauss Rifle"); - Clan.put(new Long(0x41), "(CL) Gauss Rifle"); - Clan.put(new Long(0x42), "(CL) LB 2-X AC"); - Clan.put(new Long(0x43), "(CL) LB 5-X AC"); - Clan.put(new Long(0x44), "(CL) LB 10-X AC"); - Clan.put(new Long(0x45), "(CL) LB 20-X AC"); - Clan.put(new Long(0x46), "(CL) Machine Gun"); - Clan.put(new Long(0x47), "(CL) Ultra AC/2"); - Clan.put(new Long(0x48), "(CL) Ultra AC/5"); - Clan.put(new Long(0x49), "(CL) Ultra AC/10"); - Clan.put(new Long(0x4A), "(CL) Ultra AC/20"); - Clan.put(new Long(0x8E), "(IS) Autocannon/2"); - Clan.put(new Long(0x8F), "(IS) Autocannon/5"); - Clan.put(new Long(0x90), "(IS) Autocannon/10"); - Clan.put(new Long(0x91), "(IS) Autocannon/20"); - Clan.put(new Long(0x96), "(IS) Light Gauss Rifle"); - Clan.put(new Long(0x97), "(IS) Gauss Rifle"); - Clan.put(new Long(0x9B), "(IS) LB 2-X AC"); - Clan.put(new Long(0x9C), "(IS) LB 5-X AC"); - Clan.put(new Long(0x9D), "(IS) LB 10-X AC"); - Clan.put(new Long(0x9E), "(IS) LB 20-X AC"); - Clan.put(new Long(0x9F), "(IS) Machine Gun"); - Clan.put(new Long(0xA0), "(IS) Light AC/2"); - Clan.put(new Long(0xA1), "(IS) Light AC/5"); - Clan.put(new Long(0xA4), "(IS) Ultra AC/2"); - Clan.put(new Long(0xA5), "(IS) Ultra AC/5"); - Clan.put(new Long(0xA6), "(IS) Ultra AC/10"); - Clan.put(new Long(0xA7), "(IS) Ultra AC/20"); - Clan.put(new Long(0xAD), "(CL) Light Machine Gun"); - Clan.put(new Long(0xAE), "(CL) Heavy Machine Gun"); - Clan.put(new Long(0x93), "Long Tom Artillery Cannon"); - Clan.put(new Long(0x94), "Sniper Artillery Cannon"); - Clan.put(new Long(0x95), "Thumper Artillery Cannon"); + Common.put(Long.valueOf(0x121), "(IS) Rotary AC/2"); + Common.put(Long.valueOf(0x122), "(IS) Rotary AC/5"); + Common.put(Long.valueOf(0x124), "(CL) Rotary AC/2"); + Common.put(Long.valueOf(0x125), "(CL) Rotary AC/5"); + Sphere.put(Long.valueOf(0x3E), "(IS) Autocannon/2"); + Sphere.put(Long.valueOf(0x3F), "(IS) Autocannon/5"); + Sphere.put(Long.valueOf(0x40), "(IS) Autocannon/10"); + Sphere.put(Long.valueOf(0x41), "(IS) Autocannon/20"); + Sphere.put(Long.valueOf(0x43), "Long Tom Artillery Cannon"); + Sphere.put(Long.valueOf(0x44), "Sniper Artillery Cannon"); + Sphere.put(Long.valueOf(0x45), "Thumper Artillery Cannon"); + Sphere.put(Long.valueOf(0x46), "(IS) Light Gauss Rifle"); + Sphere.put(Long.valueOf(0x47), "(IS) Gauss Rifle"); + Sphere.put(Long.valueOf(0x4B), "(IS) LB 2-X AC"); + Sphere.put(Long.valueOf(0x4C), "(IS) LB 5-X AC"); + Sphere.put(Long.valueOf(0x4D), "(IS) LB 10-X AC"); + Sphere.put(Long.valueOf(0x4E), "(IS) LB 20-X AC"); + Sphere.put(Long.valueOf(0x4F), "(IS) Machine Gun"); + Sphere.put(Long.valueOf(0x50), "(IS) Light AC/2"); + Sphere.put(Long.valueOf(0x51), "(IS) Light AC/5"); + Sphere.put(Long.valueOf(0x54), "(IS) Ultra AC/2"); + Sphere.put(Long.valueOf(0x55), "(IS) Ultra AC/5"); + Sphere.put(Long.valueOf(0x56), "(IS) Ultra AC/10"); + Sphere.put(Long.valueOf(0x57), "(IS) Ultra AC/20"); + Sphere.put(Long.valueOf(0x5E), "(CL) Light Machine Gun"); + Sphere.put(Long.valueOf(0x5F), "(CL) Heavy Machine Gun"); + Sphere.put(Long.valueOf(0xB5), "(CL) Gauss Rifle"); + Sphere.put(Long.valueOf(0xB6), "(CL) LB 2-X AC"); + Sphere.put(Long.valueOf(0xB7), "(CL) LB 5-X AC"); + Sphere.put(Long.valueOf(0xB8), "(CL) LB 10-X AC"); + Sphere.put(Long.valueOf(0xB9), "(CL) LB 20-X AC"); + Sphere.put(Long.valueOf(0xBA), "(CL) Machine Gun"); + Sphere.put(Long.valueOf(0xBB), "(CL) Ultra AC/2"); + Sphere.put(Long.valueOf(0xBC), "(CL) Ultra AC/5"); + Sphere.put(Long.valueOf(0xBD), "(CL) Ultra AC/10"); + Sphere.put(Long.valueOf(0xBE), "(CL) Ultra AC/20"); + Sphere.put(Long.valueOf(0x123), "(IS) Heavy Gauss Rifle"); + Clan.put(Long.valueOf(0x41), "(CL) Gauss Rifle"); + Clan.put(Long.valueOf(0x42), "(CL) LB 2-X AC"); + Clan.put(Long.valueOf(0x43), "(CL) LB 5-X AC"); + Clan.put(Long.valueOf(0x44), "(CL) LB 10-X AC"); + Clan.put(Long.valueOf(0x45), "(CL) LB 20-X AC"); + Clan.put(Long.valueOf(0x46), "(CL) Machine Gun"); + Clan.put(Long.valueOf(0x47), "(CL) Ultra AC/2"); + Clan.put(Long.valueOf(0x48), "(CL) Ultra AC/5"); + Clan.put(Long.valueOf(0x49), "(CL) Ultra AC/10"); + Clan.put(Long.valueOf(0x4A), "(CL) Ultra AC/20"); + Clan.put(Long.valueOf(0x8E), "(IS) Autocannon/2"); + Clan.put(Long.valueOf(0x8F), "(IS) Autocannon/5"); + Clan.put(Long.valueOf(0x90), "(IS) Autocannon/10"); + Clan.put(Long.valueOf(0x91), "(IS) Autocannon/20"); + Clan.put(Long.valueOf(0x96), "(IS) Light Gauss Rifle"); + Clan.put(Long.valueOf(0x97), "(IS) Gauss Rifle"); + Clan.put(Long.valueOf(0x9B), "(IS) LB 2-X AC"); + Clan.put(Long.valueOf(0x9C), "(IS) LB 5-X AC"); + Clan.put(Long.valueOf(0x9D), "(IS) LB 10-X AC"); + Clan.put(Long.valueOf(0x9E), "(IS) LB 20-X AC"); + Clan.put(Long.valueOf(0x9F), "(IS) Machine Gun"); + Clan.put(Long.valueOf(0xA0), "(IS) Light AC/2"); + Clan.put(Long.valueOf(0xA1), "(IS) Light AC/5"); + Clan.put(Long.valueOf(0xA4), "(IS) Ultra AC/2"); + Clan.put(Long.valueOf(0xA5), "(IS) Ultra AC/5"); + Clan.put(Long.valueOf(0xA6), "(IS) Ultra AC/10"); + Clan.put(Long.valueOf(0xA7), "(IS) Ultra AC/20"); + Clan.put(Long.valueOf(0xAD), "(CL) Light Machine Gun"); + Clan.put(Long.valueOf(0xAE), "(CL) Heavy Machine Gun"); + Clan.put(Long.valueOf(0x93), "Long Tom Artillery Cannon"); + Clan.put(Long.valueOf(0x94), "Sniper Artillery Cannon"); + Clan.put(Long.valueOf(0x95), "Thumper Artillery Cannon"); // missile weapons - Common.put(new Long(0xFC), "(CL) ATM-3"); - Common.put(new Long(0xFD), "(CL) ATM-6"); - Common.put(new Long(0xFE), "(CL) ATM-9"); - Common.put(new Long(0xFF), "(CL) ATM-12"); - Common.put(new Long(0x129), "(IS) Rocket Launcher 10"); - Common.put(new Long(0x12A), "(IS) Rocket Launcher 15"); - Common.put(new Long(0x12B), "(IS) Rocket Launcher 20"); - Sphere.put(new Long(0x60), "(IS) LRM-5"); - Sphere.put(new Long(0x61), "(IS) LRM-10"); - Sphere.put(new Long(0x62), "(IS) LRM-15"); - Sphere.put(new Long(0x63), "(IS) LRM-20"); - Sphere.put(new Long(0x67), "(IS) SRM-2"); - Sphere.put(new Long(0x68), "(IS) SRM-4"); - Sphere.put(new Long(0x69), "(IS) SRM-6"); - Sphere.put(new Long(0x6A), "(IS) Streak SRM-2"); - Sphere.put(new Long(0x6B), "(IS) Streak SRM-4"); - Sphere.put(new Long(0x6C), "(IS) Streak SRM-6"); - Sphere.put(new Long(0x89), "(IS) MRM-10"); - Sphere.put(new Long(0x8A), "(IS) MRM-20"); - Sphere.put(new Long(0x8B), "(IS) MRM-30"); - Sphere.put(new Long(0x8C), "(IS) MRM-40"); - Sphere.put(new Long(0x6D), "(IS) Thunderbolt-5"); - Sphere.put(new Long(0x6E), "(IS) Thunderbolt-10"); - Sphere.put(new Long(0x6F), "(IS) Thunderbolt-15"); - Sphere.put(new Long(0x70), "(IS) Thunderbolt-20"); - Sphere.put(new Long(0x66), "(IS) iNarc Launcher"); - Sphere.put(new Long(0x79), "(IS) Narc Missile Beacon"); - Sphere.put(new Long(0x92), "(IS) LRT-5"); - Sphere.put(new Long(0x93), "(IS) LRT-10"); - Sphere.put(new Long(0x94), "(IS) LRT-15"); - Sphere.put(new Long(0x95), "(IS) LRT-20"); - Sphere.put(new Long(0x96), "(IS) SRT-2"); - Sphere.put(new Long(0x97), "(IS) SRT-4"); - Sphere.put(new Long(0x98), "(IS) SRT-6"); - Sphere.put(new Long(0x7B), "(IS) LRM-5 (OS)"); - Sphere.put(new Long(0x7C), "(IS) LRM-10 (OS)"); - Sphere.put(new Long(0x7D), "(IS) LRM-15 (OS)"); - Sphere.put(new Long(0x7E), "(IS) LRM-20 (OS)"); - Sphere.put(new Long(0x7F), "(IS) SRM-2 (OS)"); - Sphere.put(new Long(0x80), "(IS) SRM-4 (OS)"); - Sphere.put(new Long(0x81), "(IS) SRM-6 (OS)"); - Sphere.put(new Long(0x82), "(IS) Streak SRM-2 (OS)"); - Sphere.put(new Long(0x83), "(IS) Streak SRM-4 (OS)"); - Sphere.put(new Long(0x84), "(IS) Streak SRM-6 (OS)"); - Sphere.put(new Long(0x8E), "(IS) MRM-10 (OS)"); - Sphere.put(new Long(0x8F), "(IS) MRM-20 (OS)"); - Sphere.put(new Long(0x90), "(IS) MRM-30 (OS)"); - Sphere.put(new Long(0x91), "(IS) MRM-40 (OS)"); - Sphere.put(new Long(0x99), "(IS) LRM-5 (iOS)"); - Sphere.put(new Long(0x9A), "(IS) LRM-10 (iOS)"); - Sphere.put(new Long(0x9B), "(IS) LRM-15 (iOS)"); - Sphere.put(new Long(0x9C), "(IS) LRM-20 (iOS)"); - Sphere.put(new Long(0x9D), "(IS) SRM-2 (iOS)"); - Sphere.put(new Long(0x9E), "(IS) SRM-4 (iOS)"); - Sphere.put(new Long(0x9f), "(IS) SRM-6 (iOS)"); - Sphere.put(new Long(0xA0), "(IS) Streak SRM-2 (iOS)"); - Sphere.put(new Long(0xA1), "(IS) Streak SRM-4 (iOS)"); - Sphere.put(new Long(0xA2), "(IS) Streak SRM-6 (iOS)"); - Sphere.put(new Long(0xA3), "(IS) MRM-10 (iOS)"); - Sphere.put(new Long(0xA4), "(IS) MRM-20 (iOS)"); - Sphere.put(new Long(0xA5), "(IS) MRM-30 (iOS)"); - Sphere.put(new Long(0xA6), "(IS) MRM-40 (iOS)"); - Sphere.put(new Long(0xBF), "(CL) LRM-5"); - Sphere.put(new Long(0xC0), "(CL) LRM-10"); - Sphere.put(new Long(0xC1), "(CL) LRM-15"); - Sphere.put(new Long(0xC2), "(CL) LRM-20"); - Sphere.put(new Long(0xC3), "(CL) SRM-2"); - Sphere.put(new Long(0xC4), "(CL) SRM-4"); - Sphere.put(new Long(0xC5), "(CL) SRM-6"); - Sphere.put(new Long(0xC6), "(CL) Streak SRM-2"); - Sphere.put(new Long(0xC7), "(CL) Streak SRM-4"); - Sphere.put(new Long(0xC8), "(CL) Streak SRM-6"); - Sphere.put(new Long(0xCD), "(CL) Narc Missile Beacon"); - Sphere.put(new Long(0xD0), "(CL) LRM-5 (OS)"); - Sphere.put(new Long(0xD1), "(CL) LRM-10 (OS)"); - Sphere.put(new Long(0xD2), "(CL) LRM-15 (OS)"); - Sphere.put(new Long(0xD3), "(CL) LRM-20 (OS)"); - Sphere.put(new Long(0xD4), "(CL) SRM-2 (OS)"); - Sphere.put(new Long(0xD5), "(CL) SRM-4 (OS)"); - Sphere.put(new Long(0xD6), "(CL) SRM-6 (OS)"); - Sphere.put(new Long(0xD7), "(CL) Streak SRM-2 (OS)"); - Sphere.put(new Long(0xD8), "(CL) Streak SRM-4 (OS)"); - Sphere.put(new Long(0xD9), "(CL) Streak SRM-6 (OS)"); - Sphere.put(new Long(0xDE), "(CL) LRT-5"); - Sphere.put(new Long(0xDF), "(CL) LRT-10"); - Sphere.put(new Long(0xE0), "(CL) LRT-15"); - Sphere.put(new Long(0xE1), "(CL) LRT-20"); - Sphere.put(new Long(0xE2), "(CL) SRT-2"); - Sphere.put(new Long(0xE3), "(CL) SRT-4"); - Sphere.put(new Long(0xE4), "(CL) SRT-6"); - Sphere.put(new Long(0xE5), "(CL) Streak LRM-5"); - Sphere.put(new Long(0xE6), "(CL) Streak LRM-10"); - Sphere.put(new Long(0xE7), "(CL) Streak LRM-15"); - Sphere.put(new Long(0xE8), "(CL) Streak LRM-20"); - Sphere.put(new Long(0xEA), "(CL) LRM-5 (iOS)"); - Sphere.put(new Long(0xEB), "(CL) LRM-10 (iOS)"); - Sphere.put(new Long(0xEC), "(CL) LRM-15 (iOS)"); - Sphere.put(new Long(0xED), "(CL) LRM-20 (iOS)"); - Sphere.put(new Long(0xEE), "(CL) SRM-2 (iOS)"); - Sphere.put(new Long(0xEF), "(CL) SRM-4 (iOS)"); - Sphere.put(new Long(0xF0), "(CL) SRM-6 (iOS)"); - Sphere.put(new Long(0xF1), "(CL) Streak SRM-2 (iOS)"); - Sphere.put(new Long(0xF2), "(CL) Streak SRM-4 (iOS)"); - Sphere.put(new Long(0xF3), "(CL) Streak SRM-6 (iOS)"); - Clan.put(new Long(0x4B), "(CL) LRM-5"); - Clan.put(new Long(0x4C), "(CL) LRM-10"); - Clan.put(new Long(0x4D), "(CL) LRM-15"); - Clan.put(new Long(0x4E), "(CL) LRM-20"); - Clan.put(new Long(0x4F), "(CL) SRM-2"); - Clan.put(new Long(0x50), "(CL) SRM-4"); - Clan.put(new Long(0x51), "(CL) SRM-6"); - Clan.put(new Long(0x52), "(CL) Streak SRM-2"); - Clan.put(new Long(0x53), "(CL) Streak SRM-4"); - Clan.put(new Long(0x54), "(CL) Streak SRM-6"); - Clan.put(new Long(0x59), "(CL) Narc Missile Beacon"); - Clan.put(new Long(0x5C), "(CL) LRM-5 (OS)"); - Clan.put(new Long(0x5D), "(CL) LRM-10 (OS)"); - Clan.put(new Long(0x5E), "(CL) LRM-15 (OS)"); - Clan.put(new Long(0x5F), "(CL) LRM-20 (OS)"); - Clan.put(new Long(0x60), "(CL) SRM-2 (OS)"); - Clan.put(new Long(0x61), "(CL) SRM-4 (OS)"); - Clan.put(new Long(0x62), "(CL) SRM-6 (OS)"); - Clan.put(new Long(0x63), "(CL) Streak SRM-2 (OS)"); - Clan.put(new Long(0x64), "(CL) Streak SRM-4 (OS)"); - Clan.put(new Long(0x65), "(CL) Streak SRM-6 (OS)"); - Clan.put(new Long(0x6A), "(CL) LRT-5"); - Clan.put(new Long(0x6B), "(CL) LRT-10"); - Clan.put(new Long(0x6C), "(CL) LRT-15"); - Clan.put(new Long(0x6D), "(CL) LRT-20"); - Clan.put(new Long(0x6E), "(CL) SRT-2"); - Clan.put(new Long(0x6F), "(CL) SRT-4"); - Clan.put(new Long(0x70), "(CL) SRT-6"); - Clan.put(new Long(0x71), "(CL) Streak LRM-5"); - Clan.put(new Long(0x72), "(CL) Streak LRM-10"); - Clan.put(new Long(0x73), "(CL) Streak LRM-15"); - Clan.put(new Long(0x74), "(CL) Streak LRM-20"); - Clan.put(new Long(0x76), "(CL) LRM-5 (iOS)"); - Clan.put(new Long(0x77), "(CL) LRM-10 (iOS)"); - Clan.put(new Long(0x78), "(CL) LRM-15 (iOS)"); - Clan.put(new Long(0x79), "(CL) LRM-20 (iOS)"); - Clan.put(new Long(0x7a), "(CL) SRM-2 (iOS)"); - Clan.put(new Long(0x7b), "(CL) SRM-4 (iOS)"); - Clan.put(new Long(0x7c), "(CL) SRM-6 (iOS)"); - Clan.put(new Long(0x7d), "(CL) Streak SRM-2 (iOS)"); - Clan.put(new Long(0x7e), "(CL) Streak SRM-4 (iOS)"); - Clan.put(new Long(0x7f), "(CL) Streak SRM-6 (iOS)"); - Clan.put(new Long(0xB0), "(IS) LRM-5"); - Clan.put(new Long(0xB1), "(IS) LRM-10"); - Clan.put(new Long(0xB2), "(IS) LRM-15"); - Clan.put(new Long(0xB3), "(IS) LRM-20"); - Clan.put(new Long(0xB6), "(IS) iNarc Launcher"); - Clan.put(new Long(0xB7), "(IS) SRM-2"); - Clan.put(new Long(0xB8), "(IS) SRM-4"); - Clan.put(new Long(0xB9), "(IS) SRM-6"); - Clan.put(new Long(0xBA), "(IS) Streak SRM-2"); - Clan.put(new Long(0xBB), "(IS) Streak SRM-4"); - Clan.put(new Long(0xBC), "(IS) Streak SRM-6"); - Clan.put(new Long(0xBD), "(IS) Thunderbolt-5"); - Clan.put(new Long(0xBE), "(IS) Thunderbolt-10"); - Clan.put(new Long(0xBF), "(IS) Thunderbolt-15"); - Clan.put(new Long(0xC0), "(IS) Thunderbolt-20"); - Clan.put(new Long(0xC9), "(IS) Narc Missile Beacon"); - Clan.put(new Long(0xCB), "(IS) LRM-5 (OS)"); - Clan.put(new Long(0xCC), "(IS) LRM-10 (OS)"); - Clan.put(new Long(0xCD), "(IS) LRM-15 (OS)"); - Clan.put(new Long(0xCE), "(IS) LRM-20 (OS)"); - Clan.put(new Long(0xCF), "(IS) SRM-2 (OS)"); - Clan.put(new Long(0xD0), "(IS) SRM-4 (OS)"); - Clan.put(new Long(0xD1), "(IS) SRM-6 (OS)"); - Clan.put(new Long(0xD2), "(IS) Streak SRM-2 (OS)"); - Clan.put(new Long(0xD3), "(IS) Streak SRM-4 (OS)"); - Clan.put(new Long(0xD4), "(IS) Streak SRM-6 (OS)"); - Clan.put(new Long(0xD9), "(IS) MRM-10"); - Clan.put(new Long(0xDA), "(IS) MRM-20"); - Clan.put(new Long(0xDB), "(IS) MRM-30"); - Clan.put(new Long(0xDC), "(IS) MRM-40"); - Clan.put(new Long(0xDE), "(IS) MRM-10 (OS)"); - Clan.put(new Long(0xDF), "(IS) MRM-20 (OS)"); - Clan.put(new Long(0xE0), "(IS) MRM-30 (OS)"); - Clan.put(new Long(0xE1), "(IS) MRM-40 (OS)"); - Clan.put(new Long(0xE2), "(IS) LRT-5"); - Clan.put(new Long(0xE3), "(IS) LRT-10"); - Clan.put(new Long(0xE4), "(IS) LRT-15"); - Clan.put(new Long(0xE5), "(IS) LRT-20"); - Clan.put(new Long(0xE6), "(IS) SRT-2"); - Clan.put(new Long(0xE7), "(IS) SRT-4"); - Clan.put(new Long(0xE8), "(IS) SRT-6"); - Clan.put(new Long(0xE9), "(IS) LRM-5 (iOS)"); - Clan.put(new Long(0xEA), "(IS) LRM-10 (iOS)"); - Clan.put(new Long(0xEB), "(IS) LRM-15 (iOS)"); - Clan.put(new Long(0xEC), "(IS) LRM-20 (iOS)"); - Clan.put(new Long(0xED), "(IS) SRM-2 (iOS)"); - Clan.put(new Long(0xEE), "(IS) SRM-4 (iOS)"); - Clan.put(new Long(0xEf), "(IS) SRM-6 (iOS)"); - Clan.put(new Long(0xF0), "(IS) Streak SRM-2 (iOS)"); - Clan.put(new Long(0xF1), "(IS) Streak SRM-4 (iOS)"); - Clan.put(new Long(0xF2), "(IS) Streak SRM-6 (iOS)"); - Clan.put(new Long(0xF3), "(IS) MRM-10 (iOS)"); - Clan.put(new Long(0xF4), "(IS) MRM-20 (iOS)"); - Clan.put(new Long(0xF5), "(IS) MRM-30 (iOS)"); - Clan.put(new Long(0xF6), "(IS) MRM-40 (iOS)"); + Common.put(Long.valueOf(0xFC), "(CL) ATM-3"); + Common.put(Long.valueOf(0xFD), "(CL) ATM-6"); + Common.put(Long.valueOf(0xFE), "(CL) ATM-9"); + Common.put(Long.valueOf(0xFF), "(CL) ATM-12"); + Common.put(Long.valueOf(0x129), "(IS) Rocket Launcher 10"); + Common.put(Long.valueOf(0x12A), "(IS) Rocket Launcher 15"); + Common.put(Long.valueOf(0x12B), "(IS) Rocket Launcher 20"); + Sphere.put(Long.valueOf(0x60), "(IS) LRM-5"); + Sphere.put(Long.valueOf(0x61), "(IS) LRM-10"); + Sphere.put(Long.valueOf(0x62), "(IS) LRM-15"); + Sphere.put(Long.valueOf(0x63), "(IS) LRM-20"); + Sphere.put(Long.valueOf(0x67), "(IS) SRM-2"); + Sphere.put(Long.valueOf(0x68), "(IS) SRM-4"); + Sphere.put(Long.valueOf(0x69), "(IS) SRM-6"); + Sphere.put(Long.valueOf(0x6A), "(IS) Streak SRM-2"); + Sphere.put(Long.valueOf(0x6B), "(IS) Streak SRM-4"); + Sphere.put(Long.valueOf(0x6C), "(IS) Streak SRM-6"); + Sphere.put(Long.valueOf(0x89), "(IS) MRM-10"); + Sphere.put(Long.valueOf(0x8A), "(IS) MRM-20"); + Sphere.put(Long.valueOf(0x8B), "(IS) MRM-30"); + Sphere.put(Long.valueOf(0x8C), "(IS) MRM-40"); + Sphere.put(Long.valueOf(0x6D), "(IS) Thunderbolt-5"); + Sphere.put(Long.valueOf(0x6E), "(IS) Thunderbolt-10"); + Sphere.put(Long.valueOf(0x6F), "(IS) Thunderbolt-15"); + Sphere.put(Long.valueOf(0x70), "(IS) Thunderbolt-20"); + Sphere.put(Long.valueOf(0x66), "(IS) iNarc Launcher"); + Sphere.put(Long.valueOf(0x79), "(IS) Narc Missile Beacon"); + Sphere.put(Long.valueOf(0x92), "(IS) LRT-5"); + Sphere.put(Long.valueOf(0x93), "(IS) LRT-10"); + Sphere.put(Long.valueOf(0x94), "(IS) LRT-15"); + Sphere.put(Long.valueOf(0x95), "(IS) LRT-20"); + Sphere.put(Long.valueOf(0x96), "(IS) SRT-2"); + Sphere.put(Long.valueOf(0x97), "(IS) SRT-4"); + Sphere.put(Long.valueOf(0x98), "(IS) SRT-6"); + Sphere.put(Long.valueOf(0x7B), "(IS) LRM-5 (OS)"); + Sphere.put(Long.valueOf(0x7C), "(IS) LRM-10 (OS)"); + Sphere.put(Long.valueOf(0x7D), "(IS) LRM-15 (OS)"); + Sphere.put(Long.valueOf(0x7E), "(IS) LRM-20 (OS)"); + Sphere.put(Long.valueOf(0x7F), "(IS) SRM-2 (OS)"); + Sphere.put(Long.valueOf(0x80), "(IS) SRM-4 (OS)"); + Sphere.put(Long.valueOf(0x81), "(IS) SRM-6 (OS)"); + Sphere.put(Long.valueOf(0x82), "(IS) Streak SRM-2 (OS)"); + Sphere.put(Long.valueOf(0x83), "(IS) Streak SRM-4 (OS)"); + Sphere.put(Long.valueOf(0x84), "(IS) Streak SRM-6 (OS)"); + Sphere.put(Long.valueOf(0x8E), "(IS) MRM-10 (OS)"); + Sphere.put(Long.valueOf(0x8F), "(IS) MRM-20 (OS)"); + Sphere.put(Long.valueOf(0x90), "(IS) MRM-30 (OS)"); + Sphere.put(Long.valueOf(0x91), "(IS) MRM-40 (OS)"); + Sphere.put(Long.valueOf(0x99), "(IS) LRM-5 (iOS)"); + Sphere.put(Long.valueOf(0x9A), "(IS) LRM-10 (iOS)"); + Sphere.put(Long.valueOf(0x9B), "(IS) LRM-15 (iOS)"); + Sphere.put(Long.valueOf(0x9C), "(IS) LRM-20 (iOS)"); + Sphere.put(Long.valueOf(0x9D), "(IS) SRM-2 (iOS)"); + Sphere.put(Long.valueOf(0x9E), "(IS) SRM-4 (iOS)"); + Sphere.put(Long.valueOf(0x9f), "(IS) SRM-6 (iOS)"); + Sphere.put(Long.valueOf(0xA0), "(IS) Streak SRM-2 (iOS)"); + Sphere.put(Long.valueOf(0xA1), "(IS) Streak SRM-4 (iOS)"); + Sphere.put(Long.valueOf(0xA2), "(IS) Streak SRM-6 (iOS)"); + Sphere.put(Long.valueOf(0xA3), "(IS) MRM-10 (iOS)"); + Sphere.put(Long.valueOf(0xA4), "(IS) MRM-20 (iOS)"); + Sphere.put(Long.valueOf(0xA5), "(IS) MRM-30 (iOS)"); + Sphere.put(Long.valueOf(0xA6), "(IS) MRM-40 (iOS)"); + Sphere.put(Long.valueOf(0xBF), "(CL) LRM-5"); + Sphere.put(Long.valueOf(0xC0), "(CL) LRM-10"); + Sphere.put(Long.valueOf(0xC1), "(CL) LRM-15"); + Sphere.put(Long.valueOf(0xC2), "(CL) LRM-20"); + Sphere.put(Long.valueOf(0xC3), "(CL) SRM-2"); + Sphere.put(Long.valueOf(0xC4), "(CL) SRM-4"); + Sphere.put(Long.valueOf(0xC5), "(CL) SRM-6"); + Sphere.put(Long.valueOf(0xC6), "(CL) Streak SRM-2"); + Sphere.put(Long.valueOf(0xC7), "(CL) Streak SRM-4"); + Sphere.put(Long.valueOf(0xC8), "(CL) Streak SRM-6"); + Sphere.put(Long.valueOf(0xCD), "(CL) Narc Missile Beacon"); + Sphere.put(Long.valueOf(0xD0), "(CL) LRM-5 (OS)"); + Sphere.put(Long.valueOf(0xD1), "(CL) LRM-10 (OS)"); + Sphere.put(Long.valueOf(0xD2), "(CL) LRM-15 (OS)"); + Sphere.put(Long.valueOf(0xD3), "(CL) LRM-20 (OS)"); + Sphere.put(Long.valueOf(0xD4), "(CL) SRM-2 (OS)"); + Sphere.put(Long.valueOf(0xD5), "(CL) SRM-4 (OS)"); + Sphere.put(Long.valueOf(0xD6), "(CL) SRM-6 (OS)"); + Sphere.put(Long.valueOf(0xD7), "(CL) Streak SRM-2 (OS)"); + Sphere.put(Long.valueOf(0xD8), "(CL) Streak SRM-4 (OS)"); + Sphere.put(Long.valueOf(0xD9), "(CL) Streak SRM-6 (OS)"); + Sphere.put(Long.valueOf(0xDE), "(CL) LRT-5"); + Sphere.put(Long.valueOf(0xDF), "(CL) LRT-10"); + Sphere.put(Long.valueOf(0xE0), "(CL) LRT-15"); + Sphere.put(Long.valueOf(0xE1), "(CL) LRT-20"); + Sphere.put(Long.valueOf(0xE2), "(CL) SRT-2"); + Sphere.put(Long.valueOf(0xE3), "(CL) SRT-4"); + Sphere.put(Long.valueOf(0xE4), "(CL) SRT-6"); + Sphere.put(Long.valueOf(0xE5), "(CL) Streak LRM-5"); + Sphere.put(Long.valueOf(0xE6), "(CL) Streak LRM-10"); + Sphere.put(Long.valueOf(0xE7), "(CL) Streak LRM-15"); + Sphere.put(Long.valueOf(0xE8), "(CL) Streak LRM-20"); + Sphere.put(Long.valueOf(0xEA), "(CL) LRM-5 (iOS)"); + Sphere.put(Long.valueOf(0xEB), "(CL) LRM-10 (iOS)"); + Sphere.put(Long.valueOf(0xEC), "(CL) LRM-15 (iOS)"); + Sphere.put(Long.valueOf(0xED), "(CL) LRM-20 (iOS)"); + Sphere.put(Long.valueOf(0xEE), "(CL) SRM-2 (iOS)"); + Sphere.put(Long.valueOf(0xEF), "(CL) SRM-4 (iOS)"); + Sphere.put(Long.valueOf(0xF0), "(CL) SRM-6 (iOS)"); + Sphere.put(Long.valueOf(0xF1), "(CL) Streak SRM-2 (iOS)"); + Sphere.put(Long.valueOf(0xF2), "(CL) Streak SRM-4 (iOS)"); + Sphere.put(Long.valueOf(0xF3), "(CL) Streak SRM-6 (iOS)"); + Clan.put(Long.valueOf(0x4B), "(CL) LRM-5"); + Clan.put(Long.valueOf(0x4C), "(CL) LRM-10"); + Clan.put(Long.valueOf(0x4D), "(CL) LRM-15"); + Clan.put(Long.valueOf(0x4E), "(CL) LRM-20"); + Clan.put(Long.valueOf(0x4F), "(CL) SRM-2"); + Clan.put(Long.valueOf(0x50), "(CL) SRM-4"); + Clan.put(Long.valueOf(0x51), "(CL) SRM-6"); + Clan.put(Long.valueOf(0x52), "(CL) Streak SRM-2"); + Clan.put(Long.valueOf(0x53), "(CL) Streak SRM-4"); + Clan.put(Long.valueOf(0x54), "(CL) Streak SRM-6"); + Clan.put(Long.valueOf(0x59), "(CL) Narc Missile Beacon"); + Clan.put(Long.valueOf(0x5C), "(CL) LRM-5 (OS)"); + Clan.put(Long.valueOf(0x5D), "(CL) LRM-10 (OS)"); + Clan.put(Long.valueOf(0x5E), "(CL) LRM-15 (OS)"); + Clan.put(Long.valueOf(0x5F), "(CL) LRM-20 (OS)"); + Clan.put(Long.valueOf(0x60), "(CL) SRM-2 (OS)"); + Clan.put(Long.valueOf(0x61), "(CL) SRM-4 (OS)"); + Clan.put(Long.valueOf(0x62), "(CL) SRM-6 (OS)"); + Clan.put(Long.valueOf(0x63), "(CL) Streak SRM-2 (OS)"); + Clan.put(Long.valueOf(0x64), "(CL) Streak SRM-4 (OS)"); + Clan.put(Long.valueOf(0x65), "(CL) Streak SRM-6 (OS)"); + Clan.put(Long.valueOf(0x6A), "(CL) LRT-5"); + Clan.put(Long.valueOf(0x6B), "(CL) LRT-10"); + Clan.put(Long.valueOf(0x6C), "(CL) LRT-15"); + Clan.put(Long.valueOf(0x6D), "(CL) LRT-20"); + Clan.put(Long.valueOf(0x6E), "(CL) SRT-2"); + Clan.put(Long.valueOf(0x6F), "(CL) SRT-4"); + Clan.put(Long.valueOf(0x70), "(CL) SRT-6"); + Clan.put(Long.valueOf(0x71), "(CL) Streak LRM-5"); + Clan.put(Long.valueOf(0x72), "(CL) Streak LRM-10"); + Clan.put(Long.valueOf(0x73), "(CL) Streak LRM-15"); + Clan.put(Long.valueOf(0x74), "(CL) Streak LRM-20"); + Clan.put(Long.valueOf(0x76), "(CL) LRM-5 (iOS)"); + Clan.put(Long.valueOf(0x77), "(CL) LRM-10 (iOS)"); + Clan.put(Long.valueOf(0x78), "(CL) LRM-15 (iOS)"); + Clan.put(Long.valueOf(0x79), "(CL) LRM-20 (iOS)"); + Clan.put(Long.valueOf(0x7a), "(CL) SRM-2 (iOS)"); + Clan.put(Long.valueOf(0x7b), "(CL) SRM-4 (iOS)"); + Clan.put(Long.valueOf(0x7c), "(CL) SRM-6 (iOS)"); + Clan.put(Long.valueOf(0x7d), "(CL) Streak SRM-2 (iOS)"); + Clan.put(Long.valueOf(0x7e), "(CL) Streak SRM-4 (iOS)"); + Clan.put(Long.valueOf(0x7f), "(CL) Streak SRM-6 (iOS)"); + Clan.put(Long.valueOf(0xB0), "(IS) LRM-5"); + Clan.put(Long.valueOf(0xB1), "(IS) LRM-10"); + Clan.put(Long.valueOf(0xB2), "(IS) LRM-15"); + Clan.put(Long.valueOf(0xB3), "(IS) LRM-20"); + Clan.put(Long.valueOf(0xB6), "(IS) iNarc Launcher"); + Clan.put(Long.valueOf(0xB7), "(IS) SRM-2"); + Clan.put(Long.valueOf(0xB8), "(IS) SRM-4"); + Clan.put(Long.valueOf(0xB9), "(IS) SRM-6"); + Clan.put(Long.valueOf(0xBA), "(IS) Streak SRM-2"); + Clan.put(Long.valueOf(0xBB), "(IS) Streak SRM-4"); + Clan.put(Long.valueOf(0xBC), "(IS) Streak SRM-6"); + Clan.put(Long.valueOf(0xBD), "(IS) Thunderbolt-5"); + Clan.put(Long.valueOf(0xBE), "(IS) Thunderbolt-10"); + Clan.put(Long.valueOf(0xBF), "(IS) Thunderbolt-15"); + Clan.put(Long.valueOf(0xC0), "(IS) Thunderbolt-20"); + Clan.put(Long.valueOf(0xC9), "(IS) Narc Missile Beacon"); + Clan.put(Long.valueOf(0xCB), "(IS) LRM-5 (OS)"); + Clan.put(Long.valueOf(0xCC), "(IS) LRM-10 (OS)"); + Clan.put(Long.valueOf(0xCD), "(IS) LRM-15 (OS)"); + Clan.put(Long.valueOf(0xCE), "(IS) LRM-20 (OS)"); + Clan.put(Long.valueOf(0xCF), "(IS) SRM-2 (OS)"); + Clan.put(Long.valueOf(0xD0), "(IS) SRM-4 (OS)"); + Clan.put(Long.valueOf(0xD1), "(IS) SRM-6 (OS)"); + Clan.put(Long.valueOf(0xD2), "(IS) Streak SRM-2 (OS)"); + Clan.put(Long.valueOf(0xD3), "(IS) Streak SRM-4 (OS)"); + Clan.put(Long.valueOf(0xD4), "(IS) Streak SRM-6 (OS)"); + Clan.put(Long.valueOf(0xD9), "(IS) MRM-10"); + Clan.put(Long.valueOf(0xDA), "(IS) MRM-20"); + Clan.put(Long.valueOf(0xDB), "(IS) MRM-30"); + Clan.put(Long.valueOf(0xDC), "(IS) MRM-40"); + Clan.put(Long.valueOf(0xDE), "(IS) MRM-10 (OS)"); + Clan.put(Long.valueOf(0xDF), "(IS) MRM-20 (OS)"); + Clan.put(Long.valueOf(0xE0), "(IS) MRM-30 (OS)"); + Clan.put(Long.valueOf(0xE1), "(IS) MRM-40 (OS)"); + Clan.put(Long.valueOf(0xE2), "(IS) LRT-5"); + Clan.put(Long.valueOf(0xE3), "(IS) LRT-10"); + Clan.put(Long.valueOf(0xE4), "(IS) LRT-15"); + Clan.put(Long.valueOf(0xE5), "(IS) LRT-20"); + Clan.put(Long.valueOf(0xE6), "(IS) SRT-2"); + Clan.put(Long.valueOf(0xE7), "(IS) SRT-4"); + Clan.put(Long.valueOf(0xE8), "(IS) SRT-6"); + Clan.put(Long.valueOf(0xE9), "(IS) LRM-5 (iOS)"); + Clan.put(Long.valueOf(0xEA), "(IS) LRM-10 (iOS)"); + Clan.put(Long.valueOf(0xEB), "(IS) LRM-15 (iOS)"); + Clan.put(Long.valueOf(0xEC), "(IS) LRM-20 (iOS)"); + Clan.put(Long.valueOf(0xED), "(IS) SRM-2 (iOS)"); + Clan.put(Long.valueOf(0xEE), "(IS) SRM-4 (iOS)"); + Clan.put(Long.valueOf(0xEf), "(IS) SRM-6 (iOS)"); + Clan.put(Long.valueOf(0xF0), "(IS) Streak SRM-2 (iOS)"); + Clan.put(Long.valueOf(0xF1), "(IS) Streak SRM-4 (iOS)"); + Clan.put(Long.valueOf(0xF2), "(IS) Streak SRM-6 (iOS)"); + Clan.put(Long.valueOf(0xF3), "(IS) MRM-10 (iOS)"); + Clan.put(Long.valueOf(0xF4), "(IS) MRM-20 (iOS)"); + Clan.put(Long.valueOf(0xF5), "(IS) MRM-30 (iOS)"); + Clan.put(Long.valueOf(0xF6), "(IS) MRM-40 (iOS)"); // Artillery - Clan.put(new Long(0xD7), "(IS) Sniper"); - Clan.put(new Long(0xD8), "(IS) Thumper"); - Clan.put(new Long(0x55), "(CL) Arrow IV Missile"); - Clan.put(new Long(0x68), "(IS) Sniper"); - Clan.put(new Long(0x69), "(IS) Thumper"); - Sphere.put(new Long(0x87), "(IS) Sniper"); - Sphere.put(new Long(0x88), "(IS) Thumper"); - Sphere.put(new Long(0x71), "(IS) Arrow IV Missile"); - Sphere.put(new Long(0xC9), "(CL) Arrow IV Missile"); - Sphere.put(new Long(0xDC), "(IS) Sniper"); - Sphere.put(new Long(0xDD), "(IS) Thumper"); + Clan.put(Long.valueOf(0xD7), "(IS) Sniper"); + Clan.put(Long.valueOf(0xD8), "(IS) Thumper"); + Clan.put(Long.valueOf(0x55), "(CL) Arrow IV Missile"); + Clan.put(Long.valueOf(0x68), "(IS) Sniper"); + Clan.put(Long.valueOf(0x69), "(IS) Thumper"); + Sphere.put(Long.valueOf(0x87), "(IS) Sniper"); + Sphere.put(Long.valueOf(0x88), "(IS) Thumper"); + Sphere.put(Long.valueOf(0x71), "(IS) Arrow IV Missile"); + Sphere.put(Long.valueOf(0xC9), "(CL) Arrow IV Missile"); + Sphere.put(Long.valueOf(0xDC), "(IS) Sniper"); + Sphere.put(Long.valueOf(0xDD), "(IS) Thumper"); // ammunition - Common.put(new Long(0x10000028cL), "(CL) @ ATM-3 (ER)"); - Common.put(new Long(0x20000028cL), "(CL) @ ATM-3 (HE)"); - Common.put(new Long(0x10000028dL), "(CL) @ ATM-6 (ER)"); - Common.put(new Long(0x20000028dL), "(CL) @ ATM-6 (HE)"); - Common.put(new Long(0x10000028eL), "(CL) @ ATM-9 (ER)"); - Common.put(new Long(0x20000028eL), "(CL) @ ATM-9 (HE)"); - Common.put(new Long(0x10000028fL), "(CL) @ ATM-12 (ER)"); - Common.put(new Long(0x20000028fL), "(CL) @ ATM-12 (HE)"); - Common.put(new Long(0x28c), "(CL) @ ATM-3"); - Common.put(new Long(0x28d), "(CL) @ ATM-6"); - Common.put(new Long(0x28e), "(CL) @ ATM-9"); - Common.put(new Long(0x28f), "(CL) @ ATM-12"); - Common.put(new Long(0x2B1), "(IS) @ Rotary AC/2"); - Common.put(new Long(0x2B2), "(IS) @ Rotary AC/5"); - Common.put(new Long(0x2b4), "(CL) @ Rotary AC/2"); - Common.put(new Long(0x2b5), "(CL) @ Rotary AC/5"); + Common.put(Long.valueOf(0x10000028cL), "(CL) @ ATM-3 (ER)"); + Common.put(Long.valueOf(0x20000028cL), "(CL) @ ATM-3 (HE)"); + Common.put(Long.valueOf(0x10000028dL), "(CL) @ ATM-6 (ER)"); + Common.put(Long.valueOf(0x20000028dL), "(CL) @ ATM-6 (HE)"); + Common.put(Long.valueOf(0x10000028eL), "(CL) @ ATM-9 (ER)"); + Common.put(Long.valueOf(0x20000028eL), "(CL) @ ATM-9 (HE)"); + Common.put(Long.valueOf(0x10000028fL), "(CL) @ ATM-12 (ER)"); + Common.put(Long.valueOf(0x20000028fL), "(CL) @ ATM-12 (HE)"); + Common.put(Long.valueOf(0x28c), "(CL) @ ATM-3"); + Common.put(Long.valueOf(0x28d), "(CL) @ ATM-6"); + Common.put(Long.valueOf(0x28e), "(CL) @ ATM-9"); + Common.put(Long.valueOf(0x28f), "(CL) @ ATM-12"); + Common.put(Long.valueOf(0x2B1), "(IS) @ Rotary AC/2"); + Common.put(Long.valueOf(0x2B2), "(IS) @ Rotary AC/5"); + Common.put(Long.valueOf(0x2b4), "(CL) @ Rotary AC/2"); + Common.put(Long.valueOf(0x2b5), "(CL) @ Rotary AC/5"); // special for ammo mutator // 28c-28f = atm - //BFB.Common.put(new Long(0x100000298L), "ISLBXAC2 Ammo (THB)"); - //BFB.Common.put(new Long(0x100000299L), "ISLBXAC5 Ammo (THB)"); - //BFB.Common.put(new Long(0x10000029AL), "ISLBXAC20 Ammo (THB)"); - Sphere.put(new Long(0x01CE), "(IS) @ AC/2"); - Sphere.put(new Long(0x01CF), "(IS) @ AC/5"); - Sphere.put(new Long(0x01D0), "(IS) @ AC/10"); - Sphere.put(new Long(0x01d1), "(IS) @ AC/20"); - Sphere.put(new Long(0x01d2), "(IS) @ Anti-Missile System"); - Sphere.put(new Long(0x01d3), "@ Long Tom Cannon"); - Sphere.put(new Long(0x01d4), "@ Sniper Cannon"); - Sphere.put(new Long(0x01d5), "@ Thumper Cannon"); - Sphere.put(new Long(0x01d6), "(IS) @ Light Gauss Rifle"); - Sphere.put(new Long(0x01d7), "@ Gauss Rifle"); - Sphere.put(new Long(0x01db), "(IS) @ LB 2-X AC (Slug)"); - Sphere.put(new Long(0x01dc), "(IS) @ LB 5-X AC (Slug)"); - Sphere.put(new Long(0x01dd), "(IS) @ LB 10-X AC (Slug)"); - Sphere.put(new Long(0x01de), "(IS) @ LB 20-X AC (Slug)"); - Sphere.put(new Long(0x01df), "@ Machine Gun"); - Sphere.put(new Long(0x1e0), "@ Light AC/2"); - Sphere.put(new Long(0x1e1), "@ Light AC/5"); - Sphere.put(new Long(0x1e2), "@ Heavy Flamer"); - Sphere.put(new Long(0x01e4), "(IS) @ Ultra AC/2"); - Sphere.put(new Long(0x01e5), "(IS) @ Ultra AC/5"); - Sphere.put(new Long(0x01e6), "(IS) @ Ultra AC/10"); - Sphere.put(new Long(0x01e7), "(IS) @ Ultra AC/20"); - Sphere.put(new Long(0x01EE), "@ Light Machine Gun"); - Sphere.put(new Long(0x01EF), "@ Heavy Machine Gun"); - Sphere.put(new Long(0x01f0), "(IS) @ LRM-5"); - Sphere.put(new Long(0x01f1), "(IS) @ LRM-10"); - Sphere.put(new Long(0x01f2), "(IS) @ LRM-15"); - Sphere.put(new Long(0x01f3), "(IS) @ LRM-20"); - Sphere.put(new Long(0x01f6), "@ iNarc (Homing)"); - Sphere.put(new Long(0x01f7), "@ SRM-2"); - Sphere.put(new Long(0x01f8), "@ SRM-4"); - Sphere.put(new Long(0x01f9), "@ SRM-6"); - Sphere.put(new Long(0x01fa), "(IS) @ Streak SRM-2"); - Sphere.put(new Long(0x01fb), "(IS) @ Streak SRM-4"); - Sphere.put(new Long(0x01FC), "(IS) @ Streak SRM-6"); - Sphere.put(new Long(0x01FD), "@ Thunderbolt-5"); - Sphere.put(new Long(0x01FE), "@ Thunderbolt-10"); - Sphere.put(new Long(0x01FF), "@ Thunderbolt-15"); - Sphere.put(new Long(0x0200), "@ Thunderbolt-20"); - Sphere.put(new Long(0x0201), "(IS) @ Arrow IV (Homing)"); - Sphere.put(new Long(0x0209), "(IS) @ Narc (Homing)"); - Sphere.put(new Long(0x0215), "@ Vehicle Flamer"); - Sphere.put(new Long(0x0217), "(IS) @ Sniper"); - Sphere.put(new Long(0x0218), "(IS) @ Thumper"); - Sphere.put(new Long(0x0219), "(IS) @ MRM-10"); - Sphere.put(new Long(0x021a), "(IS) @ MRM-20"); - Sphere.put(new Long(0x021b), "(IS) @ MRM-30"); - Sphere.put(new Long(0x021c), "(IS) @ MRM-40"); - Sphere.put(new Long(0x0222), "(IS) @ LRT-5 (Torpedo)"); - Sphere.put(new Long(0x0223), "(IS) @ LRT-10 (Torpedo)"); - Sphere.put(new Long(0x0224), "(IS) @ LRT-15 (Torpedo)"); - Sphere.put(new Long(0x0225), "(IS) @ LRT-20 (Torpedo)"); - Sphere.put(new Long(0x0226), "@ SRT-2 (Torpedo)"); - Sphere.put(new Long(0x0227), "@ SRT-4 (Torpedo)"); - Sphere.put(new Long(0x0228), "@ SRT-6 (Torpedo)"); - Sphere.put(new Long(0x0244), "(CL) @ Anti-Missile System"); - Sphere.put(new Long(0x0245), "@ Gauss Rifle"); - Sphere.put(new Long(0x0246), "(CL) @ LB 2-X AC (Slug)"); - Sphere.put(new Long(0x0247), "(CL) @ LB 5-X AC (Slug)"); - Sphere.put(new Long(0x0248), "(CL) @ LB 10-X AC (Slug)"); - Sphere.put(new Long(0x0249), "(CL) @ LB 20-X AC (Slug)"); - Sphere.put(new Long(0x024A), "@ Machine Gun"); - Sphere.put(new Long(0x024B), "(CL) @ Ultra AC/2"); - Sphere.put(new Long(0x024C), "(CL) @ Ultra AC/5"); - Sphere.put(new Long(0x024D), "(CL) @ Ultra AC/10"); - Sphere.put(new Long(0x024E), "(CL) @ Ultra AC/20"); - Sphere.put(new Long(0x024F), "(CL) @ LRM-5"); - Sphere.put(new Long(0x0250), "(CL) @ LRM-10"); - Sphere.put(new Long(0x0251), "(CL) @ LRM-15"); - Sphere.put(new Long(0x0252), "(CL) @ LRM-20"); - Sphere.put(new Long(0x0253), "@ SRM-2"); - Sphere.put(new Long(0x0254), "@ SRM-4"); - Sphere.put(new Long(0x0255), "@ SRM-6"); - Sphere.put(new Long(0x0256), "(CL) @ Streak SRM-2"); - Sphere.put(new Long(0x0257), "(CL) @ Streak SRM-4"); - Sphere.put(new Long(0x0258), "(CL) @ Streak SRM-6"); - Sphere.put(new Long(0x0259), "(CL) @ Arrow IV (Homing)"); - Sphere.put(new Long(0x025D), "(CL) @ Narc (Homing)"); - Sphere.put(new Long(0x026A), "@ Vehicle Flamer"); - Sphere.put(new Long(0x026C), "@ Sniper"); - Sphere.put(new Long(0x026D), "@ Thumper"); - Sphere.put(new Long(0x026E), "(CL) @ LRT-5 (Torpedo)"); - Sphere.put(new Long(0x026F), "(CL) @ LRT-10 (Torpedo)"); - Sphere.put(new Long(0x0270), "(CL) @ LRT-15 (Torpedo)"); - Sphere.put(new Long(0x0271), "(CL) @ LRT-20 (Torpedo)"); - Sphere.put(new Long(0x0272), "@ SRT-2"); - Sphere.put(new Long(0x0273), "@ SRT-4"); - Sphere.put(new Long(0x0274), "@ SRT-6"); - Sphere.put(new Long(0x0275), "@ Streak LRM-5"); - Sphere.put(new Long(0x0276), "@ Streak LRM-10"); - Sphere.put(new Long(0x0277), "@ Streak LRM-15"); - Sphere.put(new Long(0x0278), "@ Streak LRM-20"); - Sphere.put(new Long(0x02b3), "(IS) @ Heavy Gauss Rifle"); + //BFB.Common.put(Long.valueOf(0x100000298L), "ISLBXAC2 Ammo (THB)"); + //BFB.Common.put(Long.valueOf(0x100000299L), "ISLBXAC5 Ammo (THB)"); + //BFB.Common.put(Long.valueOf(0x10000029AL), "ISLBXAC20 Ammo (THB)"); + Sphere.put(Long.valueOf(0x01CE), "(IS) @ AC/2"); + Sphere.put(Long.valueOf(0x01CF), "(IS) @ AC/5"); + Sphere.put(Long.valueOf(0x01D0), "(IS) @ AC/10"); + Sphere.put(Long.valueOf(0x01d1), "(IS) @ AC/20"); + Sphere.put(Long.valueOf(0x01d2), "(IS) @ Anti-Missile System"); + Sphere.put(Long.valueOf(0x01d3), "@ Long Tom Cannon"); + Sphere.put(Long.valueOf(0x01d4), "@ Sniper Cannon"); + Sphere.put(Long.valueOf(0x01d5), "@ Thumper Cannon"); + Sphere.put(Long.valueOf(0x01d6), "(IS) @ Light Gauss Rifle"); + Sphere.put(Long.valueOf(0x01d7), "@ Gauss Rifle"); + Sphere.put(Long.valueOf(0x01db), "(IS) @ LB 2-X AC (Slug)"); + Sphere.put(Long.valueOf(0x01dc), "(IS) @ LB 5-X AC (Slug)"); + Sphere.put(Long.valueOf(0x01dd), "(IS) @ LB 10-X AC (Slug)"); + Sphere.put(Long.valueOf(0x01de), "(IS) @ LB 20-X AC (Slug)"); + Sphere.put(Long.valueOf(0x01df), "@ Machine Gun"); + Sphere.put(Long.valueOf(0x1e0), "@ Light AC/2"); + Sphere.put(Long.valueOf(0x1e1), "@ Light AC/5"); + Sphere.put(Long.valueOf(0x1e2), "@ Heavy Flamer"); + Sphere.put(Long.valueOf(0x01e4), "(IS) @ Ultra AC/2"); + Sphere.put(Long.valueOf(0x01e5), "(IS) @ Ultra AC/5"); + Sphere.put(Long.valueOf(0x01e6), "(IS) @ Ultra AC/10"); + Sphere.put(Long.valueOf(0x01e7), "(IS) @ Ultra AC/20"); + Sphere.put(Long.valueOf(0x01EE), "@ Light Machine Gun"); + Sphere.put(Long.valueOf(0x01EF), "@ Heavy Machine Gun"); + Sphere.put(Long.valueOf(0x01f0), "(IS) @ LRM-5"); + Sphere.put(Long.valueOf(0x01f1), "(IS) @ LRM-10"); + Sphere.put(Long.valueOf(0x01f2), "(IS) @ LRM-15"); + Sphere.put(Long.valueOf(0x01f3), "(IS) @ LRM-20"); + Sphere.put(Long.valueOf(0x01f6), "@ iNarc (Homing)"); + Sphere.put(Long.valueOf(0x01f7), "@ SRM-2"); + Sphere.put(Long.valueOf(0x01f8), "@ SRM-4"); + Sphere.put(Long.valueOf(0x01f9), "@ SRM-6"); + Sphere.put(Long.valueOf(0x01fa), "(IS) @ Streak SRM-2"); + Sphere.put(Long.valueOf(0x01fb), "(IS) @ Streak SRM-4"); + Sphere.put(Long.valueOf(0x01FC), "(IS) @ Streak SRM-6"); + Sphere.put(Long.valueOf(0x01FD), "@ Thunderbolt-5"); + Sphere.put(Long.valueOf(0x01FE), "@ Thunderbolt-10"); + Sphere.put(Long.valueOf(0x01FF), "@ Thunderbolt-15"); + Sphere.put(Long.valueOf(0x0200), "@ Thunderbolt-20"); + Sphere.put(Long.valueOf(0x0201), "(IS) @ Arrow IV (Homing)"); + Sphere.put(Long.valueOf(0x0209), "(IS) @ Narc (Homing)"); + Sphere.put(Long.valueOf(0x0215), "@ Vehicle Flamer"); + Sphere.put(Long.valueOf(0x0217), "(IS) @ Sniper"); + Sphere.put(Long.valueOf(0x0218), "(IS) @ Thumper"); + Sphere.put(Long.valueOf(0x0219), "(IS) @ MRM-10"); + Sphere.put(Long.valueOf(0x021a), "(IS) @ MRM-20"); + Sphere.put(Long.valueOf(0x021b), "(IS) @ MRM-30"); + Sphere.put(Long.valueOf(0x021c), "(IS) @ MRM-40"); + Sphere.put(Long.valueOf(0x0222), "(IS) @ LRT-5 (Torpedo)"); + Sphere.put(Long.valueOf(0x0223), "(IS) @ LRT-10 (Torpedo)"); + Sphere.put(Long.valueOf(0x0224), "(IS) @ LRT-15 (Torpedo)"); + Sphere.put(Long.valueOf(0x0225), "(IS) @ LRT-20 (Torpedo)"); + Sphere.put(Long.valueOf(0x0226), "@ SRT-2 (Torpedo)"); + Sphere.put(Long.valueOf(0x0227), "@ SRT-4 (Torpedo)"); + Sphere.put(Long.valueOf(0x0228), "@ SRT-6 (Torpedo)"); + Sphere.put(Long.valueOf(0x0244), "(CL) @ Anti-Missile System"); + Sphere.put(Long.valueOf(0x0245), "@ Gauss Rifle"); + Sphere.put(Long.valueOf(0x0246), "(CL) @ LB 2-X AC (Slug)"); + Sphere.put(Long.valueOf(0x0247), "(CL) @ LB 5-X AC (Slug)"); + Sphere.put(Long.valueOf(0x0248), "(CL) @ LB 10-X AC (Slug)"); + Sphere.put(Long.valueOf(0x0249), "(CL) @ LB 20-X AC (Slug)"); + Sphere.put(Long.valueOf(0x024A), "@ Machine Gun"); + Sphere.put(Long.valueOf(0x024B), "(CL) @ Ultra AC/2"); + Sphere.put(Long.valueOf(0x024C), "(CL) @ Ultra AC/5"); + Sphere.put(Long.valueOf(0x024D), "(CL) @ Ultra AC/10"); + Sphere.put(Long.valueOf(0x024E), "(CL) @ Ultra AC/20"); + Sphere.put(Long.valueOf(0x024F), "(CL) @ LRM-5"); + Sphere.put(Long.valueOf(0x0250), "(CL) @ LRM-10"); + Sphere.put(Long.valueOf(0x0251), "(CL) @ LRM-15"); + Sphere.put(Long.valueOf(0x0252), "(CL) @ LRM-20"); + Sphere.put(Long.valueOf(0x0253), "@ SRM-2"); + Sphere.put(Long.valueOf(0x0254), "@ SRM-4"); + Sphere.put(Long.valueOf(0x0255), "@ SRM-6"); + Sphere.put(Long.valueOf(0x0256), "(CL) @ Streak SRM-2"); + Sphere.put(Long.valueOf(0x0257), "(CL) @ Streak SRM-4"); + Sphere.put(Long.valueOf(0x0258), "(CL) @ Streak SRM-6"); + Sphere.put(Long.valueOf(0x0259), "(CL) @ Arrow IV (Homing)"); + Sphere.put(Long.valueOf(0x025D), "(CL) @ Narc (Homing)"); + Sphere.put(Long.valueOf(0x026A), "@ Vehicle Flamer"); + Sphere.put(Long.valueOf(0x026C), "@ Sniper"); + Sphere.put(Long.valueOf(0x026D), "@ Thumper"); + Sphere.put(Long.valueOf(0x026E), "(CL) @ LRT-5 (Torpedo)"); + Sphere.put(Long.valueOf(0x026F), "(CL) @ LRT-10 (Torpedo)"); + Sphere.put(Long.valueOf(0x0270), "(CL) @ LRT-15 (Torpedo)"); + Sphere.put(Long.valueOf(0x0271), "(CL) @ LRT-20 (Torpedo)"); + Sphere.put(Long.valueOf(0x0272), "@ SRT-2"); + Sphere.put(Long.valueOf(0x0273), "@ SRT-4"); + Sphere.put(Long.valueOf(0x0274), "@ SRT-6"); + Sphere.put(Long.valueOf(0x0275), "@ Streak LRM-5"); + Sphere.put(Long.valueOf(0x0276), "@ Streak LRM-10"); + Sphere.put(Long.valueOf(0x0277), "@ Streak LRM-15"); + Sphere.put(Long.valueOf(0x0278), "@ Streak LRM-20"); + Sphere.put(Long.valueOf(0x02b3), "(IS) @ Heavy Gauss Rifle"); // 1db-1de = is // 1d2-1d5 = cl // 298-299 = thb // 22B-22E = IS on clan // 246-249 = clan on IS - Sphere.put(new Long(0x1000001dbL), "(IS) @ LB 2-X AC (Cluster)"); - Sphere.put(new Long(0x1000001dcL), "(IS) @ LB 5-X AC (Cluster)"); - Sphere.put(new Long(0x1000001ddL), "(IS) @ LB 10-X AC (Cluster)"); - Sphere.put(new Long(0x1000001deL), "(IS) @ LB 20-X AC (Cluster)"); - Sphere.put(new Long(0x100000246L), "(CL) @ LB 2-X AC (Cluster)"); - Sphere.put(new Long(0x100000247L), "(CL) @ LB 5-X AC (Cluster)"); - Sphere.put(new Long(0x100000248L), "(CL) @ LB 10-X AC (Cluster)"); - Sphere.put(new Long(0x100000249L), "(CL) @ LB 20-X AC (Cluster)"); - // Clan.put(new Long(0x01ce), "CLAC2 Ammo"); - Clan.put(new Long(0x01d0), "(CL) @ Anti-Missile System"); - // Clan.put(new Long(0x01cf), "CLAC5 Ammo"); - Clan.put(new Long(0x01d1), "@ Gauss Rifle"); - Clan.put(new Long(0x01d2), "(CL) @ LB 2-X AC (Slug)"); - Clan.put(new Long(0x01d3), "(CL) @ LB 5-X AC (Slug)"); - Clan.put(new Long(0x01d4), "(CL) @ LB 10-X AC (Slug)"); - Clan.put(new Long(0x01d5), "(CL) @ LB 20-X AC (Slug)"); - Clan.put(new Long(0x01d6), "@ Machine Gun"); - Clan.put(new Long(0x01d7), "(CL) @ Ultra AC/2"); - Clan.put(new Long(0x01d8), "(CL) @ Ultra AC/5"); - Clan.put(new Long(0x01d9), "(CL) @ Ultra AC/10"); - Clan.put(new Long(0x01da), "(CL) @ Ultra AC/20"); - Clan.put(new Long(0x01db), "(CL) @ LRM-5"); - Clan.put(new Long(0x01dc), "(CL) @ LRM-10"); - Clan.put(new Long(0x01dd), "(CL) @ LRM-15"); - Clan.put(new Long(0x01de), "(CL) @ LRM-20"); - Clan.put(new Long(0x01df), "@ SRM-2"); - Clan.put(new Long(0x01e0), "@ SRM-4"); - Clan.put(new Long(0x01e1), "@ SRM-6"); - Clan.put(new Long(0x01e2), "(CL) @ Streak SRM-2"); - Clan.put(new Long(0x01e3), "(CL) @ Streak SRM-4"); - Clan.put(new Long(0x01e4), "(CL) @ Streak SRM-6"); - Clan.put(new Long(0x01e5), "(CL) @ Arrow IV (Homing)"); - Clan.put(new Long(0x01e9), "(CL) @ Narc (Homing)"); - // Clan.put(new Long(0x0215), "CLFlamer Ammo"); - Clan.put(new Long(0x01f0), "(CL) @ LRM-5"); - Clan.put(new Long(0x01f1), "(CL) @ LRM-10"); - Clan.put(new Long(0x01f2), "(CL) @ LRM-15"); - Clan.put(new Long(0x01f3), "(CL) @ LRM-20"); - Clan.put(new Long(0x01f6), "@ Vehicle Flamer"); - Clan.put(new Long(0x01f8), "@ Sniper"); - Clan.put(new Long(0x01f9), "@ Thumper"); - Clan.put(new Long(0x01fa), "(CL) @ LRT-5 (Torpedo)"); - Clan.put(new Long(0x01fb), "(CL) @ LRT-10 (Torpedo)"); - Clan.put(new Long(0x01fc), "(CL) @ LRT-15 (Torpedo)"); - Clan.put(new Long(0x01fd), "(CL) @ LRT-20 (Torpedo)"); - Clan.put(new Long(0x01fe), "@ SRT-2"); - Clan.put(new Long(0x01ff), "@ SRT-4"); - Clan.put(new Long(0x0200), "@ SRT-6"); - Clan.put(new Long(0x0201), "@ Streak LRM-5"); - Clan.put(new Long(0x0202), "@ Streak LRM-10"); - Clan.put(new Long(0x0203), "@ Streak LRM-15"); - Clan.put(new Long(0x0204), "@ Streak LRM-20"); - Clan.put(new Long(0x021E), "@ AC/2"); - Clan.put(new Long(0x021F), "@ AC/5"); - Clan.put(new Long(0x0220), "@ AC/10"); - Clan.put(new Long(0x0221), "@ AC/20"); - Clan.put(new Long(0x0222), "(IS) @ Anti-Missile System"); - Clan.put(new Long(0x0223), "@ Long Tom Cannon"); - Clan.put(new Long(0x0224), "@ Sniper Cannon"); - Clan.put(new Long(0x0225), "@ Thumper Cannon"); - Clan.put(new Long(0x0226), "(IS) @ Light Gauss Rifle"); - Clan.put(new Long(0x0227), "@ Gauss Rifle"); - // Clan.put(new Long(0x0228), "CLSRTorpedo6 Ammo"); - Clan.put(new Long(0x022B), "(IS) @ LB 2-X AC (Slug)"); - Clan.put(new Long(0x022C), "(IS) @ LB 5-X AC (Slug)"); - Clan.put(new Long(0x022D), "(IS) @ LB 10-X AC (Slug)"); - Clan.put(new Long(0x022E), "(IS) @ LB 20-X AC (Slug)"); - Clan.put(new Long(0x022F), "@ Machine Gun"); - Clan.put(new Long(0x0230), "@ Light AC/2"); - Clan.put(new Long(0x0231), "@ Light AC/5"); - Clan.put(new Long(0x0234), "(IS) @ Ultra AC/2"); - Clan.put(new Long(0x0235), "(IS) @ Ultra AC/5"); - Clan.put(new Long(0x0236), "(IS) @ Ultra AC/10"); - Clan.put(new Long(0x0237), "(IS) @ Ultra AC/20"); - Clan.put(new Long(0x023d), "@ Light Machine Gun"); - Clan.put(new Long(0x023e), "@ Heavy Machine Gun"); - Clan.put(new Long(0x0240), "(IS) @ LRM-5"); - Clan.put(new Long(0x0241), "(IS) @ LRM-10"); - Clan.put(new Long(0x0242), "(IS) @ LRM-15"); - Clan.put(new Long(0x0243), "(IS) @ LRM-20"); - Clan.put(new Long(0x0246), "@ iNarc (Homing)"); - Clan.put(new Long(0x0247), "@ SRM-2"); - Clan.put(new Long(0x0248), "@ SRM-4"); - Clan.put(new Long(0x0249), "@ SRM-6"); - Clan.put(new Long(0x024A), "(IS) @ Streak SRM-2"); - Clan.put(new Long(0x024B), "(IS) @ Streak SRM-4"); - Clan.put(new Long(0x024C), "(IS) @ Streak SRM-6"); - Clan.put(new Long(0x024D), "@ Thunderbolt-5"); - Clan.put(new Long(0x024E), "@ Thunderbolt-10"); - Clan.put(new Long(0x024F), "@ Thunderbolt-15"); - Clan.put(new Long(0x0250), "@ Thunderbolt-20"); - Clan.put(new Long(0x0259), "(IS) @ Narc (Homing)"); - Clan.put(new Long(0x0265), "@ Vehicle Flamer"); - Clan.put(new Long(0x0267), "@ Sniper"); - Clan.put(new Long(0x0268), "@ Thumper"); - Clan.put(new Long(0x0269), "(IS) @ MRM-10"); - Clan.put(new Long(0x026A), "(IS) @ MRM-20"); - Clan.put(new Long(0x026B), "(IS) @ MRM-30"); - Clan.put(new Long(0x026C), "(IS) @ MRM-40"); - Clan.put(new Long(0x0272), "(IS) @ LRT-15 (Torpedo)"); - Clan.put(new Long(0x0273), "(IS) @ LRT-20 (Torpedo)"); - Clan.put(new Long(0x0274), "(IS) @ LRT-5 (Torpedo)"); - Clan.put(new Long(0x0275), "(IS) @ LRT-10 (Torpedo)"); - Clan.put(new Long(0x0276), "@ SRT-4"); - Clan.put(new Long(0x0277), "@ SRT-2"); - Clan.put(new Long(0x0278), "@ SRT-6"); - Clan.put(new Long(0x10000022bL), "(IS) @ LB 2-X AC (Slug)"); - Clan.put(new Long(0x10000022cL), "(IS) @ LB 5-X AC (Slug)"); - Clan.put(new Long(0x10000022dL), "(IS) @ LB 10-X AC (Slug)"); - Clan.put(new Long(0x10000022eL), "(IS) @ LB 20-X AC (Slug)"); - Clan.put(new Long(0x1000001d2L), "(CL) @ LB 2-X AC (Cluster)"); - Clan.put(new Long(0x1000001d3L), "(CL) @ LB 5-X AC (Cluster)"); - Clan.put(new Long(0x1000001d4L), "(CL) @ LB 10-X AC (Cluster)"); - Clan.put(new Long(0x1000001d5L), "(CL) @ LB 20-X AC (Cluster)"); + Sphere.put(Long.valueOf(0x1000001dbL), "(IS) @ LB 2-X AC (Cluster)"); + Sphere.put(Long.valueOf(0x1000001dcL), "(IS) @ LB 5-X AC (Cluster)"); + Sphere.put(Long.valueOf(0x1000001ddL), "(IS) @ LB 10-X AC (Cluster)"); + Sphere.put(Long.valueOf(0x1000001deL), "(IS) @ LB 20-X AC (Cluster)"); + Sphere.put(Long.valueOf(0x100000246L), "(CL) @ LB 2-X AC (Cluster)"); + Sphere.put(Long.valueOf(0x100000247L), "(CL) @ LB 5-X AC (Cluster)"); + Sphere.put(Long.valueOf(0x100000248L), "(CL) @ LB 10-X AC (Cluster)"); + Sphere.put(Long.valueOf(0x100000249L), "(CL) @ LB 20-X AC (Cluster)"); + // Clan.put(Long.valueOf(0x01ce), "CLAC2 Ammo"); + Clan.put(Long.valueOf(0x01d0), "(CL) @ Anti-Missile System"); + // Clan.put(Long.valueOf(0x01cf), "CLAC5 Ammo"); + Clan.put(Long.valueOf(0x01d1), "@ Gauss Rifle"); + Clan.put(Long.valueOf(0x01d2), "(CL) @ LB 2-X AC (Slug)"); + Clan.put(Long.valueOf(0x01d3), "(CL) @ LB 5-X AC (Slug)"); + Clan.put(Long.valueOf(0x01d4), "(CL) @ LB 10-X AC (Slug)"); + Clan.put(Long.valueOf(0x01d5), "(CL) @ LB 20-X AC (Slug)"); + Clan.put(Long.valueOf(0x01d6), "@ Machine Gun"); + Clan.put(Long.valueOf(0x01d7), "(CL) @ Ultra AC/2"); + Clan.put(Long.valueOf(0x01d8), "(CL) @ Ultra AC/5"); + Clan.put(Long.valueOf(0x01d9), "(CL) @ Ultra AC/10"); + Clan.put(Long.valueOf(0x01da), "(CL) @ Ultra AC/20"); + Clan.put(Long.valueOf(0x01db), "(CL) @ LRM-5"); + Clan.put(Long.valueOf(0x01dc), "(CL) @ LRM-10"); + Clan.put(Long.valueOf(0x01dd), "(CL) @ LRM-15"); + Clan.put(Long.valueOf(0x01de), "(CL) @ LRM-20"); + Clan.put(Long.valueOf(0x01df), "@ SRM-2"); + Clan.put(Long.valueOf(0x01e0), "@ SRM-4"); + Clan.put(Long.valueOf(0x01e1), "@ SRM-6"); + Clan.put(Long.valueOf(0x01e2), "(CL) @ Streak SRM-2"); + Clan.put(Long.valueOf(0x01e3), "(CL) @ Streak SRM-4"); + Clan.put(Long.valueOf(0x01e4), "(CL) @ Streak SRM-6"); + Clan.put(Long.valueOf(0x01e5), "(CL) @ Arrow IV (Homing)"); + Clan.put(Long.valueOf(0x01e9), "(CL) @ Narc (Homing)"); + // Clan.put(Long.valueOf(0x0215), "CLFlamer Ammo"); + Clan.put(Long.valueOf(0x01f0), "(CL) @ LRM-5"); + Clan.put(Long.valueOf(0x01f1), "(CL) @ LRM-10"); + Clan.put(Long.valueOf(0x01f2), "(CL) @ LRM-15"); + Clan.put(Long.valueOf(0x01f3), "(CL) @ LRM-20"); + Clan.put(Long.valueOf(0x01f6), "@ Vehicle Flamer"); + Clan.put(Long.valueOf(0x01f8), "@ Sniper"); + Clan.put(Long.valueOf(0x01f9), "@ Thumper"); + Clan.put(Long.valueOf(0x01fa), "(CL) @ LRT-5 (Torpedo)"); + Clan.put(Long.valueOf(0x01fb), "(CL) @ LRT-10 (Torpedo)"); + Clan.put(Long.valueOf(0x01fc), "(CL) @ LRT-15 (Torpedo)"); + Clan.put(Long.valueOf(0x01fd), "(CL) @ LRT-20 (Torpedo)"); + Clan.put(Long.valueOf(0x01fe), "@ SRT-2"); + Clan.put(Long.valueOf(0x01ff), "@ SRT-4"); + Clan.put(Long.valueOf(0x0200), "@ SRT-6"); + Clan.put(Long.valueOf(0x0201), "@ Streak LRM-5"); + Clan.put(Long.valueOf(0x0202), "@ Streak LRM-10"); + Clan.put(Long.valueOf(0x0203), "@ Streak LRM-15"); + Clan.put(Long.valueOf(0x0204), "@ Streak LRM-20"); + Clan.put(Long.valueOf(0x021E), "@ AC/2"); + Clan.put(Long.valueOf(0x021F), "@ AC/5"); + Clan.put(Long.valueOf(0x0220), "@ AC/10"); + Clan.put(Long.valueOf(0x0221), "@ AC/20"); + Clan.put(Long.valueOf(0x0222), "(IS) @ Anti-Missile System"); + Clan.put(Long.valueOf(0x0223), "@ Long Tom Cannon"); + Clan.put(Long.valueOf(0x0224), "@ Sniper Cannon"); + Clan.put(Long.valueOf(0x0225), "@ Thumper Cannon"); + Clan.put(Long.valueOf(0x0226), "(IS) @ Light Gauss Rifle"); + Clan.put(Long.valueOf(0x0227), "@ Gauss Rifle"); + // Clan.put(Long.valueOf(0x0228), "CLSRTorpedo6 Ammo"); + Clan.put(Long.valueOf(0x022B), "(IS) @ LB 2-X AC (Slug)"); + Clan.put(Long.valueOf(0x022C), "(IS) @ LB 5-X AC (Slug)"); + Clan.put(Long.valueOf(0x022D), "(IS) @ LB 10-X AC (Slug)"); + Clan.put(Long.valueOf(0x022E), "(IS) @ LB 20-X AC (Slug)"); + Clan.put(Long.valueOf(0x022F), "@ Machine Gun"); + Clan.put(Long.valueOf(0x0230), "@ Light AC/2"); + Clan.put(Long.valueOf(0x0231), "@ Light AC/5"); + Clan.put(Long.valueOf(0x0234), "(IS) @ Ultra AC/2"); + Clan.put(Long.valueOf(0x0235), "(IS) @ Ultra AC/5"); + Clan.put(Long.valueOf(0x0236), "(IS) @ Ultra AC/10"); + Clan.put(Long.valueOf(0x0237), "(IS) @ Ultra AC/20"); + Clan.put(Long.valueOf(0x023d), "@ Light Machine Gun"); + Clan.put(Long.valueOf(0x023e), "@ Heavy Machine Gun"); + Clan.put(Long.valueOf(0x0240), "(IS) @ LRM-5"); + Clan.put(Long.valueOf(0x0241), "(IS) @ LRM-10"); + Clan.put(Long.valueOf(0x0242), "(IS) @ LRM-15"); + Clan.put(Long.valueOf(0x0243), "(IS) @ LRM-20"); + Clan.put(Long.valueOf(0x0246), "@ iNarc (Homing)"); + Clan.put(Long.valueOf(0x0247), "@ SRM-2"); + Clan.put(Long.valueOf(0x0248), "@ SRM-4"); + Clan.put(Long.valueOf(0x0249), "@ SRM-6"); + Clan.put(Long.valueOf(0x024A), "(IS) @ Streak SRM-2"); + Clan.put(Long.valueOf(0x024B), "(IS) @ Streak SRM-4"); + Clan.put(Long.valueOf(0x024C), "(IS) @ Streak SRM-6"); + Clan.put(Long.valueOf(0x024D), "@ Thunderbolt-5"); + Clan.put(Long.valueOf(0x024E), "@ Thunderbolt-10"); + Clan.put(Long.valueOf(0x024F), "@ Thunderbolt-15"); + Clan.put(Long.valueOf(0x0250), "@ Thunderbolt-20"); + Clan.put(Long.valueOf(0x0259), "(IS) @ Narc (Homing)"); + Clan.put(Long.valueOf(0x0265), "@ Vehicle Flamer"); + Clan.put(Long.valueOf(0x0267), "@ Sniper"); + Clan.put(Long.valueOf(0x0268), "@ Thumper"); + Clan.put(Long.valueOf(0x0269), "(IS) @ MRM-10"); + Clan.put(Long.valueOf(0x026A), "(IS) @ MRM-20"); + Clan.put(Long.valueOf(0x026B), "(IS) @ MRM-30"); + Clan.put(Long.valueOf(0x026C), "(IS) @ MRM-40"); + Clan.put(Long.valueOf(0x0272), "(IS) @ LRT-15 (Torpedo)"); + Clan.put(Long.valueOf(0x0273), "(IS) @ LRT-20 (Torpedo)"); + Clan.put(Long.valueOf(0x0274), "(IS) @ LRT-5 (Torpedo)"); + Clan.put(Long.valueOf(0x0275), "(IS) @ LRT-10 (Torpedo)"); + Clan.put(Long.valueOf(0x0276), "@ SRT-4"); + Clan.put(Long.valueOf(0x0277), "@ SRT-2"); + Clan.put(Long.valueOf(0x0278), "@ SRT-6"); + Clan.put(Long.valueOf(0x10000022bL), "(IS) @ LB 2-X AC (Slug)"); + Clan.put(Long.valueOf(0x10000022cL), "(IS) @ LB 5-X AC (Slug)"); + Clan.put(Long.valueOf(0x10000022dL), "(IS) @ LB 10-X AC (Slug)"); + Clan.put(Long.valueOf(0x10000022eL), "(IS) @ LB 20-X AC (Slug)"); + Clan.put(Long.valueOf(0x1000001d2L), "(CL) @ LB 2-X AC (Cluster)"); + Clan.put(Long.valueOf(0x1000001d3L), "(CL) @ LB 5-X AC (Cluster)"); + Clan.put(Long.valueOf(0x1000001d4L), "(CL) @ LB 10-X AC (Cluster)"); + Clan.put(Long.valueOf(0x1000001d5L), "(CL) @ LB 20-X AC (Cluster)"); // unused items, from older books usually - Unused.put(new Long(0x11D), "ISTHBAngelECMSuite"); - Unused.put(new Long(0x11E), "ISTHBBloodhoundActiveProbe"); - Unused.put(new Long(0x0216), "ISLongTom Ammo"); - Unused.put(new Long(0x026B), "CLLongTom Ammo"); - Unused.put(new Long(0x67), "CLLongTomArtillery"); - Unused.put(new Long(0x75), "CLGrenadeLauncher"); - Unused.put(new Long(0xCF), "Thunderbolt (OS)"); - Unused.put(new Long(0xD6), "ISLongTomArtillery"); - Unused.put(new Long(0xDD), "Grenade Launcher"); - Unused.put(new Long(0x01f7), "CLLongTom Ammo"); - Unused.put(new Long(0x0266), "Long Tom Ammo"); - Unused.put(new Long(0x2b6), "CLRotaryAC10 Ammo"); - Unused.put(new Long(0x2b7), "CLRotaryAC20 Ammo"); - Unused.put(new Long(0x2BC), "Mortar/1 Ammo (THB)"); - Unused.put(new Long(0x2BD), "Mortar/2 Ammo (THB)"); - Unused.put(new Long(0x2BE), "Mortar/4 Ammo (THB)"); - Unused.put(new Long(0x2BF), "Mortar/8 Ammo (THB)"); - Unused.put(new Long(0x29E), "ELRM-5 Ammo (THB)"); - Unused.put(new Long(0x29F), "ELRM-10 Ammo (THB)"); - Unused.put(new Long(0x2A0), "ELRM-15 Ammo (THB)"); - Unused.put(new Long(0x2A1), "ELRM-20 Ammo (THB)"); - Unused.put(new Long(0x2A2), "LR DFM-5 Ammo (THB)"); - Unused.put(new Long(0x2A3), "LR DFM-10 Ammo (THB)"); - Unused.put(new Long(0x2A4), "LR DFM-15 Ammo (THB)"); - Unused.put(new Long(0x2A5), "LR DFM-20 Ammo (THB)"); - Unused.put(new Long(0x2A6), "SR DFM-2 Ammo (THB)"); - Unused.put(new Long(0x2A7), "SR DFM-4 Ammo (THB)"); - Unused.put(new Long(0x2A8), "SR DFM-6 Ammo (THB)"); - Unused.put(new Long(0x2A9), "Thunderbolt-5 Ammo (THB)"); - Unused.put(new Long(0x2AA), "Thunderbolt-10 Ammo (THB)"); - Unused.put(new Long(0x2AB), "Thunderbolt-15 Ammo (THB)"); - Unused.put(new Long(0x2AC), "Thunderbolt-20 Ammo (THB)"); - Unused.put(new Long(0x24), "Blue Shield (UB)"); - Unused.put(new Long(0x86), "ISLongTomArtillery"); - Unused.put(new Long(0x8D), "Grenade Launcher"); - Unused.put(new Long(0xCF), "Thunderbolt (OS)"); - Unused.put(new Long(0xDB), "CLLongTomArtillery"); - Unused.put(new Long(0xE9), "CLGrenadeLauncher"); - Unused.put(new Long(0x290), "SB Gauss Rifle Ammo (UB)"); - Unused.put(new Long(0x291), "Caseless AC/2 Ammo (THB)"); - Unused.put(new Long(0x292), "Caseless AC/5 Ammo (THB)"); - Unused.put(new Long(0x293), "Caseless AC/10 Ammo (THB)"); - Unused.put(new Long(0x294), "Caseless AC/20 Ammo (THB)"); - Unused.put(new Long(0x295), "Heavy AC/2 Ammo (THB)"); - Unused.put(new Long(0x296), "Heavy AC/5 Ammo (THB)"); - Unused.put(new Long(0x297), "Heavy AC/10 Ammo (THB)"); - Unused.put(new Long(0x298), "ISLBXAC2 Ammo (THB)"); - Unused.put(new Long(0x299), "ISLBXAC5 Ammo (THB)"); - Unused.put(new Long(0x29A), "ISLBXAC20 Ammo (THB)"); - Unused.put(new Long(0x29B), "IS Ultra AC/2 Ammo (THB)"); - Unused.put(new Long(0x29C), "IS Ultra AC/10 Ammo (THB)"); - Unused.put(new Long(0x29D), "IS Ultra AC/20 Ammo (THB)"); - Unused.put(new Long(0x133), "CLStreakLRM5 (OS)"); // ? - Unused.put(new Long(0x134), "CLStreakLRM10 (OS)"); // ? - Unused.put(new Long(0x135), "CLStreakLRM15 (OS)");// ? - Unused.put(new Long(0x136), "CLStreakLRM20 (OS)");// ? - Unused.put(new Long(0x12C), "Mortar/1 (THB)"); - Unused.put(new Long(0x12D), "Mortar/2 (THB)"); - Unused.put(new Long(0x12E), "Mortar/4 (THB)"); - Unused.put(new Long(0x12F), "Mortar/8 (THB)"); - Unused.put(new Long(0x100), "SB Gauss Rifle (UB)"); - Unused.put(new Long(0x101), "Caseless AC/2 (THB)"); - Unused.put(new Long(0x102), "Caseless AC/5 (THB)"); - Unused.put(new Long(0x103), "Caseless AC/10 (THB)"); - Unused.put(new Long(0x104), "Caseless AC/20 (THB)"); - Unused.put(new Long(0x105), "Heavy AC/2 (THB)"); - Unused.put(new Long(0x106), "Heavy AC/5 (THB)"); - Unused.put(new Long(0x107), "Heavy AC/10 (THB)"); - Unused.put(new Long(0x108), "ISTHBLBXAC2"); - Unused.put(new Long(0x109), "ISTHBLBXAC5"); - Unused.put(new Long(0x10A), "ISTHBLBXAC20"); - Unused.put(new Long(0x10B), "ISUltraAC2 (THB)"); - Unused.put(new Long(0x10C), "ISUltraAC10 (THB)"); - Unused.put(new Long(0x10D), "ISUltraAC20 (THB)"); - Unused.put(new Long(0x10E), "ELRM-5 (THB)"); - Unused.put(new Long(0x10F), "ELRM-10 (THB)"); - Unused.put(new Long(0x110), "ELRM-15 (THB)"); - Unused.put(new Long(0x111), "ELRM-20 (THB)"); - Unused.put(new Long(0x112), "LR DFM-5 (THB)"); - Unused.put(new Long(0x113), "LR DFM-10 (THB)"); - Unused.put(new Long(0x114), "LR DFM-15 (THB)"); - Unused.put(new Long(0x115), "LR DFM-20 (THB)"); - Unused.put(new Long(0x116), "SR DFM-2 (THB)"); - Unused.put(new Long(0x117), "SR DFM-4 (THB)"); - Unused.put(new Long(0x118), "SR DFM-6 (THB)"); - Unused.put(new Long(0x119), "Thunderbolt-5 (THB)"); - Unused.put(new Long(0x11A), "Thunderbolt-10 (THB)"); - Unused.put(new Long(0x11B), "Thunderbolt-15 (THB)"); - Unused.put(new Long(0x11C), "Thunderbolt-20 (THB)"); - Unused.put(new Long(0x11F), "Watchdog ECM (THB)"); - Unused.put(new Long(0x120), "IS Laser AMS (THB)"); - Unused.put(new Long(0x2B), "Claw (THB)"); - Unused.put(new Long(0x2C), "Mace (THB)"); - Unused.put(new Long(0x2d), "Armored Cowl"); - Unused.put(new Long(0x2e), "Buzzsaw (UB)"); - Unused.put(new Long(0x13), "Turret"); - Unused.put(new Long(0x1a), "Variable Range TargSys"); - Unused.put(new Long(0x1b), "Multi-Trac II"); - Unused.put(new Long(0x1e), "Jump Booster"); - Unused.put(new Long(0x126), "CLRotaryAC10"); - Unused.put(new Long(0x127), "CLRotaryAC20"); + Unused.put(Long.valueOf(0x11D), "ISTHBAngelECMSuite"); + Unused.put(Long.valueOf(0x11E), "ISTHBBloodhoundActiveProbe"); + Unused.put(Long.valueOf(0x0216), "ISLongTom Ammo"); + Unused.put(Long.valueOf(0x026B), "CLLongTom Ammo"); + Unused.put(Long.valueOf(0x67), "CLLongTomArtillery"); + Unused.put(Long.valueOf(0x75), "CLGrenadeLauncher"); + Unused.put(Long.valueOf(0xCF), "Thunderbolt (OS)"); + Unused.put(Long.valueOf(0xD6), "ISLongTomArtillery"); + Unused.put(Long.valueOf(0xDD), "Grenade Launcher"); + Unused.put(Long.valueOf(0x01f7), "CLLongTom Ammo"); + Unused.put(Long.valueOf(0x0266), "Long Tom Ammo"); + Unused.put(Long.valueOf(0x2b6), "CLRotaryAC10 Ammo"); + Unused.put(Long.valueOf(0x2b7), "CLRotaryAC20 Ammo"); + Unused.put(Long.valueOf(0x2BC), "Mortar/1 Ammo (THB)"); + Unused.put(Long.valueOf(0x2BD), "Mortar/2 Ammo (THB)"); + Unused.put(Long.valueOf(0x2BE), "Mortar/4 Ammo (THB)"); + Unused.put(Long.valueOf(0x2BF), "Mortar/8 Ammo (THB)"); + Unused.put(Long.valueOf(0x29E), "ELRM-5 Ammo (THB)"); + Unused.put(Long.valueOf(0x29F), "ELRM-10 Ammo (THB)"); + Unused.put(Long.valueOf(0x2A0), "ELRM-15 Ammo (THB)"); + Unused.put(Long.valueOf(0x2A1), "ELRM-20 Ammo (THB)"); + Unused.put(Long.valueOf(0x2A2), "LR DFM-5 Ammo (THB)"); + Unused.put(Long.valueOf(0x2A3), "LR DFM-10 Ammo (THB)"); + Unused.put(Long.valueOf(0x2A4), "LR DFM-15 Ammo (THB)"); + Unused.put(Long.valueOf(0x2A5), "LR DFM-20 Ammo (THB)"); + Unused.put(Long.valueOf(0x2A6), "SR DFM-2 Ammo (THB)"); + Unused.put(Long.valueOf(0x2A7), "SR DFM-4 Ammo (THB)"); + Unused.put(Long.valueOf(0x2A8), "SR DFM-6 Ammo (THB)"); + Unused.put(Long.valueOf(0x2A9), "Thunderbolt-5 Ammo (THB)"); + Unused.put(Long.valueOf(0x2AA), "Thunderbolt-10 Ammo (THB)"); + Unused.put(Long.valueOf(0x2AB), "Thunderbolt-15 Ammo (THB)"); + Unused.put(Long.valueOf(0x2AC), "Thunderbolt-20 Ammo (THB)"); + Unused.put(Long.valueOf(0x24), "Blue Shield (UB)"); + Unused.put(Long.valueOf(0x86), "ISLongTomArtillery"); + Unused.put(Long.valueOf(0x8D), "Grenade Launcher"); + Unused.put(Long.valueOf(0xCF), "Thunderbolt (OS)"); + Unused.put(Long.valueOf(0xDB), "CLLongTomArtillery"); + Unused.put(Long.valueOf(0xE9), "CLGrenadeLauncher"); + Unused.put(Long.valueOf(0x290), "SB Gauss Rifle Ammo (UB)"); + Unused.put(Long.valueOf(0x291), "Caseless AC/2 Ammo (THB)"); + Unused.put(Long.valueOf(0x292), "Caseless AC/5 Ammo (THB)"); + Unused.put(Long.valueOf(0x293), "Caseless AC/10 Ammo (THB)"); + Unused.put(Long.valueOf(0x294), "Caseless AC/20 Ammo (THB)"); + Unused.put(Long.valueOf(0x295), "Heavy AC/2 Ammo (THB)"); + Unused.put(Long.valueOf(0x296), "Heavy AC/5 Ammo (THB)"); + Unused.put(Long.valueOf(0x297), "Heavy AC/10 Ammo (THB)"); + Unused.put(Long.valueOf(0x298), "ISLBXAC2 Ammo (THB)"); + Unused.put(Long.valueOf(0x299), "ISLBXAC5 Ammo (THB)"); + Unused.put(Long.valueOf(0x29A), "ISLBXAC20 Ammo (THB)"); + Unused.put(Long.valueOf(0x29B), "IS Ultra AC/2 Ammo (THB)"); + Unused.put(Long.valueOf(0x29C), "IS Ultra AC/10 Ammo (THB)"); + Unused.put(Long.valueOf(0x29D), "IS Ultra AC/20 Ammo (THB)"); + Unused.put(Long.valueOf(0x133), "CLStreakLRM5 (OS)"); // ? + Unused.put(Long.valueOf(0x134), "CLStreakLRM10 (OS)"); // ? + Unused.put(Long.valueOf(0x135), "CLStreakLRM15 (OS)");// ? + Unused.put(Long.valueOf(0x136), "CLStreakLRM20 (OS)");// ? + Unused.put(Long.valueOf(0x12C), "Mortar/1 (THB)"); + Unused.put(Long.valueOf(0x12D), "Mortar/2 (THB)"); + Unused.put(Long.valueOf(0x12E), "Mortar/4 (THB)"); + Unused.put(Long.valueOf(0x12F), "Mortar/8 (THB)"); + Unused.put(Long.valueOf(0x100), "SB Gauss Rifle (UB)"); + Unused.put(Long.valueOf(0x101), "Caseless AC/2 (THB)"); + Unused.put(Long.valueOf(0x102), "Caseless AC/5 (THB)"); + Unused.put(Long.valueOf(0x103), "Caseless AC/10 (THB)"); + Unused.put(Long.valueOf(0x104), "Caseless AC/20 (THB)"); + Unused.put(Long.valueOf(0x105), "Heavy AC/2 (THB)"); + Unused.put(Long.valueOf(0x106), "Heavy AC/5 (THB)"); + Unused.put(Long.valueOf(0x107), "Heavy AC/10 (THB)"); + Unused.put(Long.valueOf(0x108), "ISTHBLBXAC2"); + Unused.put(Long.valueOf(0x109), "ISTHBLBXAC5"); + Unused.put(Long.valueOf(0x10A), "ISTHBLBXAC20"); + Unused.put(Long.valueOf(0x10B), "ISUltraAC2 (THB)"); + Unused.put(Long.valueOf(0x10C), "ISUltraAC10 (THB)"); + Unused.put(Long.valueOf(0x10D), "ISUltraAC20 (THB)"); + Unused.put(Long.valueOf(0x10E), "ELRM-5 (THB)"); + Unused.put(Long.valueOf(0x10F), "ELRM-10 (THB)"); + Unused.put(Long.valueOf(0x110), "ELRM-15 (THB)"); + Unused.put(Long.valueOf(0x111), "ELRM-20 (THB)"); + Unused.put(Long.valueOf(0x112), "LR DFM-5 (THB)"); + Unused.put(Long.valueOf(0x113), "LR DFM-10 (THB)"); + Unused.put(Long.valueOf(0x114), "LR DFM-15 (THB)"); + Unused.put(Long.valueOf(0x115), "LR DFM-20 (THB)"); + Unused.put(Long.valueOf(0x116), "SR DFM-2 (THB)"); + Unused.put(Long.valueOf(0x117), "SR DFM-4 (THB)"); + Unused.put(Long.valueOf(0x118), "SR DFM-6 (THB)"); + Unused.put(Long.valueOf(0x119), "Thunderbolt-5 (THB)"); + Unused.put(Long.valueOf(0x11A), "Thunderbolt-10 (THB)"); + Unused.put(Long.valueOf(0x11B), "Thunderbolt-15 (THB)"); + Unused.put(Long.valueOf(0x11C), "Thunderbolt-20 (THB)"); + Unused.put(Long.valueOf(0x11F), "Watchdog ECM (THB)"); + Unused.put(Long.valueOf(0x120), "IS Laser AMS (THB)"); + Unused.put(Long.valueOf(0x2B), "Claw (THB)"); + Unused.put(Long.valueOf(0x2C), "Mace (THB)"); + Unused.put(Long.valueOf(0x2d), "Armored Cowl"); + Unused.put(Long.valueOf(0x2e), "Buzzsaw (UB)"); + Unused.put(Long.valueOf(0x13), "Turret"); + Unused.put(Long.valueOf(0x1a), "Variable Range TargSys"); + Unused.put(Long.valueOf(0x1b), "Multi-Trac II"); + Unused.put(Long.valueOf(0x1e), "Jump Booster"); + Unused.put(Long.valueOf(0x126), "CLRotaryAC10"); + Unused.put(Long.valueOf(0x127), "CLRotaryAC20"); } private int DecodeRulesLevel( int OldRules ) { @@ -1998,7 +1999,7 @@ private boolean IsRearMounted( long critical ) { private Long GetLookupNum( long l ) { // According to HMPFile.java, this will return the actual lookup number. // the first two bytes of the critical location number are the type. - Long retval = new Long( l & 0xFFFF ); + Long retval = Long.valueOf( l & 0xFFFF ); return retval; } From 67cd60b4facfac9d77ac301bf5696ea3b2bad659 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Wed, 9 Dec 2020 21:58:35 -0600 Subject: [PATCH 004/126] Added serialVersionUID Added types to Tempaltes --- ssw/src/main/java/ssw/gui/dlgPrefs.java | 86 ++++++++++++------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/ssw/src/main/java/ssw/gui/dlgPrefs.java b/ssw/src/main/java/ssw/gui/dlgPrefs.java index 09ed407b..59be637f 100644 --- a/ssw/src/main/java/ssw/gui/dlgPrefs.java +++ b/ssw/src/main/java/ssw/gui/dlgPrefs.java @@ -46,6 +46,7 @@ import ssw.constants.SSWConstants; public class dlgPrefs extends javax.swing.JDialog { + private static final long serialVersionUID = -8888473432146683096L; private Preferences Prefs; @@ -250,7 +251,6 @@ private void SetDefaults() { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; @@ -262,10 +262,10 @@ private void initComponents() { jTabbedPane1 = new javax.swing.JTabbedPane(); pnlConstruction = new javax.swing.JPanel(); jPanel1 = new javax.swing.JPanel(); - cmbRulesLevel = new javax.swing.JComboBox(); - cmbEra = new javax.swing.JComboBox(); - cmbTechbase = new javax.swing.JComboBox(); - cmbHeatSinks = new javax.swing.JComboBox(); + cmbRulesLevel = new javax.swing.JComboBox(); + cmbEra = new javax.swing.JComboBox(); + cmbTechbase = new javax.swing.JComboBox(); + cmbHeatSinks = new javax.swing.JComboBox(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); @@ -368,7 +368,7 @@ private void initComponents() { jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "New 'Mech Defaults")); jPanel1.setLayout(new java.awt.GridBagLayout()); - cmbRulesLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Introductory", "Tournament Legal", "Advanced Rules", "Experimental Tech", "Era Specific" })); + cmbRulesLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Introductory", "Tournament Legal", "Advanced Rules", "Experimental Tech", "Era Specific" })); cmbRulesLevel.setSelectedIndex(1); cmbRulesLevel.setMaximumSize(new java.awt.Dimension(150, 20)); cmbRulesLevel.setMinimumSize(new java.awt.Dimension(150, 20)); @@ -383,7 +383,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { gridBagConstraints.gridy = 0; jPanel1.add(cmbRulesLevel, gridBagConstraints); - cmbEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Age of War/Star League", "Succession Wars", "Clan Invasion", "Dark Ages", "All Eras (non-canon)" })); + cmbEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Age of War/Star League", "Succession Wars", "Clan Invasion", "Dark Ages", "All Eras (non-canon)" })); cmbEra.setMaximumSize(new java.awt.Dimension(150, 20)); cmbEra.setMinimumSize(new java.awt.Dimension(150, 20)); cmbEra.setPreferredSize(new java.awt.Dimension(150, 20)); @@ -397,7 +397,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { gridBagConstraints.gridy = 1; jPanel1.add(cmbEra, gridBagConstraints); - cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan", "Mixed" })); + cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan", "Mixed" })); cmbTechbase.setMaximumSize(new java.awt.Dimension(150, 20)); cmbTechbase.setMinimumSize(new java.awt.Dimension(150, 20)); cmbTechbase.setPreferredSize(new java.awt.Dimension(150, 20)); @@ -411,7 +411,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { gridBagConstraints.gridy = 2; jPanel1.add(cmbTechbase, gridBagConstraints); - cmbHeatSinks.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Single Heat Sinks", "Double Heat Sinks", "Laser Heat Sinks", "Compact Heat Sinks" })); + cmbHeatSinks.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Single Heat Sinks", "Double Heat Sinks", "Laser Heat Sinks", "Compact Heat Sinks" })); cmbHeatSinks.setMaximumSize(new java.awt.Dimension(150, 20)); cmbHeatSinks.setMinimumSize(new java.awt.Dimension(150, 20)); cmbHeatSinks.setPreferredSize(new java.awt.Dimension(150, 20)); @@ -1469,59 +1469,59 @@ private void btnMTFPathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI private void cmbEraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbEraActionPerformed switch( cmbEra.getSelectedIndex() ) { case AvailableCode.ERA_STAR_LEAGUE: - cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel( new String[] { "Inner Sphere" })); + cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel( new String[] { "Inner Sphere" })); switch( cmbRulesLevel.getSelectedIndex() ) { case AvailableCode.RULES_INTRODUCTORY: - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink" } ) ); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink" } ) ); break; default: - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); break; } break; case AvailableCode.ERA_SUCCESSION: switch( cmbRulesLevel.getSelectedIndex() ) { case AvailableCode.RULES_INTRODUCTORY: - cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere" })); - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink" } ) ); + cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere" })); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink" } ) ); break; case AvailableCode.RULES_TOURNAMENT: - cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan" })); - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); + cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan" })); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); break; case AvailableCode.RULES_EXPERIMENTAL: case AvailableCode.RULES_ERA_SPECIFIC: - cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan", "Mixed" })); + cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan", "Mixed" })); if( cmbTechbase.getSelectedIndex() == 3 ) { - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "(IS) Double Heat Sink", "(CL) Double Heat Sink" } ) ); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "(IS) Double Heat Sink", "(CL) Double Heat Sink" } ) ); } else { - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); } default: - cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan" })); - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); + cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan" })); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); break; } break; case AvailableCode.ERA_CLAN_INVASION: case AvailableCode.ERA_DARK_AGES: case AvailableCode.ERA_ALL: switch( cmbRulesLevel.getSelectedIndex() ) { case AvailableCode.RULES_INTRODUCTORY: - cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere" })); - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink" } ) ); + cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere" })); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink" } ) ); break; case AvailableCode.RULES_TOURNAMENT: - cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan" })); - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); + cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan" })); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); break; case AvailableCode.RULES_EXPERIMENTAL: case AvailableCode.RULES_ERA_SPECIFIC: - cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan", "Mixed" })); + cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan", "Mixed" })); if( cmbTechbase.getSelectedIndex() == AvailableCode.TECH_BOTH ) { - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "(IS) Double Heat Sink", "(CL) Double Heat Sink", "Compact Heat Sink", "Laser Heat Sink" } ) ); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "(IS) Double Heat Sink", "(CL) Double Heat Sink", "Compact Heat Sink", "Laser Heat Sink" } ) ); } else { - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink", "Compact Heat Sink", "Laser Heat Sink" } ) ); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink", "Compact Heat Sink", "Laser Heat Sink" } ) ); } default: - cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan" })); - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); + cmbTechbase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan" })); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); break; } break; @@ -1537,17 +1537,17 @@ private void cmbTechbaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F case AvailableCode.TECH_INNER_SPHERE: switch( cmbRulesLevel.getSelectedIndex() ) { case AvailableCode.RULES_INTRODUCTORY: - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink" } ) ); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink" } ) ); break; case AvailableCode.RULES_EXPERIMENTAL: case AvailableCode.RULES_ERA_SPECIFIC: if( cmbEra.getSelectedIndex() >= AvailableCode.ERA_CLAN_INVASION ) { - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink", "Compact Heat Sink" } ) ); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink", "Compact Heat Sink" } ) ); } else { - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); } break; default: - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); break; } break; @@ -1555,21 +1555,21 @@ private void cmbTechbaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F switch( cmbRulesLevel.getSelectedIndex() ) { case AvailableCode.RULES_EXPERIMENTAL: case AvailableCode.RULES_ERA_SPECIFIC: if( cmbEra.getSelectedIndex() >= AvailableCode.ERA_CLAN_INVASION ) { - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink", "Laser Heat Sink" } ) ); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink", "Laser Heat Sink" } ) ); } else { - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); } break; default: - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "Double Heat Sink" } ) ); break; } break; case AvailableCode.TECH_BOTH: if( cmbEra.getSelectedIndex() >= AvailableCode.ERA_CLAN_INVASION ) { - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "(IS) Double Heat Sink", "(CL) Double Heat Sink", "Compact Heat Sink", "Laser Heat Sink" } ) ); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "(IS) Double Heat Sink", "(CL) Double Heat Sink", "Compact Heat Sink", "Laser Heat Sink" } ) ); } else { - cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "(IS) Double Heat Sink", "(CL) Double Heat Sink" } ) ); + cmbHeatSinks.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Single Heat Sink", "(IS) Double Heat Sink", "(CL) Double Heat Sink" } ) ); } break; } @@ -1665,10 +1665,10 @@ private void btnDefaultImagePathActionPerformed(java.awt.event.ActionEvent evt) private javax.swing.JCheckBox chkLoadLastMech; private javax.swing.JCheckBox chkMaxNotInt; private javax.swing.JCheckBox chkUpdateStartup; - private javax.swing.JComboBox cmbEra; - private javax.swing.JComboBox cmbHeatSinks; - private javax.swing.JComboBox cmbRulesLevel; - private javax.swing.JComboBox cmbTechbase; + private javax.swing.JComboBox cmbEra; + private javax.swing.JComboBox cmbHeatSinks; + private javax.swing.JComboBox cmbRulesLevel; + private javax.swing.JComboBox cmbTechbase; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; From 673740a614b4204a3c2acaded727673d16308748 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Wed, 9 Dec 2020 22:20:36 -0600 Subject: [PATCH 005/126] Deprication removals Serial IDs Template Declarations with Types --- BFB/src/main/java/BFB/GUI/dlgAbout.java | 3 +-- .../main/java/BFB/GUI/dlgAdvancedSearch.java | 26 +++++++++--------- BFB/src/main/java/BFB/GUI/dlgBalance.java | 27 ++++++++++--------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/BFB/src/main/java/BFB/GUI/dlgAbout.java b/BFB/src/main/java/BFB/GUI/dlgAbout.java index ea3ffe31..6c484e44 100644 --- a/BFB/src/main/java/BFB/GUI/dlgAbout.java +++ b/BFB/src/main/java/BFB/GUI/dlgAbout.java @@ -32,6 +32,7 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * @author gblouin */ public class dlgAbout extends javax.swing.JDialog { + private static final long serialVersionUID = 2091416214909819417L; /** Creates new form dlgAbout */ public dlgAbout() { @@ -43,7 +44,6 @@ public dlgAbout() { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { @@ -114,5 +114,4 @@ private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextPane txtAbout; // End of variables declaration//GEN-END:variables - } diff --git a/BFB/src/main/java/BFB/GUI/dlgAdvancedSearch.java b/BFB/src/main/java/BFB/GUI/dlgAdvancedSearch.java index a6da83a3..3ed64109 100644 --- a/BFB/src/main/java/BFB/GUI/dlgAdvancedSearch.java +++ b/BFB/src/main/java/BFB/GUI/dlgAdvancedSearch.java @@ -16,6 +16,7 @@ * @author gblouin */ public class dlgAdvancedSearch extends javax.swing.JDialog { + private static final long serialVersionUID = -1887334518951060000L; /** Creates new form dlgAdvancedSearch */ public dlgAdvancedSearch(java.awt.Frame parent, boolean modal) { @@ -28,7 +29,6 @@ public dlgAdvancedSearch(java.awt.Frame parent, boolean modal) { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { @@ -44,14 +44,14 @@ private void initComponents() { jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); - cmbClass = new javax.swing.JComboBox(); + cmbClass = new javax.swing.JComboBox(); jLabel16 = new javax.swing.JLabel(); - cmbMechType = new javax.swing.JComboBox(); + cmbMechType = new javax.swing.JComboBox(); jLabel15 = new javax.swing.JLabel(); - cmbMotive = new javax.swing.JComboBox(); + cmbMotive = new javax.swing.JComboBox(); jLabel14 = new javax.swing.JLabel(); jLabel20 = new javax.swing.JLabel(); - cmbRulesLevel = new javax.swing.JComboBox(); + cmbRulesLevel = new javax.swing.JComboBox(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); @@ -144,7 +144,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Options")); - cmbClass.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All", "Light", "Medium", "Heavy", "Assault" })); + cmbClass.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All", "Light", "Medium", "Heavy", "Assault" })); cmbClass.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbClassActionPerformed(evt); @@ -153,7 +153,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel16.setText("Mech Type:"); - cmbMechType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "BattleMech", "IndustrialMech", "Primitive BattleMech", "Primitive IndustrialMech" })); + cmbMechType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "BattleMech", "IndustrialMech", "Primitive BattleMech", "Primitive IndustrialMech" })); cmbMechType.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbMechTypeActionPerformed(evt); @@ -162,7 +162,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel15.setText("Motive Type:"); - cmbMotive.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Biped", "Quad" })); + cmbMotive.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Biped", "Quad" })); cmbMotive.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbMotiveActionPerformed(evt); @@ -173,7 +173,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel20.setText("Rules Level:"); - cmbRulesLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Introductory", "Tournament Legal", "Advanced Rules", "Experimental Tech", "Era Specific" })); + cmbRulesLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Introductory", "Tournament Legal", "Advanced Rules", "Experimental Tech", "Era Specific" })); cmbRulesLevel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbRulesLevelActionPerformed(evt); @@ -364,10 +364,10 @@ public void windowClosing(java.awt.event.WindowEvent e) { } // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JComboBox cmbClass; - private javax.swing.JComboBox cmbMechType; - private javax.swing.JComboBox cmbMotive; - private javax.swing.JComboBox cmbRulesLevel; + private javax.swing.JComboBox cmbClass; + private javax.swing.JComboBox cmbMechType; + private javax.swing.JComboBox cmbMotive; + private javax.swing.JComboBox cmbRulesLevel; private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel14; diff --git a/BFB/src/main/java/BFB/GUI/dlgBalance.java b/BFB/src/main/java/BFB/GUI/dlgBalance.java index 828936c5..a841d7bb 100644 --- a/BFB/src/main/java/BFB/GUI/dlgBalance.java +++ b/BFB/src/main/java/BFB/GUI/dlgBalance.java @@ -31,11 +31,13 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import Force.Skills; public class dlgBalance extends javax.swing.JDialog { + private static final long serialVersionUID = -3950107051873075862L; + public int Result = -1; public Skills skills = new Skills(); public boolean overwrite = false; - private Force force; + // private Force force; public static final int SK_CANCEL = -1, SK_BESTSKILLS = 0, @@ -46,7 +48,7 @@ public dlgBalance(java.awt.Frame parent, boolean modal, Force force) { super(parent, modal); initComponents(); - this.force = force; + // this.force = force; } /** This method is called from within the constructor to @@ -54,7 +56,6 @@ public dlgBalance(java.awt.Frame parent, boolean modal, Force force) { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { @@ -71,11 +72,11 @@ private void initComponents() { rdoNeither = new javax.swing.JRadioButton(); jPanel7 = new javax.swing.JPanel(); jLabel12 = new javax.swing.JLabel(); - cmbSkillLevel = new javax.swing.JComboBox(); + cmbSkillLevel = new javax.swing.JComboBox(); btnRandomGen = new javax.swing.JButton(); jPanel9 = new javax.swing.JPanel(); jLabel14 = new javax.swing.JLabel(); - cmbNameFilter = new javax.swing.JComboBox(); + cmbNameFilter = new javax.swing.JComboBox(); btnRandomName = new javax.swing.JButton(); chkOverwriteName = new javax.swing.JCheckBox(); @@ -159,7 +160,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel12.setText("Skill Level:"); - cmbSkillLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Random", "Green", "Regular", "Veteran", "Elite" })); + cmbSkillLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Random", "Green", "Regular", "Veteran", "Elite" })); btnRandomGen.setText("Generate"); btnRandomGen.addActionListener(new java.awt.event.ActionListener() { @@ -198,7 +199,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel14.setText("Filter By:"); - cmbNameFilter.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Random" })); + cmbNameFilter.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Random" })); btnRandomName.setText("Generate"); btnRandomName.addActionListener(new java.awt.event.ActionListener() { @@ -291,21 +292,21 @@ private void btnRandomNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN private javax.swing.JButton btnFilter; private javax.swing.ButtonGroup btnGrpMinimize; private javax.swing.JButton btnRandomGen; - private javax.swing.JButton btnRandomGen1; + // private javax.swing.JButton btnRandomGen1; private javax.swing.JButton btnRandomName; private javax.swing.JCheckBox chkOverwriteName; - private javax.swing.JComboBox cmbNameFilter; - private javax.swing.JComboBox cmbSkillLevel; - private javax.swing.JComboBox cmbSkillLevel1; + private javax.swing.JComboBox cmbNameFilter; + private javax.swing.JComboBox cmbSkillLevel; + // private javax.swing.JComboBox cmbSkillLevel1; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; - private javax.swing.JLabel jLabel13; + // private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel7; private javax.swing.JPanel jPanel6; private javax.swing.JPanel jPanel7; - private javax.swing.JPanel jPanel8; + // private javax.swing.JPanel jPanel8; private javax.swing.JPanel jPanel9; private javax.swing.JRadioButton rdoGunnery; private javax.swing.JRadioButton rdoNeither; From 05dd1853090c45099b6917f6a56b1cff268b595c Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sun, 13 Dec 2020 16:20:13 -0600 Subject: [PATCH 006/126] Java Warnings related to arrasy and unchecked types --- BFB/src/main/java/BFB/GUI/dlgGenericUnit.java | 8 ++--- BFB/src/main/java/BFB/GUI/dlgGroup.java | 35 +++++++++++-------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/BFB/src/main/java/BFB/GUI/dlgGenericUnit.java b/BFB/src/main/java/BFB/GUI/dlgGenericUnit.java index 47c73162..4ced30ca 100644 --- a/BFB/src/main/java/BFB/GUI/dlgGenericUnit.java +++ b/BFB/src/main/java/BFB/GUI/dlgGenericUnit.java @@ -5,6 +5,7 @@ import Force.Unit; public class dlgGenericUnit extends javax.swing.JDialog { + private static final long serialVersionUID = -4119661501553704680L; Force force; @@ -20,14 +21,13 @@ public dlgGenericUnit(java.awt.Frame parent, boolean modal, Force force) { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); txtName = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); - cmbType = new javax.swing.JComboBox(); + cmbType = new javax.swing.JComboBox(); jLabel3 = new javax.swing.JLabel(); txtBaseBV = new javax.swing.JTextField(); txtModel = new javax.swing.JTextField(); @@ -47,7 +47,7 @@ private void initComponents() { jLabel2.setText("Unit Type:"); - cmbType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "BattleMech", "IndustrialMech", "ProtoMech", "Vehicle", "Infantry", "Battle Armor", "Conventional Fighter", "Aerospace Fighter", "Small Craft", "Dropship", "Support Vehicle", "Mobile Structure" })); + cmbType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "BattleMech", "IndustrialMech", "ProtoMech", "Vehicle", "Infantry", "Battle Armor", "Conventional Fighter", "Aerospace Fighter", "Small Craft", "Dropship", "Support Vehicle", "Mobile Structure" })); jLabel3.setText("Base BV:"); @@ -181,7 +181,7 @@ private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS private javax.swing.JButton btnClear; private javax.swing.JButton btnClose; private javax.swing.JButton btnSave; - private javax.swing.JComboBox cmbType; + private javax.swing.JComboBox cmbType; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; diff --git a/BFB/src/main/java/BFB/GUI/dlgGroup.java b/BFB/src/main/java/BFB/GUI/dlgGroup.java index 29e99943..4e7c0a7b 100644 --- a/BFB/src/main/java/BFB/GUI/dlgGroup.java +++ b/BFB/src/main/java/BFB/GUI/dlgGroup.java @@ -10,6 +10,8 @@ import javax.swing.DefaultListModel; public class dlgGroup extends javax.swing.JDialog { + private static final long serialVersionUID = -6264074581148435903L; + private Scenario scenario; private Media media = new Media(); private Group curGroup; @@ -31,7 +33,6 @@ public dlgGroup(java.awt.Frame parent, boolean modal, Scenario scenario) { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { @@ -39,12 +40,12 @@ private void initComponents() { jPanel2 = new javax.swing.JPanel(); btnCancel = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); - lstGroups = new javax.swing.JList(); + lstGroups = new javax.swing.JList(); jLabel1 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); lblGroupLogo = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); - lstUnits = new javax.swing.JList(); + lstUnits = new javax.swing.JList(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); @@ -80,10 +81,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(btnCancel) ); - lstGroups.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } + lstGroups.setModel(new javax.swing.AbstractListModel() { + private static final long serialVersionUID = 1L; + + Group[] groups = { }; + public int getSize() { return groups.length; } + public Group getElementAt(int i) { return groups[i]; } }); lstGroups.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { @@ -102,10 +105,12 @@ public void mouseClicked(java.awt.event.MouseEvent evt) { }); lstUnits.setBackground(new java.awt.Color(240, 240, 240)); - lstUnits.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } + lstUnits.setModel(new javax.swing.AbstractListModel() { + private static final long serialVersionUID = 2L; + + Unit[] units = { }; + public int getSize() { return units.length; } + public Unit getElementAt(int i) { return units[i]; } }); jScrollPane2.setViewportView(lstUnits); @@ -261,7 +266,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }// //GEN-END:initComponents private void loadGroupList() { - DefaultListModel gModel = new DefaultListModel(); + DefaultListModel gModel = new DefaultListModel(); for ( Force f : scenario.getForces() ) { for ( Group g : f.Groups ) { gModel.addElement(g); @@ -292,7 +297,7 @@ else if ( curGroup.getType().equals(BattleForce.Clan) ) lblPV.setText(curGroup.getTotalPV()+""); media.setLogo(lblGroupLogo, new File(curGroup.getLogo())); - DefaultListModel uModel = new DefaultListModel(); + DefaultListModel uModel = new DefaultListModel(); for ( Unit u : curGroup.getUnits() ) { uModel.addElement(u); } @@ -352,8 +357,8 @@ private void rdoComstarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI private javax.swing.JLabel lblBV; private javax.swing.JLabel lblGroupLogo; private javax.swing.JLabel lblPV; - private javax.swing.JList lstGroups; - private javax.swing.JList lstUnits; + private javax.swing.JList lstGroups; + private javax.swing.JList lstUnits; private javax.swing.JRadioButton rdoClan; private javax.swing.JRadioButton rdoComstar; private javax.swing.JRadioButton rdoInnerSphere; From d10044467dcc3445f8eeeab5c096fb736dc7999b Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sun, 13 Dec 2020 21:26:37 -0600 Subject: [PATCH 007/126] Strict Type declarations. Commented out code that is not needed. removed import not being used. Updated Advantages to conform to type. --- BFB/src/main/java/BFB/GUI/dlgManeiDomini.java | 40 +++++++++++++++---- sswlib/src/main/java/Force/Advantages.java | 4 +- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/BFB/src/main/java/BFB/GUI/dlgManeiDomini.java b/BFB/src/main/java/BFB/GUI/dlgManeiDomini.java index b91f089e..7892266c 100644 --- a/BFB/src/main/java/BFB/GUI/dlgManeiDomini.java +++ b/BFB/src/main/java/BFB/GUI/dlgManeiDomini.java @@ -2,11 +2,13 @@ import Force.Advantages; import Force.Advantages.Enhancement; -import Force.Warrior; +// import Force.Warrior; import java.util.ArrayList; import javax.swing.JDialog; public class dlgManeiDomini extends javax.swing.JDialog { + private static final long serialVersionUID = -8720839392985654131L; + public double Modifier = 1.0; public ArrayList Enhancements = new ArrayList(); @@ -31,13 +33,12 @@ public void setEnhancements(ArrayList List ) { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { jLabel4 = new javax.swing.JLabel(); jScrollPane3 = new javax.swing.JScrollPane(); - lstMods = new javax.swing.JList(); + lstMods = new javax.swing.JList(); jLabel5 = new javax.swing.JLabel(); lblHighestLevel = new javax.swing.JLabel(); btnSave = new javax.swing.JButton(); @@ -51,11 +52,36 @@ private void initComponents() { jLabel4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel4.setText("Select Manei Domini Enhancements"); - lstMods.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "0, Cosmetic Enhancement", "0, Prosthetic Hand/Foot/Arm/Leg", "1, Enhanced Prosthetic Hand/Foot/Arm/Leg", "3, Improved Enhanced Prosthetic Hand/Foot/Arm/Leg", "1, Secondary Power Supply", "3, Prosthetic Leg MASC", "2, Pain Shunt", "3, Pheremone Effuser", "4, Toxin Effuser", "2, Cybernetic Eye/Ear/Speech Implants", "3, Multi-Modal Cybernetic Eye/Ear/Speech Implants", "5, Enhanced Multi-Modal Cybernetic Eye/Ear/Speech Implants", "2, Recorder/Transmitter/Receiver/Communications Implant", "4, Boosted Recorder/Transmitter/Receiver/Communications Implants", "3, Filtration Liver/Lung Implants", "3, Vehicular Direct Neural Interface (VDNI)", "5, Buffered VDNI", "4, Myomer Full-Body Implants" }; + /* + * Not needed. Data is reset after initialization. + lstMods.setModel(new javax.swing.AbstractListModel() { + private static final long serialVersionUID = 1L; + + String[] strings = { + "0, Cosmetic Enhancement", + "0, Prosthetic Hand/Foot/Arm/Leg", + "1, Enhanced Prosthetic Hand/Foot/Arm/Leg", + "3, Improved Enhanced Prosthetic Hand/Foot/Arm/Leg", + "1, Secondary Power Supply", + "3, Prosthetic Leg MASC", + "2, Pain Shunt", + "3, Pheremone Effuser", + "4, Toxin Effuser", + "2, Cybernetic Eye/Ear/Speech Implants", + "3, Multi-Modal Cybernetic Eye/Ear/Speech Implants", + "5, Enhanced Multi-Modal Cybernetic Eye/Ear/Speech Implants", + "2, Recorder/Transmitter/Receiver/Communications Implant", + "4, Boosted Recorder/Transmitter/Receiver/Communications Implants", + "3, Filtration Liver/Lung Implants", + "3, Vehicular Direct Neural Interface (VDNI)", + "5, Buffered VDNI", + "4, Myomer Full-Body Implants" + }; public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } + public String getElementAt(int i) { return strings[i]; } }); + */ + lstMods.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { lstModsValueChanged(evt); @@ -169,7 +195,7 @@ private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST private javax.swing.JScrollPane jScrollPane3; private javax.swing.JLabel lblHighestLevel; private javax.swing.JLabel lblMod; - private javax.swing.JList lstMods; + private javax.swing.JList lstMods; // End of variables declaration//GEN-END:variables } diff --git a/sswlib/src/main/java/Force/Advantages.java b/sswlib/src/main/java/Force/Advantages.java index ff0dc0c6..16a11e0a 100644 --- a/sswlib/src/main/java/Force/Advantages.java +++ b/sswlib/src/main/java/Force/Advantages.java @@ -106,8 +106,8 @@ public ArrayList getMDMods() { return ret; } - public DefaultListModel getMDModsModel() { - DefaultListModel m = new DefaultListModel(); + public DefaultListModel getMDModsModel() { + DefaultListModel m = new DefaultListModel(); for ( Enhancement e : getMDMods() ) { m.addElement(e); } From 3de32a471ab84f28b45246d450a4774fa9d250c0 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sun, 13 Dec 2020 21:32:35 -0600 Subject: [PATCH 008/126] Commented out code not used Static types for tempaltes --- BFB/src/main/java/BFB/GUI/dlgOmnis.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/BFB/src/main/java/BFB/GUI/dlgOmnis.java b/BFB/src/main/java/BFB/GUI/dlgOmnis.java index 5f56ea40..e47f244c 100644 --- a/BFB/src/main/java/BFB/GUI/dlgOmnis.java +++ b/BFB/src/main/java/BFB/GUI/dlgOmnis.java @@ -30,7 +30,9 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import list.UnitListData; public class dlgOmnis extends javax.swing.JDialog { - private frmBase parent; + private static final long serialVersionUID = -273180311262289731L; + + // private frmBase parent; public UnitListData m; public String Variant; @@ -40,11 +42,12 @@ public class dlgOmnis extends javax.swing.JDialog { public dlgOmnis(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); - this.parent = (frmBase) parent; + // this.parent = (frmBase) parent; // Not used anywhere other than calling Super. } public dlgOmnis(java.awt.Frame parent, boolean modal, UnitListData m) { this(parent, modal); + for (int i=0; i < m.Configurations.size(); i++) { UnitListData l = (UnitListData) m.Configurations.get(i); cboVariants.addItem(l.getConfig()); @@ -56,12 +59,9 @@ public dlgOmnis(java.awt.Frame parent, boolean modal, UnitListData m) { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { - - btgOptions = new javax.swing.ButtonGroup(); - cboVariants = new javax.swing.JComboBox(); + cboVariants = new javax.swing.JComboBox(); lblUnitName = new javax.swing.JLabel(); btnOK = new javax.swing.JButton(); btnCancel = new javax.swing.JButton(); @@ -127,10 +127,9 @@ private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:e }//GEN-LAST:event_btnOKActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.ButtonGroup btgOptions; private javax.swing.JButton btnCancel; private javax.swing.JButton btnOK; - private javax.swing.JComboBox cboVariants; + private javax.swing.JComboBox cboVariants; private javax.swing.JLabel lblUnitName; // End of variables declaration//GEN-END:variables From b3622a68caafde2b87c6df8c437449e92f0c5194 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sun, 13 Dec 2020 22:19:16 -0600 Subject: [PATCH 009/126] Strict type control Commenting out code not being used. --- BFB/src/main/java/BFB/GUI/dlgOpen.java | 163 +++++++++++--------- sswlib/src/main/java/Force/FSL.java | 103 +++++++------ sswlib/src/main/java/Force/RUS.java | 20 +-- sswlib/src/main/java/list/UnitListData.java | 7 +- sswlib/src/main/java/list/abUnitData.java | 11 +- 5 files changed, 167 insertions(+), 137 deletions(-) diff --git a/BFB/src/main/java/BFB/GUI/dlgOpen.java b/BFB/src/main/java/BFB/GUI/dlgOpen.java index e7a88a26..7cee47b4 100644 --- a/BFB/src/main/java/BFB/GUI/dlgOpen.java +++ b/BFB/src/main/java/BFB/GUI/dlgOpen.java @@ -47,12 +47,13 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; -import java.util.ArrayList; +// import java.util.ArrayList; import javax.swing.DefaultListModel; import javax.swing.RowSorter; import javax.swing.SortOrder; import javax.swing.border.TitledBorder; import javax.swing.event.TreeSelectionListener; +// import javax.swing.event.UndoableEditListener; import javax.swing.table.TableRowSorter; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; @@ -60,9 +61,12 @@ public class dlgOpen extends javax.swing.JFrame implements java.awt.datatransfer.ClipboardOwner { + private static final long serialVersionUID = -6890478470060344517L; + private frmBase parent; private UnitList list, filtered, chosen = new UnitList(); - private String MechListPath = "", BaseRUSPath = "./Data/Tables/", RUSDirectory = "", RUSPath = BaseRUSPath; + private String MechListPath = "", BaseRUSPath = "./Data/Tables/"; + // private String RUSDirectory = "", RUSPath = BaseRUSPath; // Not used in uncommented code. private Force force; private RUS rus = new RUS(); private FSL fsl = new FSL(); @@ -80,10 +84,10 @@ public dlgOpen(java.awt.Frame parent, boolean modal) { initComponents(); this.parent = (frmBase) parent; - cmbTech.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Any Tech", "Clan", "Inner Sphere", "Mixed"})); - cmbEra.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Any Era", "Age of War/Star League", "Succession Wars", "Clan Invasion"})); - cmbMechType.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Any Type", "BattleMech", "IndustrialMech", "Primitive BattleMech", "Primitive IndustrialMech"})); - cmbMotive.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Any Motive", "Biped", "Quad"})); + cmbTech.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Any Tech", "Clan", "Inner Sphere", "Mixed"})); + cmbEra.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Any Era", "Age of War/Star League", "Succession Wars", "Clan Invasion"})); + cmbMechType.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Any Type", "BattleMech", "IndustrialMech", "Primitive BattleMech", "Primitive IndustrialMech"})); + cmbMotive.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Any Motive", "Biped", "Quad"})); LoadList(true); loadChosen(); @@ -125,7 +129,7 @@ private void addChosen() { private void loadChosen() { int BV = 0; float Cost = 0; - DefaultListModel newList = new DefaultListModel(); + DefaultListModel newList = new DefaultListModel(); for (UnitListData data : chosen.getList()) { newList.addElement(data); @@ -172,36 +176,43 @@ public void sortArray(Collator collator, String[] strArray) { /** Add nodes from under "dir" into curTop. Highly recursive. */ DefaultMutableTreeNode addNodes(DefaultMutableTreeNode curTop, File dir) { String curPath = dir.getPath(); - String dirName = dir.getName(); + // String dirName = dir.getName(); // Not used in method DefaultMutableTreeNode curDir = new DefaultMutableTreeNode(new DirectoryLeaf(dir)); if (curTop != null) { // should only be null at root curTop.add(curDir); } - ArrayList ol = new ArrayList(); + ArrayList ol = new ArrayList(); String[] tmp = dir.list(); ol.addAll(Arrays.asList(tmp)); Collections.sort(ol, String.CASE_INSENSITIVE_ORDER); + File f; - ArrayList files = new ArrayList(); + // ArrayList files = new ArrayList(); // Not used in loops. // Make two passes, one for Dirs and one for Files. This is #1. for (int i = 0; i < ol.size(); i++) { - String thisObject = (String) ol.get(i); + String thisObject = ol.get(i); String newPath; + if (curPath.equals(".")) { newPath = thisObject; } else { newPath = curPath + File.separator + thisObject; } + if ((f = new File(newPath)).isDirectory()) { addNodes(curDir, f); } else { //files.addElement(thisObject); } } + + /* Null op as 'files' isn't populated previously // Pass two: for files. for (int fnum = 0; fnum < files.size(); fnum++) { curDir.add(new DefaultMutableTreeNode(files.get(fnum))); } + */ + return curDir; } @@ -250,10 +261,11 @@ public int compare(DirectoryLeaf o1, DirectoryLeaf o2) { return (String.CASE_INSENSITIVE_ORDER).compare(o1.toString(), o2.toString()); } }); - DefaultListModel listModel = new DefaultListModel(); - for ( DirectoryLeaf leaf : v ) { + DefaultListModel listModel = new DefaultListModel(); + for (DirectoryLeaf leaf : v) { listModel.addElement(leaf); } + lstFiles.setModel(listModel); } catch (NullPointerException npe) { Media.Messager("Could not load " + dirPath + ".\n" + npe.getMessage()); @@ -279,14 +291,16 @@ private void loadFSL() { } private void Calculate() { - int BV = 0; - float Cost = 0; + /* BV/Cost not actually used */ + + // int BV = 0; + // float Cost = 0; int[] rows = tblMechData.getSelectedRows(); for (int i = 0; i < rows.length; i++) { UnitListData data = ((UnitList) tblMechData.getModel()).Get(tblMechData.convertRowIndexToModel(rows[i])); - BV += data.getBV(); - Cost += data.getCost(); + // BV += data.getBV(); + // Cost += data.getCost(); setTooltip(data); } } @@ -331,7 +345,7 @@ private void setupList(UnitList mechList) { tblMechData.setModel(mechList); //Create a sorting class and apply it to the list - TableRowSorter sorter = new TableRowSorter(mechList); + TableRowSorter sorter = new TableRowSorter(mechList); List sortKeys = new ArrayList(); sortKeys.add(new RowSorter.SortKey(0, SortOrder.ASCENDING)); sortKeys.add(new RowSorter.SortKey(1, SortOrder.ASCENDING)); @@ -362,7 +376,6 @@ private void checkSelection() { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; @@ -382,15 +395,15 @@ private void initComponents() { jLabel11 = new javax.swing.JLabel(); txtSource = new javax.swing.JTextField(); jLabel12 = new javax.swing.JLabel(); - cmbTech = new javax.swing.JComboBox(); + cmbTech = new javax.swing.JComboBox(); jLabel13 = new javax.swing.JLabel(); - cmbEra = new javax.swing.JComboBox(); + cmbEra = new javax.swing.JComboBox(); jLabel14 = new javax.swing.JLabel(); - cmbClass = new javax.swing.JComboBox(); + cmbClass = new javax.swing.JComboBox(); jLabel15 = new javax.swing.JLabel(); - cmbMotive = new javax.swing.JComboBox(); + cmbMotive = new javax.swing.JComboBox(); jLabel16 = new javax.swing.JLabel(); - cmbMechType = new javax.swing.JComboBox(); + cmbMechType = new javax.swing.JComboBox(); jLabel17 = new javax.swing.JLabel(); chkOmniOnly = new javax.swing.JCheckBox(); jLabel18 = new javax.swing.JLabel(); @@ -415,32 +428,32 @@ private void initComponents() { jLabel2 = new javax.swing.JLabel(); jPanel6 = new javax.swing.JPanel(); jScrollPane3 = new javax.swing.JScrollPane(); - lstOptions = new javax.swing.JList(); + lstOptions = new javax.swing.JList(); jScrollPane6 = new javax.swing.JScrollPane(); treDirectories = new javax.swing.JTree(); jPanel4 = new javax.swing.JPanel(); jScrollPane2 = new javax.swing.JScrollPane(); - lstFiles = new javax.swing.JList(); + lstFiles = new javax.swing.JList(); pnlFSL = new javax.swing.JPanel(); spnFSL = new javax.swing.JScrollPane(); tblFSL = new javax.swing.JTable(); jPanel17 = new javax.swing.JPanel(); - cmbFaction = new javax.swing.JComboBox(); - cmbType = new javax.swing.JComboBox(); - cmbSource = new javax.swing.JComboBox(); - cmbFSLEra = new javax.swing.JComboBox(); + cmbFaction = new javax.swing.JComboBox(); + cmbType = new javax.swing.JComboBox(); + cmbSource = new javax.swing.JComboBox(); + cmbFSLEra = new javax.swing.JComboBox(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); pnlRandomSelection = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); - lstSelected = new javax.swing.JList(); + lstSelected = new javax.swing.JList(); btnClearSelection = new javax.swing.JButton(); btnClipboard = new javax.swing.JButton(); pnlSelected = new javax.swing.JPanel(); jScrollPane4 = new javax.swing.JScrollPane(); - lstChosen = new javax.swing.JList(); + lstChosen = new javax.swing.JList(); btnClearChosen = new javax.swing.JButton(); btnAddUnits = new javax.swing.JButton(); btnDeleteUnit = new javax.swing.JButton(); @@ -648,7 +661,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; jPanel5.add(jLabel14, gridBagConstraints); - cmbClass.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All", "Light", "Medium", "Heavy", "Assault" })); + cmbClass.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All", "Light", "Medium", "Heavy", "Assault" })); cmbClass.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbClassActionPerformed(evt); @@ -673,7 +686,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; jPanel5.add(jLabel15, gridBagConstraints); - cmbMotive.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Biped", "Quad" })); + cmbMotive.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Biped", "Quad" })); cmbMotive.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbMotiveActionPerformed(evt); @@ -698,7 +711,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; jPanel5.add(jLabel16, gridBagConstraints); - cmbMechType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "BattleMech", "IndustrialMech", "Primitive BattleMech", "Primitive IndustrialMech" })); + cmbMechType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "BattleMech", "IndustrialMech", "Primitive BattleMech", "Primitive IndustrialMech" })); cmbMechType.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbMechTypeActionPerformed(evt); @@ -1069,13 +1082,13 @@ public void valueChanged(javax.swing.event.ListSelectionEvent evt) { )); spnFSL.setViewportView(tblFSL); - cmbFaction.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + cmbFaction.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); - cmbType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + cmbType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); - cmbSource.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + cmbSource.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); - cmbFSLEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + cmbFSLEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); jLabel3.setText("Faction"); @@ -1384,12 +1397,10 @@ private void btnOpenDirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI }//GEN-LAST:event_btnOpenDirActionPerformed private void txtMinCostFilter(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMinCostFilter - // TODO add your handling code here: -}//GEN-LAST:event_txtMinCostFilter + }//GEN-LAST:event_txtMinCostFilter private void txtMaxCostFilter(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMaxCostFilter - // TODO add your handling code here: -}//GEN-LAST:event_txtMaxCostFilter + }//GEN-LAST:event_txtMaxCostFilter private void btnClearFilterFilter(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearFilterFilter setupList(getList()); @@ -1401,7 +1412,7 @@ private void btnClearFilterFilter(java.awt.event.ActionEvent evt) {//GEN-FIRST:e txtMinCost.setText(""); txtMaxCost.setText(""); txtName.setText(""); -}//GEN-LAST:event_btnClearFilterFilter + }//GEN-LAST:event_btnClearFilterFilter private void lstFilesValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstFilesValueChanged DirectoryLeaf f = (DirectoryLeaf) lstFiles.getSelectedValue(); @@ -1419,15 +1430,15 @@ private void lstFilesValueChanged(javax.swing.event.ListSelectionEvent evt) {//G private void btnRollActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRollActionPerformed lstSelected.setModel(rus.Generate(Integer.parseInt(spnSelections.getValue().toString()), Integer.parseInt(spnAddOn.getValue().toString()))); -}//GEN-LAST:event_btnRollActionPerformed + }//GEN-LAST:event_btnRollActionPerformed private void tbpSelectionsFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tbpSelectionsFocusGained //LoadRUSFiles(parent.Prefs.get("RUSPath", "")); -}//GEN-LAST:event_tbpSelectionsFocusGained + }//GEN-LAST:event_tbpSelectionsFocusGained private void btnClearSelectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearSelectionActionPerformed lstSelected.setModel(rus.ClearSelection()); -}//GEN-LAST:event_btnClearSelectionActionPerformed + }//GEN-LAST:event_btnClearSelectionActionPerformed private void btnClipboardActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClipboardActionPerformed String data = ""; @@ -1445,11 +1456,11 @@ private void btnClipboardActionPerformed(java.awt.event.ActionEvent evt) {//GEN- }//GEN-LAST:event_btnClipboardActionPerformed private void lstSelectedKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_lstSelectedKeyPressed - if (lstSelected.getSelectedValues().length > 0) { + if (lstSelected.getSelectedValuesList().size() > 0) { if (evt.getKeyCode() == KeyEvent.VK_DELETE) { - DefaultListModel model = (DefaultListModel) lstSelected.getModel(); - for (int i = lstSelected.getSelectedValues().length - 1; i >= 0; i--) { - model.removeElement((Object) lstSelected.getSelectedValues()[i]); + DefaultListModel model = (DefaultListModel) lstSelected.getModel(); + for (int i = lstSelected.getSelectedValuesList().size() - 1; i >= 0; i--) { + model.removeElement(lstSelected.getSelectedValuesList().get(i)); } lstSelected.clearSelection(); } @@ -1457,8 +1468,8 @@ private void lstSelectedKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:eve }//GEN-LAST:event_lstSelectedKeyPressed private void lstSelectedValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstSelectedValueChanged - if ((lstSelected.getSelectedValues().length > 0)) { - String Item = ((Object) lstSelected.getSelectedValues()[0]).toString(); + if ((lstSelected.getSelectedValuesList().size() > 0)) { + String Item = lstSelected.getSelectedValuesList().get(0); if (Item.contains(" ")) { String Name = RUS.ParseDesignName(Item); txtName.setText(Name); @@ -1486,21 +1497,20 @@ private void cmbClassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS }//GEN-LAST:event_cmbClassActionPerformed private void lstChosenValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstChosenValueChanged - // TODO add your handling code here: -}//GEN-LAST:event_lstChosenValueChanged + }//GEN-LAST:event_lstChosenValueChanged private void lstChosenKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_lstChosenKeyPressed - if (lstChosen.getSelectedValues().length > 0) { + if (lstChosen.getSelectedValuesList().size() > 0) { if (evt.getKeyCode() == KeyEvent.VK_DELETE) { btnDeleteUnitActionPerformed(null); } } -}//GEN-LAST:event_lstChosenKeyPressed + }//GEN-LAST:event_lstChosenKeyPressed private void btnClearChosenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearChosenActionPerformed chosen.RemoveAll(); loadChosen(); -}//GEN-LAST:event_btnClearChosenActionPerformed + }//GEN-LAST:event_btnClearChosenActionPerformed private void btnAddUnitsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddUnitsActionPerformed if (chosen.Size() > 0) { @@ -1512,7 +1522,7 @@ private void btnAddUnitsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F parent.Refresh(); this.setVisible(false); } -}//GEN-LAST:event_btnAddUnitsActionPerformed + }//GEN-LAST:event_btnAddUnitsActionPerformed private void lstOptionsValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstOptionsValueChanged }//GEN-LAST:event_lstOptionsValueChanged @@ -1549,14 +1559,15 @@ private void tblMechDataMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:e }//GEN-LAST:event_tblMechDataMouseMoved private void tblMechDataFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tblMechDataFocusGained - // TODO add your handling code here: }//GEN-LAST:event_tblMechDataFocusGained private void btnDeleteUnitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteUnitActionPerformed - Object[] remove = lstChosen.getSelectedValues(); - for (Object data : remove) { - chosen.Remove((UnitListData) data); + List remove = lstChosen.getSelectedValuesList(); + + for (UnitListData data : remove) { + chosen.Remove(data); } + loadChosen(); }//GEN-LAST:event_btnDeleteUnitActionPerformed @@ -1623,15 +1634,15 @@ private void formKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_for private javax.swing.JButton btnRefresh; private javax.swing.JButton btnRoll; private javax.swing.JCheckBox chkOmniOnly; - private javax.swing.JComboBox cmbClass; - private javax.swing.JComboBox cmbEra; - private javax.swing.JComboBox cmbFSLEra; - private javax.swing.JComboBox cmbFaction; - private javax.swing.JComboBox cmbMechType; - private javax.swing.JComboBox cmbMotive; - private javax.swing.JComboBox cmbSource; - private javax.swing.JComboBox cmbTech; - private javax.swing.JComboBox cmbType; + private javax.swing.JComboBox cmbClass; + private javax.swing.JComboBox cmbEra; + private javax.swing.JComboBox cmbFSLEra; + private javax.swing.JComboBox cmbFaction; + private javax.swing.JComboBox cmbMechType; + private javax.swing.JComboBox cmbMotive; + private javax.swing.JComboBox cmbSource; + private javax.swing.JComboBox cmbTech; + private javax.swing.JComboBox cmbType; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; @@ -1664,10 +1675,10 @@ private void formKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_for private javax.swing.JScrollPane jScrollPane4; private javax.swing.JScrollPane jScrollPane6; private javax.swing.JLabel lblLoading; - private javax.swing.JList lstChosen; - private javax.swing.JList lstFiles; - private javax.swing.JList lstOptions; - private javax.swing.JList lstSelected; + private javax.swing.JList lstChosen; + private javax.swing.JList lstFiles; + private javax.swing.JList lstOptions; + private javax.swing.JList lstSelected; private javax.swing.JPanel pnlFSL; private javax.swing.JPanel pnlRandom; private javax.swing.JPanel pnlRandomSelection; diff --git a/sswlib/src/main/java/Force/FSL.java b/sswlib/src/main/java/Force/FSL.java index 88a6a2c8..c369823c 100644 --- a/sswlib/src/main/java/Force/FSL.java +++ b/sswlib/src/main/java/Force/FSL.java @@ -35,7 +35,9 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import javax.swing.table.AbstractTableModel; public class FSL extends AbstractTableModel { - private ArrayList Items = new ArrayList(); + private static final long serialVersionUID = -782713552784624633L; + + private ArrayList Items = new ArrayList(); public void Add( FSLItem item ) { Items.add( item ); @@ -57,22 +59,27 @@ public void Load( String filename ) throws FileNotFoundException, IOException { try { BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename))); String line = null; - + //skip the first line as it has headers reader.readLine(); while ((line = reader.readLine()) != null) { - if ( line.trim().length() > 0 ) { Add(line); } + if (line.trim().length() > 0) { + Add(line); + } } + + reader.close(); } catch (IOException ex) { //do nothing } } - public DefaultComboBoxModel getFactions() { - ArrayList storage = new ArrayList(); - DefaultComboBoxModel list = new DefaultComboBoxModel(); + public DefaultComboBoxModel getFactions() { + ArrayList storage = new ArrayList(); + DefaultComboBoxModel list = new DefaultComboBoxModel(); for ( int i=0; i < Items.size(); i++ ) { - FSLItem item = (FSLItem) Items.get(i); + FSLItem item = Items.get(i); + if ( ! storage.contains( item.Faction ) ) { list.addElement( item.Faction ); storage.add(item.Faction); @@ -81,42 +88,50 @@ public DefaultComboBoxModel getFactions() { return list; } - public DefaultComboBoxModel getTypes() { - ArrayList storage = new ArrayList(); - DefaultComboBoxModel list = new DefaultComboBoxModel(); - for ( int i=0; i < Items.size(); i++ ) { - FSLItem item = (FSLItem) Items.get(i); - if ( ! storage.contains( item.Type ) ) { - list.addElement( item.Type ); + public DefaultComboBoxModel getTypes() { + ArrayList storage = new ArrayList(); + DefaultComboBoxModel list = new DefaultComboBoxModel(); + for (int i = 0; i < Items.size(); i++) { + FSLItem item = Items.get(i); + + if (!storage.contains(item.Type)) { + list.addElement(item.Type); storage.add(item.Type); } } + return list; } - public DefaultComboBoxModel getSources() { - ArrayList storage = new ArrayList(); - DefaultComboBoxModel list = new DefaultComboBoxModel(); + public DefaultComboBoxModel getSources() { + ArrayList storage = new ArrayList(); + DefaultComboBoxModel list = new DefaultComboBoxModel(); + for ( int i=0; i < Items.size(); i++ ) { - FSLItem item = (FSLItem) Items.get(i); + FSLItem item = Items.get(i); + if ( ! storage.contains( item.Source ) ) { list.addElement( item.Source ); storage.add(item.Source); } } + return list; } - public DefaultComboBoxModel getEras() { - ArrayList storage = new ArrayList(); - DefaultComboBoxModel list = new DefaultComboBoxModel(); - for ( int i=0; i < Items.size(); i++ ) { - FSLItem item = (FSLItem) Items.get(i); - if ( ! storage.contains( item.Era ) ) { - list.addElement( item.Era ); + public DefaultComboBoxModel getEras() { + ArrayList storage = new ArrayList(); + DefaultComboBoxModel list = new DefaultComboBoxModel(); + + for (int i = 0; i < Items.size(); i++) { + FSLItem item = Items.get(i); + + if (!storage.contains(item.Era)) { + list.addElement(item.Era); storage.add(item.Era); } } + return list; } @@ -147,17 +162,22 @@ public String getColumnName( int col ) { return ""; } public int getRowCount() { return Items.size(); } - public int getColumnCount() { return 10; } + + public int getColumnCount() { + return 10; + } + @Override - public Class getColumnClass(int c) { + public Class getColumnClass(int c) { if (Items.size() > 0) { return getClassOf(0, c).getClass(); } else { return String.class; } } + public Object getClassOf( int row, int col ) { - FSLItem u = (FSLItem) Items.get( row ); + FSLItem u = Items.get( row ); switch( col ) { case 0: return u.Faction; @@ -183,7 +203,7 @@ public Object getClassOf( int row, int col ) { return ""; } public Object getValueAt( int row, int col ) { - FSLItem u = (FSLItem) Items.get( row ); + FSLItem u = Items.get( row ); switch( col ) { case 0: return u.Faction; @@ -213,15 +233,6 @@ public boolean isCellEditable( int row, int col ) { return false; } - - - - - - - - - public class FSLItem { private String Faction = "", Type = "", @@ -232,10 +243,10 @@ public class FSLItem { Date = "", Era = ""; - private float BV = 0.0f, - Cost = 0.0f; + private float BV = 0.0f, + Cost = 0.0f; - private int Tonnage = 0; + private int Tonnage = 0; public FSLItem( String Faction, String Type, String Name, String RulesLevel, String TechBase, String Source, String Date, String Era, float BV, float Cost, int Tonnage ) { this.Faction = Faction; @@ -252,28 +263,32 @@ public FSLItem( String Faction, String Type, String Name, String RulesLevel, Str } public FSLItem( String Line ) { - //javax.swing.JOptionPane.showMessageDialog(null, "Given: " + Line); if ( Line.contains(CommonTools.Tab) ) { String[] data = Line.split(CommonTools.Tab); + if ( data.length >= 12 ) { this.Faction = data[0].trim(); this.Type = data[1].trim(); this.Name = data[2].trim(); + try { this.Tonnage = Integer.parseInt(data[4].trim()); - } catch ( Exception e ) { + } catch (Exception e) { //do nothing } + try { this.Cost = Float.parseFloat(data[5].trim()); - } catch ( Exception e ) { + } catch (Exception e) { //do nothing } + this.RulesLevel = data[6].trim(); this.TechBase = data[7].trim(); this.Source = data[8].trim(); this.Date = data[9].trim(); this.Era = data[10].trim(); + try { this.BV = Float.parseFloat(data[11].trim()); } catch ( Exception e ) { diff --git a/sswlib/src/main/java/Force/RUS.java b/sswlib/src/main/java/Force/RUS.java index 7a0e09d3..8d85b8be 100644 --- a/sswlib/src/main/java/Force/RUS.java +++ b/sswlib/src/main/java/Force/RUS.java @@ -35,9 +35,9 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import javax.swing.DefaultListModel; public class RUS { - private DefaultListModel DisplayList = new DefaultListModel(); - private ArrayList Choices = new ArrayList(); - private DefaultListModel Selection = new DefaultListModel(); + private DefaultListModel DisplayList = new DefaultListModel(); + private ArrayList Choices = new ArrayList(); + private DefaultListModel Selection = new DefaultListModel(); public final static String ParseDesignName( String selection ) { String Name = "", Model = ""; @@ -87,7 +87,7 @@ public void LoadFile( String filePath ) { } } - public DefaultListModel getDisplay() { + public DefaultListModel getDisplay() { return DisplayList; } @@ -105,17 +105,17 @@ public void AddItem( String Line, String Name, int Value ) { } } - public DefaultListModel Add( String Item ) { + public DefaultListModel Add( String Item ) { getSelection().addElement(Item); return getSelection(); } public void ClearItems() { - DisplayList = new DefaultListModel(); + DisplayList = new DefaultListModel(); Choices.clear(); } - public DefaultListModel Generate( int Selections, int AddOn ) { + public DefaultListModel Generate( int Selections, int AddOn ) { java.util.Random random = new Random(); for (int i=0; i < Selections; i++ ) { @@ -133,15 +133,15 @@ public String Generate() { return Choices.get(Row).toString(); } - public DefaultListModel ClearSelection() { - Selection = new DefaultListModel(); + public DefaultListModel ClearSelection() { + Selection = new DefaultListModel(); return Selection; } /** * @return the Selection */ - public DefaultListModel getSelection() { + public DefaultListModel getSelection() { return Selection; } } diff --git a/sswlib/src/main/java/list/UnitListData.java b/sswlib/src/main/java/list/UnitListData.java index efdd2823..a6eacf73 100644 --- a/sswlib/src/main/java/list/UnitListData.java +++ b/sswlib/src/main/java/list/UnitListData.java @@ -68,6 +68,7 @@ public UnitListData( UnitListData m ) { public UnitListData( String filename, String basePath ) throws Exception { MechReader read = new MechReader(); UnitListData tempData = new UnitListData(); + try { tempData = read.ReadMechData(filename, basePath); @@ -89,9 +90,11 @@ public UnitListData( String filename, String basePath ) throws Exception { this.Omni = tempData.isOmni(); this.filename = tempData.getFilename().replace(basePath, ""); this.Config = tempData.getConfig(); - for ( int i=0; i < tempData.Configurations.size(); i++ ){ + + for (int i = 0; i < tempData.Configurations.size(); i++) { this.Configurations.add(tempData.Configurations.get(i)); } + this.bfstat = tempData.getBattleForceStats(); } catch ( Exception e1 ) { throw new Exception("[MechListData " + e1.getMessage() + "]"); @@ -183,7 +186,7 @@ public List toCsvIndex() { public String toString() { return getFullName() + " (" + getBV() + ") " + getInfo(); } - + public int getUnitType() { if ( this.filename.endsWith(".ssw") ) { return CommonTools.BattleMech; diff --git a/sswlib/src/main/java/list/abUnitData.java b/sswlib/src/main/java/list/abUnitData.java index a2b485d4..96ed84ba 100644 --- a/sswlib/src/main/java/list/abUnitData.java +++ b/sswlib/src/main/java/list/abUnitData.java @@ -56,11 +56,12 @@ public abstract class abUnitData implements ifUnitData { boolean Omni = false; String basePath = "", filename = ""; - public ArrayList Configurations = new ArrayList(); + public ArrayList Configurations = new ArrayList(); public BattleForceStats bfstat = new BattleForceStats(); - private String[] indexFields = new String[]{"Name", "Model", "Level", "Era", - "Tech", "Source", "Tonnage", "Year", "BV", "Cost", "Filename", "Type", - "Motive", "Info", "Config"}; + + // Not used in this or child classes + // private String[] indexFields = new String[]{"Name", "Model", "Level", "Era", "Tech", "Source", "Tonnage", "Year", "BV", "Cost", "Filename", "Type","Motive", "Info", "Config"}; + static final int name = 0, model = 1, configuration = 2, @@ -246,7 +247,7 @@ public void setMinMP(int MinMP) { public void setBattleForceStats( BattleForceStats stat ) { this.bfstat = stat; } - + public BattleForceStats getBattleForceStats() { if ( bfstat.getName().isEmpty() ) bfstat.setName(getFullName()); return bfstat; From 591539c153672af34e46984dbd04b6ecfc373725 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sun, 13 Dec 2020 22:39:14 -0600 Subject: [PATCH 010/126] Type enforcement for Templates Corrected type for abUnitData --- BFB/src/main/java/BFB/GUI/dlgOmnis.java | 3 +-- sswlib/src/main/java/list/UnitList.java | 25 +++++++++++++++-------- sswlib/src/main/java/list/abUnitData.java | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/BFB/src/main/java/BFB/GUI/dlgOmnis.java b/BFB/src/main/java/BFB/GUI/dlgOmnis.java index e47f244c..65353681 100644 --- a/BFB/src/main/java/BFB/GUI/dlgOmnis.java +++ b/BFB/src/main/java/BFB/GUI/dlgOmnis.java @@ -49,8 +49,7 @@ public dlgOmnis(java.awt.Frame parent, boolean modal, UnitListData m) { this(parent, modal); for (int i=0; i < m.Configurations.size(); i++) { - UnitListData l = (UnitListData) m.Configurations.get(i); - cboVariants.addItem(l.getConfig()); + cboVariants.addItem(m.Configurations.get(i).getConfig()); } } diff --git a/sswlib/src/main/java/list/UnitList.java b/sswlib/src/main/java/list/UnitList.java index 5bd22d5f..52b076bc 100644 --- a/sswlib/src/main/java/list/UnitList.java +++ b/sswlib/src/main/java/list/UnitList.java @@ -38,6 +38,8 @@ public class UnitList extends AbstractTableModel { + private static final long serialVersionUID = -3263076465516677079L; + private ArrayList List = new ArrayList(); private String Directory = ""; private int IndexVersion = 10; @@ -47,7 +49,7 @@ public class UnitList extends AbstractTableModel { public UnitList() { } - + public UnitList(String directory) { this(directory, true); } @@ -78,7 +80,7 @@ public UnitList( String directory, boolean useIndex ) { } } } - + final void Load( String Directory ) { File d = new File(Directory); if ( d.isDirectory() && !d.isHidden() ) { @@ -93,7 +95,7 @@ final void Load( String Directory ) { } } } - + boolean EditorFile(File f) { for ( String ext : Extensions ) { if ( f.getPath().endsWith(ext) ) return true; @@ -220,13 +222,13 @@ public UnitList Filter(ListFilter filter) { if ( ! filter.getSource().isEmpty() ) { if (! mData.getSource().toUpperCase().contains( filter.getSource().toUpperCase() ) ) remove = true; } - + if (remove) m.List.remove(mData); } return m; } - + public final void Write() throws IOException { if (List.size() > 0) { BufferedWriter bw = new BufferedWriter(new FileWriter(getDirectory() + File.separator + "index.ssi") ); @@ -243,9 +245,12 @@ public final boolean Read() { try { BufferedReader br = new BufferedReader(new FileReader(getDirectory() + File.separator + "index.ssi")); int version = Integer.parseInt(br.readLine().split(":")[1]); + if (version != IndexVersion) { + br.close(); return false; } + List = UnitCacheParser.LoadUnitCache(br); br.close(); return true; @@ -281,9 +286,13 @@ public String getColumnName( int col ) { return ""; } public int getRowCount() { return List.size(); } - public int getColumnCount() { return 9; } + + public int getColumnCount() { + return 9; + } + @Override - public Class getColumnClass(int c) { + public Class getColumnClass(int c) { if (List.size() > 0) { return getClassOf(c).getClass(); } else { @@ -320,7 +329,7 @@ public Object getClassOf( int c ) { public void fireTableDataChanged() { super.fireTableDataChanged(); } - + public Object getValueAt( int row, int col ) { UnitListData m = (UnitListData) List.get( row ); switch( col ) { diff --git a/sswlib/src/main/java/list/abUnitData.java b/sswlib/src/main/java/list/abUnitData.java index 96ed84ba..c00a28c0 100644 --- a/sswlib/src/main/java/list/abUnitData.java +++ b/sswlib/src/main/java/list/abUnitData.java @@ -56,7 +56,7 @@ public abstract class abUnitData implements ifUnitData { boolean Omni = false; String basePath = "", filename = ""; - public ArrayList Configurations = new ArrayList(); + public ArrayList Configurations = new ArrayList(); public BattleForceStats bfstat = new BattleForceStats(); // Not used in this or child classes From 6ecb187d1e500fa42944d9a2a959c1f45a55e86b Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sun, 13 Dec 2020 22:44:11 -0600 Subject: [PATCH 011/126] Commented out code that doesn't appear to be used. Type enforcement for methods --- BFB/src/main/java/BFB/GUI/dlgPersonnel.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/BFB/src/main/java/BFB/GUI/dlgPersonnel.java b/BFB/src/main/java/BFB/GUI/dlgPersonnel.java index 71574a93..24d53193 100644 --- a/BFB/src/main/java/BFB/GUI/dlgPersonnel.java +++ b/BFB/src/main/java/BFB/GUI/dlgPersonnel.java @@ -37,19 +37,24 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; +// import javax.swing.event.TableModelEvent; +// import javax.swing.event.TableModelListener; public class dlgPersonnel extends javax.swing.JDialog { + private static final long serialVersionUID = -5037491851130149787L; + public Warriors warriors; private frmBase parent; + /* + * Not used in class it seems private TableModelListener ListChanged = new TableModelListener() { public void tableChanged(TableModelEvent e) { warriors.setupTable(tblWarriors); } }; - + */ + public dlgPersonnel(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); @@ -65,7 +70,6 @@ public dlgPersonnel(java.awt.Frame parent, boolean modal) { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { @@ -203,14 +207,17 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { "Name", "Affiliation", "Skills" } ) { - Class[] types = new Class [] { + private static final long serialVersionUID = 741045032946894662L; + + Class[] types = new Class[] { java.lang.String.class, java.lang.String.class, java.lang.String.class }; + boolean[] canEdit = new boolean [] { false, false, false }; - public Class getColumnClass(int columnIndex) { + public Class getColumnClass(int columnIndex) { return types [columnIndex]; } From 5d444f695d1d6fc20edbde3c52df2112782197c6 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sun, 13 Dec 2020 22:47:20 -0600 Subject: [PATCH 012/126] Static template adjustments --- BFB/src/main/java/BFB/GUI/dlgQuickAdd.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/BFB/src/main/java/BFB/GUI/dlgQuickAdd.java b/BFB/src/main/java/BFB/GUI/dlgQuickAdd.java index 934dde6a..bb2a1172 100644 --- a/BFB/src/main/java/BFB/GUI/dlgQuickAdd.java +++ b/BFB/src/main/java/BFB/GUI/dlgQuickAdd.java @@ -9,7 +9,8 @@ import list.view.*; public class dlgQuickAdd extends javax.swing.JDialog { - + private static final long serialVersionUID = -749945358585948118L; + private frmBase parent; private Force force; private UnitList list, filtered = new UnitList(); @@ -60,7 +61,6 @@ private void setupList(UnitList mechList) { viewModel.setupTable(tblList); } - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { @@ -70,8 +70,8 @@ private void initComponents() { tblList = new javax.swing.JTable(); btnAdd = new javax.swing.JButton(); btnClose = new javax.swing.JButton(); - cmbGunnery = new javax.swing.JComboBox(); - cmbPiloting = new javax.swing.JComboBox(); + cmbGunnery = new javax.swing.JComboBox(); + cmbPiloting = new javax.swing.JComboBox(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Quick Add Units"); @@ -118,10 +118,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - cmbGunnery.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" })); + cmbGunnery.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" })); cmbGunnery.setSelectedIndex(4); - cmbPiloting.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" })); + cmbPiloting.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" })); cmbPiloting.setEditor(null); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); @@ -204,8 +204,8 @@ private void txtNameFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:even // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnAdd; private javax.swing.JButton btnClose; - private javax.swing.JComboBox cmbGunnery; - private javax.swing.JComboBox cmbPiloting; + private javax.swing.JComboBox cmbGunnery; + private javax.swing.JComboBox cmbPiloting; private javax.swing.JLabel jLabel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable tblList; From 8c7230d0e950e09bc39952607e48fa5303d29a85 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sun, 13 Dec 2020 22:49:12 -0600 Subject: [PATCH 013/126] Static type declaration for templates --- BFB/src/main/java/BFB/GUI/dlgWarrior.java | 27 ++++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/BFB/src/main/java/BFB/GUI/dlgWarrior.java b/BFB/src/main/java/BFB/GUI/dlgWarrior.java index b5a99212..1c439695 100644 --- a/BFB/src/main/java/BFB/GUI/dlgWarrior.java +++ b/BFB/src/main/java/BFB/GUI/dlgWarrior.java @@ -32,6 +32,8 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import Force.Warriors; public class dlgWarrior extends javax.swing.JDialog { + private static final long serialVersionUID = 2242028034198967193L; + private Warriors warriors; private Warrior warrior; private NameGenerator NameGen = new NameGenerator(); @@ -76,7 +78,6 @@ private void Setup( Warriors warriors, Warrior warrior ) { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { @@ -84,8 +85,8 @@ private void initComponents() { txtName = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); - cmbGunnery = new javax.swing.JComboBox(); - cmbPiloting = new javax.swing.JComboBox(); + cmbGunnery = new javax.swing.JComboBox(); + cmbPiloting = new javax.swing.JComboBox(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); txtManeiDomini = new javax.swing.JTextField(); @@ -96,8 +97,8 @@ private void initComponents() { jLabel3 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); - cmbFaction = new javax.swing.JComboBox(); - cmbStatus = new javax.swing.JComboBox(); + cmbFaction = new javax.swing.JComboBox(); + cmbStatus = new javax.swing.JComboBox(); jPanel3 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); txtQuirks = new javax.swing.JTextArea(); @@ -117,10 +118,10 @@ private void initComponents() { jLabel6.setText("Gunnery:"); - cmbGunnery.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" })); + cmbGunnery.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" })); cmbGunnery.setSelectedIndex(4); - cmbPiloting.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" })); + cmbPiloting.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" })); cmbPiloting.setSelectedIndex(5); jLabel7.setText("Piloting:"); @@ -200,10 +201,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel9.setText("Status:"); cmbFaction.setEditable(true); - cmbFaction.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Capellan Confederation", "Circinus Federation", "Clan Blood Spirit", "Clan Cloud Cobra", "Clan Coyote", "Clan Diamond Shark", "Clan Fire Mandrill", "Clan Ghost Bear", "Clan Goliath Scorpion", "Clan Hell's Horses", "Clan Ice Hellion", "Clan Jade Falcon", "Clan Nova Cat", "Clan Snow Raven", "Clan Star Adder", "Clan Steel Viper", "Clan Wolf", "Clan Wolf in Exile", "Comstar", "Draconis Combine", "Eridani Light Horse", "Federated Suns", "Free Rasalhague Republic", "Free Worlds League", "Lyran Alliance", "Magistracy of Canopus", "Marian Hegemony", "Northwind Highlanders", "Outworlds Alliance", "Pirates", "Taurian Concordat", "Wolf's Dragoons", "Word of Blake" })); + cmbFaction.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Capellan Confederation", "Circinus Federation", "Clan Blood Spirit", "Clan Cloud Cobra", "Clan Coyote", "Clan Diamond Shark", "Clan Fire Mandrill", "Clan Ghost Bear", "Clan Goliath Scorpion", "Clan Hell's Horses", "Clan Ice Hellion", "Clan Jade Falcon", "Clan Nova Cat", "Clan Snow Raven", "Clan Star Adder", "Clan Steel Viper", "Clan Wolf", "Clan Wolf in Exile", "Comstar", "Draconis Combine", "Eridani Light Horse", "Federated Suns", "Free Rasalhague Republic", "Free Worlds League", "Lyran Alliance", "Magistracy of Canopus", "Marian Hegemony", "Northwind Highlanders", "Outworlds Alliance", "Pirates", "Taurian Concordat", "Wolf's Dragoons", "Word of Blake" })); cmbStatus.setEditable(true); - cmbStatus.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Active", "Inactive", "Wounded", "Hospitalized" })); + cmbStatus.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Active", "Inactive", "Wounded", "Hospitalized" })); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); @@ -404,10 +405,10 @@ private void btnGenNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI private javax.swing.JButton btnCancel; private javax.swing.JButton btnGenName; private javax.swing.JButton btnSave; - private javax.swing.JComboBox cmbFaction; - private javax.swing.JComboBox cmbGunnery; - private javax.swing.JComboBox cmbPiloting; - private javax.swing.JComboBox cmbStatus; + private javax.swing.JComboBox cmbFaction; + private javax.swing.JComboBox cmbGunnery; + private javax.swing.JComboBox cmbPiloting; + private javax.swing.JComboBox cmbStatus; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; From 7b716361c11919de382114c2410797bfc256e3d5 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sun, 13 Dec 2020 22:50:11 -0600 Subject: [PATCH 014/126] Static Assignment of Types for Templates --- BFB/src/main/java/BFB/GUI/ForcePanel.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BFB/src/main/java/BFB/GUI/ForcePanel.java b/BFB/src/main/java/BFB/GUI/ForcePanel.java index 0a533a91..93e04ddd 100644 --- a/BFB/src/main/java/BFB/GUI/ForcePanel.java +++ b/BFB/src/main/java/BFB/GUI/ForcePanel.java @@ -39,6 +39,7 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import javax.swing.event.TableModelListener; public class ForcePanel extends javax.swing.JPanel { + private static final long serialVersionUID = 9012868947346629504L; private Force force; private abTable currentModel = new tbTotalWarfare(); @@ -79,7 +80,6 @@ private void OverrideSkills() { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { @@ -93,7 +93,7 @@ private void initComponents() { jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); txtForceName = new javax.swing.JTextField(); - cmbForceType = new javax.swing.JComboBox(); + cmbForceType = new javax.swing.JComboBox(); jLabel2 = new javax.swing.JLabel(); txtOverrideGunnery = new javax.swing.JTextField(); txtOverridePiloting = new javax.swing.JTextField(); @@ -175,7 +175,7 @@ public void keyReleased(java.awt.event.KeyEvent evt) { jLabel1.setText("Unit Name:"); - cmbForceType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan", "Comstar/WoB" })); + cmbForceType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan", "Comstar/WoB" })); jLabel2.setText("Type:"); @@ -401,7 +401,7 @@ public void tableChanged(TableModelEvent e) { private javax.swing.JButton btnRandom; private javax.swing.JButton btnSaveForce; private javax.swing.JButton btnTransfer; - private javax.swing.JComboBox cmbForceType; + private javax.swing.JComboBox cmbForceType; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel6; From ada6e6d966b2667fb79437ad44dd19b4d651a20c Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sun, 13 Dec 2020 22:50:38 -0600 Subject: [PATCH 015/126] Serial Version UID added to class --- .../java/binaryconverter/gui/frmMain.java | 56 ++++++++++--------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/binconvert/src/main/java/binaryconverter/gui/frmMain.java b/binconvert/src/main/java/binaryconverter/gui/frmMain.java index b7bd7320..c4f097b0 100644 --- a/binconvert/src/main/java/binaryconverter/gui/frmMain.java +++ b/binconvert/src/main/java/binaryconverter/gui/frmMain.java @@ -24,6 +24,8 @@ public class frmMain extends JFrame { + private static final long serialVersionUID = -6506576790071457388L; + private JButton btnCancel; private JButton btnConvert; private JButton btnJson; @@ -34,9 +36,9 @@ public class frmMain private JPanel jPanel1; private JPanel jPanel2; private JPanel jPanel3; - + public frmMain() { initComponents(); } - + private JPanel jPanel4; private JScrollPane jScrollPane1; private JRadioButton rdoAmmo; @@ -46,7 +48,7 @@ public class frmMain private JRadioButton rdoWeapons; private JTextPane txtLog; private JTextField txtSource; - + private void initComponents() { this.grpType = new ButtonGroup(); this.jPanel1 = new JPanel(); @@ -67,18 +69,18 @@ private void initComponents() { this.rdoEquipment = new JRadioButton(); this.rdoAmmo = new JRadioButton(); this.rdoQuirks = new JRadioButton(); - + setDefaultCloseOperation(3); getContentPane().setLayout(new GridBagLayout()); - + this.jLabel1.setText("Source File:"); this.jPanel1.add(this.jLabel1); - + this.txtSource.setEditable(false); this.txtSource.setMinimumSize(new Dimension(20, 20)); this.txtSource.setPreferredSize(new Dimension(20, 20)); this.jPanel1.add(this.txtSource); - + this.btnSetSource.setText("..."); this.btnSetSource.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { @@ -86,7 +88,7 @@ public void actionPerformed(ActionEvent evt) { } }); this.jPanel1.add(this.btnSetSource); - + getContentPane().add(this.jPanel1, new GridBagConstraints()); this.btnJson.setText("JSON"); @@ -96,7 +98,7 @@ public void actionPerformed(ActionEvent evt) { } }); this.jPanel2.add(this.btnJson); - + this.btnConvert.setText("Convert"); this.btnConvert.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { @@ -104,7 +106,7 @@ public void actionPerformed(ActionEvent evt) { } }); this.jPanel2.add(this.btnConvert); - + this.btnCancel.setText("Quit"); this.btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { @@ -112,68 +114,68 @@ public void actionPerformed(ActionEvent evt) { } }); this.jPanel2.add(this.btnCancel); - + GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = 13; getContentPane().add(this.jPanel2, gridBagConstraints); - + this.jPanel3.setLayout(new GridBagLayout()); - + this.jLabel2.setText("Logs"); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = 17; this.jPanel3.add(this.jLabel2, gridBagConstraints); - + this.txtLog.setMinimumSize(new Dimension(20, 20)); this.txtLog.setPreferredSize(new Dimension(200, 200)); this.jScrollPane1.setViewportView(this.txtLog); - + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; this.jPanel3.add(this.jScrollPane1, gridBagConstraints); - + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = 2; gridBagConstraints.insets = new Insets(4, 0, 0, 0); getContentPane().add(this.jPanel3, gridBagConstraints); - + this.jPanel4.setLayout(new BoxLayout(this.jPanel4, 3)); - + this.grpType.add(this.rdoWeapons); this.rdoWeapons.setSelected(true); this.rdoWeapons.setText("Weapons File"); this.jPanel4.add(this.rdoWeapons); - + this.grpType.add(this.rdoPhysicals); this.rdoPhysicals.setText("Physical Weapons"); this.jPanel4.add(this.rdoPhysicals); - + this.grpType.add(this.rdoEquipment); this.rdoEquipment.setText("Equipment"); this.jPanel4.add(this.rdoEquipment); - + this.grpType.add(this.rdoAmmo); this.rdoAmmo.setText("Ammunition File"); this.jPanel4.add(this.rdoAmmo); - + this.grpType.add(this.rdoQuirks); this.rdoQuirks.setText("Quirks"); this.jPanel4.add(this.rdoQuirks); - + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = 17; getContentPane().add(this.jPanel4, gridBagConstraints); - + pack(); } - + private void btnSetSourceActionPerformed(ActionEvent evt) { Media media = new Media(); File file = media.SelectFile("", "csv,dat", "Select"); @@ -193,7 +195,7 @@ private void btnSetSourceActionPerformed(ActionEvent evt) { } this.txtSource.setText(name); } - + private void btnConvertActionPerformed(ActionEvent evt) { if (!txtSource.getText().endsWith(".csv")) { Media.Messager("Binary Conversion can only work with semicolon-delimited files.\nPlease choose an appropriate CSV file."); @@ -211,7 +213,7 @@ private void btnConvertActionPerformed(ActionEvent evt) { bc.ConvertAmmunitionCSVtoBin(this.txtSource.getText(), this.txtSource.getText().replace(".csv", ".dat"), ";"); } else if (this.rdoQuirks.isSelected()) { bc.ConvertQuirksCSVtoBin(this.txtSource.getText(), this.txtSource.getText().replace(".csv", ".dat"), ";"); - } + } this.txtLog.setText(bc.GetMessages()); } From d4bf9c8287bbb0a478db1e9a791c177fc38d99d1 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sun, 13 Dec 2020 22:51:13 -0600 Subject: [PATCH 016/126] serial Version UID Added --- saw/src/main/java/saw/gui/dlgAboutBox.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/saw/src/main/java/saw/gui/dlgAboutBox.java b/saw/src/main/java/saw/gui/dlgAboutBox.java index 90259b25..dd28def5 100644 --- a/saw/src/main/java/saw/gui/dlgAboutBox.java +++ b/saw/src/main/java/saw/gui/dlgAboutBox.java @@ -32,6 +32,7 @@ import javax.swing.JFrame; public class dlgAboutBox extends javax.swing.JDialog { + private static final long serialVersionUID = -2014513138244194718L; JFrame Parent; @@ -324,5 +325,5 @@ private void btnLicenseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI private javax.swing.JLabel lblVersion; private javax.swing.JLabel lblVersionLabel; // End of variables declaration//GEN-END:variables - + } From 34b4a3d77f7b900432c5cb69f45571c7dc4c5135 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sun, 13 Dec 2020 22:51:52 -0600 Subject: [PATCH 017/126] Serial Version UID and Removed warning supression --- saw/src/main/java/saw/gui/dlgAmmoLotSize.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/saw/src/main/java/saw/gui/dlgAmmoLotSize.java b/saw/src/main/java/saw/gui/dlgAmmoLotSize.java index 5c0ed697..97474b69 100644 --- a/saw/src/main/java/saw/gui/dlgAmmoLotSize.java +++ b/saw/src/main/java/saw/gui/dlgAmmoLotSize.java @@ -32,6 +32,7 @@ import javax.swing.SpinnerNumberModel; public class dlgAmmoLotSize extends javax.swing.JDialog { + private static final long serialVersionUID = -9043812552454360378L; private Ammunition Ammo; private int CurAmmo; @@ -60,7 +61,6 @@ public boolean GetResult() { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; From d11473be15cac213fc202dfdd7c080d0deb7dab6 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sun, 13 Dec 2020 22:53:36 -0600 Subject: [PATCH 018/126] Serial Version UID Added --- saw/src/main/java/saw/gui/dlgArmorTonnage.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/saw/src/main/java/saw/gui/dlgArmorTonnage.java b/saw/src/main/java/saw/gui/dlgArmorTonnage.java index adfa212a..42a6aafc 100644 --- a/saw/src/main/java/saw/gui/dlgArmorTonnage.java +++ b/saw/src/main/java/saw/gui/dlgArmorTonnage.java @@ -34,9 +34,11 @@ import java.awt.event.ActionListener; public class dlgArmorTonnage extends javax.swing.JDialog { + private static final long serialVersionUID = -5493538800967300377L; + private boolean NewTonnage = false; private double result; - + /** Creates new form dlgArmorTonnage */ public dlgArmorTonnage(java.awt.Frame parent, boolean modal, CombatVehicle vee) { super(parent, modal); @@ -159,7 +161,7 @@ private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR NewTonnage = false; this.setVisible( false ); }//GEN-LAST:event_btnCancelActionPerformed - + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnCancel; private javax.swing.JButton btnOkay; From 91fa1d88b51375ff46ad6a96698a46510d8e07a0 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sun, 13 Dec 2020 22:59:06 -0600 Subject: [PATCH 019/126] Commented out code not being used Added Serial Version ID Removed warning supression --- saw/src/main/java/saw/gui/dlgBatchHMP.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/saw/src/main/java/saw/gui/dlgBatchHMP.java b/saw/src/main/java/saw/gui/dlgBatchHMP.java index f229ba50..e06a5575 100644 --- a/saw/src/main/java/saw/gui/dlgBatchHMP.java +++ b/saw/src/main/java/saw/gui/dlgBatchHMP.java @@ -36,9 +36,10 @@ import javax.swing.SwingWorker; import components.Mech; import filehandlers.*; -import saw.filehandlers.*; +// import saw.filehandlers.*; public class dlgBatchHMP extends javax.swing.JDialog implements PropertyChangeListener { + private static final long serialVersionUID = -7704272225299700617L; /** Creates new form dlgTextExport */ public dlgBatchHMP(java.awt.Frame parent, boolean modal ) { @@ -51,10 +52,12 @@ public void propertyChange( PropertyChangeEvent e ) { prgImporting.setValue( ((Importer) e.getSource()).getProgress() ); } - private class Importer extends SwingWorker { - dlgBatchHMP Owner; + private class Importer extends SwingWorker { + // Not used in class or any subclasses. + // dlgBatchHMP Owner; + public Importer( dlgBatchHMP owner ) { - Owner = owner; + // Owner = owner; } @Override @@ -135,7 +138,6 @@ protected Void doInBackground() throws Exception { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; From 9efb5411de3d28d4f73e3e3391a590f9f66311ec Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sun, 13 Dec 2020 23:03:38 -0600 Subject: [PATCH 020/126] Updated gitignore for VS Code settings --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index a23cba54..fe9b5ea2 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,8 @@ gradle-app.setting */Data/ # End of https://www.gitignore.io/api/gradle,intellij Logs/ + +.settings/ +bin/ +.classpath +.project From 7027945ef45da4dc86ff7380a18b92605c51a3c5 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 13:42:01 -0600 Subject: [PATCH 021/126] Commented out unused variable --- saw/src/main/java/saw/gui/dlgCostBVBreakdown.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/saw/src/main/java/saw/gui/dlgCostBVBreakdown.java b/saw/src/main/java/saw/gui/dlgCostBVBreakdown.java index 3c1b10cc..6e661a6a 100644 --- a/saw/src/main/java/saw/gui/dlgCostBVBreakdown.java +++ b/saw/src/main/java/saw/gui/dlgCostBVBreakdown.java @@ -32,16 +32,17 @@ import utilities.CVCostBVBreakdown; public class dlgCostBVBreakdown extends javax.swing.JDialog { + private static final long serialVersionUID = -5059025491169801993L; private CombatVehicle CurVee; - private String NL; + // private String NL; // Assigned but not used. /** Creates new form dlgCostBVBreakdown */ public dlgCostBVBreakdown(java.awt.Frame parent, boolean modal, CombatVehicle m ) { super(parent, modal); initComponents(); CurVee = m; - NL = System.getProperty( "line.separator" ); + // NL = System.getProperty( "line.separator" ); CVCostBVBreakdown Breakdown = new CVCostBVBreakdown(m); txtCostBV.setText( Breakdown.Render() ); txtCostBV.setCaretPosition( 0 ); @@ -53,7 +54,6 @@ public dlgCostBVBreakdown(java.awt.Frame parent, boolean modal, CombatVehicle m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { From d3b0ff3a506b8da898dd8ea65665a5290335f2f9 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 13:42:26 -0600 Subject: [PATCH 022/126] Added Serial Version UID --- saw/src/main/java/saw/gui/dlgCredits.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/saw/src/main/java/saw/gui/dlgCredits.java b/saw/src/main/java/saw/gui/dlgCredits.java index 15674573..64f1753f 100644 --- a/saw/src/main/java/saw/gui/dlgCredits.java +++ b/saw/src/main/java/saw/gui/dlgCredits.java @@ -29,7 +29,8 @@ package saw.gui; public class dlgCredits extends javax.swing.JDialog { - + private static final long serialVersionUID = -9066410622172896446L; + /** Creates new form dlgCredits */ public dlgCredits(java.awt.Frame parent, boolean modal) { super(parent, modal); @@ -37,7 +38,7 @@ public dlgCredits(java.awt.Frame parent, boolean modal) { setResizable( false ); setTitle( saw.Constants.AppName + " Credits" ); } - + /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is @@ -127,7 +128,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed dispose(); }//GEN-LAST:event_btnCloseActionPerformed - + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnClose; private javax.swing.JLabel jLabel1; @@ -137,5 +138,5 @@ private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel8; // End of variables declaration//GEN-END:variables - + } From 05375a8fced01fd0f6fc8e71bbe6b29791061e15 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 13:42:59 -0600 Subject: [PATCH 023/126] Removed warning supression and added Serial Version UID --- saw/src/main/java/saw/gui/dlgFiles.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/saw/src/main/java/saw/gui/dlgFiles.java b/saw/src/main/java/saw/gui/dlgFiles.java index 24bff2c7..396b2c41 100644 --- a/saw/src/main/java/saw/gui/dlgFiles.java +++ b/saw/src/main/java/saw/gui/dlgFiles.java @@ -16,6 +16,8 @@ * @author gblouin */ public class dlgFiles extends javax.swing.JDialog { + private static final long serialVersionUID = 7443919656231059051L; + public boolean result = false; /** Creates new form dlgSSWFiles */ @@ -29,7 +31,6 @@ public dlgFiles(java.awt.Frame parent, boolean modal) { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { From 349c07f761c0d4b9319a7d10d82341a5c23a23a9 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 13:43:17 -0600 Subject: [PATCH 024/126] Added serial version UID --- saw/src/main/java/saw/gui/dlgLicense.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/saw/src/main/java/saw/gui/dlgLicense.java b/saw/src/main/java/saw/gui/dlgLicense.java index 766f6337..a34f6b0f 100644 --- a/saw/src/main/java/saw/gui/dlgLicense.java +++ b/saw/src/main/java/saw/gui/dlgLicense.java @@ -29,6 +29,7 @@ package saw.gui; public class dlgLicense extends javax.swing.JDialog { + private static final long serialVersionUID = 1771463188420594068L; /** Creates new form dlgLicense */ public dlgLicense(java.awt.Frame parent, boolean modal) { @@ -128,5 +129,5 @@ private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextArea jTextArea1; // End of variables declaration//GEN-END:variables - + } From 8dd7d55bc351a233d74f353f59f05364baa5dff0 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 13:43:41 -0600 Subject: [PATCH 025/126] Added Serial Version UID --- saw/src/main/java/saw/gui/dlgOmniBase.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/saw/src/main/java/saw/gui/dlgOmniBase.java b/saw/src/main/java/saw/gui/dlgOmniBase.java index 51e27eac..057ff50b 100644 --- a/saw/src/main/java/saw/gui/dlgOmniBase.java +++ b/saw/src/main/java/saw/gui/dlgOmniBase.java @@ -31,6 +31,8 @@ import filehandlers.Media; public class dlgOmniBase extends javax.swing.JDialog { + private static final long serialVersionUID = -7470713520449456467L; + String input = ""; boolean cancel = false; @@ -137,7 +139,7 @@ private void OkayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:ev setVisible( false ); } }//GEN-LAST:event_OkayActionPerformed - + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton Okay; private javax.swing.JButton btnCancel; @@ -147,5 +149,5 @@ private void OkayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:ev private javax.swing.JPanel jPanel1; private javax.swing.JTextField txtLoadoutName; // End of variables declaration//GEN-END:variables - + } From 9410b4ac73cc2900f5d8af75790804eea0c955e2 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 13:49:18 -0600 Subject: [PATCH 026/126] SAW/GUI/dlgOpen - Type enforcement of combo boxes. --- saw/src/main/java/saw/gui/dlgOpen.java | 80 +++++++++++++------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/saw/src/main/java/saw/gui/dlgOpen.java b/saw/src/main/java/saw/gui/dlgOpen.java index f390614f..a2a86c1e 100644 --- a/saw/src/main/java/saw/gui/dlgOpen.java +++ b/saw/src/main/java/saw/gui/dlgOpen.java @@ -42,11 +42,13 @@ import filehandlers.*; import java.awt.event.KeyEvent; import java.util.ArrayList; -import javax.swing.ImageIcon; +// import javax.swing.ImageIcon; import list.*; import list.view.*; public class dlgOpen extends javax.swing.JFrame implements PropertyChangeListener { + private static final long serialVersionUID = 6589811493396909976L; + private common.DesignForm parent; private UnitList list = new UnitList(); private Media media = new Media(); @@ -66,15 +68,15 @@ public dlgOpen(java.awt.Frame parent, boolean modal) { //ImageIcon icon = new ImageIcon(super.getClass().getResource("/ssw/Images/appicon.png")); //super.setIconImage(icon.getImage()); this.parent = (common.DesignForm) parent; - + prgResaving.setVisible(false); - cmbTech.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Tech", "Clan", "Inner Sphere", "Mixed" })); - cmbEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Era", "Age of War/Star League", "Succession Wars", "Clan Invasion", "Dark Ages", "All Eras (non-canon)" })); - cmbRulesLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Level", "Introductory", "Tournament Legal", "Advanced Rules", "Experimental Tech", "Era Specific" })); - cmbMotive.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Motive", "Hovercraft", "Naval (Displacement)", "Naval (Hydrofoil)", "Naval (Submarine)", "Tracked", "VTOL", "Wheeled", "WiGE" })); + cmbTech.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Tech", "Clan", "Inner Sphere", "Mixed" })); + cmbEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Era", "Age of War/Star League", "Succession Wars", "Clan Invasion", "Dark Ages", "All Eras (non-canon)" })); + cmbRulesLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Level", "Introductory", "Tournament Legal", "Advanced Rules", "Experimental Tech", "Era Specific" })); + cmbMotive.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Motive", "Hovercraft", "Naval (Displacement)", "Naval (Hydrofoil)", "Naval (Submarine)", "Tracked", "VTOL", "Wheeled", "WiGE" })); NL = System.getProperty( "line.separator" ); } - + private void LoadMech() { switch ( Requestor ) { case SSW: @@ -97,11 +99,13 @@ private void LoadMechIntoSSW() { try { CVReader read = new CVReader(); - CombatVehicle m = read.ReadUnit( list.getDirectory() + Data.getFilename(), parent.GetData() ); + CombatVehicle m = read.ReadUnit(list.getDirectory() + Data.getFilename(), parent.GetData()); + if (Data.isOmni()) { - m.SetCurLoadout( Data.getConfig() ); + m.SetCurLoadout(Data.getConfig()); } - ArrayList units = new ArrayList(); + + ArrayList units = new ArrayList(); units.add(m); parent.setUnit( units ); @@ -141,7 +145,7 @@ public void LoadList(boolean useIndex) { this.lblStatus.setText("Loading Units..."); this.txtSelected.setText("0 Units Selected for 0 BV and 0 C-Bills"); this.tblMechData.setModel(new UnitList()); - + if (dirPath.isEmpty()) { dirPath = parent.GetPrefs().get("ListPath", parent.GetPrefs().get( "LastOpenCVDirectory", "" ) ); @@ -165,7 +169,7 @@ public void LoadList(boolean useIndex) { } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - + list = new UnitList(dirPath, useIndex); if (list.Size() > 0) { @@ -242,7 +246,7 @@ private void setTooltip( UnitListData data ) { //do nothing } } - + public void propertyChange( PropertyChangeEvent e ) { prgResaving.setValue( ((Resaver) e.getSource()).getProgress() ); } @@ -337,7 +341,6 @@ private void processFile( File file, CVReader read, CVWriter writer ) throws IOE * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { @@ -358,7 +361,7 @@ private void initComponents() { jSeparator3 = new javax.swing.JToolBar.Separator(); lblForce = new javax.swing.JLabel(); jSeparator5 = new javax.swing.JToolBar.Separator(); - cmbView = new javax.swing.JComboBox(); + cmbView = new javax.swing.JComboBox(); spnMechTable = new javax.swing.JScrollPane(); tblMechData = new javax.swing.JTable(); pnlFilters = new javax.swing.JPanel(); @@ -368,19 +371,19 @@ private void initComponents() { jPanel14 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); lblMinMP = new javax.swing.JLabel(); - cmbMinMP = new javax.swing.JComboBox(); + cmbMinMP = new javax.swing.JComboBox(); jPanel3 = new javax.swing.JPanel(); - cmbEra = new javax.swing.JComboBox(); + cmbEra = new javax.swing.JComboBox(); lblEra = new javax.swing.JLabel(); jPanel6 = new javax.swing.JPanel(); lblMotive = new javax.swing.JLabel(); - cmbMotive = new javax.swing.JComboBox(); + cmbMotive = new javax.swing.JComboBox(); jPanel2 = new javax.swing.JPanel(); - cmbTech = new javax.swing.JComboBox(); + cmbTech = new javax.swing.JComboBox(); lblTech = new javax.swing.JLabel(); jPanel4 = new javax.swing.JPanel(); lblLevel = new javax.swing.JLabel(); - cmbRulesLevel = new javax.swing.JComboBox(); + cmbRulesLevel = new javax.swing.JComboBox(); jPanel15 = new javax.swing.JPanel(); jPanel13 = new javax.swing.JPanel(); lblName = new javax.swing.JLabel(); @@ -550,7 +553,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { tlbActions.add(lblForce); tlbActions.add(jSeparator5); - cmbView.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Total Warfare Standard", "Total Warfare Compact", "BattleForce Information", "Chat Information" })); + cmbView.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Total Warfare Standard", "Total Warfare Compact", "BattleForce Information", "Chat Information" })); cmbView.setFocusable(false); cmbView.setMaximumSize(new java.awt.Dimension(139, 20)); cmbView.addActionListener(new java.awt.event.ActionListener() { @@ -624,7 +627,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { lblMinMP.setText("Min MP"); - cmbMinMP.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" })); + cmbMinMP.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" })); cmbMinMP.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbMinMPFilter(evt); @@ -646,7 +649,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(cmbMinMP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); - cmbEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Era", "Age of War/Star League", "Succession Wars", "Clan Invasion", "Dark Ages", "All Eras (non-canon)" })); + cmbEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Era", "Age of War/Star League", "Succession Wars", "Clan Invasion", "Dark Ages", "All Eras (non-canon)" })); cmbEra.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { Filter(evt); @@ -672,7 +675,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { lblMotive.setText("Motive Type"); - cmbMotive.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Motive", "Hover", "Naval (Displacement)", "Naval (Hydrofoil)", "Naval (Submarine)", "Tracked", "Wheeled", "WiGE" })); + cmbMotive.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Motive", "Hover", "Naval (Displacement)", "Naval (Hydrofoil)", "Naval (Submarine)", "Tracked", "Wheeled", "WiGE" })); cmbMotive.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbMotiveFilter(evt); @@ -694,7 +697,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(cmbMotive, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); - cmbTech.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Tech", "Clan", "Inner Sphere", "Mixed" })); + cmbTech.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Tech", "Clan", "Inner Sphere", "Mixed" })); cmbTech.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { Filter(evt); @@ -721,7 +724,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { lblLevel.setText("Rules Level"); - cmbRulesLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Level", "Introductory", "Tournament Legal", "Advanced Rules", "Experimental Tech", "Era Specific" })); + cmbRulesLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Level", "Introductory", "Tournament Legal", "Advanced Rules", "Experimental Tech", "Era Specific" })); cmbRulesLevel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbRulesLevelFilter(evt); @@ -1217,16 +1220,14 @@ private void Filter(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Filter }//GEN-LAST:event_Filter private void txtMinCostFilter(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMinCostFilter - // TODO add your handling code here: -}//GEN-LAST:event_txtMinCostFilter + }//GEN-LAST:event_txtMinCostFilter private void txtMaxCostFilter(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMaxCostFilter - // TODO add your handling code here: -}//GEN-LAST:event_txtMaxCostFilter + }//GEN-LAST:event_txtMaxCostFilter private void btnClearFilterFilter(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearFilterFilter setupList(list, false); - + //clear the dropdowns cmbEra.setSelectedIndex(0); cmbMotive.setSelectedIndex(0); @@ -1245,7 +1246,7 @@ private void btnClearFilterFilter(java.awt.event.ActionEvent evt) {//GEN-FIRST:e txtMaxYear.setText(""); txtName.setText(""); chkOmni.setSelected(false); -}//GEN-LAST:event_btnClearFilterFilter + }//GEN-LAST:event_btnClearFilterFilter private void btnAdd2ForceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAdd2ForceActionPerformed //lblForce.setText(""); @@ -1350,7 +1351,7 @@ private void tblMechDataKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:ev private void btnViewForceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnViewForceActionPerformed lblForce.setText(""); - + //if ( tblMechData.getSelectedRowCount() > 0 ) { // btnAdd2ForceActionPerformed(evt); //} @@ -1394,7 +1395,6 @@ private void txtNameKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ }//GEN-LAST:event_txtNameKeyReleased private void txtMaxYearFilter(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMaxYearFilter - // TODO add your handling code here: }//GEN-LAST:event_txtMaxYearFilter private void txtMinTonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtMinTonFocusLost @@ -1472,12 +1472,12 @@ public void setVisible( boolean b ) { private javax.swing.JButton btnRefresh; private javax.swing.JButton btnViewForce; private javax.swing.JCheckBox chkOmni; - private javax.swing.JComboBox cmbEra; - private javax.swing.JComboBox cmbMinMP; - private javax.swing.JComboBox cmbMotive; - private javax.swing.JComboBox cmbRulesLevel; - private javax.swing.JComboBox cmbTech; - private javax.swing.JComboBox cmbView; + private javax.swing.JComboBox cmbEra; + private javax.swing.JComboBox cmbMinMP; + private javax.swing.JComboBox cmbMotive; + private javax.swing.JComboBox cmbRulesLevel; + private javax.swing.JComboBox cmbTech; + private javax.swing.JComboBox cmbView; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel10; private javax.swing.JPanel jPanel11; From add9ef29eea0ec583d2f3a8103eda5bb55d13cbf Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 13:50:08 -0600 Subject: [PATCH 027/126] SAW/GUI - dlgPlaceableInfo - Removed warning supression - Added Serial Version UID --- saw/src/main/java/saw/gui/dlgPlaceableInfo.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/saw/src/main/java/saw/gui/dlgPlaceableInfo.java b/saw/src/main/java/saw/gui/dlgPlaceableInfo.java index 67b05351..0736a1e9 100644 --- a/saw/src/main/java/saw/gui/dlgPlaceableInfo.java +++ b/saw/src/main/java/saw/gui/dlgPlaceableInfo.java @@ -33,6 +33,8 @@ import components.abPlaceable; public class dlgPlaceableInfo extends javax.swing.JDialog { + private static final long serialVersionUID = 6473333535717708068L; + abPlaceable CurItem; /** Creates new form dlgPlaceableInfo */ @@ -120,7 +122,6 @@ private void SetState() { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; From ce252bd64ec1405c06b1ddeec9e1a7a20cbf59ba Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 13:51:50 -0600 Subject: [PATCH 028/126] SAW/GUI - dlgSummaryInfo - Added Serial Version UID --- saw/src/main/java/saw/gui/dlgSummaryInfo.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/saw/src/main/java/saw/gui/dlgSummaryInfo.java b/saw/src/main/java/saw/gui/dlgSummaryInfo.java index 1900255b..08bd7d5b 100644 --- a/saw/src/main/java/saw/gui/dlgSummaryInfo.java +++ b/saw/src/main/java/saw/gui/dlgSummaryInfo.java @@ -33,6 +33,8 @@ import javax.swing.JFrame; public class dlgSummaryInfo extends javax.swing.JDialog { + private static final long serialVersionUID = -296831143535570611L; + JFrame Parent; CombatVehicle CurVee; @@ -437,7 +439,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { private void btnOkayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkayActionPerformed dispose(); }//GEN-LAST:event_btnOkayActionPerformed - + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnOkay; private javax.swing.JLabel jLabel1; @@ -473,5 +475,5 @@ private void btnOkayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST private javax.swing.JLabel lblTotalDryWeight; private javax.swing.JLabel lblTotalWeight; // End of variables declaration//GEN-END:variables - + } From 29566dd380dda940302a5c1e4fba3d4c73722968 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 13:52:43 -0600 Subject: [PATCH 029/126] SAW/GUI - dlgTechBaseChooser - Added Serial Version UID - Removed warning supression --- saw/src/main/java/saw/gui/dlgTechBaseChooser.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/saw/src/main/java/saw/gui/dlgTechBaseChooser.java b/saw/src/main/java/saw/gui/dlgTechBaseChooser.java index d72972c0..62f81b37 100644 --- a/saw/src/main/java/saw/gui/dlgTechBaseChooser.java +++ b/saw/src/main/java/saw/gui/dlgTechBaseChooser.java @@ -29,6 +29,8 @@ package saw.gui; public class dlgTechBaseChooser extends javax.swing.JDialog { + private static final long serialVersionUID = -7559478011916662557L; + private boolean Clan = false; /** Creates new form dlgTechBaseChooser */ @@ -47,7 +49,6 @@ public boolean IsClan() { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; From ebc9b44c191d911952eac760f3c98d3baecda946 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 13:53:22 -0600 Subject: [PATCH 030/126] SAW/GUI - dlgTextExport - Added Serial Version UID - Removed warning supression --- saw/src/main/java/saw/gui/dlgTextExport.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/saw/src/main/java/saw/gui/dlgTextExport.java b/saw/src/main/java/saw/gui/dlgTextExport.java index cbd621e5..58605773 100644 --- a/saw/src/main/java/saw/gui/dlgTextExport.java +++ b/saw/src/main/java/saw/gui/dlgTextExport.java @@ -33,6 +33,11 @@ public class dlgTextExport extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -3127223371247674666L; + /** Creates new form dlgTextExport */ public dlgTextExport(java.awt.Frame parent, boolean modal, CombatVehicle m ) { super(parent, modal); @@ -56,7 +61,6 @@ public dlgTextExport( java.awt.Frame parent, boolean modal, String msg ) { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { From 2edfa046307d13c3c7357ef2f602bb55d6cbdad0 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 13:54:00 -0600 Subject: [PATCH 031/126] SAW/GUI - dlgVariableSize - Added Serial Version UID - Removed Warning Supression --- saw/src/main/java/saw/gui/dlgVariableSize.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/saw/src/main/java/saw/gui/dlgVariableSize.java b/saw/src/main/java/saw/gui/dlgVariableSize.java index 2459c70e..21a175f4 100644 --- a/saw/src/main/java/saw/gui/dlgVariableSize.java +++ b/saw/src/main/java/saw/gui/dlgVariableSize.java @@ -35,6 +35,11 @@ public class dlgVariableSize extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = 7797500260179881452L; + private Equipment CurEquip; private double CurTons; private CombatVehicle Owner; @@ -69,7 +74,6 @@ public boolean GetResult() { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; From 7d66da9fe2363cd92b534c72209b15517b9d3137 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 13:54:32 -0600 Subject: [PATCH 032/126] SAW/GUI - dlgWeaponInfo - Aded Serial Version UID --- saw/src/main/java/saw/gui/dlgWeaponInfo.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/saw/src/main/java/saw/gui/dlgWeaponInfo.java b/saw/src/main/java/saw/gui/dlgWeaponInfo.java index 46b4d793..0b015563 100644 --- a/saw/src/main/java/saw/gui/dlgWeaponInfo.java +++ b/saw/src/main/java/saw/gui/dlgWeaponInfo.java @@ -32,6 +32,11 @@ import components.*; public class dlgWeaponInfo extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -2926692648021667553L; + abPlaceable CurItem; /** Creates new form dlgItemInfo */ @@ -976,7 +981,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed dispose(); }//GEN-LAST:event_btnCloseActionPerformed - + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnClose; private javax.swing.JLabel jLabel1; @@ -1056,5 +1061,5 @@ private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS private javax.swing.JPanel pnlClanAvailability; private javax.swing.JPanel pnlISAvailability; // End of variables declaration//GEN-END:variables - + } From 08621f7b25413e9a109bd8f2c2e8e7294dedac0e Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 15:07:29 -0600 Subject: [PATCH 033/126] SAW/GUI - EquipmentListRenderer - Commented out values not being used - added Serial Version UID - Added comment regarding parameter and type --- .../main/java/saw/gui/EquipmentListRenderer.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/saw/src/main/java/saw/gui/EquipmentListRenderer.java b/saw/src/main/java/saw/gui/EquipmentListRenderer.java index d5f5365e..267c6128 100644 --- a/saw/src/main/java/saw/gui/EquipmentListRenderer.java +++ b/saw/src/main/java/saw/gui/EquipmentListRenderer.java @@ -33,23 +33,29 @@ import javax.swing.JLabel; import javax.swing.JList; import components.AvailableCode; -import components.CombatVehicle; +// import components.CombatVehicle; import components.Equipment; import components.abPlaceable; import components.EquipmentCollection; public class EquipmentListRenderer extends DefaultListCellRenderer { + /** + * + */ + private static final long serialVersionUID = -5019499364200237551L; + private ifVeeForm Parent; - private CombatVehicle CurVee; + // private CombatVehicle CurVee; // Variable Not Used. + private abPlaceable a = null; public EquipmentListRenderer( ifVeeForm v ) { Parent = v; } - @Override + @Override // What kind of element gets passed into the list? public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { - JLabel label = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, hasFocus); + JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, hasFocus); String Text = ""; if( value instanceof abPlaceable ) { a = (abPlaceable) value; From 9b1aa449384e676255f1fbd44ad0caa42d4e3fef Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 15:09:43 -0600 Subject: [PATCH 034/126] SAW/GUI - EquipmentSelectedRenderer - Added Serial Version UID - Added comment regarding list being passed in --- saw/src/main/java/saw/gui/EquipmentSelectedRenderer.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/saw/src/main/java/saw/gui/EquipmentSelectedRenderer.java b/saw/src/main/java/saw/gui/EquipmentSelectedRenderer.java index c47d4b2b..799bcef3 100644 --- a/saw/src/main/java/saw/gui/EquipmentSelectedRenderer.java +++ b/saw/src/main/java/saw/gui/EquipmentSelectedRenderer.java @@ -36,6 +36,11 @@ import filehandlers.FileCommon; public class EquipmentSelectedRenderer extends DefaultListCellRenderer { + /** + * + */ + private static final long serialVersionUID = 7036001042258389350L; + private ifVeeForm Parent; private abPlaceable a = null; @@ -43,7 +48,7 @@ public EquipmentSelectedRenderer( ifVeeForm v ) { Parent = v; } - @Override + @Override // What kind of type gets passed into the list? public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { JLabel label = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, hasFocus); String Text = ""; @@ -74,4 +79,4 @@ public Component getListCellRendererComponent(JList list, Object value, int inde return label; } -} \ No newline at end of file +} From 56a92aedac09a7065eb9c9947b55ef122d78c1e5 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 15:16:05 -0600 Subject: [PATCH 035/126] SAW/GUI - ifVeeForm - Removed imports not being used --- saw/src/main/java/saw/gui/ifVeeForm.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/saw/src/main/java/saw/gui/ifVeeForm.java b/saw/src/main/java/saw/gui/ifVeeForm.java index e8131bb9..e04fb708 100644 --- a/saw/src/main/java/saw/gui/ifVeeForm.java +++ b/saw/src/main/java/saw/gui/ifVeeForm.java @@ -28,12 +28,12 @@ package saw.gui; -import common.DataFactory; +// import common.DataFactory; import components.CombatVehicle; -import components.abPlaceable; -import dialog.frmForce; -import java.util.prefs.Preferences; -import states.ifState; +// import components.abPlaceable; +// import dialog.frmForce; +// import java.util.prefs.Preferences; +// import states.ifState; /** * From db8a1f0ad40202937c0fbf02bec5fcff76b39753 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 15:18:11 -0600 Subject: [PATCH 036/126] SAW/GUI - EquimentListRenderer/EquipmentSelectedRenderer - Adjusted type of JList to be "Any" --- saw/src/main/java/saw/gui/EquipmentListRenderer.java | 4 ++-- saw/src/main/java/saw/gui/EquipmentSelectedRenderer.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/saw/src/main/java/saw/gui/EquipmentListRenderer.java b/saw/src/main/java/saw/gui/EquipmentListRenderer.java index 267c6128..19e9014b 100644 --- a/saw/src/main/java/saw/gui/EquipmentListRenderer.java +++ b/saw/src/main/java/saw/gui/EquipmentListRenderer.java @@ -53,8 +53,8 @@ public EquipmentListRenderer( ifVeeForm v ) { Parent = v; } - @Override // What kind of element gets passed into the list? - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, hasFocus); String Text = ""; if( value instanceof abPlaceable ) { diff --git a/saw/src/main/java/saw/gui/EquipmentSelectedRenderer.java b/saw/src/main/java/saw/gui/EquipmentSelectedRenderer.java index 799bcef3..8a02d91b 100644 --- a/saw/src/main/java/saw/gui/EquipmentSelectedRenderer.java +++ b/saw/src/main/java/saw/gui/EquipmentSelectedRenderer.java @@ -48,8 +48,8 @@ public EquipmentSelectedRenderer( ifVeeForm v ) { Parent = v; } - @Override // What kind of type gets passed into the list? - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { JLabel label = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, hasFocus); String Text = ""; if( value instanceof abPlaceable ) { From 561bf188ad70cd174f013ed5e4d727b697986082 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 15:29:17 -0600 Subject: [PATCH 037/126] SSW/Components - CCGMech - Removed imports that weren't used. - Commented out variables not used - Commented out loops that weren't used. - Additional formmating done via VSCode --- ssw/src/main/java/ssw/components/CCGMech.java | 535 +++++++++--------- 1 file changed, 273 insertions(+), 262 deletions(-) diff --git a/ssw/src/main/java/ssw/components/CCGMech.java b/ssw/src/main/java/ssw/components/CCGMech.java index 66e9b510..6e61523a 100644 --- a/ssw/src/main/java/ssw/components/CCGMech.java +++ b/ssw/src/main/java/ssw/components/CCGMech.java @@ -6,69 +6,57 @@ package ssw.components; import components.PhysicalWeapon; -import components.PhysicalWeapon; -import components.RangedWeapon; import components.RangedWeapon; import components.abPlaceable; -import components.abPlaceable; -import components.ifWeapon; import components.ifWeapon; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.ArrayList; + /** - * - * CCGMech - Class that generates a Battletech CCG card - * based upon data provided from Mech class. For now, use - * dlgCCGMech to display the relevant information. - * - * CCGMech handles the conversion of a 'Mech from the tabletop - * rules into a card that can be used in the Battletech CCG game. - * - * The goal of this class is to reproduce the stats on the cards - * for those 'Mechs already included in the game. Other 'Mechs - * should be generated in a manner consistent with the canon - * cards in an effort to keep play balanced. - * - * The current conversion process is a little long to be - * detailed here, but they are based upon Gauss Bears - * Inofficial Conversion Rules. * - * There are still a few special abilities to generate, 'Mech cost to - * calculate, and a whole bunch of fiddling with equations. In addition, - * the class currently does not check if a canon card already exists. + * CCGMech - Class that generates a Battletech CCG card based upon data provided + * from Mech class. For now, use dlgCCGMech to display the relevant information. + * + * CCGMech handles the conversion of a 'Mech from the tabletop rules into a card + * that can be used in the Battletech CCG game. + * + * The goal of this class is to reproduce the stats on the cards for those + * 'Mechs already included in the game. Other 'Mechs should be generated in a + * manner consistent with the canon cards in an effort to keep play balanced. + * + * The current conversion process is a little long to be detailed here, but they + * are based upon Gauss Bears Inofficial Conversion Rules. + * + * There are still a few special abilities to generate, 'Mech cost to calculate, + * and a whole bunch of fiddling with equations. In addition, the class + * currently does not check if a canon card already exists. * * @author Kevin */ public class CCGMech { - private String Name = "", - FullName = "", - ImageSrc = "", - Faction = "", - SpecialAbilities = "", - FlavourText = "", - IllustratorName = "", - Loadout = "", - Cost = ""; + private String Name = "", FullName = "", + // ImageSrc = "", + // Faction = "", + // FlavourText = "", + // IllustratorName = "", + // Loadout = "", + // Cost = "", + SpecialAbilities = ""; private char MovementRate = 'S'; - private int ResourceCost = 0, - Mass = 0, - MunitionsAttributeCost = 0, - TacticsAttributeCost = 0, - LogisticsAttributeCost = 0, - PoliticsAttributeCost = 0, - AssemblyAttributeCost = 0, - AttackValue = 0, - ArmourValue = 0, - StructureValue = 0, - MissileDamage = 0, - OverheatDamage = 0, - AlphaStrikeDamage = 0, - LeakDamage = 0; - - //These Strings should be bundled up into a single class. - //Also, I should learn to printf() Java styles cause this is dirty. + private int Mass = 0, + // ResourceCost = 0, + // MunitionsAttributeCost = 0, + // TacticsAttributeCost = 0, + // LogisticsAttributeCost = 0, + // PoliticsAttributeCost = 0, + // AssemblyAttributeCost = 0, + AttackValue = 0, ArmourValue = 0, StructureValue = 0, MissileDamage = 0, + // OverheatDamage = 0, + AlphaStrikeDamage = 0, LeakDamage = 0; + + // These Strings should be bundled up into a single class. + // Also, I should learn to printf() Java styles cause this is dirty. private static String AblSlow = " cannot block unless guarding.\n"; private static String AblDasher1 = "You may move "; private static String AblDasher2 = " to your Patrol region as soon as you activate it.\n"; @@ -76,7 +64,7 @@ public class CCGMech { private static String AblAP2 = " deals +1 damage to any target other than a 'Mech)\n"; private static String AblPA1 = "If "; private static String AblPA2 = " blocks or is blocked by at least one "; - private static String AblPA3= " 'Mech, "; + private static String AblPA3 = " 'Mech, "; private static String AblPA4 = " deals +1 damage to one of those "; private static String AblPA5 = " 'Mech.\n"; private static String AblJump = "Jump (-1 attack: +1 initiative)\n"; @@ -85,15 +73,17 @@ public class CCGMech { private static String AblLeak3 = " of its damage to the target.\n"; /** - * This constructor should build the entire card. Possibly an entire - * Mech object can be passed in here, although this system works for now. + * This constructor should build the entire card. Possibly an entire Mech object + * can be passed in here, although this system works for now. * - * Eventually, this constructor should check to see if there exists a - * canon CCG card, in which case those stats should be used. Otherwise - * we can generate a (hopefully) balanced card using the conversion process. + * Eventually, this constructor should check to see if there exists a canon CCG + * card, in which case those stats should be used. Otherwise we can generate a + * (hopefully) balanced card using the conversion process. * - * @param name The 'Mech's name without variant info. Normally aMech.GetName(). - * @param fullname The full name of the unit (appears on top of card. Normally aMech.GetFullName(); + * @param name The 'Mech's name without variant info. Normally + * aMech.GetName(). + * @param fullname The full name of the unit (appears on top of card. Normally + * aMech.GetFullName(); */ public CCGMech(String name, String fullname) { Name = name; @@ -101,154 +91,155 @@ public CCGMech(String name, String fullname) { } /** - * Sets the movement rate for the card based upon the 'Mech's - * walking speed. + * Sets the movement rate for the card based upon the 'Mech's walking speed. * - * [0-2] Slow, Slowpoke ability. - * [3] Slow - * [4-6] Moderate - * [7-8] Fast - * [9+] Fast, Dasher ability. + * [0-2] Slow, Slowpoke ability. [3] Slow [4-6] Moderate [7-8] Fast [9+] Fast, + * Dasher ability. * - * TODO: Possibility of MASC or Supercharger ability. Something - * like: - * MASC (Place a MASC token on this card. The 'Mech - * takes 1 Damage for every MASC token on the card, - * but may operate as if it was one speed level faster.) + * TODO: Possibility of MASC or Supercharger ability. Something like: MASC + * (Place a MASC token on this card. The 'Mech takes 1 Damage for every MASC + * token on the card, but may operate as if it was one speed level faster.) * * @param walkSpeed The walk MP of the 'Mech */ public void setMovementRate(int walkSpeed) { - if(walkSpeed <= 3) { + if (walkSpeed <= 3) { MovementRate = 'S'; - if(walkSpeed < 3) { + if (walkSpeed < 3) { SpecialAbilities = SpecialAbilities + Name + AblSlow + "\n"; } - } else if(walkSpeed <= 6) { + } else if (walkSpeed <= 6) { MovementRate = 'M'; } else if (walkSpeed > 6) { MovementRate = 'F'; - if(walkSpeed >= 9 ) { + if (walkSpeed >= 9) { SpecialAbilities = SpecialAbilities + AblDasher1 + Name + AblDasher2 + "\n"; } } } /** - * IF the mech has a single jump jet, it gets - * the jump ability. + * IF the mech has a single jump jet, it gets the jump ability. * - * TODO: Possiblity of an IJJ ability. Something - * like: - * Improved Jump (-1 Attack, +1 Initiative), 'Mech - * operates as if it was one speed level faster. + * TODO: Possiblity of an IJJ ability. Something like: Improved Jump (-1 Attack, + * +1 Initiative), 'Mech operates as if it was one speed level faster. * * @param jump */ public void setJump(int jump) { - if(jump > 0) { + if (jump > 0) { SpecialAbilities = SpecialAbilities + AblJump + "\n"; } } /** - * The 'Mech's mass is used when assigning structure - * values. Heavier mechs tend to have more armour than - * lighter ones. You should set the mass before you + * The 'Mech's mass is used when assigning structure values. Heavier mechs tend + * to have more armour than lighter ones. You should set the mass before you * setArmourAndStructure(). * * @param mass The mas of the 'Mech */ - public void setMass (int mass) { + public void setMass(int mass) { Mass = mass; } /** - * The function is very much a work in progress. Currently, it is one unholy - * mess of an if statement. Each piece of equipment from the loadout is - * checked to see if it is a weapon. If it is, check to see if it is rear-mounted - * (in which case it is ignored) or an MG (in which case it gives the card - * the AntiPersonnel ability. + * The function is very much a work in progress. Currently, it is one unholy + * mess of an if statement. Each piece of equipment from the loadout is checked + * to see if it is a weapon. If it is, check to see if it is rear-mounted (in + * which case it is ignored) or an MG (in which case it gives the card the + * AntiPersonnel ability. * - * From there, each main class of weapons is checked. Basic algorithm is - * that weapon damage is divided by a range factor (long range weapons - * have a lower range factor) to produce an Attack value for that weapon. + * From there, each main class of weapons is checked. Basic algorithm is that + * weapon damage is divided by a range factor (long range weapons have a lower + * range factor) to produce an Attack value for that weapon. * - * Missile weapons are split between LRMs and all others. LRMs increase a - * Mech's missile ability, while MRMs and SRMs increase the attack value. - * (unlike in the conversion rules, SRMs do not currently grant alpha - * strike, although I think that maybe MRMs should). - * Artemis IV is accounted for, but NARC and Apollo currently aren't. + * Missile weapons are split between LRMs and all others. LRMs increase a Mech's + * missile ability, while MRMs and SRMs increase the attack value. (unlike in + * the conversion rules, SRMs do not currently grant alpha strike, although I + * think that maybe MRMs should). Artemis IV is accounted for, but NARC and + * Apollo currently aren't. * * TODO: NARC and MRMs to Alpha Strike. * - * Next is ballistic weapons. Ac-20s of all types give +2 Alpha strike and - * count half damage and heat towards Attack value. Ac-10s and Heavy Gauss - * Rifles count +1 to Alpha Strike and half damage and heat as well. - * Gauss and Heavy Gauss also count +1 to leak damage for long range fire. - * Remaining ballistic weapons add to Attack Value only. + * Next is ballistic weapons. Ac-20s of all types give +2 Alpha strike and count + * half damage and heat towards Attack value. Ac-10s and Heavy Gauss Rifles + * count +1 to Alpha Strike and half damage and heat as well. Gauss and Heavy + * Gauss also count +1 to leak damage for long range fire. Remaining ballistic + * weapons add to Attack Value only. * * TODO: Light Gauss rifle. * - * Finally Energy weapons (and all others). 3 or more PPCs or ERLL - * contribute a +1 to leak damage, while 1 ER PPC does the same. - * All Attack values from energy weapons are multiplied by 1.3 as - * well. Unlike the conversion rules, there is no range factor reduction - * for IS Pulse Weapons, although there probably should be. + * Finally Energy weapons (and all others). 3 or more PPCs or ERLL contribute a + * +1 to leak damage, while 1 ER PPC does the same. All Attack values from + * energy weapons are multiplied by 1.3 as well. Unlike the conversion rules, + * there is no range factor reduction for IS Pulse Weapons, although there + * probably should be. * * The overheat situation is all borked up, I have no idea how to properly - * implement it. The conversion rules are all fuzzy and happy about it, - * but it's basically fudge work. + * implement it. The conversion rules are all fuzzy and happy about it, but it's + * basically fudge work. * * I'm going to try counting weapon damage as a block value (ie if the mech * overheats by 4, does 10 damage and produces 14 heat, instead of removing * individual weapons ill do the ideal solution and remove 4 heat worth of - * damage under the (faulty) assumption that all weapons have identical - * heat to damage ratios. + * damage under the (faulty) assumption that all weapons have identical heat to + * damage ratios. * * - * @param CurrentLoadout The ArrayList from a Mech class with weapons and equipment. - * @param MovementHeat The maximum heat the 'Mech generates by moving (Usually 2 unless it jumps). - * @param TotalHeatDis The total amount of heat the 'Mech can dissapate in one turn. + * @param CurrentLoadout The ArrayList from a Mech class with weapons and + * equipment. + * @param MovementHeat The maximum heat the 'Mech generates by moving (Usually + * 2 unless it jumps). + * @param TotalHeatDis The total amount of heat the 'Mech can dissapate in one + * turn. */ - public void setAttackValue(ArrayList CurrentLoadout, int MovementHeat, int TotalHeatDis) { + public void setAttackValue(ArrayList CurrentLoadout, int MovementHeat, int TotalHeatDis) { double attackValue = 0.0; double missileValue = 0.0; int vanPPCERLLcount = 0; List weaponList = new ArrayList(); - if( CurrentLoadout.size() > 0 ) { - for( int i = 0; i < CurrentLoadout.size(); i++ ) { - if(CurrentLoadout.get(i) instanceof ifWeapon) { - ifWeapon currentWeapon = (ifWeapon) CurrentLoadout.get(i); + if (CurrentLoadout.size() > 0) { + for (int i = 0; i < CurrentLoadout.size(); i++) { + if (CurrentLoadout.get(i) instanceof ifWeapon) { + ifWeapon currentWeapon = CurrentLoadout.get(i); double currentWeaponAttackValue = 0.0; double currentMissileValue = 0.0; - //a bunch of checks to see if we even need to calculated - //for this particular weapon: + // a bunch of checks to see if we even need to calculated + // for this particular weapon: // if(currentWeapon.) - boolean notRear = true; - boolean notMG = true; - boolean physical = false; - boolean missile = false; - if(((abPlaceable)currentWeapon).IsMountedRear()) { - notRear = false; - }else if(currentWeapon.LookupName().contains("Machine Gun")) { - notMG = false; + + // Although these are assigned, they are not used anywhere. + // boolean notRear = true; + // boolean notMG = true; + // boolean physical = false; + // boolean missile = false; + + if (((abPlaceable) currentWeapon).IsMountedRear()) { + // notRear = false; + } else if (currentWeapon.LookupName().contains("Machine Gun")) { + // notMG = false; SpecialAbilities = SpecialAbilities + AblAP1 + Name + AblAP2 + "\n"; - }else if(currentWeapon instanceof PhysicalWeapon ){ - physical = true; - if(Mass >= 80) { + } else if (currentWeapon instanceof PhysicalWeapon) { + // physical = true; + + if (Mass >= 80) { currentWeaponAttackValue = 2.0; } else { currentWeaponAttackValue = 1.0; } - SpecialAbilities = SpecialAbilities + AblPA1 + Name + AblPA2 + MovementRate + AblPA3 + Name + AblPA4 + MovementRate + AblPA5 + "\n"; - }else if(currentWeapon.GetWeaponClass() == ifWeapon.W_MISSILE ){ - //need to handle NARC in here somehow. - missile = true; + + SpecialAbilities = SpecialAbilities + AblPA1 + Name + AblPA2 + MovementRate + AblPA3 + Name + + AblPA4 + MovementRate + AblPA5 + "\n"; + } else if (currentWeapon.GetWeaponClass() == ifWeapon.W_MISSILE) { + // need to handle NARC in here somehow. + // missile = true; + int clusterSize = currentWeapon.ClusterSize(); - if(currentWeapon.GetRangeLong() > 15) { - //LRMS - if(clusterSize == 5) { + + if (currentWeapon.GetRangeLong() > 15) { + // LRMS + if (clusterSize == 5) { currentMissileValue = 3; } else if (clusterSize == 10) { currentMissileValue = 6; @@ -257,17 +248,17 @@ public void setAttackValue(ArrayList CurrentLoadout, int MovementHeat, int Total } else if (clusterSize == 20) { currentMissileValue = 12; } - if(((RangedWeapon)currentWeapon).GetFCS() != null) { + if (((RangedWeapon) currentWeapon).GetFCS() != null) { currentMissileValue = currentMissileValue * 4 / 3; } - if(currentWeapon.GetRangeMin() > 0){ + if (currentWeapon.GetRangeMin() > 0) { currentMissileValue = currentMissileValue * 0.75; } currentMissileValue = currentMissileValue / 8; missileValue = missileValue + currentMissileValue; - } else if(currentWeapon.GetRangeLong() > 12) { - //MRMs (add some alpha strike code here) - if(clusterSize == 10) { + } else if (currentWeapon.GetRangeLong() > 12) { + // MRMs (add some alpha strike code here) + if (clusterSize == 10) { currentMissileValue = 6; } else if (clusterSize == 20) { currentMissileValue = 12; @@ -276,11 +267,11 @@ public void setAttackValue(ArrayList CurrentLoadout, int MovementHeat, int Total } else if (clusterSize == 40) { currentMissileValue = 24; } - currentMissileValue = currentMissileValue * 0.8 /7; + currentMissileValue = currentMissileValue * 0.8 / 7; attackValue = attackValue + currentMissileValue; - } else if(currentWeapon.GetRangeLong() > 9) { - //Clan Streak SRMs - if(clusterSize == 2) { + } else if (currentWeapon.GetRangeLong() > 9) { + // Clan Streak SRMs + if (clusterSize == 2) { currentMissileValue = 4; } else if (clusterSize == 4) { currentMissileValue = 8; @@ -290,90 +281,91 @@ public void setAttackValue(ArrayList CurrentLoadout, int MovementHeat, int Total currentMissileValue = currentMissileValue / 7; attackValue = attackValue + currentMissileValue; } else { - //SRMS - if(clusterSize == 2) { + // SRMS + if (clusterSize == 2) { currentMissileValue = 2; } else if (clusterSize == 4) { currentMissileValue = 6; } else if (clusterSize == 6) { currentMissileValue = 4; } - if(currentWeapon.IsStreak()) { + if (currentWeapon.IsStreak()) { currentMissileValue = clusterSize * 2; - } else if(((RangedWeapon)currentWeapon).GetFCS() != null) { + } else if (((RangedWeapon) currentWeapon).GetFCS() != null) { currentMissileValue = currentMissileValue + 2; } currentMissileValue = currentMissileValue / 9; attackValue = attackValue + currentMissileValue; } - } else if((currentWeapon.GetWeaponClass() == ifWeapon.W_BALLISTIC) ){ - if(currentWeapon.GetDamageLong() == 20) { + } else if ((currentWeapon.GetWeaponClass() == ifWeapon.W_BALLISTIC)) { + if (currentWeapon.GetDamageLong() == 20) { AlphaStrikeDamage = AlphaStrikeDamage + 2; - if(currentWeapon.GetRangeLong() >= 12) { + if (currentWeapon.GetRangeLong() >= 12) { currentWeaponAttackValue = currentWeapon.GetDamageMedium() / 7.0 / 2.0; } else { currentWeaponAttackValue = currentWeapon.GetDamageMedium() / 9.0 / 2.0; } - } else if(currentWeapon.GetDamageLong() == 10) { - //Hvy Gauss or AC/10. + } else if (currentWeapon.GetDamageLong() == 10) { + // Hvy Gauss or AC/10. AlphaStrikeDamage = AlphaStrikeDamage + 1; - if(currentWeapon.GetRangeLong() >= 18){ - currentWeaponAttackValue = currentWeapon.GetDamageMedium()/ 5.0 / 2.0 * 0.75; + if (currentWeapon.GetRangeLong() >= 18) { + currentWeaponAttackValue = currentWeapon.GetDamageMedium() / 5.0 / 2.0 * 0.75; LeakDamage++; - } else if(currentWeapon.GetRangeLong() >= 12) { - currentWeaponAttackValue = currentWeapon.GetDamageMedium()/ 7.0 / 2.0; - } else if(currentWeapon.GetRangeLong() >= 7) { - currentWeaponAttackValue = currentWeapon.GetDamageMedium()/ 9.0 / 2.0; + } else if (currentWeapon.GetRangeLong() >= 12) { + currentWeaponAttackValue = currentWeapon.GetDamageMedium() / 7.0 / 2.0; + } else if (currentWeapon.GetRangeLong() >= 7) { + currentWeaponAttackValue = currentWeapon.GetDamageMedium() / 9.0 / 2.0; } else { - currentWeaponAttackValue = currentWeapon.GetDamageMedium()/ 11.0 / 2.0; + currentWeaponAttackValue = currentWeapon.GetDamageMedium() / 11.0 / 2.0; } - } else if(currentWeapon.GetDamageLong() == 15) { - //Standard Gauss - currentWeaponAttackValue = currentWeapon.GetDamageMedium()/ 5.0 / 2.0 * 0.75; + } else if (currentWeapon.GetDamageLong() == 15) { + // Standard Gauss + currentWeaponAttackValue = currentWeapon.GetDamageMedium() / 5.0 / 2.0 * 0.75; LeakDamage++; } else { - if(currentWeapon.GetRangeLong() >= 18){ - currentWeaponAttackValue = currentWeapon.GetDamageMedium()/5.0; - } else if(currentWeapon.GetRangeLong() >= 12) { - currentWeaponAttackValue = currentWeapon.GetDamageMedium()/7.0; - } else if(currentWeapon.GetRangeLong() >= 7) { - currentWeaponAttackValue = currentWeapon.GetDamageMedium()/9.0; + if (currentWeapon.GetRangeLong() >= 18) { + currentWeaponAttackValue = currentWeapon.GetDamageMedium() / 5.0; + } else if (currentWeapon.GetRangeLong() >= 12) { + currentWeaponAttackValue = currentWeapon.GetDamageMedium() / 7.0; + } else if (currentWeapon.GetRangeLong() >= 7) { + currentWeaponAttackValue = currentWeapon.GetDamageMedium() / 9.0; } else { - currentWeaponAttackValue = currentWeapon.GetDamageMedium()/11.0; + currentWeaponAttackValue = currentWeapon.GetDamageMedium() / 11.0; } - if(currentWeapon.GetRangeMin() > 0) { + if (currentWeapon.GetRangeMin() > 0) { currentWeaponAttackValue = currentWeaponAttackValue * 0.75; } } } else { - if(currentWeapon.GetRangeLong() >= 18){ - currentWeaponAttackValue = currentWeapon.GetDamageMedium()/5.0; - if(currentWeapon.GetRangeLong() >= 19) { + if (currentWeapon.GetRangeLong() >= 18) { + currentWeaponAttackValue = currentWeapon.GetDamageMedium() / 5.0; + if (currentWeapon.GetRangeLong() >= 19) { LeakDamage++; } else { vanPPCERLLcount++; } - if(vanPPCERLLcount > 2) { + if (vanPPCERLLcount > 2) { vanPPCERLLcount = 0; LeakDamage++; } - } else if(currentWeapon.GetRangeLong() >= 12) { - currentWeaponAttackValue = currentWeapon.GetDamageMedium()/7.0; - } else if(currentWeapon.GetRangeLong() >= 7) { - currentWeaponAttackValue = currentWeapon.GetDamageMedium()/9.0; + } else if (currentWeapon.GetRangeLong() >= 12) { + currentWeaponAttackValue = currentWeapon.GetDamageMedium() / 7.0; + } else if (currentWeapon.GetRangeLong() >= 7) { + currentWeaponAttackValue = currentWeapon.GetDamageMedium() / 9.0; } else { - currentWeaponAttackValue = currentWeapon.GetDamageMedium()/11.0; + currentWeaponAttackValue = currentWeapon.GetDamageMedium() / 11.0; } - if(currentWeapon.GetRangeMin() > 0) { + if (currentWeapon.GetRangeMin() > 0) { currentWeaponAttackValue = currentWeaponAttackValue * 0.75; } - if(currentWeapon.GetWeaponClass() == ifWeapon.W_ENERGY ) { + if (currentWeapon.GetWeaponClass() == ifWeapon.W_ENERGY) { currentWeaponAttackValue = currentWeaponAttackValue * 1.3; } } - //System.out.println(currentWeapon.GetName() + " " + currentWeapon.GetType() + " " + currentWeapon.GetDamageMedium()); - if(currentWeaponAttackValue > 0.0) { + // System.out.println(currentWeapon.GetName() + " " + currentWeapon.GetType() + + // " " + currentWeapon.GetDamageMedium()); + if (currentWeaponAttackValue > 0.0) { WeaponData wep = new WeaponData(); wep.Damage = currentWeaponAttackValue; wep.Heat = currentWeapon.GetHeat(); @@ -383,171 +375,184 @@ public void setAttackValue(ArrayList CurrentLoadout, int MovementHeat, int Total } } } -// System.out.println("Un-Sorted"); -// for(int c = 0; c < weaponList.size(); c++) { -// WeaponData wep = weaponList.get(c); -// System.out.println("AttackValue: " + wep.Damage + " HeatValue: " + wep.Heat); -// } -// + + /* + * Both this batch and the batch after the sort appear to be Debuging statements + * to confirm sorting. First was already commented out, section had the output + * commented. Just made both uniform for styling and remove an effective no-op. + */ + + /* No-op */ + // System.out.println("Un-Sorted"); + // for(int c = 0; c < weaponList.size(); c++) { + // WeaponData wep = weaponList.get(c); + // System.out.println("AttackValue: " + wep.Damage + " HeatValue: " + wep.Heat); + // } + Collections.sort(weaponList); - System.out.println("Sorted"); - for(int c = 0; c < weaponList.size(); c++) { - WeaponData wep = weaponList.get(c); - // System.out.println("AttackValue: " + wep.Damage + " HeatValue: " + wep.Heat); - } + + /* No-op */ + // System.out.println("Sorted"); + // for(int c = 0; c < weaponList.size(); c++) { + // WeaponData wep = weaponList.get(c); + // // System.out.println("AttackValue: " + wep.Damage + " HeatValue: " + + // wep.Heat); + // } int heat = MovementHeat; - for(int c = 0; c < weaponList.size(); c++) { - heat = heat + weaponList.get(c).Heat; + for (int c = 0; c < weaponList.size(); c++) { + heat = heat + weaponList.get(c).Heat; } double overHeatDamage = 0.0; double overHeatHeat = 0.0; - if(heat > TotalHeatDis) { - for(int c = 0; c < weaponList.size(); c++) { + if (heat > TotalHeatDis) { + for (int c = 0; c < weaponList.size(); c++) { heat = heat - weaponList.get(c).Heat; overHeatHeat = overHeatHeat + weaponList.get(c).Heat; attackValue = attackValue - weaponList.get(c).Damage; overHeatDamage = overHeatDamage + weaponList.get(c).Damage; - if(heat <= TotalHeatDis) { + if (heat <= TotalHeatDis) { break; } } overHeatHeat = overHeatHeat / 5.0; - if((int)overHeatHeat == 0) { + if ((int) overHeatHeat == 0) { overHeatHeat = 1; } - if((int)overHeatDamage == 0) { + if ((int) overHeatDamage == 0) { overHeatDamage = 1; } - SpecialAbilities = SpecialAbilities + "Overheat " + (int)overHeatHeat + ": " + (int)overHeatDamage + "\n"; + SpecialAbilities = SpecialAbilities + "Overheat " + (int) overHeatHeat + ": " + (int) overHeatDamage + "\n"; } - AttackValue = (int)attackValue; - //System.out.println(missileValue); - MissileDamage = (int)missileValue; + AttackValue = (int) attackValue; + // System.out.println(missileValue); + MissileDamage = (int) missileValue; - if(AlphaStrikeDamage > 0 ) { + if (AlphaStrikeDamage > 0) { SpecialAbilities = SpecialAbilities + "AlphaStrike: " + AlphaStrikeDamage + "\n"; } - if(LeakDamage > 0 ) { + if (LeakDamage > 0) { SpecialAbilities = SpecialAbilities + AblLeak1 + Name + AblLeak2 + LeakDamage + AblLeak3 + "\n"; } - //System.out.println("Attack value: " + attackValue + " MissileValue: " + missileValue); - if(MissileDamage > 0) { + // System.out.println("Attack value: " + attackValue + " MissileValue: " + + // missileValue); + if (MissileDamage > 0) { SpecialAbilities = SpecialAbilities + "Missile: " + MissileDamage + "\n"; } } - //Canon cards that are miscalculated by this method: - //Light: Jenner (IS variants) - // Spectre - //Medium: Assassin (ASN-23) - //Heavy: Axman - public void setArmourAndStructure (int armourPoints) { - //The Jenner seems to be the sole exception that light - //fast mechs get 0 Armour unless their structure is at - //least 5. - if(armourPoints < 30) { + + // Canon cards that are miscalculated by this method: + // Light: Jenner (IS variants) + // Spectre + // Medium: Assassin (ASN-23) + // Heavy: Axman + public void setArmourAndStructure(int armourPoints) { + // The Jenner seems to be the sole exception that light + // fast mechs get 0 Armour unless their structure is at + // least 5. + if (armourPoints < 30) { ArmourValue = 0; StructureValue = 1; - } else if(armourPoints < 50) { + } else if (armourPoints < 50) { ArmourValue = 0; StructureValue = 2; - } else if(armourPoints < 70) { - if(MovementRate == 'F') { + } else if (armourPoints < 70) { + if (MovementRate == 'F') { ArmourValue = 0; StructureValue = 3; } else { ArmourValue = 1; StructureValue = 2; } - } else if(armourPoints < 90) { - if(MovementRate == 'F') { + } else if (armourPoints < 90) { + if (MovementRate == 'F') { ArmourValue = 0; StructureValue = 4; } else { ArmourValue = 1; StructureValue = 3; } - } else if(armourPoints < 110) { - if(MovementRate == 'F') { + } else if (armourPoints < 110) { + if (MovementRate == 'F') { ArmourValue = 0; StructureValue = 5; - } else if(Mass < 40) { + } else if (Mass < 40) { ArmourValue = 0; StructureValue = 5; } else { ArmourValue = 1; StructureValue = 4; } - } else if(armourPoints < 130) { - if(MovementRate == 'F') { + } else if (armourPoints < 130) { + if (MovementRate == 'F') { ArmourValue = 1; StructureValue = 5; - } else if(Mass < 60) { + } else if (Mass < 60) { ArmourValue = 1; StructureValue = 5; } else { ArmourValue = 2; StructureValue = 4; } - } else if(armourPoints < 150) { - if(MovementRate == 'F') { + } else if (armourPoints < 150) { + if (MovementRate == 'F') { ArmourValue = 1; StructureValue = 6; - } else if(Mass < 60) { + } else if (Mass < 60) { ArmourValue = 1; StructureValue = 6; - } else { + } else { ArmourValue = 2; StructureValue = 5; } - } else if(armourPoints < 170) { - if(MovementRate == 'F') { + } else if (armourPoints < 170) { + if (MovementRate == 'F') { ArmourValue = 1; StructureValue = 7; - } else if(Mass < 60) { + } else if (Mass < 60) { ArmourValue = 1; StructureValue = 7; - } else { + } else { ArmourValue = 2; StructureValue = 6; } - } else if(armourPoints < 190) { - if(MovementRate == 'F') { + } else if (armourPoints < 190) { + if (MovementRate == 'F') { ArmourValue = 1; StructureValue = 8; - } else if(Mass < 60) { + } else if (Mass < 60) { ArmourValue = 1; StructureValue = 8; - } else if(Mass >= 80) { - ArmourValue = 3; - StructureValue = 6; - } else { + } else if (Mass >= 80) { + ArmourValue = 3; + StructureValue = 6; + } else { ArmourValue = 2; StructureValue = 7; } - } else if(armourPoints < 210) { - if(Mass >= 80) { + } else if (armourPoints < 210) { + if (Mass >= 80) { ArmourValue = 2; StructureValue = 8; } else { ArmourValue = 3; StructureValue = 7; } - } else if(armourPoints < 230) { - if(Mass >= 80) { + } else if (armourPoints < 230) { + if (Mass >= 80) { ArmourValue = 2; StructureValue = 9; } else { ArmourValue = 3; StructureValue = 8; } - } else if(armourPoints < 250) { + } else if (armourPoints < 250) { ArmourValue = 3; StructureValue = 9; - } else if(armourPoints < 270) { + } else if (armourPoints < 270) { ArmourValue = 3; StructureValue = 10; - } else if(armourPoints < 290) { + } else if (armourPoints < 290) { ArmourValue = 3; StructureValue = 11; } else { @@ -559,31 +564,37 @@ public void setArmourAndStructure (int armourPoints) { public char getSpeed() { return MovementRate; } + public String getName() { return FullName; } - public int getMass(){ + + public int getMass() { return Mass; } + public String getSpecial() { return SpecialAbilities; } + public int getArmour() { return ArmourValue; } + public int getStructure() { return StructureValue; } + public int getAttack() { return AttackValue; } - private class WeaponData implements Comparable{ + private class WeaponData implements Comparable { public int Heat; public double Damage; - public int compareTo(WeaponData o){ - return (int)(this.Damage - o.Damage); + public int compareTo(WeaponData o) { + return (int) (this.Damage - o.Damage); } } } From 352dda16e644dbe04fdd6c13b6ef6a4d305b689a Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 15:37:43 -0600 Subject: [PATCH 038/126] ssw/filehandlers - HMPReader - Added comment regarding 'unused' variable --- ssw/src/main/java/ssw/filehandlers/HMPReader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ssw/src/main/java/ssw/filehandlers/HMPReader.java b/ssw/src/main/java/ssw/filehandlers/HMPReader.java index 35199c30..9f2cbcd9 100644 --- a/ssw/src/main/java/ssw/filehandlers/HMPReader.java +++ b/ssw/src/main/java/ssw/filehandlers/HMPReader.java @@ -118,7 +118,7 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws int IntStrucTechBase = TechBase; int EngineTechBase = TechBase; int HSTechBase = TechBase; - int PhysicalWeaponTechBase = TechBase; + int PhysicalWeaponTechBase = TechBase; // Used to read forward bytes in the file. int EnhanceTechBase = TechBase; int TCTechBase = TechBase; int ArmorTechBase = TechBase; @@ -135,7 +135,7 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws // whether the specific equipment exists on the mech or not. EngineTechBase = readUnsignedShort(FR); HSTechBase = readUnsignedShort(FR); - PhysicalWeaponTechBase = readUnsignedShort(FR); + PhysicalWeaponTechBase = readUnsignedShort(FR); // Used to read forward bytes in the file. EnhanceTechBase = readUnsignedShort(FR); TCTechBase = readUnsignedShort(FR); ArmorTechBase = readUnsignedShort(FR); From 4c762806a68f53414729c5079c7d47a4cd1c9e0e Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 15:39:23 -0600 Subject: [PATCH 039/126] ssw/filehandlers - MTFReader - Commented out variables not being used. --- ssw/src/main/java/ssw/filehandlers/MTFReader.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ssw/src/main/java/ssw/filehandlers/MTFReader.java b/ssw/src/main/java/ssw/filehandlers/MTFReader.java index d5ab9335..b58a4424 100644 --- a/ssw/src/main/java/ssw/filehandlers/MTFReader.java +++ b/ssw/src/main/java/ssw/filehandlers/MTFReader.java @@ -29,21 +29,21 @@ package ssw.filehandlers; import components.Mech; -import java.util.Hashtable; -import visitors.VMechFullRecalc; +// import java.util.Hashtable; +// import visitors.VMechFullRecalc; public class MTFReader { - private Hashtable MMLookup = new Hashtable(); + // private Hashtable MMLookup = new Hashtable(); // Not used anywhere nor in a subclass. public MTFReader() { BuildHash(); } public Mech ReadMech() { Mech m = new Mech(); - VMechFullRecalc Recalc = new VMechFullRecalc(); + // VMechFullRecalc Recalc = new VMechFullRecalc(); // Not used // m.Visit( Recalc ); - + return m; } From 6b19cd8f70132f37e30c4c353ce60e082c06effd Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 15:42:34 -0600 Subject: [PATCH 040/126] ssw/gui - DamageChart - Added Serial Version UID - Typed Vector Templates. --- ssw/src/main/java/ssw/gui/DamageChart.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ssw/src/main/java/ssw/gui/DamageChart.java b/ssw/src/main/java/ssw/gui/DamageChart.java index 49397c8b..4e9f323a 100644 --- a/ssw/src/main/java/ssw/gui/DamageChart.java +++ b/ssw/src/main/java/ssw/gui/DamageChart.java @@ -37,10 +37,15 @@ import javax.swing.JPanel; public class DamageChart extends JPanel { + /** + * + */ + private static final long serialVersionUID = 1303342508543758261L; + private int GridX = 1; private int GridY = 1; - private Vector charts = new Vector(); - private Vector colors = new Vector(); + private Vector charts = new Vector(); + private Vector colors = new Vector(); private boolean TextView = false; public DamageChart() { @@ -51,7 +56,7 @@ public DamageChart() { * Sets the grid width and height for this damage chart. * X should be one greater than the maximum range the unit can hit at * Y should be one greater than the maximum damage the unit can produce at any range. - * + * * @param x Grid X Units * @param y Grid Y Units */ @@ -66,7 +71,7 @@ public void SetGridSize( int x, int y ) { * Adds a Damage At Range chart to the chart. The DAR chart should consist of * an int[], with each array element representing the damage at that range. * For instance, chart[9] should return the damage the unit produces at range 9. - * + * * @param chart The Damage At Range chart. * @param ccolor The color to draw the DAR chart's line in. */ From 1ff6ac372f63f1c29d9bcc66f376742fec049576 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 15:43:22 -0600 Subject: [PATCH 041/126] ssw/gui - dlgAboutBox - Added Serial Version UID - VS Code Code Formating. --- ssw/src/main/java/ssw/gui/dlgAboutBox.java | 36 +++++++++++++--------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/ssw/src/main/java/ssw/gui/dlgAboutBox.java b/ssw/src/main/java/ssw/gui/dlgAboutBox.java index 7174fa7d..372ab9ba 100644 --- a/ssw/src/main/java/ssw/gui/dlgAboutBox.java +++ b/ssw/src/main/java/ssw/gui/dlgAboutBox.java @@ -34,6 +34,11 @@ public class dlgAboutBox extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -2839351238531094634L; + ifMechForm Parent; /** Creates new form dlgAboutBox */ @@ -41,19 +46,20 @@ public dlgAboutBox(java.awt.Frame parent, boolean modal) { super(parent, modal); Parent = (ifMechForm) parent; initComponents(); - setResizable( false ); - setTitle( "About " + SSWConstants.AppDescription ); + setResizable(false); + setTitle("About " + SSWConstants.AppDescription); lblAppName.setText(SSWConstants.AppDescription); lblRelease.setText(SSWConstants.GetRelease()); lblVersion.setText(SSWConstants.GetVersion()); } - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ - // //GEN-BEGIN:initComponents + // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; @@ -314,16 +320,16 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pack(); }// //GEN-END:initComponents - private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed + private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCloseActionPerformed dispose(); - }//GEN-LAST:event_btnCloseActionPerformed + }// GEN-LAST:event_btnCloseActionPerformed - private void btnLicenseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLicenseActionPerformed - dlgLicense lwindow = new dlgLicense( (javax.swing.JFrame) Parent, true ); + private void btnLicenseActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnLicenseActionPerformed + dlgLicense lwindow = new dlgLicense((javax.swing.JFrame) Parent, true); Point p = getLocationOnScreen(); - lwindow.setLocation( p.x, p.y ); - lwindow.setVisible( true ); - }//GEN-LAST:event_btnLicenseActionPerformed + lwindow.setLocation(p.x, p.y); + lwindow.setVisible(true); + }// GEN-LAST:event_btnLicenseActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnClose; @@ -353,5 +359,5 @@ private void btnLicenseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI private javax.swing.JLabel lblVersion; private javax.swing.JLabel lblVersionLabel; // End of variables declaration//GEN-END:variables - + } From 6ae2a4ed6ca2272574a8c1a3308c20af7fe2778f Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 15:44:41 -0600 Subject: [PATCH 042/126] ssw/gui - dlgAmmoLotSize - Added Serial Version UID - VS Code Formatting --- ssw/src/main/java/ssw/gui/dlgAmmoLotSize.java | 57 +++++++++++-------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/ssw/src/main/java/ssw/gui/dlgAmmoLotSize.java b/ssw/src/main/java/ssw/gui/dlgAmmoLotSize.java index e8a1a7dd..b46512f3 100644 --- a/ssw/src/main/java/ssw/gui/dlgAmmoLotSize.java +++ b/ssw/src/main/java/ssw/gui/dlgAmmoLotSize.java @@ -33,13 +33,18 @@ public class dlgAmmoLotSize extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = 3816171968518021189L; + private Ammunition Ammo; private int CurAmmo; private boolean result = true; /** Creates new form dlgVariableSize */ - public dlgAmmoLotSize( java.awt.Frame parent, boolean modal, Ammunition a ) { - super( parent, modal ); + public dlgAmmoLotSize(java.awt.Frame parent, boolean modal, Ammunition a) { + super(parent, modal); initComponents(); Ammo = a; CurAmmo = Ammo.GetLotSize(); @@ -47,21 +52,21 @@ public dlgAmmoLotSize( java.awt.Frame parent, boolean modal, Ammunition a ) { } private void SetState() { - spnTonnage.setModel( new javax.swing.SpinnerNumberModel( Ammo.GetLotSize(), 1, Ammo.GetMaxLotSize(), 1 ) ); - setTitle( "Setting ammo tonnage." ); + spnTonnage.setModel(new javax.swing.SpinnerNumberModel(Ammo.GetLotSize(), 1, Ammo.GetMaxLotSize(), 1)); + setTitle("Setting ammo tonnage."); } public boolean GetResult() { return result; } - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents + // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; @@ -125,7 +130,7 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { pack(); }// //GEN-END:initComponents - private void spnTonnageStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnTonnageStateChanged + private void spnTonnageStateChanged(javax.swing.event.ChangeEvent evt) {// GEN-FIRST:event_spnTonnageStateChanged javax.swing.SpinnerNumberModel n = (SpinnerNumberModel) spnTonnage.getModel(); javax.swing.JComponent editor = spnTonnage.getEditor(); javax.swing.JFormattedTextField tf = ((javax.swing.JSpinner.DefaultEditor) editor).getTextField(); @@ -133,32 +138,36 @@ private void spnTonnageStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI // get the value from the text box, if it's valid. try { spnTonnage.commitEdit(); - } catch ( java.text.ParseException pe ) { + } catch (java.text.ParseException pe) { // Edited value is invalid, spinner.getValue() will return // the last valid value, you could revert the spinner to show that: - if ( editor instanceof javax.swing.JSpinner.DefaultEditor ) { - tf.setValue( spnTonnage.getValue() ); + if (editor instanceof javax.swing.JSpinner.DefaultEditor) { + tf.setValue(spnTonnage.getValue()); } return; } CurAmmo = n.getNumber().intValue(); - }//GEN-LAST:event_spnTonnageStateChanged + }// GEN-LAST:event_spnTonnageStateChanged - private void btnOkayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkayActionPerformed + private void btnOkayActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnOkayActionPerformed // now round to the nearest increment (up) int value = CurAmmo; - if( value > Ammo.GetMaxLotSize() ) { value = Ammo.GetMaxLotSize(); } - if( value < 1 ) { value = 1; } - Ammo.SetLotSize( CurAmmo ); + if (value > Ammo.GetMaxLotSize()) { + value = Ammo.GetMaxLotSize(); + } + if (value < 1) { + value = 1; + } + Ammo.SetLotSize(CurAmmo); result = true; - setVisible( false ); - }//GEN-LAST:event_btnOkayActionPerformed + setVisible(false); + }// GEN-LAST:event_btnOkayActionPerformed - private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed + private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCancelActionPerformed result = false; - setVisible( false ); - }//GEN-LAST:event_btnCancelActionPerformed + setVisible(false); + }// GEN-LAST:event_btnCancelActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnCancel; From 48d36a942b57f368d440056d314cd3f5df704bff Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Mon, 14 Dec 2020 15:45:21 -0600 Subject: [PATCH 043/126] ssw/gui - dlgArmorTonnage - Added Serial Version UID - VS Code Formatting --- .../main/java/ssw/gui/dlgArmorTonnage.java | 141 +++++++++--------- 1 file changed, 73 insertions(+), 68 deletions(-) diff --git a/ssw/src/main/java/ssw/gui/dlgArmorTonnage.java b/ssw/src/main/java/ssw/gui/dlgArmorTonnage.java index 09ac1120..ec7d47fa 100644 --- a/ssw/src/main/java/ssw/gui/dlgArmorTonnage.java +++ b/ssw/src/main/java/ssw/gui/dlgArmorTonnage.java @@ -33,18 +33,23 @@ import java.awt.event.ActionListener; public class dlgArmorTonnage extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = 5389583553791220983L; + private boolean NewTonnage = false; private double result; - + /** Creates new form dlgArmorTonnage */ public dlgArmorTonnage(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); - setResizable( false ); - setTitle( "Set Armor Tonnage" ); - setDefaultCloseOperation( javax.swing.JDialog.HIDE_ON_CLOSE ); + setResizable(false); + setTitle("Set Armor Tonnage"); + setDefaultCloseOperation(javax.swing.JDialog.HIDE_ON_CLOSE); double max = ((ifMechForm) parent).GetMech().GetArmor().GetMaxTonnage(); - lblMaxArmor.setText( "Max Armor Tonnage: " + max ); + lblMaxArmor.setText("Max Armor Tonnage: " + max); double currentTonnage = ((ifMechForm) parent).GetMech().GetArmor().GetTonnage(); txtArmorTons.setText("" + currentTonnage); } @@ -57,12 +62,13 @@ public boolean NewTonnage() { return NewTonnage; } - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ - // //GEN-BEGIN:initComponents + // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; @@ -93,74 +99,73 @@ private void initComponents() { gridBagConstraints.gridwidth = 2; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); getContentPane().add(txtArmorTons, gridBagConstraints); - txtArmorTons.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent e) { - btnOkayActionPerformed( e ); - } - }); - - btnOkay.setText("Okay"); - btnOkay.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnOkayActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); - getContentPane().add(btnOkay, gridBagConstraints); - - btnCancel.setText("Cancel"); - btnCancel.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnCancelActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 0); - getContentPane().add(btnCancel, gridBagConstraints); - - lblMaxArmor.setText("Max Armor Tonnage: 100.00"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4); - getContentPane().add(lblMaxArmor, gridBagConstraints); - - pack(); - }// //GEN-END:initComponents - - private void btnOkayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkayActionPerformed + txtArmorTons.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + btnOkayActionPerformed(e); + } + }); + + btnOkay.setText("Okay"); + btnOkay.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnOkayActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); + getContentPane().add(btnOkay, gridBagConstraints); + + btnCancel.setText("Cancel"); + btnCancel.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnCancelActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 0); + getContentPane().add(btnCancel, gridBagConstraints); + + lblMaxArmor.setText("Max Armor Tonnage: 100.00"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.gridwidth = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4); + getContentPane().add(lblMaxArmor, gridBagConstraints); + + pack(); + }// //GEN-END:initComponents + + private void btnOkayActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnOkayActionPerformed // validate the text. - try{//GEN-LAST:event_btnOkayActionPerformed - result = Double.parseDouble( txtArmorTons.getText() ); - } catch( NumberFormatException n ) { - Media.Messager( this, "Please enter a valid number" ); - txtArmorTons.setText( "" ); + try {// GEN-LAST:event_btnOkayActionPerformed + result = Double.parseDouble(txtArmorTons.getText()); + } catch (NumberFormatException n) { + Media.Messager(this, "Please enter a valid number"); + txtArmorTons.setText(""); NewTonnage = false; return; } // tell the program we have a new tonnage NewTonnage = true; - setVisible( false ); + setVisible(false); } - private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed + private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCancelActionPerformed NewTonnage = false; - this.setVisible( false ); - }//GEN-LAST:event_btnCancelActionPerformed - + this.setVisible(false); + }// GEN-LAST:event_btnCancelActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnCancel; private javax.swing.JButton btnOkay; From 8b5d1de46f41ecc255af647b8f92d927d0ed8ec4 Mon Sep 17 00:00:00 2001 From: Algebro Date: Tue, 15 Dec 2020 22:47:22 -0500 Subject: [PATCH 044/126] save reference to mech quirk list --- ssw/src/main/java/ssw/gui/frmMain.java | 1 + ssw/src/main/java/ssw/gui/frmMainWide.java | 1 + 2 files changed, 2 insertions(+) diff --git a/ssw/src/main/java/ssw/gui/frmMain.java b/ssw/src/main/java/ssw/gui/frmMain.java index a57306e2..7e598744 100644 --- a/ssw/src/main/java/ssw/gui/frmMain.java +++ b/ssw/src/main/java/ssw/gui/frmMain.java @@ -452,6 +452,7 @@ public void actionPerformed(ActionEvent e) { RefreshInternalPoints(); SetLoadoutArrays(); SetWeaponChoosers(); + quirks = CurMech.GetQuirks(); cmbInternalType.setSelectedItem( SSWConstants.DEFAULT_CHASSIS ); cmbEngineType.setSelectedItem( SSWConstants.DEFAULT_ENGINE ); cmbGyroType.setSelectedItem( SSWConstants.DEFAULT_GYRO ); diff --git a/ssw/src/main/java/ssw/gui/frmMainWide.java b/ssw/src/main/java/ssw/gui/frmMainWide.java index 6a5bfe4e..ce926fb4 100644 --- a/ssw/src/main/java/ssw/gui/frmMainWide.java +++ b/ssw/src/main/java/ssw/gui/frmMainWide.java @@ -432,6 +432,7 @@ public void actionPerformed(ActionEvent e) { RefreshInternalPoints(); SetLoadoutArrays(); SetWeaponChoosers(); + quirks = CurMech.GetQuirks(); cmbInternalType.setSelectedItem( SSWConstants.DEFAULT_CHASSIS ); cmbEngineType.setSelectedItem( SSWConstants.DEFAULT_ENGINE ); cmbGyroType.setSelectedItem( SSWConstants.DEFAULT_GYRO ); From 2ba43a7f09649742e7190003c55e9e6901f53782 Mon Sep 17 00:00:00 2001 From: Algebro Date: Thu, 17 Dec 2020 13:55:01 -0500 Subject: [PATCH 045/126] move quirks assignment to a more logical location --- ssw/src/main/java/ssw/gui/frmMain.java | 4 ++-- ssw/src/main/java/ssw/gui/frmMainWide.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ssw/src/main/java/ssw/gui/frmMain.java b/ssw/src/main/java/ssw/gui/frmMain.java index 7e598744..2272123f 100644 --- a/ssw/src/main/java/ssw/gui/frmMain.java +++ b/ssw/src/main/java/ssw/gui/frmMain.java @@ -129,7 +129,7 @@ public void run() { private Cursor NormalCursor = new Cursor( Cursor.DEFAULT_CURSOR ); // ImageIcon FluffImage = Utils.createImageIcon( SSWConstants.NO_IMAGE ); public DataFactory data; - public ArrayList quirks = new ArrayList(); + public ArrayList quirks; private dlgPrintBatchMechs BatchWindow = null; private ImageTracker imageTracker = new ImageTracker(); @@ -157,6 +157,7 @@ public frmMain() { CurMech = new Mech( Prefs ); ArmorTons = new VSetArmorTonnage( Prefs ); Mechrender = new MechLoadoutRenderer( this ); + quirks = CurMech.GetQuirks(); // added for easy checking PPCCapAC.SetISCodes( 'E', 'X', 'X', 'E', 'D' ); @@ -452,7 +453,6 @@ public void actionPerformed(ActionEvent e) { RefreshInternalPoints(); SetLoadoutArrays(); SetWeaponChoosers(); - quirks = CurMech.GetQuirks(); cmbInternalType.setSelectedItem( SSWConstants.DEFAULT_CHASSIS ); cmbEngineType.setSelectedItem( SSWConstants.DEFAULT_ENGINE ); cmbGyroType.setSelectedItem( SSWConstants.DEFAULT_GYRO ); diff --git a/ssw/src/main/java/ssw/gui/frmMainWide.java b/ssw/src/main/java/ssw/gui/frmMainWide.java index ce926fb4..c5ba912b 100644 --- a/ssw/src/main/java/ssw/gui/frmMainWide.java +++ b/ssw/src/main/java/ssw/gui/frmMainWide.java @@ -114,7 +114,7 @@ public class frmMainWide extends javax.swing.JFrame implements java.awt.datatran private Cursor NormalCursor = new Cursor( Cursor.DEFAULT_CURSOR ); // ImageIcon FluffImage = Utils.createImageIcon( SSWConstants.NO_IMAGE ); public DataFactory data; - public ArrayList quirks = new ArrayList(); + public ArrayList quirks; private dlgPrintBatchMechs BatchWindow = null; private ImageTracker imageTracker = new ImageTracker(); @@ -143,6 +143,7 @@ public frmMainWide() { CurMech = new Mech( Prefs ); ArmorTons = new VSetArmorTonnage( Prefs ); Mechrender = new MechLoadoutRenderer( this ); + quirks = CurMech.GetQuirks(); // added for easy checking PPCCapAC.SetISCodes( 'E', 'X', 'X', 'E', 'D' ); @@ -432,7 +433,6 @@ public void actionPerformed(ActionEvent e) { RefreshInternalPoints(); SetLoadoutArrays(); SetWeaponChoosers(); - quirks = CurMech.GetQuirks(); cmbInternalType.setSelectedItem( SSWConstants.DEFAULT_CHASSIS ); cmbEngineType.setSelectedItem( SSWConstants.DEFAULT_ENGINE ); cmbGyroType.setSelectedItem( SSWConstants.DEFAULT_GYRO ); From e8d8a139bc0951b9f06067cf9b16c6219d621625 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 17:25:39 -0600 Subject: [PATCH 046/126] Commented out variables and methods not used in Class. --- .../main/java/visitors/VSetArmorTonnage.java | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/sswlib/src/main/java/visitors/VSetArmorTonnage.java b/sswlib/src/main/java/visitors/VSetArmorTonnage.java index 6cfbe3bf..923874cd 100644 --- a/sswlib/src/main/java/visitors/VSetArmorTonnage.java +++ b/sswlib/src/main/java/visitors/VSetArmorTonnage.java @@ -35,8 +35,8 @@ public class VSetArmorTonnage implements ifVisitor { private double ArmorTons; private int ArmorPoints[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; private int CTRPerc = MechArmor.DEFAULT_CTR_ARMOR_PERCENT, - STRPerc = MechArmor.DEFAULT_STR_ARMOR_PERCENT, - ArmorPriority = MechArmor.ARMOR_PRIORITY_TORSO; + STRPerc = MechArmor.DEFAULT_STR_ARMOR_PERCENT; + // ArmorPriority = MechArmor.ARMOR_PRIORITY_TORSO; private Preferences Prefs; public VSetArmorTonnage( Preferences p ) { @@ -48,7 +48,7 @@ public void Clear() { ArmorPoints[i] = 0; } } - + public void SetClan( boolean clan ) { } @@ -64,7 +64,7 @@ public void Visit(Mech m) { // only the armor changes, so pass us off CTRPerc = Prefs.getInt( "ArmorCTRPercent", MechArmor.DEFAULT_CTR_ARMOR_PERCENT ); STRPerc = Prefs.getInt( "ArmorSTRPercent", MechArmor.DEFAULT_STR_ARMOR_PERCENT ); - ArmorPriority = Prefs.getInt( "ArmorPriority", MechArmor.ARMOR_PRIORITY_TORSO ); + // ArmorPriority = Prefs.getInt( "ArmorPriority", MechArmor.ARMOR_PRIORITY_TORSO ); MechArmor a = m.GetArmor(); // set the armor tonnage @@ -121,12 +121,12 @@ public void Visit(CombatVehicle v) { // only the armor changes, so pass us off CTRPerc = Prefs.getInt( "ArmorFrontPercent", CVArmor.DEFAULT_FRONT_ARMOR_PERCENT ); STRPerc = Prefs.getInt( "ArmorTurretPercent", CVArmor.DEFAULT_TURRET_ARMOR_PERCENT ); - ArmorPriority = Prefs.getInt( "ArmorPriority", CVArmor.ARMOR_PRIORITY_FRONT ); + // ArmorPriority = Prefs.getInt( "ArmorPriority", CVArmor.ARMOR_PRIORITY_FRONT ); CVArmor a = v.GetArmor(); // remove all existing amounts so we can reset a.ClearArmorValues(); - + if( ArmorTons >= a.GetMaxTonnage() ) { a.Maximize(); } else if( ArmorTons <= 0 ) { @@ -136,14 +136,14 @@ public void Visit(CombatVehicle v) { } else { // allocate the armor AllocateArmor( a ); - + // fix the armor FixArmor( a ); - + if ( a.GetArmorValue() < a.GetArmorPoints(ArmorTons) ) { AllocateExtra(a, (a.GetArmorPoints(ArmorTons)-a.GetArmorValue())); FixArmor( a ); - } + } } } @@ -215,19 +215,19 @@ private void AllocateArmor( CVArmor a ) { // remove all existing amounts so we can reset a.ClearArmorValues(); - + if ( a.GetOwner().IsVTOL() ) { ArmorPoints[LocationIndex.CV_LOC_ROTOR] = 2; AV -= 2; } int split = AV / a.GetOwner().getLocationCount(); - + if ( a.GetOwner().isHasTurret1() ) ArmorPoints[LocationIndex.CV_LOC_TURRET1] = split; if ( a.GetOwner().isHasTurret2() ) ArmorPoints[LocationIndex.CV_LOC_TURRET2] = split; - + ArmorPoints[LocationIndex.CV_LOC_LEFT] = split; ArmorPoints[LocationIndex.CV_LOC_RIGHT] = split; - + ArmorPoints[LocationIndex.CV_LOC_FRONT] = (int)Math.ceil((split * 2) * .6); ArmorPoints[LocationIndex.CV_LOC_REAR] = (split * 2)-ArmorPoints[LocationIndex.CV_LOC_FRONT]; } @@ -308,6 +308,8 @@ private int CheckMaximums( MechArmor a, int AV ) { return result; } + /* + * Not used inside class at this time. private int CheckMaximums( CVArmor a, int AV ) { int result = AV; @@ -356,6 +358,7 @@ private int CheckMaximums( CVArmor a, int AV ) { return result; } + */ private void AllocateExtra( MechArmor a, int AV ) { // recursive routine for allocating the armor. Pass in the AV we have @@ -640,6 +643,8 @@ private void Symmetrize( MechArmor a ) { } } + /* + * Not used in class private void Symmetrize( CVArmor a ) { if( ArmorPoints[LocationIndex.CV_LOC_LEFT] > ArmorPoints[LocationIndex.CV_LOC_RIGHT] || ArmorPoints[LocationIndex.CV_LOC_LEFT] < ArmorPoints[LocationIndex.CV_LOC_RIGHT] ) { if( ArmorPoints[LocationIndex.CV_LOC_LEFT] > ArmorPoints[LocationIndex.CV_LOC_RIGHT] ) { @@ -667,6 +672,7 @@ private void Symmetrize( CVArmor a ) { } } + */ private void FixArmor( MechArmor a ) { // fixes the armor values to the mech From 3e23673164435a19b98520321c440de7db552493 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 17:27:58 -0600 Subject: [PATCH 047/126] sswlib/src/main/java/visitors - VHeatSinkSetProtoDouble - Commented out varible not being used - VS Code Formatting. --- .../visitors/VHeatSinkSetProtoDouble.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sswlib/src/main/java/visitors/VHeatSinkSetProtoDouble.java b/sswlib/src/main/java/visitors/VHeatSinkSetProtoDouble.java index f4370d2a..f758ded0 100644 --- a/sswlib/src/main/java/visitors/VHeatSinkSetProtoDouble.java +++ b/sswlib/src/main/java/visitors/VHeatSinkSetProtoDouble.java @@ -32,9 +32,9 @@ public class VHeatSinkSetProtoDouble implements ifVisitor { private Mech CurMech; - private boolean Clan = false; + // private boolean Clan = false; // Not being used in class. - public void SetClan( boolean clan ) { + public void SetClan(boolean clan) { } public void LoadLocations(LocationIndex[] locs) { @@ -46,9 +46,9 @@ public void Visit(Mech m) { CurMech = m; HeatSinkFactory h = CurMech.GetHeatSinks(); - //h.SetStarLeagueProtoDHS(); - - switch( CurMech.GetEra() ) { + // h.SetStarLeagueProtoDHS(); + + switch (CurMech.GetEra()) { case AvailableCode.ERA_STAR_LEAGUE: h.SetStarLeagueProtoDHS(); break; @@ -68,47 +68,47 @@ public String toString() { return "Prototype Double Heat Sink Visitor"; } - public void Visit( CombatVehicle v ) throws Exception { + public void Visit(CombatVehicle v) throws Exception { // does nothing at the moment } - public void Visit( Infantry i ) throws Exception { + public void Visit(Infantry i) throws Exception { // does nothing at the moment } - public void Visit( SupportVehicle s ) throws Exception { + public void Visit(SupportVehicle s) throws Exception { // does nothing at the moment } - public void Visit( BattleArmor b ) throws Exception { + public void Visit(BattleArmor b) throws Exception { // does nothing at the moment } - public void Visit( Fighter f ) throws Exception { + public void Visit(Fighter f) throws Exception { // does nothing at the moment } - public void Visit( Spaceship s ) throws Exception { + public void Visit(Spaceship s) throws Exception { // does nothing at the moment } - public void Visit( SpaceStation s ) throws Exception { + public void Visit(SpaceStation s) throws Exception { // does nothing at the moment } - public void Visit( ProtoMech p ) throws Exception { + public void Visit(ProtoMech p) throws Exception { // does nothing at the moment } - public void Visit( MobileStructure m ) throws Exception { + public void Visit(MobileStructure m) throws Exception { // does nothing at the moment } - public void Visit( LargeSupportVehicle l ) throws Exception { + public void Visit(LargeSupportVehicle l) throws Exception { // does nothing at the moment } - public void Visit( Dropship d ) throws Exception { + public void Visit(Dropship d) throws Exception { // does nothing at the moment } } From 6f482cf3326706f6fbd3a43f73f236d39777e427 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 17:28:54 -0600 Subject: [PATCH 048/126] sswlib/src/main/java/visitors - VGyroSetNone.java - Commented out import not being used. - VS Code Formatting. --- .../src/main/java/visitors/VGyroSetNone.java | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/sswlib/src/main/java/visitors/VGyroSetNone.java b/sswlib/src/main/java/visitors/VGyroSetNone.java index 5cd5e7e3..39540f9f 100644 --- a/sswlib/src/main/java/visitors/VGyroSetNone.java +++ b/sswlib/src/main/java/visitors/VGyroSetNone.java @@ -29,44 +29,44 @@ package visitors; import components.*; -import states.stCockpitInterface; +// import states.stCockpitInterface; // Not Used public class VGyroSetNone implements ifVisitor { private Mech CurMech; - public void SetClan( boolean clan ) { + public void SetClan(boolean clan) { } public void LoadLocations(LocationIndex[] locs) { // does nothing here, but may later. } - public void Visit( Mech m ) throws Exception { + public void Visit(Mech m) throws Exception { CurMech = m; boolean CASEInstalled = false; boolean SChargerInstalled = false; Gyro g = CurMech.GetGyro(); ifMechLoadout l = CurMech.GetLoadout(); - //if (!(CurMech.GetCockpit().GetCurrentState() instanceof stCockpitInterface)) - // throw new Exception( "The selected cockpit requires a gyro." ); + // if (!(CurMech.GetCockpit().GetCurrentState() instanceof stCockpitInterface)) + // throw new Exception( "The selected cockpit requires a gyro." ); // see if we have CASE installed in the CT - if( CurMech.HasCTCase() ) { - // remove it. We may not be able to replace it, but we'll try + if (CurMech.HasCTCase()) { + // remove it. We may not be able to replace it, but we'll try CASEInstalled = true; CurMech.RemoveCTCase(); } // see if we have a supercharger installed - if( CurMech.GetLoadout().HasSupercharger() ) { - if( CurMech.GetLoadout().Find( CurMech.GetLoadout().GetSupercharger() ) == LocationIndex.MECH_LOC_CT ) { + if (CurMech.GetLoadout().HasSupercharger()) { + if (CurMech.GetLoadout().Find(CurMech.GetLoadout().GetSupercharger()) == LocationIndex.MECH_LOC_CT) { SChargerInstalled = true; try { - CurMech.GetLoadout().SetSupercharger( false, -1, -1 ); - } catch ( Exception e ) { - // wow, a problem removing it. Log it for later. - System.err.println( e.getMessage() ); + CurMech.GetLoadout().SetSupercharger(false, -1, -1); + } catch (Exception e) { + // wow, a problem removing it. Log it for later. + System.err.println(e.getMessage()); } } } @@ -81,73 +81,73 @@ public void Visit( Mech m ) throws Exception { g.SetNone(); // now replace the engine criticals - if( ! m.GetEngine().Place(l) ) { - throw new Exception( m.GetEngine().LookupName() + " cannot be allocated!" ); + if (!m.GetEngine().Place(l)) { + throw new Exception(m.GetEngine().LookupName() + " cannot be allocated!"); } // if we had CASE installed, try to replace it - if( CASEInstalled ) { + if (CASEInstalled) { // at this point, we don't care whether it happened or not since the // primary inhabitants of the CT are taken care of. try { CurMech.AddCTCase(); - } catch( Exception e ) { - // unhandled at this time. write out a system error - System.err.println( e.getMessage() ); + } catch (Exception e) { + // unhandled at this time. write out a system error + System.err.println(e.getMessage()); } } // try to reinstall the Supercharger - if( SChargerInstalled ) { + if (SChargerInstalled) { try { - CurMech.GetLoadout().SetSupercharger( true, LocationIndex.MECH_LOC_CT, -1 ); - } catch ( Exception e ) { - System.err.println( e.getMessage() ); + CurMech.GetLoadout().SetSupercharger(true, LocationIndex.MECH_LOC_CT, -1); + } catch (Exception e) { + System.err.println(e.getMessage()); } } } - public void Visit( CombatVehicle v ) throws Exception { + public void Visit(CombatVehicle v) throws Exception { // does nothing at the moment } - public void Visit( Infantry i ) throws Exception { + public void Visit(Infantry i) throws Exception { // does nothing at the moment } - public void Visit( SupportVehicle s ) throws Exception { + public void Visit(SupportVehicle s) throws Exception { // does nothing at the moment } - public void Visit( BattleArmor b ) throws Exception { + public void Visit(BattleArmor b) throws Exception { // does nothing at the moment } - public void Visit( Fighter f ) throws Exception { + public void Visit(Fighter f) throws Exception { // does nothing at the moment } - public void Visit( Spaceship s ) throws Exception { + public void Visit(Spaceship s) throws Exception { // does nothing at the moment } - public void Visit( SpaceStation s ) throws Exception { + public void Visit(SpaceStation s) throws Exception { // does nothing at the moment } - public void Visit( ProtoMech p ) throws Exception { + public void Visit(ProtoMech p) throws Exception { // does nothing at the moment } - public void Visit( MobileStructure m ) throws Exception { + public void Visit(MobileStructure m) throws Exception { // does nothing at the moment } - public void Visit( LargeSupportVehicle l ) throws Exception { + public void Visit(LargeSupportVehicle l) throws Exception { // does nothing at the moment } - public void Visit( Dropship d ) throws Exception { + public void Visit(Dropship d) throws Exception { // does nothing at the moment } } From def2412934dd8f4619391ca53f849684e63d8a64 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 18:35:47 -0600 Subject: [PATCH 049/126] sswlib/src/main/java/visitors - VFCSArtemisVLoader - Type Enforcement of ArrayList;s - Update Interfaces to enforce Type Enforcement - Fix compile errors related to changes - VS Code Formatting. --- .../java/saw/filehandlers/HTMLWriter.java | 8 +- .../java/ssw/filehandlers/HTMLWriter.java | 18 +- .../main/java/components/CombatVehicle.java | 2048 ++++---- sswlib/src/main/java/components/Mech.java | 4631 +++++++++-------- .../src/main/java/components/ifCVLoadout.java | 6 +- .../main/java/components/ifMechLoadout.java | 424 +- .../main/java/filehandlers/CVTXTWriter.java | 989 ++-- .../src/main/java/filehandlers/TXTWriter.java | 1465 +++--- .../main/java/utilities/CostBVBreakdown.java | 906 +++- .../java/visitors/VFCSArtemisVLoader.java | 10 +- 10 files changed, 5890 insertions(+), 4615 deletions(-) diff --git a/saw/src/main/java/saw/filehandlers/HTMLWriter.java b/saw/src/main/java/saw/filehandlers/HTMLWriter.java index 2aa83bba..c562c4e6 100644 --- a/saw/src/main/java/saw/filehandlers/HTMLWriter.java +++ b/saw/src/main/java/saw/filehandlers/HTMLWriter.java @@ -1136,10 +1136,10 @@ private abPlaceable[] GetEquips( boolean fluff ) { } // sort the weapons by BV - Object[] o = CurVee.SortWeapons( ret, false ); + ArrayList o = CurVee.SortWeapons( ret, false ); ret.clear(); - for( int i = 0; i < o.length; i++ ) { - ret.add( o[i] ); + for( int i = 0; i < o.size(); i++ ) { + ret.add( o.get(i) ); } // now add any extra equipment to the end of the list. @@ -1498,4 +1498,4 @@ private String GetJumpJetTypeLine() { } return retval; } -} \ No newline at end of file +} diff --git a/ssw/src/main/java/ssw/filehandlers/HTMLWriter.java b/ssw/src/main/java/ssw/filehandlers/HTMLWriter.java index b69a53fd..5c594aa6 100644 --- a/ssw/src/main/java/ssw/filehandlers/HTMLWriter.java +++ b/ssw/src/main/java/ssw/filehandlers/HTMLWriter.java @@ -1164,10 +1164,10 @@ private abPlaceable[] GetEquips( boolean fluff ) { } // sort the weapons by BV - Object[] o = CurMech.SortWeapons( ret, false ); + ArrayList o = CurMech.SortWeapons( ret, false ); ret.clear(); - for( int i = 0; i < o.length; i++ ) { - ret.add( o[i] ); + for( int i = 0; i < o.size(); i++ ) { + ret.add( o.get(i) ); } // now add any extra equipment to the end of the list. @@ -1612,11 +1612,11 @@ private void BuildHash() { private String GetHeatSinkLine() { String retval = ""; - + int extraDHS = 0; boolean isProto = CurMech.GetHeatSinks().IsProtoDHS(); ArrayList equipment = CurMech.GetLoadout().GetEquipment(); - + for (int i = 0; i < equipment.size(); i++){ if (equipment.get(i) instanceof EquipmentProtoSuccWarsDoubleHeatSink){ extraDHS += 1; @@ -1624,20 +1624,20 @@ private String GetHeatSinkLine() { extraDHS += 1; } } - + if (isProto || extraDHS != 0){ int numberOfHS = CurMech.GetHeatSinks().GetNumHS(); int internalHS = CurMech.GetHeatSinks().InternalHeatSinks(); int singles; int doubles; if (isProto) - { + { singles = numberOfHS < internalHS ? numberOfHS : internalHS; doubles = (numberOfHS - singles) + extraDHS; } else { singles = numberOfHS; doubles = extraDHS; - } + } retval = singles + " + " + doubles + "(" + CurMech.GetHeatSinks().TotalDissipation() + ")"; } else if( CurMech.GetHeatSinks().IsDouble() ) { retval = CurMech.GetHeatSinks().GetNumHS() + " (" + CurMech.GetHeatSinks().TotalDissipation() + ")"; @@ -1764,4 +1764,4 @@ private String GetJumpJetTypeLine() { } return retval; } -} \ No newline at end of file +} diff --git a/sswlib/src/main/java/components/CombatVehicle.java b/sswlib/src/main/java/components/CombatVehicle.java index 9ed88257..f70053e1 100644 --- a/sswlib/src/main/java/components/CombatVehicle.java +++ b/sswlib/src/main/java/components/CombatVehicle.java @@ -34,141 +34,110 @@ import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; -import java.util.prefs.Preferences; +// import java.util.prefs.Preferences; import states.*; import visitors.*; public class CombatVehicle implements ifUnit, ifBattleforce { // Declares - private String Name = "", - Model = "", - Overview = "", - Capabilities = "", - History = "", - Deployment = "", - Variants = "", - Notables = "", - Additional = "", - Company = "", - Location = "", - EngineManufacturer = "", - ArmorModel = "", - ChassisModel = "", - JJModel = "", - CommSystem = "", - TandTSystem = "", - Solaris7ID = "0", - Solaris7ImageID = "0", - SSWImage = "", - Source = ""; - private int HeatSinks = 0, - Tonnage = 20, - CruiseMP = 1, - Crew = 0, - Year; - private double JJMult, - LiftEquipment = 0, - Controls = 0; - private boolean Omni = false, - FractionalAccounting = false, - Changed = false, - Primitive = false, - HasBlueShield = false, - HasTurret1 = false, - HasTurret2 = false, - HasSponsonTurret = false, - HasPowerAmplifier = false, - UsingFlotationHull = false, - UsingLimitedAmphibious = false, - UsingFullAmphibious = false, - UsingDuneBuggy = false, - UsingEnvironmentalSealing = false, - IsTrailer = false; - private static ifCombatVehicle Wheeled = new stCVWheeled(), - Tracked = new stCVTracked(), - Hover = new stCVHover(), - VTOL = new stCVVTOL(), - WiGE = new stCVWiGE(), - Displacement = new stCVDisplacement(), - Hydrofoil = new stCVHydrofoil(), - Submarine = new stCVSubmarine(), - SHHover = new stCVHoverSH(), - SHDisplacement = new stCVDisplacementSH(); - private ifCombatVehicle[] states = new ifCombatVehicle[]{ Wheeled, Tracked, Hover, VTOL, WiGE, Displacement, Hydrofoil, Submarine, SHHover, SHDisplacement}; - private Engine CurEngine = new Engine( this ); + private String Name = "", Model = "", Overview = "", Capabilities = "", History = "", Deployment = "", + Variants = "", Notables = "", Additional = "", Company = "", Location = "", EngineManufacturer = "", + ArmorModel = "", ChassisModel = "", JJModel = "", CommSystem = "", TandTSystem = "", Solaris7ID = "0", + Solaris7ImageID = "0", SSWImage = "", Source = ""; + private int // HeatSinks = 0, // Variables aren't actually used + Tonnage = 20, CruiseMP = 1, + // Crew = 0, + Year; + private double JJMult, LiftEquipment = 0, Controls = 0; + private boolean Omni = false, FractionalAccounting = false, Changed = false, Primitive = false, + HasBlueShield = false, HasTurret1 = false, HasTurret2 = false, HasSponsonTurret = false, + HasPowerAmplifier = false, UsingFlotationHull = false, UsingLimitedAmphibious = false, + UsingFullAmphibious = false, UsingDuneBuggy = false, UsingEnvironmentalSealing = false, IsTrailer = false; + private static ifCombatVehicle Wheeled = new stCVWheeled(), Tracked = new stCVTracked(), Hover = new stCVHover(), + VTOL = new stCVVTOL(), WiGE = new stCVWiGE(), Displacement = new stCVDisplacement(), + Hydrofoil = new stCVHydrofoil(), Submarine = new stCVSubmarine(), SHHover = new stCVHoverSH(), + SHDisplacement = new stCVDisplacementSH(); + private ifCombatVehicle[] states = new ifCombatVehicle[] { Wheeled, Tracked, Hover, VTOL, WiGE, Displacement, + Hydrofoil, Submarine, SHHover, SHDisplacement }; + private Engine CurEngine = new Engine(this); private ifCombatVehicle CurConfig = Tracked; - private InternalStructure CurStructure = new InternalStructure( this ); + private InternalStructure CurStructure = new InternalStructure(this); private ArrayList Loadouts = new ArrayList(); - private ifCVLoadout MainLoadout, - CurLoadout; - private CVArmor CurArmor = new CVArmor( this ); - private Hashtable Lookup = new Hashtable(); + private ifCVLoadout MainLoadout, CurLoadout; + private CVArmor CurArmor = new CVArmor(this); + private Hashtable Lookup = new Hashtable(); private ArrayList MechMods = new ArrayList(); - private static AvailableCode OmniAvailable = new AvailableCode( AvailableCode.TECH_BOTH ), - DualTurretAC = new AvailableCode( AvailableCode.TECH_BOTH ), - ChinTurretAC = new AvailableCode( AvailableCode.TECH_BOTH ), - SponsonAC = new AvailableCode( AvailableCode.TECH_BOTH ); - private Preferences Prefs; + private static AvailableCode OmniAvailable = new AvailableCode(AvailableCode.TECH_BOTH), + DualTurretAC = new AvailableCode(AvailableCode.TECH_BOTH), + ChinTurretAC = new AvailableCode(AvailableCode.TECH_BOTH), + SponsonAC = new AvailableCode(AvailableCode.TECH_BOTH); + // private Preferences Prefs; // Not Used private BattleForceData BFData; - private MultiSlotSystem BlueShield, - EnviroSealing; - public final static double[] DefensiveFactor = { 1.0, 1.0, 1.1, 1.1, 1.2, 1.2, - 1.3, 1.3, 1.3, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.5, - 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6 }; + private MultiSlotSystem BlueShield, EnviroSealing; + public final static double[] DefensiveFactor = { 1.0, 1.0, 1.1, 1.1, 1.2, 1.2, 1.3, 1.3, 1.3, 1.4, 1.4, 1.4, 1.4, + 1.4, 1.4, 1.4, 1.4, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6 }; public CombatVehicle() { - OmniAvailable.SetCodes( 'E', 'X', 'E', 'E', 'D', 'E', 'X', 'E', 'E', 'D' ); - OmniAvailable.SetFactions( "", "", "", "", "", "", "", "" ); - OmniAvailable.SetISDates( 0, 0, false, 3010, 0, 0, false, false ); - OmniAvailable.SetCLDates( 0, 0, false, 2854, 0, 0, false, false ); - OmniAvailable.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - - DualTurretAC.SetCodes( 'B', 'F', 'F', 'F', 'E', 'B', 'F', 'F', 'F', 'E' ); - DualTurretAC.SetFactions( "", "", "PS", "", "", "", "PS", "" ); - DualTurretAC.SetISDates( 0, 0, false, 1950, 0, 0, false, false ); - DualTurretAC.SetCLDates( 0, 0, false, 1950, 0, 0, false, false ); - DualTurretAC.SetRulesLevels( AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - - ChinTurretAC.SetCodes( 'B', 'F', 'F', 'F', 'E', 'B', 'F', 'F', 'F', 'E' ); - ChinTurretAC.SetFactions( "", "", "PS", "", "", "", "PS", "" ); - ChinTurretAC.SetISDates( 0, 0, false, 1950, 0, 0, false, false ); - ChinTurretAC.SetCLDates( 0, 0, false, 1950, 0, 0, false, false ); - ChinTurretAC.SetRulesLevels( AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - - SponsonAC.SetCodes( 'B', 'F', 'F', 'F', 'D', 'B', 'F', 'F', 'F', 'D' ); - SponsonAC.SetFactions( "", "", "PS", "", "", "", "PS", "" ); - SponsonAC.SetISDates( 0, 0, false, 1950, 0, 0, false, false ); - SponsonAC.SetCLDates( 0, 0, false, 1950, 0, 0, false, false ); - SponsonAC.SetRulesLevels( AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - - AvailableCode AC = new AvailableCode( AvailableCode.TECH_INNER_SPHERE ); - AC.SetISCodes( 'E', 'X', 'X', 'F', 'F' ); - AC.SetISDates( 3051, 3053, true, 3053, 0, 0, false, false ); - AC.SetISFactions( "FS", "FS", "", "" ); - AC.SetPBMAllowed( true ); - AC.SetPIMAllowed( true ); - AC.SetRulesLevels( AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - BlueShield = new MultiSlotSystem( this, "Blue Shield PFD", "Blue Shield PFD", "Blue Shield Project", "Blue Shield Particle Field Damper", 3.0, false, true, 1000000.0, false, AC ); - BlueShield.AddMechModifier( new MechModifier( 0, 0, 0, 0.0, 0, 0, 0, 0.0, 0.0, 0.2, 0.2, true, false ) ); - BlueShield.SetBookReference( "Tactical Operations" ); - BlueShield.SetChatName( "BluShld" ); - - AC = new AvailableCode( AvailableCode.TECH_BOTH ); - AC.SetISCodes( 'C', 'C', 'C', 'C', 'C' ); - AC.SetISDates( 0, 0, false, 2350, 0, 0, false, false ); - AC.SetISFactions( "", "", "TH", "" ); - AC.SetCLCodes( 'C', 'X', 'C', 'C', 'C' ); - AC.SetCLDates( 0, 0, false, 2350, 0, 0, false, false ); - AC.SetCLFactions( "", "", "TH", "" ); - AC.SetPBMAllowed( true ); - AC.SetPIMAllowed( true ); - AC.SetRulesLevels( AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_INTRODUCTORY, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - EnviroSealing = new MultiSlotSystem( this, "Environmental Sealing", "Environmental Sealing", "Environmental Sealing", "Environmental Sealing", 0.1, false, false, 225.0, true, AC ); - EnviroSealing.SetWeightBasedOnMechTonnage( true ); - EnviroSealing.SetBookReference( "Tech Manual" ); - EnviroSealing.SetChatName( "EnvSlng" ); - - HeatSinks = CurEngine.FreeHeatSinks(); + OmniAvailable.SetCodes('E', 'X', 'E', 'E', 'D', 'E', 'X', 'E', 'E', 'D'); + OmniAvailable.SetFactions("", "", "", "", "", "", "", ""); + OmniAvailable.SetISDates(0, 0, false, 3010, 0, 0, false, false); + OmniAvailable.SetCLDates(0, 0, false, 2854, 0, 0, false, false); + OmniAvailable.SetRulesLevels(AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, + AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + + DualTurretAC.SetCodes('B', 'F', 'F', 'F', 'E', 'B', 'F', 'F', 'F', 'E'); + DualTurretAC.SetFactions("", "", "PS", "", "", "", "PS", ""); + DualTurretAC.SetISDates(0, 0, false, 1950, 0, 0, false, false); + DualTurretAC.SetCLDates(0, 0, false, 1950, 0, 0, false, false); + DualTurretAC.SetRulesLevels(AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, + AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + + ChinTurretAC.SetCodes('B', 'F', 'F', 'F', 'E', 'B', 'F', 'F', 'F', 'E'); + ChinTurretAC.SetFactions("", "", "PS", "", "", "", "PS", ""); + ChinTurretAC.SetISDates(0, 0, false, 1950, 0, 0, false, false); + ChinTurretAC.SetCLDates(0, 0, false, 1950, 0, 0, false, false); + ChinTurretAC.SetRulesLevels(AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, + AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + + SponsonAC.SetCodes('B', 'F', 'F', 'F', 'D', 'B', 'F', 'F', 'F', 'D'); + SponsonAC.SetFactions("", "", "PS", "", "", "", "PS", ""); + SponsonAC.SetISDates(0, 0, false, 1950, 0, 0, false, false); + SponsonAC.SetCLDates(0, 0, false, 1950, 0, 0, false, false); + SponsonAC.SetRulesLevels(AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, + AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + + AvailableCode AC = new AvailableCode(AvailableCode.TECH_INNER_SPHERE); + AC.SetISCodes('E', 'X', 'X', 'F', 'F'); + AC.SetISDates(3051, 3053, true, 3053, 0, 0, false, false); + AC.SetISFactions("FS", "FS", "", ""); + AC.SetPBMAllowed(true); + AC.SetPIMAllowed(true); + AC.SetRulesLevels(AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_EXPERIMENTAL, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + BlueShield = new MultiSlotSystem(this, "Blue Shield PFD", "Blue Shield PFD", "Blue Shield Project", + "Blue Shield Particle Field Damper", 3.0, false, true, 1000000.0, false, AC); + BlueShield.AddMechModifier(new MechModifier(0, 0, 0, 0.0, 0, 0, 0, 0.0, 0.0, 0.2, 0.2, true, false)); + BlueShield.SetBookReference("Tactical Operations"); + BlueShield.SetChatName("BluShld"); + + AC = new AvailableCode(AvailableCode.TECH_BOTH); + AC.SetISCodes('C', 'C', 'C', 'C', 'C'); + AC.SetISDates(0, 0, false, 2350, 0, 0, false, false); + AC.SetISFactions("", "", "TH", ""); + AC.SetCLCodes('C', 'X', 'C', 'C', 'C'); + AC.SetCLDates(0, 0, false, 2350, 0, 0, false, false); + AC.SetCLFactions("", "", "TH", ""); + AC.SetPBMAllowed(true); + AC.SetPIMAllowed(true); + AC.SetRulesLevels(AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_TOURNAMENT, + AvailableCode.RULES_INTRODUCTORY, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + EnviroSealing = new MultiSlotSystem(this, "Environmental Sealing", "Environmental Sealing", + "Environmental Sealing", "Environmental Sealing", 0.1, false, false, 225.0, true, AC); + EnviroSealing.SetWeightBasedOnMechTonnage(true); + EnviroSealing.SetBookReference("Tech Manual"); + EnviroSealing.SetChatName("EnvSlng"); + + // HeatSinks = CurEngine.FreeHeatSinks(); CurLoadout = new CVLoadout(this); CurLoadout.GetHeatSinks().SetSingle(); @@ -178,12 +147,12 @@ public CombatVehicle() { setTonnage(10); } - public void Visit( ifVisitor v ) throws Exception { - v.Visit( this ); + public void Visit(ifVisitor v) throws Exception { + v.Visit(this); } public void Validate() { - if ( getTonnage() > getCurConfig().GetMaxTonnage() ) { + if (getTonnage() > getCurConfig().GetMaxTonnage()) { setTonnage(getCurConfig().GetMaxTonnage()); } } @@ -225,12 +194,12 @@ public void SetSubmarine() { SetTrailer(false); setCurConfig(Submarine); } - + public void SetSuperHeavyHover() { SetTrailer(false); setCurConfig(SHHover); } - + public void SetSuperHeavyDisplacement() { SetTrailer(false); setCurConfig(SHDisplacement); @@ -243,7 +212,7 @@ public String GetMotiveLookupName() { public int GetMinTonnage() { return getCurConfig().GetMinTonnage(); } - + public int GetMaxTonnage() { return getCurConfig().GetMaxTonnage(); } @@ -267,13 +236,13 @@ public boolean CanBeDuneBuggy() { public boolean CanUseEnviroSealing() { return getCurConfig().CanUseEnviroSealing(); } - + public int GetSuspensionFactor() { - return getCurConfig().GetSuspensionFactor( Tonnage ); + return getCurConfig().GetSuspensionFactor(Tonnage); } public float GetMinEngineWeight() { - return getCurConfig().GetMinEngineWeight( Tonnage ); + return getCurConfig().GetMinEngineWeight(Tonnage); } public float GetLiftEquipmentCostMultiplier() { @@ -284,24 +253,22 @@ public boolean RequiresLiftEquipment() { return getCurConfig().RequiresLiftEquipment(); } - public double GetLiftEquipmentTonnage() - { + public double GetLiftEquipmentTonnage() { return LiftEquipment; } - + public double GetLiftEquipmentCost() { return GetLiftEquipmentCostMultiplier() * LiftEquipment; } - public double GetControls() - { + public double GetControls() { return Controls; } - + public double GetControlsCost() { return 10000 * Controls; } - + public boolean IsVTOL() { return getCurConfig().IsVTOL(); } @@ -309,32 +276,35 @@ public boolean IsVTOL() { public boolean IsWIGE() { return getCurConfig().IsWIGE(); } - + public boolean IsNaval() { - return ( (CurConfig instanceof stCVDisplacement) || - (CurConfig instanceof stCVHydrofoil) || - (CurConfig instanceof stCVSubmarine) ) ? true : false; + return ((CurConfig instanceof stCVDisplacement) || (CurConfig instanceof stCVHydrofoil) + || (CurConfig instanceof stCVSubmarine)) ? true : false; } - + public boolean IsGround() { - return ( ( CurConfig instanceof stCVHover ) || - ( CurConfig instanceof stCVTracked ) || - ( CurConfig instanceof stCVWheeled ) || - ( CurConfig instanceof stCVWiGE ) ) ? true : false; + return ((CurConfig instanceof stCVHover) || (CurConfig instanceof stCVTracked) + || (CurConfig instanceof stCVWheeled) || (CurConfig instanceof stCVWiGE)) ? true : false; } public boolean CanUseTurret() { - if( IsVTOL() && CommonTools.IsAllowed( ChinTurretAC,this) ) { return true; } + if (IsVTOL() && CommonTools.IsAllowed(ChinTurretAC, this)) { + return true; + } return getCurConfig().CanUseTurret(); } public boolean CanUseDualTurret() { - if( CommonTools.IsAllowed( DualTurretAC,this) ) { return true; } + if (CommonTools.IsAllowed(DualTurretAC, this)) { + return true; + } return false; } public boolean CanUseSponson() { - if( CommonTools.IsAllowed( SponsonAC,this) ) { return true; } + if (CommonTools.IsAllowed(SponsonAC, this)) { + return true; + } return false; } @@ -358,10 +328,10 @@ public CVArmor GetArmor() { return getCurArmor(); } - public ArrayList GetLoadouts() { + public ArrayList GetLoadouts() { return Loadouts; } - + public ifCVLoadout GetMainLoadout() { return getMainLoadout(); } @@ -373,14 +343,13 @@ public boolean IsOmni() { public int GetBaseRulesLevel() { return MainLoadout.GetRulesLevel(); } - + public Engine GetEngine() { return getCurEngine(); } - public double GetEngineTonnage() - { - return Math.max(CurEngine.GetTonnage(), CurConfig.GetMinEngineWeight( Tonnage )); + public double GetEngineTonnage() { + return Math.max(CurEngine.GetTonnage(), CurConfig.GetMinEngineWeight(Tonnage)); } public int GetYear() { @@ -389,23 +358,24 @@ public int GetYear() { public int GetCurrentBV() { // returns the final battle value of the combat vehicle - return (int) Math.round(( GetDefensiveBV() + GetOffensiveBV() ) ); + return (int) Math.round((GetDefensiveBV() + GetOffensiveBV())); } public double GetTotalCost() { // final cost calculations return GetDryCost() + GetAmmoCosts(); } - + public double GetDryCost() { // returns the total cost of the mech without ammunition - return (GetEquipCost() + CurLoadout.GetSponsonTurretCost() + GetChassisCost()) * GetCostMult() * GetConfigMultiplier(); + return (GetEquipCost() + CurLoadout.GetSponsonTurretCost() + GetChassisCost()) * GetCostMult() + * GetConfigMultiplier(); } - + public double GetConfigMultiplier() { - return (1 + ((double)Tonnage / (double)CurConfig.GetCostMultiplier())); + return (1 + ((double) Tonnage / (double) CurConfig.GetCostMultiplier())); } - + public double GetCurrentTons() { // returns the current total tonnage of the combat vehicle double result = 0.0; @@ -417,18 +387,23 @@ public double GetCurrentTons() { result += CurArmor.GetTonnage(); result += GetHeatSinks().GetTonnage(); result += CurLoadout.GetPowerAmplifier().GetTonnage(); - if ( isHasTurret1() ) result += CurLoadout.GetTurretTonnage(); - if ( isHasTurret2() ) result += CurLoadout.GetRearTurretTonnage(); - if ( isHasSponsonTurret() ) result += CurLoadout.GetSponsonTurretTonnage(); + if (isHasTurret1()) + result += CurLoadout.GetTurretTonnage(); + if (isHasTurret2()) + result += CurLoadout.GetRearTurretTonnage(); + if (isHasSponsonTurret()) + result += CurLoadout.GetSponsonTurretTonnage(); result += GetLimitedAmphibiousTonnage(); result += GetFullAmphibiousTonnage(); result += GetEnvironmentalSealingTonnage(); - //if( HasBlueShield ) { result += BlueShield.GetTonnage(); } - if( CurLoadout.HasSupercharger() ) { result += CurLoadout.GetSupercharger().GetTonnage(); } + // if( HasBlueShield ) { result += BlueShield.GetTonnage(); } + if (CurLoadout.HasSupercharger()) { + result += CurLoadout.GetSupercharger().GetTonnage(); + } - ArrayList v = CurLoadout.GetNonCore(); - if( v.size() > 0 ) { - for( int i = 0; i < v.size(); i++ ) { + ArrayList v = CurLoadout.GetNonCore(); + if (v.size() > 0) { + for (int i = 0; i < v.size(); i++) { result += ((abPlaceable) v.get(i)).GetTonnage(); } } @@ -446,16 +421,26 @@ public double GetCurrentDryTons() { result += GetHeatSinks().GetTonnage(); result += GetJumpJets().GetTonnage(); result += CurArmor.GetTonnage(); - if( CurLoadout.UsingTC() ) { result += GetTC().GetTonnage(); } - if( ! CurEngine.IsNuclear() ) { result += CurLoadout.GetPowerAmplifier().GetTonnage(); } - if( HasBlueShield ) { result += BlueShield.GetTonnage(); } - if( CurLoadout.HasSupercharger() ) { result += CurLoadout.GetSupercharger().GetTonnage(); } - if( UsingEnvironmentalSealing ) { result += EnviroSealing.GetTonnage(); } - - ArrayList v = CurLoadout.GetNonCore(); - if( v.size() > 0 ) { - for( int i = 0; i < v.size(); i++ ) { - if( ! ( v.get( i ) instanceof Ammunition ) ) { + if (CurLoadout.UsingTC()) { + result += GetTC().GetTonnage(); + } + if (!CurEngine.IsNuclear()) { + result += CurLoadout.GetPowerAmplifier().GetTonnage(); + } + if (HasBlueShield) { + result += BlueShield.GetTonnage(); + } + if (CurLoadout.HasSupercharger()) { + result += CurLoadout.GetSupercharger().GetTonnage(); + } + if (UsingEnvironmentalSealing) { + result += EnviroSealing.GetTonnage(); + } + + ArrayList v = CurLoadout.GetNonCore(); + if (v.size() > 0) { + for (int i = 0; i < v.size(); i++) { + if (!(v.get(i) instanceof Ammunition)) { result += ((abPlaceable) v.get(i)).GetTonnage(); } } @@ -467,11 +452,11 @@ public boolean UsingFractionalAccounting() { return isFractionalAccounting(); } - public void SetFractionalAccounting( boolean b ) { + public void SetFractionalAccounting(boolean b) { setFractionalAccounting(b); } - public void SetChanged( boolean b ) { + public void SetChanged(boolean b) { setChanged(b); } @@ -479,15 +464,15 @@ public boolean HasChanged() { return isChanged(); } - public void AddHeatSinks( int i ) { + public void AddHeatSinks(int i) { } - public void SetHeatSinks( int i ) { + public void SetHeatSinks(int i) { } - public void RemoveHeatSinks( int i ) { + public void RemoveHeatSinks(int i) { // be sure to check against the engine's free heat sinks! } @@ -499,7 +484,7 @@ public double GetHeatSinkTonnage() { // remember to not include the engine's free sinks. return 0.0; } - + public void ResetHeatSinks() { CurLoadout.ResetHeatSinks(); } @@ -512,77 +497,50 @@ public boolean UsingTurret2() { return isHasTurret2(); } - //Battleforce Specific Methods + // Battleforce Specific Methods /** * Determines the size of the unit from pg. 356 of Strategic Operations - * @return + * + * @return */ public int GetBFSize() { int mass = GetTonnage(); - if( mass < 40 ){ + if (mass < 40) { return BFConstants.BF_SIZE_LIGHT; - }else if( mass < 60 ){ + } else if (mass < 60) { return BFConstants.BF_SIZE_MEDIUM; - }else if ( mass < 80 ){ + } else if (mass < 80) { return BFConstants.BF_SIZE_HEAVY; - }else{ + } else { return BFConstants.BF_SIZE_ASSAULT; } /* - int mass = GetTonnage(); - if ( mass < 5.0 ) - return BFConstants.BF_SIZE_SMALL; - - //Hover - if ( "h".equals(CurConfig.GetBFMotiveType())) { - if ( mass <= 50 ) - return BFConstants.BF_SIZE_MEDIUM; - return BFConstants.BF_SIZE_LARGE; - } - - //Naval and Submarines - if ( "n".equals(CurConfig.GetBFMotiveType()) || - "s".equals(CurConfig.GetBFMotiveType())) { - if ( mass <= 300) - return BFConstants.BF_SIZE_MEDIUM; - if ( mass <= 6000) - return BFConstants.BF_SIZE_LARGE; - if ( mass <= 30000) - return BFConstants.BF_SIZE_VERYLARGE; - return BFConstants.BF_SIZE_SUPERLARGE; - } - - //Tracked - if ( "t".equals(CurConfig.GetBFMotiveType())) { - if ( mass <= 100 ) - return BFConstants.BF_SIZE_MEDIUM; - return BFConstants.BF_SIZE_LARGE; - } - - //VTOL - if ( "v".equals(CurConfig.GetBFMotiveType())) { - if ( mass <= 30) - return BFConstants.BF_SIZE_MEDIUM; - return BFConstants.BF_SIZE_LARGE; - } - - //Wheeled - if ( "w".equals(CurConfig.GetBFMotiveType())) { - if ( mass <= 80) - return BFConstants.BF_SIZE_MEDIUM; - return BFConstants.BF_SIZE_LARGE; - } - - //WiGE - if ( "g".equals(CurConfig.GetBFMotiveType())) { - if ( mass <= 80) - return BFConstants.BF_SIZE_MEDIUM; - return BFConstants.BF_SIZE_LARGE; - } - - return BFConstants.BF_SIZE_SMALL; - */ + * int mass = GetTonnage(); if ( mass < 5.0 ) return BFConstants.BF_SIZE_SMALL; + * + * //Hover if ( "h".equals(CurConfig.GetBFMotiveType())) { if ( mass <= 50 ) + * return BFConstants.BF_SIZE_MEDIUM; return BFConstants.BF_SIZE_LARGE; } + * + * //Naval and Submarines if ( "n".equals(CurConfig.GetBFMotiveType()) || + * "s".equals(CurConfig.GetBFMotiveType())) { if ( mass <= 300) return + * BFConstants.BF_SIZE_MEDIUM; if ( mass <= 6000) return + * BFConstants.BF_SIZE_LARGE; if ( mass <= 30000) return + * BFConstants.BF_SIZE_VERYLARGE; return BFConstants.BF_SIZE_SUPERLARGE; } + * + * //Tracked if ( "t".equals(CurConfig.GetBFMotiveType())) { if ( mass <= 100 ) + * return BFConstants.BF_SIZE_MEDIUM; return BFConstants.BF_SIZE_LARGE; } + * + * //VTOL if ( "v".equals(CurConfig.GetBFMotiveType())) { if ( mass <= 30) + * return BFConstants.BF_SIZE_MEDIUM; return BFConstants.BF_SIZE_LARGE; } + * + * //Wheeled if ( "w".equals(CurConfig.GetBFMotiveType())) { if ( mass <= 80) + * return BFConstants.BF_SIZE_MEDIUM; return BFConstants.BF_SIZE_LARGE; } + * + * //WiGE if ( "g".equals(CurConfig.GetBFMotiveType())) { if ( mass <= 80) + * return BFConstants.BF_SIZE_MEDIUM; return BFConstants.BF_SIZE_LARGE; } + * + * return BFConstants.BF_SIZE_SMALL; + */ } public int GetBFPrimeMovement() { @@ -594,13 +552,13 @@ public String GetBFPrimeMovementMode() { int walkMP = getCruiseMP(); int jumpMP = GetJumpJets().GetNumJJ(); - if ( walkMP == jumpMP && GetBFPrimeMovement() == jumpMP ){ - if ( GetBFSecondaryMovementMode().isEmpty() ) { + if (walkMP == jumpMP && GetBFPrimeMovement() == jumpMP) { + if (GetBFSecondaryMovementMode().isEmpty()) { return "j"; } else { return CurConfig.GetBFMotiveType(); } - }else{ + } else { return CurConfig.GetBFMotiveType(); } } @@ -610,16 +568,16 @@ public int GetBFSecondaryMovement() { int walkMP = GetBFPrimeMovement(); int jumpMP = GetJumpJets().GetNumJJ(); - if ( jumpMP > 0 && walkMP != jumpMP ){ - if ( baseMP > jumpMP ) - return (int)(Math.round(jumpMP*0.66)); - else if ( baseMP == jumpMP && walkMP > jumpMP ) + if (jumpMP > 0 && walkMP != jumpMP) { + if (baseMP > jumpMP) + return (int) (Math.round(jumpMP * 0.66)); + else if (baseMP == jumpMP && walkMP > jumpMP) return jumpMP; - else if ( walkMP < jumpMP ) + else if (walkMP < jumpMP) return jumpMP; else return 0; - }else + } else return 0; } @@ -627,9 +585,9 @@ public String GetBFSecondaryMovementMode() { int walkMP = GetBFPrimeMovement(); int jumpMP = GetJumpJets().GetNumJJ(); - if ( jumpMP > 0 && walkMP != jumpMP ) + if (jumpMP > 0 && walkMP != jumpMP) return "j"; - else if ( walkMP < jumpMP ) + else if (walkMP < jumpMP) return "j"; else return ""; @@ -639,13 +597,13 @@ public int GetBFArmor() { CVArmor a = GetArmor(); double armorpoints = a.GetArmorValue(); - if ( a.IsCommercial() ){ + if (a.IsCommercial()) { armorpoints = (double) Math.floor(armorpoints / 2.0); - }else if ( a.IsFerroLamellor() ){ + } else if (a.IsFerroLamellor()) { armorpoints = (double) Math.ceil(armorpoints * 1.2); - }else if ( a.IsHardened() ){ + } else if (a.IsHardened()) { armorpoints = (double) Math.ceil(armorpoints * 2.0); - }else if ( a.IsReactive() || a.IsReflective() ){ + } else if (a.IsReactive() || a.IsReflective()) { armorpoints = (double) Math.ceil(armorpoints * 0.75f); } @@ -655,90 +613,112 @@ public int GetBFArmor() { } public int GetBFStructure() { - Engine e = GetEngine(); - int t = GetTonnage(); + // Neither are used. + // Engine e = GetEngine(); + // int t = GetTonnage(); int s = CurStructure.NumCVSpaces(); int retval = s * 4; - if ( isHasTurret1() ) retval += s; - if ( isHasTurret2() ) retval += s; - if ( IsVTOL() ) retval += s; - - return (int)Math.round(retval / 10.0); + if (isHasTurret1()) + retval += s; + if (isHasTurret2()) + retval += s; + if (IsVTOL()) + retval += s; + + return (int) Math.round(retval / 10.0); } public int[] GetBFDamage(BattleForceStats bfs) { - int[] retval = {0,0,0,0,0}; - int CoolantPods = 0; + int[] retval = { 0, 0, 0, 0, 0 }; + // int CoolantPods = 0; // Not used but to increment a value that is not read anywhere. // Loop through all weapons in non-core // and convert all weapon dmg - ArrayList nc = GetLoadout().GetNonCore(); - BattleForceData baseData = new BattleForceData(); + ArrayList nc = GetLoadout().GetNonCore(); + // BattleForceData baseData = new BattleForceData(); // Not used in method BattleForceData turret1Data = new BattleForceData(); BattleForceData turret2Data = new BattleForceData(); BFData = new BattleForceData(); - + boolean isTurret1 = false; boolean isTurret2 = false; - BFData.AddNote("Weapon :: Short / Medium / Long / Extreme / [Heat]" ); - for ( int i = 0; i < nc.size(); i++ ) { - if ( nc.get(i) instanceof ifWeapon ) { - ifWeapon w = (ifWeapon)nc.get(i); - double [] temp = BattleForceTools.GetDamage(w, (ifBattleforce)this); + BFData.AddNote("Weapon :: Short / Medium / Long / Extreme / [Heat]"); + for (int i = 0; i < nc.size(); i++) { + if (nc.get(i) instanceof ifWeapon) { + ifWeapon w = (ifWeapon) nc.get(i); + double[] temp = BattleForceTools.GetDamage(w, (ifBattleforce) this); BFData.AddBase(temp); - - isTurret1 = ( GetLoadout().Find((abPlaceable)nc.get(i)) == LocationIndex.CV_LOC_TURRET1); - isTurret2 = ( GetLoadout().Find((abPlaceable)nc.get(i)) == LocationIndex.CV_LOC_TURRET2); - - if ( isTurret1 ) turret1Data.AddBase(temp); - if ( isTurret2) turret2Data.AddBase(temp); - - if ( BattleForceTools.isBFAutocannon(w) ) { + + isTurret1 = (GetLoadout().Find((abPlaceable) nc.get(i)) == LocationIndex.CV_LOC_TURRET1); + isTurret2 = (GetLoadout().Find((abPlaceable) nc.get(i)) == LocationIndex.CV_LOC_TURRET2); + + if (isTurret1) + turret1Data.AddBase(temp); + if (isTurret2) + turret2Data.AddBase(temp); + + if (BattleForceTools.isBFAutocannon(w)) { BFData.AC.AddBase(temp); - if ( isTurret1 ) turret1Data.AC.AddBase(temp); - if ( isTurret2) turret2Data.AC.AddBase(temp); - } else if ( BattleForceTools.isBFLRM(w) ) { + if (isTurret1) + turret1Data.AC.AddBase(temp); + if (isTurret2) + turret2Data.AC.AddBase(temp); + } else if (BattleForceTools.isBFLRM(w)) { BFData.LRM.AddBase(temp); - if ( isTurret1 ) turret1Data.LRM.AddBase(temp); - if ( isTurret2) turret2Data.LRM.AddBase(temp); - } else if ( BattleForceTools.isBFSRM(w) ) { + if (isTurret1) + turret1Data.LRM.AddBase(temp); + if (isTurret2) + turret2Data.LRM.AddBase(temp); + } else if (BattleForceTools.isBFSRM(w)) { BFData.SRM.AddBase(temp); - if ( isTurret1 ) turret1Data.SRM.AddBase(temp); - if ( isTurret2) turret2Data.SRM.AddBase(temp); - } else if ( BattleForceTools.isBFSRT(w) || - BattleForceTools.isBFLRT(w) ) { + if (isTurret1) + turret1Data.SRM.AddBase(temp); + if (isTurret2) + turret2Data.SRM.AddBase(temp); + } else if (BattleForceTools.isBFSRT(w) || BattleForceTools.isBFLRT(w)) { BFData.TOR.AddBase(temp); - if ( isTurret1 ) turret1Data.TOR.AddBase(temp); - if ( isTurret2) turret2Data.TOR.AddBase(temp); - } else if ( BattleForceTools.isBFMML(w) ) - { - BFData.SRM.AddBase(new double[]{temp[BFConstants.BF_SHORT], temp[BFConstants.BF_MEDIUM]/2.0, 0.0, 0.0, temp[BFConstants.BF_OV]}); - BFData.LRM.AddBase(new double[]{0.0, temp[BFConstants.BF_MEDIUM]/2.0, temp[BFConstants.BF_LONG], 0.0, temp[BFConstants.BF_OV]} ); - if ( isTurret1 ) { + if (isTurret1) + turret1Data.TOR.AddBase(temp); + if (isTurret2) + turret2Data.TOR.AddBase(temp); + } else if (BattleForceTools.isBFMML(w)) { + BFData.SRM.AddBase(new double[] { temp[BFConstants.BF_SHORT], temp[BFConstants.BF_MEDIUM] / 2.0, + 0.0, 0.0, temp[BFConstants.BF_OV] }); + BFData.LRM.AddBase(new double[] { 0.0, temp[BFConstants.BF_MEDIUM] / 2.0, temp[BFConstants.BF_LONG], + 0.0, temp[BFConstants.BF_OV] }); + if (isTurret1) { turret1Data.SRM.AddBase(temp); turret1Data.LRM.AddBase(temp); } - if ( isTurret2) { + if (isTurret2) { turret2Data.SRM.AddBase(temp); turret2Data.LRM.AddBase(temp); } } - if ( BattleForceTools.isBFIF(w) ) { + if (BattleForceTools.isBFIF(w)) { BFData.IF.AddBase(temp); - if ( isTurret1 ) turret1Data.IF.AddBase(temp); - if ( isTurret2) turret2Data.IF.AddBase(temp); - } if ( BattleForceTools.isBFFLK(w) ) { - BFData.FLK.AddBase(temp); - if ( isTurret1 ) turret1Data.FLK.AddBase(temp); - if ( isTurret2) turret2Data.FLK.AddBase(temp); + if (isTurret1) + turret1Data.IF.AddBase(temp); + if (isTurret2) + turret2Data.IF.AddBase(temp); } - BFData.AddNote(nc.get(i).toString() + " :: " + temp[BFConstants.BF_SHORT] + "/" + temp[BFConstants.BF_MEDIUM] + "/" + temp[BFConstants.BF_LONG] + "/" + temp[BFConstants.BF_EXTREME] + " [" + temp[BFConstants.BF_OV] + "]" ); - } else if ( nc.get(i) instanceof Equipment ) { - Equipment equip = ((Equipment) nc.get(i)); - if ( equip.CritName().contains("Coolant Pod")) { - CoolantPods++; + if (BattleForceTools.isBFFLK(w)) { + BFData.FLK.AddBase(temp); + if (isTurret1) + turret1Data.FLK.AddBase(temp); + if (isTurret2) + turret2Data.FLK.AddBase(temp); } + BFData.AddNote(nc.get(i).toString() + " :: " + temp[BFConstants.BF_SHORT] + "/" + + temp[BFConstants.BF_MEDIUM] + "/" + temp[BFConstants.BF_LONG] + "/" + + temp[BFConstants.BF_EXTREME] + " [" + temp[BFConstants.BF_OV] + "]"); + } else if (nc.get(i) instanceof Equipment) { + // Basically a NOP as value isn't used anywhere else. + // Equipment equip = ((Equipment) nc.get(i)); + // if (equip.CritName().contains("Coolant Pod")) { + // CoolantPods++; + // } } } @@ -749,7 +729,7 @@ public int[] GetBFDamage(BattleForceStats bfs) { turret2Data.AddHeat(-4); // Also include Stealth heat, which is ALWAYS on in BF - if ( GetArmor().IsStealth() ) { + if (GetArmor().IsStealth()) { BFData.AddHeat(10); turret1Data.AddHeat(10); turret2Data.AddHeat(10); @@ -758,57 +738,71 @@ public int[] GetBFDamage(BattleForceStats bfs) { BFData.SetHeat(BFData.getTotalHeatGenerated()); turret1Data.SetHeat(turret1Data.getTotalHeatGenerated()); turret2Data.SetHeat(turret2Data.getTotalHeatGenerated()); - + BFData.CheckSpecials(); turret1Data.CheckSpecials(); turret2Data.CheckSpecials(); // Convert all damage to BF scale - retval[BFConstants.BF_SHORT] = BFData.AdjBase.getBFShort(); //(int) Math.ceil(dmgShort / 10); - retval[BFConstants.BF_MEDIUM] = BFData.AdjBase.getBFMedium(); //(int) Math.ceil(dmgMedium / 10); - retval[BFConstants.BF_LONG] = BFData.AdjBase.getBFLong(); //(int) Math.ceil(dmgLong / 10); - retval[BFConstants.BF_EXTREME] = 0; // Vehicles dont have extreme range ever + retval[BFConstants.BF_SHORT] = BFData.AdjBase.getBFShort(); // (int) Math.ceil(dmgShort / 10); + retval[BFConstants.BF_MEDIUM] = BFData.AdjBase.getBFMedium(); // (int) Math.ceil(dmgMedium / 10); + retval[BFConstants.BF_LONG] = BFData.AdjBase.getBFLong(); // (int) Math.ceil(dmgLong / 10); + retval[BFConstants.BF_EXTREME] = 0; // Vehicles dont have extreme range ever - if ( HasTurret1 ) { + if (HasTurret1) { ArrayList data = new ArrayList(); - if ( turret1Data.AdjBase.getBFShort() > 0 || - turret1Data.AdjBase.getBFMedium()> 0 || - turret1Data.AdjBase.getBFLong()> 0) data.add(turret1Data.AdjBase.GetAbility()); - if ( turret1Data.AC.CheckSpecial() ) data.add("AC " + turret1Data.AC.GetAbility()); - if ( turret1Data.SRM.CheckSpecial() ) data.add("SRM " + turret1Data.SRM.GetAbility()); - if ( turret1Data.LRM.CheckSpecial() ) data.add("LRM " + turret1Data.LRM.GetAbility()); - if ( turret1Data.TOR.CheckSpecial() ) data.add("TOR " + turret1Data.TOR.GetAbility()); - if ( turret1Data.IF.CheckSpecial() ) data.add("IF " + turret1Data.IF.GetAbility()); - if ( turret1Data.FLK.CheckSpecial() ) data.add("FLK " + turret1Data.FLK.GetAbility()); + if (turret1Data.AdjBase.getBFShort() > 0 || turret1Data.AdjBase.getBFMedium() > 0 + || turret1Data.AdjBase.getBFLong() > 0) + data.add(turret1Data.AdjBase.GetAbility()); + if (turret1Data.AC.CheckSpecial()) + data.add("AC " + turret1Data.AC.GetAbility()); + if (turret1Data.SRM.CheckSpecial()) + data.add("SRM " + turret1Data.SRM.GetAbility()); + if (turret1Data.LRM.CheckSpecial()) + data.add("LRM " + turret1Data.LRM.GetAbility()); + if (turret1Data.TOR.CheckSpecial()) + data.add("TOR " + turret1Data.TOR.GetAbility()); + if (turret1Data.IF.CheckSpecial()) + data.add("IF " + turret1Data.IF.GetAbility()); + if (turret1Data.FLK.CheckSpecial()) + data.add("FLK " + turret1Data.FLK.GetAbility()); bfs.addAbility("TUR(" + data.toString().replace("\\[", "").replace("\\]", "") + ")"); } - + // Add Special Abilities to BattleForceStats if applicable - if ( BFData.AC.CheckSpecial() ) bfs.addAbility("AC " + BFData.AC.GetAbility() ); - if ( BFData.SRM.CheckSpecial() ) bfs.addAbility("SRM " + BFData.SRM.GetAbility() ); - if ( BFData.LRM.CheckSpecial() ) bfs.addAbility("LRM " + BFData.LRM.GetAbility() ); - if ( BFData.TOR.CheckSpecial() ) bfs.addAbility("TOR " + BFData.TOR.GetAbility() ); - if ( BFData.IF.getBFLong() > 0 ) bfs.addAbility("IF " + BFData.IF.getBFLong() ); - if ( BFData.FLK.getBaseMedium() > 5 ) bfs.addAbility("FLK " + BFData.FLK.GetAbility() ); - + if (BFData.AC.CheckSpecial()) + bfs.addAbility("AC " + BFData.AC.GetAbility()); + if (BFData.SRM.CheckSpecial()) + bfs.addAbility("SRM " + BFData.SRM.GetAbility()); + if (BFData.LRM.CheckSpecial()) + bfs.addAbility("LRM " + BFData.LRM.GetAbility()); + if (BFData.TOR.CheckSpecial()) + bfs.addAbility("TOR " + BFData.TOR.GetAbility()); + if (BFData.IF.getBFLong() > 0) + bfs.addAbility("IF " + BFData.IF.getBFLong()); + if (BFData.FLK.getBaseMedium() > 5) + bfs.addAbility("FLK " + BFData.FLK.GetAbility()); + // Determine OverHeat - if ( BFData.BaseMaxMedium() != 0 ) - { - int DmgMedium = BFData.AdjBase.getBFMedium() + BFData.SRM.getBFMedium() + BFData.LRM.getBFMedium() + BFData.AC.getBFMedium(); + if (BFData.BaseMaxMedium() != 0) { + int DmgMedium = BFData.AdjBase.getBFMedium() + BFData.SRM.getBFMedium() + BFData.LRM.getBFMedium() + + BFData.AC.getBFMedium(); retval[BFConstants.BF_OV] = BFData.BaseMaxMedium() - DmgMedium; - BFData.AddNote("Medium: " + BFData.BaseMaxMedium() + " - " + DmgMedium + " = " + (BFData.BaseMaxMedium()-DmgMedium)); - //System.out.println( BFData.BaseMaxMedium() + " - " + DmgMedium + " = " + (BFData.BaseMaxMedium()-DmgMedium)); - } - else - { - int DmgShort = BFData.AdjBase.getBFShort() + BFData.SRM.getBFShort() + BFData.LRM.getBFShort() + BFData.AC.getBFShort(); + BFData.AddNote("Medium: " + BFData.BaseMaxMedium() + " - " + DmgMedium + " = " + + (BFData.BaseMaxMedium() - DmgMedium)); + // System.out.println( BFData.BaseMaxMedium() + " - " + DmgMedium + " = " + + // (BFData.BaseMaxMedium()-DmgMedium)); + } else { + int DmgShort = BFData.AdjBase.getBFShort() + BFData.SRM.getBFShort() + BFData.LRM.getBFShort() + + BFData.AC.getBFShort(); retval[BFConstants.BF_OV] = BFData.BaseMaxShort() - DmgShort; - BFData.AddNote("Short: " + BFData.BaseMaxShort() + " - " + DmgShort + " = " + (BFData.BaseMaxShort()-DmgShort)); + BFData.AddNote( + "Short: " + BFData.BaseMaxShort() + " - " + DmgShort + " = " + (BFData.BaseMaxShort() - DmgShort)); } - - //Determine Long Overheat OVL - if ( BFData.BaseMaxLong() != 0 ) { - + + // Determine Long Overheat OVL + if (BFData.BaseMaxLong() != 0) { + } // Maximum OV value is 4, minimum is 0 @@ -817,74 +811,85 @@ public int[] GetBFDamage(BattleForceStats bfs) { if (retval[BFConstants.BF_OV] < 0) retval[BFConstants.BF_OV] = 0; - //System.out.println(BFData.toString()); + // System.out.println(BFData.toString()); // Return final values return retval; } - public ArrayList GetBFAbilities() { - ArrayList retval = new ArrayList(); + public ArrayList GetBFAbilities() { + ArrayList retval = new ArrayList(); // First search all equipment for BF Abilities - ArrayList nc = GetLoadout().GetNonCore(); - boolean isENE = true, - hasExplodable = false; - int Taser = 0, - RSD = 0; + ArrayList nc = GetLoadout().GetNonCore(); + boolean isENE = true, hasExplodable = false; + int Taser = 0, RSD = 0; double MHQTons = 0; int Heat = 0; - //Underwater Movement - if ( GetJumpJets().IsUMU() ) { - if ( !retval.contains("UMU") ) retval.add("UMU"); + // Underwater Movement + if (GetJumpJets().IsUMU()) { + if (!retval.contains("UMU")) + retval.add("UMU"); } - //Omni - if ( IsOmni() ) - if ( !retval.contains("OMNI") ) retval.add("OMNI"); + // Omni + if (IsOmni()) + if (!retval.contains("OMNI")) + retval.add("OMNI"); - //Stealth (also adds ECM) - if ( (GetArmor().IsStealth()) ) { - if ( !retval.contains("ECM") ) retval.add("ECM"); - if ( !retval.contains("STL") ) retval.add("STL"); + // Stealth (also adds ECM) + if ((GetArmor().IsStealth())) { + if (!retval.contains("ECM")) + retval.add("ECM"); + if (!retval.contains("STL")) + retval.add("STL"); } - for ( int i = 0; i < nc.size(); i++ ) { - abPlaceable item = (abPlaceable)nc.get(i); + for (int i = 0; i < nc.size(); i++) { + abPlaceable item = (abPlaceable) nc.get(i); // Get the list of abilities from the equipment itself // handle special cases like C3 String[] abilities = item.GetBattleForceAbilities(); - for ( String ability : abilities ) { - - if ( ability.equals("C3M") ) MHQTons += 5.0d; - if ( ability.equals("C3I") ) MHQTons += 2.5d; - if ( ability.equals("C3BM") ) MHQTons += 6.0d; - if ( ability.equals("MTAS") ) Taser += 1; - if ( ability.equals("RSD") ) RSD += 1; - if ( ability.equals("HT2") ) Heat += 2; - if ( ability.equals("HT3") ) Heat += 3; - if ( ability.equals("HT7") ) Heat += 7; - - if ( !retval.contains(ability) ) retval.add(ability); + for (String ability : abilities) { + + if (ability.equals("C3M")) + MHQTons += 5.0d; + if (ability.equals("C3I")) + MHQTons += 2.5d; + if (ability.equals("C3BM")) + MHQTons += 6.0d; + if (ability.equals("MTAS")) + Taser += 1; + if (ability.equals("RSD")) + RSD += 1; + if (ability.equals("HT2")) + Heat += 2; + if (ability.equals("HT3")) + Heat += 3; + if (ability.equals("HT7")) + Heat += 7; + + if (!retval.contains(ability)) + retval.add(ability); } // Check equipment for special abilities - if ( item instanceof ifWeapon ) { + if (item instanceof ifWeapon) { // ENE for mechs without ammo dependant weapons - if ( ((ifWeapon)item).GetWeaponClass() != ifWeapon.W_ENERGY && - ((ifWeapon)item).GetWeaponClass() != ifWeapon.W_PHYSICAL) { + if (((ifWeapon) item).GetWeaponClass() != ifWeapon.W_ENERGY + && ((ifWeapon) item).GetWeaponClass() != ifWeapon.W_PHYSICAL) { isENE = false; } // Does the mech carry an explodable weapon? - if ( ((ifWeapon)nc.get(i)).IsExplosive() ) { + if (((ifWeapon) nc.get(i)).IsExplosive()) { hasExplodable = true; } } - if( item instanceof Ammunition ) { - if( ((Ammunition) item).IsExplosive() ) { + if (item instanceof Ammunition) { + if (((Ammunition) item).IsExplosive()) { hasExplodable = true; } } @@ -896,33 +901,34 @@ public ArrayList GetBFAbilities() { retval.remove("HT7"); // Now deal with all the funny stuff - if ( isENE ) { + if (isENE) { retval.add("ENE"); } - if ( !isENE && ( CurLoadout.IsUsingClanCASE() && CurLoadout.CanUseClanCASE() ) ) - if ( !retval.contains( "CASE" ) ) retval.add("CASE"); - if ( Taser > 0 ) { + if (!isENE && (CurLoadout.IsUsingClanCASE() && CurLoadout.CanUseClanCASE())) + if (!retval.contains("CASE")) + retval.add("CASE"); + if (Taser > 0) { retval.remove("MTAS"); retval.add("MTAS" + Taser); } - if ( MHQTons > 0 ) { + if (MHQTons > 0) { retval.add("MHQ" + (int) MHQTons); } - if ( RSD > 0 ) { + if (RSD > 0) { retval.remove("RSD"); retval.add("RSD" + RSD); } - if ( !hasExplodable ) { - //They don't have anything that blows up so remove any traces of CASE or CASEII + if (!hasExplodable) { + // They don't have anything that blows up so remove any traces of CASE or CASEII retval.remove("CASE"); retval.remove("CASEII"); } - if ( Heat > 10 ) + if (Heat > 10) retval.add("HT2"); - else if ( Heat > 5 ) + else if (Heat > 5) retval.add("HT1"); - //Remove a - that is a result of the file needing data + // Remove a - that is a result of the file needing data retval.remove("-"); // Remove extra base LRM, SRM, TRO, and AC if included @@ -933,7 +939,7 @@ else if ( Heat > 5 ) retval.remove("IF"); retval.remove("FLK"); - if ( CurEngine.IsICE() || CurEngine.isFuelCell() ) { + if (CurEngine.IsICE() || CurEngine.isFuelCell()) { retval.add("EE"); } @@ -942,24 +948,23 @@ else if ( Heat > 5 ) public String GetBFConversionStr() { String retval = "Weapon\t\t\tShort\tMedium\tLong\n\r"; - //TODO Add in conversion steps if possible + // TODO Add in conversion steps if possible return retval; } public int GetBFPoints() { - return Math.round( GetCurrentBV() / 100.0f ); + return Math.round(GetCurrentBV() / 100.0f); } @Override - public int GetAmmoCount( int ammoIndex ) - { + public int GetAmmoCount(int ammoIndex) { int retval = 0; - ArrayList v = CurLoadout.GetNonCore(); - if( v.size() > 0 ) { - for( int i = 0; i < v.size(); i++ ) { - if( ( v.get( i ) instanceof Ammunition ) ) { - if ( ((Ammunition)v.get(i)).GetAmmoIndex() == ammoIndex ) - retval += ((Ammunition)v.get(i)).GetLotSize(); + ArrayList v = CurLoadout.GetNonCore(); + if (v.size() > 0) { + for (int i = 0; i < v.size(); i++) { + if ((v.get(i) instanceof Ammunition)) { + if (((Ammunition) v.get(i)).GetAmmoIndex() == ammoIndex) + retval += ((Ammunition) v.get(i)).GetLotSize(); } } return retval; @@ -967,28 +972,25 @@ public int GetAmmoCount( int ammoIndex ) return retval; } - + /* * Gets a count of weapons on a unit that all use the same ammo type */ @Override - public int GetWeaponCount( int ammoIndex ) - { + public int GetWeaponCount(int ammoIndex) { int retval = 0; - ArrayList v = CurLoadout.GetNonCore(); - if ( v.size() > 0 ) { - for(Object w : v) - { - if (w instanceof RangedWeapon) - { - if (((RangedWeapon)w).GetAmmoIndex() == ammoIndex ) + ArrayList v = CurLoadout.GetNonCore(); + if (v.size() > 0) { + for (Object w : v) { + if (w instanceof RangedWeapon) { + if (((RangedWeapon) w).GetAmmoIndex() == ammoIndex) retval++; } } } return retval; } - + public int GetUnitType() { return AvailableCode.UNIT_COMBATVEHICLE; } @@ -1000,8 +1002,8 @@ public int GetRulesLevel() { public int GetTechbase() { return getCurLoadout().GetTechBase(); } - - public int GetBaseTechbase() { + + public int GetBaseTechbase() { return getMainLoadout().GetTechBase(); } @@ -1009,22 +1011,22 @@ public int GetEra() { return getCurLoadout().GetEra(); } - public void SetEra( int e ) { - if( Omni ) { - CurLoadout.SetEra( e ); + public void SetEra(int e) { + if (Omni) { + CurLoadout.SetEra(e); } else { - MainLoadout.SetEra( e ); + MainLoadout.SetEra(e); } } - public void SetYear( int y, boolean specified ) { - if( Omni ) { - CurLoadout.SetYear( y, specified ); + public void SetYear(int y, boolean specified) { + if (Omni) { + CurLoadout.SetYear(y, specified); } else { - MainLoadout.SetYear( y, specified ); + MainLoadout.SetYear(y, specified); } } - + public boolean IsYearRestricted() { return getCurLoadout().IsYearRestricted(); } @@ -1036,11 +1038,11 @@ public boolean YearWasSpecified() { public boolean HasFHES() { return false; } - + public String GetName() { return Name; } - + public void setName(String Name) { this.Name = Name; } @@ -1205,11 +1207,11 @@ public final void setTonnage(int Tonnage) { this.Tonnage = Tonnage; LiftEquipment = 0; Controls = 0; - - if ( CurConfig.RequiresLiftEquipment() ) - this.LiftEquipment = CommonTools.RoundHalfUp((double)Tonnage / 10.0); - if( CurEngine.RequiresControls() ) - this.Controls = CommonTools.RoundHalfUp((double)Tonnage * 0.05); + + if (CurConfig.RequiresLiftEquipment()) + this.LiftEquipment = CommonTools.RoundHalfUp((double) Tonnage / 10.0); + if (CurEngine.RequiresControls()) + this.Controls = CommonTools.RoundHalfUp((double) Tonnage * 0.05); SetEngine(CurEngine); } @@ -1225,21 +1227,23 @@ public int getInternalStructurePoints() { return CurStructure.NumCVSpaces(); } - public int getMaxItems() - { - return 5 + ( Math.round(Tonnage / 5) ); + public int getMaxItems() { + return 5 + (Math.round(Tonnage / 5)); } - + public int getLocationCount(boolean includeRotor) { int retval = 4; - if ( isHasTurret1() ) retval += 1; - if ( isHasTurret2() ) retval += 1; - if ( includeRotor && IsVTOL() ) retval += 1; - return retval; + if (isHasTurret1()) + retval += 1; + if (isHasTurret2()) + retval += 1; + if (includeRotor && IsVTOL()) + retval += 1; + return retval; } - + public int getLocationCount() { - return getLocationCount(false); + return getLocationCount(false); } public int getCruiseMP() { @@ -1247,27 +1251,33 @@ public int getCruiseMP() { } public int getMaxCruiseMP() { - if( CurEngine.IsPrimitive() ) { - return (int) Math.floor( ( ( 400.0 + (double)CurConfig.GetSuspensionFactor(Tonnage) ) / (double)Tonnage ) / 1.2 ); - } //else if( CurEngine.CanSupportRating( 500, this ) ) { - //return (int) Math.floor( 500 / Tonnage ); - //} + if (CurEngine.IsPrimitive()) { + return (int) Math + .floor(((400.0 + (double) CurConfig.GetSuspensionFactor(Tonnage)) / (double) Tonnage) / 1.2); + } // else if( CurEngine.CanSupportRating( 500, this ) ) { + // return (int) Math.floor( 500 / Tonnage ); + // } else { - return (int) Math.floor( ( 400.0 + (double)CurConfig.GetSuspensionFactor(Tonnage) ) / (double)Tonnage ); + return (int) Math.floor((400.0 + (double) CurConfig.GetSuspensionFactor(Tonnage)) / (double) Tonnage); } } - + public int getMinCruiseMP() { - if ( CurEngine.RequiresControls() && !IsTrailer ) return 1; + if (CurEngine.RequiresControls() && !IsTrailer) + return 1; return 0; } public void setCruiseMP(int mp) throws Exception { int MaxWalk = getMaxCruiseMP(); - if( mp > MaxWalk ) { mp = MaxWalk; } - if( mp < 0 ) { mp = 0; } + if (mp > MaxWalk) { + mp = MaxWalk; + } + if (mp < 0) { + mp = 0; + } CruiseMP = mp; - CurEngine.SetRating( GetFinalEngineRating() ); + CurEngine.SetRating(GetFinalEngineRating()); } public double getJJMult() { @@ -1282,20 +1292,20 @@ public boolean isOmni() { return Omni; } - public void SetOmni( String name ) { + public void SetOmni(String name) { // this performs everything needed to turn the mech into an omni Omni = true; - // remove any targeting computers from the base chassis. they vary too + // remove any targeting computers from the base chassis. they vary too // much to be fixed equipment - UseTC( false, false ); + UseTC(false, false); // set the minimums on heat sinks and jump jets - if( GetJumpJets().GetNumJJ() > 0 ) { - GetJumpJets().SetBaseLoadoutNumJJ( GetJumpJets().GetNumJJ() ); + if (GetJumpJets().GetNumJJ() > 0) { + GetJumpJets().SetBaseLoadoutNumJJ(GetJumpJets().GetNumJJ()); } - if( GetHeatSinks().GetNumHS() > CurEngine.FreeHeatSinks() ) { - GetHeatSinks().SetBaseLoadoutNumHS( GetHeatSinks().GetNumHS() ); + if (GetHeatSinks().GetNumHS() > CurEngine.FreeHeatSinks()) { + GetHeatSinks().SetBaseLoadoutNumHS(GetHeatSinks().GetNumHS()); } // lock the main chassis @@ -1303,8 +1313,8 @@ public void SetOmni( String name ) { // now get a new loadout and set it to the current. ifCVLoadout l = MainLoadout.Clone(); - l.SetName( name ); - Loadouts.add( l ); + l.SetName(name); + Loadouts.add(l); CurLoadout = l; } @@ -1316,41 +1326,43 @@ public void UnlockChassis() { CurLoadout = MainLoadout; } - public void AddLoadout( String Name ) throws Exception { + public void AddLoadout(String Name) throws Exception { // Adds a new loadout with the given name to the ArrayList, cloned from the // base loadout // does the name match the Base Loadout's name? - if( MainLoadout.GetName().equals( Name ) ) { - throw new Exception( "\"" + Name + "\" is reserved for the base loadout and cannot be used\nfor a new loadout. Please choose another name." ); + if (MainLoadout.GetName().equals(Name)) { + throw new Exception("\"" + Name + + "\" is reserved for the base loadout and cannot be used\nfor a new loadout. Please choose another name."); } // see if another loadout has the same name - for( int i = 0; i < Loadouts.size(); i++ ) { - if( ((ifCVLoadout) Loadouts.get( i )).GetName().equals( Name ) ) { - throw new Exception( "Could not add the new loadout because\nthe name given matches an existing loadout." ); + for (int i = 0; i < Loadouts.size(); i++) { + if (((ifCVLoadout) Loadouts.get(i)).GetName().equals(Name)) { + throw new Exception( + "Could not add the new loadout because\nthe name given matches an existing loadout."); } } ifCVLoadout l = MainLoadout.Clone(); - l.SetName( Name ); - Loadouts.add( l ); + l.SetName(Name); + Loadouts.add(l); CurLoadout = l; } - public void RemoveLoadout( String Name ) { - // removes the given loadout from the loadout ArrayList. if the ArrayList is + public void RemoveLoadout(String Name) { + // removes the given loadout from the loadout ArrayList. if the ArrayList is // empty (non-omnimech) nothing is done. - for( int i = 0; i < Loadouts.size(); i++ ) { - if( ((ifCVLoadout) Loadouts.get( i )).GetName().equals( Name ) ) { + for (int i = 0; i < Loadouts.size(); i++) { + if (((ifCVLoadout) Loadouts.get(i)).GetName().equals(Name)) { // remove it - Loadouts.remove( i ); + Loadouts.remove(i); break; } } // now set the current loadout to the first - if( Loadouts.size() > 0 ) { + if (Loadouts.size() > 0) { CurLoadout = (ifCVLoadout) Loadouts.get(0); } else { CurLoadout = MainLoadout; @@ -1379,7 +1391,7 @@ public boolean isHasTurret1() { public void setHasTurret1(boolean HasTurret1) { this.HasTurret1 = HasTurret1; - //Move any weapons/equipment that was in the turret to another location + // Move any weapons/equipment that was in the turret to another location if (!HasTurret1) { GetLoadout().SetTurret1(new ArrayList()); GetLoadout().RefreshHeatSinks(); @@ -1393,7 +1405,7 @@ public boolean isHasTurret2() { public void setHasTurret2(boolean HasTurret2) { this.HasTurret2 = HasTurret2; - //Move any weapons/equipment that was in the turret to another location + // Move any weapons/equipment that was in the turret to another location if (!HasTurret2) { GetLoadout().SetTurret2(new ArrayList()); GetLoadout().RefreshHeatSinks(); @@ -1407,7 +1419,7 @@ public boolean isHasSponsonTurret() { public void setHasSponsonTurret(boolean HasSponsonTurret) { this.HasSponsonTurret = HasSponsonTurret; - //Move any weapons/equipment that was in the turret to another location + // Move any weapons/equipment that was in the turret to another location if (!HasSponsonTurret) { GetLoadout().SetSponsonTurretLeftItems(new ArrayList()); GetLoadout().SetSponsonTurretRightItems(new ArrayList()); @@ -1458,42 +1470,43 @@ public ifCVLoadout GetBaseLoadout() { return MainLoadout; } - public void SetCurLoadout( String Name ) { + public void SetCurLoadout(String Name) { // sets the current loadout to the named loadout. - if( Name.equals( Constants.BASELOADOUT_NAME ) ) { + if (Name.equals(Constants.BASELOADOUT_NAME)) { CurLoadout = MainLoadout; return; } - for( int i = 0; i < Loadouts.size(); i++ ) { - if( ((ifCVLoadout) Loadouts.get( i )).GetName().equals( Name ) ) { - CurLoadout = (ifCVLoadout) Loadouts.get( i ); + for (int i = 0; i < Loadouts.size(); i++) { + if (((ifCVLoadout) Loadouts.get(i)).GetName().equals(Name)) { + CurLoadout = (ifCVLoadout) Loadouts.get(i); return; } } - // if we got here, there was a problem. set the loadout to the base - if( Loadouts.size() > 0 ) { + // if we got here, there was a problem. set the loadout to the base + if (Loadouts.size() > 0) { CurLoadout = (ifCVLoadout) Loadouts.get(0); } else { CurLoadout = MainLoadout; } } + // handlers for Artemis IV operations. - public void SetFCSArtemisIV( boolean b ) throws Exception { - CurLoadout.SetFCSArtemisIV( b ); + public void SetFCSArtemisIV(boolean b) throws Exception { + CurLoadout.SetFCSArtemisIV(b); } - public void SetFCSArtemisV( boolean b ) throws Exception { - CurLoadout.SetFCSArtemisV( b ); + public void SetFCSArtemisV(boolean b) throws Exception { + CurLoadout.SetFCSArtemisV(b); } - public void SetFCSApollo( boolean b ) throws Exception { - CurLoadout.SetFCSApollo( b ); + public void SetFCSApollo(boolean b) throws Exception { + CurLoadout.SetFCSApollo(b); } - public void UseTC( boolean use, boolean clan ) { - CurLoadout.UseTC( use, clan ); + public void UseTC(boolean use, boolean clan) { + CurLoadout.UseTC(use, clan); } public boolean UsingArtemisIV() { @@ -1516,16 +1529,16 @@ public void setCurArmor(CVArmor CurArmor) { this.CurArmor = CurArmor; } - public ifVisitor Lookup( String s ) { + public ifVisitor Lookup(String s) { // returns a visitor from the lookup table based on the lookup string - return (ifVisitor) Lookup.get( s ); + return (ifVisitor) Lookup.get(s); } - public Hashtable getLookup() { + public Hashtable getLookup() { return Lookup; } - public void setLookup(Hashtable Lookup) { + public void setLookup(Hashtable Lookup) { this.Lookup = Lookup; } @@ -1533,19 +1546,19 @@ public int getYear() { return Year; } - public void setYear(int y, boolean specified) { - if( Omni ) { - CurLoadout.SetYear( y, specified ); + public void setYear(int y, boolean specified) { + if (Omni) { + CurLoadout.SetYear(y, specified); } else { - MainLoadout.SetYear( y, specified ); + MainLoadout.SetYear(y, specified); } } - public void SetYearRestricted( boolean y ) { - if( Omni ) { - CurLoadout.SetYearRestricted( y ); + public void SetYearRestricted(boolean y) { + if (Omni) { + CurLoadout.SetYearRestricted(y); } else { - MainLoadout.SetYearRestricted( y ); + MainLoadout.SetYearRestricted(y); } } @@ -1558,18 +1571,18 @@ public void setSource(String Source) { } public int getFlankMP() { - return CruiseMP == 0 ? 0 : (int) Math.floor( CruiseMP * 1.5 + 0.5 ); + return CruiseMP == 0 ? 0 : (int) Math.floor(CruiseMP * 1.5 + 0.5); } - public int getFlankMP( int MiniMult ) { - return (int) Math.floor( ( getCruiseMP() * MiniMult ) * 1.5 + 0.5 ); + public int getFlankMP(int MiniMult) { + return (int) Math.floor((getCruiseMP() * MiniMult) * 1.5 + 0.5); } - - public void SetRulesLevel( int r ) { - if( Omni ) { - CurLoadout.SetRulesLevel( r ); + + public void SetRulesLevel(int r) { + if (Omni) { + CurLoadout.SetRulesLevel(r); } else { - MainLoadout.SetRulesLevel( r ); + MainLoadout.SetRulesLevel(r); } } @@ -1589,15 +1602,15 @@ public int GetTechBase() { return MainLoadout.GetTechBase(); } - public boolean SetTechBase( int t ) { - if( Omni ) { - if( t != MainLoadout.GetTechBase() && t != AvailableCode.TECH_BOTH ) { + public boolean SetTechBase(int t) { + if (Omni) { + if (t != MainLoadout.GetTechBase() && t != AvailableCode.TECH_BOTH) { return false; } else { - CurLoadout.SetTechBase( t ); + CurLoadout.SetTechBase(t); } } else { - MainLoadout.SetTechBase( t ); + MainLoadout.SetTechBase(t); } return true; } @@ -1621,7 +1634,7 @@ public double GetJJMult() { public void SetInnerSphere() { // performs all the neccesary actions to switch this to Inner Sphere // set the tech base - SetTechBase( AvailableCode.TECH_INNER_SPHERE ); + SetTechBase(AvailableCode.TECH_INNER_SPHERE); // clear the loadout CurLoadout.ClearLoadout(); @@ -1639,16 +1652,16 @@ public void SetInnerSphere() { CurArmor.SetStandard(); // replace everything in the loadout - //CurEngine.Place( CurLoadout ); + // CurEngine.Place( CurLoadout ); GetHeatSinks().ReCalculate(); - //GetJumpJets().ReCalculate(); + // GetJumpJets().ReCalculate(); CurArmor.Recalculate(); } public void SetClan() { // performs all the neccesary actions to switch this to Clan // set the tech base - SetTechBase( AvailableCode.TECH_CLAN ); + SetTechBase(AvailableCode.TECH_CLAN); // clear the loadout CurLoadout.ClearLoadout(); @@ -1666,42 +1679,44 @@ public void SetClan() { CurArmor.SetStandard(); // replace everything iun the loadout - //CurEngine.Place( CurLoadout ); + // CurEngine.Place( CurLoadout ); GetHeatSinks().ReCalculate(); - //GetJumpJets().ReCalculate(); + // GetJumpJets().ReCalculate(); CurArmor.Recalculate(); } + public void SetMixed() { - SetTechBase( AvailableCode.TECH_BOTH ); + SetTechBase(AvailableCode.TECH_BOTH); // although nothing should technically be illegal, we'll do it anyway. CurLoadout.FlushIllegal(); // check each component in turn before reseting to a default - if( ! CommonTools.IsAllowed( CurEngine.GetAvailability(), this ) ) { + if (!CommonTools.IsAllowed(CurEngine.GetAvailability(), this)) { CurEngine.SetICEngine(); - //CurEngine.Place( CurLoadout ); + // CurEngine.Place( CurLoadout ); } - if( ! CommonTools.IsAllowed( GetHeatSinks().GetAvailability(), this ) ) { + if (!CommonTools.IsAllowed(GetHeatSinks().GetAvailability(), this)) { GetHeatSinks().SetSingle(); GetHeatSinks().ReCalculate(); } - if( ! CommonTools.IsAllowed( GetJumpJets().GetAvailability(), this ) ) { - //GetJumpJets().SetNormal(); - //GetJumpJets().ReCalculate(); + if (!CommonTools.IsAllowed(GetJumpJets().GetAvailability(), this)) { + // GetJumpJets().SetNormal(); + // GetJumpJets().ReCalculate(); } - if( ! CommonTools.IsAllowed( CurArmor.GetAvailability(), this ) ) { + if (!CommonTools.IsAllowed(CurArmor.GetAvailability(), this)) { CurArmor.SetStandard(); CurArmor.Recalculate(); } } public String GetFullName() { - return String.format("%1$s %2$s %3$s", GetName(), GetModel(), GetLoadout().GetName()).replace(" " + Constants.BASELOADOUT_NAME, "").trim(); + return String.format("%1$s %2$s %3$s", GetName(), GetModel(), GetLoadout().GetName()) + .replace(" " + Constants.BASELOADOUT_NAME, "").trim(); } public String GetChatInfo() { @@ -1709,19 +1724,20 @@ public String GetChatInfo() { info += GetTonnage() + "t, "; // MP info += getCruiseMP(); - //if( getCruiseMP() != GetAdjustedWalkingMP( false, true ) ) { - // info += "[" + GetAdjustedWalkingMP( false, true ) + "]"; - //} + // if( getCruiseMP() != GetAdjustedWalkingMP( false, true ) ) { + // info += "[" + GetAdjustedWalkingMP( false, true ) + "]"; + // } info += "/"; info += getFlankMP(); - //if( getFlankMP() != GetAdjustedRunningMP( false, true ) ) { - // info += "[" + GetAdjustedRunningMP( false, true ) + "]"; - //} - if ( CurLoadout.GetJumpJets().GetNumJJ() > 0 ) { + // if( getFlankMP() != GetAdjustedRunningMP( false, true ) ) { + // info += "[" + GetAdjustedRunningMP( false, true ) + "]"; + // } + if (CurLoadout.GetJumpJets().GetNumJJ() > 0) { info += "/" + CurLoadout.GetJumpJets().GetNumJJ(); - //if( CurLoadout.GetJumpJets().GetNumJJ() != this.GetAdjustedJumpingMP( false ) ) { - // info += "[" + GetAdjustedJumpingMP( false ) + "]"; - //} + // if( CurLoadout.GetJumpJets().GetNumJJ() != this.GetAdjustedJumpingMP( false ) + // ) { + // info += "[" + GetAdjustedJumpingMP( false ) + "]"; + // } } info += ", "; @@ -1729,48 +1745,48 @@ public String GetChatInfo() { info += GetEngine().ChatName() + ", "; // Armor - info += GetArmor().GetTonnage() + "T/" + Math.round(GetArmor().GetCoverage()) + "% " + GetArmor().ChatName() + "; "; + info += GetArmor().GetTonnage() + "T/" + Math.round(GetArmor().GetCoverage()) + "% " + GetArmor().ChatName() + + "; "; // heat sinks info += GetHeatSinks().GetNumHS() + " " + GetHeatSinks().ChatName() + "; "; - //Weapons and Equip + // Weapons and Equip Hashtable list = new Hashtable(); abPlaceable item; - for( int i = 0; i < CurLoadout.GetNonCore().size(); i++ ) { - item = (abPlaceable) CurLoadout.GetNonCore().get( i ); - if( ! ( item instanceof Ammunition ) ) { - if ( list.containsKey( item.ChatName() ) ) { - int curVal = (Integer) list.get( item.ChatName() ).intValue(); + for (int i = 0; i < CurLoadout.GetNonCore().size(); i++) { + item = (abPlaceable) CurLoadout.GetNonCore().get(i); + if (!(item instanceof Ammunition)) { + if (list.containsKey(item.ChatName())) { + int curVal = (Integer) list.get(item.ChatName()).intValue(); curVal++; - list.remove( item.ChatName() ); - list.put( item.ChatName(), curVal ); + list.remove(item.ChatName()); + list.put(item.ChatName(), curVal); } else { - list.put( item.ChatName(), new Integer( 1 ) ); + list.put(item.ChatName(), Integer.valueOf(1)); } } } - Enumeration e = list.keys(); - while( e.hasMoreElements() ) { + Enumeration e = list.keys(); + while (e.hasMoreElements()) { String name = (String) e.nextElement(); int count = (Integer) list.get(name).intValue(); info += count + " " + name + ", "; } - if( UsingTC() ) { + if (UsingTC()) { info += GetTC().ChatName() + ", "; } - return info.trim().substring( 0, info.length() - 2 ); + return info.trim().substring(0, info.length() - 2); } public boolean UsingTC() { return CurLoadout.UsingTC(); } - public TargetingComputer GetTC() - { + public TargetingComputer GetTC() { return CurLoadout.GetTC(); } @@ -1800,71 +1816,75 @@ public AvailableCode GetOmniAvailability() { private void BuildLookupTable() { // sets up the lookup hashtable with String keys and ifVisitor values - Lookup.put( "Standard Armor", new VArmorSetStandard() ); - Lookup.put( "Ferro-Fibrous", new VArmorSetFF() ); - Lookup.put( "(IS) Ferro-Fibrous", new VArmorSetFF() ); - Lookup.put( "(CL) Ferro-Fibrous", new VArmorSetFF() ); - Lookup.put( "Vehicle Stealth Armor", new VArmorSetVStealth() ); - Lookup.put( "Light Ferro-Fibrous", new VArmorSetLightFF() ); - Lookup.put( "Heavy Ferro-Fibrous", new VArmorSetHeavyFF() ); - Lookup.put( "Ferro-Lamellor", new VArmorSetFL() ); - Lookup.put( "Hardened Armor", new VArmorSetHA() ); - Lookup.put( "Laser-Reflective", new VArmorSetLR() ); - Lookup.put( "(IS) Laser-Reflective", new VArmorSetLR() ); - Lookup.put( "(CL) Laser-Reflective", new VArmorSetLR() ); - Lookup.put( "Reactive Armor", new VArmorSetRE() ); - Lookup.put( "(IS) Reactive Armor", new VArmorSetRE() ); - Lookup.put( "(CL) Reactive Armor", new VArmorSetRE() ); - Lookup.put( "Industrial Armor", new VArmorSetIndustrial() ); - Lookup.put( "Commercial Armor", new VArmorSetCommercial() ); - Lookup.put( "Ablation Armor", new VArmorSetAB()); - Lookup.put( "Ballistic-Reinforced Armor", new VArmorSetBR()); - Lookup.put( "Patchwork Armor", new VArmorSetPatchwork() ); - Lookup.put( "Standard Structure", new VChassisSetStandard() ); - Lookup.put( "Fuel-Cell Engine", new VEngineSetFuelCell() ); - Lookup.put( "Fission Engine", new VEngineSetFission() ); - Lookup.put( "Fusion Engine", new VEngineSetFusion() ); - //Lookup.put( "Primitive Fuel-Cell Engine", new VEngineSetPrimitiveFuelCell() ); - //Lookup.put( "Primitive Fission Engine", new VEngineSetPrimitiveFission() ); - //Lookup.put( "Primitive Fusion Engine", new VEngineSetPrimitiveFusion() ); - Lookup.put( "XL Engine", new VEngineSetFusionXL() ); - Lookup.put( "(IS) XL Engine", new VEngineSetFusionXL() ); - Lookup.put( "(CL) XL Engine", new VEngineSetFusionXL() ); - Lookup.put( "XXL Engine", new VEngineSetFusionXXL() ); - Lookup.put( "(IS) XXL Engine", new VEngineSetFusionXXL() ); - Lookup.put( "(CL) XXL Engine", new VEngineSetFusionXXL() ); - Lookup.put( "I.C.E. Engine", new VEngineSetICE() ); - //Lookup.put( "Primitive I.C.E. Engine", new VEngineSetPrimitiveICE() ); - Lookup.put( "Compact Fusion Engine", new VEngineSetCompactFusion() ); - Lookup.put( "Light Fusion Engine", new VEngineSetLightFusion() ); - Lookup.put( "No Engine", new VEngineSetNone() ); - Lookup.put( "No Enhancement", new VEnhanceSetNone() ); - Lookup.put( "Single Heat Sink", new VHeatSinkSetSingle() ); - //Lookup.put( "Double Heat Sink", new VHeatSinkSetDouble() ); - //Lookup.put( "(IS) Double Heat Sink", new VHeatSinkSetDouble() ); - //Lookup.put( "(CL) Double Heat Sink", new VHeatSinkSetDouble() ); - //Lookup.put( "Compact Heat Sink", new VHeatSinkSetCompact() ); - //Lookup.put( "Laser Heat Sink", new VHeatSinkSetLaser() ); - Lookup.put( "Standard Jump Jet", new VJumpJetSetStandard() ); - //Lookup.put( "Improved Jump Jet", new VJumpJetSetImproved() ); - //Lookup.put( "Primitive Armor", new VArmorSetPrimitive() ); - //Lookup.put( "Primitive Structure", new VChassisSetPrimitive() ); - //Lookup.put( "Primitive Industrial Structure", new VChassisSetPrimitiveIndustrial() ); - //Lookup.put( "Primitive Cockpit", new VCockpitSetPrimitive() ); - //Lookup.put( "Primitive Industrial Cockpit", new VCockpitSetPrimIndustrial() ); - //Lookup.put( "Primitive Industrial w/ Adv. FC", new VCockpitSetPrimIndustrialAFC() ); + Lookup.put("Standard Armor", new VArmorSetStandard()); + Lookup.put("Ferro-Fibrous", new VArmorSetFF()); + Lookup.put("(IS) Ferro-Fibrous", new VArmorSetFF()); + Lookup.put("(CL) Ferro-Fibrous", new VArmorSetFF()); + Lookup.put("Vehicle Stealth Armor", new VArmorSetVStealth()); + Lookup.put("Light Ferro-Fibrous", new VArmorSetLightFF()); + Lookup.put("Heavy Ferro-Fibrous", new VArmorSetHeavyFF()); + Lookup.put("Ferro-Lamellor", new VArmorSetFL()); + Lookup.put("Hardened Armor", new VArmorSetHA()); + Lookup.put("Laser-Reflective", new VArmorSetLR()); + Lookup.put("(IS) Laser-Reflective", new VArmorSetLR()); + Lookup.put("(CL) Laser-Reflective", new VArmorSetLR()); + Lookup.put("Reactive Armor", new VArmorSetRE()); + Lookup.put("(IS) Reactive Armor", new VArmorSetRE()); + Lookup.put("(CL) Reactive Armor", new VArmorSetRE()); + Lookup.put("Industrial Armor", new VArmorSetIndustrial()); + Lookup.put("Commercial Armor", new VArmorSetCommercial()); + Lookup.put("Ablation Armor", new VArmorSetAB()); + Lookup.put("Ballistic-Reinforced Armor", new VArmorSetBR()); + Lookup.put("Patchwork Armor", new VArmorSetPatchwork()); + Lookup.put("Standard Structure", new VChassisSetStandard()); + Lookup.put("Fuel-Cell Engine", new VEngineSetFuelCell()); + Lookup.put("Fission Engine", new VEngineSetFission()); + Lookup.put("Fusion Engine", new VEngineSetFusion()); + // Lookup.put( "Primitive Fuel-Cell Engine", new VEngineSetPrimitiveFuelCell() + // ); + // Lookup.put( "Primitive Fission Engine", new VEngineSetPrimitiveFission() ); + // Lookup.put( "Primitive Fusion Engine", new VEngineSetPrimitiveFusion() ); + Lookup.put("XL Engine", new VEngineSetFusionXL()); + Lookup.put("(IS) XL Engine", new VEngineSetFusionXL()); + Lookup.put("(CL) XL Engine", new VEngineSetFusionXL()); + Lookup.put("XXL Engine", new VEngineSetFusionXXL()); + Lookup.put("(IS) XXL Engine", new VEngineSetFusionXXL()); + Lookup.put("(CL) XXL Engine", new VEngineSetFusionXXL()); + Lookup.put("I.C.E. Engine", new VEngineSetICE()); + // Lookup.put( "Primitive I.C.E. Engine", new VEngineSetPrimitiveICE() ); + Lookup.put("Compact Fusion Engine", new VEngineSetCompactFusion()); + Lookup.put("Light Fusion Engine", new VEngineSetLightFusion()); + Lookup.put("No Engine", new VEngineSetNone()); + Lookup.put("No Enhancement", new VEnhanceSetNone()); + Lookup.put("Single Heat Sink", new VHeatSinkSetSingle()); + // Lookup.put( "Double Heat Sink", new VHeatSinkSetDouble() ); + // Lookup.put( "(IS) Double Heat Sink", new VHeatSinkSetDouble() ); + // Lookup.put( "(CL) Double Heat Sink", new VHeatSinkSetDouble() ); + // Lookup.put( "Compact Heat Sink", new VHeatSinkSetCompact() ); + // Lookup.put( "Laser Heat Sink", new VHeatSinkSetLaser() ); + Lookup.put("Standard Jump Jet", new VJumpJetSetStandard()); + // Lookup.put( "Improved Jump Jet", new VJumpJetSetImproved() ); + // Lookup.put( "Primitive Armor", new VArmorSetPrimitive() ); + // Lookup.put( "Primitive Structure", new VChassisSetPrimitive() ); + // Lookup.put( "Primitive Industrial Structure", new + // VChassisSetPrimitiveIndustrial() ); + // Lookup.put( "Primitive Cockpit", new VCockpitSetPrimitive() ); + // Lookup.put( "Primitive Industrial Cockpit", new VCockpitSetPrimIndustrial() + // ); + // Lookup.put( "Primitive Industrial w/ Adv. FC", new + // VCockpitSetPrimIndustrialAFC() ); // now to fix all the visitors with counterparts to use Clan tech if needed - ((ifVisitor) Lookup.get( "(CL) Ferro-Fibrous" )).SetClan( true ); - ((ifVisitor) Lookup.get( "(CL) Laser-Reflective" )).SetClan( true ); - ((ifVisitor) Lookup.get( "(CL) Reactive Armor" )).SetClan( true ); - ((ifVisitor) Lookup.get( "(CL) XL Engine" )).SetClan( true ); - ((ifVisitor) Lookup.get( "(CL) XXL Engine" )).SetClan( true ); - //((ifVisitor) Lookup.get( "(CL) Double Heat Sink" )).SetClan( true ); + ((ifVisitor) Lookup.get("(CL) Ferro-Fibrous")).SetClan(true); + ((ifVisitor) Lookup.get("(CL) Laser-Reflective")).SetClan(true); + ((ifVisitor) Lookup.get("(CL) Reactive Armor")).SetClan(true); + ((ifVisitor) Lookup.get("(CL) XL Engine")).SetClan(true); + ((ifVisitor) Lookup.get("(CL) XXL Engine")).SetClan(true); + // ((ifVisitor) Lookup.get( "(CL) Double Heat Sink" )).SetClan( true ); } public boolean ValidateECM() { - if( CurArmor.IsStealth() ) { + if (CurArmor.IsStealth()) { return HasECM(); } return true; @@ -1872,11 +1892,11 @@ public boolean ValidateECM() { public boolean HasECM() { // ensures that, if the 'Mech needs ECM, it has it. - SimplePlaceable p = new SimplePlaceable( "ECMTest", "ECMTest", "ECMTest", "ECMTest", "none", 0, false, null ); + SimplePlaceable p = new SimplePlaceable("ECMTest", "ECMTest", "ECMTest", "ECMTest", "none", 0, false, null); p.SetExclusions(new String[] { "ECM", "Watchdog" }); try { - CurLoadout.CheckExclusions( p ); - } catch( Exception e ) { + CurLoadout.CheckExclusions(p); + } catch (Exception e) { return true; } return false; @@ -1884,11 +1904,11 @@ public boolean HasECM() { public boolean HasC3() { // checks for C3 systems. - SimplePlaceable p = new SimplePlaceable( "C3Test", "C3Test", "C3Test", "C3Test", "none", 0, false, null ); + SimplePlaceable p = new SimplePlaceable("C3Test", "C3Test", "C3Test", "C3Test", "none", 0, false, null); p.SetExclusions(new String[] { "C3" }); try { - CurLoadout.CheckExclusions( p ); - } catch( Exception e ) { + CurLoadout.CheckExclusions(p); + } catch (Exception e) { return true; } return false; @@ -1896,52 +1916,57 @@ public boolean HasC3() { public boolean HasProbe() { // ensures that, if the 'Mech needs Probe, it has it. - SimplePlaceable p = new SimplePlaceable( "ProbeTest", "ProbeTest", "ProbeTest", "ProbeTest", "none", 0, false, null ); + SimplePlaceable p = new SimplePlaceable("ProbeTest", "ProbeTest", "ProbeTest", "ProbeTest", "none", 0, false, + null); p.SetExclusions(new String[] { "Probe" }); try { - CurLoadout.CheckExclusions( p ); - } catch( Exception e ) { + CurLoadout.CheckExclusions(p); + } catch (Exception e) { return true; } return false; } - - public void AddMechModifier( MechModifier m ) { - if( m == null ) { return; } - if( ! MechMods.contains( m ) &! CurLoadout.GetMechMods().contains( m ) ) { - MechMods.add( m ); + + public void AddMechModifier(MechModifier m) { + if (m == null) { + return; + } + if (!MechMods.contains(m) & !CurLoadout.GetMechMods().contains(m)) { + MechMods.add(m); } } - public void RemoveMechMod( MechModifier m ) { - if( m == null ) { return; } - MechMods.remove( m ); + public void RemoveMechMod(MechModifier m) { + if (m == null) { + return; + } + MechMods.remove(m); } - public MechModifier GetTotalModifiers( boolean BV, boolean MASCTSM ) { - MechModifier retval = new MechModifier( 0, 0, 0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, true, true ); - if( MechMods.size() > 0 ) { - for( int i = 0; i < MechMods.size(); i++ ) { - if( BV ) { - retval.BVCombine( ((MechModifier) MechMods.get( i )) ); + public MechModifier GetTotalModifiers(boolean BV, boolean MASCTSM) { + MechModifier retval = new MechModifier(0, 0, 0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, true, true); + if (MechMods.size() > 0) { + for (int i = 0; i < MechMods.size(); i++) { + if (BV) { + retval.BVCombine(((MechModifier) MechMods.get(i))); } else { - retval.Combine( ((MechModifier) MechMods.get( i )) ); + retval.Combine(((MechModifier) MechMods.get(i))); } } } - if( CurLoadout.GetMechMods().size() > 0 ) { - for( int i = 0; i < CurLoadout.GetMechMods().size(); i++ ) { - if( BV ) { - retval.BVCombine( ((MechModifier) CurLoadout.GetMechMods().get( i )) ); + if (CurLoadout.GetMechMods().size() > 0) { + for (int i = 0; i < CurLoadout.GetMechMods().size(); i++) { + if (BV) { + retval.BVCombine(((MechModifier) CurLoadout.GetMechMods().get(i))); } else { - retval.Combine( ((MechModifier) CurLoadout.GetMechMods().get( i )) ); + retval.Combine(((MechModifier) CurLoadout.GetMechMods().get(i))); } } } return retval; } - public ArrayList GetMechMods() { + public ArrayList GetMechMods() { return MechMods; } @@ -1949,17 +1974,23 @@ public double GetDefensiveBV() { // modify the result by the defensive factor and send it out return GetUnmodifiedDefensiveBV() * GetDefensiveModifier() * GetDefensiveFactor(); } - + public double GetDefensiveModifier() { return CurConfig.GetDefensiveMultiplier() + GetChassisModifier(); } + public double GetChassisModifier() { double retval = 0.0; - if ( UsingFlotationHull ) retval += 0.1; - if ( UsingLimitedAmphibious ) retval += 0.1; - if ( UsingFullAmphibious ) retval += 0.2; - if ( UsingDuneBuggy ) retval += 0.1; - if ( UsingEnvironmentalSealing ) retval += 0.1; + if (UsingFlotationHull) + retval += 0.1; + if (UsingLimitedAmphibious) + retval += 0.1; + if (UsingFullAmphibious) + retval += 0.2; + if (UsingDuneBuggy) + retval += 0.1; + if (UsingEnvironmentalSealing) + retval += 0.1; return retval; } @@ -1972,45 +2003,52 @@ public double GetUnmodifiedDefensiveBV() { defresult += CurStructure.GetDefensiveBV(); defresult += GetDefensiveEquipBV(); defresult += GetDefensiveExcessiveAmmoPenalty(); - //defresult += GetExplosiveAmmoPenalty(); - //defresult += GetExplosiveWeaponPenalty(); - if( defresult < 1.0 ) { + // defresult += GetExplosiveAmmoPenalty(); + // defresult += GetExplosiveWeaponPenalty(); + if (defresult < 1.0) { defresult = 1.0; } return defresult; } - + public String GetChassisModifierString() { StringBuilder b = new StringBuilder(); - if ( UsingFlotationHull ) b.append(", Flotation Hull"); - if ( UsingLimitedAmphibious ) b.append(", Limited Amphibious"); - if ( UsingFullAmphibious ) b.append(", Full Amphibious"); - if ( UsingDuneBuggy ) b.append(", Dune Buggy"); - if ( UsingEnvironmentalSealing && !(CurConfig instanceof stCVSubmarine) ) b.append(", Environmental Sealing"); - if ( b.length() > 0 ) return "(" + b.toString().substring(2) + ")"; + if (UsingFlotationHull) + b.append(", Flotation Hull"); + if (UsingLimitedAmphibious) + b.append(", Limited Amphibious"); + if (UsingFullAmphibious) + b.append(", Full Amphibious"); + if (UsingDuneBuggy) + b.append(", Dune Buggy"); + if (UsingEnvironmentalSealing && !(CurConfig instanceof stCVSubmarine)) + b.append(", Environmental Sealing"); + if (b.length() > 0) + return "(" + b.toString().substring(2) + ")"; return ""; } public double GetDefensiveEquipBV() { // return the BV of all defensive equipment double result = 0.0; - ArrayList v = CurLoadout.GetNonCore(); + ArrayList v = CurLoadout.GetNonCore(); - for( int i = 0; i < v.size(); i++ ) { - result += ((abPlaceable) v.get( i )).GetDefensiveBV(); + for (int i = 0; i < v.size(); i++) { + result += ((abPlaceable) v.get(i)).GetDefensiveBV(); } - if( UsingTC() ) { + if (UsingTC()) { result += GetTC().GetDefensiveBV(); } // now get the defensive BV for any armored components that weren't // already covered. - if( CurLoadout.GetRulesLevel() >= AvailableCode.RULES_EXPERIMENTAL && CurLoadout.GetEra() >= AvailableCode.ERA_CLAN_INVASION ) { + if (CurLoadout.GetRulesLevel() >= AvailableCode.RULES_EXPERIMENTAL + && CurLoadout.GetEra() >= AvailableCode.ERA_CLAN_INVASION) { result += CurEngine.GetDefensiveBV(); - if( HasBlueShield() ) { + if (HasBlueShield()) { result += BlueShield.GetDefensiveBV(); } - if( CurLoadout.HasSupercharger() ) { + if (CurLoadout.HasSupercharger()) { result += CurLoadout.GetSupercharger().GetDefensiveBV(); } } @@ -2019,60 +2057,64 @@ public double GetDefensiveEquipBV() { public double GetDefensiveExcessiveAmmoPenalty() { double result = 0.0; - ArrayList v = CurLoadout.GetNonCore(); - ArrayList Ammo = new ArrayList(), - Wep = new ArrayList(); + ArrayList v = CurLoadout.GetNonCore(); + ArrayList Ammo = new ArrayList(), + Wep = new ArrayList(); // do we even need to do this? - if( v.size() <= 0 ) { return result; } + if (v.size() <= 0) { + return result; + } // seperate out the ammo-using weapons and their ammunition - for( int i = 0; i < v.size(); i++ ) { - if( v.get( i ) instanceof Ammunition ) { - Ammo.add( v.get( i ) ); + for (int i = 0; i < v.size(); i++) { + if (v.get(i) instanceof Ammunition) { + Ammo.add(v.get(i)); } - if( v.get(i) instanceof Equipment ) { - if( ((Equipment) v.get( i )).HasAmmo() ) { - Wep.add( v.get( i ) ); + if (v.get(i) instanceof Equipment) { + if (((Equipment) v.get(i)).HasAmmo()) { + Wep.add(v.get(i)); } } } // do we need to continue? - if( Ammo.size() <= 0 ) { return result; } + if (Ammo.size() <= 0) { + return result; + } // for each weapon that uses ammo, total it's ammo BV and ensure it's - // not excessive. Add the BV to the running total. - while( Wep.size() > 0 ) { + // not excessive. Add the BV to the running total. + while (Wep.size() > 0) { // get the first item and check if anything else uses the same ammo - Equipment test = (Equipment) Wep.get( 0 ); - Wep.remove( test ); + Equipment test = (Equipment) Wep.get(0); + Wep.remove(test); Ammunition ammo = null; int NumWeps = 1; int NumAmmos = 0; - for( int i = Wep.size() - 1; i >= 0; i-- ) { - if( ((Equipment) Wep.get( i )).GetAmmoIndex() == test.GetAmmoIndex() ) { + for (int i = Wep.size() - 1; i >= 0; i--) { + if (((Equipment) Wep.get(i)).GetAmmoIndex() == test.GetAmmoIndex()) { NumWeps++; - Wep.remove( i ); + Wep.remove(i); } } // now check the number of ammunitions that this weapon uses - for( int i = 0; i < Ammo.size(); i++ ) { - if( ((Ammunition) Ammo.get(i)).GetAmmoIndex() == test.GetAmmoIndex() ) { - ammo = (Ammunition) Ammo.get( i ); + for (int i = 0; i < Ammo.size(); i++) { + if (((Ammunition) Ammo.get(i)).GetAmmoIndex() == test.GetAmmoIndex()) { + ammo = (Ammunition) Ammo.get(i); NumAmmos++; } } // now find out if the ammo is excessive - if( NumAmmos != 0 && ammo != null ) { - double ammoBV = ( NumAmmos * ammo.GetDefensiveBV() ); - if( ammoBV <= 0.0 ) { - ammoBV = ( NumAmmos * ammo.GetDefensiveBV() ); + if (NumAmmos != 0 && ammo != null) { + double ammoBV = (NumAmmos * ammo.GetDefensiveBV()); + if (ammoBV <= 0.0) { + ammoBV = (NumAmmos * ammo.GetDefensiveBV()); } - double wepBV = ( NumWeps * ((abPlaceable) test).GetDefensiveBV() ); - if( ammoBV > wepBV ) { + double wepBV = (NumWeps * ((abPlaceable) test).GetDefensiveBV()); + if (ammoBV > wepBV) { result -= ammoBV - wepBV; } } @@ -2083,13 +2125,13 @@ public double GetDefensiveExcessiveAmmoPenalty() { public double GetExplosiveAmmoPenalty() { double result = 0.0; - ArrayList v = CurLoadout.GetNonCore(); + ArrayList v = CurLoadout.GetNonCore(); abPlaceable p; - for( int i = 0; i < v.size(); i++ ) { - p = (abPlaceable) v.get( i ); - if( p instanceof Ammunition ) { - if( ((Ammunition) p).IsExplosive() ) { + for (int i = 0; i < v.size(); i++) { + p = v.get(i); + if (p instanceof Ammunition) { + if (((Ammunition) p).IsExplosive()) { } } } @@ -2099,27 +2141,30 @@ public double GetExplosiveAmmoPenalty() { public double GetExplosiveWeaponPenalty() { double result = 0.0; - ArrayList v = CurLoadout.GetNonCore(); - abPlaceable p; - boolean Explode; - - for( int i = 0; i < v.size(); i++ ) { - p = (abPlaceable) v.get( i ); - Explode = false; - int mod = 0; - if( p instanceof ifWeapon ) { - Explode = ((ifWeapon) p).IsExplosive(); - if( p instanceof RangedWeapon ) { - if( ((RangedWeapon) p).IsUsingCapacitor() ) { + // ArrayList v = CurLoadout.GetNonCore(); + // abPlaceable p; + // boolean Explode; // Not Read Anywhere. + + /* + * Since mod is not bing used, loop can be removed. + for (int i = 0; i < v.size(); i++) { + p = (abPlaceable) v.get(i); + // Explode = false; + // int mod = 0; // Not Read Anywhere + if (p instanceof ifWeapon) { + // Explode = ((ifWeapon) p).IsExplosive(); + if (p instanceof RangedWeapon) { + if (((RangedWeapon) p).IsUsingCapacitor()) { mod = 1; } } } } + */ // check for Blue Shield system. - if( HasBlueShield ) { - if( CurEngine.IsISXL() ) { + if (HasBlueShield) { + if (CurEngine.IsISXL()) { result -= 3.0; } } @@ -2136,28 +2181,34 @@ public double GetDefensiveFactor() { // this is a safeguard for using MASC on an incredibly speedy chassis // there is currently no way to get a bonus higher anyway. - if( RunMP > 29 ) { RunMP = 29; } + if (RunMP > 29) { + RunMP = 29; + } // safeguard for low walk mp (Modular MechArmor, for instance) - if( RunMP < 0 ) { RunMP = 0; } + if (RunMP < 0) { + RunMP = 0; + } // Get the defensive factors for jumping and running movement double ground = DefensiveFactor[RunMP]; - - //VTOL's and WiGEs get an extra .1 - if ( IsVTOL() || IsWIGE() ) ground += .1; - - //Stealth Armor gets an extra .2 - if ( GetArmor().IsStealth() ) ground += .2; - + + // VTOL's and WiGEs get an extra .1 + if (IsVTOL() || IsWIGE()) + ground += .1; + + // Stealth Armor gets an extra .2 + if (GetArmor().IsStealth()) + ground += .2; + double jump = 0.0; - if( GetJumpJets().GetNumJJ() > 0 ) { + if (GetJumpJets().GetNumJJ() > 0) { JumpMP = GetJumpJets().GetNumJJ() - 1; jump = DefensiveFactor[JumpMP] + 0.1; } double retval = 0.0; // return the best one. - if( jump > ground ) { + if (jump > ground) { retval = jump; } else { retval = ground; @@ -2184,11 +2235,11 @@ public double GetUnmodifiedOffensiveBV() { public double GetWeaponBV() { double result = 0.0, foreBV = 0.0, rearBV = 0.0; boolean UseRear = false, TC = CurLoadout.UsingTC(); - + ArrayList> FrontRear = new ArrayList>(); FrontRear.add(CurLoadout.GetFrontItems()); FrontRear.add(CurLoadout.GetRearItems()); - + ArrayList> Locations = new ArrayList>(); Locations.add(CurLoadout.GetLeftItems()); Locations.add(CurLoadout.GetRightItems()); @@ -2196,51 +2247,53 @@ public double GetWeaponBV() { Locations.add(CurLoadout.GetTurret2Items()); Locations.add(CurLoadout.GetSponsonTurretLeftItems()); Locations.add(CurLoadout.GetSponsonTurretRightItems()); - + // is it even worth performing all this? - if( CurLoadout.GetNonCore().size() <= 0 ) { + if (CurLoadout.GetNonCore().size() <= 0) { // nope return result; } // find out the total BV of rear and forward firing weapons - for ( abPlaceable w : CurLoadout.GetFrontItems() ) { - if ( w instanceof ifWeapon ) + for (abPlaceable w : CurLoadout.GetFrontItems()) { + if (w instanceof ifWeapon) foreBV += w.GetCurOffensiveBV(false, TC, false); } - for ( abPlaceable w : CurLoadout.GetRearItems() ) { - if ( w instanceof ifWeapon ) + for (abPlaceable w : CurLoadout.GetRearItems()) { + if (w instanceof ifWeapon) rearBV += w.GetCurOffensiveBV(true, TC, false); } - if( rearBV > foreBV ) { UseRear = true; } - - //Re-calculate values now based on rear adjustment - for ( ArrayList list : FrontRear ) { - for ( abPlaceable w : list ) { - if ( w instanceof ifWeapon) + if (rearBV > foreBV) { + UseRear = true; + } + + // Re-calculate values now based on rear adjustment + for (ArrayList list : FrontRear) { + for (abPlaceable w : list) { + if (w instanceof ifWeapon) result += w.GetCurOffensiveBV(UseRear, TC, false); } } - - //Sides and Turrets are full value no matter what - for ( ArrayList list : Locations ) { - for ( abPlaceable w : list ) { - if ( w instanceof ifWeapon) + + // Sides and Turrets are full value no matter what + for (ArrayList list : Locations) { + for (abPlaceable w : list) { + if (w instanceof ifWeapon) result += w.GetCurOffensiveBV(false, TC, false); } } - + return result; } public double GetNonHeatEquipBV() { // return the BV of all offensive equipment double result = 0.0; - ArrayList v = CurLoadout.GetNonCore(); + ArrayList v = CurLoadout.GetNonCore(); - for( int i = 0; i < v.size(); i++ ) { - if( ! ( v.get( i ) instanceof ifWeapon ) ) { - result += ((abPlaceable) v.get( i )).GetOffensiveBV(); + for (int i = 0; i < v.size(); i++) { + if (!(v.get(i) instanceof ifWeapon)) { + result += ((abPlaceable) v.get(i)).GetOffensiveBV(); } } return result; @@ -2248,63 +2301,67 @@ public double GetNonHeatEquipBV() { public double GetExcessiveAmmoPenalty() { double result = 0.0; - ArrayList v = CurLoadout.GetNonCore(); - ArrayList Ammo = new ArrayList(), - Wep = new ArrayList(); + ArrayList v = CurLoadout.GetNonCore(); + ArrayList Ammo = new ArrayList(), + Wep = new ArrayList(); // do we even need to do this? - if( v.size() <= 0 ) { return result; } + if (v.size() <= 0) { + return result; + } // seperate out the ammo-using weapons and their ammunition - for( int i = 0; i < v.size(); i++ ) { - if( v.get( i ) instanceof Ammunition ) { - Ammo.add( v.get( i ) ); + for (int i = 0; i < v.size(); i++) { + if (v.get(i) instanceof Ammunition) { + Ammo.add(v.get(i)); } - if( v.get(i) instanceof ifWeapon ) { - if( ((ifWeapon) v.get( i )).HasAmmo() ) { - Wep.add( v.get( i ) ); + if (v.get(i) instanceof ifWeapon) { + if (((ifWeapon) v.get(i)).HasAmmo()) { + Wep.add(v.get(i)); } } } // do we need to continue? - if( Ammo.size() <= 0 ) { return result; } + if (Ammo.size() <= 0) { + return result; + } // for each weapon that uses ammo, total it's ammo BV and ensure it's - // not excessive. Add the BV to the running total. - while( Wep.size() > 0 ) { + // not excessive. Add the BV to the running total. + while (Wep.size() > 0) { // get the first item and check if anything else uses the same ammo - ifWeapon test = (ifWeapon) Wep.get( 0 ); - Wep.remove( test ); + ifWeapon test = (ifWeapon) Wep.get(0); + Wep.remove((abPlaceable) test); Ammunition ammo = null; int NumWeps = 1; int NumAmmos = 0; - for( int i = Wep.size() - 1; i >= 0; i-- ) { - if( ((ifWeapon) Wep.get( i )).GetAmmoIndex() == test.GetAmmoIndex() ) { + for (int i = Wep.size() - 1; i >= 0; i--) { + if (((ifWeapon) Wep.get(i)).GetAmmoIndex() == test.GetAmmoIndex()) { NumWeps++; - Wep.remove( i ); + Wep.remove(i); } } // now check the number of ammunitions that this weapon uses - for( int i = 0; i < Ammo.size(); i++ ) { - if( ((Ammunition) Ammo.get(i)).GetAmmoIndex() == test.GetAmmoIndex() ) { - ammo = (Ammunition) Ammo.get( i ); + for (int i = 0; i < Ammo.size(); i++) { + if (((Ammunition) Ammo.get(i)).GetAmmoIndex() == test.GetAmmoIndex()) { + ammo = (Ammunition) Ammo.get(i); NumAmmos++; } } // now find out if the ammo is excessive - if( NumAmmos != 0 && ammo != null ) { - double ammoBV = ( NumAmmos * ammo.GetOffensiveBV() ); - if( ammoBV <= 0.0 ) { - ammoBV = ( NumAmmos * ammo.GetDefensiveBV() ); + if (NumAmmos != 0 && ammo != null) { + double ammoBV = (NumAmmos * ammo.GetOffensiveBV()); + if (ammoBV <= 0.0) { + ammoBV = (NumAmmos * ammo.GetDefensiveBV()); } - double wepBV = ( NumWeps * ((abPlaceable) test).GetOffensiveBV() ); - if( wepBV <= 0.0 ) { - wepBV = ( NumWeps * ((abPlaceable) test).GetDefensiveBV() ); + double wepBV = (NumWeps * ((abPlaceable) test).GetOffensiveBV()); + if (wepBV <= 0.0) { + wepBV = (NumWeps * ((abPlaceable) test).GetDefensiveBV()); } - if( ammoBV > wepBV ) { + if (ammoBV > wepBV) { result -= ammoBV - wepBV; } } @@ -2314,153 +2371,160 @@ public double GetExcessiveAmmoPenalty() { } public double GetTonnageBV() { - return (double)Tonnage / 2.0; + return (double) Tonnage / 2.0; } public double GetOffensiveFactor() { double result = 0.0; result += (double) (getFlankMP() - 5.0f); result = result * 0.1 + 1.0; - result = (double) Math.pow( result, 1.2 ) ; + result = (double) Math.pow(result, 1.2); // round off to the nearest two digits - result = (double) Math.floor( result * 100 + 0.5 ) / 100; + result = (double) Math.floor(result * 100 + 0.5) / 100; double cockpitMultiplier = 1.0; return result * cockpitMultiplier; } - public boolean SetEngine( Engine e ) { + public boolean SetEngine(Engine e) { CurEngine = e; - if ( !e.RequiresControls() ) { + if (!e.RequiresControls()) { CruiseMP = 0; } else { - if ( CruiseMP == 0 ) + if (CruiseMP == 0) CruiseMP = 1; } - CurEngine.SetRating( GetFinalEngineRating() ); + CurEngine.SetRating(GetFinalEngineRating()); - if ( e.FreeHeatSinks() > GetHeatSinks().GetNumHS() ) + if (e.FreeHeatSinks() > GetHeatSinks().GetNumHS()) GetHeatSinks().SetNumHS(e.FreeHeatSinks()); return true; } - public int GetAvailableSlots() - { + public int GetAvailableSlots() { int retval = getMaxItems(); retval -= CurEngine.NumCVSpaces(); retval -= CurArmor.NumCVSpaces(); retval -= GetLoadout().NumCVAmmoSpaces(); - for ( abPlaceable a : (ArrayList)GetLoadout().GetNonCore() ) { + for (abPlaceable a : (ArrayList) GetLoadout().GetNonCore()) { retval -= a.NumCVSpaces(); } return retval; } - public int GetBaseEngineRating() - { + public int GetBaseEngineRating() { return Tonnage * CruiseMP; } - public int GetFinalEngineRating() - { - return Math.min(Math.max( (int)(CommonTools.RoundHalfUp( (GetBaseEngineRating() - CurConfig.GetSuspensionFactor(Tonnage))*.1 ) * 10) , CurEngine.GetTonnage() == 0 ? 0 : 10), 400); + public int GetFinalEngineRating() { + return Math + .min(Math.max( + (int) (CommonTools.RoundHalfUp( + (GetBaseEngineRating() - CurConfig.GetSuspensionFactor(Tonnage)) * .1) * 10), + CurEngine.GetTonnage() == 0 ? 0 : 10), 400); } public AvailableCode GetAvailability() { // returns the availability code for this mech based on all components - AvailableCode Base = new AvailableCode( CurLoadout.GetTechBase() ); - Base.SetCodes( 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A' ); - Base.SetISDates( 0, 0, false, 1950, 0, 0, false, false ); - Base.SetCLDates( 0, 0, false, 1950, 0, 0, false, false ); - Base.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - if( Omni ) { - Base.Combine( OmniAvailable ); + AvailableCode Base = new AvailableCode(CurLoadout.GetTechBase()); + Base.SetCodes('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); + Base.SetISDates(0, 0, false, 1950, 0, 0, false, false); + Base.SetCLDates(0, 0, false, 1950, 0, 0, false, false); + Base.SetRulesLevels(AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + if (Omni) { + Base.Combine(OmniAvailable); } // combine the availability codes from all equipment - Base.Combine( CurEngine.GetAvailability() ); - Base.Combine( new stChassisMSBP().GetAvailability() ); - Base.Combine( GetHeatSinks().GetAvailability() ); - if( GetJumpJets().GetNumJJ() > 0 ) { - Base.Combine( GetJumpJets().GetAvailability() ); + Base.Combine(CurEngine.GetAvailability()); + Base.Combine(new stChassisMSBP().GetAvailability()); + Base.Combine(GetHeatSinks().GetAvailability()); + if (GetJumpJets().GetNumJJ() > 0) { + Base.Combine(GetJumpJets().GetAvailability()); + } + Base.Combine(CurArmor.GetAvailability()); + if (CurLoadout.UsingTC()) { + Base.Combine(GetTC().GetAvailability()); } - Base.Combine( CurArmor.GetAvailability() ); - if( CurLoadout.UsingTC() ) { - Base.Combine( GetTC().GetAvailability() ); + if (!CurEngine.IsNuclear()) { + Base.Combine(CurLoadout.GetPowerAmplifier().GetAvailability()); } - if( ! CurEngine.IsNuclear() ) { Base.Combine( CurLoadout.GetPowerAmplifier().GetAvailability() ); } - ArrayList v = CurLoadout.GetNonCore(); - for( int i = 0; i < v.size(); i++ ) { - Base.Combine( ((abPlaceable) v.get( i )).GetAvailability() ); + ArrayList v = CurLoadout.GetNonCore(); + for (int i = 0; i < v.size(); i++) { + Base.Combine(((abPlaceable) v.get(i)).GetAvailability()); } - if( CurLoadout.HasSupercharger() ) { - Base.Combine( CurLoadout.GetSupercharger().GetAvailability() ); + if (CurLoadout.HasSupercharger()) { + Base.Combine(CurLoadout.GetSupercharger().GetAvailability()); } - if( HasBlueShield() ) { - Base.Combine( BlueShield.GetAvailability() ); + if (HasBlueShield()) { + Base.Combine(BlueShield.GetAvailability()); } // now adjust for the era. - if( CurLoadout.GetEra() == AvailableCode.ERA_SUCCESSION ) { + if (CurLoadout.GetEra() == AvailableCode.ERA_SUCCESSION) { // cut out the Star League stuff. - AvailableCode SW = new AvailableCode( Base.GetTechBase() ); - SW.SetCodes( 'A', 'X', 'A', 'A', 'A', 'A', 'X', 'A', 'A', 'A' ); - SW.SetISDates( 0, 0, false, 2801, 10000, 0, false, false ); - SW.SetCLDates( 0, 0, false, 2801, 10000, 0, false, false ); - SW.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - Base.Combine( SW ); - } - if( CurLoadout.GetEra() == AvailableCode.ERA_CLAN_INVASION ) { + AvailableCode SW = new AvailableCode(Base.GetTechBase()); + SW.SetCodes('A', 'X', 'A', 'A', 'A', 'A', 'X', 'A', 'A', 'A'); + SW.SetISDates(0, 0, false, 2801, 10000, 0, false, false); + SW.SetCLDates(0, 0, false, 2801, 10000, 0, false, false); + SW.SetRulesLevels(AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + Base.Combine(SW); + } + if (CurLoadout.GetEra() == AvailableCode.ERA_CLAN_INVASION) { // cut out the Star League and Succession Wars stuff. - AvailableCode CI = new AvailableCode( Base.GetTechBase() ); - CI.SetCodes( 'A', 'X', 'X', 'A', 'A', 'A', 'X', 'X', 'A', 'A' ); - CI.SetISDates( 0, 0, false, 3051, 10000, 0, false, false ); - CI.SetCLDates( 0, 0, false, 3051, 10000, 0, false, false ); - CI.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - Base.Combine( CI ); + AvailableCode CI = new AvailableCode(Base.GetTechBase()); + CI.SetCodes('A', 'X', 'X', 'A', 'A', 'A', 'X', 'X', 'A', 'A'); + CI.SetISDates(0, 0, false, 3051, 10000, 0, false, false); + CI.SetCLDates(0, 0, false, 3051, 10000, 0, false, false); + CI.SetRulesLevels(AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + Base.Combine(CI); } return Base; } - public abPlaceable[] SortWeapons( ArrayList v, boolean rear ) { + public ArrayList SortWeapons(ArrayList v, boolean rear) { // convert the results - ArrayList r = SortWeapons(v, rear, true); - abPlaceable[] result = new abPlaceable[r.size()]; - for( int i = 0; i < r.size(); i++ ) { - result[i] = (abPlaceable) r.get( i ); + ArrayList r = SortWeapons(v, rear, true); + ArrayList result = new ArrayList(); + for (int i = 0; i < r.size(); i++) { + result.set(i, r.get(i)); } return result; } // sorting routine for weapon BV calculation. this is undoubtedly slow - public ArrayList SortWeapons( ArrayList v, boolean rear, boolean DoRearHeatCheck ) { - // sort by BV first (using gnomesort for less code. may have to change - // this depending on the slowness of the program. I figure lower overhead + public ArrayList SortWeapons(ArrayList v, boolean rear, boolean DoRearHeatCheck) { + // sort by BV first (using gnomesort for less code. may have to change + // this depending on the slowness of the program. I figure lower overhead // will have better results at this time, and mechs typically don't - // carry more than twelve to fifteen weapons. I'll have to test this. + // carry more than twelve to fifteen weapons. I'll have to test this. int i = 1, j = 2; boolean TC = UsingTC(); - Object swap; - while( i < v.size() ) { + abPlaceable swap; + while (i < v.size()) { // get the two items we'll be comparing boolean AES1 = false; boolean AES2 = false; - if( ((abPlaceable) v.get( i - 1 )).GetCurOffensiveBV( rear, TC, AES1 ) >= ((abPlaceable) v.get( i )).GetCurOffensiveBV( rear, TC, AES2 ) ) { + if (((abPlaceable) v.get(i - 1)).GetCurOffensiveBV(rear, TC, AES1) >= ((abPlaceable) v.get(i)) + .GetCurOffensiveBV(rear, TC, AES2)) { i = j; j += 1; } else { - swap = v.get( i - 1 ); - v.set( i - 1, v.get( i ) ); - v.set( i, swap ); + swap = v.get(i - 1); + v.set(i - 1, v.get(i)); + v.set(i, swap); i -= 1; - if( i == 0 ) { + if (i == 0) { i = 1; } } @@ -2468,31 +2532,32 @@ public ArrayList SortWeapons( ArrayList v, boolean rear, boolean DoRearHeatCheck // check our values, ensuring that rear-firing weapons, then lower heat // weapons take precedence - if ( DoRearHeatCheck ) { + if (DoRearHeatCheck) { i = 1; - while( i < v.size() ) { + while (i < v.size()) { boolean AES1 = false; boolean AES2 = false; - if( ((abPlaceable) v.get( i - 1 )).GetCurOffensiveBV( rear, TC, AES1 ) == ((abPlaceable) v.get( i )).GetCurOffensiveBV( rear, TC, AES2 ) ) { - if( rear ) { - if( ((abPlaceable) v.get( i - 1 )).IsMountedRear() &! ((abPlaceable) v.get( i )).IsMountedRear() ) { - swap = v.get( i - 1 ); - v.set( i - 1, v.get( i ) ); - v.set( i, swap ); - } else if( ((ifWeapon) v.get( i - 1)).GetHeat() > ((ifWeapon) v.get( i )).GetHeat() ) { - swap = v.get( i - 1 ); - v.set( i - 1, v.get( i ) ); - v.set( i, swap ); + if (((abPlaceable) v.get(i - 1)).GetCurOffensiveBV(rear, TC, AES1) == ((abPlaceable) v.get(i)) + .GetCurOffensiveBV(rear, TC, AES2)) { + if (rear) { + if (((abPlaceable) v.get(i - 1)).IsMountedRear() & !((abPlaceable) v.get(i)).IsMountedRear()) { + swap = v.get(i - 1); + v.set(i - 1, v.get(i)); + v.set(i, swap); + } else if (((ifWeapon) v.get(i - 1)).GetHeat() > ((ifWeapon) v.get(i)).GetHeat()) { + swap = v.get(i - 1); + v.set(i - 1, v.get(i)); + v.set(i, swap); } } else { - if( ! ((abPlaceable) v.get( i - 1 )).IsMountedRear() && ((abPlaceable) v.get( i )).IsMountedRear() ) { - swap = v.get( i - 1 ); - v.set( i - 1, v.get( i ) ); - v.set( i, swap ); - } else if( ((ifWeapon) v.get( i - 1)).GetHeat() > ((ifWeapon) v.get( i )).GetHeat() ) { - swap = v.get( i - 1 ); - v.set( i - 1, v.get( i ) ); - v.set( i, swap ); + if (!((abPlaceable) v.get(i - 1)).IsMountedRear() && ((abPlaceable) v.get(i)).IsMountedRear()) { + swap = v.get(i - 1); + v.set(i - 1, v.get(i)); + v.set(i, swap); + } else if (((ifWeapon) v.get(i - 1)).GetHeat() > ((ifWeapon) v.get(i)).GetHeat()) { + swap = v.get(i - 1); + v.set(i - 1, v.get(i)); + v.set(i, swap); } } } @@ -2513,15 +2578,17 @@ public boolean IsPrimitive() { public double GetEquipCost() { // gets the cost for all non-core items minus ammuntion. - ArrayList v = CurLoadout.GetNonCore(); + ArrayList v = CurLoadout.GetNonCore(); double retval = 0.0; - if( v.size() > 0 ) { - for( int i = 0; i < v.size(); i++ ) { - if( ! (v.get( i ) instanceof Ammunition ) ) { - retval += ( (abPlaceable) v.get( i ) ).GetCost(); + if (v.size() > 0) { + for (int i = 0; i < v.size(); i++) { + if (!(v.get(i) instanceof Ammunition)) { + retval += ((abPlaceable) v.get(i)).GetCost(); } } - if( ! CurEngine.IsNuclear() ) { retval += CurLoadout.GetPowerAmplifier().GetCost(); } + if (!CurEngine.IsNuclear()) { + retval += CurLoadout.GetPowerAmplifier().GetCost(); + } return retval; } else { return retval; @@ -2530,12 +2597,12 @@ public double GetEquipCost() { public double GetAmmoCosts() { // gets the cost for all ammuntion. - ArrayList v = CurLoadout.GetNonCore(); + ArrayList v = CurLoadout.GetNonCore(); double retval = 0.0; - if( v.size() > 0 ) { - for( int i = 0; i < v.size(); i++ ) { - if( (v.get( i ) instanceof Ammunition ) ) { - retval += ( (abPlaceable) v.get( i ) ).GetCost(); + if (v.size() > 0) { + for (int i = 0; i < v.size(); i++) { + if ((v.get(i) instanceof Ammunition)) { + retval += ((abPlaceable) v.get(i)).GetCost(); } } return retval; @@ -2546,7 +2613,7 @@ public double GetAmmoCosts() { public double GetBaseChassisCost() { // chassis cost in this context is different than the ChassisCost - // variable. It includes all components except engine, TC, and + // variable. It includes all components except engine, TC, and // equipment without multiple calculation ("base" cost) double result = 0.0; @@ -2556,29 +2623,40 @@ public double GetBaseChassisCost() { result += GetHeatSinks().GetCost(); result += GetJumpJets().GetCost(); result += CurArmor.GetCost(); - if ( isHasTurret1() ) result += getCurLoadout().GetTurret().GetCost(); - if ( isHasTurret2() ) result += getCurLoadout().GetRearTurret().GetCost(); - if ( HasPowerAmplifier ) result += getCurLoadout().GetPowerAmplifier().GetCost(); + if (isHasTurret1()) + result += getCurLoadout().GetTurret().GetCost(); + if (isHasTurret2()) + result += getCurLoadout().GetRearTurret().GetCost(); + if (HasPowerAmplifier) + result += getCurLoadout().GetPowerAmplifier().GetCost(); return result; } - + public double GetChassisCost() { // this method sets the cost variable by calculating the base cost. // this is usually only done whenever a chassis component changes. double result = GetBaseChassisCost(); result += CurEngine.GetCost(); - if( UsingLimitedAmphibious ) { result += 10000.0 * GetLimitedAmphibiousTonnage(); } - if( UsingFullAmphibious ) { result += 10000.0 * GetFullAmphibiousTonnage(); } - if( UsingDuneBuggy ) { result += 10 * Tonnage * Tonnage; } - if( HasBlueShield() ) { result += BlueShield.GetCost(); } + if (UsingLimitedAmphibious) { + result += 10000.0 * GetLimitedAmphibiousTonnage(); + } + if (UsingFullAmphibious) { + result += 10000.0 * GetFullAmphibiousTonnage(); + } + if (UsingDuneBuggy) { + result += 10 * Tonnage * Tonnage; + } + if (HasBlueShield()) { + result += BlueShield.GetCost(); + } // same goes for the targeting computer and supercharger - if( CurLoadout.UsingTC() ) { - //result += GetTC().GetCost(); + if (CurLoadout.UsingTC()) { + // result += GetTC().GetCost(); } - if( CurLoadout.HasSupercharger() ) { + if (CurLoadout.HasSupercharger()) { result += CurLoadout.GetSupercharger().GetCost(); } @@ -2587,12 +2665,15 @@ public double GetChassisCost() { public double GetCostMult() { double retval = 1.0; - if ( Omni ) retval *= 1.25; - if ( UsingFlotationHull ) retval *= 1.25; - if ( UsingEnvironmentalSealing && !(CurConfig instanceof stCVSubmarine) ) retval *= 1.25; + if (Omni) + retval *= 1.25; + if (UsingFlotationHull) + retval *= 1.25; + if (UsingEnvironmentalSealing && !(CurConfig instanceof stCVSubmarine)) + retval *= 1.25; return Math.max(retval, 1); } - + public boolean IsQuad() { return false; } @@ -2600,7 +2681,7 @@ public boolean IsQuad() { public boolean IsTripod() { return false; } - + public PhysicalEnhancement GetPhysEnhance() { return new PhysicalEnhancement(this); } @@ -2611,52 +2692,51 @@ public ifCVLoadout GetLoadout() { public int GetArmorableLocationCount() { int Locs = 4; - if ( isHasTurret1() ) + if (isHasTurret1()) Locs++; - if ( isHasTurret2() ) + if (isHasTurret2()) Locs++; - if ( IsVTOL() ) + if (IsVTOL()) Locs++; - + return Locs; } - - public int GetCrew() - { - if ( CurEngine.RequiresControls() ) - return Math.round(Tonnage / 15) + ( (Tonnage % 15 > 0) ? 1 : 0); + + public int GetCrew() { + if (CurEngine.RequiresControls()) + return Math.round(Tonnage / 15) + ((Tonnage % 15 > 0) ? 1 : 0); else return 0; } - - public void SetProductionEra( int e ) { - if( Omni ) { - CurLoadout.SetProductionEra( e ); + + public void SetProductionEra(int e) { + if (Omni) { + CurLoadout.SetProductionEra(e); } else { - MainLoadout.SetProductionEra( e ); + MainLoadout.SetProductionEra(e); } } - - public void setMotiveType( String Motive ) { - for ( ifCombatVehicle state : states) { + + public void setMotiveType(String Motive) { + for (ifCombatVehicle state : states) { if (state.GetMotiveLookupName().equals(Motive)) { CurConfig = state; break; } } } - + public int GetDeprecatedLevel() { // returns the mech's "level" according to the older rules // this is used by Solaris7.com - if( GetRulesLevel() >= AvailableCode.RULES_ADVANCED ) { + if (GetRulesLevel() >= AvailableCode.RULES_ADVANCED) { return 3; } else { - if( MainLoadout.GetTechBase() == AvailableCode.TECH_CLAN ) { + if (MainLoadout.GetTechBase() == AvailableCode.TECH_CLAN) { return 2; } - if( GetAvailability().GetISSWCode() < 'F' ) { - if( GetHeatSinks().IsDouble() ) { + if (GetAvailability().GetISSWCode() < 'F') { + if (GetHeatSinks().IsDouble()) { return 2; } else { return 1; @@ -2666,23 +2746,25 @@ public int GetDeprecatedLevel() { } } } - + public String GetTurretLookupName() { String retval = "No Turret"; - if ( isHasTurret1() ) retval = "Single Turret"; - if ( isHasTurret2() ) retval = "Dual Turret"; + if (isHasTurret1()) + retval = "Single Turret"; + if (isHasTurret2()) + retval = "Dual Turret"; return retval; } - + public int GetMegaMekLevel() { // returns the mech's tech level according to MegaMek - switch( GetRulesLevel() ) { + switch (GetRulesLevel()) { case AvailableCode.RULES_TOURNAMENT: - if( CurLoadout.GetTechBase() == AvailableCode.TECH_CLAN ) { + if (CurLoadout.GetTechBase() == AvailableCode.TECH_CLAN) { return 2; } - if( GetAvailability().GetISSWCode() < 'F' ) { - if( GetHeatSinks().IsDouble() ) { + if (GetAvailability().GetISSWCode() < 'F') { + if (GetHeatSinks().IsDouble()) { return 2; } else { return 1; @@ -2699,37 +2781,37 @@ public int GetMegaMekLevel() { return 5; } } - - public void SetTrailer(boolean b ) { + + public void SetTrailer(boolean b) { IsTrailer = b; - if ( b ) { + if (b) { CurEngine.SetNoneEngine(); - } else if ( CurEngine.isNone() ) { + } else if (CurEngine.isNone()) { CurEngine.SetICEngine(); } setTonnage(Tonnage); } - + public boolean isTrailer() { return IsTrailer; } - + public double GetBVWeaponHeat() { // this returns the heat generated by weapons for BV purposes as the // normal method is governed by user preferences double result = 0; - ArrayList v = CurLoadout.GetNonCore(); - if( v.size() <= 0 ) { + ArrayList v = CurLoadout.GetNonCore(); + if (v.size() <= 0) { return result; } abPlaceable a; - for( int i = 0; i < v.size(); i++ ) { - a = (abPlaceable) v.get( i ); - if( a instanceof ifWeapon ) { + for (int i = 0; i < v.size(); i++) { + a = v.get(i); + if (a instanceof ifWeapon) { result += ((ifWeapon) a).GetBVHeat(); } - if( a instanceof MGArray ) { + if (a instanceof MGArray) { result += ((MGArray) a).GetBVHeat(); } } @@ -2744,84 +2826,86 @@ public int GetBVMovementHeat() { int minjumpheat = 3 * CurEngine.JumpingHeatMultiplier(); double heatperjj = 0.0; - if( GetJumpJets().IsImproved() ) { + if (GetJumpJets().IsImproved()) { heatperjj = 0.5 * CurEngine.JumpingHeatMultiplier(); } else { heatperjj = 1.0 * CurEngine.JumpingHeatMultiplier(); } - if( GetJumpJets().GetNumJJ() > 0 ) { - jump = (int) ( GetJumpJets().GetNumJJ() * heatperjj + 0.51f ); - if( jump < minjumpheat ) { jump = minjumpheat; } + if (GetJumpJets().GetNumJJ() > 0) { + jump = (int) (GetJumpJets().GetNumJJ() * heatperjj + 0.51f); + if (jump < minjumpheat) { + jump = minjumpheat; + } - if ( GetJumpJets().IsUMU() ) { jump = 1 * CurEngine.JumpingHeatMultiplier(); } + if (GetJumpJets().IsUMU()) { + jump = 1 * CurEngine.JumpingHeatMultiplier(); + } } - if( jump > walk ) { + if (jump > walk) { return jump; } else { return walk; } } - + public boolean HasFlotationHull() { return UsingFlotationHull; } - + public void SetFlotationHull(boolean b) { UsingFlotationHull = b; } - + public boolean HasLimitedAmphibious() { return UsingLimitedAmphibious; } - + public void SetLimitedAmphibious(boolean b) { UsingLimitedAmphibious = b; } - + public double GetLimitedAmphibiousTonnage() { - if ( UsingLimitedAmphibious ) - return CommonTools.RoundHalfUp(Tonnage / 25.0); + if (UsingLimitedAmphibious) + return CommonTools.RoundHalfUp(Tonnage / 25.0); return 0; } - + public boolean HasFullAmphibious() { return UsingFullAmphibious; } - + public void SetFullAmphibious(boolean b) { UsingFullAmphibious = b; } - + public double GetFullAmphibiousTonnage() { - if ( UsingFullAmphibious ) - return CommonTools.RoundHalfUp(Tonnage / 10.0); + if (UsingFullAmphibious) + return CommonTools.RoundHalfUp(Tonnage / 10.0); return 0; } - + public boolean HasEnvironmentalSealing() { return UsingEnvironmentalSealing; } - + public void SetEnvironmentalSealing(boolean b) { UsingEnvironmentalSealing = b; } - + public double GetEnvironmentalSealingTonnage() { - if ( UsingEnvironmentalSealing && !(CurConfig instanceof stCVSubmarine) ) - return CommonTools.RoundHalfUp(Tonnage / 10.0); + if (UsingEnvironmentalSealing && !(CurConfig instanceof stCVSubmarine)) + return CommonTools.RoundHalfUp(Tonnage / 10.0); return 0; } - + public boolean HasDuneBuggy() { return UsingDuneBuggy; } - + public void SetDuneBuggy(boolean b) { UsingDuneBuggy = b; } } - - diff --git a/sswlib/src/main/java/components/Mech.java b/sswlib/src/main/java/components/Mech.java index f2585287..62104f46 100644 --- a/sswlib/src/main/java/components/Mech.java +++ b/sswlib/src/main/java/components/Mech.java @@ -37,102 +37,54 @@ import java.util.prefs.Preferences; public class Mech implements ifUnit, ifBattleforce { - // A mech for the designer. This is a large container class that will + // A mech for the designer. This is a large container class that will // handle calculations and settings for the design. // Declares - private String Name = "", - Model = "", - Overview = "", - Capabilities = "", - History = "", - Deployment = "", - Variants = "", - Notables = "", - Additional = "", - Company = "", - Location = "", - EngineManufacturer = "", - ArmorModel = "", - ChassisModel = "", - JJModel = "", - CommSystem = "", - TandTSystem = "", - Solaris7ID = "0", - Solaris7ImageID = "0", - SSWImage = ""; + private String Name = "", Model = "", Overview = "", Capabilities = "", History = "", Deployment = "", + Variants = "", Notables = "", Additional = "", Company = "", Location = "", EngineManufacturer = "", + ArmorModel = "", ChassisModel = "", JJModel = "", CommSystem = "", TandTSystem = "", Solaris7ID = "0", + Solaris7ImageID = "0", SSWImage = ""; private ArrayList Quirks = new ArrayList(); - private int Tonnage = 20, - WalkMP; - private double JJMult, - MechMult; - public final static double[] DefensiveFactor = { 1.0, 1.0, 1.1, 1.1, 1.2, 1.2, - 1.3, 1.3, 1.3, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.5, - 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6 }; - private boolean Quad, - Tripod, - Omnimech, - SuperHeavy, - Primitive = false, - IndustrialMech = false, - HasNullSig = false, - HasVoidSig = false, - HasChameleon = false, - HasBlueShield = false, - HasEnviroSealing = false, - HasEjectionSeat = false, - HasTracks = false, - HasLAAES = false, - HasRAAES = false, - HasLegAES = false, - HasFHES = false, - HasPartialWing = false, - HasJumpBooster = false, - HasDroneOS = false, - FractionalAccounting = false, - Changed = false; - private Engine CurEngine = new Engine( this ); - private ifMechLoadout MainLoadout = new BipedLoadout( Constants.BASELOADOUT_NAME, this ), - CurLoadout = MainLoadout; + private int Tonnage = 20, WalkMP; + private double JJMult, MechMult; + public final static double[] DefensiveFactor = { 1.0, 1.0, 1.1, 1.1, 1.2, 1.2, 1.3, 1.3, 1.3, 1.4, 1.4, 1.4, 1.4, + 1.4, 1.4, 1.4, 1.4, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6 }; + private boolean Quad, Tripod, Omnimech, SuperHeavy, Primitive = false, IndustrialMech = false, HasNullSig = false, + HasVoidSig = false, HasChameleon = false, HasBlueShield = false, HasEnviroSealing = false, + HasEjectionSeat = false, HasTracks = false, HasLAAES = false, HasRAAES = false, HasLegAES = false, + HasFHES = false, HasPartialWing = false, HasJumpBooster = false, HasDroneOS = false, + FractionalAccounting = false, Changed = false; + private Engine CurEngine = new Engine(this); + private ifMechLoadout MainLoadout = new BipedLoadout(Constants.BASELOADOUT_NAME, this), CurLoadout = MainLoadout; private ArrayList Loadouts = new ArrayList(); private ArrayList MechMods = new ArrayList(); - private Gyro CurGyro = new Gyro( this ); - private InternalStructure CurIntStruc = new InternalStructure( this ); - private Cockpit CurCockpit = new Cockpit( this ); - private PhysicalEnhancement CurPhysEnhance = new PhysicalEnhancement( this ); - private MechArmor CurArmor = new MechArmor( this ); - private MechanicalJumpBooster JumpBooster = new MechanicalJumpBooster( this ); - private MultiSlotSystem NullSig, - VoidSig, - Chameleon, - BlueShield, - EnviroSealing, - Tracks; - private SimplePlaceable EjectionSeat, - CommandConsole; - private AESSystem LAAES = new AESSystem( this, false ), - RAAES = new AESSystem( this, false ), - FLLAES = new AESSystem( this, true ), - FRLAES = new AESSystem( this, true ), - LLAES = new AESSystem( this, true ), - RLAES = new AESSystem( this, true ), - CurLAAES, - CurRAAES; - private PartialWing Wing = new PartialWing( this ); - private AvailableCode FHESAC = new AvailableCode( AvailableCode.TECH_BOTH ); - private Hashtable Lookup = new Hashtable(); - private AvailableCode OmniAvailable = new AvailableCode( AvailableCode.TECH_BOTH ); + private Gyro CurGyro = new Gyro(this); + private InternalStructure CurIntStruc = new InternalStructure(this); + private Cockpit CurCockpit = new Cockpit(this); + private PhysicalEnhancement CurPhysEnhance = new PhysicalEnhancement(this); + private MechArmor CurArmor = new MechArmor(this); + private MechanicalJumpBooster JumpBooster = new MechanicalJumpBooster(this); + private MultiSlotSystem NullSig, VoidSig, Chameleon, BlueShield, EnviroSealing, Tracks; + private SimplePlaceable EjectionSeat, CommandConsole; + private AESSystem LAAES = new AESSystem(this, false), RAAES = new AESSystem(this, false), + FLLAES = new AESSystem(this, true), FRLAES = new AESSystem(this, true), LLAES = new AESSystem(this, true), + RLAES = new AESSystem(this, true), CurLAAES, CurRAAES; + private PartialWing Wing = new PartialWing(this); + private AvailableCode FHESAC = new AvailableCode(AvailableCode.TECH_BOTH); + private Hashtable Lookup = new Hashtable(); + private AvailableCode OmniAvailable = new AvailableCode(AvailableCode.TECH_BOTH); private BattleForceData BFData; private Preferences Prefs; // Constructors public Mech() { // no prefs file, create a default. - Prefs = Preferences.userRoot().node( Constants.SSWPrefs ); + Prefs = Preferences.userRoot().node(Constants.SSWPrefs); Load(); } - public Mech( Preferences p ) { + public Mech(Preferences p) { Prefs = p; Load(); } @@ -142,159 +94,177 @@ private void Load() { // Set the names and years to blank so the user doesn't have to overtype Name = ""; - MainLoadout.SetTechBase( AvailableCode.TECH_INNER_SPHERE ); + MainLoadout.SetTechBase(AvailableCode.TECH_INNER_SPHERE); - // Basic setup for the mech. This is an arbitrary default chassis + // Basic setup for the mech. This is an arbitrary default chassis Quad = false; Omnimech = false; SuperHeavy = false; WalkMP = 1; - CurEngine.SetRating( 20 ); - CurLoadout.SetBaseLoadout( MainLoadout ); + CurEngine.SetRating(20); + CurLoadout.SetBaseLoadout(MainLoadout); // Set the AES Systems to the default CurLAAES = LAAES; CurRAAES = RAAES; // finish off the OmniMech availability - OmniAvailable.SetISCodes( 'E', 'X', 'E', 'E', 'D' ); - OmniAvailable.SetISDates( 0, 0, false, 3052, 0, 0, false, false ); - OmniAvailable.SetISFactions( "", "", "", "" ); - OmniAvailable.SetCLCodes( 'E', 'X', 'E', 'E', 'D' ); - OmniAvailable.SetCLDates( 0, 0, false, 2856, 0, 0, false, false ); - OmniAvailable.SetCLFactions( "", "", "", "" ); - OmniAvailable.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); + OmniAvailable.SetISCodes('E', 'X', 'E', 'E', 'D'); + OmniAvailable.SetISDates(0, 0, false, 3052, 0, 0, false, false); + OmniAvailable.SetISFactions("", "", "", ""); + OmniAvailable.SetCLCodes('E', 'X', 'E', 'E', 'D'); + OmniAvailable.SetCLDates(0, 0, false, 2856, 0, 0, false, false); + OmniAvailable.SetCLFactions("", "", "", ""); + OmniAvailable.SetRulesLevels(AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); // load up some special equipment - AvailableCode AC = new AvailableCode( AvailableCode.TECH_INNER_SPHERE ); - AC.SetISCodes( 'E', 'E', 'X', 'X', 'F' ); - AC.SetISDates( 0, 0, false, 2630, 2790, 3099, true, true ); - AC.SetISFactions( "", "", "TH", "" ); - AC.SetPBMAllowed( true ); - AC.SetPIMAllowed( true ); - AC.SetRulesLevels( AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - NullSig = new MultiSlotSystem( this, "Null Signature System", "Null Signature System", "Null Signature System", "NullSignatureSystem", 0.0, false, true, 1400000.0, false, AC ); - NullSig.AddMechModifier( new MechModifier( 0, 0, 0, 0.0, 0, 0, 10, 0.2, 0.0, 0.0, 0.0, true, false ) ); + AvailableCode AC = new AvailableCode(AvailableCode.TECH_INNER_SPHERE); + AC.SetISCodes('E', 'E', 'X', 'X', 'F'); + AC.SetISDates(0, 0, false, 2630, 2790, 3099, true, true); + AC.SetISFactions("", "", "TH", ""); + AC.SetPBMAllowed(true); + AC.SetPIMAllowed(true); + AC.SetRulesLevels(AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + NullSig = new MultiSlotSystem(this, "Null Signature System", "Null Signature System", "Null Signature System", + "NullSignatureSystem", 0.0, false, true, 1400000.0, false, AC); + NullSig.AddMechModifier(new MechModifier(0, 0, 0, 0.0, 0, 0, 10, 0.2, 0.0, 0.0, 0.0, true, false)); NullSig.SetExclusions(new String[] { "Targeting Computer", "Void Signature System", "Stealth Armor", "C3" }); - NullSig.SetBookReference( "Tactical Operations" ); - NullSig.SetChatName( "NullSig" ); - - AC = new AvailableCode( AvailableCode.TECH_INNER_SPHERE ); - AC.SetISCodes( 'E', 'F', 'X', 'X', 'F' ); - AC.SetISDates( 0, 0, false, 2630, 2790, 3099, true, true ); - AC.SetISFactions( "", "", "TH", "" ); - AC.SetPBMAllowed( true ); - AC.SetPIMAllowed( true ); - AC.SetRulesLevels( AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - Chameleon = new MultiSlotSystem( this, "Chameleon LPS", "Chameleon LPS", "Chameleon LPS", "ChameleonLightPolarizationField", 0.0, true, true, 600000.0, false, AC ); - Chameleon.AddMechModifier( new MechModifier( 0, 0, 0, 0.0, 0, 0, 6, 0.2, 0.0, 0.0, 0.0, true, false ) ); + NullSig.SetBookReference("Tactical Operations"); + NullSig.SetChatName("NullSig"); + + AC = new AvailableCode(AvailableCode.TECH_INNER_SPHERE); + AC.SetISCodes('E', 'F', 'X', 'X', 'F'); + AC.SetISDates(0, 0, false, 2630, 2790, 3099, true, true); + AC.SetISFactions("", "", "TH", ""); + AC.SetPBMAllowed(true); + AC.SetPIMAllowed(true); + AC.SetRulesLevels(AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + Chameleon = new MultiSlotSystem(this, "Chameleon LPS", "Chameleon LPS", "Chameleon LPS", + "ChameleonLightPolarizationField", 0.0, true, true, 600000.0, false, AC); + Chameleon.AddMechModifier(new MechModifier(0, 0, 0, 0.0, 0, 0, 6, 0.2, 0.0, 0.0, 0.0, true, false)); Chameleon.SetExclusions(new String[] { "Void Signature System", "Stealth Armor" }); - Chameleon.SetBookReference( "Tactical Operations" ); - Chameleon.SetChatName( "CLPS" ); - - AC = new AvailableCode( AvailableCode.TECH_INNER_SPHERE ); - AC.SetISCodes( 'E', 'X', 'X', 'F', 'F' ); - AC.SetISDates( 3051, 3053, true, 3053, 0, 0, false, false ); - AC.SetISFactions( "FS", "FS", "", "" ); - AC.SetPBMAllowed( true ); - AC.SetPIMAllowed( true ); - AC.SetRulesLevels( AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - BlueShield = new MultiSlotSystem( this, "Blue Shield PFD", "Blue Shield PFD", "Blue Shield Project", "Blue Shield Particle Field Damper", 3.0, false, true, 1000000.0, false, AC ); - BlueShield.AddMechModifier( new MechModifier( 0, 0, 0, 0.0, 0, 0, 0, 0.0, 0.0, 0.2, 0.2, true, false ) ); - BlueShield.SetBookReference( "Tactical Operations" ); - BlueShield.SetChatName( "BluShld" ); - - AC = new AvailableCode( AvailableCode.TECH_INNER_SPHERE ); - AC.SetISCodes( 'E', 'X', 'X', 'E', 'F' ); - AC.SetISDates( 3060, 3070, true, 3085, 0, 0, false, false ); - AC.SetISFactions( "WB", "WB", "", "" ); - AC.SetPBMAllowed( true ); - AC.SetPIMAllowed( true ); - AC.SetRulesLevels( AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - VoidSig = new MultiSlotSystem( this, "Void Signature System", "Void Signature System", "Void Signature System", "VoidSignatureSystem", 0.0, false, true, 2000000.0, false, AC ); - VoidSig.AddMechModifier( new MechModifier( 0, 0, 0, 0.0, 0, 0, 10, 0.3, 0.0, 0.0, 0.0, true, false ) ); - VoidSig.SetExclusions(new String[] { "Targeting Computer", "Null Signature System", "Stealth Armor", "C3", "Chameleon LPS" }); - VoidSig.SetBookReference( "Tactical Operations" ); - VoidSig.SetChatName( "VoidSig" ); - - AC = new AvailableCode( AvailableCode.TECH_BOTH ); - AC.SetISCodes( 'C', 'C', 'C', 'C', 'C' ); - AC.SetISDates( 0, 0, false, 2350, 0, 0, false, false ); - AC.SetISFactions( "", "", "PS", "" ); - AC.SetCLCodes( 'C', 'X', 'C', 'C', 'C' ); - AC.SetCLDates( 0, 0, false, 2350, 0, 0, false, false ); - AC.SetCLFactions( "", "", "PS", "" ); - AC.SetPBMAllowed( true ); - AC.SetPIMAllowed( true ); - AC.SetRulesLevels( AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - EnviroSealing = new MultiSlotSystem( this, "Environmental Sealing", "Environmental Sealing", "Environmental Sealing", "Environmental Sealing", 0.1, false, false, 225.0, true, AC ); - EnviroSealing.SetWeightBasedOnMechTonnage( true ); - EnviroSealing.SetBookReference( "Tech Manual" ); - EnviroSealing.SetChatName( "EnvSlng" ); - - AC = new AvailableCode( AvailableCode.TECH_BOTH ); - AC.SetISCodes( 'B', 'D', 'E', 'F', 'E' ); - AC.SetISDates( 0, 0, false, 2445, 0, 0, false, false ); - AC.SetISFactions( "", "", "TH", "" ); - AC.SetCLCodes( 'B', 'X', 'E', 'F', 'E' ); - AC.SetCLDates( 0, 0, false, 2445, 0, 0, false, false ); - AC.SetCLFactions( "", "", "TH", "" ); - AC.SetPBMAllowed( true ); - AC.SetPIMAllowed( true ); - AC.SetRulesLevels( AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - EjectionSeat = new SimplePlaceable( "Ejection Seat", "Ejection Seat", "Ejection Seat", "EjectionSeat", "Tech Manual", 1, true, AC ); - EjectionSeat.SetTonnage( 0.5 ); - EjectionSeat.SetCost( 25000.0 ); - - AC = new AvailableCode( AvailableCode.TECH_BOTH ); - AC.SetISCodes( 'C', 'D', 'E', 'E', 'D' ); - AC.SetISDates( 0, 0, false, 2440, 0, 0, false, false ); - AC.SetISFactions( "", "", "DC", "" ); - AC.SetCLCodes( 'C', 'X', 'D', 'E', 'D' ); - AC.SetCLDates( 0, 0, false, 2440, 0, 0, false, false ); - AC.SetCLFactions( "", "", "DC", "" ); - AC.SetPBMAllowed( true ); - AC.SetPIMAllowed( true ); - AC.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - Tracks = new Tracks( this, AC ); - - AC = new AvailableCode( AvailableCode.TECH_BOTH ); - AC.SetISCodes( 'D', 'C', 'F', 'E', 'D' ); - AC.SetISDates( 0, 0, false, 2631, 2850, 3030, true, true ); - AC.SetISFactions( "", "", "TH", "??" ); - AC.SetCLCodes( 'D', 'X', 'F', 'E', 'D' ); - AC.SetCLDates( 0, 0, false, 2631, 0, 0, false, false ); - AC.SetCLFactions( "", "", "TH", "" ); - AC.SetPBMAllowed( true ); - AC.SetPIMAllowed( true ); - AC.SetRulesLevels( AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - CommandConsole = new SimplePlaceable( "Command Console", "Command Console", "Command Console", "Cockpit", "Tactical Operations", 1, true, AC ); - CommandConsole.SetTonnage( 3.0 ); - CommandConsole.SetCost( 500000.0 ); + Chameleon.SetBookReference("Tactical Operations"); + Chameleon.SetChatName("CLPS"); + + AC = new AvailableCode(AvailableCode.TECH_INNER_SPHERE); + AC.SetISCodes('E', 'X', 'X', 'F', 'F'); + AC.SetISDates(3051, 3053, true, 3053, 0, 0, false, false); + AC.SetISFactions("FS", "FS", "", ""); + AC.SetPBMAllowed(true); + AC.SetPIMAllowed(true); + AC.SetRulesLevels(AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_EXPERIMENTAL, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + BlueShield = new MultiSlotSystem(this, "Blue Shield PFD", "Blue Shield PFD", "Blue Shield Project", + "Blue Shield Particle Field Damper", 3.0, false, true, 1000000.0, false, AC); + BlueShield.AddMechModifier(new MechModifier(0, 0, 0, 0.0, 0, 0, 0, 0.0, 0.0, 0.2, 0.2, true, false)); + BlueShield.SetBookReference("Tactical Operations"); + BlueShield.SetChatName("BluShld"); + + AC = new AvailableCode(AvailableCode.TECH_INNER_SPHERE); + AC.SetISCodes('E', 'X', 'X', 'E', 'F'); + AC.SetISDates(3060, 3070, true, 3085, 0, 0, false, false); + AC.SetISFactions("WB", "WB", "", ""); + AC.SetPBMAllowed(true); + AC.SetPIMAllowed(true); + AC.SetRulesLevels(AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + VoidSig = new MultiSlotSystem(this, "Void Signature System", "Void Signature System", "Void Signature System", + "VoidSignatureSystem", 0.0, false, true, 2000000.0, false, AC); + VoidSig.AddMechModifier(new MechModifier(0, 0, 0, 0.0, 0, 0, 10, 0.3, 0.0, 0.0, 0.0, true, false)); + VoidSig.SetExclusions( + new String[] { "Targeting Computer", "Null Signature System", "Stealth Armor", "C3", "Chameleon LPS" }); + VoidSig.SetBookReference("Tactical Operations"); + VoidSig.SetChatName("VoidSig"); + + AC = new AvailableCode(AvailableCode.TECH_BOTH); + AC.SetISCodes('C', 'C', 'C', 'C', 'C'); + AC.SetISDates(0, 0, false, 2350, 0, 0, false, false); + AC.SetISFactions("", "", "PS", ""); + AC.SetCLCodes('C', 'X', 'C', 'C', 'C'); + AC.SetCLDates(0, 0, false, 2350, 0, 0, false, false); + AC.SetCLFactions("", "", "PS", ""); + AC.SetPBMAllowed(true); + AC.SetPIMAllowed(true); + AC.SetRulesLevels(AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + EnviroSealing = new MultiSlotSystem(this, "Environmental Sealing", "Environmental Sealing", + "Environmental Sealing", "Environmental Sealing", 0.1, false, false, 225.0, true, AC); + EnviroSealing.SetWeightBasedOnMechTonnage(true); + EnviroSealing.SetBookReference("Tech Manual"); + EnviroSealing.SetChatName("EnvSlng"); + + AC = new AvailableCode(AvailableCode.TECH_BOTH); + AC.SetISCodes('B', 'D', 'E', 'F', 'E'); + AC.SetISDates(0, 0, false, 2445, 0, 0, false, false); + AC.SetISFactions("", "", "TH", ""); + AC.SetCLCodes('B', 'X', 'E', 'F', 'E'); + AC.SetCLDates(0, 0, false, 2445, 0, 0, false, false); + AC.SetCLFactions("", "", "TH", ""); + AC.SetPBMAllowed(true); + AC.SetPIMAllowed(true); + AC.SetRulesLevels(AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + EjectionSeat = new SimplePlaceable("Ejection Seat", "Ejection Seat", "Ejection Seat", "EjectionSeat", + "Tech Manual", 1, true, AC); + EjectionSeat.SetTonnage(0.5); + EjectionSeat.SetCost(25000.0); + + AC = new AvailableCode(AvailableCode.TECH_BOTH); + AC.SetISCodes('C', 'D', 'E', 'E', 'D'); + AC.SetISDates(0, 0, false, 2440, 0, 0, false, false); + AC.SetISFactions("", "", "DC", ""); + AC.SetCLCodes('C', 'X', 'D', 'E', 'D'); + AC.SetCLDates(0, 0, false, 2440, 0, 0, false, false); + AC.SetCLFactions("", "", "DC", ""); + AC.SetPBMAllowed(true); + AC.SetPIMAllowed(true); + AC.SetRulesLevels(AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + Tracks = new Tracks(this, AC); + + AC = new AvailableCode(AvailableCode.TECH_BOTH); + AC.SetISCodes('D', 'C', 'F', 'E', 'D'); + AC.SetISDates(0, 0, false, 2631, 2850, 3030, true, true); + AC.SetISFactions("", "", "TH", "??"); + AC.SetCLCodes('D', 'X', 'F', 'E', 'D'); + AC.SetCLDates(0, 0, false, 2631, 0, 0, false, false); + AC.SetCLFactions("", "", "TH", ""); + AC.SetPBMAllowed(true); + AC.SetPIMAllowed(true); + AC.SetRulesLevels(AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_UNALLOWED, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + CommandConsole = new SimplePlaceable("Command Console", "Command Console", "Command Console", "Cockpit", + "Tactical Operations", 1, true, AC); + CommandConsole.SetTonnage(3.0); + CommandConsole.SetCost(500000.0); CommandConsole.SetArmoredTonnage(1.0); - FHESAC.SetISCodes( 'D', 'X', 'X', 'E', 'D' ); - FHESAC.SetISDates( 0, 0, false, 3023, 0, 0, false, false ); - FHESAC.SetISFactions( "", "", "LC", "" ); - FHESAC.SetCLCodes( 'D', 'X', 'X', 'E', 'D' ); - FHESAC.SetCLDates( 0, 0, false, 3052, 0, 0, false, false ); - FHESAC.SetCLFactions( "", "", "CWF", "" ); - FHESAC.SetRulesLevels( AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); + FHESAC.SetISCodes('D', 'X', 'X', 'E', 'D'); + FHESAC.SetISDates(0, 0, false, 3023, 0, 0, false, false); + FHESAC.SetISFactions("", "", "LC", ""); + FHESAC.SetCLCodes('D', 'X', 'X', 'E', 'D'); + FHESAC.SetCLDates(0, 0, false, 3052, 0, 0, false, false); + FHESAC.SetCLFactions("", "", "CWF", ""); + FHESAC.SetRulesLevels(AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_UNALLOWED, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); } public void Recalculate() { // recalculates the Mech Mult and the Jump Jet Mult - if( Tonnage < 60 ) { + if (Tonnage < 60) { JJMult = 0.5; - } else if( Tonnage > 55 && Tonnage < 90 ) { + } else if (Tonnage > 55 && Tonnage < 90) { JJMult = 1.0; - } else { + } else { JJMult = 2.0; } - if ( IndustrialMech == false ) { - MechMult = 1.0 + ( Tonnage * 0.01 ); + if (IndustrialMech == false) { + MechMult = 1.0 + (Tonnage * 0.01); } else { - MechMult = 1.0 + ( Tonnage * 0.0025 ); + MechMult = 1.0 + (Tonnage * 0.0025); } } @@ -302,77 +272,81 @@ public int GetTonnage() { return Tonnage; } - public void SetTonnage( int t ) { + public void SetTonnage(int t) { Tonnage = t; Recalculate(); // also need to redo the engine if tonnage changes. int MaxWalk = 0; - if( Primitive ) { - MaxWalk = (int) Math.floor( 400 / Tonnage / 1.2 ); + if (Primitive) { + MaxWalk = (int) Math.floor(400 / Tonnage / 1.2); } else { - MaxWalk = (int) Math.floor( 400 / Tonnage ); + MaxWalk = (int) Math.floor(400 / Tonnage); + } + if (WalkMP < 1) { + WalkMP = 1; + } + if (WalkMP > MaxWalk) { + WalkMP = MaxWalk; } - if( WalkMP < 1 ) { WalkMP = 1; } - if( WalkMP > MaxWalk ) { WalkMP = MaxWalk; } - CurEngine.SetRating( WalkMP * Tonnage ); + CurEngine.SetRating(WalkMP * Tonnage); - SetChanged( true ); + SetChanged(true); } - public void SetName( String n ) { + public void SetName(String n) { Name = n; - SetChanged( true ); + SetChanged(true); } - public void SetModel( String m ) { + public void SetModel(String m) { Model = m; - SetChanged( true ); + SetChanged(true); } - public void SetEra( int e ) { - if( Omnimech ) { - CurLoadout.SetEra( e ); + public void SetEra(int e) { + if (Omnimech) { + CurLoadout.SetEra(e); } else { - MainLoadout.SetEra( e ); + MainLoadout.SetEra(e); } - SetChanged( true ); + SetChanged(true); } - public void SetProductionEra( int e ) { - if( Omnimech ) { - CurLoadout.SetProductionEra( e ); + public void SetProductionEra(int e) { + if (Omnimech) { + CurLoadout.SetProductionEra(e); } else { - MainLoadout.SetProductionEra( e ); + MainLoadout.SetProductionEra(e); } - SetChanged( true ); + SetChanged(true); } - public void SetRulesLevel( int r ) { - if( Omnimech ) { - CurLoadout.SetRulesLevel( r ); + public void SetRulesLevel(int r) { + if (Omnimech) { + CurLoadout.SetRulesLevel(r); } else { - MainLoadout.SetRulesLevel( r ); + MainLoadout.SetRulesLevel(r); } - SetChanged( true ); + SetChanged(true); } - public void SetYear( int y, boolean specified ) { - if( Omnimech ) { - CurLoadout.SetYear( y, specified ); + public void SetYear(int y, boolean specified) { + if (Omnimech) { + CurLoadout.SetYear(y, specified); } else { - MainLoadout.SetYear( y, specified ); + MainLoadout.SetYear(y, specified); } - SetChanged( true ); + SetChanged(true); } - public void SetYearRestricted( boolean y ) { - if( Omnimech ) { - CurLoadout.SetYearRestricted( y ); + public void SetYearRestricted(boolean y) { + if (Omnimech) { + CurLoadout.SetYearRestricted(y); } else { - MainLoadout.SetYearRestricted( y ); + MainLoadout.SetYearRestricted(y); } - SetChanged( true ); + SetChanged(true); } public boolean IsYearRestricted() { @@ -383,39 +357,39 @@ public int GetTechBase() { return MainLoadout.GetTechBase(); } - public boolean SetTechBase( int t ) { - if( Omnimech ) { - if( t != MainLoadout.GetTechBase() && t != AvailableCode.TECH_BOTH ) { + public boolean SetTechBase(int t) { + if (Omnimech) { + if (t != MainLoadout.GetTechBase() && t != AvailableCode.TECH_BOTH) { return false; } else { - CurLoadout.SetTechBase( t ); + CurLoadout.SetTechBase(t); } } else { - MainLoadout.SetTechBase( t ); + MainLoadout.SetTechBase(t); } - SetChanged( true ); + SetChanged(true); return true; } - public void SetSolaris7ID( String ID ) { + public void SetSolaris7ID(String ID) { Solaris7ID = ID; - SetChanged( true ); + SetChanged(true); } - public void SetSolaris7ImageID( String ID ) { + public void SetSolaris7ImageID(String ID) { Solaris7ImageID = ID; - SetChanged( true ); + SetChanged(true); } - public void SetSSWImage( String image ) { + public void SetSSWImage(String image) { SSWImage = image; - SetChanged( true ); + SetChanged(true); } public void SetInnerSphere() { // performs all the neccesary actions to switch this to Inner Sphere // set the tech base - SetTechBase( AvailableCode.TECH_INNER_SPHERE ); + SetTechBase(AvailableCode.TECH_INNER_SPHERE); // clear out any MechModifiers in the chassis and loadout MechMods.clear(); @@ -431,14 +405,14 @@ public void SetInnerSphere() { CurGyro.SetStandard(); // switch the internal structure - if( IsQuad() ) { - if( IndustrialMech ) { + if (IsQuad()) { + if (IndustrialMech) { CurIntStruc.SetIMQD(); } else { CurIntStruc.SetMSQD(); } } else { - if( IndustrialMech ) { + if (IndustrialMech) { CurIntStruc.SetIMBP(); } else { CurIntStruc.SetMSBP(); @@ -446,7 +420,7 @@ public void SetInnerSphere() { } // switch the cockpit - if( IndustrialMech ) { + if (IndustrialMech) { CurCockpit.SetIndustrialCockpit(); } else { CurCockpit.SetStandardCockpit(); @@ -465,60 +439,60 @@ public void SetInnerSphere() { CurArmor.SetStandard(); // replace everything in the loadout - CurGyro.Place( CurLoadout ); - CurEngine.Place( CurLoadout ); - CurIntStruc.Place( CurLoadout ); - CurCockpit.Place( CurLoadout ); + CurGyro.Place(CurLoadout); + CurEngine.Place(CurLoadout); + CurIntStruc.Place(CurLoadout); + CurCockpit.Place(CurLoadout); GetActuators().PlaceActuators(); - CurPhysEnhance.Place( CurLoadout ); + CurPhysEnhance.Place(CurLoadout); GetHeatSinks().ReCalculate(); GetJumpJets().ReCalculate(); CurArmor.Recalculate(); - UseTC( false, false ); + UseTC(false, false); try { // replace fixed-slot equipment - if(HasBlueShield){ + if (HasBlueShield) { SetBlueShield(false); SetBlueShield(true); } - if(HasChameleon){ + if (HasChameleon) { SetChameleon(false); SetChameleon(true); } - if(HasEjectionSeat){ + if (HasEjectionSeat) { SetEjectionSeat(false); SetEjectionSeat(true); } - if(HasEnviroSealing){ + if (HasEnviroSealing) { SetEnviroSealing(false); SetEnviroSealing(true); } - if(HasNullSig){ + if (HasNullSig) { SetNullSig(false); SetNullSig(true); } - if(HasTracks){ + if (HasTracks) { SetTracks(false); SetTracks(true); } - if(HasVoidSig){ + if (HasVoidSig) { SetVoidSig(false); SetVoidSig(true); } - if(HasPartialWing) { - SetPartialWing( false ); + if (HasPartialWing) { + SetPartialWing(false); } - } catch( Exception e ) { + } catch (Exception e) { e.printStackTrace(); } - SetChanged( true ); + SetChanged(true); } public void SetClan() { // performs all the neccesary actions to switch this to Clan // set the tech base - SetTechBase( AvailableCode.TECH_CLAN ); + SetTechBase(AvailableCode.TECH_CLAN); // clear out any MechModifiers in the chassis and loadout MechMods.clear(); @@ -534,14 +508,14 @@ public void SetClan() { CurGyro.SetStandard(); // switch the internal structure - if( IsQuad() ) { - if( IndustrialMech ) { + if (IsQuad()) { + if (IndustrialMech) { CurIntStruc.SetIMQD(); } else { CurIntStruc.SetMSQD(); } } else { - if( IndustrialMech ) { + if (IndustrialMech) { CurIntStruc.SetIMBP(); } else { CurIntStruc.SetMSBP(); @@ -549,7 +523,7 @@ public void SetClan() { } // switch the cockpit - if( IndustrialMech ) { + if (IndustrialMech) { CurCockpit.SetIndustrialCockpit(); } else { CurCockpit.SetStandardCockpit(); @@ -568,55 +542,55 @@ public void SetClan() { CurArmor.SetStandard(); // replace everything iun the loadout - CurGyro.Place( CurLoadout ); - CurEngine.Place( CurLoadout ); - CurIntStruc.Place( CurLoadout ); - CurCockpit.Place( CurLoadout ); + CurGyro.Place(CurLoadout); + CurEngine.Place(CurLoadout); + CurIntStruc.Place(CurLoadout); + CurCockpit.Place(CurLoadout); GetActuators().PlaceActuators(); - CurPhysEnhance.Place( CurLoadout ); + CurPhysEnhance.Place(CurLoadout); GetHeatSinks().ReCalculate(); GetJumpJets().ReCalculate(); CurArmor.Recalculate(); - UseTC( false, false ); + UseTC(false, false); try { // replace fixed-slot equipment - if(HasBlueShield){ + if (HasBlueShield) { SetBlueShield(false); } - if(HasChameleon){ + if (HasChameleon) { SetChameleon(false); } - if(HasEjectionSeat){ + if (HasEjectionSeat) { SetEjectionSeat(false); SetEjectionSeat(true); } - if(HasEnviroSealing){ + if (HasEnviroSealing) { SetEnviroSealing(false); SetEnviroSealing(true); } - if(HasNullSig){ + if (HasNullSig) { SetNullSig(false); } - if(HasTracks){ + if (HasTracks) { SetTracks(false); SetTracks(true); } - if(HasVoidSig){ + if (HasVoidSig) { SetVoidSig(false); } - if(HasPartialWing) { - SetPartialWing( false ); - SetPartialWing( true ); + if (HasPartialWing) { + SetPartialWing(false); + SetPartialWing(true); } - } catch( Exception e ) { + } catch (Exception e) { e.printStackTrace(); } - SetChanged( true ); + SetChanged(true); } public void SetMixed() { - SetTechBase( AvailableCode.TECH_BOTH ); + SetTechBase(AvailableCode.TECH_BOTH); // clear out any MechModifiers in the chassis and loadout MechMods.clear(); @@ -626,209 +600,153 @@ public void SetMixed() { CurLoadout.FlushIllegal(); // check each component in turn before reseting to a default - if( ! CommonTools.IsAllowed( CurGyro.GetAvailability(), this ) ) { + if (!CommonTools.IsAllowed(CurGyro.GetAvailability(), this)) { CurGyro.SetStandard(); - CurGyro.Place( CurLoadout ); + CurGyro.Place(CurLoadout); } - if( ! CommonTools.IsAllowed( CurEngine.GetAvailability(), this ) ) { + if (!CommonTools.IsAllowed(CurEngine.GetAvailability(), this)) { CurEngine.SetFUEngine(); - CurEngine.Place( CurLoadout ); + CurEngine.Place(CurLoadout); } - if( ! CommonTools.IsAllowed( CurIntStruc.GetAvailability(), this ) ) { + if (!CommonTools.IsAllowed(CurIntStruc.GetAvailability(), this)) { // switch the internal structure - if( IsQuad() ) { - if( IndustrialMech ) { + if (IsQuad()) { + if (IndustrialMech) { CurIntStruc.SetIMQD(); } else { CurIntStruc.SetMSQD(); } } else { - if( IndustrialMech ) { + if (IndustrialMech) { CurIntStruc.SetIMBP(); } else { CurIntStruc.SetMSBP(); } } - CurIntStruc.Place( CurLoadout ); + CurIntStruc.Place(CurLoadout); } - if( ! CommonTools.IsAllowed( CurCockpit.GetAvailability(), this ) ) { - if( IndustrialMech ) { + if (!CommonTools.IsAllowed(CurCockpit.GetAvailability(), this)) { + if (IndustrialMech) { CurCockpit.SetIndustrialCockpit(); } else { CurCockpit.SetStandardCockpit(); } - CurCockpit.Place( CurLoadout ); + CurCockpit.Place(CurLoadout); } - if( ! CommonTools.IsAllowed( CurPhysEnhance.GetAvailability(), this ) ) { + if (!CommonTools.IsAllowed(CurPhysEnhance.GetAvailability(), this)) { CurPhysEnhance.SetNone(); - CurPhysEnhance.Place( CurLoadout ); + CurPhysEnhance.Place(CurLoadout); } - if( ! CommonTools.IsAllowed( GetHeatSinks().GetAvailability(), this ) ) { + if (!CommonTools.IsAllowed(GetHeatSinks().GetAvailability(), this)) { GetHeatSinks().SetSingle(); GetHeatSinks().ReCalculate(); } - if( ! CommonTools.IsAllowed( GetJumpJets().GetAvailability(), this ) ) { + if (!CommonTools.IsAllowed(GetJumpJets().GetAvailability(), this)) { GetJumpJets().SetNormal(); GetJumpJets().ReCalculate(); } - if( ! CommonTools.IsAllowed( CurArmor.GetAvailability(), this ) ) { + if (!CommonTools.IsAllowed(CurArmor.GetAvailability(), this)) { CurArmor.SetStandard(); CurArmor.Recalculate(); } // replace everything iun the loadout - UseTC( false, false ); + UseTC(false, false); try { // replace fixed-slot equipment - if(HasBlueShield){ + if (HasBlueShield) { SetBlueShield(false); SetBlueShield(true); } - if(HasChameleon){ + if (HasChameleon) { SetChameleon(false); SetChameleon(true); } - if(HasEjectionSeat){ + if (HasEjectionSeat) { SetEjectionSeat(false); SetEjectionSeat(true); } - if(HasEnviroSealing){ + if (HasEnviroSealing) { SetEnviroSealing(false); SetEnviroSealing(true); } - if(HasNullSig){ + if (HasNullSig) { SetNullSig(false); SetNullSig(true); } - if(HasTracks){ + if (HasTracks) { SetTracks(false); SetTracks(true); } - if(HasVoidSig){ + if (HasVoidSig) { SetVoidSig(false); SetVoidSig(true); } - if(HasPartialWing) { - SetPartialWing( false ); - SetPartialWing( true ); + if (HasPartialWing) { + SetPartialWing(false); + SetPartialWing(true); } - } catch( Exception e ) { + } catch (Exception e) { e.printStackTrace(); } - SetChanged( true ); + SetChanged(true); } -/* public void SetMixed() { - // performs all the neccesary actions to switch this to Mixed Tech - // set the tech base - SetTechBase( AvailableCode.TECH_BOTH ); - - // clear out any MechModifiers in the chassis and loadout - MechMods.clear(); - CurLoadout.GetMechMods().clear(); - - // clear the loadout - CurLoadout.ClearLoadout(); - - // switch the engine over to a military Standard Clan - CurEngine.SetFUEngine(); - - // switch the gyro - CurGyro.SetStandard(); - - // switch the internal structure - if( IsQuad() ) { - if( IndustrialMech ) { - CurIntStruc.SetIMQD(); - } else { - CurIntStruc.SetMSQD(); - } - } else { - if( IndustrialMech ) { - CurIntStruc.SetIMBP(); - } else { - CurIntStruc.SetMSBP(); - } - } - - // switch the cockpit - if( IndustrialMech ) { - CurCockpit.SetIndustrialCockpit(); - } else { - CurCockpit.SetStandardCockpit(); - } - - // switch the heat sinks - GetHeatSinks().SetSingle(); - - // switch the jump jets - GetJumpJets().SetNormal(); - - // switch the physical enhancement - CurPhysEnhance.SetNone(); - - // set the armor type - CurArmor.SetStandard(); - - // replace everything iun the loadout - CurGyro.Place( CurLoadout ); - CurEngine.Place( CurLoadout ); - CurIntStruc.Place( CurLoadout ); - CurCockpit.Place( CurLoadout ); - GetActuators().PlaceActuators(); - CurPhysEnhance.Place( CurLoadout ); - GetHeatSinks().ReCalculate(); - GetJumpJets().ReCalculate(); - CurArmor.Recalculate(); - UseTC( false, false ); - try { - // replace fixed-slot equipment - if(HasBlueShield){ - SetBlueShield(false); - SetBlueShield(true); - } - if(HasChameleon){ - SetChameleon(false); - SetChameleon(true); - } - if(HasEjectionSeat){ - SetEjectionSeat(false); - SetEjectionSeat(true); - } - if(HasEnviroSealing){ - SetEnviroSealing(false); - SetEnviroSealing(true); - } - if(HasNullSig){ - SetNullSig(false); - SetNullSig(true); - } - if(HasTracks){ - SetTracks(false); - SetTracks(true); - } - if(HasVoidSig){ - SetVoidSig(false); - SetVoidSig(true); - } - if(HasPartialWing) { - SetPartialWing( false ); - SetPartialWing( true ); - } - } catch( Exception e ) { - e.printStackTrace(); - } - - SetChanged( true ); - }*/ + /* + * public void SetMixed() { // performs all the neccesary actions to switch this + * to Mixed Tech // set the tech base SetTechBase( AvailableCode.TECH_BOTH ); + * + * // clear out any MechModifiers in the chassis and loadout MechMods.clear(); + * CurLoadout.GetMechMods().clear(); + * + * // clear the loadout CurLoadout.ClearLoadout(); + * + * // switch the engine over to a military Standard Clan + * CurEngine.SetFUEngine(); + * + * // switch the gyro CurGyro.SetStandard(); + * + * // switch the internal structure if( IsQuad() ) { if( IndustrialMech ) { + * CurIntStruc.SetIMQD(); } else { CurIntStruc.SetMSQD(); } } else { if( + * IndustrialMech ) { CurIntStruc.SetIMBP(); } else { CurIntStruc.SetMSBP(); } } + * + * // switch the cockpit if( IndustrialMech ) { + * CurCockpit.SetIndustrialCockpit(); } else { CurCockpit.SetStandardCockpit(); + * } + * + * // switch the heat sinks GetHeatSinks().SetSingle(); + * + * // switch the jump jets GetJumpJets().SetNormal(); + * + * // switch the physical enhancement CurPhysEnhance.SetNone(); + * + * // set the armor type CurArmor.SetStandard(); + * + * // replace everything iun the loadout CurGyro.Place( CurLoadout ); + * CurEngine.Place( CurLoadout ); CurIntStruc.Place( CurLoadout ); + * CurCockpit.Place( CurLoadout ); GetActuators().PlaceActuators(); + * CurPhysEnhance.Place( CurLoadout ); GetHeatSinks().ReCalculate(); + * GetJumpJets().ReCalculate(); CurArmor.Recalculate(); UseTC( false, false ); + * try { // replace fixed-slot equipment if(HasBlueShield){ + * SetBlueShield(false); SetBlueShield(true); } if(HasChameleon){ + * SetChameleon(false); SetChameleon(true); } if(HasEjectionSeat){ + * SetEjectionSeat(false); SetEjectionSeat(true); } if(HasEnviroSealing){ + * SetEnviroSealing(false); SetEnviroSealing(true); } if(HasNullSig){ + * SetNullSig(false); SetNullSig(true); } if(HasTracks){ SetTracks(false); + * SetTracks(true); } if(HasVoidSig){ SetVoidSig(false); SetVoidSig(true); } + * if(HasPartialWing) { SetPartialWing( false ); SetPartialWing( true ); } } + * catch( Exception e ) { e.printStackTrace(); } + * + * SetChanged( true ); } + */ public int GetTechbase() { return CurLoadout.GetTechBase(); @@ -839,7 +757,7 @@ public int GetBaseTechbase() { } public int GetUnitType() { - if( IndustrialMech ) { + if (IndustrialMech) { return AvailableCode.UNIT_INDUSTRIALMECH; } else { return AvailableCode.UNIT_BATTLEMECH; @@ -877,21 +795,21 @@ public void SetBiped() { int NumHS = GetHeatSinks().GetNumHS() - CurEngine.FreeHeatSinks(); // Get a new Biped Loadout and load up the queue - ifMechLoadout l = new BipedLoadout( Constants.BASELOADOUT_NAME, this ); - l.SetTechBase( MainLoadout.GetTechBase() ); - l.SetRulesLevel( MainLoadout.GetRulesLevel() ); - l.SetEra( MainLoadout.GetEra() ); - l.SetProductionEra( MainLoadout.GetProductionEra() ); - CurLoadout.Transfer( l ); + ifMechLoadout l = new BipedLoadout(Constants.BASELOADOUT_NAME, this); + l.SetTechBase(MainLoadout.GetTechBase()); + l.SetRulesLevel(MainLoadout.GetRulesLevel()); + l.SetEra(MainLoadout.GetEra()); + l.SetProductionEra(MainLoadout.GetProductionEra()); + CurLoadout.Transfer(l); CurLoadout.ClearLoadout(); // Now set the new main loadout and current loadout MainLoadout = l; CurLoadout = MainLoadout; - CurLoadout.SetBaseLoadout( MainLoadout ); + CurLoadout.SetBaseLoadout(MainLoadout); // next, change the internal structure to a default standard biped - if( IndustrialMech ) { + if (IndustrialMech) { CurIntStruc.SetIMBP(); } else { CurIntStruc.SetMSBP(); @@ -908,41 +826,41 @@ public void SetBiped() { HasLegAES = false; // remove the any existing physical weapons, and industrial equipment - ArrayList v = CurLoadout.GetNonCore(); - for( int i = v.size() - 1; i >= 0; i-- ) { - abPlaceable p = (abPlaceable) v.get( i ); - if( p instanceof PhysicalWeapon ) { + ArrayList v = CurLoadout.GetNonCore(); + for (int i = v.size() - 1; i >= 0; i--) { + abPlaceable p = (abPlaceable) v.get(i); + if (p instanceof PhysicalWeapon) { CurLoadout.Remove(p); - } else if( p instanceof Equipment ) { + } else if (p instanceof Equipment) { try { - ((Equipment) p).Validate( this); + ((Equipment) p).Validate(this); } catch (Exception e) { - CurLoadout.Remove( p ); + CurLoadout.Remove(p); } } } // replace everything into the new loadout - CurGyro.Place( CurLoadout ); - CurEngine.Place( CurLoadout ); - CurIntStruc.Place( CurLoadout ); - CurCockpit.Place( CurLoadout ); + CurGyro.Place(CurLoadout); + CurEngine.Place(CurLoadout); + CurIntStruc.Place(CurLoadout); + CurCockpit.Place(CurLoadout); GetActuators().PlaceActuators(); - CurPhysEnhance.Place( CurLoadout ); + CurPhysEnhance.Place(CurLoadout); // reset the correct number of heat sinks and jump jets try { - ifVisitor ResetV = Lookup( Jumps ); - Visit( ResetV ); - for( int i = 0; i < NumJJ; i++ ) { + ifVisitor ResetV = Lookup(Jumps); + Visit(ResetV); + for (int i = 0; i < NumJJ; i++) { GetJumpJets().IncrementNumJJ(); } - ResetV = Lookup( HeatSinks ); - Visit( ResetV ); - for( int i = 0; i < NumHS; i++ ) { + ResetV = Lookup(HeatSinks); + Visit(ResetV); + for (int i = 0; i < NumHS; i++) { GetHeatSinks().IncrementNumHS(); } - } catch( Exception e ) { - System.err.println( e.getMessage() ); + } catch (Exception e) { + System.err.println(e.getMessage()); e.printStackTrace(); } @@ -951,88 +869,88 @@ public void SetBiped() { GetJumpJets().ReCalculate(); CurArmor.Recalculate(); CurArmor.ResetPlaced(); - CurArmor.Place( CurLoadout ); + CurArmor.Place(CurLoadout); // attempt to replace any CASE systems that went missing try { - if( ctcase ) { + if (ctcase) { AddCTCase(); } - if( ltcase ) { + if (ltcase) { AddLTCase(); } - if( rtcase ) { + if (rtcase) { AddRTCase(); } - if( hdcase2 ) { - CurLoadout.SetHDCASEII( true, -1, hdcase2clan ); + if (hdcase2) { + CurLoadout.SetHDCASEII(true, -1, hdcase2clan); } - if( ctcase2 ) { - CurLoadout.SetCTCASEII( true, -1, ctcase2clan ); + if (ctcase2) { + CurLoadout.SetCTCASEII(true, -1, ctcase2clan); } - if( ltcase2 ) { - CurLoadout.SetLTCASEII( true, -1, ltcase2clan ); + if (ltcase2) { + CurLoadout.SetLTCASEII(true, -1, ltcase2clan); } - if( rtcase2 ) { - CurLoadout.SetRTCASEII( true, -1, rtcase2clan ); + if (rtcase2) { + CurLoadout.SetRTCASEII(true, -1, rtcase2clan); } - if( lacase2 ) { - CurLoadout.SetLACASEII( true, -1, lacase2clan ); + if (lacase2) { + CurLoadout.SetLACASEII(true, -1, lacase2clan); } - if( racase2 ) { - CurLoadout.SetRACASEII( true, -1, racase2clan ); + if (racase2) { + CurLoadout.SetRACASEII(true, -1, racase2clan); } - if( llcase2 ) { - CurLoadout.SetLLCASEII( true, -1, llcase2clan ); + if (llcase2) { + CurLoadout.SetLLCASEII(true, -1, llcase2clan); } - if( rlcase2 ) { - CurLoadout.SetRLCASEII( true, -1, rlcase2clan ); + if (rlcase2) { + CurLoadout.SetRLCASEII(true, -1, rlcase2clan); } - if (useClanCase){ + if (useClanCase) { CurLoadout.SetClanCASE(false); CurLoadout.SetClanCASE(true); } // replace fixed-slot equipment - if(HasBlueShield){ + if (HasBlueShield) { SetBlueShield(false); SetBlueShield(true); } - if(HasChameleon){ + if (HasChameleon) { SetChameleon(false); SetChameleon(true); } - if(HasEjectionSeat){ + if (HasEjectionSeat) { SetEjectionSeat(false); SetEjectionSeat(true); } - if(HasEnviroSealing){ + if (HasEnviroSealing) { SetEnviroSealing(false); SetEnviroSealing(true); } - if(HasNullSig){ + if (HasNullSig) { SetNullSig(false); SetNullSig(true); } - if(HasTracks){ + if (HasTracks) { SetTracks(false); SetTracks(true); } - if(HasVoidSig){ + if (HasVoidSig) { SetVoidSig(false); SetVoidSig(true); } - if(HasPartialWing) { - SetPartialWing( false ); - SetPartialWing( true ); + if (HasPartialWing) { + SetPartialWing(false); + SetPartialWing(true); } - } catch( Exception e ) { + } catch (Exception e) { // unhandled at this time, print an error out - System.err.println( "System not reinstalled:\n" + e.getMessage() ); + System.err.println("System not reinstalled:\n" + e.getMessage()); } - SetChanged( true ); + SetChanged(true); } public void SetQuad() { @@ -1066,21 +984,21 @@ public void SetQuad() { int NumHS = GetHeatSinks().GetNumHS() - CurEngine.FreeHeatSinks(); // Get a new Quad Loadout and load up the queue - ifMechLoadout l = new QuadLoadout( Constants.BASELOADOUT_NAME, this ); - l.SetTechBase( MainLoadout.GetTechBase() ); - l.SetRulesLevel( MainLoadout.GetRulesLevel() ); - l.SetEra( MainLoadout.GetEra() ); - l.SetProductionEra( MainLoadout.GetProductionEra() ); - CurLoadout.Transfer( l ); + ifMechLoadout l = new QuadLoadout(Constants.BASELOADOUT_NAME, this); + l.SetTechBase(MainLoadout.GetTechBase()); + l.SetRulesLevel(MainLoadout.GetRulesLevel()); + l.SetEra(MainLoadout.GetEra()); + l.SetProductionEra(MainLoadout.GetProductionEra()); + CurLoadout.Transfer(l); CurLoadout.ClearLoadout(); // Now set the new main loadout and current loadout MainLoadout = l; CurLoadout = l; - CurLoadout.SetBaseLoadout( MainLoadout ); + CurLoadout.SetBaseLoadout(MainLoadout); // next, change the internal structure to a default standard quad - if( IndustrialMech ) { + if (IndustrialMech) { CurIntStruc.SetIMQD(); } else { CurIntStruc.SetMSQD(); @@ -1096,15 +1014,15 @@ public void SetQuad() { HasLAAES = false; HasLegAES = false; - // remove the any existing physical weapons and industrial equipment - ArrayList v = CurLoadout.GetNonCore(); - for( int i = v.size() - 1; i >= 0; i-- ) { - abPlaceable p = (abPlaceable) v.get( i ); - if( p instanceof PhysicalWeapon ) { + // remove the any existing physical weapons and industrial equipment + ArrayList v = CurLoadout.GetNonCore(); + for (int i = v.size() - 1; i >= 0; i--) { + abPlaceable p = (abPlaceable) v.get(i); + if (p instanceof PhysicalWeapon) { CurLoadout.Remove(p); - } else if( p instanceof Equipment ) { + } else if (p instanceof Equipment) { try { - ((Equipment) p).Validate( this); + ((Equipment) p).Validate(this); } catch (Exception e) { CurLoadout.Remove(p); } @@ -1112,27 +1030,27 @@ public void SetQuad() { } // replace everything into the new loadout - CurGyro.Place( CurLoadout ); - CurEngine.Place( CurLoadout ); - CurIntStruc.Place( CurLoadout ); - CurCockpit.Place( CurLoadout ); + CurGyro.Place(CurLoadout); + CurEngine.Place(CurLoadout); + CurIntStruc.Place(CurLoadout); + CurCockpit.Place(CurLoadout); GetActuators().PlaceActuators(); - CurPhysEnhance.Place( CurLoadout ); + CurPhysEnhance.Place(CurLoadout); // reset the correct number of heat sinks and jump jets try { - ifVisitor ResetV = Lookup( Jumps ); - Visit( ResetV ); - for( int i = 0; i < NumJJ; i++ ) { + ifVisitor ResetV = Lookup(Jumps); + Visit(ResetV); + for (int i = 0; i < NumJJ; i++) { GetJumpJets().IncrementNumJJ(); } - ResetV = Lookup( HeatSinks ); - Visit( ResetV ); - for( int i = 0; i < NumHS; i++ ) { + ResetV = Lookup(HeatSinks); + Visit(ResetV); + for (int i = 0; i < NumHS; i++) { GetHeatSinks().IncrementNumHS(); } - } catch( Exception e ) { + } catch (Exception e) { // we shouldn't get an error from these visitors, but log it anyway - System.err.println( e.getMessage() ); + System.err.println(e.getMessage()); e.printStackTrace(); } @@ -1141,87 +1059,87 @@ public void SetQuad() { GetJumpJets().ReCalculate(); CurArmor.Recalculate(); CurArmor.ResetPlaced(); - CurArmor.Place( CurLoadout ); + CurArmor.Place(CurLoadout); // attempt to replace any CASE systems that went missing try { - if( ctcase ) { + if (ctcase) { AddCTCase(); } - if( ltcase ) { + if (ltcase) { AddLTCase(); } - if( rtcase ) { + if (rtcase) { AddRTCase(); } - if( hdcase2 ) { - CurLoadout.SetHDCASEII( true, -1, hdcase2clan ); + if (hdcase2) { + CurLoadout.SetHDCASEII(true, -1, hdcase2clan); } - if( ctcase2 ) { - CurLoadout.SetCTCASEII( true, -1, ctcase2clan ); + if (ctcase2) { + CurLoadout.SetCTCASEII(true, -1, ctcase2clan); } - if( ltcase2 ) { - CurLoadout.SetLTCASEII( true, -1, ltcase2clan ); + if (ltcase2) { + CurLoadout.SetLTCASEII(true, -1, ltcase2clan); } - if( rtcase2 ) { - CurLoadout.SetRTCASEII( true, -1, rtcase2clan ); + if (rtcase2) { + CurLoadout.SetRTCASEII(true, -1, rtcase2clan); } - if( lacase2 ) { - CurLoadout.SetLACASEII( true, -1, lacase2clan ); + if (lacase2) { + CurLoadout.SetLACASEII(true, -1, lacase2clan); } - if( racase2 ) { - CurLoadout.SetRACASEII( true, -1, racase2clan ); + if (racase2) { + CurLoadout.SetRACASEII(true, -1, racase2clan); } - if( llcase2 ) { - CurLoadout.SetLLCASEII( true, -1, llcase2clan ); + if (llcase2) { + CurLoadout.SetLLCASEII(true, -1, llcase2clan); } - if( rlcase2 ) { - CurLoadout.SetRLCASEII( true, -1, rlcase2clan ); + if (rlcase2) { + CurLoadout.SetRLCASEII(true, -1, rlcase2clan); } - if (useClanCase){ + if (useClanCase) { CurLoadout.SetClanCASE(false); CurLoadout.SetClanCASE(true); } // replace fixed-slot equipment - if(HasBlueShield){ + if (HasBlueShield) { SetBlueShield(false); SetBlueShield(true); } - if(HasChameleon){ + if (HasChameleon) { SetChameleon(false); SetChameleon(true); } - if(HasEjectionSeat){ + if (HasEjectionSeat) { SetEjectionSeat(false); SetEjectionSeat(true); } - if(HasEnviroSealing){ + if (HasEnviroSealing) { SetEnviroSealing(false); SetEnviroSealing(true); } - if(HasNullSig){ + if (HasNullSig) { SetNullSig(false); SetNullSig(true); } - if(HasTracks){ + if (HasTracks) { SetTracks(false); SetTracks(true); } - if(HasVoidSig){ + if (HasVoidSig) { SetVoidSig(false); SetVoidSig(true); } - if(HasPartialWing) { - SetPartialWing( false ); - SetPartialWing( true ); + if (HasPartialWing) { + SetPartialWing(false); + SetPartialWing(true); } - } catch( Exception e ) { + } catch (Exception e) { // unhandled at this time, print an error out - System.err.println( "System not reinstalled:\n" + e.getMessage() ); + System.err.println("System not reinstalled:\n" + e.getMessage()); } - SetChanged( true ); + SetChanged(true); } public boolean IsQuad() { @@ -1231,7 +1149,7 @@ public boolean IsQuad() { public boolean IsTripod() { return Tripod; } - + public void SetTripod() { // this performs all the neccesary actions to change this mech into a quad // see if we have any CASE systems installed first. @@ -1263,21 +1181,21 @@ public void SetTripod() { int NumHS = GetHeatSinks().GetNumHS() - CurEngine.FreeHeatSinks(); // Get a new Quad Loadout and load up the queue - ifMechLoadout l = new TripodLoadout( Constants.BASELOADOUT_NAME, this ); - l.SetTechBase( MainLoadout.GetTechBase() ); - l.SetRulesLevel( MainLoadout.GetRulesLevel() ); - l.SetEra( MainLoadout.GetEra() ); - l.SetProductionEra( MainLoadout.GetProductionEra() ); - CurLoadout.Transfer( l ); + ifMechLoadout l = new TripodLoadout(Constants.BASELOADOUT_NAME, this); + l.SetTechBase(MainLoadout.GetTechBase()); + l.SetRulesLevel(MainLoadout.GetRulesLevel()); + l.SetEra(MainLoadout.GetEra()); + l.SetProductionEra(MainLoadout.GetProductionEra()); + CurLoadout.Transfer(l); CurLoadout.ClearLoadout(); // Now set the new main loadout and current loadout MainLoadout = l; CurLoadout = l; - CurLoadout.SetBaseLoadout( MainLoadout ); + CurLoadout.SetBaseLoadout(MainLoadout); // next, change the internal structure to a default standard quad - if( IndustrialMech ) { + if (IndustrialMech) { CurIntStruc.SetIMQD(); } else { CurIntStruc.SetMSQD(); @@ -1293,13 +1211,13 @@ public void SetTripod() { HasLAAES = false; HasLegAES = false; - // remove the any existing physical weapons and industrial equipment - ArrayList v = CurLoadout.GetNonCore(); - for( int i = v.size() - 1; i >= 0; i-- ) { - abPlaceable p = (abPlaceable) v.get( i ); - if( p instanceof PhysicalWeapon ) { + // remove the any existing physical weapons and industrial equipment + ArrayList v = CurLoadout.GetNonCore(); + for (int i = v.size() - 1; i >= 0; i--) { + abPlaceable p = (abPlaceable) v.get(i); + if (p instanceof PhysicalWeapon) { CurLoadout.Remove(p); - } else if( p instanceof Equipment ) { + } else if (p instanceof Equipment) { try { ((Equipment) p).Validate(this); } catch (Exception e) { @@ -1309,27 +1227,27 @@ public void SetTripod() { } // replace everything into the new loadout - CurGyro.Place( CurLoadout ); - CurEngine.Place( CurLoadout ); - CurIntStruc.Place( CurLoadout ); - CurCockpit.Place( CurLoadout ); + CurGyro.Place(CurLoadout); + CurEngine.Place(CurLoadout); + CurIntStruc.Place(CurLoadout); + CurCockpit.Place(CurLoadout); GetActuators().PlaceActuators(); - CurPhysEnhance.Place( CurLoadout ); + CurPhysEnhance.Place(CurLoadout); // reset the correct number of heat sinks and jump jets try { - ifVisitor ResetV = Lookup( Jumps ); - Visit( ResetV ); - for( int i = 0; i < NumJJ; i++ ) { + ifVisitor ResetV = Lookup(Jumps); + Visit(ResetV); + for (int i = 0; i < NumJJ; i++) { GetJumpJets().IncrementNumJJ(); } - ResetV = Lookup( HeatSinks ); - Visit( ResetV ); - for( int i = 0; i < NumHS; i++ ) { + ResetV = Lookup(HeatSinks); + Visit(ResetV); + for (int i = 0; i < NumHS; i++) { GetHeatSinks().IncrementNumHS(); } - } catch( Exception e ) { + } catch (Exception e) { // we shouldn't get an error from these visitors, but log it anyway - System.err.println( e.getMessage() ); + System.err.println(e.getMessage()); e.printStackTrace(); } @@ -1338,155 +1256,156 @@ public void SetTripod() { GetJumpJets().ReCalculate(); CurArmor.Recalculate(); CurArmor.ResetPlaced(); - CurArmor.Place( CurLoadout ); + CurArmor.Place(CurLoadout); // attempt to replace any CASE systems that went missing try { - if( ctcase ) { + if (ctcase) { AddCTCase(); } - if( ltcase ) { + if (ltcase) { AddLTCase(); } - if( rtcase ) { + if (rtcase) { AddRTCase(); } - if( hdcase2 ) { - CurLoadout.SetHDCASEII( true, -1, hdcase2clan ); + if (hdcase2) { + CurLoadout.SetHDCASEII(true, -1, hdcase2clan); } - if( ctcase2 ) { - CurLoadout.SetCTCASEII( true, -1, ctcase2clan ); + if (ctcase2) { + CurLoadout.SetCTCASEII(true, -1, ctcase2clan); } - if( ltcase2 ) { - CurLoadout.SetLTCASEII( true, -1, ltcase2clan ); + if (ltcase2) { + CurLoadout.SetLTCASEII(true, -1, ltcase2clan); } - if( rtcase2 ) { - CurLoadout.SetRTCASEII( true, -1, rtcase2clan ); + if (rtcase2) { + CurLoadout.SetRTCASEII(true, -1, rtcase2clan); } - if( lacase2 ) { - CurLoadout.SetLACASEII( true, -1, lacase2clan ); + if (lacase2) { + CurLoadout.SetLACASEII(true, -1, lacase2clan); } - if( racase2 ) { - CurLoadout.SetRACASEII( true, -1, racase2clan ); + if (racase2) { + CurLoadout.SetRACASEII(true, -1, racase2clan); } - if( llcase2 ) { - CurLoadout.SetLLCASEII( true, -1, llcase2clan ); + if (llcase2) { + CurLoadout.SetLLCASEII(true, -1, llcase2clan); } - if( rlcase2 ) { - CurLoadout.SetRLCASEII( true, -1, rlcase2clan ); + if (rlcase2) { + CurLoadout.SetRLCASEII(true, -1, rlcase2clan); } - if (useClanCase){ + if (useClanCase) { CurLoadout.SetClanCASE(false); CurLoadout.SetClanCASE(true); } // replace fixed-slot equipment - if(HasBlueShield){ + if (HasBlueShield) { SetBlueShield(false); SetBlueShield(true); } - if(HasChameleon){ + if (HasChameleon) { SetChameleon(false); SetChameleon(true); } - if(HasEjectionSeat){ + if (HasEjectionSeat) { SetEjectionSeat(false); SetEjectionSeat(true); } - if(HasEnviroSealing){ + if (HasEnviroSealing) { SetEnviroSealing(false); SetEnviroSealing(true); } - if(HasNullSig){ + if (HasNullSig) { SetNullSig(false); SetNullSig(true); } - if(HasTracks){ + if (HasTracks) { SetTracks(false); SetTracks(true); } - if(HasVoidSig){ + if (HasVoidSig) { SetVoidSig(false); SetVoidSig(true); } - if(HasPartialWing) { - SetPartialWing( false ); - SetPartialWing( true ); + if (HasPartialWing) { + SetPartialWing(false); + SetPartialWing(true); } - } catch( Exception e ) { + } catch (Exception e) { // unhandled at this time, print an error out - System.err.println( "System not reinstalled:\n" + e.getMessage() ); + System.err.println("System not reinstalled:\n" + e.getMessage()); } - SetChanged( true ); + SetChanged(true); } - + /** * Determines if this mech is a Super Heavy 'Mech (over 100 tons) - * @return True if this Mech is SuperHeavy + * + * @return True if this Mech is SuperHeavy */ public boolean IsSuperheavy() { return SuperHeavy; } - + /** - * This performs all the necessary steps to transform this Mech into a + * This performs all the necessary steps to transform this Mech into a * SuperHeavy chassis */ public void SetSuperHeavy() { - + SuperHeavy = true; - + // Update chassis CurIntStruc.SetSHBP(); - + // switch the engine over to a military Standard CurEngine.SetFUEngine(); - + // Update cockpit CurCockpit.SetSuperHeavy(); - + // Update gyro CurGyro.SetSuperHeavy(); - + // Update physical enhancements, Super Heavy Mechs may not use them CurPhysEnhance.SetNone(); - + // Clear all Mech Modifications MechMods.clear(); } - + /** - * This performs all the necessary steps to transform this Mech into a - * standard chassis + * This performs all the necessary steps to transform this Mech into a standard + * chassis */ public void UnsetSuperHeavy() { - + SuperHeavy = false; - + // Update chassis CurIntStruc.SetMSBP(); - + // switch the engine over to a military Standard CurEngine.SetFUEngine(); - + // Update cockpit CurCockpit.SetStandardCockpit(); - + // Update gyro CurGyro.SetStandard(); - + // Update physical enhancements, Super Heavy Mechs may not use them CurPhysEnhance.SetNone(); - + // Clear all Mech Modifications MechMods.clear(); } - + public void SetIndustrialmech() { // do all the neccesary things to change over to an IndustrialMech IndustrialMech = true; - switch( MainLoadout.GetTechBase() ) { + switch (MainLoadout.GetTechBase()) { case AvailableCode.TECH_INNER_SPHERE: SetInnerSphere(); break; @@ -1498,20 +1417,20 @@ public void SetIndustrialmech() { break; } - if( Quad ) { + if (Quad) { SetQuad(); } else { SetBiped(); } Recalculate(); - SetChanged( true ); + SetChanged(true); } public void SetBattlemech() { // do all the neccesary things to change over to a BattleMech IndustrialMech = false; - switch( MainLoadout.GetTechBase() ) { + switch (MainLoadout.GetTechBase()) { case AvailableCode.TECH_INNER_SPHERE: SetInnerSphere(); break; @@ -1523,73 +1442,73 @@ public void SetBattlemech() { break; } - if( Quad ) { + if (Quad) { SetQuad(); } else { SetBiped(); } Recalculate(); - SetChanged( true ); + SetChanged(true); } public void SetPrimitive() { Primitive = true; - SetChanged( true ); + SetChanged(true); } public void SetModern() { Primitive = false; - SetChanged( true ); + SetChanged(true); } - + public void AddDroneOS() { HasDroneOS = true; } - + public void RemoveDroneOS() { HasDroneOS = false; } - public void SetOmnimech( String name ) { + public void SetOmnimech(String name) { // this performs everything needed to turn the mech into an omni Omnimech = true; - // remove any targeting computers from the base chassis. they vary too + // remove any targeting computers from the base chassis. they vary too // much to be fixed equipment - UseTC( false, false ); + UseTC(false, false); // before we unallocate the actuators, we need to make sure that // there are no physical weapons located there. boolean left = true; boolean right = true; - ArrayList v = MainLoadout.GetNonCore(); - for( int i = 0; i < v.size(); i++ ) { - if( v.get( i ) instanceof PhysicalWeapon ) { - if( MainLoadout.Find( (abPlaceable) v.get( i ) ) == LocationIndex.MECH_LOC_LA ) { + ArrayList v = MainLoadout.GetNonCore(); + for (int i = 0; i < v.size(); i++) { + if (v.get(i) instanceof PhysicalWeapon) { + if (MainLoadout.Find((abPlaceable) v.get(i)) == LocationIndex.MECH_LOC_LA) { left = false; } - if( MainLoadout.Find( (abPlaceable) v.get( i ) ) == LocationIndex.MECH_LOC_RA ) { + if (MainLoadout.Find((abPlaceable) v.get(i)) == LocationIndex.MECH_LOC_RA) { right = false; } } } - if( left ) { + if (left) { MainLoadout.GetActuators().RemoveLeftLowerArm(); } - if( right ) { + if (right) { MainLoadout.GetActuators().RemoveRightLowerArm(); } // set the minimums on heat sinks and jump jets - if( GetJumpJets().GetNumJJ() > 0 ) { - GetJumpJets().SetBaseLoadoutNumJJ( GetJumpJets().GetNumJJ() ); + if (GetJumpJets().GetNumJJ() > 0) { + GetJumpJets().SetBaseLoadoutNumJJ(GetJumpJets().GetNumJJ()); } - if( GetHeatSinks().GetNumHS() > CurEngine.FreeHeatSinks() ) { - GetHeatSinks().SetBaseLoadoutNumHS( GetHeatSinks().GetNumHS() ); + if (GetHeatSinks().GetNumHS() > CurEngine.FreeHeatSinks()) { + GetHeatSinks().SetBaseLoadoutNumHS(GetHeatSinks().GetNumHS()); } // lock the main chassis @@ -1597,11 +1516,11 @@ public void SetOmnimech( String name ) { // now get a new loadout and set it to the current. ifMechLoadout l = MainLoadout.Clone(); - l.SetName( name ); - Loadouts.add( l ); + l.SetName(name); + Loadouts.add(l); CurLoadout = l; - SetChanged( true ); + SetChanged(true); } public void UnlockChassis() { @@ -1612,74 +1531,76 @@ public void UnlockChassis() { CurLoadout = MainLoadout; } - public void AddLoadout( String Name ) throws Exception { + public void AddLoadout(String Name) throws Exception { // Adds a new loadout with the given name to the ArrayList, cloned from the // base loadout // does the name match the Base Loadout's name? - if( MainLoadout.GetName().equals( Name ) ) { - throw new Exception( "\"" + Name + "\" is reserved for the base loadout and cannot be used\nfor a new loadout. Please choose another name." ); + if (MainLoadout.GetName().equals(Name)) { + throw new Exception("\"" + Name + + "\" is reserved for the base loadout and cannot be used\nfor a new loadout. Please choose another name."); } // see if another loadout has the same name - for( int i = 0; i < Loadouts.size(); i++ ) { - if( ((ifMechLoadout) Loadouts.get( i )).GetName().equals( Name ) ) { - throw new Exception( "Could not add the new loadout because\nthe name given matches an existing loadout." ); + for (int i = 0; i < Loadouts.size(); i++) { + if (((ifMechLoadout) Loadouts.get(i)).GetName().equals(Name)) { + throw new Exception( + "Could not add the new loadout because\nthe name given matches an existing loadout."); } } ifMechLoadout l = MainLoadout.Clone(); - l.SetName( Name ); - Loadouts.add( l ); + l.SetName(Name); + Loadouts.add(l); CurLoadout = l; - SetChanged( true ); + SetChanged(true); } - public void RemoveLoadout( String Name ) { - // removes the given loadout from the loadout ArrayList. if the ArrayList is + public void RemoveLoadout(String Name) { + // removes the given loadout from the loadout ArrayList. if the ArrayList is // empty (non-omnimech) nothing is done. - for( int i = 0; i < Loadouts.size(); i++ ) { - if( ((ifMechLoadout) Loadouts.get( i )).GetName().equals( Name ) ) { + for (int i = 0; i < Loadouts.size(); i++) { + if (((ifMechLoadout) Loadouts.get(i)).GetName().equals(Name)) { // remove it - Loadouts.remove( i ); + Loadouts.remove(i); break; } } // now set the current loadout to the first - if( Loadouts.size() > 0 ) { + if (Loadouts.size() > 0) { CurLoadout = (ifMechLoadout) Loadouts.get(0); } else { CurLoadout = MainLoadout; } - SetChanged( true ); + SetChanged(true); } - public void SetCurLoadout( String Name ) { + public void SetCurLoadout(String Name) { // sets the current loadout to the named loadout. - if( Name.equals( Constants.BASELOADOUT_NAME ) ) { + if (Name.equals(Constants.BASELOADOUT_NAME)) { CurLoadout = MainLoadout; return; } - for( int i = 0; i < Loadouts.size(); i++ ) { - if( ((ifMechLoadout) Loadouts.get( i )).GetName().equals( Name ) ) { - CurLoadout = (ifMechLoadout) Loadouts.get( i ); + for (int i = 0; i < Loadouts.size(); i++) { + if (((ifMechLoadout) Loadouts.get(i)).GetName().equals(Name)) { + CurLoadout = (ifMechLoadout) Loadouts.get(i); return; } } - // if we got here, there was a problem. set the loadout to the base - if( Loadouts.size() > 0 ) { + // if we got here, there was a problem. set the loadout to the base + if (Loadouts.size() > 0) { CurLoadout = (ifMechLoadout) Loadouts.get(0); } else { CurLoadout = MainLoadout; } } - public ArrayList GetLoadouts() { + public ArrayList GetLoadouts() { return Loadouts; } @@ -1703,8 +1624,7 @@ public boolean UsingTC() { return CurLoadout.UsingTC(); } - public boolean UsingRoboticCockpit() - { + public boolean UsingRoboticCockpit() { return GetCockpit().IsRobotic(); } @@ -1733,7 +1653,7 @@ public int GetBaseProductionEra() { } public int GetRulesLevel() { - if( Omnimech ) { + if (Omnimech) { return CurLoadout.GetRulesLevel(); } else { return MainLoadout.GetRulesLevel(); @@ -1745,7 +1665,8 @@ public int GetBaseRulesLevel() { } public String GetFullName() { - return String.format("%1$s %2$s %3$s", GetName(), GetModel(), GetLoadout().GetName()).replace(" " + Constants.BASELOADOUT_NAME, "").trim(); + return String.format("%1$s %2$s %3$s", GetName(), GetModel(), GetLoadout().GetName()) + .replace(" " + Constants.BASELOADOUT_NAME, "").trim(); } public String GetChatInfo() { @@ -1753,22 +1674,22 @@ public String GetChatInfo() { info += GetTonnage() + "t, "; // MP info += GetWalkingMP(); - if( GetWalkingMP() != GetAdjustedWalkingMP( false, true ) ) { - info += "[" + GetAdjustedWalkingMP( false, true ) + "]"; + if (GetWalkingMP() != GetAdjustedWalkingMP(false, true)) { + info += "[" + GetAdjustedWalkingMP(false, true) + "]"; } info += "/"; info += GetRunningMP(); - if( GetRunningMP() != GetAdjustedRunningMP( false, true ) ) { - info += "[" + GetAdjustedRunningMP( false, true ) + "]"; + if (GetRunningMP() != GetAdjustedRunningMP(false, true)) { + info += "[" + GetAdjustedRunningMP(false, true) + "]"; } info += "/" + CurLoadout.GetJumpJets().GetNumJJ(); - if( CurLoadout.GetJumpJets().GetNumJJ() != this.GetAdjustedJumpingMP( false ) ) { - info += "[" + GetAdjustedJumpingMP( false ) + "]"; + if (CurLoadout.GetJumpJets().GetNumJJ() != this.GetAdjustedJumpingMP(false)) { + info += "[" + GetAdjustedJumpingMP(false) + "]"; } - if( HasJumpBooster ) { + if (HasJumpBooster) { info += "/" + JumpBooster.ChatName(); } - if( CurPhysEnhance.IsMASC() || CurPhysEnhance.IsTSM() ) { + if (CurPhysEnhance.IsMASC() || CurPhysEnhance.IsTSM()) { info += " " + CurPhysEnhance.ChatName(); } info += ", "; @@ -1780,74 +1701,75 @@ public String GetChatInfo() { info += GetIntStruc().ChatName(); // Gyro - if ( ! GetGyro().LookupName().equals( "Standard Gyro" ) ) { + if (!GetGyro().LookupName().equals("Standard Gyro")) { info += ", " + GetGyro().ChatName(); } - info += "; "; + info += "; "; // MechArmor - info += GetArmor().GetTonnage() + "T/" + Math.round(GetArmor().GetCoverage()) + "% " + GetArmor().ChatName() + "; "; + info += GetArmor().GetTonnage() + "T/" + Math.round(GetArmor().GetCoverage()) + "% " + GetArmor().ChatName() + + "; "; // heat sinks info += GetHeatSinks().GetNumHS() + " " + GetHeatSinks().ChatName() + "; "; - //Weapons and Equip + // Weapons and Equip Hashtable list = new Hashtable(); abPlaceable item; - for( int i = 0; i < CurLoadout.GetNonCore().size(); i++ ) { - item = (abPlaceable) CurLoadout.GetNonCore().get( i ); - if( ! ( item instanceof Ammunition ) ) { - if ( list.containsKey( item.ChatName() ) ) { - int curVal = (Integer) list.get( item.ChatName() ).intValue(); + for (int i = 0; i < CurLoadout.GetNonCore().size(); i++) { + item = (abPlaceable) CurLoadout.GetNonCore().get(i); + if (!(item instanceof Ammunition)) { + if (list.containsKey(item.ChatName())) { + int curVal = (Integer) list.get(item.ChatName()).intValue(); curVal++; - list.remove( item.ChatName() ); - list.put( item.ChatName(), curVal ); + list.remove(item.ChatName()); + list.put(item.ChatName(), curVal); } else { - list.put( item.ChatName(), new Integer( 1 ) ); + list.put(item.ChatName(), Integer.valueOf(1)); } } } - Enumeration e = list.keys(); - while( e.hasMoreElements() ) { + Enumeration e = list.keys(); + while (e.hasMoreElements()) { String name = (String) e.nextElement(); int count = (Integer) list.get(name).intValue(); info += count + " " + name + ", "; } - if( UsingTC() ) { + if (UsingTC()) { info += GetTC().ChatName() + ", "; } - if( HasNullSig() ) { + if (HasNullSig()) { info += NullSig.ChatName() + ", "; } - if( HasChameleon() ) { + if (HasChameleon()) { info += Chameleon.ChatName() + ", "; } - if( HasBlueShield() ) { + if (HasBlueShield()) { info += BlueShield.ChatName() + ", "; } - if( HasVoidSig() ) { + if (HasVoidSig()) { info += VoidSig.ChatName() + ", "; } - if( HasPartialWing ) { + if (HasPartialWing) { info += "PartWing, "; } - return info.trim().substring( 0, info.length() - 2 ); + return info.trim().substring(0, info.length() - 2); } public int GetDeprecatedLevel() { // returns the mech's "level" according to the older rules // this is used by Solaris7.com - if( GetRulesLevel() >= AvailableCode.RULES_ADVANCED ) { + if (GetRulesLevel() >= AvailableCode.RULES_ADVANCED) { return 3; } else { - if( MainLoadout.GetTechBase() == AvailableCode.TECH_CLAN ) { + if (MainLoadout.GetTechBase() == AvailableCode.TECH_CLAN) { return 2; } - if( GetAvailability().GetISSWCode() < 'F' ) { - if( GetHeatSinks().IsDouble() ) { + if (GetAvailability().GetISSWCode() < 'F') { + if (GetHeatSinks().IsDouble()) { return 2; } else { return 1; @@ -1860,13 +1782,13 @@ public int GetDeprecatedLevel() { public int GetMegaMekLevel() { // returns the mech's tech level according to MegaMek - switch( GetRulesLevel() ) { + switch (GetRulesLevel()) { case AvailableCode.RULES_TOURNAMENT: - if( CurLoadout.GetTechBase() == AvailableCode.TECH_CLAN ) { + if (CurLoadout.GetTechBase() == AvailableCode.TECH_CLAN) { return 2; } - if( GetAvailability().GetISSWCode() < 'F' ) { - if( GetHeatSinks().IsDouble() ) { + if (GetAvailability().GetISSWCode() < 'F') { + if (GetHeatSinks().IsDouble()) { return 2; } else { return 1; @@ -1908,29 +1830,30 @@ public String GetSSWImage() { return SSWImage; } - public void SetEngineRating( int rate ) throws Exception { + public void SetEngineRating(int rate) throws Exception { int oldrate = CurEngine.GetRating(); - if( CurEngine.CanSupportRating( rate, this ) ) { - if( ( CurEngine.GetRating() < 405 && rate > 400 ) || ( CurEngine.GetRating() > 400 && rate < 405 ) ) { - MainLoadout.Remove( CurEngine ); - CurEngine.SetRating( rate ); - if( ! CurEngine.Place( MainLoadout ) ) { - MainLoadout.Remove( CurEngine ); - CurEngine.SetRating( oldrate ); + if (CurEngine.CanSupportRating(rate, this)) { + if ((CurEngine.GetRating() < 405 && rate > 400) || (CurEngine.GetRating() > 400 && rate < 405)) { + MainLoadout.Remove(CurEngine); + CurEngine.SetRating(rate); + if (!CurEngine.Place(MainLoadout)) { + MainLoadout.Remove(CurEngine); + CurEngine.SetRating(oldrate); WalkMP = (int) oldrate / Tonnage; - CurEngine.Place( MainLoadout ); - throw new Exception( "The engine cannot support the new rating of " + rate + "\nbecause there is no room for the engine!" ); + CurEngine.Place(MainLoadout); + throw new Exception("The engine cannot support the new rating of " + rate + + "\nbecause there is no room for the engine!"); } WalkMP = (int) rate / Tonnage; } else { - CurEngine.SetRating( rate ); + CurEngine.SetRating(rate); WalkMP = (int) rate / Tonnage; } } else { - SetWalkMP( 1 ); + SetWalkMP(1); } - SetChanged( true ); + SetChanged(true); } public int GetWalkingMP() { @@ -1938,87 +1861,102 @@ public int GetWalkingMP() { } public int GetMaxWalkMP() { - if( CurEngine.IsPrimitive() ) { - return (int) Math.floor( 400 / Tonnage / 1.2 ); - } else if( CurEngine.CanSupportRating( 500, this ) ) { - return (int) Math.floor( 500 / Tonnage ); + if (CurEngine.IsPrimitive()) { + return (int) Math.floor(400 / Tonnage / 1.2); + } else if (CurEngine.CanSupportRating(500, this)) { + return (int) Math.floor(500 / Tonnage); } else { - return (int) Math.floor( 400 / Tonnage ); + return (int) Math.floor(400 / Tonnage); } } - public int GetAdjustedWalkingMP( boolean BV, boolean MASCTSM ) { + public int GetAdjustedWalkingMP(boolean BV, boolean MASCTSM) { int retval = WalkMP; - retval += GetTotalModifiers( BV, MASCTSM ).WalkingAdder(); - if( retval < 0 ) { return 0; } + retval += GetTotalModifiers(BV, MASCTSM).WalkingAdder(); + if (retval < 0) { + return 0; + } return retval; } - public void SetWalkMP( int mp ) throws Exception { + public void SetWalkMP(int mp) throws Exception { int MaxWalk = GetMaxWalkMP(); int oldrate = CurEngine.GetRating(); - if( mp > MaxWalk ) { mp = MaxWalk; } - if( mp < 1 ) { mp = 1; } + if (mp > MaxWalk) { + mp = MaxWalk; + } + if (mp < 1) { + mp = 1; + } int rate = mp * Tonnage; - if( ( oldrate < 405 && rate > 400 ) || ( oldrate > 400 && rate < 405 ) ) { - MainLoadout.Remove( CurEngine ); - CurEngine.SetRating( rate ); - if( ! CurEngine.Place( MainLoadout ) ) { - MainLoadout.Remove( CurEngine ); - CurEngine.SetRating( oldrate ); + if ((oldrate < 405 && rate > 400) || (oldrate > 400 && rate < 405)) { + MainLoadout.Remove(CurEngine); + CurEngine.SetRating(rate); + if (!CurEngine.Place(MainLoadout)) { + MainLoadout.Remove(CurEngine); + CurEngine.SetRating(oldrate); WalkMP = (int) oldrate / Tonnage; - throw new Exception( "The engine cannot support the new rating of " + rate + "\nbecause there is no room for the engine!\nEngine reset to the previous rating." ); + throw new Exception("The engine cannot support the new rating of " + rate + + "\nbecause there is no room for the engine!\nEngine reset to the previous rating."); } else { WalkMP = mp; } } else { - CurEngine.SetRating( rate ); + CurEngine.SetRating(rate); WalkMP = mp; } - SetChanged( true ); + SetChanged(true); } public int GetRunningMP() { - return (int) Math.floor( GetWalkingMP() * 1.5 + 0.5 ); + return (int) Math.floor(GetWalkingMP() * 1.5 + 0.5); } - public int GetRunningMP( int MiniMult ) { - return (int) Math.floor( ( GetWalkingMP() * MiniMult ) * 1.5 + 0.5 ); + public int GetRunningMP(int MiniMult) { + return (int) Math.floor((GetWalkingMP() * MiniMult) * 1.5 + 0.5); } - public int GetAdjustedRunningMP( boolean BV, boolean MASCTSM ) { + public int GetAdjustedRunningMP(boolean BV, boolean MASCTSM) { // this had to become more complicated because of the peculiar - // idiosyncracies of the BV system. Stupid. - MechModifier m = GetTotalModifiers( BV, MASCTSM ); - int WalkValue = GetAdjustedWalkingMP( BV, MASCTSM ); + // idiosyncracies of the BV system. Stupid. + MechModifier m = GetTotalModifiers(BV, MASCTSM); + int WalkValue = GetAdjustedWalkingMP(BV, MASCTSM); double Multiplier = 1.5 + m.RunningMultiplier(); - int retval = (int) Math.floor( WalkValue * Multiplier + 0.5 ) + m.RunningAdder(); - if( retval < 0 ) { return 0; } + int retval = (int) Math.floor(WalkValue * Multiplier + 0.5) + m.RunningAdder(); + if (retval < 0) { + return 0; + } return retval; } - public int GetAdjustedRunningMP( boolean BV, boolean MASCTSM, int MiniMult ) { + public int GetAdjustedRunningMP(boolean BV, boolean MASCTSM, int MiniMult) { // this had to become more complicated because of the peculiar - // idiosyncracies of the BV system. Stupid. + // idiosyncracies of the BV system. Stupid. // this method provided for miniatures-scale printing - MechModifier m = GetTotalModifiers( BV, MASCTSM ); - int WalkValue = GetAdjustedWalkingMP( BV, MASCTSM ) * MiniMult; + MechModifier m = GetTotalModifiers(BV, MASCTSM); + int WalkValue = GetAdjustedWalkingMP(BV, MASCTSM) * MiniMult; double Multiplier = 1.5 + m.RunningMultiplier(); - int retval = (int) Math.floor( WalkValue * Multiplier + 0.5 ) + m.RunningAdder(); - if( retval < 0 ) { return 0; } + int retval = (int) Math.floor(WalkValue * Multiplier + 0.5) + m.RunningAdder(); + if (retval < 0) { + return 0; + } return retval; } - public int GetAdjustedJumpingMP( boolean BV ) { + public int GetAdjustedJumpingMP(boolean BV) { // Large Shields restrict jumping ability but do affect BV movement modifiers - if ( ! BV && ! GetTotalModifiers( BV, true ).CanJump() ) { + if (!BV && !GetTotalModifiers(BV, true).CanJump()) { return 0; } else { int retval = CurLoadout.GetJumpJets().GetNumJJ(); - if( HasPartialWing && retval > 0 &! CurLoadout.GetJumpJets().IsUMU() ) { retval += Wing.GetJumpBonus(); } - retval += GetTotalModifiers( BV, true ).JumpingAdder(); - if( retval < 0 ) { return 0; } + if (HasPartialWing && retval > 0 & !CurLoadout.GetJumpJets().IsUMU()) { + retval += Wing.GetJumpBonus(); + } + retval += GetTotalModifiers(BV, true).JumpingAdder(); + if (retval < 0) { + return 0; + } return retval; } } @@ -2031,14 +1969,16 @@ public int GetJumpBoosterMP() { return JumpBooster.GetMP(); } - public int GetAdjustedBoosterMP( boolean BV ) { + public int GetAdjustedBoosterMP(boolean BV) { // Large Shields restrict jumping ability but do affect BV movement modifiers - if ( ! BV && ! GetTotalModifiers( BV, true ).CanJump() ) { + if (!BV && !GetTotalModifiers(BV, true).CanJump()) { return 0; } else { int retval = JumpBooster.GetMP(); - retval += GetTotalModifiers( BV, true ).JumpingAdder(); - if( retval < 0 ) { return 0; } + retval += GetTotalModifiers(BV, true).JumpingAdder(); + if (retval < 0) { + return 0; + } return retval; } } @@ -2050,7 +1990,7 @@ public double GetCurrentTons() { result += CurEngine.GetTonnage(); result += CurGyro.GetTonnage(); result += CurCockpit.GetTonnage(); - if( HasCommandConsole() ) { + if (HasCommandConsole()) { result += CommandConsole.GetTonnage(); } result += GetHeatSinks().GetTonnage(); @@ -2058,45 +1998,109 @@ public double GetCurrentTons() { result += GetJumpJets().GetTonnage(); result += CurArmor.GetTonnage(); result += GetActuators().GetTonnage(); - if( HasCTCase() ) { result += CurLoadout.GetCTCase().GetTonnage(); } - if( HasLTCase() ) { result += CurLoadout.GetCTCase().GetTonnage(); } - if( HasRTCase() ) { result += CurLoadout.GetCTCase().GetTonnage(); } - if( CurLoadout.HasHDCASEII() ) { result += CurLoadout.GetHDCaseII().GetTonnage(); } - if( CurLoadout.HasCTCASEII() ) { result += CurLoadout.GetCTCaseII().GetTonnage(); } - if( CurLoadout.HasLTCASEII() ) { result += CurLoadout.GetLTCaseII().GetTonnage(); } - if( CurLoadout.HasRTCASEII() ) { result += CurLoadout.GetRTCaseII().GetTonnage(); } - if( CurLoadout.HasLACASEII() ) { result += CurLoadout.GetLACaseII().GetTonnage(); } - if( CurLoadout.HasRACASEII() ) { result += CurLoadout.GetRACaseII().GetTonnage(); } - if( CurLoadout.HasLLCASEII() ) { result += CurLoadout.GetLLCaseII().GetTonnage(); } - if( CurLoadout.HasRLCASEII() ) { result += CurLoadout.GetRLCaseII().GetTonnage(); } - if( CurLoadout.HasHDTurret() ) { result += CurLoadout.GetHDTurret().GetTonnage(); } - if( CurLoadout.HasLTTurret() ) { result += CurLoadout.GetLTTurret().GetTonnage(); } - if( CurLoadout.HasRTTurret() ) { result += CurLoadout.GetRTTurret().GetTonnage(); } - if( CurLoadout.UsingTC() ) { result += GetTC().GetTonnage(); } - if( CurLoadout.UsingDumper() ) {result += GetDumper().GetTonnage(); } - if( ! CurEngine.IsNuclear() ) { result += CurLoadout.GetPowerAmplifier().GetTonnage(); } - if( HasBlueShield ) { result += BlueShield.GetTonnage(); } - if( HasVoidSig ) { result += VoidSig.GetTonnage(); } - if( HasNullSig ) { result += NullSig.GetTonnage(); } - if( HasChameleon ) { result += Chameleon.GetTonnage(); } - if( HasPartialWing ) { result += Wing.GetTonnage(); } - if( HasJumpBooster ) { result += JumpBooster.GetTonnage(); } - if( CurLoadout.HasSupercharger() ) { result += CurLoadout.GetSupercharger().GetTonnage(); } - if( HasEnviroSealing ) { result += EnviroSealing.GetTonnage(); } - if( HasEjectionSeat ) { result += EjectionSeat.GetTonnage(); } - if( HasTracks) { result += Tracks.GetTonnage(); } - if( Quad ) { - if( HasLegAES ) { result += RLAES.GetTonnage() * 4.0; } + if (HasCTCase()) { + result += CurLoadout.GetCTCase().GetTonnage(); + } + if (HasLTCase()) { + result += CurLoadout.GetCTCase().GetTonnage(); + } + if (HasRTCase()) { + result += CurLoadout.GetCTCase().GetTonnage(); + } + if (CurLoadout.HasHDCASEII()) { + result += CurLoadout.GetHDCaseII().GetTonnage(); + } + if (CurLoadout.HasCTCASEII()) { + result += CurLoadout.GetCTCaseII().GetTonnage(); + } + if (CurLoadout.HasLTCASEII()) { + result += CurLoadout.GetLTCaseII().GetTonnage(); + } + if (CurLoadout.HasRTCASEII()) { + result += CurLoadout.GetRTCaseII().GetTonnage(); + } + if (CurLoadout.HasLACASEII()) { + result += CurLoadout.GetLACaseII().GetTonnage(); + } + if (CurLoadout.HasRACASEII()) { + result += CurLoadout.GetRACaseII().GetTonnage(); + } + if (CurLoadout.HasLLCASEII()) { + result += CurLoadout.GetLLCaseII().GetTonnage(); + } + if (CurLoadout.HasRLCASEII()) { + result += CurLoadout.GetRLCaseII().GetTonnage(); + } + if (CurLoadout.HasHDTurret()) { + result += CurLoadout.GetHDTurret().GetTonnage(); + } + if (CurLoadout.HasLTTurret()) { + result += CurLoadout.GetLTTurret().GetTonnage(); + } + if (CurLoadout.HasRTTurret()) { + result += CurLoadout.GetRTTurret().GetTonnage(); + } + if (CurLoadout.UsingTC()) { + result += GetTC().GetTonnage(); + } + if (CurLoadout.UsingDumper()) { + result += GetDumper().GetTonnage(); + } + if (!CurEngine.IsNuclear()) { + result += CurLoadout.GetPowerAmplifier().GetTonnage(); + } + if (HasBlueShield) { + result += BlueShield.GetTonnage(); + } + if (HasVoidSig) { + result += VoidSig.GetTonnage(); + } + if (HasNullSig) { + result += NullSig.GetTonnage(); + } + if (HasChameleon) { + result += Chameleon.GetTonnage(); + } + if (HasPartialWing) { + result += Wing.GetTonnage(); + } + if (HasJumpBooster) { + result += JumpBooster.GetTonnage(); + } + if (CurLoadout.HasSupercharger()) { + result += CurLoadout.GetSupercharger().GetTonnage(); + } + if (HasEnviroSealing) { + result += EnviroSealing.GetTonnage(); + } + if (HasEjectionSeat) { + result += EjectionSeat.GetTonnage(); + } + if (HasTracks) { + result += Tracks.GetTonnage(); + } + if (Quad) { + if (HasLegAES) { + result += RLAES.GetTonnage() * 4.0; + } } else { - if( HasRAAES ) { result += CurRAAES.GetTonnage(); } - if( HasLAAES ) { result += CurLAAES.GetTonnage(); } - if( HasLegAES ) { result += RLAES.GetTonnage() * 2.0; } + if (HasRAAES) { + result += CurRAAES.GetTonnage(); + } + if (HasLAAES) { + result += CurLAAES.GetTonnage(); + } + if (HasLegAES) { + result += RLAES.GetTonnage() * 2.0; + } + } + if (CurLoadout.HasBoobyTrap()) { + result += CurLoadout.GetBoobyTrap().GetTonnage(); } - if ( CurLoadout.HasBoobyTrap() ) { result += CurLoadout.GetBoobyTrap().GetTonnage(); } - ArrayList v = CurLoadout.GetNonCore(); - if( v.size() > 0 ) { - for( int i = 0; i < v.size(); i++ ) { + ArrayList v = CurLoadout.GetNonCore(); + if (v.size() > 0) { + for (int i = 0; i < v.size(); i++) { result += ((abPlaceable) v.get(i)).GetTonnage(); } } @@ -2111,7 +2115,7 @@ public double GetCurrentDryTons() { result += CurEngine.GetTonnage(); result += CurGyro.GetTonnage(); result += CurCockpit.GetTonnage(); - if( HasCommandConsole() ) { + if (HasCommandConsole()) { result += CommandConsole.GetTonnage(); } result += GetHeatSinks().GetTonnage(); @@ -2119,43 +2123,101 @@ public double GetCurrentDryTons() { result += GetJumpJets().GetTonnage(); result += CurArmor.GetTonnage(); result += GetActuators().GetTonnage(); - if( HasCTCase() ) { result += CurLoadout.GetCTCase().GetTonnage(); } - if( HasLTCase() ) { result += CurLoadout.GetCTCase().GetTonnage(); } - if( HasRTCase() ) { result += CurLoadout.GetCTCase().GetTonnage(); } - if( CurLoadout.HasHDCASEII() ) { result += CurLoadout.GetHDCaseII().GetTonnage(); } - if( CurLoadout.HasCTCASEII() ) { result += CurLoadout.GetCTCaseII().GetTonnage(); } - if( CurLoadout.HasLTCASEII() ) { result += CurLoadout.GetLTCaseII().GetTonnage(); } - if( CurLoadout.HasRTCASEII() ) { result += CurLoadout.GetRTCaseII().GetTonnage(); } - if( CurLoadout.HasLACASEII() ) { result += CurLoadout.GetLACaseII().GetTonnage(); } - if( CurLoadout.HasRACASEII() ) { result += CurLoadout.GetRACaseII().GetTonnage(); } - if( CurLoadout.HasLLCASEII() ) { result += CurLoadout.GetLLCaseII().GetTonnage(); } - if( CurLoadout.HasRLCASEII() ) { result += CurLoadout.GetRLCaseII().GetTonnage(); } - if( CurLoadout.HasHDTurret() ) { result += CurLoadout.GetHDTurret().GetTonnage(); } - if( CurLoadout.HasLTTurret() ) { result += CurLoadout.GetLTTurret().GetTonnage(); } - if( CurLoadout.HasRTTurret() ) { result += CurLoadout.GetRTTurret().GetTonnage(); } - if( CurLoadout.UsingTC() ) { result += GetTC().GetTonnage(); } - if( ! CurEngine.IsNuclear() ) { result += CurLoadout.GetPowerAmplifier().GetTonnage(); } - if( HasBlueShield ) { result += BlueShield.GetTonnage(); } - if( HasVoidSig ) { result += VoidSig.GetTonnage(); } - if( HasNullSig ) { result += NullSig.GetTonnage(); } - if( HasChameleon ) { result += Chameleon.GetTonnage(); } - if( HasPartialWing ) { result += Wing.GetTonnage(); } - if( HasJumpBooster ) { result += JumpBooster.GetTonnage(); } - if( CurLoadout.HasSupercharger() ) { result += CurLoadout.GetSupercharger().GetTonnage(); } - if( HasEnviroSealing ) { result += EnviroSealing.GetTonnage(); } - if( HasEjectionSeat ) { result += EjectionSeat.GetTonnage(); } - if( Quad ) { - if( HasLegAES ) { result += RLAES.GetTonnage() * 4.0; } + if (HasCTCase()) { + result += CurLoadout.GetCTCase().GetTonnage(); + } + if (HasLTCase()) { + result += CurLoadout.GetCTCase().GetTonnage(); + } + if (HasRTCase()) { + result += CurLoadout.GetCTCase().GetTonnage(); + } + if (CurLoadout.HasHDCASEII()) { + result += CurLoadout.GetHDCaseII().GetTonnage(); + } + if (CurLoadout.HasCTCASEII()) { + result += CurLoadout.GetCTCaseII().GetTonnage(); + } + if (CurLoadout.HasLTCASEII()) { + result += CurLoadout.GetLTCaseII().GetTonnage(); + } + if (CurLoadout.HasRTCASEII()) { + result += CurLoadout.GetRTCaseII().GetTonnage(); + } + if (CurLoadout.HasLACASEII()) { + result += CurLoadout.GetLACaseII().GetTonnage(); + } + if (CurLoadout.HasRACASEII()) { + result += CurLoadout.GetRACaseII().GetTonnage(); + } + if (CurLoadout.HasLLCASEII()) { + result += CurLoadout.GetLLCaseII().GetTonnage(); + } + if (CurLoadout.HasRLCASEII()) { + result += CurLoadout.GetRLCaseII().GetTonnage(); + } + if (CurLoadout.HasHDTurret()) { + result += CurLoadout.GetHDTurret().GetTonnage(); + } + if (CurLoadout.HasLTTurret()) { + result += CurLoadout.GetLTTurret().GetTonnage(); + } + if (CurLoadout.HasRTTurret()) { + result += CurLoadout.GetRTTurret().GetTonnage(); + } + if (CurLoadout.UsingTC()) { + result += GetTC().GetTonnage(); + } + if (!CurEngine.IsNuclear()) { + result += CurLoadout.GetPowerAmplifier().GetTonnage(); + } + if (HasBlueShield) { + result += BlueShield.GetTonnage(); + } + if (HasVoidSig) { + result += VoidSig.GetTonnage(); + } + if (HasNullSig) { + result += NullSig.GetTonnage(); + } + if (HasChameleon) { + result += Chameleon.GetTonnage(); + } + if (HasPartialWing) { + result += Wing.GetTonnage(); + } + if (HasJumpBooster) { + result += JumpBooster.GetTonnage(); + } + if (CurLoadout.HasSupercharger()) { + result += CurLoadout.GetSupercharger().GetTonnage(); + } + if (HasEnviroSealing) { + result += EnviroSealing.GetTonnage(); + } + if (HasEjectionSeat) { + result += EjectionSeat.GetTonnage(); + } + if (Quad) { + if (HasLegAES) { + result += RLAES.GetTonnage() * 4.0; + } } else { - if( HasRAAES ) { result += CurRAAES.GetTonnage(); } - if( HasLAAES ) { result += CurLAAES.GetTonnage(); } - if( HasLegAES ) { result += RLAES.GetTonnage() * 2.0; } + if (HasRAAES) { + result += CurRAAES.GetTonnage(); + } + if (HasLAAES) { + result += CurLAAES.GetTonnage(); + } + if (HasLegAES) { + result += RLAES.GetTonnage() * 2.0; + } } - ArrayList v = CurLoadout.GetNonCore(); - if( v.size() > 0 ) { - for( int i = 0; i < v.size(); i++ ) { - if( ! ( v.get( i ) instanceof Ammunition ) ) { + ArrayList v = CurLoadout.GetNonCore(); + if (v.size() > 0) { + for (int i = 0; i < v.size(); i++) { + if (!(v.get(i) instanceof Ammunition)) { result += ((abPlaceable) v.get(i)).GetTonnage(); } } @@ -2168,8 +2230,8 @@ public int GetMaxHeat() { int result = 0; result += GetMovementHeat(); result += GetWeaponHeat(); - if( ! Prefs.getBoolean( "HeatExcludeSystems", false ) ) { - result += GetTotalModifiers( false, true ).HeatAdder(); + if (!Prefs.getBoolean("HeatExcludeSystems", false)) { + result += GetTotalModifiers(false, true).HeatAdder(); } return result; } @@ -2180,8 +2242,8 @@ public int GetJumpingHeat() { int minjumpheat = 3 * CurEngine.JumpingHeatMultiplier(); double heatperjj = 0.0; - if( GetJumpJets().IsImproved() ) { - if (GetJumpJets().IsProto()){ + if (GetJumpJets().IsImproved()) { + if (GetJumpJets().IsProto()) { minjumpheat = 6 * CurEngine.JumpingHeatMultiplier(); heatperjj = 2.0 * CurEngine.JumpingHeatMultiplier(); } else { @@ -2191,15 +2253,19 @@ public int GetJumpingHeat() { heatperjj = 1.0 * CurEngine.JumpingHeatMultiplier(); } - if( GetJumpJets().GetNumJJ() > 0 ) { - jump = (int) ( GetJumpJets().GetNumJJ() * heatperjj + 0.51f ); - if( jump < minjumpheat ) { jump = minjumpheat; } + if (GetJumpJets().GetNumJJ() > 0) { + jump = (int) (GetJumpJets().GetNumJJ() * heatperjj + 0.51f); + if (jump < minjumpheat) { + jump = minjumpheat; + } - if ( GetJumpJets().IsUMU() ) { return 1 * CurEngine.JumpingHeatMultiplier(); } + if (GetJumpJets().IsUMU()) { + return 1 * CurEngine.JumpingHeatMultiplier(); + } } - if( Prefs.getBoolean( "HeatExcludeJumpMP", false ) ) { - if( Prefs.getBoolean( "HeatExcludeAllMP", false ) ) { + if (Prefs.getBoolean("HeatExcludeJumpMP", false)) { + if (Prefs.getBoolean("HeatExcludeAllMP", false)) { walk = CurEngine.MinimumHeat(); jump = 0; } else { @@ -2207,20 +2273,21 @@ public int GetJumpingHeat() { } } - if( jump > walk ) { + if (jump > walk) { return jump; } else { return 0; } } + public int GetMovementHeat() { int walk = CurEngine.MaxMovementHeat(); int jump = 0; int minjumpheat = 3 * CurEngine.JumpingHeatMultiplier(); double heatperjj = 0.0; - if( GetJumpJets().IsImproved() ) { - if (GetJumpJets().IsProto()){ + if (GetJumpJets().IsImproved()) { + if (GetJumpJets().IsProto()) { minjumpheat = 6 * CurEngine.JumpingHeatMultiplier(); heatperjj = 2.0 * CurEngine.JumpingHeatMultiplier(); } else { @@ -2230,15 +2297,19 @@ public int GetMovementHeat() { heatperjj = 1.0 * CurEngine.JumpingHeatMultiplier(); } - if( GetJumpJets().GetNumJJ() > 0 ) { - jump = (int) ( GetJumpJets().GetNumJJ() * heatperjj + 0.51f ); - if( jump < minjumpheat ) { jump = minjumpheat; } + if (GetJumpJets().GetNumJJ() > 0) { + jump = (int) (GetJumpJets().GetNumJJ() * heatperjj + 0.51f); + if (jump < minjumpheat) { + jump = minjumpheat; + } - if ( GetJumpJets().IsUMU() ) { jump = 1 * CurEngine.JumpingHeatMultiplier(); } + if (GetJumpJets().IsUMU()) { + jump = 1 * CurEngine.JumpingHeatMultiplier(); + } } - if( Prefs.getBoolean( "HeatExcludeJumpMP", false ) ) { - if( Prefs.getBoolean( "HeatExcludeAllMP", false ) ) { + if (Prefs.getBoolean("HeatExcludeJumpMP", false)) { + if (Prefs.getBoolean("HeatExcludeAllMP", false)) { walk = CurEngine.MinimumHeat(); jump = 0; } else { @@ -2246,7 +2317,7 @@ public int GetMovementHeat() { } } - if( jump > walk ) { + if (jump > walk) { return jump; } else { return walk; @@ -2260,8 +2331,8 @@ public int GetBVMovementHeat() { int minjumpheat = 3 * CurEngine.JumpingHeatMultiplier(); double heatperjj = 0.0; - if( GetJumpJets().IsImproved() ) { - if (GetJumpJets().IsProto()){ + if (GetJumpJets().IsImproved()) { + if (GetJumpJets().IsProto()) { minjumpheat = 6 * CurEngine.JumpingHeatMultiplier(); heatperjj = 2.0 * CurEngine.JumpingHeatMultiplier(); } else { @@ -2271,26 +2342,27 @@ public int GetBVMovementHeat() { heatperjj = 1.0 * CurEngine.JumpingHeatMultiplier(); } - if( GetJumpJets().GetNumJJ() > 0 ) { - jump = (int) ( GetJumpJets().GetNumJJ() * heatperjj + 0.51f ); - if( jump < minjumpheat ) { jump = minjumpheat; } + if (GetJumpJets().GetNumJJ() > 0) { + jump = (int) (GetJumpJets().GetNumJJ() * heatperjj + 0.51f); + if (jump < minjumpheat) { + jump = minjumpheat; + } - if ( GetJumpJets().IsUMU() ) { jump = 1 * CurEngine.JumpingHeatMultiplier(); } + if (GetJumpJets().IsUMU()) { + jump = 1 * CurEngine.JumpingHeatMultiplier(); + } } - if( jump > walk ) { + if (jump > walk) { return jump; } else { return walk; } } - public int GetWeaponHeat() - { - return GetWeaponHeat(Prefs.getBoolean("HeatExcludeOS", false), - Prefs.getBoolean( "HeatExcludeRear", false), - Prefs.getBoolean( "HeatACFullRate", true), - Prefs.getBoolean( "HeatExcludeEquips", false)); + public int GetWeaponHeat() { + return GetWeaponHeat(Prefs.getBoolean("HeatExcludeOS", false), Prefs.getBoolean("HeatExcludeRear", false), + Prefs.getBoolean("HeatACFullRate", true), Prefs.getBoolean("HeatExcludeEquips", false)); } /** @@ -2299,48 +2371,46 @@ public int GetWeaponHeat() * @param ExcludeRear * @param FullRate * @param ExcludeEquip - * @return int representing the total weapon heat limited by the exclusions provided + * @return int representing the total weapon heat limited by the exclusions + * provided */ - public int GetWeaponHeat(boolean ExcludeOS, - boolean ExcludeRear, - boolean FullRate, - boolean ExcludeEquip) { - // returns the heat generated by weaponry and equipment that are not + public int GetWeaponHeat(boolean ExcludeOS, boolean ExcludeRear, boolean FullRate, boolean ExcludeEquip) { + // returns the heat generated by weaponry and equipment that are not // core components int result = 0; - ArrayList v = CurLoadout.GetNonCore(); - if( v.size() <= 0 ) { + ArrayList v = CurLoadout.GetNonCore(); + if (v.size() <= 0) { return result; } abPlaceable a; - for( int i = 0; i < v.size(); i++ ) { - a = (abPlaceable) v.get( i ); - if( a instanceof ifWeapon ) { + for (int i = 0; i < v.size(); i++) { + a = (abPlaceable) v.get(i); + if (a instanceof ifWeapon) { boolean OS = ((ifWeapon) a).IsOneShot(); boolean Rear = a.IsMountedRear(); int rate = 1; - if( ( a instanceof RangedWeapon ) && FullRate ) { - if( ((RangedWeapon) a).IsUltra() ) { + if ((a instanceof RangedWeapon) && FullRate) { + if (((RangedWeapon) a).IsUltra()) { rate = 2; - } else if( ((RangedWeapon) a).IsRotary() ) { + } else if (((RangedWeapon) a).IsRotary()) { rate = 6; } } - if( ExcludeOS || ExcludeRear ) { - if( ExcludeOS ) { - if( ExcludeRear ) { - if( ! Rear &! OS ) { + if (ExcludeOS || ExcludeRear) { + if (ExcludeOS) { + if (ExcludeRear) { + if (!Rear & !OS) { result += ((ifWeapon) a).GetHeat() * rate; } } else { - if( ! OS ) { + if (!OS) { result += ((ifWeapon) a).GetHeat() * rate; } } } else { - if( ExcludeRear ) { - if( ! Rear ) { + if (ExcludeRear) { + if (!Rear) { result += ((ifWeapon) a).GetHeat() * rate; } } else { @@ -2350,8 +2420,8 @@ public int GetWeaponHeat(boolean ExcludeOS, } else { result += ((ifWeapon) a).GetHeat() * rate; } - } else if( a instanceof Equipment ) { - if( ! ExcludeEquip ) { + } else if (a instanceof Equipment) { + if (!ExcludeEquip) { result += ((Equipment) a).GetHeat(); } } @@ -2364,18 +2434,18 @@ public double GetBVWeaponHeat() { // this returns the heat generated by weapons for BV purposes as the // normal method is governed by user preferences double result = 0; - ArrayList v = CurLoadout.GetNonCore(); - if( v.size() <= 0 ) { + ArrayList v = CurLoadout.GetNonCore(); + if (v.size() <= 0) { return result; } abPlaceable a; - for( int i = 0; i < v.size(); i++ ) { - a = (abPlaceable) v.get( i ); - if( a instanceof ifWeapon ) { + for (int i = 0; i < v.size(); i++) { + a = (abPlaceable) v.get(i); + if (a instanceof ifWeapon) { result += ((ifWeapon) a).GetBVHeat(); } - if( a instanceof MGArray ) { + if (a instanceof MGArray) { result += ((MGArray) a).GetBVHeat(); } } @@ -2386,8 +2456,8 @@ public double GetBVWeaponHeat() { public int GetCurrentBV() { // returns the final battle value of the mech double CockpitBVMod = HasDroneOS ? .95 : CurCockpit.BVMod(); - - return (int) Math.floor( CockpitBVMod * ( GetDefensiveBV() + GetOffensiveBV() ) + 0.5 ); + + return (int) Math.floor(CockpitBVMod * (GetDefensiveBV() + GetOffensiveBV()) + 0.5); } public double GetDefensiveBV() { @@ -2407,7 +2477,7 @@ public double GetUnmodifiedDefensiveBV() { defresult += GetDefensiveExcessiveAmmoPenalty(); defresult += GetExplosiveAmmoPenalty(); defresult += GetExplosiveWeaponPenalty(); - if( defresult < 1.0 ) { + if (defresult < 1.0) { defresult = 1.0; } @@ -2417,55 +2487,57 @@ public double GetUnmodifiedDefensiveBV() { public double GetDefensiveEquipBV() { // return the BV of all defensive equipment double result = 0.0; - ArrayList v = CurLoadout.GetNonCore(); + ArrayList v = CurLoadout.GetNonCore(); - for( int i = 0; i < v.size(); i++ ) { - result += ((abPlaceable) v.get( i )).GetDefensiveBV(); + for (int i = 0; i < v.size(); i++) { + result += ((abPlaceable) v.get(i)).GetDefensiveBV(); } - if( UsingTC() ) { + if (UsingTC()) { result += GetTC().GetDefensiveBV(); } // now get the defensive BV for any armored components that weren't // already covered. - if( CurLoadout.GetRulesLevel() >= AvailableCode.RULES_EXPERIMENTAL && CurLoadout.GetEra() >= AvailableCode.ERA_CLAN_INVASION ) { + if (CurLoadout.GetRulesLevel() >= AvailableCode.RULES_EXPERIMENTAL + && CurLoadout.GetEra() >= AvailableCode.ERA_CLAN_INVASION) { result += CurEngine.GetDefensiveBV(); result += CurCockpit.GetDefensiveBV(); - if (HasCommandConsole()) result += CommandConsole.GetDefensiveBV(); + if (HasCommandConsole()) + result += CommandConsole.GetDefensiveBV(); result += CurLoadout.GetActuators().GetDefensiveBV(); - if( HasNullSig() ) { + if (HasNullSig()) { result += NullSig.GetDefensiveBV(); } - if( HasChameleon() ) { + if (HasChameleon()) { result += Chameleon.GetDefensiveBV(); } - if( HasBlueShield() ) { + if (HasBlueShield()) { result += BlueShield.GetDefensiveBV(); } - if( HasVoidSig() ) { + if (HasVoidSig()) { result += VoidSig.GetDefensiveBV(); } - if( UsingPartialWing() ) { + if (UsingPartialWing()) { result += Wing.GetDefensiveBV(); } - if( UsingJumpBooster() ) { + if (UsingJumpBooster()) { result += JumpBooster.GetDefensiveBV(); } - if( HasEnviroSealing() ) { + if (HasEnviroSealing()) { result += EnviroSealing.GetDefensiveBV(); } - if( HasTracks() ) { + if (HasTracks()) { result += Tracks.GetDefensiveBV(); } - if( CurLoadout.HasSupercharger() ) { + if (CurLoadout.HasSupercharger()) { result += CurLoadout.GetSupercharger().GetDefensiveBV(); } - if( CurLoadout.HasLTTurret()){ + if (CurLoadout.HasLTTurret()) { result += CurLoadout.GetLTTurret().GetDefensiveBV(); } - if( CurLoadout.HasRTTurret()){ + if (CurLoadout.HasRTTurret()) { result += CurLoadout.GetRTTurret().GetDefensiveBV(); } - if( CurLoadout.HasHDTurret()){ + if (CurLoadout.HasHDTurret()) { result += CurLoadout.GetHDTurret().GetDefensiveBV(); } } @@ -2474,60 +2546,63 @@ public double GetDefensiveEquipBV() { public double GetDefensiveExcessiveAmmoPenalty() { double result = 0.0; - ArrayList v = CurLoadout.GetNonCore(); - ArrayList Ammo = new ArrayList(), - Wep = new ArrayList(); + ArrayList v = CurLoadout.GetNonCore(); + ArrayList Ammo = new ArrayList(), Wep = new ArrayList(); // do we even need to do this? - if( v.size() <= 0 ) { return result; } + if (v.size() <= 0) { + return result; + } // seperate out the ammo-using weapons and their ammunition - for( int i = 0; i < v.size(); i++ ) { - if( v.get( i ) instanceof Ammunition ) { - Ammo.add( v.get( i ) ); + for (int i = 0; i < v.size(); i++) { + if (v.get(i) instanceof Ammunition) { + Ammo.add(v.get(i)); } - if( v.get(i) instanceof Equipment ) { - if( ((Equipment) v.get( i )).HasAmmo() ) { - Wep.add( v.get( i ) ); + if (v.get(i) instanceof Equipment) { + if (((Equipment) v.get(i)).HasAmmo()) { + Wep.add(v.get(i)); } } } // do we need to continue? - if( Ammo.size() <= 0 ) { return result; } + if (Ammo.size() <= 0) { + return result; + } // for each weapon that uses ammo, total it's ammo BV and ensure it's - // not excessive. Add the BV to the running total. - while( Wep.size() > 0 ) { + // not excessive. Add the BV to the running total. + while (Wep.size() > 0) { // get the first item and check if anything else uses the same ammo - Equipment test = (Equipment) Wep.get( 0 ); - Wep.remove( test ); + Equipment test = (Equipment) Wep.get(0); + Wep.remove(test); Ammunition ammo = null; int NumWeps = 1; int NumAmmos = 0; - for( int i = Wep.size() - 1; i >= 0; i-- ) { - if( ((Equipment) Wep.get( i )).GetAmmoIndex() == test.GetAmmoIndex() ) { + for (int i = Wep.size() - 1; i >= 0; i--) { + if (((Equipment) Wep.get(i)).GetAmmoIndex() == test.GetAmmoIndex()) { NumWeps++; - Wep.remove( i ); + Wep.remove(i); } } // now check the number of ammunitions that this weapon uses - for( int i = 0; i < Ammo.size(); i++ ) { - if( ((Ammunition) Ammo.get(i)).GetAmmoIndex() == test.GetAmmoIndex() ) { - ammo = (Ammunition) Ammo.get( i ); + for (int i = 0; i < Ammo.size(); i++) { + if (((Ammunition) Ammo.get(i)).GetAmmoIndex() == test.GetAmmoIndex()) { + ammo = (Ammunition) Ammo.get(i); NumAmmos++; } } // now find out if the ammo is excessive - if( NumAmmos != 0 && ammo != null ) { - double ammoBV = ( NumAmmos * ammo.GetDefensiveBV() ); - if( ammoBV <= 0.0 ) { - ammoBV = ( NumAmmos * ammo.GetDefensiveBV() ); + if (NumAmmos != 0 && ammo != null) { + double ammoBV = (NumAmmos * ammo.GetDefensiveBV()); + if (ammoBV <= 0.0) { + ammoBV = (NumAmmos * ammo.GetDefensiveBV()); } - double wepBV = ( NumWeps * ((abPlaceable) test).GetDefensiveBV() ); - if( ammoBV > wepBV ) { + double wepBV = (NumWeps * ((abPlaceable) test).GetDefensiveBV()); + if (ammoBV > wepBV) { result -= ammoBV - wepBV; } } @@ -2538,102 +2613,105 @@ public double GetDefensiveExcessiveAmmoPenalty() { public double GetExplosiveAmmoPenalty() { double result = 0.0; - ArrayList v = CurLoadout.GetNonCore(); + ArrayList v = CurLoadout.GetNonCore(); abPlaceable p; - for( int i = 0; i < v.size(); i++ ) { - p = (abPlaceable) v.get( i ); - // Extended Fuel Tanks are to be treated just like explosive ammunition for BV calculation purposes + for (int i = 0; i < v.size(); i++) { + p = (abPlaceable) v.get(i); + // Extended Fuel Tanks are to be treated just like explosive ammunition for BV + // calculation purposes // https://bg.battletech.com/forums/index.php?topic=67275.0 - if((p instanceof Ammunition && ((Ammunition)p).IsExplosive()) || p instanceof ExtendedFuelTank) { - if( CurEngine.IsISXL() ) { - switch( CurLoadout.Find( p ) ) { + if ((p instanceof Ammunition && ((Ammunition) p).IsExplosive()) || p instanceof ExtendedFuelTank) { + if (CurEngine.IsISXL()) { + switch (CurLoadout.Find(p)) { case 0: - if( ! CurLoadout.HasHDCASEII() ) { + if (!CurLoadout.HasHDCASEII()) { result -= 15.0 * p.NumCrits(); } break; case 1: - if( ! CurLoadout.HasCTCASEII() ) { + if (!CurLoadout.HasCTCASEII()) { result -= 15.0 * p.NumCrits(); } break; case 2: - if( ! CurLoadout.HasLTCASEII() ) { + if (!CurLoadout.HasLTCASEII()) { result -= 15.0 * p.NumCrits(); } break; case 3: - if( ! CurLoadout.HasRTCASEII() ) { + if (!CurLoadout.HasRTCASEII()) { result -= 15.0 * p.NumCrits(); } break; case 4: - if (CurLoadout instanceof QuadLoadout && (! CurLoadout.HasLACASEII() )){ + if (CurLoadout instanceof QuadLoadout && (!CurLoadout.HasLACASEII())) { result -= 15.0 * p.NumCrits(); - } - else if( ! CurLoadout.HasLACASEII() &! CurLoadout.HasLTCASEII() &! CurLoadout.IsUsingClanCASE() ) { + } else if (!CurLoadout.HasLACASEII() & !CurLoadout.HasLTCASEII() + & !CurLoadout.IsUsingClanCASE()) { result -= 15.0 * p.NumCrits(); } break; case 5: - if (CurLoadout instanceof QuadLoadout && (! CurLoadout.HasRACASEII() )){ + if (CurLoadout instanceof QuadLoadout && (!CurLoadout.HasRACASEII())) { result -= 15.0 * p.NumCrits(); - } - else if( ! CurLoadout.HasRACASEII() &! CurLoadout.HasRTCASEII() &! CurLoadout.IsUsingClanCASE() ) { + } else if (!CurLoadout.HasRACASEII() & !CurLoadout.HasRTCASEII() + & !CurLoadout.IsUsingClanCASE()) { result -= 15.0 * p.NumCrits(); } break; case 6: - if( ! CurLoadout.HasLLCASEII() ) { + if (!CurLoadout.HasLLCASEII()) { result -= 15.0 * p.NumCrits(); } break; case 7: - if( ! CurLoadout.HasRLCASEII() ) { + if (!CurLoadout.HasRLCASEII()) { result -= 15.0 * p.NumCrits(); } break; } } else { - switch( CurLoadout.Find( p ) ) { + switch (CurLoadout.Find(p)) { case 0: - if( ! CurLoadout.HasHDCASEII() ) { + if (!CurLoadout.HasHDCASEII()) { result -= 15.0 * p.NumCrits(); } break; case 1: - if( ! CurLoadout.HasCTCASEII() ) { + if (!CurLoadout.HasCTCASEII()) { result -= 15.0 * p.NumCrits(); } break; case 2: - if( ! CurLoadout.HasLTCASEII() &! CurLoadout.HasLTCASE() &! CurLoadout.IsUsingClanCASE() ) { + if (!CurLoadout.HasLTCASEII() & !CurLoadout.HasLTCASE() & !CurLoadout.IsUsingClanCASE()) { result -= 15.0 * p.NumCrits(); } break; case 3: - if( ! CurLoadout.HasRTCASEII() &! CurLoadout.HasRTCASE() &! CurLoadout.IsUsingClanCASE() ) { + if (!CurLoadout.HasRTCASEII() & !CurLoadout.HasRTCASE() & !CurLoadout.IsUsingClanCASE()) { result -= 15.0 * p.NumCrits(); } break; case 4: - if( ! CurLoadout.HasLACASEII() &! CurLoadout.HasLTCASEII() &! CurLoadout.HasLTCASE() &! CurLoadout.IsUsingClanCASE() ) { + if (!CurLoadout.HasLACASEII() & !CurLoadout.HasLTCASEII() & !CurLoadout.HasLTCASE() + & !CurLoadout.IsUsingClanCASE()) { result -= 15.0 * p.NumCrits(); } break; case 5: - if( ! CurLoadout.HasRACASEII() &! CurLoadout.HasRTCASEII() &! CurLoadout.HasRTCASE() &! CurLoadout.IsUsingClanCASE() ) { + if (!CurLoadout.HasRACASEII() & !CurLoadout.HasRTCASEII() & !CurLoadout.HasRTCASE() + & !CurLoadout.IsUsingClanCASE()) { result -= 15.0 * p.NumCrits(); } break; case 6: - if( ! CurLoadout.HasLLCASEII() ) { + if (!CurLoadout.HasLLCASEII()) { result -= 15.0 * p.NumCrits(); } break; case 7: - if( ! CurLoadout.HasRLCASEII() ) { + if (!CurLoadout.HasRLCASEII()) { result -= 15.0 * p.NumCrits(); } break; @@ -2646,105 +2724,105 @@ else if( ! CurLoadout.HasRACASEII() &! CurLoadout.HasRTCASEII() &! CurLoadout.Is public double GetExplosiveWeaponPenalty() { double result = 0.0; - ArrayList v = CurLoadout.GetNonCore(); + ArrayList v = CurLoadout.GetNonCore(); JumpJetFactory jumpJetFactory = CurLoadout.GetJumpJets(); JumpJet[] jumpjets = jumpJetFactory.GetPlacedJumps(); abPlaceable p; boolean Explode; - for (int x = 0; x < jumpjets.length; x++) - { + for (int x = 0; x < jumpjets.length; x++) { p = jumpjets[x]; Explode = false; int mod = 0; - //if (p instanceof JumpJet){ - // Explode = ((JumpJet) p).IsExplosive(); - //} - - if (((JumpJet) p).IsExplosive()) - { - if( CurEngine.IsISXL() ) { - switch( CurLoadout.Find( p ) ) { + // if (p instanceof JumpJet){ + // Explode = ((JumpJet) p).IsExplosive(); + // } + + if (((JumpJet) p).IsExplosive()) { + if (CurEngine.IsISXL()) { + switch (CurLoadout.Find(p)) { case 0: - if( ! CurLoadout.HasHDCASEII() ) { + if (!CurLoadout.HasHDCASEII()) { result -= p.NumCrits() + mod; } break; case 1: - if( ! CurLoadout.HasCTCASEII() ) { + if (!CurLoadout.HasCTCASEII()) { result -= p.NumCrits() + mod; } break; case 2: - if( ! CurLoadout.HasLTCASEII() ) { + if (!CurLoadout.HasLTCASEII()) { result -= p.NumCrits() + mod; } break; case 3: - if( ! CurLoadout.HasRTCASEII() ) { + if (!CurLoadout.HasRTCASEII()) { result -= p.NumCrits() + mod; } break; case 4: - if( ! CurLoadout.HasLACASEII() &! CurLoadout.HasLTCASEII() &! CurLoadout.IsUsingClanCASE() ) { + if (!CurLoadout.HasLACASEII() & !CurLoadout.HasLTCASEII() & !CurLoadout.IsUsingClanCASE()) { result -= p.NumCrits() + mod; } break; case 5: - if( ! CurLoadout.HasRACASEII() &! CurLoadout.HasRTCASEII() &! CurLoadout.IsUsingClanCASE() ) { + if (!CurLoadout.HasRACASEII() & !CurLoadout.HasRTCASEII() & !CurLoadout.IsUsingClanCASE()) { result -= p.NumCrits() + mod; } break; case 6: - if( ! CurLoadout.HasLLCASEII() ) { + if (!CurLoadout.HasLLCASEII()) { result -= p.NumCrits() + mod; } break; case 7: - if( ! CurLoadout.HasRLCASEII() ) { + if (!CurLoadout.HasRLCASEII()) { result -= p.NumCrits() + mod; } break; } } else { - switch( CurLoadout.Find( p ) ) { + switch (CurLoadout.Find(p)) { case 0: - if( ! CurLoadout.HasHDCASEII() ) { + if (!CurLoadout.HasHDCASEII()) { result -= p.NumCrits() + mod; } break; case 1: - if( ! CurLoadout.HasCTCASEII() ) { + if (!CurLoadout.HasCTCASEII()) { result -= p.NumCrits() + mod; } break; case 2: - if( ! CurLoadout.HasLTCASEII() &! CurLoadout.HasLTCASE() &! CurLoadout.IsUsingClanCASE() ) { + if (!CurLoadout.HasLTCASEII() & !CurLoadout.HasLTCASE() & !CurLoadout.IsUsingClanCASE()) { result -= p.NumCrits() + mod; } break; case 3: - if( ! CurLoadout.HasRTCASEII() &! CurLoadout.HasRTCASE() &! CurLoadout.IsUsingClanCASE() ) { + if (!CurLoadout.HasRTCASEII() & !CurLoadout.HasRTCASE() & !CurLoadout.IsUsingClanCASE()) { result -= p.NumCrits() + mod; } break; case 4: - if( ! CurLoadout.HasLACASEII() &! CurLoadout.HasLTCASEII() &! CurLoadout.HasLTCASE() &! CurLoadout.IsUsingClanCASE() ) { + if (!CurLoadout.HasLACASEII() & !CurLoadout.HasLTCASEII() & !CurLoadout.HasLTCASE() + & !CurLoadout.IsUsingClanCASE()) { result -= p.NumCrits() + mod; } break; case 5: - if( ! CurLoadout.HasRACASEII() &! CurLoadout.HasRTCASEII() &! CurLoadout.HasRTCASE() &! CurLoadout.IsUsingClanCASE() ) { + if (!CurLoadout.HasRACASEII() & !CurLoadout.HasRTCASEII() & !CurLoadout.HasRTCASE() + & !CurLoadout.IsUsingClanCASE()) { result -= p.NumCrits() + mod; } break; case 6: - if( ! CurLoadout.HasLLCASEII() ) { + if (!CurLoadout.HasLLCASEII()) { result -= p.NumCrits() + mod; } break; case 7: - if( ! CurLoadout.HasRLCASEII() ) { + if (!CurLoadout.HasRLCASEII()) { result -= p.NumCrits() + mod; } break; @@ -2753,106 +2831,110 @@ public double GetExplosiveWeaponPenalty() { } } - for( int i = 0; i < v.size(); i++ ) { - p = (abPlaceable) v.get( i ); + for (int i = 0; i < v.size(); i++) { + p = (abPlaceable) v.get(i); Explode = false; int mod = 0; - if( p instanceof ifWeapon ) { + if (p instanceof ifWeapon) { Explode = ((ifWeapon) p).IsExplosive(); - if( p instanceof RangedWeapon ) { - if( ((RangedWeapon) p).IsUsingCapacitor() ) { + if (p instanceof RangedWeapon) { + if (((RangedWeapon) p).IsUsingCapacitor()) { mod += 1; } - if( ((RangedWeapon) p).IsUsingPulseModule()) { + if (((RangedWeapon) p).IsUsingPulseModule()) { mod += 1; } } } - if( p instanceof Equipment ) { Explode = ((Equipment) p).IsExplosive(); } - if( Explode && !(p instanceof ExtendedFuelTank)) { - if( CurEngine.IsISXL() ) { - switch( CurLoadout.Find( p ) ) { + if (p instanceof Equipment) { + Explode = ((Equipment) p).IsExplosive(); + } + if (Explode && !(p instanceof ExtendedFuelTank)) { + if (CurEngine.IsISXL()) { + switch (CurLoadout.Find(p)) { case 0: - if( ! CurLoadout.HasHDCASEII() ) { + if (!CurLoadout.HasHDCASEII()) { result -= p.NumCrits() + mod; } break; case 1: - if( ! CurLoadout.HasCTCASEII() ) { + if (!CurLoadout.HasCTCASEII()) { result -= p.NumCrits() + mod; } break; case 2: - if( ! CurLoadout.HasLTCASEII() ) { + if (!CurLoadout.HasLTCASEII()) { result -= p.NumCrits() + mod; } break; case 3: - if( ! CurLoadout.HasRTCASEII() ) { + if (!CurLoadout.HasRTCASEII()) { result -= p.NumCrits() + mod; } break; case 4: - if( ! CurLoadout.HasLACASEII() &! CurLoadout.HasLTCASEII() &! CurLoadout.IsUsingClanCASE() ) { + if (!CurLoadout.HasLACASEII() & !CurLoadout.HasLTCASEII() & !CurLoadout.IsUsingClanCASE()) { result -= p.NumCrits() + mod; } break; case 5: - if( ! CurLoadout.HasRACASEII() &! CurLoadout.HasRTCASEII() &! CurLoadout.IsUsingClanCASE() ) { + if (!CurLoadout.HasRACASEII() & !CurLoadout.HasRTCASEII() & !CurLoadout.IsUsingClanCASE()) { result -= p.NumCrits() + mod; } break; case 6: - if( ! CurLoadout.HasLLCASEII() ) { + if (!CurLoadout.HasLLCASEII()) { result -= p.NumCrits() + mod; } break; case 7: - if( ! CurLoadout.HasRLCASEII() ) { + if (!CurLoadout.HasRLCASEII()) { result -= p.NumCrits() + mod; } break; } } else { - switch( CurLoadout.Find( p ) ) { + switch (CurLoadout.Find(p)) { case 0: - if( ! CurLoadout.HasHDCASEII() ) { + if (!CurLoadout.HasHDCASEII()) { result -= p.NumCrits() + mod; } break; case 1: - if( ! CurLoadout.HasCTCASEII() ) { + if (!CurLoadout.HasCTCASEII()) { result -= p.NumCrits() + mod; } break; case 2: - if( ! CurLoadout.HasLTCASEII() &! CurLoadout.HasLTCASE() &! CurLoadout.IsUsingClanCASE() ) { + if (!CurLoadout.HasLTCASEII() & !CurLoadout.HasLTCASE() & !CurLoadout.IsUsingClanCASE()) { result -= p.NumCrits() + mod; } break; case 3: - if( ! CurLoadout.HasRTCASEII() &! CurLoadout.HasRTCASE() &! CurLoadout.IsUsingClanCASE() ) { + if (!CurLoadout.HasRTCASEII() & !CurLoadout.HasRTCASE() & !CurLoadout.IsUsingClanCASE()) { result -= p.NumCrits() + mod; } break; case 4: - if( ! CurLoadout.HasLACASEII() &! CurLoadout.HasLTCASEII() &! CurLoadout.HasLTCASE() &! CurLoadout.IsUsingClanCASE() ) { + if (!CurLoadout.HasLACASEII() & !CurLoadout.HasLTCASEII() & !CurLoadout.HasLTCASE() + & !CurLoadout.IsUsingClanCASE()) { result -= p.NumCrits() + mod; } break; case 5: - if( ! CurLoadout.HasRACASEII() &! CurLoadout.HasRTCASEII() &! CurLoadout.HasRTCASE() &! CurLoadout.IsUsingClanCASE() ) { + if (!CurLoadout.HasRACASEII() & !CurLoadout.HasRTCASEII() & !CurLoadout.HasRTCASE() + & !CurLoadout.IsUsingClanCASE()) { result -= p.NumCrits() + mod; } break; case 6: - if( ! CurLoadout.HasLLCASEII() ) { + if (!CurLoadout.HasLLCASEII()) { result -= p.NumCrits() + mod; } break; case 7: - if( ! CurLoadout.HasRLCASEII() ) { + if (!CurLoadout.HasRLCASEII()) { result -= p.NumCrits() + mod; } break; @@ -2862,21 +2944,45 @@ public double GetExplosiveWeaponPenalty() { } // check for Blue Shield system. - if( HasBlueShield ) { - if( CurEngine.IsISXL() ) { - if( ! CurLoadout.HasLACASEII() &! CurLoadout.IsUsingClanCASE() ) { result -= 1; } - if( ! CurLoadout.HasRACASEII() &! CurLoadout.IsUsingClanCASE() ) { result -= 1; } - if( ! CurLoadout.HasLLCASEII() &! CurLoadout.IsUsingClanCASE() ) { result -= 1; } - if( ! CurLoadout.HasRLCASEII() &! CurLoadout.IsUsingClanCASE() ) { result -= 1; } + if (HasBlueShield) { + if (CurEngine.IsISXL()) { + if (!CurLoadout.HasLACASEII() & !CurLoadout.IsUsingClanCASE()) { + result -= 1; + } + if (!CurLoadout.HasRACASEII() & !CurLoadout.IsUsingClanCASE()) { + result -= 1; + } + if (!CurLoadout.HasLLCASEII() & !CurLoadout.IsUsingClanCASE()) { + result -= 1; + } + if (!CurLoadout.HasRLCASEII() & !CurLoadout.IsUsingClanCASE()) { + result -= 1; + } result -= 3.0; } else { - if( ! CurLoadout.HasCTCASEII() ) { result -= 1; } - if( ! CurLoadout.HasLTCASEII() &! CurLoadout.HasLTCASE() &! CurLoadout.HasLACASEII() &! CurLoadout.IsUsingClanCASE() ) { result -= 1; } - if( ! CurLoadout.HasLTCASEII() &! CurLoadout.HasLTCASE() &! CurLoadout.IsUsingClanCASE() ) { result -= 1; } - if( ! CurLoadout.HasRTCASEII() &! CurLoadout.HasRTCASE() &! CurLoadout.HasRACASEII() &! CurLoadout.IsUsingClanCASE() ) { result -= 1; } - if( ! CurLoadout.HasRTCASEII() &! CurLoadout.HasRTCASE() &! CurLoadout.IsUsingClanCASE() ) { result -= 1; } - if( ! CurLoadout.HasLLCASEII() &! CurLoadout.IsUsingClanCASE() ) { result -= 1; } - if( ! CurLoadout.HasRLCASEII() &! CurLoadout.IsUsingClanCASE() ) { result -= 1; } + if (!CurLoadout.HasCTCASEII()) { + result -= 1; + } + if (!CurLoadout.HasLTCASEII() & !CurLoadout.HasLTCASE() & !CurLoadout.HasLACASEII() + & !CurLoadout.IsUsingClanCASE()) { + result -= 1; + } + if (!CurLoadout.HasLTCASEII() & !CurLoadout.HasLTCASE() & !CurLoadout.IsUsingClanCASE()) { + result -= 1; + } + if (!CurLoadout.HasRTCASEII() & !CurLoadout.HasRTCASE() & !CurLoadout.HasRACASEII() + & !CurLoadout.IsUsingClanCASE()) { + result -= 1; + } + if (!CurLoadout.HasRTCASEII() & !CurLoadout.HasRTCASE() & !CurLoadout.IsUsingClanCASE()) { + result -= 1; + } + if (!CurLoadout.HasLLCASEII() & !CurLoadout.IsUsingClanCASE()) { + result -= 1; + } + if (!CurLoadout.HasRLCASEII() & !CurLoadout.IsUsingClanCASE()) { + result -= 1; + } } } return result; @@ -2887,25 +2993,29 @@ public double GetDefensiveFactor() { // target number for speed. // subtract one since we're indexing an array - int RunMP = GetAdjustedRunningMP( true, true ) - 1; + int RunMP = GetAdjustedRunningMP(true, true) - 1; int JumpMP = 0; // this is a safeguard for using MASC on an incredibly speedy chassis // there is currently no way to get a bonus higher anyway. - if( RunMP > 29 ) { RunMP = 29; } + if (RunMP > 29) { + RunMP = 29; + } // safeguard for low walk mp (Modular MechArmor, for instance) - if( RunMP < 0 ) { RunMP = 0; } + if (RunMP < 0) { + RunMP = 0; + } // Get the defensive factors for jumping and running movement double ground = DefensiveFactor[RunMP]; double jump = 0.0; - if( GetJumpJets().GetNumJJ() > 0 ) { - JumpMP = GetAdjustedJumpingMP( true ) - 1; + if (GetJumpJets().GetNumJJ() > 0) { + JumpMP = GetAdjustedJumpingMP(true) - 1; jump = DefensiveFactor[JumpMP] + 0.1; } - if( UsingJumpBooster() ) { - int boostMP = GetAdjustedBoosterMP( true ) - 1; - if( boostMP > JumpMP ) { + if (UsingJumpBooster()) { + int boostMP = GetAdjustedBoosterMP(true) - 1; + if (boostMP > JumpMP) { JumpMP = boostMP; jump = Mech.DefensiveFactor[JumpMP] + 0.1f; } @@ -2913,17 +3023,18 @@ public double GetDefensiveFactor() { double retval = 0.0; // return the best one. - if( jump > ground ) { + if (jump > ground) { retval = jump; } else { retval = ground; } // TODO: Refactor GetTotalModifiers/BVCombine to account for voidsig - MechModifier m = GetTotalModifiers( true, true ); + MechModifier m = GetTotalModifiers(true, true); // Apply void sig errata if (HasVoidSig) { - // GetTotalModifiers currently doesn't account for VoidSig, so ignore it and compare the voidsig bonus to + // GetTotalModifiers currently doesn't account for VoidSig, so ignore it and + // compare the voidsig bonus to // our current tally if (retval < 1.3) { retval = 1.3; @@ -2934,7 +3045,7 @@ public double GetDefensiveFactor() { retval += m.DefensiveBonus(); } - if( retval < m.MinimumDefensiveBonus() ) { + if (retval < m.MinimumDefensiveBonus()) { retval = m.MinimumDefensiveBonus(); } @@ -2957,31 +3068,33 @@ public double GetUnmodifiedOffensiveBV() { } public double GetHeatAdjustedWeaponBV() { - ArrayList v = CurLoadout.GetNonCore(), wep = new ArrayList(); + ArrayList v = CurLoadout.GetNonCore(), wep = new ArrayList(); double result = 0.0, foreBV = 0.0, rearBV = 0.0; boolean UseRear = false, TC = UsingTC(), UseAESMod = false, UseRobotic = CurCockpit.IsRobotic(); abPlaceable a; // is it even worth performing all this? - if( v.size() <= 0 ) { + if (v.size() <= 0) { // nope return result; } // trim out the other equipment and get a list of offensive weapons only. - for( int i = 0; i < v.size(); i++ ) { - if( v.get( i ) instanceof ifWeapon ) { - wep.add( v.get( i ) ); + for (int i = 0; i < v.size(); i++) { + if (v.get(i) instanceof ifWeapon) { + wep.add(v.get(i)); } } // just to save us a headache if there are no weapons - if( wep.size() <= 0 ) { return result; } + if (wep.size() <= 0) { + return result; + } // now get the mech's heat efficiency and the total heat from weapons double heff = 6 + GetHeatSinks().TotalDissipation() - GetBVMovementHeat(); - //Subtract another 10 for the stealth armor - if ( CurArmor.IsStealth() ) + // Subtract another 10 for the stealth armor + if (CurArmor.IsStealth()) heff -= 10; // Subtract Chameleon LPS (TacOps Errata) @@ -3001,95 +3114,98 @@ public double GetHeatAdjustedWeaponBV() { double wheat = GetBVWeaponHeat(); - if( GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL ) { + if (GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL) { // check for coolant pods int NumHS = GetHeatSinks().GetNumHS(), MaxHSBonus = NumHS * 2, NumPods = 0; - for( int i = 0; i < v.size(); i++ ) { - a = (abPlaceable) v.get( i ); - if( a instanceof Equipment ) { - if( ((Equipment) a).LookupName().equals( "Coolant Pod" ) ) { + for (int i = 0; i < v.size(); i++) { + a = (abPlaceable) v.get(i); + if (a instanceof Equipment) { + if (((Equipment) a).LookupName().equals("Coolant Pod")) { NumPods++; } } } // get the heat sink bonus - int Bonus = (int) Math.ceil( (double) NumHS * ( (double) NumPods * 0.2 ) ); - if( Bonus > MaxHSBonus ) { Bonus = MaxHSBonus; } + int Bonus = (int) Math.ceil((double) NumHS * ((double) NumPods * 0.2)); + if (Bonus > MaxHSBonus) { + Bonus = MaxHSBonus; + } heff += Bonus; } // find out the total BV of rear and forward firing weapons - for( int i = 0; i < wep.size(); i++ ) { - a = ((abPlaceable) wep.get( i )); + for (int i = 0; i < wep.size(); i++) { + a = ((abPlaceable) wep.get(i)); // arm mounted weapons always count their full BV, so ignore them. - int loc = CurLoadout.Find( a ); + int loc = CurLoadout.Find(a); // 2020-10-10 Turreted are also always their full BV - if( loc != LocationIndex.MECH_LOC_LA - && loc != LocationIndex.MECH_LOC_RA - && (a instanceof RangedWeapon && !((RangedWeapon)a).IsTurreted()) ) { - UseAESMod = UseAESModifier( a ); - if( a.IsMountedRear() ) { - rearBV += a.GetCurOffensiveBV( true, TC, UseAESMod, UseRobotic ); + if (loc != LocationIndex.MECH_LOC_LA && loc != LocationIndex.MECH_LOC_RA + && (a instanceof RangedWeapon && !((RangedWeapon) a).IsTurreted())) { + UseAESMod = UseAESModifier(a); + if (a.IsMountedRear()) { + rearBV += a.GetCurOffensiveBV(true, TC, UseAESMod, UseRobotic); } else { - foreBV += a.GetCurOffensiveBV( false, TC, UseAESMod, UseRobotic ); + foreBV += a.GetCurOffensiveBV(false, TC, UseAESMod, UseRobotic); } } } - if( rearBV > foreBV ) { UseRear = true; } + if (rearBV > foreBV) { + UseRear = true; + } // see if we need to run heat calculations - if( heff - wheat >= 0 ) { + if (heff - wheat >= 0) { // no need for extensive calculations, return the weapon BV - for( int i = 0; i < wep.size(); i++ ) { - a = ((abPlaceable) wep.get( i )); - int loc = CurLoadout.Find( a ); - UseAESMod = UseAESModifier( a ); - if( loc != LocationIndex.MECH_LOC_LA && loc != LocationIndex.MECH_LOC_RA ) { - result += a.GetCurOffensiveBV( UseRear, TC, UseAESMod,UseRobotic ); + for (int i = 0; i < wep.size(); i++) { + a = ((abPlaceable) wep.get(i)); + int loc = CurLoadout.Find(a); + UseAESMod = UseAESModifier(a); + if (loc != LocationIndex.MECH_LOC_LA && loc != LocationIndex.MECH_LOC_RA) { + result += a.GetCurOffensiveBV(UseRear, TC, UseAESMod, UseRobotic); } else { - result += a.GetCurOffensiveBV( false, TC, UseAESMod, UseRobotic ); + result += a.GetCurOffensiveBV(false, TC, UseAESMod, UseRobotic); } } // calculate if drone os - if(HasDroneOS){ + if (HasDroneOS) { result *= 0.8; } return result; } // Sort the weapon list - abPlaceable[] sorted = SortWeapons( wep, UseRear ); + ArrayList sorted = SortWeapons(wep, UseRear); // calculate the BV of the weapons based on heat double curheat = 0; - for( int i = 0; i < sorted.length; i++ ) { - int loc = CurLoadout.Find( sorted[i] ); - UseAESMod = UseAESModifier( sorted[i] ); - if( curheat < heff ) { - if( loc != LocationIndex.MECH_LOC_LA && loc != LocationIndex.MECH_LOC_RA ) { - result += sorted[i].GetCurOffensiveBV( UseRear, UsingTC(), UseAESMod, UseRobotic ); + for (int i = 0; i < sorted.size(); i++) { + int loc = CurLoadout.Find(sorted.get(i)); + UseAESMod = UseAESModifier(sorted.get(i)); + if (curheat < heff) { + if (loc != LocationIndex.MECH_LOC_LA && loc != LocationIndex.MECH_LOC_RA) { + result += sorted.get(i).GetCurOffensiveBV(UseRear, UsingTC(), UseAESMod, UseRobotic); } else { - result += sorted[i].GetCurOffensiveBV( false, UsingTC(), UseAESMod, UseRobotic ); + result += sorted.get(i).GetCurOffensiveBV(false, UsingTC(), UseAESMod, UseRobotic); } } else { - if( ((ifWeapon) sorted[i]).GetBVHeat() <= 0 ) { - if( loc != LocationIndex.MECH_LOC_LA && loc != LocationIndex.MECH_LOC_RA ) { - result += sorted[i].GetCurOffensiveBV( UseRear, UsingTC(), UseAESMod, UseRobotic ); + if (((ifWeapon) sorted.get(i)).GetBVHeat() <= 0) { + if (loc != LocationIndex.MECH_LOC_LA && loc != LocationIndex.MECH_LOC_RA) { + result += sorted.get(i).GetCurOffensiveBV(UseRear, UsingTC(), UseAESMod, UseRobotic); } else { - result += sorted[i].GetCurOffensiveBV( false, UsingTC(), UseAESMod, UseRobotic ); + result += sorted.get(i).GetCurOffensiveBV(false, UsingTC(), UseAESMod, UseRobotic); } } else { - if( loc != LocationIndex.MECH_LOC_LA && loc != LocationIndex.MECH_LOC_RA ) { - result += sorted[i].GetCurOffensiveBV( UseRear, UsingTC(), UseAESMod, UseRobotic ) * 0.5; + if (loc != LocationIndex.MECH_LOC_LA && loc != LocationIndex.MECH_LOC_RA) { + result += sorted.get(i).GetCurOffensiveBV(UseRear, UsingTC(), UseAESMod, UseRobotic) * 0.5; } else { - result += sorted[i].GetCurOffensiveBV( false, UsingTC(), UseAESMod, UseRobotic ) * 0.5; + result += sorted.get(i).GetCurOffensiveBV(false, UsingTC(), UseAESMod, UseRobotic) * 0.5; } } } - curheat += ((ifWeapon) sorted[i]).GetBVHeat(); + curheat += ((ifWeapon) sorted.get(i)).GetBVHeat(); } // calculate if drone os - if(HasDroneOS){ + if (HasDroneOS) { result *= 0.8; } return result; @@ -3098,11 +3214,11 @@ public double GetHeatAdjustedWeaponBV() { public double GetNonHeatEquipBV() { // return the BV of all offensive equipment double result = 0.0; - ArrayList v = CurLoadout.GetNonCore(); + ArrayList v = CurLoadout.GetNonCore(); - for( int i = 0; i < v.size(); i++ ) { - if( ! ( v.get( i ) instanceof ifWeapon ) ) { - result += ((abPlaceable) v.get( i )).GetOffensiveBV(); + for (int i = 0; i < v.size(); i++) { + if (!(v.get(i) instanceof ifWeapon)) { + result += ((abPlaceable) v.get(i)).GetOffensiveBV(); } } return result; @@ -3110,63 +3226,66 @@ public double GetNonHeatEquipBV() { public double GetExcessiveAmmoPenalty() { double result = 0.0; - ArrayList v = CurLoadout.GetNonCore(); - ArrayList Ammo = new ArrayList(), - Wep = new ArrayList(); + ArrayList v = CurLoadout.GetNonCore(); + ArrayList Ammo = new ArrayList(), Wep = new ArrayList(); // do we even need to do this? - if( v.size() <= 0 ) { return result; } + if (v.size() <= 0) { + return result; + } // seperate out the ammo-using weapons and their ammunition - for( int i = 0; i < v.size(); i++ ) { - if( v.get( i ) instanceof Ammunition ) { - Ammo.add( v.get( i ) ); + for (int i = 0; i < v.size(); i++) { + if (v.get(i) instanceof Ammunition) { + Ammo.add(v.get(i)); } - if( v.get(i) instanceof ifWeapon ) { - if( ((ifWeapon) v.get( i )).HasAmmo() ) { - Wep.add( v.get( i ) ); + if (v.get(i) instanceof ifWeapon) { + if (((ifWeapon) v.get(i)).HasAmmo()) { + Wep.add(v.get(i)); } } } // do we need to continue? - if( Ammo.size() <= 0 ) { return result; } + if (Ammo.size() <= 0) { + return result; + } // for each weapon that uses ammo, total it's ammo BV and ensure it's - // not excessive. Add the BV to the running total. - while( Wep.size() > 0 ) { + // not excessive. Add the BV to the running total. + while (Wep.size() > 0) { // get the first item and check if anything else uses the same ammo - ifWeapon test = (ifWeapon) Wep.get( 0 ); - Wep.remove( test ); + ifWeapon test = (ifWeapon) Wep.get(0); + Wep.remove((abPlaceable) test); Ammunition ammo = null; int NumWeps = 1; int NumAmmos = 0; - for( int i = Wep.size() - 1; i >= 0; i-- ) { - if( ((ifWeapon) Wep.get( i )).GetAmmoIndex() == test.GetAmmoIndex() ) { + for (int i = Wep.size() - 1; i >= 0; i--) { + if (((ifWeapon) Wep.get(i)).GetAmmoIndex() == test.GetAmmoIndex()) { NumWeps++; - Wep.remove( i ); + Wep.remove(i); } } // now check the number of ammunitions that this weapon uses - for( int i = 0; i < Ammo.size(); i++ ) { - if( ((Ammunition) Ammo.get(i)).GetAmmoIndex() == test.GetAmmoIndex() ) { - ammo = (Ammunition) Ammo.get( i ); + for (int i = 0; i < Ammo.size(); i++) { + if (((Ammunition) Ammo.get(i)).GetAmmoIndex() == test.GetAmmoIndex()) { + ammo = (Ammunition) Ammo.get(i); NumAmmos++; } } // now find out if the ammo is excessive - if( NumAmmos != 0 && ammo != null ) { - double ammoBV = ( NumAmmos * ammo.GetOffensiveBV() ); - if( ammoBV <= 0.0 ) { - ammoBV = ( NumAmmos * ammo.GetDefensiveBV() ); + if (NumAmmos != 0 && ammo != null) { + double ammoBV = (NumAmmos * ammo.GetOffensiveBV()); + if (ammoBV <= 0.0) { + ammoBV = (NumAmmos * ammo.GetDefensiveBV()); } - double wepBV = ( NumWeps * ((abPlaceable) test).GetOffensiveBV() ); - if( wepBV <= 0.0 ) { - wepBV = ( NumWeps * ((abPlaceable) test).GetDefensiveBV() ); + double wepBV = (NumWeps * ((abPlaceable) test).GetOffensiveBV()); + if (wepBV <= 0.0) { + wepBV = (NumWeps * ((abPlaceable) test).GetDefensiveBV()); } - if( ammoBV > wepBV ) { + if (ammoBV > wepBV) { result -= ammoBV - wepBV; } } @@ -3176,20 +3295,26 @@ public double GetExcessiveAmmoPenalty() { } public double GetTonnageBV() { - if( CurPhysEnhance.IsTSM() ) { + if (CurPhysEnhance.IsTSM()) { return CurPhysEnhance.GetOffensiveBV(); } else { - if( Quad ) { - if( HasLegAES ) { + if (Quad) { + if (HasLegAES) { return Tonnage * 1.4; } else { return Tonnage; } } else { double AESMod = 1.0; - if( HasLAAES ) { AESMod += 0.1; } - if( HasRAAES ) { AESMod += 0.1; } - if( HasLegAES ) { AESMod += 0.2; } + if (HasLAAES) { + AESMod += 0.1; + } + if (HasRAAES) { + AESMod += 0.1; + } + if (HasLegAES) { + AESMod += 0.2; + } return Tonnage * AESMod; } } @@ -3197,28 +3322,31 @@ public double GetTonnageBV() { public double GetOffensiveFactor() { double result = 0.0; - if( UsingJumpBooster() ) { - int boost = GetAdjustedBoosterMP( true ); - int jump = GetAdjustedJumpingMP( true ); - if( jump >= boost ) { - result += (double) (GetAdjustedRunningMP(true, true) + (Math.floor(GetAdjustedJumpingMP(true) * 0.5f + 0.5f)) - 5.0f); + if (UsingJumpBooster()) { + int boost = GetAdjustedBoosterMP(true); + int jump = GetAdjustedJumpingMP(true); + if (jump >= boost) { + result += (double) (GetAdjustedRunningMP(true, true) + + (Math.floor(GetAdjustedJumpingMP(true) * 0.5f + 0.5f)) - 5.0f); } else { - result += (double) (GetAdjustedRunningMP(true, true) + (Math.floor(GetAdjustedBoosterMP(true) * 0.5f + 0.5f)) - 5.0f); + result += (double) (GetAdjustedRunningMP(true, true) + + (Math.floor(GetAdjustedBoosterMP(true) * 0.5f + 0.5f)) - 5.0f); } } else { - result += (double) (GetAdjustedRunningMP(true, true) + (Math.floor(GetAdjustedJumpingMP(true) * 0.5f + 0.5f)) - 5.0f); + result += (double) (GetAdjustedRunningMP(true, true) + + (Math.floor(GetAdjustedJumpingMP(true) * 0.5f + 0.5f)) - 5.0f); } result = result * 0.1 + 1.0; - result = (double) Math.pow( result, 1.2 ) ; + result = (double) Math.pow(result, 1.2); // round off to the nearest two digits - result = (double) Math.floor( result * 100 + 0.5 ) / 100; + result = (double) Math.floor(result * 100 + 0.5) / 100; double cockpitMultiplier = 1.0; - if( ! CurCockpit.HasFireControl() ) { + if (!CurCockpit.HasFireControl()) { cockpitMultiplier -= 0.1; } - if( CurCockpit.LookupName().contains( "Primitive Industrial" ) ) { + if (CurCockpit.LookupName().contains("Primitive Industrial")) { cockpitMultiplier -= 0.05; } @@ -3240,15 +3368,15 @@ public InternalStructure GetIntStruc() { public Gyro GetGyro() { return CurGyro; } - + public Cockpit GetCockpit() { return CurCockpit; } - + public ActuatorSet GetActuators() { return CurLoadout.GetActuators(); } - + public PhysicalEnhancement GetPhysEnhance() { return CurPhysEnhance; } @@ -3275,30 +3403,60 @@ public double GetChassisCost() { double result = GetBaseChassisCost(); result += CurEngine.GetCost(); - if( HasNullSig() ) { result += NullSig.GetCost(); } - if( HasVoidSig() ) { result += VoidSig.GetCost(); } - if( HasChameleon() ) { result += Chameleon.GetCost(); } - if( HasBlueShield() ) { result += BlueShield.GetCost(); } - if( HasEnviroSealing() ) { result += EnviroSealing.GetCost(); } - if( HasPartialWing ) { result += Wing.GetCost(); } - if( HasJumpBooster ) { result += JumpBooster.GetCost(); } - if( Quad ) { - if( HasLegAES ) { result += RLAES.GetCost() * 4.0; } + if (HasNullSig()) { + result += NullSig.GetCost(); + } + if (HasVoidSig()) { + result += VoidSig.GetCost(); + } + if (HasChameleon()) { + result += Chameleon.GetCost(); + } + if (HasBlueShield()) { + result += BlueShield.GetCost(); + } + if (HasEnviroSealing()) { + result += EnviroSealing.GetCost(); + } + if (HasPartialWing) { + result += Wing.GetCost(); + } + if (HasJumpBooster) { + result += JumpBooster.GetCost(); + } + if (Quad) { + if (HasLegAES) { + result += RLAES.GetCost() * 4.0; + } } else { - if( HasRAAES ) { result += CurRAAES.GetCost(); } - if( HasLAAES ) { result += CurLAAES.GetCost(); } - if( HasLegAES ) { result += RLAES.GetCost() * 2.0; } + if (HasRAAES) { + result += CurRAAES.GetCost(); + } + if (HasLAAES) { + result += CurLAAES.GetCost(); + } + if (HasLegAES) { + result += RLAES.GetCost() * 2.0; + } } // same goes for the targeting computer and supercharger - if( CurLoadout.UsingTC() ) { + if (CurLoadout.UsingTC()) { result += GetTC().GetCost(); } - if( CurLoadout.HasHDTurret() ) { result += CurLoadout.GetHDTurret().GetCost(); } - if( CurLoadout.HasLTTurret() ) { result += CurLoadout.GetLTTurret().GetCost(); } - if( CurLoadout.HasRTTurret() ) { result += CurLoadout.GetRTTurret().GetCost(); } - if( HasTracks) { result += Tracks.GetCost(); } - if( CurLoadout.HasSupercharger() ) { + if (CurLoadout.HasHDTurret()) { + result += CurLoadout.GetHDTurret().GetCost(); + } + if (CurLoadout.HasLTTurret()) { + result += CurLoadout.GetLTTurret().GetCost(); + } + if (CurLoadout.HasRTTurret()) { + result += CurLoadout.GetRTTurret().GetCost(); + } + if (HasTracks) { + result += Tracks.GetCost(); + } + if (CurLoadout.HasSupercharger()) { result += CurLoadout.GetSupercharger().GetCost(); } @@ -3316,7 +3474,7 @@ public double GetDryCost() { } public double GetCostMult() { - if( Omnimech ) { + if (Omnimech) { return 1.25 * MechMult; } else { return MechMult; @@ -3325,14 +3483,14 @@ public double GetCostMult() { public double GetBaseChassisCost() { // chassis cost in this context is different than the ChassisCost - // variable. It includes all components except engine, TC, and + // variable. It includes all components except engine, TC, and // equipment without multiple calculation ("base" cost) double result = 0.0; - if( ! CurPhysEnhance.IsTSM() ) { - // this is standard musculature. If we have TSM, it's handled later + if (!CurPhysEnhance.IsTSM()) { + // this is standard musculature. If we have TSM, it's handled later // hack here for very early Primitive 'Mech costs - if( Primitive && CurLoadout.GetYear() > 2449 ) { + if (Primitive && CurLoadout.GetYear() > 2449) { result += 1000 * Tonnage; } else { result += 2000 * Tonnage; @@ -3341,40 +3499,64 @@ public double GetBaseChassisCost() { result += CurGyro.GetCost(); result += CurIntStruc.GetCost(); result += CurCockpit.GetCost(); - if( HasCommandConsole() ) { + if (HasCommandConsole()) { result += CommandConsole.GetCost(); } - if( HasEjectionSeat ) { result += EjectionSeat.GetCost(); } + if (HasEjectionSeat) { + result += EjectionSeat.GetCost(); + } result += GetActuators().GetCost(); result += CurPhysEnhance.GetCost(); result += GetHeatSinks().GetCost(); result += GetJumpJets().GetCost(); result += CurArmor.GetCost(); - if( CurLoadout.IsUsingClanCASE() ) { + if (CurLoadout.IsUsingClanCASE()) { int[] test = CurLoadout.FindExplosiveInstances(); - for( int i = 0; i < test.length; i++ ) { - if( test[i] > 0 ) { + for (int i = 0; i < test.length; i++) { + if (test[i] > 0) { result += CurLoadout.GetCTCase().GetCost(); } } } - if( HasCTCase() ) { result += CurLoadout.GetCTCase().GetCost(); } - if( HasLTCase() ) { result += CurLoadout.GetCTCase().GetCost(); } - if( HasRTCase() ) { result += CurLoadout.GetCTCase().GetCost(); } - if( CurLoadout.HasHDCASEII() ) { result += CurLoadout.GetHDCaseII().GetCost(); } - if( CurLoadout.HasCTCASEII() ) { result += CurLoadout.GetCTCaseII().GetCost(); } - if( CurLoadout.HasLTCASEII() ) { result += CurLoadout.GetLTCaseII().GetCost(); } - if( CurLoadout.HasRTCASEII() ) { result += CurLoadout.GetRTCaseII().GetCost(); } - if( CurLoadout.HasLACASEII() ) { result += CurLoadout.GetLACaseII().GetCost(); } - if( CurLoadout.HasRACASEII() ) { result += CurLoadout.GetRACaseII().GetCost(); } - if( CurLoadout.HasLLCASEII() ) { result += CurLoadout.GetLLCaseII().GetCost(); } - if( CurLoadout.HasRLCASEII() ) { result += CurLoadout.GetRLCaseII().GetCost(); } + if (HasCTCase()) { + result += CurLoadout.GetCTCase().GetCost(); + } + if (HasLTCase()) { + result += CurLoadout.GetCTCase().GetCost(); + } + if (HasRTCase()) { + result += CurLoadout.GetCTCase().GetCost(); + } + if (CurLoadout.HasHDCASEII()) { + result += CurLoadout.GetHDCaseII().GetCost(); + } + if (CurLoadout.HasCTCASEII()) { + result += CurLoadout.GetCTCaseII().GetCost(); + } + if (CurLoadout.HasLTCASEII()) { + result += CurLoadout.GetLTCaseII().GetCost(); + } + if (CurLoadout.HasRTCASEII()) { + result += CurLoadout.GetRTCaseII().GetCost(); + } + if (CurLoadout.HasLACASEII()) { + result += CurLoadout.GetLACaseII().GetCost(); + } + if (CurLoadout.HasRACASEII()) { + result += CurLoadout.GetRACaseII().GetCost(); + } + if (CurLoadout.HasLLCASEII()) { + result += CurLoadout.GetLLCaseII().GetCost(); + } + if (CurLoadout.HasRLCASEII()) { + result += CurLoadout.GetRLCaseII().GetCost(); + } return result; } - public void Visit( ifVisitor v ) throws Exception { - v.Visit( this ); + public void Visit(ifVisitor v) throws Exception { + v.Visit(this); } public Preferences GetPrefs() { @@ -3384,15 +3566,17 @@ public Preferences GetPrefs() { public double GetEquipCost() { // gets the cost for all non-core items minus ammuntion. - ArrayList v = CurLoadout.GetNonCore(); + ArrayList v = CurLoadout.GetNonCore(); double retval = 0.0; - if( v.size() > 0 ) { - for( int i = 0; i < v.size(); i++ ) { - if( ! (v.get( i ) instanceof Ammunition ) ) { - retval += ( (abPlaceable) v.get( i ) ).GetCost(); + if (v.size() > 0) { + for (int i = 0; i < v.size(); i++) { + if (!(v.get(i) instanceof Ammunition)) { + retval += ((abPlaceable) v.get(i)).GetCost(); } } - if( ! CurEngine.IsNuclear() ) { retval += CurLoadout.GetPowerAmplifier().GetCost(); } + if (!CurEngine.IsNuclear()) { + retval += CurLoadout.GetPowerAmplifier().GetCost(); + } return retval; } else { return retval; @@ -3401,12 +3585,12 @@ public double GetEquipCost() { public double GetAmmoCosts() { // gets the cost for all ammuntion. - ArrayList v = CurLoadout.GetNonCore(); + ArrayList v = CurLoadout.GetNonCore(); double retval = 0.0; - if( v.size() > 0 ) { - for( int i = 0; i < v.size(); i++ ) { - if( (v.get( i ) instanceof Ammunition ) ) { - retval += ( (abPlaceable) v.get( i ) ).GetCost(); + if (v.size() > 0) { + for (int i = 0; i < v.size(); i++) { + if ((v.get(i) instanceof Ammunition)) { + retval += ((abPlaceable) v.get(i)).GetCost(); } } return retval; @@ -3416,15 +3600,14 @@ public double GetAmmoCosts() { } @Override - public int GetAmmoCount( int ammoIndex ) - { + public int GetAmmoCount(int ammoIndex) { int retval = 0; - ArrayList v = CurLoadout.GetNonCore(); - if( v.size() > 0 ) { - for( int i = 0; i < v.size(); i++ ) { - if( ( v.get( i ) instanceof Ammunition ) ) { - if ( ((Ammunition)v.get(i)).GetAmmoIndex() == ammoIndex ) - retval += ((Ammunition)v.get(i)).GetLotSize(); + ArrayList v = CurLoadout.GetNonCore(); + if (v.size() > 0) { + for (int i = 0; i < v.size(); i++) { + if ((v.get(i) instanceof Ammunition)) { + if (((Ammunition) v.get(i)).GetAmmoIndex() == ammoIndex) + retval += ((Ammunition) v.get(i)).GetLotSize(); } } return retval; @@ -3432,26 +3615,22 @@ public int GetAmmoCount( int ammoIndex ) return retval; } - + /* * Gets a count of weapons on a unit that all use the same ammo type */ @Override - public int GetWeaponCount( int ammoIndex ) - { + public int GetWeaponCount(int ammoIndex) { int retval = 0; - ArrayList v = CurLoadout.GetNonCore(); - if ( v.size() > 0 ) { - for(Object w : v) - { - if (w instanceof RangedWeapon) - { - if (((RangedWeapon)w).GetAmmoIndex() == ammoIndex ) + ArrayList v = CurLoadout.GetNonCore(); + if (v.size() > 0) { + for (Object w : v) { + if (w instanceof RangedWeapon) { + if (((RangedWeapon) w).GetAmmoIndex() == ammoIndex) retval++; } - if (w instanceof MGArray) - { - if (((MGArray)w).GetAmmoIndex() == ammoIndex ) + if (w instanceof MGArray) { + if (((MGArray) w).GetAmmoIndex() == ammoIndex) retval++; } } @@ -3461,17 +3640,17 @@ public int GetWeaponCount( int ammoIndex ) public void AddCTCase() throws Exception { // adds CASE equipment to the CT - CurLoadout.SetCTCASE( true, -1 ); + CurLoadout.SetCTCASE(true, -1); } public void AddLTCase() throws Exception { // adds CASE equipment to the LT - CurLoadout.SetLTCASE( true, -1 ); + CurLoadout.SetLTCASE(true, -1); } public void AddRTCase() throws Exception { // adds CASE equipment to the RT - CurLoadout.SetRTCASE( true, -1 ); + CurLoadout.SetRTCASE(true, -1); } public boolean HasCTCase() { @@ -3492,39 +3671,45 @@ public boolean HasRTCase() { public void RemoveCTCase() { // remove the CT CASE equipment try { - CurLoadout.SetCTCASE( false, -1 ); - } catch( Exception e ) { - // why we have an error while removing CASE is beyond me. Log it. - System.err.println( "Exception while removing CT CASE:\n" + e.getMessage() ); + CurLoadout.SetCTCASE(false, -1); + } catch (Exception e) { + // why we have an error while removing CASE is beyond me. Log it. + System.err.println("Exception while removing CT CASE:\n" + e.getMessage()); } } public void RemoveLTCase() { // remove the LT CASE equipment try { - CurLoadout.SetLTCASE( false, -1 ); - } catch( Exception e ) { - // why we have an error while removing CASE is beyond me. Log it. - System.err.println( "Exception while removing LT CASE:\n" + e.getMessage() ); + CurLoadout.SetLTCASE(false, -1); + } catch (Exception e) { + // why we have an error while removing CASE is beyond me. Log it. + System.err.println("Exception while removing LT CASE:\n" + e.getMessage()); } } public void RemoveRTCase() { // remove the RT CASE equipment try { - CurLoadout.SetRTCASE( false, -1 ); - } catch( Exception e ) { - // why we have an error while removing CASE is beyond me. Log it. - System.err.println( "Exception while removing RT CASE:\n" + e.getMessage() ); + CurLoadout.SetRTCASE(false, -1); + } catch (Exception e) { + // why we have an error while removing CASE is beyond me. Log it. + System.err.println("Exception while removing RT CASE:\n" + e.getMessage()); } } public double GetCaseTonnage() { double retval = 0.0; - if( HasCTCase() ) { retval += 0.5; } - if( HasLTCase() ) { retval += 0.5; } - if( HasRTCase() ) { retval += 0.5; } + if (HasCTCase()) { + retval += 0.5; + } + if (HasLTCase()) { + retval += 0.5; + } + if (HasRTCase()) { + retval += 0.5; + } return retval; } @@ -3532,29 +3717,45 @@ public double GetCaseTonnage() { public double GetCASEIITonnage() { double retval = 0.0; - if( CurLoadout.HasHDCASEII() ) { retval += CurLoadout.GetHDCaseII().GetTonnage(); } - if( CurLoadout.HasCTCASEII() ) { retval += CurLoadout.GetCTCaseII().GetTonnage(); } - if( CurLoadout.HasLTCASEII() ) { retval += CurLoadout.GetLTCaseII().GetTonnage(); } - if( CurLoadout.HasRTCASEII() ) { retval += CurLoadout.GetRTCaseII().GetTonnage(); } - if( CurLoadout.HasLACASEII() ) { retval += CurLoadout.GetLACaseII().GetTonnage(); } - if( CurLoadout.HasRACASEII() ) { retval += CurLoadout.GetRACaseII().GetTonnage(); } - if( CurLoadout.HasLLCASEII() ) { retval += CurLoadout.GetLLCaseII().GetTonnage(); } - if( CurLoadout.HasRLCASEII() ) { retval += CurLoadout.GetRLCaseII().GetTonnage(); } + if (CurLoadout.HasHDCASEII()) { + retval += CurLoadout.GetHDCaseII().GetTonnage(); + } + if (CurLoadout.HasCTCASEII()) { + retval += CurLoadout.GetCTCaseII().GetTonnage(); + } + if (CurLoadout.HasLTCASEII()) { + retval += CurLoadout.GetLTCaseII().GetTonnage(); + } + if (CurLoadout.HasRTCASEII()) { + retval += CurLoadout.GetRTCaseII().GetTonnage(); + } + if (CurLoadout.HasLACASEII()) { + retval += CurLoadout.GetLACaseII().GetTonnage(); + } + if (CurLoadout.HasRACASEII()) { + retval += CurLoadout.GetRACaseII().GetTonnage(); + } + if (CurLoadout.HasLLCASEII()) { + retval += CurLoadout.GetLLCaseII().GetTonnage(); + } + if (CurLoadout.HasRLCASEII()) { + retval += CurLoadout.GetRLCaseII().GetTonnage(); + } return retval; } // handlers for Artemis IV operations. - public void SetFCSArtemisIV( boolean b ) throws Exception { - CurLoadout.SetFCSArtemisIV( b ); + public void SetFCSArtemisIV(boolean b) throws Exception { + CurLoadout.SetFCSArtemisIV(b); } - public void SetFCSArtemisV( boolean b ) throws Exception { - CurLoadout.SetFCSArtemisV( b ); + public void SetFCSArtemisV(boolean b) throws Exception { + CurLoadout.SetFCSArtemisV(b); } - public void SetFCSApollo( boolean b ) throws Exception { - CurLoadout.SetFCSApollo( b ); + public void SetFCSApollo(boolean b) throws Exception { + CurLoadout.SetFCSApollo(b); } public boolean UsingArtemisIV() { @@ -3569,11 +3770,11 @@ public boolean UsingApollo() { return CurLoadout.UsingApollo(); } - public boolean UsingDumper(){ + public boolean UsingDumper() { return CurLoadout.UsingDumper(); } - - public void UseDumper (boolean use, String dumpDir){ + + public void UseDumper(boolean use, String dumpDir) { CurLoadout.UseDumper(use, dumpDir); } @@ -3581,12 +3782,12 @@ public Dumper GetDumper() { return CurLoadout.GetDumper(); } - public void CheckDumper(){ + public void CheckDumper() { CurLoadout.CheckDumper(); } - public void UseTC( boolean use, boolean clan ) { - CurLoadout.UseTC( use, clan ); + public void UseTC(boolean use, boolean clan) { + CurLoadout.UseTC(use, clan); } public void CheckTC() { @@ -3597,56 +3798,58 @@ public void UnallocateTC() { CurLoadout.UnallocateTC(); } - public void SetNullSig( boolean set ) throws Exception { - if( set == HasNullSig ) { + public void SetNullSig(boolean set) throws Exception { + if (set == HasNullSig) { return; } else { - if( set ) { + if (set) { try { - MainLoadout.CheckExclusions( NullSig ); - } catch( Exception e ) { + MainLoadout.CheckExclusions(NullSig); + } catch (Exception e) { throw e; } - if( ! NullSig.Place( MainLoadout ) ) { - MainLoadout.Remove( NullSig ); - throw new Exception( "There is no available room for the Null Signature System!\nIt will not be allocated." ); + if (!NullSig.Place(MainLoadout)) { + MainLoadout.Remove(NullSig); + throw new Exception( + "There is no available room for the Null Signature System!\nIt will not be allocated."); } - AddMechModifier( NullSig.GetMechModifier() ); + AddMechModifier(NullSig.GetMechModifier()); HasNullSig = true; } else { - MainLoadout.Remove( NullSig ); + MainLoadout.Remove(NullSig); HasNullSig = false; } } - SetChanged( true ); + SetChanged(true); } // the following method is added for when we want to load a 'Mech // and have specific locations for the system - public void SetNullSig( boolean set, LocationIndex[] locs ) throws Exception { - if( set == HasNullSig ) { + public void SetNullSig(boolean set, LocationIndex[] locs) throws Exception { + if (set == HasNullSig) { return; } else { - if( set ) { + if (set) { try { - MainLoadout.CheckExclusions( NullSig ); - } catch( Exception e ) { + MainLoadout.CheckExclusions(NullSig); + } catch (Exception e) { throw e; } - if( ! NullSig.Place( MainLoadout, locs ) ) { - MainLoadout.Remove( NullSig ); - throw new Exception( "There is no available room for the Null Signature System!\nIt will not be allocated." ); + if (!NullSig.Place(MainLoadout, locs)) { + MainLoadout.Remove(NullSig); + throw new Exception( + "There is no available room for the Null Signature System!\nIt will not be allocated."); } - AddMechModifier( NullSig.GetMechModifier() ); + AddMechModifier(NullSig.GetMechModifier()); HasNullSig = true; } else { - MainLoadout.Remove( NullSig ); + MainLoadout.Remove(NullSig); HasNullSig = false; } } - SetChanged( true ); + SetChanged(true); } public boolean HasNullSig() { @@ -3657,56 +3860,56 @@ public MultiSlotSystem GetNullSig() { return NullSig; } - public void SetChameleon( boolean set ) throws Exception { - if( set == HasChameleon ) { + public void SetChameleon(boolean set) throws Exception { + if (set == HasChameleon) { return; } else { - if( set ) { + if (set) { try { - MainLoadout.CheckExclusions( Chameleon ); - } catch( Exception e ) { + MainLoadout.CheckExclusions(Chameleon); + } catch (Exception e) { throw e; } - if( ! Chameleon.Place( MainLoadout ) ) { - MainLoadout.Remove( Chameleon ); - throw new Exception( "There is no available room for the Chameleon LPS!\nIt will not be allocated." ); + if (!Chameleon.Place(MainLoadout)) { + MainLoadout.Remove(Chameleon); + throw new Exception("There is no available room for the Chameleon LPS!\nIt will not be allocated."); } - AddMechModifier( Chameleon.GetMechModifier() ); + AddMechModifier(Chameleon.GetMechModifier()); HasChameleon = true; } else { - MainLoadout.Remove( Chameleon ); + MainLoadout.Remove(Chameleon); HasChameleon = false; } } - SetChanged( true ); + SetChanged(true); } // the following method is added for when we want to load a 'Mech // and have specific locations for the system - public void SetChameleon( boolean set, LocationIndex[] locs ) throws Exception { - if( set == HasChameleon ) { + public void SetChameleon(boolean set, LocationIndex[] locs) throws Exception { + if (set == HasChameleon) { return; } else { - if( set ) { + if (set) { try { - MainLoadout.CheckExclusions( Chameleon ); - } catch( Exception e ) { + MainLoadout.CheckExclusions(Chameleon); + } catch (Exception e) { throw e; } - if( ! Chameleon.Place( MainLoadout, locs ) ) { - MainLoadout.Remove( Chameleon ); - throw new Exception( "There is no available room for the Chameleon LPS!\nIt will not be allocated." ); + if (!Chameleon.Place(MainLoadout, locs)) { + MainLoadout.Remove(Chameleon); + throw new Exception("There is no available room for the Chameleon LPS!\nIt will not be allocated."); } - AddMechModifier( Chameleon.GetMechModifier() ); + AddMechModifier(Chameleon.GetMechModifier()); HasChameleon = true; } else { - MainLoadout.Remove( Chameleon ); + MainLoadout.Remove(Chameleon); HasChameleon = false; } } - SetChanged( true ); + SetChanged(true); } public boolean HasChameleon() { @@ -3716,28 +3919,25 @@ public boolean HasChameleon() { public MultiSlotSystem GetChameleon() { return Chameleon; } - + /** - * Determines if this 'Mech uses a shield in the right arm - * Returns true if found and false otherwise. - * Used to determine the proper location of the "Armor Pts" + * Determines if this 'Mech uses a shield in the right arm Returns true if found + * and false otherwise. Used to determine the proper location of the "Armor Pts" * text on a record sheet */ - public boolean HasRAShield() - { - abPlaceable items [] = CurLoadout.GetRACrits(); + public boolean HasRAShield() { + abPlaceable items[] = CurLoadout.GetRACrits(); for (abPlaceable item : items) { - if( item instanceof PhysicalWeapon ) { - if ( ((PhysicalWeapon) item).GetPWClass() == PhysicalWeapon.PW_CLASS_SHIELD ) - return true; + if (item instanceof PhysicalWeapon) { + if (((PhysicalWeapon) item).GetPWClass() == PhysicalWeapon.PW_CLASS_SHIELD) + return true; } } return false; } - public boolean HasLAShield() - { - abPlaceable items [] = CurLoadout.GetLACrits(); + public boolean HasLAShield() { + abPlaceable items[] = CurLoadout.GetLACrits(); for (abPlaceable item : items) { if (item instanceof PhysicalWeapon) { if (((PhysicalWeapon) item).GetPWClass() == PhysicalWeapon.PW_CLASS_SHIELD) { @@ -3748,56 +3948,58 @@ public boolean HasLAShield() return false; } - public void SetVoidSig( boolean set ) throws Exception { - if( set == HasVoidSig ) { + public void SetVoidSig(boolean set) throws Exception { + if (set == HasVoidSig) { return; } else { - if( set ) { + if (set) { try { - MainLoadout.CheckExclusions( VoidSig ); - } catch( Exception e ) { + MainLoadout.CheckExclusions(VoidSig); + } catch (Exception e) { throw e; } - if( ! VoidSig.Place( MainLoadout ) ) { - MainLoadout.Remove( VoidSig ); - throw new Exception( "There is no available room for the Void Signature System!\nIt will not be allocated." ); + if (!VoidSig.Place(MainLoadout)) { + MainLoadout.Remove(VoidSig); + throw new Exception( + "There is no available room for the Void Signature System!\nIt will not be allocated."); } - AddMechModifier( VoidSig.GetMechModifier() ); + AddMechModifier(VoidSig.GetMechModifier()); HasVoidSig = true; } else { - MainLoadout.Remove( VoidSig ); + MainLoadout.Remove(VoidSig); HasVoidSig = false; } } - SetChanged( true ); + SetChanged(true); } // the following method is added for when we want to load a 'Mech // and have specific locations for the system - public void SetVoidSig( boolean set, LocationIndex[] locs ) throws Exception { - if( set == HasVoidSig ) { + public void SetVoidSig(boolean set, LocationIndex[] locs) throws Exception { + if (set == HasVoidSig) { return; } else { - if( set ) { + if (set) { try { - MainLoadout.CheckExclusions( VoidSig ); - } catch( Exception e ) { + MainLoadout.CheckExclusions(VoidSig); + } catch (Exception e) { throw e; } - if( ! VoidSig.Place( MainLoadout, locs ) ) { - MainLoadout.Remove( VoidSig ); - throw new Exception( "There is no available room for the Void Signature System!\nIt will not be allocated." ); + if (!VoidSig.Place(MainLoadout, locs)) { + MainLoadout.Remove(VoidSig); + throw new Exception( + "There is no available room for the Void Signature System!\nIt will not be allocated."); } - AddMechModifier( VoidSig.GetMechModifier() ); + AddMechModifier(VoidSig.GetMechModifier()); HasVoidSig = true; } else { - MainLoadout.Remove( VoidSig ); + MainLoadout.Remove(VoidSig); HasVoidSig = false; } } - SetChanged( true ); + SetChanged(true); } public boolean HasVoidSig() { @@ -3808,56 +4010,58 @@ public MultiSlotSystem GetVoidSig() { return VoidSig; } - public void SetBlueShield( boolean set ) throws Exception { - if( set == HasBlueShield ) { + public void SetBlueShield(boolean set) throws Exception { + if (set == HasBlueShield) { return; } else { - if( set ) { + if (set) { try { - MainLoadout.CheckExclusions( BlueShield ); - } catch( Exception e ) { + MainLoadout.CheckExclusions(BlueShield); + } catch (Exception e) { throw e; } - if( ! BlueShield.Place( MainLoadout ) ) { - MainLoadout.Remove( BlueShield ); - throw new Exception( "There is no available room for the Blue Shield PFD!\nIt will not be allocated." ); + if (!BlueShield.Place(MainLoadout)) { + MainLoadout.Remove(BlueShield); + throw new Exception( + "There is no available room for the Blue Shield PFD!\nIt will not be allocated."); } - AddMechModifier( BlueShield.GetMechModifier() ); + AddMechModifier(BlueShield.GetMechModifier()); HasBlueShield = true; } else { - MainLoadout.Remove( BlueShield ); + MainLoadout.Remove(BlueShield); HasBlueShield = false; } } - SetChanged( true ); + SetChanged(true); } // the following method is added for when we want to load a 'Mech // and have specific locations for the system - public void SetBlueShield( boolean set, LocationIndex[] locs ) throws Exception { - if( set == HasBlueShield ) { + public void SetBlueShield(boolean set, LocationIndex[] locs) throws Exception { + if (set == HasBlueShield) { return; } else { - if( set ) { + if (set) { try { - MainLoadout.CheckExclusions( BlueShield ); - } catch( Exception e ) { + MainLoadout.CheckExclusions(BlueShield); + } catch (Exception e) { throw e; } - if( ! BlueShield.Place( MainLoadout, locs ) ) { - MainLoadout.Remove( BlueShield ); - throw new Exception( "There is no available room for the Blue Shield PFD!\nIt will not be allocated." ); + if (!BlueShield.Place(MainLoadout, locs)) { + MainLoadout.Remove(BlueShield); + throw new Exception( + "There is no available room for the Blue Shield PFD!\nIt will not be allocated."); } - AddMechModifier( BlueShield.GetMechModifier() ); + AddMechModifier(BlueShield.GetMechModifier()); HasBlueShield = true; } else { - MainLoadout.Remove( BlueShield ); + MainLoadout.Remove(BlueShield); HasBlueShield = false; } } - SetChanged( true ); + SetChanged(true); } public boolean HasBlueShield() { @@ -3868,56 +4072,58 @@ public MultiSlotSystem GetBlueShield() { return BlueShield; } - public void SetEnviroSealing( boolean set ) throws Exception { - if( set == HasEnviroSealing ) { + public void SetEnviroSealing(boolean set) throws Exception { + if (set == HasEnviroSealing) { return; } else { - if( set ) { + if (set) { try { - MainLoadout.CheckExclusions( EnviroSealing ); - } catch( Exception e ) { + MainLoadout.CheckExclusions(EnviroSealing); + } catch (Exception e) { throw e; } - if( ! EnviroSealing.Place( MainLoadout ) ) { - MainLoadout.Remove( EnviroSealing ); - throw new Exception( "There is no available room for the Environmental Sealing!\nIt will not be allocated." ); + if (!EnviroSealing.Place(MainLoadout)) { + MainLoadout.Remove(EnviroSealing); + throw new Exception( + "There is no available room for the Environmental Sealing!\nIt will not be allocated."); } - AddMechModifier( EnviroSealing.GetMechModifier() ); + AddMechModifier(EnviroSealing.GetMechModifier()); HasEnviroSealing = true; } else { - MainLoadout.Remove( EnviroSealing ); + MainLoadout.Remove(EnviroSealing); HasEnviroSealing = false; } } - SetChanged( true ); + SetChanged(true); } // the following method is added for when we want to load a 'Mech // and have specific locations for the system - public void SetEnviroSealing( boolean set, LocationIndex[] locs ) throws Exception { - if( set == HasEnviroSealing ) { + public void SetEnviroSealing(boolean set, LocationIndex[] locs) throws Exception { + if (set == HasEnviroSealing) { return; } else { - if( set ) { + if (set) { try { - MainLoadout.CheckExclusions( EnviroSealing ); - } catch( Exception e ) { + MainLoadout.CheckExclusions(EnviroSealing); + } catch (Exception e) { throw e; } - if( ! EnviroSealing.Place( MainLoadout, locs ) ) { - MainLoadout.Remove( EnviroSealing ); - throw new Exception( "There is no available room for the Environmental Sealing!\nIt will not be allocated." ); + if (!EnviroSealing.Place(MainLoadout, locs)) { + MainLoadout.Remove(EnviroSealing); + throw new Exception( + "There is no available room for the Environmental Sealing!\nIt will not be allocated."); } - AddMechModifier( EnviroSealing.GetMechModifier() ); + AddMechModifier(EnviroSealing.GetMechModifier()); HasEnviroSealing = true; } else { - MainLoadout.Remove( EnviroSealing ); + MainLoadout.Remove(EnviroSealing); HasEnviroSealing = false; } } - SetChanged( true ); + SetChanged(true); } public boolean HasEnviroSealing() { @@ -3928,57 +4134,56 @@ public MultiSlotSystem GetEnviroSealing() { return EnviroSealing; } - - public void SetTracks( boolean set ) throws Exception { - if( set == HasTracks ) { + public void SetTracks(boolean set) throws Exception { + if (set == HasTracks) { return; } else { - if( set ) { + if (set) { try { - MainLoadout.CheckExclusions( Tracks ); - } catch( Exception e ) { + MainLoadout.CheckExclusions(Tracks); + } catch (Exception e) { throw e; } - if( ! Tracks.Place( MainLoadout ) ) { - MainLoadout.Remove( Tracks ); - throw new Exception( "There is no available room for the Tracks!\nIt will not be allocated." ); + if (!Tracks.Place(MainLoadout)) { + MainLoadout.Remove(Tracks); + throw new Exception("There is no available room for the Tracks!\nIt will not be allocated."); } - AddMechModifier( Tracks.GetMechModifier() ); + AddMechModifier(Tracks.GetMechModifier()); HasTracks = true; } else { - MainLoadout.Remove( Tracks ); + MainLoadout.Remove(Tracks); HasTracks = false; } } - SetChanged( true ); + SetChanged(true); } // the following method is added for when we want to load a 'Mech // and have specific locations for the system - public void SetTracks( boolean set, LocationIndex[] locs ) throws Exception { - if( set == HasTracks ) { + public void SetTracks(boolean set, LocationIndex[] locs) throws Exception { + if (set == HasTracks) { return; } else { - if( set ) { + if (set) { try { - MainLoadout.CheckExclusions( Tracks ); - } catch( Exception e ) { + MainLoadout.CheckExclusions(Tracks); + } catch (Exception e) { throw e; } - if( ! Tracks.Place( MainLoadout, locs ) ) { - MainLoadout.Remove( Tracks ); - throw new Exception( "There is no available room for the Tracks!\nIt will not be allocated." ); + if (!Tracks.Place(MainLoadout, locs)) { + MainLoadout.Remove(Tracks); + throw new Exception("There is no available room for the Tracks!\nIt will not be allocated."); } - AddMechModifier( Tracks.GetMechModifier() ); + AddMechModifier(Tracks.GetMechModifier()); HasTracks = true; } else { - MainLoadout.Remove( Tracks ); + MainLoadout.Remove(Tracks); HasTracks = false; } } - SetChanged( true ); + SetChanged(true); } public boolean HasTracks() { @@ -3989,21 +4194,21 @@ public MultiSlotSystem GetTracks() { return Tracks; } - public void SetEjectionSeat( boolean set ) throws Exception { - if( set == HasEjectionSeat ) { + public void SetEjectionSeat(boolean set) throws Exception { + if (set == HasEjectionSeat) { return; } else { - if( set ) { + if (set) { // Ejection seat can only go in the main loadout - MainLoadout.AddTo( EjectionSeat, LocationIndex.MECH_LOC_HD, 3 ); + MainLoadout.AddTo(EjectionSeat, LocationIndex.MECH_LOC_HD, 3); HasEjectionSeat = true; } else { - MainLoadout.Remove( EjectionSeat ); + MainLoadout.Remove(EjectionSeat); HasEjectionSeat = false; } } - SetChanged( true ); + SetChanged(true); } public boolean HasEjectionSeat() { @@ -4014,61 +4219,77 @@ public SimplePlaceable GetEjectionSeat() { return EjectionSeat; } - public void SetPartialWing( boolean b ) throws Exception { - if( Omnimech ) { return; } - if( HasJumpBooster ) { throw new Exception( "Partial Wing is incompatible with Mechanical Jump Boosters." ); } - if( b ) { - Wing.SetClan( (GetTechBase() == AvailableCode.TECH_CLAN) || (GetTechBase() == AvailableCode.TECH_BOTH) ); - if( ! Wing.Place( MainLoadout ) ) { - throw new Exception( "There is no available room for the Partial Wing!\nIt will not be allocated." ); + public void SetPartialWing(boolean b) throws Exception { + if (Omnimech) { + return; + } + if (HasJumpBooster) { + throw new Exception("Partial Wing is incompatible with Mechanical Jump Boosters."); + } + if (b) { + Wing.SetClan((GetTechBase() == AvailableCode.TECH_CLAN) || (GetTechBase() == AvailableCode.TECH_BOTH)); + if (!Wing.Place(MainLoadout)) { + throw new Exception("There is no available room for the Partial Wing!\nIt will not be allocated."); } } else { - Wing.Remove( MainLoadout ); + Wing.Remove(MainLoadout); } HasPartialWing = b; } - public void SetPartialWing( boolean b, boolean useClan ) throws Exception { - if( Omnimech ) { return; } - if( HasJumpBooster ) { throw new Exception( "Partial Wing is incompatible with Mechanical Jump Boosters." ); } - if( b ) { - Wing.SetClan( useClan ); - if( ! Wing.Place( MainLoadout ) ) { + public void SetPartialWing(boolean b, boolean useClan) throws Exception { + if (Omnimech) { + return; + } + if (HasJumpBooster) { + throw new Exception("Partial Wing is incompatible with Mechanical Jump Boosters."); + } + if (b) { + Wing.SetClan(useClan); + if (!Wing.Place(MainLoadout)) { HasPartialWing = false; - throw new Exception( "There is no available room for the Partial Wing!\nIt will not be allocated." ); + throw new Exception("There is no available room for the Partial Wing!\nIt will not be allocated."); } } else { - Wing.Remove( MainLoadout ); + Wing.Remove(MainLoadout); } HasPartialWing = b; } - public void SetPartialWing( boolean b, boolean useClan, LocationIndex[] lpw ) throws Exception { - if( Omnimech ) { return; } - if( HasJumpBooster ) { throw new Exception( "Partial Wing is incompatible with Mechanical Jump Boosters." ); } - if( b ) { - Wing.SetClan( useClan ); - if( ! Wing.Place( MainLoadout, lpw ) ) { + public void SetPartialWing(boolean b, boolean useClan, LocationIndex[] lpw) throws Exception { + if (Omnimech) { + return; + } + if (HasJumpBooster) { + throw new Exception("Partial Wing is incompatible with Mechanical Jump Boosters."); + } + if (b) { + Wing.SetClan(useClan); + if (!Wing.Place(MainLoadout, lpw)) { HasPartialWing = false; - throw new Exception( "There is no available room for the Partial Wing!\nIt will not be allocated." ); + throw new Exception("There is no available room for the Partial Wing!\nIt will not be allocated."); } } else { - Wing.Remove( MainLoadout ); + Wing.Remove(MainLoadout); } HasPartialWing = b; } - public void SetPartialWing( boolean b, LocationIndex[] lpw ) throws Exception { - if( Omnimech ) { return; } - if( HasJumpBooster ) { throw new Exception( "Partial Wing is incompatible with Mechanical Jump Boosters." ); } - if( b ) { - Wing.SetClan( (GetTechBase() == AvailableCode.TECH_CLAN) || (GetTechBase() == AvailableCode.TECH_BOTH) ); - if( ! Wing.Place( MainLoadout, lpw ) ) { + public void SetPartialWing(boolean b, LocationIndex[] lpw) throws Exception { + if (Omnimech) { + return; + } + if (HasJumpBooster) { + throw new Exception("Partial Wing is incompatible with Mechanical Jump Boosters."); + } + if (b) { + Wing.SetClan((GetTechBase() == AvailableCode.TECH_CLAN) || (GetTechBase() == AvailableCode.TECH_BOTH)); + if (!Wing.Place(MainLoadout, lpw)) { HasPartialWing = false; - throw new Exception( "There is no available room for the Partial Wing!\nIt will not be allocated." ); + throw new Exception("There is no available room for the Partial Wing!\nIt will not be allocated."); } } else { - Wing.Remove( MainLoadout ); + Wing.Remove(MainLoadout); } HasPartialWing = b; } @@ -4081,16 +4302,20 @@ public PartialWing GetPartialWing() { return Wing; } - public void SetJumpBooster( boolean b ) throws Exception { - if( Omnimech ) { return; } - if( HasPartialWing ) { throw new Exception( "Mechanical Jump Booster is incompatible with Partial Wing." ); } - if( b ) { - if( ! JumpBooster.Place( MainLoadout ) ) { - throw new Exception( "There is no available room for the Jump Boosters!\nThey will not be allocated." ); + public void SetJumpBooster(boolean b) throws Exception { + if (Omnimech) { + return; + } + if (HasPartialWing) { + throw new Exception("Mechanical Jump Booster is incompatible with Partial Wing."); + } + if (b) { + if (!JumpBooster.Place(MainLoadout)) { + throw new Exception("There is no available room for the Jump Boosters!\nThey will not be allocated."); } } else { - JumpBooster.Remove( MainLoadout ); - JumpBooster.SetBoostMP( 0 ); + JumpBooster.Remove(MainLoadout); + JumpBooster.SetBoostMP(0); } HasJumpBooster = b; } @@ -4103,32 +4328,34 @@ public MechanicalJumpBooster GetJumpBooster() { return JumpBooster; } - public void SetLAAES( boolean set, int index ) throws Exception { - if( set == HasLAAES ) { return; } - if( IsQuad() ) { - throw new Exception( "A quad 'Mech may not mount arm-based A.E.S. systems." ); + public void SetLAAES(boolean set, int index) throws Exception { + if (set == HasLAAES) { + return; + } + if (IsQuad()) { + throw new Exception("A quad 'Mech may not mount arm-based A.E.S. systems."); } - if( set ) { + if (set) { try { - MainLoadout.CheckExclusions( LAAES ); - } catch( Exception e ) { + MainLoadout.CheckExclusions(LAAES); + } catch (Exception e) { throw e; } - if( index < 0 ) { + if (index < 0) { // plop it in the arm where it'll fit. - CurLoadout.AddToLA( CurLAAES ); + CurLoadout.AddToLA(CurLAAES); HasLAAES = true; } else { // we have a specific location in mind here - CurLoadout.AddToLA( CurLAAES, index ); + CurLoadout.AddToLA(CurLAAES, index); HasLAAES = true; } } else { - CurLoadout.Remove( CurLAAES ); + CurLoadout.Remove(CurLAAES); HasLAAES = false; } - SetChanged( true ); + SetChanged(true); } public boolean HasLAAES() { @@ -4139,32 +4366,34 @@ public AESSystem GetLAAES() { return CurLAAES; } - public void SetRAAES( boolean set, int index ) throws Exception { - if( set == HasRAAES ) { return; } - if( IsQuad() ) { - throw new Exception( "A quad 'Mech may not mount arm-based A.E.S. systems." ); + public void SetRAAES(boolean set, int index) throws Exception { + if (set == HasRAAES) { + return; + } + if (IsQuad()) { + throw new Exception("A quad 'Mech may not mount arm-based A.E.S. systems."); } - if( set ) { + if (set) { try { - MainLoadout.CheckExclusions( RAAES ); - } catch( Exception e ) { + MainLoadout.CheckExclusions(RAAES); + } catch (Exception e) { throw e; } - if( index < 0 ) { + if (index < 0) { // plop it in the arm where it'll fit. - CurLoadout.AddToRA( CurRAAES ); + CurLoadout.AddToRA(CurRAAES); HasRAAES = true; } else { // we have a specific location in mind here - CurLoadout.AddToRA( CurRAAES, index ); + CurLoadout.AddToRA(CurRAAES, index); HasRAAES = true; } } else { - CurLoadout.Remove( CurRAAES ); + CurLoadout.Remove(CurRAAES); HasRAAES = false; } - SetChanged( true ); + SetChanged(true); } public boolean HasRAAES() { @@ -4175,51 +4404,57 @@ public AESSystem GetRAAES() { return CurRAAES; } - public void SetLegAES( boolean set, LocationIndex[] Loc ) throws Exception { - if( set == HasLegAES ) { return; } + public void SetLegAES(boolean set, LocationIndex[] Loc) throws Exception { + if (set == HasLegAES) { + return; + } boolean FRL = false, FLL = false, RL = false, LL = false; - if( IsQuad() ) { - if( set ) { + if (IsQuad()) { + if (set) { try { - MainLoadout.CheckExclusions( LAAES ); - } catch( Exception e ) { + MainLoadout.CheckExclusions(LAAES); + } catch (Exception e) { throw e; } - if( Loc != null ) { + if (Loc != null) { try { // we've got some locations, go through them and adjust for // any missing locations - for( int i = 0; i < Loc.length; i++ ) { - switch( Loc[i].Location ) { + for (int i = 0; i < Loc.length; i++) { + switch (Loc[i].Location) { case LocationIndex.MECH_LOC_RA: - if( FRL ) { - throw new Exception( "The 'Mech already has an AES system in the FRL.\nAES System will not be installed." ); + if (FRL) { + throw new Exception( + "The 'Mech already has an AES system in the FRL.\nAES System will not be installed."); } else { - CurLoadout.AddToRA( CurRAAES, Loc[i].Index ); + CurLoadout.AddToRA(CurRAAES, Loc[i].Index); FRL = true; } break; case LocationIndex.MECH_LOC_LA: - if( FLL ) { - throw new Exception( "The 'Mech already has an AES system in the FLL.\nAES System will not be installed." ); + if (FLL) { + throw new Exception( + "The 'Mech already has an AES system in the FLL.\nAES System will not be installed."); } else { - CurLoadout.AddToLA( CurLAAES, Loc[i].Index ); + CurLoadout.AddToLA(CurLAAES, Loc[i].Index); FLL = true; } break; case LocationIndex.MECH_LOC_RL: - if( RL ) { - throw new Exception( "The 'Mech already has an AES system in the RL.\nAES System will not be installed." ); + if (RL) { + throw new Exception( + "The 'Mech already has an AES system in the RL.\nAES System will not be installed."); } else { - CurLoadout.AddToRL( RLAES, Loc[i].Index ); + CurLoadout.AddToRL(RLAES, Loc[i].Index); RL = true; } break; case LocationIndex.MECH_LOC_LL: - if( LL ) { - throw new Exception( "The 'Mech already has an AES system in the LL.\nAES System will not be installed." ); + if (LL) { + throw new Exception( + "The 'Mech already has an AES system in the LL.\nAES System will not be installed."); } else { - CurLoadout.AddToLL( LLAES, Loc[i].Index ); + CurLoadout.AddToLL(LLAES, Loc[i].Index); LL = true; } break; @@ -4227,24 +4462,24 @@ public void SetLegAES( boolean set, LocationIndex[] Loc ) throws Exception { } // now handle any locations we don't have - if( ! FRL ) { - CurLoadout.AddToRA( CurRAAES ); - } - if( ! FLL ) { - CurLoadout.AddToLA( CurLAAES ); + if (!FRL) { + CurLoadout.AddToRA(CurRAAES); + } + if (!FLL) { + CurLoadout.AddToLA(CurLAAES); } - if( ! RL ) { - CurLoadout.AddToRL( RLAES ); + if (!RL) { + CurLoadout.AddToRL(RLAES); } - if( ! LL ) { - CurLoadout.AddToLL( LLAES ); + if (!LL) { + CurLoadout.AddToLL(LLAES); } - } catch( Exception e ) { + } catch (Exception e) { // remove all the leg AES systems in the 'Mech - CurLoadout.Remove( FRLAES ); - CurLoadout.Remove( FLLAES ); - CurLoadout.Remove( RLAES ); - CurLoadout.Remove( LLAES ); + CurLoadout.Remove(FRLAES); + CurLoadout.Remove(FLLAES); + CurLoadout.Remove(RLAES); + CurLoadout.Remove(LLAES); HasLegAES = false; throw e; } @@ -4254,55 +4489,57 @@ public void SetLegAES( boolean set, LocationIndex[] Loc ) throws Exception { } else { // no locations so just plop them in try { - CurLoadout.AddToRA( CurRAAES ); - CurLoadout.AddToLA( CurLAAES ); - CurLoadout.AddToRL( RLAES ); - CurLoadout.AddToLL( LLAES ); + CurLoadout.AddToRA(CurRAAES); + CurLoadout.AddToLA(CurLAAES); + CurLoadout.AddToRL(RLAES); + CurLoadout.AddToLL(LLAES); HasLegAES = true; - } catch( Exception e ) { + } catch (Exception e) { // remove all the leg AES systems in the 'Mech - CurLoadout.Remove( FRLAES ); - CurLoadout.Remove( FLLAES ); - CurLoadout.Remove( RLAES ); - CurLoadout.Remove( LLAES ); + CurLoadout.Remove(FRLAES); + CurLoadout.Remove(FLLAES); + CurLoadout.Remove(RLAES); + CurLoadout.Remove(LLAES); HasLegAES = false; throw e; } } } else { // remove all the leg AES systems in the 'Mech - CurLoadout.Remove( FRLAES ); - CurLoadout.Remove( FLLAES ); - CurLoadout.Remove( RLAES ); - CurLoadout.Remove( LLAES ); + CurLoadout.Remove(FRLAES); + CurLoadout.Remove(FLLAES); + CurLoadout.Remove(RLAES); + CurLoadout.Remove(LLAES); HasLegAES = false; } } else { - if( set ) { + if (set) { try { - MainLoadout.CheckExclusions( LAAES ); - } catch( Exception e ) { + MainLoadout.CheckExclusions(LAAES); + } catch (Exception e) { throw e; } - if( Loc != null ) { + if (Loc != null) { try { // we've got some locations, go through them and adjust for // any missing locations - for( int i = 0; i < Loc.length; i++ ) { - switch( Loc[i].Location ) { + for (int i = 0; i < Loc.length; i++) { + switch (Loc[i].Location) { case LocationIndex.MECH_LOC_RL: - if( RL ) { - throw new Exception( "The 'Mech already has an AES system in the RL.\nAES System will not be installed." ); + if (RL) { + throw new Exception( + "The 'Mech already has an AES system in the RL.\nAES System will not be installed."); } else { - CurLoadout.AddToRL( RLAES, Loc[i].Index ); + CurLoadout.AddToRL(RLAES, Loc[i].Index); RL = true; } break; case LocationIndex.MECH_LOC_LL: - if( LL ) { - throw new Exception( "The 'Mech already has an AES system in the LL.\nAES System will not be installed." ); + if (LL) { + throw new Exception( + "The 'Mech already has an AES system in the LL.\nAES System will not be installed."); } else { - CurLoadout.AddToLL( LLAES, Loc[i].Index ); + CurLoadout.AddToLL(LLAES, Loc[i].Index); LL = true; } break; @@ -4310,16 +4547,16 @@ public void SetLegAES( boolean set, LocationIndex[] Loc ) throws Exception { } // now handle any locations we don't have - if( ! RL ) { - CurLoadout.AddToRL( RLAES ); + if (!RL) { + CurLoadout.AddToRL(RLAES); } - if( ! LL ) { - CurLoadout.AddToLL( LLAES ); + if (!LL) { + CurLoadout.AddToLL(LLAES); } - } catch( Exception e ) { + } catch (Exception e) { // remove all the leg AES systems in the 'Mech - CurLoadout.Remove( RLAES ); - CurLoadout.Remove( LLAES ); + CurLoadout.Remove(RLAES); + CurLoadout.Remove(LLAES); HasLegAES = false; throw e; } @@ -4329,26 +4566,26 @@ public void SetLegAES( boolean set, LocationIndex[] Loc ) throws Exception { } else { // no locations so just plop them in try { - CurLoadout.AddToRL( RLAES ); - CurLoadout.AddToLL( LLAES ); + CurLoadout.AddToRL(RLAES); + CurLoadout.AddToLL(LLAES); HasLegAES = true; - } catch( Exception e ) { + } catch (Exception e) { // remove all the leg AES systems in the 'Mech - CurLoadout.Remove( RLAES ); - CurLoadout.Remove( LLAES ); + CurLoadout.Remove(RLAES); + CurLoadout.Remove(LLAES); HasLegAES = false; throw e; } } } else { // remove all the leg AES systems in the 'Mech - CurLoadout.Remove( RLAES ); - CurLoadout.Remove( LLAES ); + CurLoadout.Remove(RLAES); + CurLoadout.Remove(LLAES); HasLegAES = false; } } - SetChanged( true ); + SetChanged(true); } public boolean HasLegAES() { @@ -4372,14 +4609,14 @@ public AESSystem GetLLAES() { } public boolean CanUseFHES() { - if( HasCommandConsole() || CurCockpit.IsTorsoMounted() ) { + if (HasCommandConsole() || CurCockpit.IsTorsoMounted()) { return false; } else { return true; } } - public void SetFHES( boolean b ) { + public void SetFHES(boolean b) { HasFHES = b; } @@ -4394,11 +4631,11 @@ public AvailableCode GetFHESAC() { public void CheckPhysicals() { // unallocates physical weapons, especially if the tonnage changes // we'll also check to see if the mech is a quad and remove the weapons - ArrayList v = CurLoadout.GetNonCore(); - for( int i = 0; i < v.size(); i++ ) { - abPlaceable p = (abPlaceable) v.get( i ); - if( p instanceof PhysicalWeapon ) { - CurLoadout.UnallocateAll( p, false ); + ArrayList v = CurLoadout.GetNonCore(); + for (int i = 0; i < v.size(); i++) { + abPlaceable p = (abPlaceable) v.get(i); + if (p instanceof PhysicalWeapon) { + CurLoadout.UnallocateAll(p, false); } } } @@ -4409,205 +4646,212 @@ public AvailableCode GetOmniMechAvailability() { public AvailableCode GetAvailability() { // returns the availability code for this mech based on all components - AvailableCode Base = new AvailableCode( CurLoadout.GetTechBase() ); - Base.SetCodes( 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A' ); - Base.SetISDates( 0, 0, false, 1950, 0, 0, false, false ); - Base.SetCLDates( 0, 0, false, 1950, 0, 0, false, false ); - Base.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - if( Omnimech ) { - Base.Combine( OmniAvailable ); + AvailableCode Base = new AvailableCode(CurLoadout.GetTechBase()); + Base.SetCodes('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); + Base.SetISDates(0, 0, false, 1950, 0, 0, false, false); + Base.SetCLDates(0, 0, false, 1950, 0, 0, false, false); + Base.SetRulesLevels(AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + if (Omnimech) { + Base.Combine(OmniAvailable); } // combine the availability codes from all equipment - Base.Combine( CurEngine.GetAvailability() ); - Base.Combine( CurGyro.GetAvailability() ); - Base.Combine( CurIntStruc.GetAvailability() ); - Base.Combine( CurCockpit.GetAvailability() ); - if( HasCommandConsole() ) { - Base.Combine( CommandConsole.GetAvailability() ); + Base.Combine(CurEngine.GetAvailability()); + Base.Combine(CurGyro.GetAvailability()); + Base.Combine(CurIntStruc.GetAvailability()); + Base.Combine(CurCockpit.GetAvailability()); + if (HasCommandConsole()) { + Base.Combine(CommandConsole.GetAvailability()); + } + Base.Combine(GetActuators().GetAvailability()); + Base.Combine(CurPhysEnhance.GetAvailability()); + Base.Combine(GetHeatSinks().GetAvailability()); + if (GetJumpJets().GetNumJJ() > 0) { + Base.Combine(GetJumpJets().GetAvailability()); } - Base.Combine( GetActuators().GetAvailability() ); - Base.Combine( CurPhysEnhance.GetAvailability() ); - Base.Combine( GetHeatSinks().GetAvailability() ); - if( GetJumpJets().GetNumJJ() > 0 ) { - Base.Combine( GetJumpJets().GetAvailability() ); + Base.Combine(CurArmor.GetAvailability()); + if (CurLoadout.UsingTC()) { + Base.Combine(GetTC().GetAvailability()); } - Base.Combine( CurArmor.GetAvailability() ); - if( CurLoadout.UsingTC() ) { - Base.Combine( GetTC().GetAvailability() ); + if (HasCTCase() || HasRTCase() || HasLTCase()) { + Base.Combine(CurLoadout.GetCTCase().GetAvailability()); } - if( HasCTCase() || HasRTCase() || HasLTCase() ) { - Base.Combine( CurLoadout.GetCTCase().GetAvailability() ); + if (CurLoadout.HasHDCASEII() || CurLoadout.HasCTCASEII() || CurLoadout.HasLTCASEII() || CurLoadout.HasRTCASEII() + || CurLoadout.HasLACASEII() || CurLoadout.HasRACASEII() || CurLoadout.HasLLCASEII() + || CurLoadout.HasRLCASEII()) { + Base.Combine(CurLoadout.GetCTCaseII().GetAvailability()); } - if( CurLoadout.HasHDCASEII() || CurLoadout.HasCTCASEII() || CurLoadout.HasLTCASEII() || CurLoadout.HasRTCASEII() || - CurLoadout.HasLACASEII() || CurLoadout.HasRACASEII() || CurLoadout.HasLLCASEII() || CurLoadout.HasRLCASEII() ) { - Base.Combine( CurLoadout.GetCTCaseII().GetAvailability() ); + if (!CurEngine.IsNuclear()) { + Base.Combine(CurLoadout.GetPowerAmplifier().GetAvailability()); } - if( ! CurEngine.IsNuclear() ) { Base.Combine( CurLoadout.GetPowerAmplifier().GetAvailability() ); } - ArrayList v = CurLoadout.GetNonCore(); - for( int i = 0; i < v.size(); i++ ) { - Base.Combine( ((abPlaceable) v.get( i )).GetAvailability() ); + ArrayList v = CurLoadout.GetNonCore(); + for (int i = 0; i < v.size(); i++) { + Base.Combine(((abPlaceable) v.get(i)).GetAvailability()); } - if( CurLoadout.HasSupercharger() ) { - Base.Combine( CurLoadout.GetSupercharger().GetAvailability() ); + if (CurLoadout.HasSupercharger()) { + Base.Combine(CurLoadout.GetSupercharger().GetAvailability()); } - if( HasBlueShield() ) { - Base.Combine( BlueShield.GetAvailability() ); + if (HasBlueShield()) { + Base.Combine(BlueShield.GetAvailability()); } - if( HasNullSig() ) { - Base.Combine( NullSig.GetAvailability() ); + if (HasNullSig()) { + Base.Combine(NullSig.GetAvailability()); } - if( HasVoidSig() ) { - Base.Combine( VoidSig.GetAvailability() ); + if (HasVoidSig()) { + Base.Combine(VoidSig.GetAvailability()); } - if( HasChameleon() ) { - Base.Combine( Chameleon.GetAvailability() ); + if (HasChameleon()) { + Base.Combine(Chameleon.GetAvailability()); } - if( HasEnviroSealing() ) { - Base.Combine( EnviroSealing.GetAvailability() ); + if (HasEnviroSealing()) { + Base.Combine(EnviroSealing.GetAvailability()); } - if( HasEjectionSeat() ) { - Base.Combine( EjectionSeat.GetAvailability() ); + if (HasEjectionSeat()) { + Base.Combine(EjectionSeat.GetAvailability()); } - if( HasFHES() ) { - Base.Combine( FHESAC ); + if (HasFHES()) { + Base.Combine(FHESAC); } // now adjust for the era. - if( CurLoadout.GetEra() == AvailableCode.ERA_SUCCESSION ) { + if (CurLoadout.GetEra() == AvailableCode.ERA_SUCCESSION) { // cut out the Star League stuff. - AvailableCode SW = new AvailableCode( Base.GetTechBase() ); - SW.SetCodes( 'A', 'X', 'A', 'A', 'A', 'A', 'X', 'A', 'A', 'A' ); - SW.SetISDates( 0, 0, false, 2801, 10000, 0, false, false ); - SW.SetCLDates( 0, 0, false, 2801, 10000, 0, false, false ); - SW.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - Base.Combine( SW ); - } - if( CurLoadout.GetEra() == AvailableCode.ERA_CLAN_INVASION ) { + AvailableCode SW = new AvailableCode(Base.GetTechBase()); + SW.SetCodes('A', 'X', 'A', 'A', 'A', 'A', 'X', 'A', 'A', 'A'); + SW.SetISDates(0, 0, false, 2801, 10000, 0, false, false); + SW.SetCLDates(0, 0, false, 2801, 10000, 0, false, false); + SW.SetRulesLevels(AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + Base.Combine(SW); + } + if (CurLoadout.GetEra() == AvailableCode.ERA_CLAN_INVASION) { // cut out the Star League and Succession Wars stuff. - AvailableCode CI = new AvailableCode( Base.GetTechBase() ); - CI.SetCodes( 'A', 'X', 'X', 'A', 'A', 'A', 'X', 'X', 'A', 'A' ); - CI.SetISDates( 0, 0, false, 3051, 10000, 0, false, false ); - CI.SetCLDates( 0, 0, false, 3051, 10000, 0, false, false ); - CI.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); - Base.Combine( CI ); + AvailableCode CI = new AvailableCode(Base.GetTechBase()); + CI.SetCodes('A', 'X', 'X', 'A', 'A', 'A', 'X', 'X', 'A', 'A'); + CI.SetISDates(0, 0, false, 3051, 10000, 0, false, false); + CI.SetCLDates(0, 0, false, 3051, 10000, 0, false, false); + CI.SetRulesLevels(AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); + Base.Combine(CI); } return Base; } public void CheckArmoredComponents() { - if( GetRulesLevel() < AvailableCode.RULES_EXPERIMENTAL ) { - CurEngine.ArmorComponent( false ); - CurGyro.ArmorComponent( false ); - CurCockpit.ArmorComponent( false ); - CurCockpit.GetFirstSensors().ArmorComponent( false ); - CurCockpit.GetSecondSensors().ArmorComponent( false ); - CurCockpit.GetFirstLS().ArmorComponent( false ); - CurCockpit.GetSecondLS().ArmorComponent( false ); - if( CurCockpit.GetThirdSensors() != null ) { - CurCockpit.GetThirdSensors().ArmorComponent( false ); - } - CurPhysEnhance.ArmorComponent( false ); - GetActuators().LeftFoot.ArmorComponent( false ); - GetActuators().RightFoot.ArmorComponent( false ); - GetActuators().LeftLowerLeg.ArmorComponent( false ); - GetActuators().RightLowerLeg.ArmorComponent( false ); - GetActuators().LeftUpperLeg.ArmorComponent( false ); - GetActuators().RightUpperLeg.ArmorComponent( false ); - GetActuators().LeftHip.ArmorComponent( false ); - GetActuators().RightHip.ArmorComponent( false ); - - GetActuators().LeftShoulder.ArmorComponent( false ); - GetActuators().RightShoulder.ArmorComponent( false ); - GetActuators().LeftUpperArm.ArmorComponent( false ); - GetActuators().RightUpperArm.ArmorComponent( false ); - GetActuators().LeftLowerArm.ArmorComponent( false ); - GetActuators().RightLowerArm.ArmorComponent( false ); - GetActuators().LeftHand.ArmorComponent( false ); - GetActuators().RightHand.ArmorComponent( false ); - - GetActuators().LeftFrontFoot.ArmorComponent( false ); - GetActuators().RightFrontFoot.ArmorComponent( false ); - GetActuators().LeftFrontLowerLeg.ArmorComponent( false ); - GetActuators().RightFrontLowerLeg.ArmorComponent( false ); - GetActuators().LeftFrontUpperLeg.ArmorComponent( false ); - GetActuators().RightFrontUpperLeg.ArmorComponent( false ); - GetActuators().LeftFrontHip.ArmorComponent( false ); - GetActuators().RightFrontHip.ArmorComponent( false ); - - if( GetHeatSinks().GetPlacedHeatSinks().length > 0 ) { + if (GetRulesLevel() < AvailableCode.RULES_EXPERIMENTAL) { + CurEngine.ArmorComponent(false); + CurGyro.ArmorComponent(false); + CurCockpit.ArmorComponent(false); + CurCockpit.GetFirstSensors().ArmorComponent(false); + CurCockpit.GetSecondSensors().ArmorComponent(false); + CurCockpit.GetFirstLS().ArmorComponent(false); + CurCockpit.GetSecondLS().ArmorComponent(false); + if (CurCockpit.GetThirdSensors() != null) { + CurCockpit.GetThirdSensors().ArmorComponent(false); + } + CurPhysEnhance.ArmorComponent(false); + GetActuators().LeftFoot.ArmorComponent(false); + GetActuators().RightFoot.ArmorComponent(false); + GetActuators().LeftLowerLeg.ArmorComponent(false); + GetActuators().RightLowerLeg.ArmorComponent(false); + GetActuators().LeftUpperLeg.ArmorComponent(false); + GetActuators().RightUpperLeg.ArmorComponent(false); + GetActuators().LeftHip.ArmorComponent(false); + GetActuators().RightHip.ArmorComponent(false); + + GetActuators().LeftShoulder.ArmorComponent(false); + GetActuators().RightShoulder.ArmorComponent(false); + GetActuators().LeftUpperArm.ArmorComponent(false); + GetActuators().RightUpperArm.ArmorComponent(false); + GetActuators().LeftLowerArm.ArmorComponent(false); + GetActuators().RightLowerArm.ArmorComponent(false); + GetActuators().LeftHand.ArmorComponent(false); + GetActuators().RightHand.ArmorComponent(false); + + GetActuators().LeftFrontFoot.ArmorComponent(false); + GetActuators().RightFrontFoot.ArmorComponent(false); + GetActuators().LeftFrontLowerLeg.ArmorComponent(false); + GetActuators().RightFrontLowerLeg.ArmorComponent(false); + GetActuators().LeftFrontUpperLeg.ArmorComponent(false); + GetActuators().RightFrontUpperLeg.ArmorComponent(false); + GetActuators().LeftFrontHip.ArmorComponent(false); + GetActuators().RightFrontHip.ArmorComponent(false); + + if (GetHeatSinks().GetPlacedHeatSinks().length > 0) { HeatSink[] placed = GetHeatSinks().GetPlacedHeatSinks(); - for( int i = 0; i < placed.length; i++ ) { - placed[i].ArmorComponent( false ); + for (int i = 0; i < placed.length; i++) { + placed[i].ArmorComponent(false); } } - if( GetJumpJets().GetNumJJ() > 0 ) { + if (GetJumpJets().GetNumJJ() > 0) { JumpJet[] placed = GetJumpJets().GetPlacedJumps(); - for( int i = 0; i < placed.length; i++ ) { - placed[i].ArmorComponent( false ); + for (int i = 0; i < placed.length; i++) { + placed[i].ArmorComponent(false); } } - if( HasCommandConsole() ) { - CommandConsole.ArmorComponent( false ); + if (HasCommandConsole()) { + CommandConsole.ArmorComponent(false); } - if( CurLoadout.UsingTC() ) { - GetTC().ArmorComponent( false ); + if (CurLoadout.UsingTC()) { + GetTC().ArmorComponent(false); } - if( CurLoadout.HasSupercharger() ) { - CurLoadout.GetSupercharger().ArmorComponent( false ); + if (CurLoadout.HasSupercharger()) { + CurLoadout.GetSupercharger().ArmorComponent(false); } } } - public ArrayList SortLoadout( ArrayList v ) { + public ArrayList SortLoadout(ArrayList v) { return SortWeapons(v, false, false); } - public abPlaceable[] SortWeapons( ArrayList v, boolean rear ) { + public ArrayList SortWeapons(ArrayList v, boolean rear) { // convert the results - ArrayList r = SortWeapons(v, rear, true); - abPlaceable[] result = new abPlaceable[r.size()]; - for( int i = 0; i < r.size(); i++ ) { - result[i] = (abPlaceable) r.get( i ); + ArrayList r = SortWeapons(v, rear, true); + ArrayList result = new ArrayList(); + + for (int i = 0; i < r.size(); i++) { + result.add((abPlaceable) r.get(i)); } + return result; } // sorting routine for weapon BV calculation. this is undoubtedly slow - public ArrayList SortWeapons( ArrayList v, boolean rear, boolean DoRearHeatCheck ) { - // sort by BV first (using gnomesort for less code. may have to change - // this depending on the slowness of the program. I figure lower overhead + public ArrayList SortWeapons(ArrayList v, boolean rear, boolean DoRearHeatCheck) { + // sort by BV first (using gnomesort for less code. may have to change + // this depending on the slowness of the program. I figure lower overhead // will have better results at this time, and mechs typically don't - // carry more than twelve to fifteen weapons. I'll have to test this. + // carry more than twelve to fifteen weapons. I'll have to test this. int i = 1, j = 2; boolean TC = UsingTC(); - Object swap; - while( i < v.size() ) { + abPlaceable swap; + while (i < v.size()) { // get the two items we'll be comparing - boolean AES1 = UseAESModifier( ((abPlaceable) v.get( i - 1 )) ); - boolean AES2 = UseAESModifier( ((abPlaceable) v.get( i )) ); + boolean AES1 = UseAESModifier(((abPlaceable) v.get(i - 1))); + boolean AES2 = UseAESModifier(((abPlaceable) v.get(i))); /*** - * 2020-10-06: - * This should be improved but the problem is it needs to be sorted by BV, - * then by heat, lowest to highest. To that end we just get the heat and - * compare them as a second step if the BV is the same. If the BV is higher - * then we don't need to look. + * 2020-10-06: This should be improved but the problem is it needs to be sorted + * by BV, then by heat, lowest to highest. To that end we just get the heat and + * compare them as a second step if the BV is the same. If the BV is higher then + * we don't need to look. */ - double offensiveBV1 = ((abPlaceable) v.get( i - 1 )).GetCurOffensiveBV( rear, TC, AES1 ); - double offensiveBV2 = ((abPlaceable) v.get( i )).GetCurOffensiveBV( rear, TC, AES2 ); - double heat1 = ((ifWeapon) v.get( i - 1 )).GetHeat(); - double heat2 = ((ifWeapon) v.get( i )).GetHeat(); - if( offensiveBV1 > offensiveBV2 || ( offensiveBV1 == offensiveBV2 && heat1 <= heat2 ) ) { + double offensiveBV1 = ((abPlaceable) v.get(i - 1)).GetCurOffensiveBV(rear, TC, AES1); + double offensiveBV2 = ((abPlaceable) v.get(i)).GetCurOffensiveBV(rear, TC, AES2); + double heat1 = ((ifWeapon) v.get(i - 1)).GetHeat(); + double heat2 = ((ifWeapon) v.get(i)).GetHeat(); + if (offensiveBV1 > offensiveBV2 || (offensiveBV1 == offensiveBV2 && heat1 <= heat2)) { i = j; j += 1; } else { - swap = v.get( i - 1 ); - v.set( i - 1, v.get( i ) ); - v.set( i, swap ); + swap = (abPlaceable) v.get(i - 1); + v.set(i - 1, v.get(i)); + v.set(i, swap); i -= 1; - if( i == 0 ) { + if (i == 0) { i = 1; } } @@ -4615,33 +4859,34 @@ public ArrayList SortWeapons( ArrayList v, boolean rear, boolean DoRearHeatCheck // check our values, ensuring that rear-firing weapons, then lower heat // weapons take precedence - if ( DoRearHeatCheck ) { + if (DoRearHeatCheck) { i = 1; - while( i < v.size() ) { - boolean AES1 = UseAESModifier( ((abPlaceable) v.get( i - 1 )) ); - boolean AES2 = UseAESModifier( ((abPlaceable) v.get( i )) ); - double heat1 = ((ifWeapon) v.get( i - 1 )).GetHeat(); - double heat2 = ((ifWeapon) v.get( i )).GetHeat(); - if( ((abPlaceable) v.get( i - 1 )).GetCurOffensiveBV( rear, TC, AES1 ) == ((abPlaceable) v.get( i )).GetCurOffensiveBV( rear, TC, AES2 ) ) { - if( rear ) { - if( ((abPlaceable) v.get( i - 1 )).IsMountedRear() &! ((abPlaceable) v.get( i )).IsMountedRear() ) { - swap = v.get( i - 1 ); - v.set( i - 1, v.get( i ) ); - v.set( i, swap ); - } else if( heat1 > heat2 ) { - swap = v.get( i - 1 ); - v.set( i - 1, v.get( i ) ); - v.set( i, swap ); + while (i < v.size()) { + boolean AES1 = UseAESModifier(((abPlaceable) v.get(i - 1))); + boolean AES2 = UseAESModifier(((abPlaceable) v.get(i))); + double heat1 = ((ifWeapon) v.get(i - 1)).GetHeat(); + double heat2 = ((ifWeapon) v.get(i)).GetHeat(); + if (((abPlaceable) v.get(i - 1)).GetCurOffensiveBV(rear, TC, AES1) == ((abPlaceable) v.get(i)) + .GetCurOffensiveBV(rear, TC, AES2)) { + if (rear) { + if (((abPlaceable) v.get(i - 1)).IsMountedRear() & !((abPlaceable) v.get(i)).IsMountedRear()) { + swap = v.get(i - 1); + v.set(i - 1, v.get(i)); + v.set(i, swap); + } else if (heat1 > heat2) { + swap = v.get(i - 1); + v.set(i - 1, v.get(i)); + v.set(i, swap); } } else { - if( ! ((abPlaceable) v.get( i - 1 )).IsMountedRear() && ((abPlaceable) v.get( i )).IsMountedRear() ) { - swap = v.get( i - 1 ); - v.set( i - 1, v.get( i ) ); - v.set( i, swap ); - } else if( heat1 > heat2 ) { - swap = v.get( i - 1 ); - v.set( i - 1, v.get( i ) ); - v.set( i, swap ); + if (!((abPlaceable) v.get(i - 1)).IsMountedRear() && ((abPlaceable) v.get(i)).IsMountedRear()) { + swap = v.get(i - 1); + v.set(i - 1, v.get(i)); + v.set(i, swap); + } else if (heat1 > heat2) { + swap = v.get(i - 1); + v.set(i - 1, v.get(i)); + v.set(i, swap); } } } @@ -4654,39 +4899,39 @@ public ArrayList SortWeapons( ArrayList v, boolean rear, boolean DoRearHeatCheck /** * Sorting routine for weapon Printing. + * * @param v - * @return + * @return */ - - public ArrayList SortWeaponsToPrint( ArrayList v ) { + + public ArrayList SortWeaponsToPrint(ArrayList v) { /*** - * 2020-10-10: - * When we fixed the BV calculations sort (see 10-06 note above) it broke - * print preview with the way it was sorted. It's weird, but the quick fix - * that lets me work on something else and still fix the issue while keeping - * old behavior as it was is to copy the old function as it was when called by - * the Print routine. - */ - + * 2020-10-10: When we fixed the BV calculations sort (see 10-06 note above) it + * broke print preview with the way it was sorted. It's weird, but the quick fix + * that lets me work on something else and still fix the issue while keeping old + * behavior as it was is to copy the old function as it was when called by the + * Print routine. + */ + int i = 1, j = 2; boolean TC = UsingTC(); - Object swap; - while( i < v.size() ) { + abPlaceable swap; + while (i < v.size()) { // get the two items we'll be comparing - boolean AES1 = UseAESModifier( ((abPlaceable) v.get( i - 1 )) ); - boolean AES2 = UseAESModifier( ((abPlaceable) v.get( i )) ); + boolean AES1 = UseAESModifier(((abPlaceable) v.get(i - 1))); + boolean AES2 = UseAESModifier(((abPlaceable) v.get(i))); - double offensiveBV1 = ((abPlaceable) v.get( i - 1 )).GetCurOffensiveBV( false, TC, AES1 ); - double offensiveBV2 = ((abPlaceable) v.get( i )).GetCurOffensiveBV( false, TC, AES2 ); - if( offensiveBV1 >= offensiveBV2 ) { + double offensiveBV1 = ((abPlaceable) v.get(i - 1)).GetCurOffensiveBV(false, TC, AES1); + double offensiveBV2 = ((abPlaceable) v.get(i)).GetCurOffensiveBV(false, TC, AES2); + if (offensiveBV1 >= offensiveBV2) { i = j; j += 1; } else { - swap = v.get( i - 1 ); - v.set( i - 1, v.get( i ) ); - v.set( i, swap ); + swap = v.get(i - 1); + v.set(i - 1, v.get(i)); + v.set(i, swap); i -= 1; - if( i == 0 ) { + if (i == 0) { i = 1; } } @@ -4695,16 +4940,21 @@ public ArrayList SortWeaponsToPrint( ArrayList v ) { return v; } - public boolean UseAESModifier( abPlaceable a ) { - if( ! ( a instanceof ifWeapon ) ) { return false; } - if( HasLegAES || HasRAAES || HasLAAES ) { - if( a.CanSplit() ) { - ArrayList v = CurLoadout.FindSplitIndex( a ); - if( v.size() > 1 || v.size() < 1 ) { return false; } - int test = ((LocationIndex) v.get( 0 )).Location; - if( Quad ) { - if( HasLegAES && ( test == LocationIndex.MECH_LOC_RL || test == LocationIndex.MECH_LOC_LL || test == LocationIndex.MECH_LOC_RA || test == LocationIndex.MECH_LOC_LA ) ) { - if( a instanceof PhysicalWeapon ) { + public boolean UseAESModifier(abPlaceable a) { + if (!(a instanceof ifWeapon)) { + return false; + } + if (HasLegAES || HasRAAES || HasLAAES) { + if (a.CanSplit()) { + ArrayList v = CurLoadout.FindSplitIndex(a); + if (v.size() > 1 || v.size() < 1) { + return false; + } + int test = ((LocationIndex) v.get(0)).Location; + if (Quad) { + if (HasLegAES && (test == LocationIndex.MECH_LOC_RL || test == LocationIndex.MECH_LOC_LL + || test == LocationIndex.MECH_LOC_RA || test == LocationIndex.MECH_LOC_LA)) { + if (a instanceof PhysicalWeapon) { return true; } else { return false; @@ -4713,25 +4963,26 @@ public boolean UseAESModifier( abPlaceable a ) { return false; } } else { - if( HasLegAES && ( test == LocationIndex.MECH_LOC_RL || test == LocationIndex.MECH_LOC_LL ) ) { - if( a instanceof PhysicalWeapon ) { + if (HasLegAES && (test == LocationIndex.MECH_LOC_RL || test == LocationIndex.MECH_LOC_LL)) { + if (a instanceof PhysicalWeapon) { return true; } else { return false; } } - if( HasRAAES && test == LocationIndex.MECH_LOC_RA ) { + if (HasRAAES && test == LocationIndex.MECH_LOC_RA) { return true; } - if( HasLAAES && test == LocationIndex.MECH_LOC_LA ) { + if (HasLAAES && test == LocationIndex.MECH_LOC_LA) { return true; } } } else { - int test = CurLoadout.Find( a ); - if( Quad ) { - if( HasLegAES && ( test == LocationIndex.MECH_LOC_RL || test == LocationIndex.MECH_LOC_LL || test == LocationIndex.MECH_LOC_RA || test == LocationIndex.MECH_LOC_LA ) ) { - if( a instanceof PhysicalWeapon ) { + int test = CurLoadout.Find(a); + if (Quad) { + if (HasLegAES && (test == LocationIndex.MECH_LOC_RL || test == LocationIndex.MECH_LOC_LL + || test == LocationIndex.MECH_LOC_RA || test == LocationIndex.MECH_LOC_LA)) { + if (a instanceof PhysicalWeapon) { return true; } else { return false; @@ -4740,17 +4991,17 @@ public boolean UseAESModifier( abPlaceable a ) { return false; } } else { - if( HasLegAES && ( test == LocationIndex.MECH_LOC_RL || test == LocationIndex.MECH_LOC_LL ) ) { - if( a instanceof PhysicalWeapon ) { + if (HasLegAES && (test == LocationIndex.MECH_LOC_RL || test == LocationIndex.MECH_LOC_LL)) { + if (a instanceof PhysicalWeapon) { return true; } else { return false; } } - if( HasRAAES && test == LocationIndex.MECH_LOC_RA ) { + if (HasRAAES && test == LocationIndex.MECH_LOC_RA) { return true; } - if( HasLAAES && test == LocationIndex.MECH_LOC_LA ) { + if (HasLAAES && test == LocationIndex.MECH_LOC_LA) { return true; } } @@ -4765,28 +5016,30 @@ public SimplePlaceable GetCommandConsole() { return CommandConsole; } - public boolean SetCommandConsole( boolean set ) { - if( HasCommandConsole() == set ) { return true; } - if( set ) { + public boolean SetCommandConsole(boolean set) { + if (HasCommandConsole() == set) { + return true; + } + if (set) { try { - if ( !CurCockpit.IsTorsoMounted() ) { - //CurLoadout.SafeUnallocateHD(); - CurLoadout.AddToHD( CommandConsole ); + if (!CurCockpit.IsTorsoMounted()) { + // CurLoadout.SafeUnallocateHD(); + CurLoadout.AddToHD(CommandConsole); } else { - CurLoadout.AddToCT( CommandConsole ); + CurLoadout.AddToCT(CommandConsole); } - } catch( Exception e ) { + } catch (Exception e) { return false; } } else { - CurLoadout.Remove( CommandConsole ); + CurLoadout.Remove(CommandConsole); } return true; } public boolean HasCommandConsole() { - if( CurLoadout.IsAllocated( CommandConsole ) ) { + if (CurLoadout.IsAllocated(CommandConsole)) { return true; } else { return false; @@ -4794,7 +5047,7 @@ public boolean HasCommandConsole() { } public boolean HasC3() { - for (abPlaceable item : (ArrayList)CurLoadout.GetEquipment()) { + for (abPlaceable item : (ArrayList) CurLoadout.GetEquipment()) { if (item.LookupName().contains("C3")) { return true; } @@ -4803,7 +5056,7 @@ public boolean HasC3() { } public boolean HasECM() { - for (abPlaceable item : (ArrayList)CurLoadout.GetEquipment()) { + for (abPlaceable item : (ArrayList) CurLoadout.GetEquipment()) { if (item.LookupName().contains("ECM") || item.LookupName().contains("Watchdog")) { return true; } @@ -4812,7 +5065,7 @@ public boolean HasECM() { } public boolean HasProbe() { - for (abPlaceable item : (ArrayList)CurLoadout.GetEquipment()) { + for (abPlaceable item : (ArrayList) CurLoadout.GetEquipment()) { if (item.LookupName().contains("Probe")) { return true; } @@ -4821,57 +5074,61 @@ public boolean HasProbe() { } public boolean ValidateECM() { - if( CurArmor.IsStealth() || HasVoidSig() ) { + if (CurArmor.IsStealth() || HasVoidSig()) { return HasECM(); } return true; } - public ArrayList GetMechMods() { + public ArrayList GetMechMods() { return MechMods; } - public void AddMechModifier( MechModifier m ) { - if( m == null ) { return; } - if( ! MechMods.contains( m ) &! CurLoadout.GetMechMods().contains( m ) ) { - MechMods.add( m ); + public void AddMechModifier(MechModifier m) { + if (m == null) { + return; + } + if (!MechMods.contains(m) & !CurLoadout.GetMechMods().contains(m)) { + MechMods.add(m); } } - public void RemoveMechMod( MechModifier m ) { - if( m == null ) { return; } - MechMods.remove( m ); + public void RemoveMechMod(MechModifier m) { + if (m == null) { + return; + } + MechMods.remove(m); } - public MechModifier GetTotalModifiers( boolean BV, boolean MASCTSM ) { - MechModifier retval = new MechModifier( 0, 0, 0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, true, true ); - if( MechMods.size() > 0 ) { - for( int i = 0; i < MechMods.size(); i++ ) { - if( BV ) { - if( MASCTSM ) { - retval.BVCombine( ((MechModifier) MechMods.get( i )) ); + public MechModifier GetTotalModifiers(boolean BV, boolean MASCTSM) { + MechModifier retval = new MechModifier(0, 0, 0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, true, true); + if (MechMods.size() > 0) { + for (int i = 0; i < MechMods.size(); i++) { + if (BV) { + if (MASCTSM) { + retval.BVCombine(((MechModifier) MechMods.get(i))); } else { - if( MechMods.get( i ) != CurPhysEnhance.GetMechModifier() ) { - retval.BVCombine( ((MechModifier) MechMods.get( i )) ); + if (MechMods.get(i) != CurPhysEnhance.GetMechModifier()) { + retval.BVCombine(((MechModifier) MechMods.get(i))); } } } else { - if( MASCTSM ) { - retval.Combine( ((MechModifier) MechMods.get( i )) ); + if (MASCTSM) { + retval.Combine(((MechModifier) MechMods.get(i))); } else { - if( MechMods.get( i ) != CurPhysEnhance.GetMechModifier() ) { - retval.Combine( ((MechModifier) MechMods.get( i )) ); + if (MechMods.get(i) != CurPhysEnhance.GetMechModifier()) { + retval.Combine(((MechModifier) MechMods.get(i))); } } } } } - if( CurLoadout.GetMechMods().size() > 0 ) { - for( int i = 0; i < CurLoadout.GetMechMods().size(); i++ ) { - if( BV ) { - retval.BVCombine( ((MechModifier) CurLoadout.GetMechMods().get( i )) ); + if (CurLoadout.GetMechMods().size() > 0) { + for (int i = 0; i < CurLoadout.GetMechMods().size(); i++) { + if (BV) { + retval.BVCombine(((MechModifier) CurLoadout.GetMechMods().get(i))); } else { - retval.Combine( ((MechModifier) CurLoadout.GetMechMods().get( i )) ); + retval.Combine(((MechModifier) CurLoadout.GetMechMods().get(i))); } } } @@ -4882,115 +5139,115 @@ public boolean UsingFractionalAccounting() { return FractionalAccounting; } - public void SetFractionalAccounting( boolean b ) { + public void SetFractionalAccounting(boolean b) { FractionalAccounting = b; } - public void SetOverview( String n ) { + public void SetOverview(String n) { Overview = n; - SetChanged( true ); + SetChanged(true); } - - public void SetQuirks (ArrayList q) { + + public void SetQuirks(ArrayList q) { Quirks = q; - - SetChanged( true ); + + SetChanged(true); } - public void SetCapabilities( String n ) { + public void SetCapabilities(String n) { Capabilities = n; - SetChanged( true ); + SetChanged(true); } - public void SetHistory( String n ) { + public void SetHistory(String n) { History = n; - SetChanged( true ); + SetChanged(true); } - public void SetDeployment( String n ) { + public void SetDeployment(String n) { Deployment = n; - SetChanged( true ); + SetChanged(true); } - public void SetVariants( String n ) { + public void SetVariants(String n) { Variants = n; - SetChanged( true ); + SetChanged(true); } - public void SetNotables( String n ) { + public void SetNotables(String n) { Notables = n; - SetChanged( true ); + SetChanged(true); } - public void SetAdditional( String n ) { + public void SetAdditional(String n) { Additional = n; - SetChanged( true ); + SetChanged(true); } - public void SetCompany( String n ) { + public void SetCompany(String n) { Company = n; - SetChanged( true ); + SetChanged(true); } - public void SetLocation( String n ) { + public void SetLocation(String n) { Location = n; - SetChanged( true ); + SetChanged(true); } - public void SetEngineManufacturer( String n ) { + public void SetEngineManufacturer(String n) { EngineManufacturer = n; - SetChanged( true ); + SetChanged(true); } - public void SetArmorModel( String n ) { + public void SetArmorModel(String n) { ArmorModel = n; - SetChanged( true ); + SetChanged(true); } - public void SetChassisModel( String n ) { + public void SetChassisModel(String n) { ChassisModel = n; - SetChanged( true ); + SetChanged(true); } - public void SetJJModel( String n ) { + public void SetJJModel(String n) { JJModel = n; - SetChanged( true ); + SetChanged(true); } - public void SetCommSystem( String n ) { + public void SetCommSystem(String n) { CommSystem = n; - SetChanged( true ); + SetChanged(true); } - public void SetTandTSystem( String n ) { + public void SetTandTSystem(String n) { TandTSystem = n; - SetChanged( true ); + SetChanged(true); } - public void SetSource( String s ) { - CurLoadout.SetSource( s ); - SetChanged( true ); + public void SetSource(String s) { + CurLoadout.SetSource(s); + SetChanged(true); } public String GetOverview() { return Overview; } - + public ArrayList GetQuirks() { return Quirks; } @@ -5020,59 +5277,59 @@ public String GetAdditional() { } public String GetCompany() { - if( Company.matches( "" ) ) { + if (Company.matches("")) { return "Unknown"; } return Company; } public String GetLocation() { - if( Location.matches( "" ) ) { + if (Location.matches("")) { return "Unknown"; } return Location; } public String GetEngineManufacturer() { - if( EngineManufacturer.matches( "" ) ) { + if (EngineManufacturer.matches("")) { return "Unknown"; } return EngineManufacturer; } public String GetArmorModel() { - if( ArmorModel.matches( "" ) ) { + if (ArmorModel.matches("")) { return "Unknown"; } return ArmorModel; } public String GetChassisModel() { - if( ChassisModel.matches( "" ) ) { + if (ChassisModel.matches("")) { return "Unknown"; } return ChassisModel; } public String GetJJModel() { - if( ! Omnimech && GetJumpJets().GetNumJJ() < 1 ) { + if (!Omnimech && GetJumpJets().GetNumJJ() < 1) { return "None"; } - if( JJModel.matches( "" ) ) { + if (JJModel.matches("")) { return "Unknown"; } return JJModel; } public String GetCommSystem() { - if( CommSystem.matches( "" ) ) { + if (CommSystem.matches("")) { return "Unknown"; } return CommSystem; } public String GetTandTSystem() { - if( TandTSystem.matches( "" ) ) { + if (TandTSystem.matches("")) { return "Unknown"; } return TandTSystem; @@ -5082,7 +5339,7 @@ public String GetSource() { return CurLoadout.GetSource(); } - public void SetChanged( boolean b ) { + public void SetChanged(boolean b) { Changed = b; } @@ -5090,80 +5347,83 @@ public boolean HasChanged() { return Changed; } - public int GetBFPoints(){ - return Math.round( GetCurrentBV() / 100.0f ); + public int GetBFPoints() { + return Math.round(GetCurrentBV() / 100.0f); } - public int GetBFSize(){ + public int GetBFSize() { int mass = GetTonnage(); - if( mass < 40 ){ + if (mass < 40) { return BFConstants.BF_SIZE_LIGHT; - }else if( mass < 60 ){ + } else if (mass < 60) { return BFConstants.BF_SIZE_MEDIUM; - }else if ( mass < 80 ){ + } else if (mass < 80) { return BFConstants.BF_SIZE_HEAVY; - }else{ + } else { return BFConstants.BF_SIZE_ASSAULT; } } - public int GetBFPrimeMovement(){ + public int GetBFPrimeMovement() { double retval = GetAdjustedWalkingMP(false, false); // Adjust retval for MASC and SC - if ( CurLoadout.HasSupercharger() && GetPhysEnhance().IsMASC() ){ + if (CurLoadout.HasSupercharger() && GetPhysEnhance().IsMASC()) { retval *= 1.5; - }else if ( CurLoadout.HasSupercharger() || GetPhysEnhance().IsMASC() ){ + } else if (CurLoadout.HasSupercharger() || GetPhysEnhance().IsMASC()) { retval *= 1.25f; } return (int) Math.round(retval); } - - public String GetBFPrimeMovementMode(){ + + public String GetBFPrimeMovementMode() { int walkMP = GetAdjustedWalkingMP(false, false); int jumpMP = GetAdjustedJumpingMP(false); - if ( GetJumpBoosterMP() > jumpMP ) jumpMP = GetJumpBoosterMP(); + if (GetJumpBoosterMP() > jumpMP) + jumpMP = GetJumpBoosterMP(); - if ( walkMP == jumpMP && GetBFPrimeMovement() == jumpMP ){ - if ( GetBFSecondaryMovementMode().isEmpty() ) { - return (!GetJumpJets().IsUMU() ? "j":"u"); + if (walkMP == jumpMP && GetBFPrimeMovement() == jumpMP) { + if (GetBFSecondaryMovementMode().isEmpty()) { + return (!GetJumpJets().IsUMU() ? "j" : "u"); } else { return ""; } - }else{ + } else { return ""; } } - - public int GetBFSecondaryMovement(){ + + public int GetBFSecondaryMovement() { int baseMP = GetAdjustedWalkingMP(false, false); int walkMP = GetBFPrimeMovement(); int jumpMP = GetAdjustedJumpingMP(false); - if ( GetJumpBoosterMP() > jumpMP ) jumpMP = GetJumpBoosterMP(); + if (GetJumpBoosterMP() > jumpMP) + jumpMP = GetJumpBoosterMP(); - if ( jumpMP > 0 && walkMP != jumpMP ){ - if ( baseMP > jumpMP ) - return (int)(Math.round(jumpMP*0.66)); - else if ( baseMP == jumpMP && walkMP > jumpMP ) + if (jumpMP > 0 && walkMP != jumpMP) { + if (baseMP > jumpMP) + return (int) (Math.round(jumpMP * 0.66)); + else if (baseMP == jumpMP && walkMP > jumpMP) return jumpMP; - else if ( walkMP < jumpMP ) + else if (walkMP < jumpMP) return jumpMP; else return 0; - }else + } else return 0; } - public String GetBFSecondaryMovementMode(){ + public String GetBFSecondaryMovementMode() { int walkMP = GetBFPrimeMovement(); int jumpMP = GetAdjustedJumpingMP(false); - if ( GetJumpBoosterMP() > jumpMP ) jumpMP = GetJumpBoosterMP(); + if (GetJumpBoosterMP() > jumpMP) + jumpMP = GetJumpBoosterMP(); - if ( jumpMP > 0 && walkMP != jumpMP ) - return (!GetJumpJets().IsUMU() ? "j":"u"); - else if ( walkMP < jumpMP ) - return (!GetJumpJets().IsUMU() ? "j":"u"); + if (jumpMP > 0 && walkMP != jumpMP) + return (!GetJumpJets().IsUMU() ? "j" : "u"); + else if (walkMP < jumpMP) + return (!GetJumpJets().IsUMU() ? "j" : "u"); else return ""; } @@ -5173,18 +5433,18 @@ public int GetBFArmor() { MechArmor a = GetArmor(); double armorpoints = a.GetArmorValue(); - if ( a.IsCommercial() ){ + if (a.IsCommercial()) { armorpoints = (double) Math.floor(armorpoints / 2.0); - }else if ( a.IsFerroLamellor() ){ + } else if (a.IsFerroLamellor()) { armorpoints = (double) Math.ceil(armorpoints * 1.2); - }else if ( a.IsHardened() ){ + } else if (a.IsHardened()) { armorpoints = (double) Math.ceil(armorpoints * 2.0); - }else if ( a.IsReactive() || a.IsReflective() ){ + } else if (a.IsReactive() || a.IsReflective()) { armorpoints = (double) Math.ceil(armorpoints * 0.75f); } armorpoints += a.GetModularArmorValue(); - + return (int) Math.round(armorpoints / 30); } @@ -5192,58 +5452,61 @@ public int GetBFStructure() { Engine e = GetEngine(); int t = GetTonnage(); int retval = e.GetBFStructure(t); - if ( GetIntStruc().CritName().contains("Reinforced") ) - retval *=2; - else if ( GetIntStruc().CritName().contains("Composite") ) + if (GetIntStruc().CritName().contains("Reinforced")) + retval *= 2; + else if (GetIntStruc().CritName().contains("Composite")) retval /= 2; return retval; } - public int[] GetBFDamage( BattleForceStats bfs ) { - int[] retval = {0,0,0,0,0}; + public int[] GetBFDamage(BattleForceStats bfs) { + int[] retval = { 0, 0, 0, 0, 0 }; int CoolantPods = 0; // Loop through all weapons in non-core // and convert all weapon dmg - ArrayList nc = GetLoadout().GetNonCore(); + ArrayList nc = GetLoadout().GetNonCore(); BFData = new BattleForceData(); - BFData.AddNote("Weapon :: Short / Medium / Long / Extreme / [Heat]" ); - for ( int i = 0; i < nc.size(); i++ ) { - if ( nc.get(i) instanceof ifWeapon ) { - double [] temp = BattleForceTools.GetDamage((ifWeapon)nc.get(i), (ifBattleforce)this); + BFData.AddNote("Weapon :: Short / Medium / Long / Extreme / [Heat]"); + for (int i = 0; i < nc.size(); i++) { + if (nc.get(i) instanceof ifWeapon) { + double[] temp = BattleForceTools.GetDamage((ifWeapon) nc.get(i), (ifBattleforce) this); BFData.AddBase(temp); - - if ( BattleForceTools.isBFAutocannon((ifWeapon)nc.get(i)) ) + + if (BattleForceTools.isBFAutocannon((ifWeapon) nc.get(i))) BFData.AC.AddBase(temp); - else if ( BattleForceTools.isBFLRM((ifWeapon)nc.get(i)) ) + else if (BattleForceTools.isBFLRM((ifWeapon) nc.get(i))) BFData.LRM.AddBase(temp); - else if ( BattleForceTools.isBFSRM((ifWeapon)nc.get(i)) ) + else if (BattleForceTools.isBFSRM((ifWeapon) nc.get(i))) BFData.SRM.AddBase(temp); - else if ( BattleForceTools.isBFSRT((ifWeapon)nc.get(i)) || - BattleForceTools.isBFLRT((ifWeapon)nc.get(i)) ) + else if (BattleForceTools.isBFSRT((ifWeapon) nc.get(i)) + || BattleForceTools.isBFLRT((ifWeapon) nc.get(i))) BFData.TOR.AddBase(temp); - else if ( BattleForceTools.isBFMML((ifWeapon)nc.get(i)) ) - { - BFData.SRM.AddBase(new double[]{temp[BFConstants.BF_SHORT], temp[BFConstants.BF_MEDIUM]/2.0, 0.0, 0.0, temp[BFConstants.BF_OV]}); - BFData.LRM.AddBase(new double[]{0.0, temp[BFConstants.BF_MEDIUM]/2.0, temp[BFConstants.BF_LONG], 0.0, temp[BFConstants.BF_OV]} ); + else if (BattleForceTools.isBFMML((ifWeapon) nc.get(i))) { + BFData.SRM.AddBase(new double[] { temp[BFConstants.BF_SHORT], temp[BFConstants.BF_MEDIUM] / 2.0, + 0.0, 0.0, temp[BFConstants.BF_OV] }); + BFData.LRM.AddBase(new double[] { 0.0, temp[BFConstants.BF_MEDIUM] / 2.0, temp[BFConstants.BF_LONG], + 0.0, temp[BFConstants.BF_OV] }); } - if ( BattleForceTools.isBFIF((ifWeapon)nc.get(i)) ) + if (BattleForceTools.isBFIF((ifWeapon) nc.get(i))) BFData.IF.AddBase(temp); - if ( BattleForceTools.isBFFLK((ifWeapon)nc.get(i)) ) + if (BattleForceTools.isBFFLK((ifWeapon) nc.get(i))) BFData.FLK.AddBase(temp); - BFData.AddNote(nc.get(i).toString() + " :: " + temp[BFConstants.BF_SHORT] + "/" + temp[BFConstants.BF_MEDIUM] + "/" + temp[BFConstants.BF_LONG] + "/" + temp[BFConstants.BF_EXTREME] + " [" + temp[BFConstants.BF_OV] + "]" ); - } else if ( nc.get(i) instanceof Equipment ) { + BFData.AddNote(nc.get(i).toString() + " :: " + temp[BFConstants.BF_SHORT] + "/" + + temp[BFConstants.BF_MEDIUM] + "/" + temp[BFConstants.BF_LONG] + "/" + + temp[BFConstants.BF_EXTREME] + " [" + temp[BFConstants.BF_OV] + "]"); + } else if (nc.get(i) instanceof Equipment) { Equipment equip = ((Equipment) nc.get(i)); - if ( equip.CritName().contains("Coolant Pod")) { + if (equip.CritName().contains("Coolant Pod")) { CoolantPods++; } } } - + // Add in heat for movement - if ( GetAdjustedJumpingMP(false) > 2 ) { + if (GetAdjustedJumpingMP(false) > 2) { BFData.AddHeat(GetJumpingHeat()); } else { BFData.AddHeat(2); @@ -5254,46 +5517,53 @@ else if ( BattleForceTools.isBFMML((ifWeapon)nc.get(i)) ) BFData.AddHeat(-4); // Also include Stealth heat, which is ALWAYS on in BF - if ( GetArmor().IsStealth() ) { + if (GetArmor().IsStealth()) { BFData.AddHeat(10); } BFData.SetHeat(this.GetHeatSinks().TotalDissipation() + CoolantPods); BFData.CheckSpecials(); - + // Convert all damage to BF scale - retval[BFConstants.BF_SHORT] = BFData.AdjBase.getBFShort(); //(int) Math.ceil(dmgShort / 10); - retval[BFConstants.BF_MEDIUM] = BFData.AdjBase.getBFMedium(); //(int) Math.ceil(dmgMedium / 10); - retval[BFConstants.BF_LONG] = BFData.AdjBase.getBFLong(); //(int) Math.ceil(dmgLong / 10); - retval[BFConstants.BF_EXTREME] = 0; // Mechs dont have extreme range ever + retval[BFConstants.BF_SHORT] = BFData.AdjBase.getBFShort(); // (int) Math.ceil(dmgShort / 10); + retval[BFConstants.BF_MEDIUM] = BFData.AdjBase.getBFMedium(); // (int) Math.ceil(dmgMedium / 10); + retval[BFConstants.BF_LONG] = BFData.AdjBase.getBFLong(); // (int) Math.ceil(dmgLong / 10); + retval[BFConstants.BF_EXTREME] = 0; // Mechs dont have extreme range ever // Add Special Abilities to BattleForceStats if applicable - if ( BFData.AC.CheckSpecial() ) bfs.addAbility("AC " + BFData.AC.GetAbility() ); - if ( BFData.SRM.CheckSpecial() ) bfs.addAbility("SRM " + BFData.SRM.GetAbility() ); - if ( BFData.LRM.CheckSpecial() ) bfs.addAbility("LRM " + BFData.LRM.GetAbility() ); - if ( BFData.TOR.CheckSpecial() ) bfs.addAbility("TOR " + BFData.TOR.GetAbility() ); - if ( BFData.IF.getBFLong() > 0 ) bfs.addAbility("IF " + BFData.IF.getBFLong() ); - if ( BFData.FLK.getBaseMedium() > 5 ) bfs.addAbility("FLK " + BFData.FLK.GetAbility() ); + if (BFData.AC.CheckSpecial()) + bfs.addAbility("AC " + BFData.AC.GetAbility()); + if (BFData.SRM.CheckSpecial()) + bfs.addAbility("SRM " + BFData.SRM.GetAbility()); + if (BFData.LRM.CheckSpecial()) + bfs.addAbility("LRM " + BFData.LRM.GetAbility()); + if (BFData.TOR.CheckSpecial()) + bfs.addAbility("TOR " + BFData.TOR.GetAbility()); + if (BFData.IF.getBFLong() > 0) + bfs.addAbility("IF " + BFData.IF.getBFLong()); + if (BFData.FLK.getBaseMedium() > 5) + bfs.addAbility("FLK " + BFData.FLK.GetAbility()); // Determine OverHeat BFData.AddNote("OverHeat Calculations"); BFData.AddNote("Is Base Max Medium > 0 ? " + (BFData.BaseMaxMedium() > 0)); - if ( BFData.BaseMaxMedium() != 0 ) - { - int DmgMedium = BFData.AdjBase.getBFMedium() + BFData.SRM.getBFMedium() + BFData.LRM.getBFMedium() + BFData.AC.getBFMedium(); - BFData.AddNote("Medium Damage = Adj Base (" + BFData.AdjBase.getBFMedium() + ") + " - + "SRM (" + BFData.SRM.getBFMedium() + ") + " - + "LRM (" + BFData.LRM.getBFMedium() + ") + " - + "AC (" + BFData.AC.getBFMedium() + ") = " + DmgMedium); + if (BFData.BaseMaxMedium() != 0) { + int DmgMedium = BFData.AdjBase.getBFMedium() + BFData.SRM.getBFMedium() + BFData.LRM.getBFMedium() + + BFData.AC.getBFMedium(); + BFData.AddNote("Medium Damage = Adj Base (" + BFData.AdjBase.getBFMedium() + ") + " + "SRM (" + + BFData.SRM.getBFMedium() + ") + " + "LRM (" + BFData.LRM.getBFMedium() + ") + " + "AC (" + + BFData.AC.getBFMedium() + ") = " + DmgMedium); retval[BFConstants.BF_OV] = BFData.BaseMaxMedium() - DmgMedium; - BFData.AddNote("Medium: " + BFData.BaseMaxMedium() + " - " + DmgMedium + " = " + (BFData.BaseMaxMedium()-DmgMedium)); - //System.out.println( BFData.BaseMaxMedium() + " - " + DmgMedium + " = " + (BFData.BaseMaxMedium()-DmgMedium)); - } - else - { - int DmgShort = BFData.AdjBase.getBFShort() + BFData.SRM.getBFShort() + BFData.LRM.getBFShort() + BFData.AC.getBFShort(); + BFData.AddNote("Medium: " + BFData.BaseMaxMedium() + " - " + DmgMedium + " = " + + (BFData.BaseMaxMedium() - DmgMedium)); + // System.out.println( BFData.BaseMaxMedium() + " - " + DmgMedium + " = " + + // (BFData.BaseMaxMedium()-DmgMedium)); + } else { + int DmgShort = BFData.AdjBase.getBFShort() + BFData.SRM.getBFShort() + BFData.LRM.getBFShort() + + BFData.AC.getBFShort(); retval[BFConstants.BF_OV] = BFData.BaseMaxShort() - DmgShort; - BFData.AddNote("Short: " + BFData.BaseMaxShort() + " - " + DmgShort + " = " + (BFData.BaseMaxShort()-DmgShort)); + BFData.AddNote( + "Short: " + BFData.BaseMaxShort() + " - " + DmgShort + " = " + (BFData.BaseMaxShort() - DmgShort)); } // Maximum OV value is 4, minimum is 0 @@ -5302,91 +5572,106 @@ else if ( BattleForceTools.isBFMML((ifWeapon)nc.get(i)) ) if (retval[BFConstants.BF_OV] < 0) retval[BFConstants.BF_OV] = 0; - //System.out.println(BFData.toString()); + // System.out.println(BFData.toString()); // Return final values return retval; } public ArrayList GetBFAbilities() { - ArrayList retval = new ArrayList(); + ArrayList retval = new ArrayList(); // First search all equipment for BF Abilities - ArrayList nc = GetLoadout().GetNonCore(); - boolean isENE = true, - hasExplodable = false; - int Taser = 0, - RSD = 0; + ArrayList nc = GetLoadout().GetNonCore(); + boolean isENE = true, hasExplodable = false; + int Taser = 0, RSD = 0; double MHQTons = 0; int Heat = 0; - //TSM Check - if ( GetPhysEnhance().IsTSM() ) - if ( this.IsIndustrialmech() ) { - if ( !retval.contains("I-TSM") ) retval.add("I-TSM"); + // TSM Check + if (GetPhysEnhance().IsTSM()) + if (this.IsIndustrialmech()) { + if (!retval.contains("I-TSM")) + retval.add("I-TSM"); } else { - if ( !retval.contains("TSM") ) retval.add("TSM"); + if (!retval.contains("TSM")) + retval.add("TSM"); } - //Mimetic MechArmor System - if ( HasVoidSig ) - if ( !retval.contains("MAS") ) retval.add("MAS"); + // Mimetic MechArmor System + if (HasVoidSig) + if (!retval.contains("MAS")) + retval.add("MAS"); - //Underwater Movement - if ( GetJumpJets().IsUMU() ) { - if ( !retval.contains("UMU") ) retval.add("UMU"); + // Underwater Movement + if (GetJumpJets().IsUMU()) { + if (!retval.contains("UMU")) + retval.add("UMU"); } - //Omni - if ( IsOmnimech() ) - if ( !retval.contains("OMNI") ) retval.add("OMNI"); + // Omni + if (IsOmnimech()) + if (!retval.contains("OMNI")) + retval.add("OMNI"); - //Stealth (also adds ECM) - if ( (GetArmor().IsStealth()) || (this.HasChameleon) || this.HasNullSig ) { - if ( !retval.contains("ECM") ) retval.add("ECM"); - if ( !retval.contains("STL") ) retval.add("STL"); + // Stealth (also adds ECM) + if ((GetArmor().IsStealth()) || (this.HasChameleon) || this.HasNullSig) { + if (!retval.contains("ECM")) + retval.add("ECM"); + if (!retval.contains("STL")) + retval.add("STL"); } - //Command Console (affect Mobile Headquarters) - if ( GetCockpit().CritName().contains("Command Console")) + // Command Console (affect Mobile Headquarters) + if (GetCockpit().CritName().contains("Command Console")) MHQTons += 1.0d; - for ( int i = 0; i < nc.size(); i++ ) { - abPlaceable item = (abPlaceable)nc.get(i); + for (int i = 0; i < nc.size(); i++) { + abPlaceable item = (abPlaceable) nc.get(i); // Get the list of abilities from the equipment itself // handle special cases like C3 String[] abilities = item.GetBattleForceAbilities(); - for ( String ability : abilities ) { - - if ( ability.equals("C3M") ) MHQTons += 5.0d; - if ( ability.equals("C3I") ) MHQTons += 2.5d; - if ( ability.equals("C3BM") ) MHQTons += 6.0d; - if ( ability.equals("C3S") ) MHQTons += 1.0d; - if ( ability.equals("MTAS") ) Taser += 1; - if ( ability.equals("RSD") ) RSD += 1; - if ( ability.equals("HT2") ) Heat += 2; - if ( ability.equals("HT3") ) Heat += 3; - if ( ability.equals("HT7") ) Heat += 7; - - if ( !retval.contains(ability) ) retval.add(ability); + for (String ability : abilities) { + + if (ability.equals("C3M")) + MHQTons += 5.0d; + if (ability.equals("C3I")) + MHQTons += 2.5d; + if (ability.equals("C3BM")) + MHQTons += 6.0d; + if (ability.equals("C3S")) + MHQTons += 1.0d; + if (ability.equals("MTAS")) + Taser += 1; + if (ability.equals("RSD")) + RSD += 1; + if (ability.equals("HT2")) + Heat += 2; + if (ability.equals("HT3")) + Heat += 3; + if (ability.equals("HT7")) + Heat += 7; + + if (!retval.contains(ability)) + retval.add(ability); } // Check equipment for special abilities - if ( item instanceof ifWeapon ) { + if (item instanceof ifWeapon) { // ENE for mechs without ammo dependant weapons - if ( ((ifWeapon)item).GetWeaponClass() != ifWeapon.W_ENERGY && - ((ifWeapon)item).GetWeaponClass() != ifWeapon.W_PHYSICAL) { + if (((ifWeapon) item).GetWeaponClass() != ifWeapon.W_ENERGY + && ((ifWeapon) item).GetWeaponClass() != ifWeapon.W_PHYSICAL) { isENE = false; } // Does the mech carry an explodable weapon? - if ( ((ifWeapon)nc.get(i)).IsExplosive() ) { + if (((ifWeapon) nc.get(i)).IsExplosive()) { hasExplodable = true; } } - if( item instanceof Ammunition ) { - if( ((Ammunition) item).IsExplosive() ) { + if (item instanceof Ammunition) { + if (((Ammunition) item).IsExplosive()) { hasExplodable = true; } } @@ -5398,39 +5683,44 @@ public ArrayList GetBFAbilities() { retval.remove("HT7"); // Now deal with all the funny stuff - if( CurLoadout.HasCTCASE() || CurLoadout.HasLTCASE() || CurLoadout.HasRTCASE() ) { - if ( !retval.contains( "CASE" ) ) retval.add( "CASE" ); + if (CurLoadout.HasCTCASE() || CurLoadout.HasLTCASE() || CurLoadout.HasRTCASE()) { + if (!retval.contains("CASE")) + retval.add("CASE"); } - if( CurLoadout.HasHDCASEII() || CurLoadout.HasCTCASEII() || CurLoadout.HasLTCASEII() || CurLoadout.HasRTCASEII() || CurLoadout.HasLACASEII() || CurLoadout.HasRACASEII() || CurLoadout.HasLLCASEII() || CurLoadout.HasRLCASEII() ) { - if ( !retval.contains( "CASEII" ) ) retval.add( "CASEII" ); + if (CurLoadout.HasHDCASEII() || CurLoadout.HasCTCASEII() || CurLoadout.HasLTCASEII() || CurLoadout.HasRTCASEII() + || CurLoadout.HasLACASEII() || CurLoadout.HasRACASEII() || CurLoadout.HasLLCASEII() + || CurLoadout.HasRLCASEII()) { + if (!retval.contains("CASEII")) + retval.add("CASEII"); } - if ( isENE ) { + if (isENE) { retval.add("ENE"); } - if ( !isENE && ( CurLoadout.IsUsingClanCASE() && CurLoadout.CanUseClanCASE() ) ) - if ( !retval.contains( "CASE" ) ) retval.add("CASE"); - if ( Taser > 0 ) { + if (!isENE && (CurLoadout.IsUsingClanCASE() && CurLoadout.CanUseClanCASE())) + if (!retval.contains("CASE")) + retval.add("CASE"); + if (Taser > 0) { retval.remove("MTAS"); retval.add("MTAS" + Taser); } - if ( MHQTons > 0 ) { + if (MHQTons > 0) { retval.add("MHQ" + (int) MHQTons); } - if ( RSD > 0 ) { + if (RSD > 0) { retval.remove("RSD"); retval.add("RSD" + RSD); } - if ( !hasExplodable ) { - //They don't have anything that blows up so remove any traces of CASE or CASEII + if (!hasExplodable) { + // They don't have anything that blows up so remove any traces of CASE or CASEII retval.remove("CASE"); retval.remove("CASEII"); } - if ( Heat > 10 ) + if (Heat > 10) retval.add("HT2"); - else if ( Heat > 5 ) + else if (Heat > 5) retval.add("HT1"); - //Remove a - that is a result of the file needing data + // Remove a - that is a result of the file needing data retval.remove("-"); // Remove extra base LRM, SRM, TRO, and AC if included @@ -5458,25 +5748,25 @@ else if ( Heat > 5 ) } } - //ALL Mechs get SRCH (Industrials?) - retval.add("SRCH"); //Searchlight - if ( CurEngine.IsICE() || CurEngine.isFuelCell() ) { + // ALL Mechs get SRCH (Industrials?) + retval.add("SRCH"); // Searchlight + if (CurEngine.IsICE() || CurEngine.isFuelCell()) { retval.add("EE"); } - if ( IsIndustrialmech() ) { - if( HasEjectionSeat() ) { - retval.add("ES"); //Ejection Seat + if (IsIndustrialmech()) { + if (HasEjectionSeat()) { + retval.add("ES"); // Ejection Seat } - if( HasEnviroSealing() ) { - retval.add("SEAL"); //Environmental Sealing + if (HasEnviroSealing()) { + retval.add("SEAL"); // Environmental Sealing if (CurEngine.IsFusion() || CurEngine.IsNuclear() || CurEngine.isFuelCell()) { - retval.add("SOA"); //Space Operations Adaptation + retval.add("SOA"); // Space Operations Adaptation } } } else { - retval.add("ES"); //Ejection Seat - retval.add("SEAL"); //Environmental Sealing - retval.add("SOA"); //Space Operations Adaptation + retval.add("ES"); // Ejection Seat + retval.add("SEAL"); // Environmental Sealing + retval.add("SOA"); // Space Operations Adaptation } return retval; @@ -5497,24 +5787,23 @@ private boolean ValidateBFHarjel(String ability) { default: locs = new ArrayList<>(); } - boolean ct, lt, rt; - ct = lt = rt = false; - for (LocationIndex loc : locs) { - if (loc.Location == LocationIndex.MECH_LOC_CT) { - ct = true; - } else if (loc.Location == LocationIndex.MECH_LOC_LT) { - lt = true; - } else if (loc.Location == LocationIndex.MECH_LOC_RT) { - rt = true; - } + boolean ct, lt, rt; + ct = lt = rt = false; + for (LocationIndex loc : locs) { + if (loc.Location == LocationIndex.MECH_LOC_CT) { + ct = true; + } else if (loc.Location == LocationIndex.MECH_LOC_LT) { + lt = true; + } else if (loc.Location == LocationIndex.MECH_LOC_RT) { + rt = true; } - return ct && lt && rt; } + return ct && lt && rt; + } - - public String GetBFConversionStr( ) { + public String GetBFConversionStr() { String retval = "Weapon\t\t\tShort\tMedium\tLong\n\r"; - //TODO Add in conversion steps if possible + // TODO Add in conversion steps if possible return retval; } @@ -5522,110 +5811,110 @@ public BattleForceData getBFData() { return BFData; } - public ifVisitor Lookup( String s ) { + public ifVisitor Lookup(String s) { // returns a visitor from the lookup table based on the lookup string - return (ifVisitor) Lookup.get( s ); + return (ifVisitor) Lookup.get(s); } private void BuildLookupTable() { // sets up the lookup hashtable with String keys and ifVisitor values - Lookup.put( "Standard Armor", new VArmorSetStandard() ); - Lookup.put( "Ferro-Fibrous", new VArmorSetFF() ); - Lookup.put( "(IS) Ferro-Fibrous", new VArmorSetFF() ); - Lookup.put( "(CL) Ferro-Fibrous", new VArmorSetFF() ); - Lookup.put( "Stealth Armor", new VArmorSetStealth() ); - Lookup.put( "Light Ferro-Fibrous", new VArmorSetLightFF() ); - Lookup.put( "Heavy Ferro-Fibrous", new VArmorSetHeavyFF() ); - Lookup.put( "Ferro-Lamellor", new VArmorSetFL() ); - Lookup.put( "Hardened Armor", new VArmorSetHA() ); - Lookup.put( "Laser-Reflective", new VArmorSetLR() ); - Lookup.put( "(IS) Laser-Reflective", new VArmorSetLR() ); - Lookup.put( "(CL) Laser-Reflective", new VArmorSetLR() ); - Lookup.put( "Reactive Armor", new VArmorSetRE() ); - Lookup.put( "(IS) Reactive Armor", new VArmorSetRE() ); - Lookup.put( "(CL) Reactive Armor", new VArmorSetRE() ); - Lookup.put( "Industrial Armor", new VArmorSetIndustrial() ); - Lookup.put( "Commercial Armor", new VArmorSetCommercial() ); - Lookup.put( "Ablation Armor", new VArmorSetAB() ); - Lookup.put( "Heat-Dissipating Armor", new VArmorSetHD() ); - Lookup.put( "Impact-Resistant Armor", new VArmorSetIR()); - Lookup.put( "Ballistic-Reinforced Armor", new VArmorSetBR()); - Lookup.put( "Patchwork Armor", new VArmorSetPatchwork() ); - Lookup.put( "Standard Structure", new VChassisSetStandard() ); - Lookup.put( "Composite Structure", new VChassisSetComposite() ); - Lookup.put( "Endo-Steel", new VChassisSetEndoSteel() ); - Lookup.put( "(IS) Endo-Steel", new VChassisSetEndoSteel() ); - Lookup.put( "(CL) Endo-Steel", new VChassisSetEndoSteel() ); - Lookup.put( "Endo-Composite", new VChassisSetEndoComposite() ); - Lookup.put( "(IS) Endo-Composite", new VChassisSetEndoComposite() ); - Lookup.put( "(CL) Endo-Composite", new VChassisSetEndoComposite() ); - Lookup.put( "Reinforced Structure", new VChassisSetReinforced() ); - Lookup.put( "Industrial Structure", new VChassisSetIndustrial() ); - Lookup.put( "Standard Cockpit", new VCockpitSetStandard() ); - Lookup.put( "Industrial Cockpit", new VCockpitSetIndustrial() ); - Lookup.put( "Industrial w/ Adv. FC", new VCockpitSetIndustrialAFC() ); - Lookup.put( "Interface Cockpit", new VCockpitSetInterface() ); - Lookup.put( "Small Cockpit", new VCockpitSetSmall() ); - Lookup.put( "Torso-Mounted Cockpit", new VCockpitSetTorsoMount() ); - Lookup.put( "Virtual Reality Piloting Pod", new VCockpitSetVirtualRealityPilotingPod() ); - Lookup.put( "Robotic Cockpit", new VCockpitSetRobotic() ); - Lookup.put( "Fuel-Cell Engine", new VEngineSetFuelCell() ); - Lookup.put( "Fission Engine", new VEngineSetFission() ); - Lookup.put( "Fusion Engine", new VEngineSetFusion() ); - Lookup.put( "Primitive Fuel-Cell Engine", new VEngineSetPrimitiveFuelCell() ); - Lookup.put( "Primitive Fission Engine", new VEngineSetPrimitiveFission() ); - Lookup.put( "Primitive Fusion Engine", new VEngineSetPrimitiveFusion() ); - Lookup.put( "XL Engine", new VEngineSetFusionXL() ); - Lookup.put( "(IS) XL Engine", new VEngineSetFusionXL() ); - Lookup.put( "(CL) XL Engine", new VEngineSetFusionXL() ); - Lookup.put( "XXL Engine", new VEngineSetFusionXXL() ); - Lookup.put( "(IS) XXL Engine", new VEngineSetFusionXXL() ); - Lookup.put( "(CL) XXL Engine", new VEngineSetFusionXXL() ); - Lookup.put( "I.C.E. Engine", new VEngineSetICE() ); - Lookup.put( "Primitive I.C.E. Engine", new VEngineSetPrimitiveICE() ); - Lookup.put( "Compact Fusion Engine", new VEngineSetCompactFusion() ); - Lookup.put( "Light Fusion Engine", new VEngineSetLightFusion() ); - Lookup.put( "Standard Gyro", new VGyroSetStandard() ); - Lookup.put( "Heavy-Duty Gyro", new VGyroSetHD() ); - Lookup.put( "Extra-Light Gyro", new VGyroSetXL() ); - Lookup.put( "Compact Gyro", new VGyroSetCompact() ); - Lookup.put( "No Gyro", new VGyroSetNone() ); - Lookup.put( "No Enhancement", new VEnhanceSetNone() ); - Lookup.put( "MASC", new VEnhanceSetMASC() ); - Lookup.put( "(IS) MASC", new VEnhanceSetMASC() ); - Lookup.put( "(CL) MASC", new VEnhanceSetMASC() ); - Lookup.put( "TSM", new VEnhanceSetTSM() ); - Lookup.put( "Industrial TSM", new VEnhanceSetITSM() ); - Lookup.put( "Single Heat Sink", new VHeatSinkSetSingle() ); - Lookup.put( "Double Heat Sink", new VHeatSinkSetDouble() ); - Lookup.put( "(IS) Double Heat Sink", new VHeatSinkSetDouble() ); - Lookup.put( "(CL) Double Heat Sink", new VHeatSinkSetDouble() ); - Lookup.put( "Compact Heat Sink", new VHeatSinkSetCompact() ); - Lookup.put( "Laser Heat Sink", new VHeatSinkSetLaser() ); - Lookup.put( "Prototype Double Heat Sink", new VHeatSinkSetProtoDouble()); - Lookup.put( "Double Heat Sink (Freezers)", new VHeatSinkSetProtoDouble()); - Lookup.put( "Standard Jump Jet", new VJumpJetSetStandard() ); - Lookup.put( "Improved Jump Jet", new VJumpJetSetImproved() ); - Lookup.put( "Prototype Improved Jump Jet", new VJumpJetSetPrototypeImproved()); - Lookup.put( "Primitive Prototype Jump Jet", new VJumpJetSetPrimitivePrototype()); - Lookup.put( "Mech UMU", new VJumpJetSetUMU() ); - Lookup.put( "Primitive Armor", new VArmorSetPrimitive() ); - Lookup.put( "Primitive Structure", new VChassisSetPrimitive() ); - Lookup.put( "Primitive Industrial Structure", new VChassisSetPrimitiveIndustrial() ); - Lookup.put( "Primitive Cockpit", new VCockpitSetPrimitive() ); - Lookup.put( "Primitive Industrial Cockpit", new VCockpitSetPrimIndustrial() ); - Lookup.put( "Primitive Industrial w/ Adv. FC", new VCockpitSetPrimIndustrialAFC() ); + Lookup.put("Standard Armor", new VArmorSetStandard()); + Lookup.put("Ferro-Fibrous", new VArmorSetFF()); + Lookup.put("(IS) Ferro-Fibrous", new VArmorSetFF()); + Lookup.put("(CL) Ferro-Fibrous", new VArmorSetFF()); + Lookup.put("Stealth Armor", new VArmorSetStealth()); + Lookup.put("Light Ferro-Fibrous", new VArmorSetLightFF()); + Lookup.put("Heavy Ferro-Fibrous", new VArmorSetHeavyFF()); + Lookup.put("Ferro-Lamellor", new VArmorSetFL()); + Lookup.put("Hardened Armor", new VArmorSetHA()); + Lookup.put("Laser-Reflective", new VArmorSetLR()); + Lookup.put("(IS) Laser-Reflective", new VArmorSetLR()); + Lookup.put("(CL) Laser-Reflective", new VArmorSetLR()); + Lookup.put("Reactive Armor", new VArmorSetRE()); + Lookup.put("(IS) Reactive Armor", new VArmorSetRE()); + Lookup.put("(CL) Reactive Armor", new VArmorSetRE()); + Lookup.put("Industrial Armor", new VArmorSetIndustrial()); + Lookup.put("Commercial Armor", new VArmorSetCommercial()); + Lookup.put("Ablation Armor", new VArmorSetAB()); + Lookup.put("Heat-Dissipating Armor", new VArmorSetHD()); + Lookup.put("Impact-Resistant Armor", new VArmorSetIR()); + Lookup.put("Ballistic-Reinforced Armor", new VArmorSetBR()); + Lookup.put("Patchwork Armor", new VArmorSetPatchwork()); + Lookup.put("Standard Structure", new VChassisSetStandard()); + Lookup.put("Composite Structure", new VChassisSetComposite()); + Lookup.put("Endo-Steel", new VChassisSetEndoSteel()); + Lookup.put("(IS) Endo-Steel", new VChassisSetEndoSteel()); + Lookup.put("(CL) Endo-Steel", new VChassisSetEndoSteel()); + Lookup.put("Endo-Composite", new VChassisSetEndoComposite()); + Lookup.put("(IS) Endo-Composite", new VChassisSetEndoComposite()); + Lookup.put("(CL) Endo-Composite", new VChassisSetEndoComposite()); + Lookup.put("Reinforced Structure", new VChassisSetReinforced()); + Lookup.put("Industrial Structure", new VChassisSetIndustrial()); + Lookup.put("Standard Cockpit", new VCockpitSetStandard()); + Lookup.put("Industrial Cockpit", new VCockpitSetIndustrial()); + Lookup.put("Industrial w/ Adv. FC", new VCockpitSetIndustrialAFC()); + Lookup.put("Interface Cockpit", new VCockpitSetInterface()); + Lookup.put("Small Cockpit", new VCockpitSetSmall()); + Lookup.put("Torso-Mounted Cockpit", new VCockpitSetTorsoMount()); + Lookup.put("Virtual Reality Piloting Pod", new VCockpitSetVirtualRealityPilotingPod()); + Lookup.put("Robotic Cockpit", new VCockpitSetRobotic()); + Lookup.put("Fuel-Cell Engine", new VEngineSetFuelCell()); + Lookup.put("Fission Engine", new VEngineSetFission()); + Lookup.put("Fusion Engine", new VEngineSetFusion()); + Lookup.put("Primitive Fuel-Cell Engine", new VEngineSetPrimitiveFuelCell()); + Lookup.put("Primitive Fission Engine", new VEngineSetPrimitiveFission()); + Lookup.put("Primitive Fusion Engine", new VEngineSetPrimitiveFusion()); + Lookup.put("XL Engine", new VEngineSetFusionXL()); + Lookup.put("(IS) XL Engine", new VEngineSetFusionXL()); + Lookup.put("(CL) XL Engine", new VEngineSetFusionXL()); + Lookup.put("XXL Engine", new VEngineSetFusionXXL()); + Lookup.put("(IS) XXL Engine", new VEngineSetFusionXXL()); + Lookup.put("(CL) XXL Engine", new VEngineSetFusionXXL()); + Lookup.put("I.C.E. Engine", new VEngineSetICE()); + Lookup.put("Primitive I.C.E. Engine", new VEngineSetPrimitiveICE()); + Lookup.put("Compact Fusion Engine", new VEngineSetCompactFusion()); + Lookup.put("Light Fusion Engine", new VEngineSetLightFusion()); + Lookup.put("Standard Gyro", new VGyroSetStandard()); + Lookup.put("Heavy-Duty Gyro", new VGyroSetHD()); + Lookup.put("Extra-Light Gyro", new VGyroSetXL()); + Lookup.put("Compact Gyro", new VGyroSetCompact()); + Lookup.put("No Gyro", new VGyroSetNone()); + Lookup.put("No Enhancement", new VEnhanceSetNone()); + Lookup.put("MASC", new VEnhanceSetMASC()); + Lookup.put("(IS) MASC", new VEnhanceSetMASC()); + Lookup.put("(CL) MASC", new VEnhanceSetMASC()); + Lookup.put("TSM", new VEnhanceSetTSM()); + Lookup.put("Industrial TSM", new VEnhanceSetITSM()); + Lookup.put("Single Heat Sink", new VHeatSinkSetSingle()); + Lookup.put("Double Heat Sink", new VHeatSinkSetDouble()); + Lookup.put("(IS) Double Heat Sink", new VHeatSinkSetDouble()); + Lookup.put("(CL) Double Heat Sink", new VHeatSinkSetDouble()); + Lookup.put("Compact Heat Sink", new VHeatSinkSetCompact()); + Lookup.put("Laser Heat Sink", new VHeatSinkSetLaser()); + Lookup.put("Prototype Double Heat Sink", new VHeatSinkSetProtoDouble()); + Lookup.put("Double Heat Sink (Freezers)", new VHeatSinkSetProtoDouble()); + Lookup.put("Standard Jump Jet", new VJumpJetSetStandard()); + Lookup.put("Improved Jump Jet", new VJumpJetSetImproved()); + Lookup.put("Prototype Improved Jump Jet", new VJumpJetSetPrototypeImproved()); + Lookup.put("Primitive Prototype Jump Jet", new VJumpJetSetPrimitivePrototype()); + Lookup.put("Mech UMU", new VJumpJetSetUMU()); + Lookup.put("Primitive Armor", new VArmorSetPrimitive()); + Lookup.put("Primitive Structure", new VChassisSetPrimitive()); + Lookup.put("Primitive Industrial Structure", new VChassisSetPrimitiveIndustrial()); + Lookup.put("Primitive Cockpit", new VCockpitSetPrimitive()); + Lookup.put("Primitive Industrial Cockpit", new VCockpitSetPrimIndustrial()); + Lookup.put("Primitive Industrial w/ Adv. FC", new VCockpitSetPrimIndustrialAFC()); // now to fix all the visitors with counterparts to use Clan tech if needed - ((ifVisitor) Lookup.get( "(CL) Ferro-Fibrous" )).SetClan( true ); - ((ifVisitor) Lookup.get( "(CL) Laser-Reflective" )).SetClan( true ); - ((ifVisitor) Lookup.get( "(CL) Reactive Armor" )).SetClan( true ); - ((ifVisitor) Lookup.get( "(CL) Endo-Steel" )).SetClan( true ); - ((ifVisitor) Lookup.get( "(CL) Endo-Composite" )).SetClan( true ); - ((ifVisitor) Lookup.get( "(CL) XL Engine" )).SetClan( true ); - ((ifVisitor) Lookup.get( "(CL) XXL Engine" )).SetClan( true ); - ((ifVisitor) Lookup.get( "(CL) MASC" )).SetClan( true ); - ((ifVisitor) Lookup.get( "(CL) Double Heat Sink" )).SetClan( true ); + ((ifVisitor) Lookup.get("(CL) Ferro-Fibrous")).SetClan(true); + ((ifVisitor) Lookup.get("(CL) Laser-Reflective")).SetClan(true); + ((ifVisitor) Lookup.get("(CL) Reactive Armor")).SetClan(true); + ((ifVisitor) Lookup.get("(CL) Endo-Steel")).SetClan(true); + ((ifVisitor) Lookup.get("(CL) Endo-Composite")).SetClan(true); + ((ifVisitor) Lookup.get("(CL) XL Engine")).SetClan(true); + ((ifVisitor) Lookup.get("(CL) XXL Engine")).SetClan(true); + ((ifVisitor) Lookup.get("(CL) MASC")).SetClan(true); + ((ifVisitor) Lookup.get("(CL) Double Heat Sink")).SetClan(true); } // toString diff --git a/sswlib/src/main/java/components/ifCVLoadout.java b/sswlib/src/main/java/components/ifCVLoadout.java index c0c05de6..26041507 100644 --- a/sswlib/src/main/java/components/ifCVLoadout.java +++ b/sswlib/src/main/java/components/ifCVLoadout.java @@ -57,8 +57,8 @@ public interface ifCVLoadout { public boolean QueueContains( abPlaceable p ); public EquipmentCollection GetCollection( abPlaceable p ); public ArrayList GetQueue(); - public ArrayList GetNonCore(); - public ArrayList GetEquipment(); + public ArrayList GetNonCore(); + public ArrayList GetEquipment(); public boolean UsingTC(); public TargetingComputer GetTC(); public void FullUnallocate(); @@ -127,7 +127,7 @@ public interface ifCVLoadout { public void SetRearTurret( Turret t ); public void SetSponsonTurretLeft(SponsonTurret t); public void SetSponsonTurretRight(SponsonTurret t); - public ArrayList GetMechMods(); + public ArrayList GetMechMods(); public boolean CanUseClanCASE(); public boolean IsUsingClanCASE(); public void SetClanCASE( boolean b ); diff --git a/sswlib/src/main/java/components/ifMechLoadout.java b/sswlib/src/main/java/components/ifMechLoadout.java index c2417ba2..a0678bce 100644 --- a/sswlib/src/main/java/components/ifMechLoadout.java +++ b/sswlib/src/main/java/components/ifMechLoadout.java @@ -32,212 +32,418 @@ import java.util.List; public interface ifMechLoadout { - public void SetName( String s ); + public void SetName(String s); + public String GetName(); - public void SetSource( String s ); + + public void SetSource(String s); + public String GetSource(); + public Mech GetMech(); + public boolean IsQuad(); + public boolean IsTripod(); + public abPlaceable GetNoItem(); + public JumpJetFactory GetJumpJets(); + public HeatSinkFactory GetHeatSinks(); + public ActuatorSet GetActuators(); + public int GetRulesLevel(); - public boolean SetRulesLevel( int NewLevel ); + + public boolean SetRulesLevel(int NewLevel); + public int GetTechBase(); - public void SetTechBase( int NewLevel ); + + public void SetTechBase(int NewLevel); + public int GetEra(); - public boolean SetEra( int era ); + + public boolean SetEra(int era); + public int GetProductionEra(); - public boolean SetProductionEra( int era ); + + public boolean SetProductionEra(int era); + public int GetYear(); - public void SetYear( int year, boolean specified ); + + public void SetYear(int year, boolean specified); + public boolean YearWasSpecified(); - public void SetYearRestricted( boolean b ); + + public void SetYearRestricted(boolean b); + public boolean IsYearRestricted(); - public void AddToQueue( abPlaceable p ); - public void RemoveFromQueue( abPlaceable p ); - public abPlaceable GetFromQueueByIndex( int Index ); - public boolean QueueContains( abPlaceable p ); - public EquipmentCollection GetCollection( abPlaceable p ); + + public void AddToQueue(abPlaceable p); + + public void RemoveFromQueue(abPlaceable p); + + public abPlaceable GetFromQueueByIndex(int Index); + + public boolean QueueContains(abPlaceable p); + + public EquipmentCollection GetCollection(abPlaceable p); + public ArrayList GetQueue(); - public ArrayList GetNonCore(); - public ArrayList GetEquipment(); + + public ArrayList GetNonCore(); + + public ArrayList GetEquipment(); + public void ClearQueue(); // unused + public void FullUnallocate(); + public void ClearLoadout(); + public void SafeClearLoadout(); + public void SafeUnallocateHD(); + public void SafeMassUnallocate(); - public void Transfer( ifMechLoadout l ); - public void AddTo( abPlaceable p, int Loc, int SIndex ) throws Exception; - public void AddTo( abPlaceable[] Loc, abPlaceable p, int index, int numcrits ) throws Exception; - public void AddToHD( abPlaceable p ) throws Exception; - public void AddToCT( abPlaceable p ) throws Exception; - public void AddToLT( abPlaceable p ) throws Exception; - public void AddToRT( abPlaceable p ) throws Exception; - public void AddToLA( abPlaceable p ) throws Exception; - public void AddToRA( abPlaceable p ) throws Exception; - public void AddToLL( abPlaceable p ) throws Exception; - public void AddToRL( abPlaceable p ) throws Exception; - public void AddToCL( abPlaceable p ) throws Exception; - public void AddToHD( abPlaceable p, int SIndex ) throws Exception; - public void AddToCT( abPlaceable p, int SIndex ) throws Exception; - public void AddToRT( abPlaceable p, int SIndex ) throws Exception; - public void AddToLT( abPlaceable p, int SIndex ) throws Exception; - public void AddToRA( abPlaceable p, int SIndex ) throws Exception; - public void AddToLA( abPlaceable p, int SIndex ) throws Exception; - public void AddToRL( abPlaceable p, int SIndex ) throws Exception; - public void AddToLL( abPlaceable p, int SIndex ) throws Exception; - public void AddToCL( abPlaceable p, int SIndex ) throws Exception; + + public void Transfer(ifMechLoadout l); + + public void AddTo(abPlaceable p, int Loc, int SIndex) throws Exception; + + public void AddTo(abPlaceable[] Loc, abPlaceable p, int index, int numcrits) throws Exception; + + public void AddToHD(abPlaceable p) throws Exception; + + public void AddToCT(abPlaceable p) throws Exception; + + public void AddToLT(abPlaceable p) throws Exception; + + public void AddToRT(abPlaceable p) throws Exception; + + public void AddToLA(abPlaceable p) throws Exception; + + public void AddToRA(abPlaceable p) throws Exception; + + public void AddToLL(abPlaceable p) throws Exception; + + public void AddToRL(abPlaceable p) throws Exception; + + public void AddToCL(abPlaceable p) throws Exception; + + public void AddToHD(abPlaceable p, int SIndex) throws Exception; + + public void AddToCT(abPlaceable p, int SIndex) throws Exception; + + public void AddToRT(abPlaceable p, int SIndex) throws Exception; + + public void AddToLT(abPlaceable p, int SIndex) throws Exception; + + public void AddToRA(abPlaceable p, int SIndex) throws Exception; + + public void AddToLA(abPlaceable p, int SIndex) throws Exception; + + public void AddToRL(abPlaceable p, int SIndex) throws Exception; + + public void AddToLL(abPlaceable p, int SIndex) throws Exception; + + public void AddToCL(abPlaceable p, int SIndex) throws Exception; + public abPlaceable[] GetHDCrits(); + public abPlaceable[] GetCTCrits(); + public abPlaceable[] GetRTCrits(); + public abPlaceable[] GetLTCrits(); + public abPlaceable[] GetRACrits(); + public abPlaceable[] GetLACrits(); + public abPlaceable[] GetRLCrits(); + public abPlaceable[] GetLLCrits(); + public abPlaceable[] GetCLCrits(); - public abPlaceable[] GetCrits( int Loc ); + + public abPlaceable[] GetCrits(int Loc); + public List GetCrits(); - public int Find( abPlaceable p ); - public LocationIndex FindIndex( abPlaceable p ); - public ArrayList FindSplitIndex( abPlaceable p ); - public int[] FindInstances( abPlaceable p ); - public ArrayList FindIndexes( abPlaceable p ); + + public int Find(abPlaceable p); + + public LocationIndex FindIndex(abPlaceable p); + + public ArrayList FindSplitIndex(abPlaceable p); + + public int[] FindInstances(abPlaceable p); + + public ArrayList FindIndexes(abPlaceable p); + public List FindIndexesByName(String n); + public int[] FindHeatSinks(); - public int[] FindJumpJets( boolean IJJ ); + + public int[] FindJumpJets(boolean IJJ); + public int[] FindModularArmor(); + public int[] FindExplosiveInstances(); -// public void FlushIllegal( int Era, int Year, boolean Restrict ); + + // public void FlushIllegal( int Era, int Year, boolean Restrict ); public void FlushIllegal(); - public boolean UnallocateAll( abPlaceable p, boolean override ); - public void Remove( abPlaceable p ); - public void UnallocateByIndex( int SIndex, abPlaceable[] a ); - public void AutoAllocate( abPlaceable p ); - public void AutoAllocate( EquipmentCollection e ); - public void SplitAllocate( abPlaceable p, int FirstLoc, int FirstIndex, int SecondLoc ) throws Exception; - public int FreeFrom( abPlaceable [] Loc, int index ); + + public boolean UnallocateAll(abPlaceable p, boolean override); + + public void Remove(abPlaceable p); + + public void UnallocateByIndex(int SIndex, abPlaceable[] a); + + public void AutoAllocate(abPlaceable p); + + public void AutoAllocate(EquipmentCollection e); + + public void SplitAllocate(abPlaceable p, int FirstLoc, int FirstIndex, int SecondLoc) throws Exception; + + public int FreeFrom(abPlaceable[] Loc, int index); + public void Compact(); - public boolean IsAllocated( abPlaceable p ); + + public boolean IsAllocated(abPlaceable p); + public int UnplacedCrits(); + public int FreeCrits(); - public int FreeCrits( abPlaceable[] Loc ); - public int FirstFree( abPlaceable[] Loc ); + + public int FreeCrits(abPlaceable[] Loc); + + public int FirstFree(abPlaceable[] Loc); + public void LockChassis(); + public void UnlockChassis(); + public ifMechLoadout Clone(); - public void SetBaseLoadout( ifMechLoadout l ); + + public void SetBaseLoadout(ifMechLoadout l); + public ifMechLoadout GetBaseLoadout(); - public void SetHDCrits( abPlaceable[] c ); - public void SetCTCrits( abPlaceable[] c ); - public void SetLTCrits( abPlaceable[] c ); - public void SetRTCrits( abPlaceable[] c ); - public void SetLACrits( abPlaceable[] c ); - public void SetRACrits( abPlaceable[] c ); - public void SetLLCrits( abPlaceable[] c ); - public void SetRLCrits( abPlaceable[] c ); - public void SetCLCrits( abPlaceable[] c ); - public void SetNonCore( ArrayList v ); - public void SetTCList( ArrayList v ); - public void SetEquipment( ArrayList v ); + + public void SetHDCrits(abPlaceable[] c); + + public void SetCTCrits(abPlaceable[] c); + + public void SetLTCrits(abPlaceable[] c); + + public void SetRTCrits(abPlaceable[] c); + + public void SetLACrits(abPlaceable[] c); + + public void SetRACrits(abPlaceable[] c); + + public void SetLLCrits(abPlaceable[] c); + + public void SetRLCrits(abPlaceable[] c); + + public void SetCLCrits(abPlaceable[] c); + + public void SetNonCore(ArrayList v); + + public void SetTCList(ArrayList v); + + public void SetEquipment(ArrayList v); + public boolean CanUseClanCASE(); + public boolean IsUsingClanCASE(); - public void SetClanCASE( boolean b ); - public void SetCTCASE( boolean Add, int index ) throws Exception; - public void SetLTCASE( boolean Add, int index ) throws Exception; - public void SetRTCASE( boolean Add, int index ) throws Exception; - public void SetCTCASE( CASE c ); - public void SetLTCASE( CASE c ); - public void SetRTCASE( CASE c ); + + public void SetClanCASE(boolean b); + + public void SetCTCASE(boolean Add, int index) throws Exception; + + public void SetLTCASE(boolean Add, int index) throws Exception; + + public void SetRTCASE(boolean Add, int index) throws Exception; + + public void SetCTCASE(CASE c); + + public void SetLTCASE(CASE c); + + public void SetRTCASE(CASE c); + public boolean HasCTCASE(); + public boolean HasLTCASE(); + public boolean HasRTCASE(); + public CASE GetCTCase(); + public CASE GetRTCase(); + public CASE GetLTCase(); - public void SetHDCASEII( boolean Add, int index, boolean clan ) throws Exception; - public void SetHDCASEII( CASEII c ); + + public void SetHDCASEII(boolean Add, int index, boolean clan) throws Exception; + + public void SetHDCASEII(CASEII c); + public boolean HasHDCASEII(); + public CASEII GetHDCaseII(); - public void SetCTCASEII( boolean Add, int index, boolean clan ) throws Exception; - public void SetCTCASEII( CASEII c ); + + public void SetCTCASEII(boolean Add, int index, boolean clan) throws Exception; + + public void SetCTCASEII(CASEII c); + public boolean HasCTCASEII(); + public CASEII GetCTCaseII(); - public void SetLTCASEII( boolean Add, int index, boolean clan ) throws Exception; - public void SetLTCASEII( CASEII c ); + + public void SetLTCASEII(boolean Add, int index, boolean clan) throws Exception; + + public void SetLTCASEII(CASEII c); + public boolean HasLTCASEII(); + public CASEII GetLTCaseII(); - public void SetRTCASEII( boolean Add, int index, boolean clan ) throws Exception; - public void SetRTCASEII( CASEII c ); + + public void SetRTCASEII(boolean Add, int index, boolean clan) throws Exception; + + public void SetRTCASEII(CASEII c); + public boolean HasRTCASEII(); + public CASEII GetRTCaseII(); - public void SetLACASEII( boolean Add, int index, boolean clan ) throws Exception; - public void SetLACASEII( CASEII c ); + + public void SetLACASEII(boolean Add, int index, boolean clan) throws Exception; + + public void SetLACASEII(CASEII c); + public boolean HasLACASEII(); + public CASEII GetLACaseII(); - public void SetRACASEII( boolean Add, int index, boolean clan ) throws Exception; - public void SetRACASEII( CASEII c ); + + public void SetRACASEII(boolean Add, int index, boolean clan) throws Exception; + + public void SetRACASEII(CASEII c); + public boolean HasRACASEII(); + public CASEII GetRACaseII(); - public void SetLLCASEII( boolean Add, int index, boolean clan ) throws Exception; - public void SetLLCASEII( CASEII c ); + + public void SetLLCASEII(boolean Add, int index, boolean clan) throws Exception; + + public void SetLLCASEII(CASEII c); + public boolean HasLLCASEII(); + public CASEII GetLLCaseII(); - public void SetRLCASEII( boolean Add, int index, boolean clan ) throws Exception; - public void SetRLCASEII( CASEII c ); + + public void SetRLCASEII(boolean Add, int index, boolean clan) throws Exception; + + public void SetRLCASEII(CASEII c); + public boolean HasRLCASEII(); + public CASEII GetRLCaseII(); - public void SetCLCASEII( boolean Add, int index, boolean clan ) throws Exception; - public void SetCLCASEII( CASEII c ); + + public void SetCLCASEII(boolean Add, int index, boolean clan) throws Exception; + + public void SetCLCASEII(CASEII c); + public boolean HasCLCASEII(); + public CASEII GetCLCaseII(); - public void SetFCSArtemisIV( boolean b ) throws Exception; - public void SetFCSArtemisV( boolean b ) throws Exception; - public void SetFCSApollo( boolean b ) throws Exception; + + public void SetFCSArtemisIV(boolean b) throws Exception; + + public void SetFCSArtemisV(boolean b) throws Exception; + + public void SetFCSApollo(boolean b) throws Exception; + public boolean UsingArtemisIV(); + public boolean UsingArtemisV(); + public boolean UsingApollo(); + public boolean UsingDumper(); + public Dumper GetDumper(); - public void UseDumper( boolean use, String dumpDirection); + + public void UseDumper(boolean use, String dumpDirection); + public void CheckDumper(); + public boolean UsingTC(); + public TargetingComputer GetTC(); - public void UseTC( boolean use, boolean clan ); + + public void UseTC(boolean use, boolean clan); + public void CheckTC(); + public void UnallocateTC(); - public void SetSupercharger( boolean b, int Loc, int index ) throws Exception; - public void SetSupercharger( Supercharger s ); + + public void SetSupercharger(boolean b, int Loc, int index) throws Exception; + + public void SetSupercharger(Supercharger s); + public boolean HasSupercharger(); + public Supercharger GetSupercharger(); + public PowerAmplifier GetPowerAmplifier(); + public MechTurret GetHDTurret(); - public void SetHDTurret( boolean Add, int index ) throws Exception; + + public void SetHDTurret(boolean Add, int index) throws Exception; + public boolean HasHDTurret(); + public boolean CanUseHDTurret(); - public void SetHDTurret( MechTurret t ); + + public void SetHDTurret(MechTurret t); + public MechTurret GetLTTurret(); - public void SetLTTurret( boolean Add, int index ) throws Exception; + + public void SetLTTurret(boolean Add, int index) throws Exception; + public boolean HasLTTurret(); + public boolean CanUseLTTurret(); - public void SetLTTurret( MechTurret t ); + + public void SetLTTurret(MechTurret t); + public MechTurret GetRTTurret(); - public void SetRTTurret( boolean Add, int index ) throws Exception; + + public void SetRTTurret(boolean Add, int index) throws Exception; + public boolean HasRTTurret(); + public boolean CanUseRTTurret(); - public void SetRTTurret( MechTurret t ); + + public void SetRTTurret(MechTurret t); + public void UnallocateFuelTanks(); - public void CheckExclusions( abPlaceable a ) throws Exception; - public void AddMechModifier( MechModifier m ); - public void RemoveMechMod( MechModifier m ); + + public void CheckExclusions(abPlaceable a) throws Exception; + + public void AddMechModifier(MechModifier m); + + public void RemoveMechMod(MechModifier m); + public ArrayList GetMechMods(); - public void SetBoobyTrap( boolean b ) throws Exception; + + public void SetBoobyTrap(boolean b) throws Exception; + public boolean HasBoobyTrap(); + public BoobyTrap GetBoobyTrap(); + public boolean LocationHasEquip(int index, String name); + public boolean HasItem(String lookupName); } diff --git a/sswlib/src/main/java/filehandlers/CVTXTWriter.java b/sswlib/src/main/java/filehandlers/CVTXTWriter.java index 87463821..52479767 100644 --- a/sswlib/src/main/java/filehandlers/CVTXTWriter.java +++ b/sswlib/src/main/java/filehandlers/CVTXTWriter.java @@ -47,33 +47,34 @@ public class CVTXTWriter { private CombatVehicle CurVee; - private String NL, - tformat = "$6.2f"; + private String NL, tformat = "$6.2f"; private ArrayList forces; public boolean CurrentLoadoutOnly = false; public CVTXTWriter() { - NL = System.getProperty( "line.separator" ); + NL = System.getProperty("line.separator"); } - public CVTXTWriter( ArrayList forces ) { + public CVTXTWriter(ArrayList forces) { this.forces = forces; } - public CVTXTWriter( CombatVehicle m ) { + public CVTXTWriter(CombatVehicle m) { this(); CurVee = m; - if( CurVee.UsingFractionalAccounting() ) { + if (CurVee.UsingFractionalAccounting()) { tformat = "$7.3f"; } else { tformat = "$6.2f"; } } - public void Write( String filename ) throws IOException { - if ( !filename.endsWith(".txt") ) { filename += ".txt"; } - BufferedWriter FR = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ); + public void Write(String filename) throws IOException { + if (!filename.endsWith(".txt")) { + filename += ".txt"; + } + BufferedWriter FR = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")); for (Force force : forces) { FR.write(force.SerializeClipboard()); @@ -81,16 +82,18 @@ public void Write( String filename ) throws IOException { } FR.close(); } - - public void WriteForces( String filename, Force force ) throws IOException { + + public void WriteForces(String filename, Force force) throws IOException { forces = new ArrayList(); forces.add(force); - WriteForces( filename, forces ); + WriteForces(filename, forces); } - public void WriteForces( String filename, ArrayList forces ) throws IOException { - if ( !filename.endsWith(".txt") ) { filename += ".txt"; } - BufferedWriter FR = new BufferedWriter( new FileWriter(filename) ); + public void WriteForces(String filename, ArrayList forces) throws IOException { + if (!filename.endsWith(".txt")) { + filename += ".txt"; + } + BufferedWriter FR = new BufferedWriter(new FileWriter(filename)); for (Force force : forces) { FR.write(force.SerializeClipboard()); @@ -99,24 +102,25 @@ public void WriteForces( String filename, ArrayList forces ) throws IOExc FR.close(); } -// This is a text formating string (80 chars) I keep around for when it's needed -// "----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+" - public void WriteTXT( String filename ) throws IOException { - BufferedWriter FR = new BufferedWriter( new FileWriter( filename ) ); + // This is a text formating string (80 chars) I keep around for when it's needed + // "----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+" + public void WriteTXT(String filename) throws IOException { + BufferedWriter FR = new BufferedWriter(new FileWriter(filename)); // get the text export and write it - FR.write( GetTextExport() ); + FR.write(GetTextExport()); // all done FR.close(); } - public String GetChatStats( Mech m ) { + public String GetChatStats(Mech m) { // a fun convenience routine for those who talk in chat or forums. String retval = ""; // pondering some sort of GetChatName() for abplaceables. - retval += m.GetTonnage() + " tons, " + m.GetAdjustedWalkingMP( false, true ) + "/" + m.GetAdjustedRunningMP( false, true ) + "/" + m.GetAdjustedJumpingMP( false ); + retval += m.GetTonnage() + " tons, " + m.GetAdjustedWalkingMP(false, true) + "/" + + m.GetAdjustedRunningMP(false, true) + "/" + m.GetAdjustedJumpingMP(false); return retval; } @@ -124,35 +128,37 @@ public String GetChatStats( Mech m ) { public String GetTextExport() { String retval = ""; - if( CurVee.IsOmni() ) { - // start out with the base chassis. we'll switch later when needed - CurVee.SetCurLoadout( common.Constants.BASELOADOUT_NAME ); + if (CurVee.IsOmni()) { + // start out with the base chassis. we'll switch later when needed + CurVee.SetCurLoadout(common.Constants.BASELOADOUT_NAME); } retval += CurVee.GetName() + " " + CurVee.GetModel() + NL + NL; retval += "Mass: " + CurVee.GetTonnage() + " tons" + NL; - if( CurVee.IsPrimitive() ) { - retval += "Tech Base: " + CommonTools.GetTechbaseString( CurVee.GetBaseTechbase() ) + " (Primitive)" + NL; + if (CurVee.IsPrimitive()) { + retval += "Tech Base: " + CommonTools.GetTechbaseString(CurVee.GetBaseTechbase()) + " (Primitive)" + NL; } else { - retval += "Tech Base: " + CommonTools.GetTechbaseString( CurVee.GetBaseTechbase() ) + NL; + retval += "Tech Base: " + CommonTools.GetTechbaseString(CurVee.GetBaseTechbase()) + NL; } - retval += "Motive Type: " + CurVee.GetMotiveLookupName() + ( CurVee.IsOmni() ? " OmniVehicle":"") + NL; - retval += "Rules Level: " + CommonTools.GetRulesLevelString( CurVee.GetRulesLevel() ) + NL; - retval += "Era: " + CommonTools.DecodeEra( CurVee.GetEra() ) + NL; + retval += "Motive Type: " + CurVee.GetMotiveLookupName() + (CurVee.IsOmni() ? " OmniVehicle" : "") + NL; + retval += "Rules Level: " + CommonTools.GetRulesLevelString(CurVee.GetRulesLevel()) + NL; + retval += "Era: " + CommonTools.DecodeEra(CurVee.GetEra()) + NL; retval += "Tech Rating/Era Availability: " + CurVee.GetAvailability().GetBestCombinedCode() + NL; retval += "Production Year: " + CurVee.GetYear() + NL; retval += "Dry Cost: " + String.format("%1$,.0f", CurVee.GetDryCost()) + " C-Bills" + NL; retval += "Total Cost: " + String.format("%1$,.0f", CurVee.GetTotalCost()) + " C-Bills" + NL; - retval += "Battle Value: " + String.format( "%1$,d", CurVee.GetCurrentBV() ) + NL + NL; + retval += "Battle Value: " + String.format("%1$,d", CurVee.GetCurrentBV()) + NL + NL; - if( CurVee.UsingFractionalAccounting() ) { + if (CurVee.UsingFractionalAccounting()) { retval += "Construction Options: Fractional Accounting" + NL + NL; } - //retval += "Chassis: " + CurVee.GetChassisModel() + " " + CurVee.GetIntStruc().CritName() + NL; - retval += "Power Plant: " + CurVee.GetEngineManufacturer() + " " + CurVee.GetEngine().GetRating() + " " + CurVee.GetEngine() + NL; - retval += "Cruise Speed: " + CommonTools.FormatSpeed( CurVee.getCruiseMP() * 10.8 ) + " km/h" + NL; - retval += "Flanking Speed: " + CommonTools.FormatSpeed( CurVee.getFlankMP() * 10.8 ) + " km/h" + NL; - if ( CurVee.GetJumpJets().GetNumJJ() > 0 ) { + // retval += "Chassis: " + CurVee.GetChassisModel() + " " + + // CurVee.GetIntStruc().CritName() + NL; + retval += "Power Plant: " + CurVee.GetEngineManufacturer() + " " + CurVee.GetEngine().GetRating() + " " + + CurVee.GetEngine() + NL; + retval += "Cruise Speed: " + CommonTools.FormatSpeed(CurVee.getCruiseMP() * 10.8) + " km/h" + NL; + retval += "Flanking Speed: " + CommonTools.FormatSpeed(CurVee.getFlankMP() * 10.8) + " km/h" + NL; + if (CurVee.GetJumpJets().GetNumJJ() > 0) { retval += "Jump Jets: " + CurVee.GetJJModel() + NL; retval += " Jump Capacity: " + GetJumpJetDistanceLine() + NL; } @@ -162,34 +168,36 @@ public String GetTextExport() { retval += "Manufacturer: " + CurVee.GetCompany() + NL; retval += " Primary Factory: " + CurVee.GetLocation() + NL; retval += BuildComputerBlock() + NL + NL; -// retval += "================================================================================" + NL; - if( ! CurVee.getOverview().equals( "" ) ) { + // retval += + // "================================================================================" + // + NL; + if (!CurVee.getOverview().equals("")) { retval += "Overview:" + NL; - retval += FormatFluff( CurVee.getOverview() ) + NL + NL; + retval += FormatFluff(CurVee.getOverview()) + NL + NL; } - if( ! CurVee.getCapabilities().equals( "" ) ) { + if (!CurVee.getCapabilities().equals("")) { retval += "Capabilities:" + NL; - retval += FormatFluff( CurVee.getCapabilities() ) + NL + NL; + retval += FormatFluff(CurVee.getCapabilities()) + NL + NL; } - if( ! CurVee.getHistory().equals( "" ) ) { + if (!CurVee.getHistory().equals("")) { retval += "Battle History:" + NL; - retval += FormatFluff( CurVee.getHistory() ) + NL + NL; + retval += FormatFluff(CurVee.getHistory()) + NL + NL; } - if( ! CurVee.getDeployment().equals( "" ) ) { + if (!CurVee.getDeployment().equals("")) { retval += "Deployment:" + NL; - retval += FormatFluff( CurVee.getDeployment() ) + NL + NL; + retval += FormatFluff(CurVee.getDeployment()) + NL + NL; } - if( ! CurVee.getVariants().equals( "" ) ) { + if (!CurVee.getVariants().equals("")) { retval += "Variants:" + NL; - retval += FormatFluff( CurVee.getVariants() ) + NL + NL; + retval += FormatFluff(CurVee.getVariants()) + NL + NL; } - if( ! CurVee.getNotables().equals( "" ) ) { + if (!CurVee.getNotables().equals("")) { retval += "Notable 'Mechs & MechWarriors: " + NL; - retval += FormatFluff( CurVee.getNotables() ) + NL + NL; + retval += FormatFluff(CurVee.getNotables()) + NL + NL; } - if( ! CurVee.GetAdditional().equals( "" ) ) { + if (!CurVee.GetAdditional().equals("")) { retval += "Additional: " + NL; - retval += FormatFluff( CurVee.GetAdditional() ) + NL + NL; + retval += FormatFluff(CurVee.GetAdditional()) + NL + NL; } retval += "================================================================================" + NL; retval += GetMiniTextExport(); @@ -200,82 +208,125 @@ public String GetTextExport() { public String GetMiniTextExport() { String retval = ""; - if ( CurrentLoadoutOnly ) { + if (CurrentLoadoutOnly) { retval += CurVee.GetName() + " " + CurVee.GetModel() + NL + NL; - retval += "Tech Base: " + CommonTools.GetTechbaseString( CurVee.GetTechbase() ) + NL; + retval += "Tech Base: " + CommonTools.GetTechbaseString(CurVee.GetTechbase()) + NL; retval += "Chassis Config: "; String chassisString = CurVee.GetMotiveLookupName(); - if ( CurVee.IsOmni() ) { chassisString += " OmniVehicle"; } + if (CurVee.IsOmni()) { + chassisString += " OmniVehicle"; + } retval += chassisString + NL; - retval += String.format( "Era: %1$-56s Cost: %2$,.0f", CommonTools.DecodeEra( CurVee.GetEra() ), Math.floor( CurVee.GetTotalCost() + 0.5 ) ) + NL; - retval += String.format( "Tech Rating/Era Availability: %1$-32s BV2: %2$,d", CurVee.GetAvailability().GetBestCombinedCode(), CurVee.GetCurrentBV() ) + NL + NL; + retval += String.format("Era: %1$-56s Cost: %2$,.0f", CommonTools.DecodeEra(CurVee.GetEra()), + Math.floor(CurVee.GetTotalCost() + 0.5)) + NL; + retval += String.format("Tech Rating/Era Availability: %1$-32s BV2: %2$,d", + CurVee.GetAvailability().GetBestCombinedCode(), CurVee.GetCurrentBV()) + NL + NL; } retval += "Equipment Type Rating Mass " + NL; retval += "--------------------------------------------------------------------------------" + NL; - retval += String.format( "Internal Structure: %1$-28s %2$3s points %3" + tformat, CurVee.GetIntStruc().CritName(), CurVee.GetIntStruc().GetTotalPoints(), CurVee.GetIntStruc().GetTonnage() ) + NL; - retval += String.format( "Engine: %1$-28s %2$3s %3" + tformat, FileCommon.GetExportName( CurVee, CurVee.GetEngine() ), CurVee.GetEngine().GetRating(), CurVee.GetEngine().GetTonnage() ) + NL; + retval += String.format("Internal Structure: %1$-28s %2$3s points %3" + tformat, + CurVee.GetIntStruc().CritName(), CurVee.GetIntStruc().GetTotalPoints(), + CurVee.GetIntStruc().GetTonnage()) + NL; + retval += String.format("Engine: %1$-28s %2$3s %3" + tformat, + FileCommon.GetExportName(CurVee, CurVee.GetEngine()), CurVee.GetEngine().GetRating(), + CurVee.GetEngine().GetTonnage()) + NL; retval += " Cruise MP: " + CurVee.getCruiseMP() + NL; retval += " Flank MP: " + CurVee.getFlankMP() + NL; - if( CurVee.GetJumpJets().GetNumJJ() > 0 ) { + if (CurVee.GetJumpJets().GetNumJJ() > 0) { retval += " Jumping MP: " + GetJumpingMPLine() + " " + GetJumpJetTypeLine() + NL; - retval += String.format( " %1$-68s %2$6.2f", "Jump Jet Locations: " + FileCommon.GetJumpJetLocations( CurVee ), CurVee.GetJumpJets().GetTonnage() ) + NL; - } - retval += String.format( "Heat Sinks: %1$-28s %2$-8s %3" + tformat, GetHSType(), GetHSNum(), CurVee.GetHeatSinks().GetTonnage() ) + NL; - retval += String.format( "Control Equipment: %1$-28s %2$-8s %3" + tformat, "", "", CurVee.GetControls() ) + NL; - retval += String.format( "Lift Equipment: %1$-28s %2$-8s %3" + tformat, "", "", CurVee.GetLiftEquipmentTonnage() ) + NL; - if( ! CurVee.GetEngine().IsNuclear() ) { - if( CurVee.GetLoadout().GetPowerAmplifier().GetTonnage() > 0 ) { - retval += String.format( "%1$-72s %2" + tformat, "Power Amplifiers:", CurVee.GetLoadout().GetPowerAmplifier().GetTonnage() ) + NL; + retval += String.format(" %1$-68s %2$6.2f", + "Jump Jet Locations: " + FileCommon.GetJumpJetLocations(CurVee), CurVee.GetJumpJets().GetTonnage()) + + NL; + } + retval += String.format("Heat Sinks: %1$-28s %2$-8s %3" + tformat, GetHSType(), + GetHSNum(), CurVee.GetHeatSinks().GetTonnage()) + NL; + retval += String.format("Control Equipment: %1$-28s %2$-8s %3" + tformat, "", "", + CurVee.GetControls()) + NL; + retval += String.format("Lift Equipment: %1$-28s %2$-8s %3" + tformat, "", "", + CurVee.GetLiftEquipmentTonnage()) + NL; + if (!CurVee.GetEngine().IsNuclear()) { + if (CurVee.GetLoadout().GetPowerAmplifier().GetTonnage() > 0) { + retval += String.format("%1$-72s %2" + tformat, "Power Amplifiers:", + CurVee.GetLoadout().GetPowerAmplifier().GetTonnage()) + NL; } } - if ( CurVee.isHasTurret1() ) - retval += String.format( "Turret: %1$-28s %2$-8s %3" + tformat, "", "", CurVee.GetLoadout().GetTurret().GetTonnage() ) + NL; - if ( CurVee.isHasTurret2() ) - retval += String.format( "Rear Turret: %1$-28s %2$-8s %3" + tformat, "", "", CurVee.GetLoadout().GetRearTurret().GetTonnage() ) + NL; - if ( CurVee.isHasSponsonTurret() ) { - retval += String.format( "Sponson Turret: %1$-28s %2$-8s %3" + tformat, "", "", CurVee.GetLoadout().GetSponsonTurretTonnage() ) + NL; - } - if( CurVee.GetArmor().GetBAR() < 10 ) { - retval += String.format( "Armor: %1$-28s AV - %2$3s %3" + tformat, CurVee.GetArmor().CritName() + " (BAR: " + CurVee.GetArmor().GetBAR() +")", CurVee.GetArmor().GetArmorValue(), CurVee.GetArmor().GetTonnage() ) + NL; + if (CurVee.isHasTurret1()) + retval += String.format("Turret: %1$-28s %2$-8s %3" + tformat, "", "", + CurVee.GetLoadout().GetTurret().GetTonnage()) + NL; + if (CurVee.isHasTurret2()) + retval += String.format("Rear Turret: %1$-28s %2$-8s %3" + tformat, "", "", + CurVee.GetLoadout().GetRearTurret().GetTonnage()) + NL; + if (CurVee.isHasSponsonTurret()) { + retval += String.format("Sponson Turret: %1$-28s %2$-8s %3" + tformat, "", "", + CurVee.GetLoadout().GetSponsonTurretTonnage()) + NL; + } + if (CurVee.GetArmor().GetBAR() < 10) { + retval += String.format("Armor: %1$-28s AV - %2$3s %3" + tformat, + CurVee.GetArmor().CritName() + " (BAR: " + CurVee.GetArmor().GetBAR() + ")", + CurVee.GetArmor().GetArmorValue(), CurVee.GetArmor().GetTonnage()) + NL; } else { - retval += String.format( "Armor: %1$-28s AV - %2$3s %3" + tformat, CurVee.GetArmor().CritName(), CurVee.GetArmor().GetArmorValue(), CurVee.GetArmor().GetTonnage() ) + NL; + retval += String.format("Armor: %1$-28s AV - %2$3s %3" + tformat, + CurVee.GetArmor().CritName(), CurVee.GetArmor().GetArmorValue(), CurVee.GetArmor().GetTonnage()) + + NL; } retval += NL + " Armor " + NL; retval += " Factor " + NL; - if( CurVee.GetArmor().IsPatchwork() ) { - retval += String.format( " Front %1$29s %2$-3s ", "(" + CurVee.GetArmor().GetFrontArmorType().LookupName() + ")", CurVee.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_HD ) ) + NL; - retval += String.format( " Left %1$29s %2$-3s ", "(" + CurVee.GetArmor().GetLeftArmorType().LookupName() + ")", CurVee.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_CT ) ) + NL; - retval += String.format( " Right %1$29s %2$-3s ", "(" + CurVee.GetArmor().GetRightArmorType().LookupName() + ")", CurVee.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LT ) ) + NL; - retval += String.format( " Rear %1$29s %2$-3s ", "(" + CurVee.GetArmor().GetRearArmorType().LookupName() + ")", CurVee.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RT ) ) + NL; - if ( CurVee.isHasTurret1() ) { - retval += String.format( " Turret %1$29s %2$-3s ", "(" + CurVee.GetArmor().GetTurret1ArmorType().LookupName() + ")", CurVee.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LA ) ) + NL; + if (CurVee.GetArmor().IsPatchwork()) { + retval += String.format(" Front %1$29s %2$-3s ", + "(" + CurVee.GetArmor().GetFrontArmorType().LookupName() + ")", + CurVee.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_HD)) + NL; + retval += String.format(" Left %1$29s %2$-3s ", + "(" + CurVee.GetArmor().GetLeftArmorType().LookupName() + ")", + CurVee.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_CT)) + NL; + retval += String.format(" Right %1$29s %2$-3s ", + "(" + CurVee.GetArmor().GetRightArmorType().LookupName() + ")", + CurVee.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LT)) + NL; + retval += String.format(" Rear %1$29s %2$-3s ", + "(" + CurVee.GetArmor().GetRearArmorType().LookupName() + ")", + CurVee.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RT)) + NL; + if (CurVee.isHasTurret1()) { + retval += String.format(" Turret %1$29s %2$-3s ", + "(" + CurVee.GetArmor().GetTurret1ArmorType().LookupName() + ")", + CurVee.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LA)) + NL; } - if ( CurVee.isHasTurret2() ) { - retval += String.format( " Rear Turret %1$29s %2$-3s ", "(" + CurVee.GetArmor().GetTurret2ArmorType().LookupName() + ")", CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_TURRET2 ) ) + NL; + if (CurVee.isHasTurret2()) { + retval += String.format(" Rear Turret %1$29s %2$-3s ", + "(" + CurVee.GetArmor().GetTurret2ArmorType().LookupName() + ")", + CurVee.GetArmor().GetLocationArmor(LocationIndex.CV_LOC_TURRET2)) + NL; } - if ( CurVee.IsVTOL() ) { - retval += String.format( " Rotor %1$29s %2$-3s ", "(" + CurVee.GetArmor().GetRotorArmorType().LookupName() + ")", CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_ROTOR ) ) + NL; + if (CurVee.IsVTOL()) { + retval += String.format(" Rotor %1$29s %2$-3s ", + "(" + CurVee.GetArmor().GetRotorArmorType().LookupName() + ")", + CurVee.GetArmor().GetLocationArmor(LocationIndex.CV_LOC_ROTOR)) + NL; } } else { - retval += String.format( " Front %1$-3s ", CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_FRONT ) ) + NL; - retval += String.format( " Left/Right %1$3s/%2$-3s ", CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_LEFT ), CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_RIGHT) ) + NL; - if ( CurVee.isHasTurret1() ) - retval += String.format( " Turret %1$-3s ", CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_TURRET1 ) ) + NL; - retval += String.format( " Rear %1$-3s ", CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_REAR ) ) + NL; - if ( CurVee.isHasTurret2() ) - retval += String.format( " Rear Turret %1$-3s ", CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_TURRET2 ) ) + NL; - if ( CurVee.IsVTOL() ) - retval += String.format( " Rotor %1$-3s ", CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_ROTOR ) ) + NL; - } - if( CurVee.IsOmni() ) { + retval += String.format(" Front %1$-3s ", + CurVee.GetArmor().GetLocationArmor(LocationIndex.CV_LOC_FRONT)) + NL; + retval += String.format(" Left/Right %1$3s/%2$-3s ", + CurVee.GetArmor().GetLocationArmor(LocationIndex.CV_LOC_LEFT), + CurVee.GetArmor().GetLocationArmor(LocationIndex.CV_LOC_RIGHT)) + NL; + if (CurVee.isHasTurret1()) + retval += String.format(" Turret %1$-3s ", + CurVee.GetArmor().GetLocationArmor(LocationIndex.CV_LOC_TURRET1)) + NL; + retval += String.format(" Rear %1$-3s ", + CurVee.GetArmor().GetLocationArmor(LocationIndex.CV_LOC_REAR)) + NL; + if (CurVee.isHasTurret2()) + retval += String.format(" Rear Turret %1$-3s ", + CurVee.GetArmor().GetLocationArmor(LocationIndex.CV_LOC_TURRET2)) + NL; + if (CurVee.IsVTOL()) + retval += String.format(" Rotor %1$-3s ", + CurVee.GetArmor().GetLocationArmor(LocationIndex.CV_LOC_ROTOR)) + NL; + } + if (CurVee.IsOmni()) { ArrayList l = CurVee.GetLoadouts(); - if ( !CurrentLoadoutOnly ) { - CurVee.SetCurLoadout( common.Constants.BASELOADOUT_NAME ); + if (!CurrentLoadoutOnly) { + CurVee.SetCurLoadout(common.Constants.BASELOADOUT_NAME); retval += NL; retval += BuildEquipmentBlock() + NL; - for( int i = 0; i < l.size(); i++ ) { - CurVee.SetCurLoadout( ((ifCVLoadout) l.get( i )).GetName() ); - retval += NL + "================================================================================" + NL; + for (int i = 0; i < l.size(); i++) { + CurVee.SetCurLoadout(((ifCVLoadout) l.get(i)).GetName()); + retval += NL + "================================================================================" + + NL; retval += BuildOmniLoadout() + NL; } } else { @@ -283,7 +334,9 @@ public String GetMiniTextExport() { retval += BuildOmniLoadout() + NL; } } else { - //retval += NL + "================================================================================" + NL; + // retval += NL + + // "================================================================================" + // + NL; retval += NL; retval += BuildEquipmentBlock() + NL; } @@ -292,159 +345,180 @@ public String GetMiniTextExport() { } private String GetArmament() { - ArrayList v = CurVee.GetLoadout().GetNonCore(); - ArrayList w = new ArrayList(); - ArrayList EQ = new ArrayList(); + ArrayList v = CurVee.GetLoadout().GetNonCore(); + ArrayList w = new ArrayList(); + ArrayList EQ = new ArrayList(); String Armament = ""; // find only the armaments - for( int i = 0; i < v.size(); i++ ) { - if( v.get( i ) instanceof ifWeapon ) { - w.add( v.get( i ) ); + for (int i = 0; i < v.size(); i++) { + if (v.get(i) instanceof ifWeapon) { + w.add(v.get(i)); } else { - EQ.add( v.get( i ) ); + EQ.add(v.get(i)); } } // do we need to continue? - if( w.size() <= 0 ) { - if( CurVee.IsOmni() ) { - return " " + ( CurVee.GetTonnage() - CurVee.GetCurrentTons() ) + " tons of pod space." + NL; + if (w.size() <= 0) { + if (CurVee.IsOmni()) { + return " " + (CurVee.GetTonnage() - CurVee.GetCurrentTons()) + " tons of pod space." + NL; } else { return " None" + NL; } } // sort the weapons according to current BV, assuming front facing - abPlaceable[] weapons = CurVee.SortWeapons( w, false ); - ArrayList Temp = new ArrayList(); + ArrayList weapons = CurVee.SortWeapons(w, false); + ArrayList Temp = new ArrayList(); // add in the rest of the equipment - for( int i = 0; i < weapons.length; i++ ) { - Temp.add( weapons[i] ); + for (int i = 0; i < weapons.size(); i++) { + Temp.add(weapons.get(i)); } - for( int i = 0; i < EQ.size(); i++ ) { - if( ! ( EQ.get( i ) instanceof Ammunition ) ) { - Temp.add( EQ.get( i ) ); + for (int i = 0; i < EQ.size(); i++) { + if (!(EQ.get(i) instanceof Ammunition)) { + Temp.add(EQ.get(i)); } } - weapons = new abPlaceable[Temp.size()]; - for( int i = 0; i < Temp.size(); i++ ) { - weapons[i] = (abPlaceable) Temp.get( i ); + weapons = new ArrayList(); + for (int i = 0; i < Temp.size(); i++) { + weapons.set(i, Temp.get(i)); } // initialize the next loop int numthistype = 1; - abPlaceable cur = weapons[0]; - weapons[0] = null; + abPlaceable cur = weapons.get(0); + weapons.set(0, null); // do we need to continue? - if( weapons.length <= 1 ) { - if( cur instanceof RangedWeapon ) { - if( ((RangedWeapon) cur).IsUsingFCS() ) { - Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.GetFluffName( CurVee, cur ) + " w/ " + ((abPlaceable) ((RangedWeapon) cur).GetFCS()).CritName() + NL; + if (weapons.size() <= 1) { + if (cur instanceof RangedWeapon) { + if (((RangedWeapon) cur).IsUsingFCS()) { + Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.GetFluffName(CurVee, cur) + " w/ " + + ((abPlaceable) ((RangedWeapon) cur).GetFCS()).CritName() + NL; } else { - Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.GetFluffName( CurVee, cur ) + NL; + Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.GetFluffName(CurVee, cur) + NL; } } else { - if( cur instanceof Equipment ) { - if( ((Equipment) cur).IsVariableSize() ) { + if (cur instanceof Equipment) { + if (((Equipment) cur).IsVariableSize()) { Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + cur.CritName() + NL; } else { - Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.GetFluffName( CurVee, cur ) + NL; + Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.GetFluffName(CurVee, cur) + NL; } } else { - Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.GetFluffName( CurVee, cur ) + NL; + Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.GetFluffName(CurVee, cur) + NL; } } - if( CurVee.IsOmni() ) { - Armament += " " + ( CurVee.GetTonnage() - CurVee.GetCurrentTons() ) + " tons of pod space." + NL; + if (CurVee.IsOmni()) { + Armament += " " + (CurVee.GetTonnage() - CurVee.GetCurrentTons()) + " tons of pod space." + NL; } return Armament; } // count up individual weapons and build their string String plural = ""; - for( int i = 1; i <= weapons.length; i++ ) { + for (int i = 1; i <= weapons.size(); i++) { // find any other weapons of this type - for( int j = 0; j < weapons.length; j++ ) { - if( weapons[j] != null ) { - if( cur instanceof Equipment ) { - if( ((Equipment) cur).IsVariableSize() ) { - if( weapons[j].CritName().equals( cur.CritName() ) && weapons[j].GetManufacturer().equals( cur.GetManufacturer() ) ) { + for (int j = 0; j < weapons.size(); j++) { + if (weapons.get(j) != null) { + if (cur instanceof Equipment) { + if (((Equipment) cur).IsVariableSize()) { + if (weapons.get(j).CritName().equals(cur.CritName()) + && weapons.get(j).GetManufacturer().equals(cur.GetManufacturer())) { numthistype++; - weapons[j] = null; + weapons.set(j, null); } } else { - if( FileCommon.LookupStripArc( weapons[j].LookupName() ).equals( FileCommon.LookupStripArc( cur.LookupName() ) ) && weapons[j].GetManufacturer().equals( cur.GetManufacturer() ) ) { + if (FileCommon.LookupStripArc(weapons.get(j).LookupName()) + .equals(FileCommon.LookupStripArc(cur.LookupName())) + && weapons.get(j).GetManufacturer().equals(cur.GetManufacturer())) { numthistype++; - weapons[j] = null; + weapons.set(j, null); } } } else { - if( FileCommon.LookupStripArc( weapons[j].LookupName() ).equals( FileCommon.LookupStripArc( cur.LookupName() ) ) && weapons[j].GetManufacturer().equals( cur.GetManufacturer() ) ) { + if (FileCommon.LookupStripArc(weapons.get(j).LookupName()) + .equals(FileCommon.LookupStripArc(cur.LookupName())) + && weapons.get(j).GetManufacturer().equals(cur.GetManufacturer())) { numthistype++; - weapons[j] = null; + weapons.set(j, null); } } } } // add the current weapon to the armament string - if( numthistype > 1 ) { + if (numthistype > 1) { plural = "s"; } else { plural = ""; } - if( cur instanceof RangedWeapon ) { - if( CurVee.GetLoadout().GetTechBase() == AvailableCode.TECH_BOTH ) { - if( ((RangedWeapon) cur).IsUsingFCS() ) { - Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.LookupStripArc( cur.LookupName() ) + plural + " w/ " + ((abPlaceable) ((RangedWeapon) cur).GetFCS()).LookupName() + NL; + if (cur instanceof RangedWeapon) { + if (CurVee.GetLoadout().GetTechBase() == AvailableCode.TECH_BOTH) { + if (((RangedWeapon) cur).IsUsingFCS()) { + Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.LookupStripArc(cur.LookupName()) + plural + " w/ " + + ((abPlaceable) ((RangedWeapon) cur).GetFCS()).LookupName() + NL; } else { - Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.LookupStripArc( cur.LookupName() ) + plural + NL; + Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.LookupStripArc(cur.LookupName()) + plural + NL; } } else { - if( ((RangedWeapon) cur).IsUsingFCS() ) { - Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.LookupStripArc( cur.CritName() ) + plural + " w/ " + ((abPlaceable) ((RangedWeapon) cur).GetFCS()).CritName() + NL; + if (((RangedWeapon) cur).IsUsingFCS()) { + Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.LookupStripArc(cur.CritName()) + plural + " w/ " + + ((abPlaceable) ((RangedWeapon) cur).GetFCS()).CritName() + NL; } else { - Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.LookupStripArc( cur.CritName() ) + plural + NL; + Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.LookupStripArc(cur.CritName()) + plural + NL; } } } else { - if( CurVee.GetLoadout().GetTechBase() == AvailableCode.TECH_BOTH ) { - if( cur instanceof Equipment ) { - if( ((Equipment) cur).IsVariableSize() ) { + if (CurVee.GetLoadout().GetTechBase() == AvailableCode.TECH_BOTH) { + if (cur instanceof Equipment) { + if (((Equipment) cur).IsVariableSize()) { Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + cur.CritName() + NL; } else { - Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.LookupStripArc( cur.LookupName() ) + plural + NL; + Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.LookupStripArc(cur.LookupName()) + plural + NL; } } else { - Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.LookupStripArc( cur.LookupName() ) + plural + NL; + Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.LookupStripArc(cur.LookupName()) + plural + NL; } } else { - Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.LookupStripArc( cur.CritName() ) + plural + NL; + Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.LookupStripArc(cur.CritName()) + plural + NL; } } // find the next weapon type and set it to current cur = null; numthistype = 0; - for( int j = 0; j < weapons.length; j++ ) { - if( weapons[j] != null ) { - cur = weapons[j]; - weapons[j] = null; + for (int j = 0; j < weapons.size(); j++) { + if (weapons.get(j) != null) { + cur = weapons.get(j); + weapons.set(j, null); numthistype = 1; break; } } // do we need to continue? - if( cur == null ) { break; } + if (cur == null) { + break; + } } - if( CurVee.IsOmni() ) { - Armament += " " + ( CurVee.GetTonnage() - CurVee.GetCurrentTons() ) + " tons of pod space." + NL; + if (CurVee.IsOmni()) { + Armament += " " + (CurVee.GetTonnage() - CurVee.GetCurrentTons()) + " tons of pod space." + NL; } // all done @@ -453,8 +527,8 @@ private String GetArmament() { private String GetHSType() { String retval = CurVee.GetHeatSinks().GetCurrentState().LookupName(); - if( CurVee.GetTechBase() == AvailableCode.TECH_BOTH ) { - if( CurVee.GetHeatSinks().GetTechBase() == AvailableCode.TECH_CLAN ) { + if (CurVee.GetTechBase() == AvailableCode.TECH_BOTH) { + if (CurVee.GetHeatSinks().GetTechBase() == AvailableCode.TECH_CLAN) { retval = "(CL) " + retval; } else { retval = "(IS) " + retval; @@ -465,7 +539,7 @@ private String GetHSType() { private String GetHSNum() { // provides a formated heat sink dissipation string - if( CurVee.GetHeatSinks().IsDouble() ) { + if (CurVee.GetHeatSinks().IsDouble()) { return CurVee.GetHeatSinks().GetNumHS() + "(" + CurVee.GetHeatSinks().TotalDissipation() + ")"; } else { return "" + CurVee.GetHeatSinks().GetNumHS(); @@ -474,67 +548,71 @@ private String GetHSNum() { private String BuildEquipmentBlock() { // this routine builds the big equipment block at the bottom of the file -// String retval = "Equipment Location Critical Mass " + NL; + // String retval = "Equipment Location Critical Mass " + NL; String loc = ""; String crits = ""; ArrayList v = (ArrayList) CurVee.GetLoadout().GetNonCore().clone(); // add in MASC and the targeting computer if needed. - if( CurVee.GetPhysEnhance().IsMASC() ) { - v.add( CurVee.GetPhysEnhance() ); + if (CurVee.GetPhysEnhance().IsMASC()) { + v.add(CurVee.GetPhysEnhance()); } - if( CurVee.UsingTC() ) { - //don't add as we already have it in the Body - //v.add( CurVee.GetTC() ); + if (CurVee.UsingTC()) { + // don't add as we already have it in the Body + // v.add( CurVee.GetTC() ); } - if( CurVee.GetLoadout().HasSupercharger() ) { - v.add( CurVee.GetLoadout().GetSupercharger() ); + if (CurVee.GetLoadout().HasSupercharger()) { + v.add(CurVee.GetLoadout().GetSupercharger()); } - if( v.size() < 1 ) { return ""; } + if (v.size() < 1) { + return ""; + } String retval = "================================================================================" + NL; retval += "Equipment Location Heat Spaces Mass " + NL; retval += "--------------------------------------------------------------------------------" + NL; // now sort the equipment by location - v = FileCommon.SortEquipmentForStats( CurVee, v ); + v = FileCommon.SortEquipmentForStats(CurVee, v); // turn the equipment into an array abPlaceable[] equips = new abPlaceable[v.size()]; - for( int i = 0; i < v.size(); i++ ) { - equips[i] = (abPlaceable) v.get( i ); + for (int i = 0; i < v.size(); i++) { + equips[i] = (abPlaceable) v.get(i); } // we'll want to consolidate equipment within locations. int numthisloc = 1; abPlaceable cur = equips[0]; equips[0] = null; -/* - if( equips.length <= 1 ) { - retval += ProcessEquipStatLines( cur, FileCommon.EncodeLocation( CurVee.GetLoadout().Find( cur ), CurVee.IsQuad() ), "" + cur.NumCVSpaces(), 1 ); - return retval; - } -*/ + /* + * if( equips.length <= 1 ) { retval += ProcessEquipStatLines( cur, + * FileCommon.EncodeLocation( CurVee.GetLoadout().Find( cur ), CurVee.IsQuad() + * ), "" + cur.NumCVSpaces(), 1 ); return retval; } + */ // count up individual weapons and build their string - for( int i = 1; i <= equips.length; i++ ) { + for (int i = 1; i <= equips.length; i++) { // find any other weapons of this type - int locint = CurVee.GetLoadout().Find( cur ); - for( int j = 0; j < equips.length; j++ ) { - if( equips[j] != null ) { - if( cur instanceof Equipment ) { - if( ((Equipment) cur).IsVariableSize() ) { - if( equips[j].CritName().equals( cur.CritName() ) && CurVee.GetLoadout().Find( equips[j] ) == locint ) { + int locint = CurVee.GetLoadout().Find(cur); + for (int j = 0; j < equips.length; j++) { + if (equips[j] != null) { + if (cur instanceof Equipment) { + if (((Equipment) cur).IsVariableSize()) { + if (equips[j].CritName().equals(cur.CritName()) + && CurVee.GetLoadout().Find(equips[j]) == locint) { numthisloc++; equips[j] = null; } } else { - if( equips[j].LookupName().equals( cur.LookupName() ) && CurVee.GetLoadout().Find( equips[j] ) == locint ) { + if (equips[j].LookupName().equals(cur.LookupName()) + && CurVee.GetLoadout().Find(equips[j]) == locint) { numthisloc++; equips[j] = null; } } } else { - if( equips[j].LookupName().equals( cur.LookupName() ) && CurVee.GetLoadout().Find( equips[j] ) == locint ) { + if (equips[j].LookupName().equals(cur.LookupName()) + && CurVee.GetLoadout().Find(equips[j]) == locint) { numthisloc++; equips[j] = null; } @@ -542,20 +620,20 @@ private String BuildEquipmentBlock() { } } - if( numthisloc > 1) { - crits = "" + ( cur.NumCVSpaces() * numthisloc ); + if (numthisloc > 1) { + crits = "" + (cur.NumCVSpaces() * numthisloc); } else { crits = "" + cur.NumCVSpaces(); } - loc = FileCommon.EncodeLocation( locint, CurVee.IsQuad(), common.CommonTools.Vehicle ); + loc = FileCommon.EncodeLocation(locint, CurVee.IsQuad(), common.CommonTools.Vehicle); // add the current weapon to the armament string - retval += ProcessEquipStatLines( cur, loc, crits, numthisloc ); + retval += ProcessEquipStatLines(cur, loc, crits, numthisloc); // find the next weapon type and set it to current cur = null; numthisloc = 0; - for( int j = 0; j < equips.length; j++ ) { - if( equips[j] != null ) { + for (int j = 0; j < equips.length; j++) { + if (equips[j] != null) { cur = equips[j]; equips[j] = null; numthisloc = 1; @@ -564,30 +642,39 @@ private String BuildEquipmentBlock() { } // do we need to continue? - if( cur == null ) { break; } + if (cur == null) { + break; + } } // add in any special systems boolean Special = false; - if( CurVee.HasBlueShield() ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, CurVee.GetBlueShield().CritName(), "*", "-", 7, 3.0 ) + NL; + if (CurVee.HasBlueShield()) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, CurVee.GetBlueShield().CritName(), "*", + "-", 7, 3.0) + NL; Special = true; } - if( Special ) { + if (Special) { retval += NL; } // add in the equipment footers if needed - if( CurVee.HasBlueShield() ) { - retval += "* The " + CurVee.GetBlueShield().LookupName() + " occupies 1 slot in every location except the HD." + NL; + if (CurVee.HasBlueShield()) { + retval += "* The " + CurVee.GetBlueShield().LookupName() + + " occupies 1 slot in every location except the HD." + NL; } - BattleForceStats bfs = new BattleForceStats( CurVee ); - int [] BFdmg = CurVee.GetBFDamage( bfs ); + BattleForceStats bfs = new BattleForceStats(CurVee); + int[] BFdmg = CurVee.GetBFDamage(bfs); retval += NL + "BattleForce Statistics" + NL; - retval += String.format( "MV S (+0) M (+2) L (+4) E (+6) Wt. Ov Armor: %1$2s Points: " + CurVee.GetBFPoints(), CurVee.GetBFArmor() ) + NL; - retval += String.format( "%1$-6s %2$2s %3$2s %4$2s %5$2s %6$1s %7$1s Structure: %8$2s", BattleForceTools.GetMovementString( CurVee ), BFdmg[BFConstants.BF_SHORT], BFdmg[BFConstants.BF_MEDIUM], BFdmg[BFConstants.BF_LONG], BFdmg[BFConstants.BF_EXTREME], CurVee.GetBFSize(), BFdmg[BFConstants.BF_OV], CurVee.GetBFStructure() ) + NL; + retval += String.format("MV S (+0) M (+2) L (+4) E (+6) Wt. Ov Armor: %1$2s Points: " + + CurVee.GetBFPoints(), CurVee.GetBFArmor()) + NL; + retval += String.format( + "%1$-6s %2$2s %3$2s %4$2s %5$2s %6$1s %7$1s Structure: %8$2s", + BattleForceTools.GetMovementString(CurVee), BFdmg[BFConstants.BF_SHORT], BFdmg[BFConstants.BF_MEDIUM], + BFdmg[BFConstants.BF_LONG], BFdmg[BFConstants.BF_EXTREME], CurVee.GetBFSize(), BFdmg[BFConstants.BF_OV], + CurVee.GetBFStructure()) + NL; retval += "Special Abilities: " + bfs.getAbilitiesString() + NL; return retval; @@ -600,99 +687,113 @@ private String BuildOmniLoadout() { String crits = ""; ArrayList v = (ArrayList) CurVee.GetLoadout().GetNonCore().clone(); - retval += String.format( "Loadout Name: %1$-46s Cost: %2$,.0f", CurVee.GetLoadout().GetName(), Math.floor( CurVee.GetTotalCost() + 0.5 ) ) + NL; - retval += String.format( "Tech Rating/Era Availability: %1$-31s BV2: %2$,d", CurVee.GetAvailability().GetBestCombinedCode(), CurVee.GetCurrentBV() ) + NL; - if( CurVee.GetBaseRulesLevel() != CurVee.GetLoadout().GetRulesLevel() ) { - if( CurVee.GetBaseTechbase() != CurVee.GetLoadout().GetTechBase() ) { - retval += String.format( "Rules Level: %1$-42s %2$s", CommonTools.GetRulesLevelString( CurVee.GetLoadout().GetRulesLevel() ), "Tech Base: " + CommonTools.GetTechbaseString( CurVee.GetLoadout().GetTechBase() ) ) + NL; + retval += String.format("Loadout Name: %1$-46s Cost: %2$,.0f", CurVee.GetLoadout().GetName(), + Math.floor(CurVee.GetTotalCost() + 0.5)) + NL; + retval += String.format("Tech Rating/Era Availability: %1$-31s BV2: %2$,d", + CurVee.GetAvailability().GetBestCombinedCode(), CurVee.GetCurrentBV()) + NL; + if (CurVee.GetBaseRulesLevel() != CurVee.GetLoadout().GetRulesLevel()) { + if (CurVee.GetBaseTechbase() != CurVee.GetLoadout().GetTechBase()) { + retval += String.format("Rules Level: %1$-42s %2$s", + CommonTools.GetRulesLevelString(CurVee.GetLoadout().GetRulesLevel()), + "Tech Base: " + CommonTools.GetTechbaseString(CurVee.GetLoadout().GetTechBase())) + NL; } else { - retval += "Rules Level: " + CommonTools.GetRulesLevelString( CurVee.GetLoadout().GetRulesLevel() ) + NL; + retval += "Rules Level: " + CommonTools.GetRulesLevelString(CurVee.GetLoadout().GetRulesLevel()) + NL; } } // build the starting block for the loadout information retval += NL + "Equipment Type Rating Mass " + NL; retval += "--------------------------------------------------------------------------------" + NL; - if( CurVee.GetJumpJets().GetNumJJ() > 0 ) { - if( CurVee.GetJumpJets().IsImproved() ) { + if (CurVee.GetJumpJets().GetNumJJ() > 0) { + if (CurVee.GetJumpJets().IsImproved()) { retval += " Jumping MP: " + CurVee.GetJumpJets().GetNumJJ() + " (Improved)" + NL; } else { - if( CurVee.GetJumpJets().IsUMU() ) { + if (CurVee.GetJumpJets().IsUMU()) { retval += " Jumping MP: " + CurVee.GetJumpJets().GetNumJJ() + " (UMU)" + NL; } else { retval += " Jumping MP: " + CurVee.GetJumpJets().GetNumJJ() + " (Standard)" + NL; } } } - if( CurVee.GetJumpJets().GetNumJJ() > 0 ) { - retval += String.format( " %1$-68s %2$6.2f", "Jump Jet Locations: " + FileCommon.GetJumpJetLocations( CurVee ), CurVee.GetJumpJets().GetOmniTonnage() ) + NL; + if (CurVee.GetJumpJets().GetNumJJ() > 0) { + retval += String.format(" %1$-68s %2$6.2f", + "Jump Jet Locations: " + FileCommon.GetJumpJetLocations(CurVee), + CurVee.GetJumpJets().GetOmniTonnage()) + NL; } - if( CurVee.GetHeatSinks().GetNumHS() > CurVee.GetHeatSinks().GetBaseLoadoutNumHS() ) { - retval += String.format( "Heat Sinks: %1$-28s %2$-8s %3" + tformat, GetHSType(), GetHSNum(), CurVee.GetHeatSinks().GetOmniTonnage() ) + NL; + if (CurVee.GetHeatSinks().GetNumHS() > CurVee.GetHeatSinks().GetBaseLoadoutNumHS()) { + retval += String.format("Heat Sinks: %1$-28s %2$-8s %3" + tformat, GetHSType(), + GetHSNum(), CurVee.GetHeatSinks().GetOmniTonnage()) + NL; } - if( ! CurVee.GetEngine().IsNuclear() ) { - if( CurVee.GetLoadout().GetPowerAmplifier().GetTonnage() > 0 ) { - retval += String.format( "%1$-72s %2" + tformat, "Power Amplifiers:", CurVee.GetLoadout().GetPowerAmplifier().GetTonnage() ) + NL; + if (!CurVee.GetEngine().IsNuclear()) { + if (CurVee.GetLoadout().GetPowerAmplifier().GetTonnage() > 0) { + retval += String.format("%1$-72s %2" + tformat, "Power Amplifiers:", + CurVee.GetLoadout().GetPowerAmplifier().GetTonnage()) + NL; } } // add in MASC and the targeting computer if needed. - if( CurVee.GetPhysEnhance().IsMASC() ) { - v.add( CurVee.GetPhysEnhance() ); + if (CurVee.GetPhysEnhance().IsMASC()) { + v.add(CurVee.GetPhysEnhance()); } - if( CurVee.UsingTC() ) { - //don't add as we already have it in the Body of the Vehicle - //v.add( CurVee.GetTC() ); + if (CurVee.UsingTC()) { + // don't add as we already have it in the Body of the Vehicle + // v.add( CurVee.GetTC() ); } - if( CurVee.GetLoadout().HasSupercharger() ) { - v.add( CurVee.GetLoadout().GetSupercharger() ); + if (CurVee.GetLoadout().HasSupercharger()) { + v.add(CurVee.GetLoadout().GetSupercharger()); } // now sort the equipment by location - v = FileCommon.SortEquipmentForStats( CurVee, v ); + v = FileCommon.SortEquipmentForStats(CurVee, v); // turn the equipment into an array abPlaceable[] equips = new abPlaceable[v.size()]; - for( int i = 0; i < v.size(); i++ ) { - equips[i] = (abPlaceable) v.get( i ); + for (int i = 0; i < v.size(); i++) { + equips[i] = (abPlaceable) v.get(i); } // the basic equipment block header retval += NL + "Equipment Location Heat Spaces Mass " + NL; retval += "--------------------------------------------------------------------------------" + NL; - if( equips.length < 1 ) { return retval; } + if (equips.length < 1) { + return retval; + } // we'll want to consolidate equipment within locations. int numthisloc = 1; abPlaceable cur = equips[0]; equips[0] = null; - if( equips.length <= 1 ) { - retval += ProcessEquipStatLines( cur, FileCommon.EncodeLocation( CurVee.GetLoadout().Find( cur ), CurVee.IsQuad(), common.CommonTools.Vehicle ), "" + cur.NumCVSpaces(), 1 ); + if (equips.length <= 1) { + retval += ProcessEquipStatLines(cur, FileCommon.EncodeLocation(CurVee.GetLoadout().Find(cur), + CurVee.IsQuad(), common.CommonTools.Vehicle), "" + cur.NumCVSpaces(), 1); return retval; } // count up individual weapons and build their string - for( int i = 1; i <= equips.length; i++ ) { + for (int i = 1; i <= equips.length; i++) { // find any other weapons of this type - int locint = CurVee.GetLoadout().Find( cur ); - for( int j = 0; j < equips.length; j++ ) { - if( equips[j] != null ) { - if( cur instanceof Equipment ) { - if( ((Equipment) cur).IsVariableSize() ) { - if( equips[j].CritName().equals( cur.CritName() ) && CurVee.GetLoadout().Find( equips[j] ) == locint ) { + int locint = CurVee.GetLoadout().Find(cur); + for (int j = 0; j < equips.length; j++) { + if (equips[j] != null) { + if (cur instanceof Equipment) { + if (((Equipment) cur).IsVariableSize()) { + if (equips[j].CritName().equals(cur.CritName()) + && CurVee.GetLoadout().Find(equips[j]) == locint) { numthisloc++; equips[j] = null; } } else { - if( equips[j].LookupName().equals( cur.LookupName() ) && CurVee.GetLoadout().Find( equips[j] ) == locint ) { + if (equips[j].LookupName().equals(cur.LookupName()) + && CurVee.GetLoadout().Find(equips[j]) == locint) { numthisloc++; equips[j] = null; } } } else { - if( equips[j].LookupName().equals( cur.LookupName() ) && CurVee.GetLoadout().Find( equips[j] ) == locint ) { + if (equips[j].LookupName().equals(cur.LookupName()) + && CurVee.GetLoadout().Find(equips[j]) == locint) { numthisloc++; equips[j] = null; } @@ -700,20 +801,20 @@ private String BuildOmniLoadout() { } } - if( numthisloc > 1) { - crits = "" + ( cur.NumCVSpaces() * numthisloc ); + if (numthisloc > 1) { + crits = "" + (cur.NumCVSpaces() * numthisloc); } else { crits = "" + cur.NumCVSpaces(); } - loc = FileCommon.EncodeLocation( locint, CurVee.IsQuad(), common.CommonTools.Vehicle ); + loc = FileCommon.EncodeLocation(locint, CurVee.IsQuad(), common.CommonTools.Vehicle); // add the current weapon to the armament string - retval += ProcessEquipStatLines( cur, loc, crits, numthisloc ); + retval += ProcessEquipStatLines(cur, loc, crits, numthisloc); // find the next weapon type and set it to current cur = null; numthisloc = 0; - for( int j = 0; j < equips.length; j++ ) { - if( equips[j] != null ) { + for (int j = 0; j < equips.length; j++) { + if (equips[j] != null) { cur = equips[j]; equips[j] = null; numthisloc = 1; @@ -722,14 +823,21 @@ private String BuildOmniLoadout() { } // do we need to continue? - if( cur == null ) { break; } + if (cur == null) { + break; + } } - BattleForceStats bfs = new BattleForceStats( CurVee ); - int [] BFdmg = CurVee.GetBFDamage( bfs ); + BattleForceStats bfs = new BattleForceStats(CurVee); + int[] BFdmg = CurVee.GetBFDamage(bfs); retval += NL + "BattleForce Statistics" + NL; - retval += String.format( "MV S (+0) M (+2) L (+4) E (+6) Wt. Ov Armor: %1$2s Points: " + CurVee.GetBFPoints(), CurVee.GetBFArmor() ) + NL; - retval += String.format( "%1$-6s %2$2s %3$2s %4$2s %5$2s %6$1s %7$1s Structure: %8$2s", BattleForceTools.GetMovementString( CurVee ), BFdmg[BFConstants.BF_SHORT], BFdmg[BFConstants.BF_MEDIUM], BFdmg[BFConstants.BF_LONG], BFdmg[BFConstants.BF_EXTREME], CurVee.GetBFSize(), BFdmg[BFConstants.BF_OV], CurVee.GetBFStructure() ) + NL; + retval += String.format("MV S (+0) M (+2) L (+4) E (+6) Wt. Ov Armor: %1$2s Points: " + + CurVee.GetBFPoints(), CurVee.GetBFArmor()) + NL; + retval += String.format( + "%1$-6s %2$2s %3$2s %4$2s %5$2s %6$1s %7$1s Structure: %8$2s", + BattleForceTools.GetMovementString(CurVee), BFdmg[BFConstants.BF_SHORT], BFdmg[BFConstants.BF_MEDIUM], + BFdmg[BFConstants.BF_LONG], BFdmg[BFConstants.BF_EXTREME], CurVee.GetBFSize(), BFdmg[BFConstants.BF_OV], + CurVee.GetBFStructure()) + NL; retval += "Special Abilities: " + bfs.getAbilitiesString() + NL; return retval; @@ -737,126 +845,124 @@ private String BuildOmniLoadout() { private String BuildComputerBlock() { String retval = ""; -/* - abPlaceable ECM = FileCommon.HasECM( CurVee ); - abPlaceable BAP = FileCommon.HasBAP( CurVee ); - Object[] C3 = FileCommon.HasC3( CurVee ); -*/ + /* + * abPlaceable ECM = FileCommon.HasECM( CurVee ); abPlaceable BAP = + * FileCommon.HasBAP( CurVee ); Object[] C3 = FileCommon.HasC3( CurVee ); + */ // start communications system line retval += "Communications System: " + CurVee.GetCommSystem() + NL; -/* - if( ! ( ECM instanceof EmptyItem ) ) { - retval += NL + " w/ " + ECM.GetManufacturer() + " " + ECM.GetCritName(); - if( C3 != null ) { - for( int i = 0; i < C3.length; i++ ) { - retval += NL + " and " + ((abPlaceable) C3[i]).GetManufacturer() + " " + ((abPlaceable) C3[i]).GetCritName(); - } - } - } else { - if( C3 != null ) { - for( int i = 0; i < C3.length; i++ ) { - if( i == 0 ) { - retval += NL + " w/ " + ((abPlaceable) C3[i]).GetManufacturer() + " " + ((abPlaceable) C3[i]).GetCritName(); - } else { - retval += NL + " and " + ((abPlaceable) C3[i]).GetManufacturer() + " " + ((abPlaceable) C3[i]).GetCritName(); - } - } - } - } - retval += NL; -*/ + /* + * if( ! ( ECM instanceof EmptyItem ) ) { retval += NL + " w/ " + + * ECM.GetManufacturer() + " " + ECM.GetCritName(); if( C3 != null ) { for( int + * i = 0; i < C3.length; i++ ) { retval += NL + " and " + ((abPlaceable) + * C3[i]).GetManufacturer() + " " + ((abPlaceable) C3[i]).GetCritName(); } } } + * else { if( C3 != null ) { for( int i = 0; i < C3.length; i++ ) { if( i == 0 ) + * { retval += NL + " w/ " + ((abPlaceable) C3[i]).GetManufacturer() + " " + + * ((abPlaceable) C3[i]).GetCritName(); } else { retval += NL + " and " + + * ((abPlaceable) C3[i]).GetManufacturer() + " " + ((abPlaceable) + * C3[i]).GetCritName(); } } } } retval += NL; + */ // start targeting and tracking system line retval += "Targeting and Tracking System: " + CurVee.GetTandTSystem(); -/* if( ! ( BAP instanceof EmptyItem ) ) { - if( CurVee.UsingTC() ) { - retval += NL + " w/ " + BAP.GetManufacturer() + " " + BAP.GetCritName() + NL + " and " + CurVee.GetTC().GetCritName(); - } else { - retval += NL + " w/ " + BAP.GetManufacturer() + " " + BAP.GetCritName(); - } - } else { - if( CurVee.UsingTC() ) { - retval += NL + " w/ " + CurVee.GetTC().GetCritName(); - } - } -*/ + /* + * if( ! ( BAP instanceof EmptyItem ) ) { if( CurVee.UsingTC() ) { retval += NL + * + " w/ " + BAP.GetManufacturer() + " " + BAP.GetCritName() + NL + + * " and " + CurVee.GetTC().GetCritName(); } else { retval += NL + " w/ " + * + BAP.GetManufacturer() + " " + BAP.GetCritName(); } } else { if( + * CurVee.UsingTC() ) { retval += NL + " w/ " + CurVee.GetTC().GetCritName(); + * } } + */ return retval; } - private String ProcessEquipStatLines( abPlaceable p, String loc, String crits, int numthisloc ) { + private String ProcessEquipStatLines(abPlaceable p, String loc, String crits, int numthisloc) { String retval = ""; - String name = FileCommon.GetExportName( CurVee, p ); - if( numthisloc > 1 ) { + String name = FileCommon.GetExportName(CurVee, p); + if (numthisloc > 1) { name = numthisloc + " " + name + "s"; } // build the string based on the type of equipment - if( p instanceof Ammunition ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, FileCommon.FormatAmmoExportName( (Ammunition) p, numthisloc ), loc, "-", crits, p.GetTonnage() * numthisloc ) + NL; - } else if( p instanceof RangedWeapon ) { + if (p instanceof Ammunition) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, + FileCommon.FormatAmmoExportName((Ammunition) p, numthisloc), loc, "-", crits, + p.GetTonnage() * numthisloc) + NL; + } else if (p instanceof RangedWeapon) { double tons = p.GetTonnage(); String add = ""; - if( ((RangedWeapon) p).IsUsingFCS() ) { + if (((RangedWeapon) p).IsUsingFCS()) { abPlaceable a = (abPlaceable) ((RangedWeapon) p).GetFCS(); tons -= a.GetTonnage(); - add += String.format( " %1$-40s %2$-9s %3$-9s %4$-7s %5" + tformat, FileCommon.GetExportName( CurVee, a ), loc, "-", a.NumCVSpaces() * numthisloc, a.GetTonnage() * numthisloc ) + NL; + add += String.format(" %1$-40s %2$-9s %3$-9s %4$-7s %5" + tformat, + FileCommon.GetExportName(CurVee, a), loc, "-", a.NumCVSpaces() * numthisloc, + a.GetTonnage() * numthisloc) + NL; } - if( ((RangedWeapon) p).IsUsingCapacitor() ) { + if (((RangedWeapon) p).IsUsingCapacitor()) { tons -= 1.0f; abPlaceable a = ((RangedWeapon) p).GetCapacitor(); - add += String.format( " %1$-40s %2$-9s %3$-9s %4$-7s %5" + tformat, FileCommon.GetExportName( CurVee, p ), loc, numthisloc * 5 + "*", a.NumCVSpaces(), a.GetTonnage() * numthisloc ) + NL; + add += String.format(" %1$-40s %2$-9s %3$-9s %4$-7s %5" + tformat, + FileCommon.GetExportName(CurVee, p), loc, numthisloc * 5 + "*", a.NumCVSpaces(), + a.GetTonnage() * numthisloc) + NL; } - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, name, loc, ((RangedWeapon) p).GetHeat() * numthisloc, crits, tons * numthisloc ) + NL + add; - } else if( p instanceof MGArray ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, name, loc, "-", crits, ((MGArray) p).GetBaseTons() ) + NL; + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, name, loc, + ((RangedWeapon) p).GetHeat() * numthisloc, crits, tons * numthisloc) + NL + add; + } else if (p instanceof MGArray) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, name, loc, "-", crits, + ((MGArray) p).GetBaseTons()) + NL; abPlaceable a = ((MGArray) p).GetMGType(); - retval += String.format( " %1$-40s %2$-9s %3$-9s %4$-7s %5" + tformat, ((MGArray) p).GetNumMGs() + " " + FileCommon.GetExportName( CurVee, a ) + "s", loc, ((RangedWeapon) a).GetHeat() * ((MGArray) p).GetNumMGs(), ((MGArray) p).GetNumMGs(), ( ((MGArray) p).GetMGTons() * ((MGArray) p).GetNumMGs() ) ) + NL; - } else if( p instanceof Equipment ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, name, loc, ((Equipment) p).GetHeat() * numthisloc, crits, p.GetTonnage() * numthisloc ) + NL; + retval += String.format(" %1$-40s %2$-9s %3$-9s %4$-7s %5" + tformat, + ((MGArray) p).GetNumMGs() + " " + FileCommon.GetExportName(CurVee, a) + "s", loc, + ((RangedWeapon) a).GetHeat() * ((MGArray) p).GetNumMGs(), ((MGArray) p).GetNumMGs(), + (((MGArray) p).GetMGTons() * ((MGArray) p).GetNumMGs())) + NL; + } else if (p instanceof Equipment) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, name, loc, + ((Equipment) p).GetHeat() * numthisloc, crits, p.GetTonnage() * numthisloc) + NL; } else { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, name, loc, "-", crits, p.GetTonnage() * numthisloc ) + NL; + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, name, loc, "-", crits, + p.GetTonnage() * numthisloc) + NL; } return retval; } - private String FormatFluff( String s ) { + private String FormatFluff(String s) { // we're basically checking length here to limit it to 80 chars in length // first, seperate out all the newlines. - s = s.replaceAll( "\n\r", "\n" ); - s = s.replace( " ", "" ); - s = s.replace( " ", "" ); - s = s.replace( "

", "" ); - s = s.replaceAll( "\t", " " ); - s = s.replace( "

", "\n" ); - String[] newline = s.split( "\n" ); + s = s.replaceAll("\n\r", "\n"); + s = s.replace(" ", ""); + s = s.replace(" ", ""); + s = s.replace("

", ""); + s = s.replaceAll("\t", " "); + s = s.replace("

", "\n"); + String[] newline = s.split("\n"); String retval = ""; - for( int i = 0; i < newline.length; i++ ) { - String[] temp = wrapText( newline[i], 80 ); + for (int i = 0; i < newline.length; i++) { + String[] temp = wrapText(newline[i], 80); // put the string back together - for( int j = 0; j < temp.length; j++ ) { + for (int j = 0; j < temp.length; j++) { retval += temp[j] + NL; } } return retval; } - static String [] wrapText (String text, int len) { + static String[] wrapText(String text, int len) { // return empty array for null text if (text == null) - return new String [] {}; + return new String[] {}; // return text if len is zero or less if (len <= 0) - return new String [] {text}; + return new String[] { text }; // return text if less than length if (text.length() <= len) - return new String [] {text}; + return new String[] { text }; // before the wrapping, replace any special characters - text = text.replace( "\t", " " ); + text = text.replace("\t", " "); - char [] chars = text.toCharArray(); + char[] chars = text.toCharArray(); ArrayList lines = new ArrayList(); StringBuffer line = new StringBuffer(); StringBuffer word = new StringBuffer(); @@ -889,10 +995,10 @@ private String FormatFluff( String s ) { lines.add(line.toString()); } - String [] ret = new String[lines.size()]; + String[] ret = new String[lines.size()]; int c = 0; // counter Iterator itr = lines.iterator(); - while(itr.hasNext()) { + while (itr.hasNext()) { ret[c] = (String) itr.next(); c++; } @@ -901,7 +1007,7 @@ private String FormatFluff( String s ) { } private String GetJumpJetDistanceLine() { - String retval = ( CurVee.GetJumpJets().GetNumJJ() * 30 ) + " meters"; + String retval = (CurVee.GetJumpJets().GetNumJJ() * 30) + " meters"; return retval; } @@ -912,15 +1018,15 @@ private String GetJumpingMPLine() { private String GetJumpJetTypeLine() { String retval = ""; - if( CurVee.GetJumpJets().GetNumJJ() <= 0 ) { + if (CurVee.GetJumpJets().GetNumJJ() <= 0) { retval = ""; } else { - if( CurVee.GetJumpJets().IsImproved() ) { + if (CurVee.GetJumpJets().IsImproved()) { retval = "Improved"; } else { - if( CurVee.GetJumpJets().IsUMU() ) { + if (CurVee.GetJumpJets().IsUMU()) { retval = "UMU"; - } else{ + } else { retval = "Standard"; } } @@ -928,92 +1034,101 @@ private String GetJumpJetTypeLine() { return retval; } - public void WriteList(String filename, Scenario scenario) throws IOException { - if ( !filename.endsWith(".csv") ) { filename += ".csv"; } - BufferedWriter FR = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ); - - FR.write( CSVFormat("unit_type") ); - FR.write( CSVFormat("sub_unit_type") ); - FR.write( CSVFormat("unit_name") ); - FR.write( CSVFormat("model_number") ); - FR.write( CSVFormat("tonnage") ); - FR.write( CSVFormat("bv2") ); - FR.write( CSVFormat("tw rules_level") ); - FR.write( CSVFormat("technology base") ); - FR.write( CSVFormat("source") ); - FR.write( CSVFormat("date") ); - FR.write( CSVFormat("era") ); - FR.write( "PV,Wt,MV,S,M,L,E,OV,Armor,Internal,Special Abilities" ); + if (!filename.endsWith(".csv")) { + filename += ".csv"; + } + BufferedWriter FR = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")); + + FR.write(CSVFormat("unit_type")); + FR.write(CSVFormat("sub_unit_type")); + FR.write(CSVFormat("unit_name")); + FR.write(CSVFormat("model_number")); + FR.write(CSVFormat("tonnage")); + FR.write(CSVFormat("bv2")); + FR.write(CSVFormat("tw rules_level")); + FR.write(CSVFormat("technology base")); + FR.write(CSVFormat("source")); + FR.write(CSVFormat("date")); + FR.write(CSVFormat("era")); + FR.write("PV,Wt,MV,S,M,L,E,OV,Armor,Internal,Special Abilities"); FR.newLine(); String datum = ""; - for ( Unit u : scenario.getUnits() ) { - FR.write( CSVFormat(CommonTools.UnitTypes[u.UnitType]) ); + for (Unit u : scenario.getUnits()) { + FR.write(CSVFormat(CommonTools.UnitTypes[u.UnitType])); datum = "Combat Vehicle"; - if ( u.IsOmni() ) { datum = "OmniVehicle"; } - FR.write( CSVFormat(datum) ); - FR.write( CSVFormat(u.Name )); - FR.write( CSVFormat((u.Model + " " + u.Configuration).trim()) ); - FR.write( CSVFormat(u.Tonnage+"") ); - FR.write( CSVFormat(u.BaseBV+"") ); - FR.write( CSVFormat("") ); - FR.write( CSVFormat("") ); - FR.write( CSVFormat("") ); - FR.write( CSVFormat("") ); - FR.write( CSVFormat("") ); - FR.write( u.getBFStats().SerializeCSV( false ) ); + if (u.IsOmni()) { + datum = "OmniVehicle"; + } + FR.write(CSVFormat(datum)); + FR.write(CSVFormat(u.Name)); + FR.write(CSVFormat((u.Model + " " + u.Configuration).trim())); + FR.write(CSVFormat(u.Tonnage + "")); + FR.write(CSVFormat(u.BaseBV + "")); + FR.write(CSVFormat("")); + FR.write(CSVFormat("")); + FR.write(CSVFormat("")); + FR.write(CSVFormat("")); + FR.write(CSVFormat("")); + FR.write(u.getBFStats().SerializeCSV(false)); FR.newLine(); } FR.close(); } public void WriteList(String filename, UnitList list) throws IOException { - if ( !filename.endsWith(".csv") ) { filename += ".csv"; } - BufferedWriter FR = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ); - - FR.write( CSVFormat("unit_type") ); - FR.write( CSVFormat("sub_unit_type") ); - FR.write( CSVFormat("unit_name") ); - FR.write( CSVFormat("model_number") ); - FR.write( CSVFormat("tonnage") ); - FR.write( CSVFormat("bv2") ); - FR.write( CSVFormat("tw rules_level") ); - FR.write( CSVFormat("technology base") ); - FR.write( CSVFormat("source") ); - FR.write( CSVFormat("date") ); - FR.write( CSVFormat("era") ); - FR.write( CSVFormat("cost") ); - FR.write( "PV,Wt,MV,S,M,L,E,OV,Armor,Internal,Special Abilities" ); + if (!filename.endsWith(".csv")) { + filename += ".csv"; + } + BufferedWriter FR = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")); + + FR.write(CSVFormat("unit_type")); + FR.write(CSVFormat("sub_unit_type")); + FR.write(CSVFormat("unit_name")); + FR.write(CSVFormat("model_number")); + FR.write(CSVFormat("tonnage")); + FR.write(CSVFormat("bv2")); + FR.write(CSVFormat("tw rules_level")); + FR.write(CSVFormat("technology base")); + FR.write(CSVFormat("source")); + FR.write(CSVFormat("date")); + FR.write(CSVFormat("era")); + FR.write(CSVFormat("cost")); + FR.write("PV,Wt,MV,S,M,L,E,OV,Armor,Internal,Special Abilities"); FR.newLine(); String datum = ""; - for (int i=0; i < list.Size(); i++) { + for (int i = 0; i < list.Size(); i++) { UnitListData data = (UnitListData) list.Get(i); - FR.write( CSVFormat("Combat Vehicle") ); + FR.write(CSVFormat("Combat Vehicle")); datum = "Combat Vehicle"; - if ( data.isOmni() ) { datum = "OmniVehicle"; } - FR.write( CSVFormat(datum) ); - FR.write( CSVFormat(data.getName()) ); - FR.write( CSVFormat((data.getModel() + " " + data.getConfig()).trim()) ); - FR.write( CSVFormat(data.getTonnage()+"") ); - FR.write( CSVFormat(data.getBV()+"") ); - FR.write( CSVFormat(data.getLevel()) ); - FR.write( CSVFormat(data.getTech()) ); - FR.write( CSVFormat(data.getSource()) ); - FR.write( CSVFormat(data.getYear()+"") ); - FR.write( CSVFormat(data.getEra()) ); - FR.write( CSVFormat(data.getCost()+"") ); - FR.write( data.getBattleForceStats().SerializeCSV( false ) ); + if (data.isOmni()) { + datum = "OmniVehicle"; + } + FR.write(CSVFormat(datum)); + FR.write(CSVFormat(data.getName())); + FR.write(CSVFormat((data.getModel() + " " + data.getConfig()).trim())); + FR.write(CSVFormat(data.getTonnage() + "")); + FR.write(CSVFormat(data.getBV() + "")); + FR.write(CSVFormat(data.getLevel())); + FR.write(CSVFormat(data.getTech())); + FR.write(CSVFormat(data.getSource())); + FR.write(CSVFormat(data.getYear() + "")); + FR.write(CSVFormat(data.getEra())); + FR.write(CSVFormat(data.getCost() + "")); + FR.write(data.getBattleForceStats().SerializeCSV(false)); FR.newLine(); } FR.close(); } - public void WriteCost( Mech m, String filename ) throws IOException { + public void WriteCost(Mech m, String filename) throws IOException { filename += m.GetFullName(); - if ( !filename.endsWith(".txt") ) { filename += ".txt"; } - BufferedWriter FR = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ); + if (!filename.endsWith(".txt")) { + filename += ".txt"; + } + BufferedWriter FR = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")); CostBVBreakdown cost = new CostBVBreakdown(m); FR.write(cost.Render()); @@ -1021,59 +1136,67 @@ public void WriteCost( Mech m, String filename ) throws IOException { } public void WriteBFList(String filename, UnitList list) throws IOException { - if ( !filename.endsWith(".csv") ) { filename += ".csv"; } - BufferedWriter FR = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ); + if (!filename.endsWith(".csv")) { + filename += ".csv"; + } + BufferedWriter FR = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")); String message = ""; FR.write("Element,PV,Wt,MV,S,M,L,E,OV,Armor,Internal,Special Abilities"); FR.newLine(); - for ( UnitListData mech : list.getList() ) { - FR.write(mech.getBattleForceStats().SerializeCSV( true )); + for (UnitListData mech : list.getList()) { + FR.write(mech.getBattleForceStats().SerializeCSV(true)); FR.newLine(); } FR.close(); - if ( !message.isEmpty() ) { + if (!message.isEmpty()) { Media.Messager("Could not write out the following:\n" + message); } } public void WriteBFList(String filename, Scenario scenario) throws IOException { - if ( !filename.endsWith(".csv") ) { filename += ".csv"; } - BufferedWriter FR = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ); + if (!filename.endsWith(".csv")) { + filename += ".csv"; + } + BufferedWriter FR = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")); - String message = "", force= "", group = ""; + String message = "", force = "", group = ""; FR.write("Force,Group,Element,PV,Wt,MV,S,M,L,E,OV,Armor,Internal,Special Abilities"); FR.newLine(); - for ( Force f : scenario.getForces() ) { + for (Force f : scenario.getForces()) { force = f.ForceName; - for ( Unit u : f.getUnits() ) { + for (Unit u : f.getUnits()) { group = u.getGroup(); - FR.write(CSVFormat(force) + CSVFormat(group) + u.getBFStats().SerializeCSV( true )); + FR.write(CSVFormat(force) + CSVFormat(group) + u.getBFStats().SerializeCSV(true)); FR.newLine(); } } FR.close(); - if ( !message.isEmpty() ) { + if (!message.isEmpty()) { Media.Messager("Could not write out the following:\n" + message); } } - public void WriteFactorList(String filename, Scenario scenario ) throws IOException { - if ( !filename.endsWith(".csv") ) { filename += ".csv"; } - BufferedWriter FR = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ); + public void WriteFactorList(String filename, Scenario scenario) throws IOException { + if (!filename.endsWith(".csv")) { + filename += ".csv"; + } + BufferedWriter FR = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")); String message = ""; FR.write("Unit,Type,Prb,ECM,Spd,Jmp,TSM,Phys,Armr,TC,8+,10+,Hd Cap,Tot Dmg,Base BV, Adj BV"); FR.newLine(); - for ( Force f : scenario.getForces() ) { - if ( !f.ForceName.isEmpty()) {FR.write(f.ForceName);} - for ( Group g : f.Groups ) { + for (Force f : scenario.getForces()) { + if (!f.ForceName.isEmpty()) { + FR.write(f.ForceName); + } + for (Group g : f.Groups) { FR.newLine(); - for ( Unit u : g.getUnits() ) { + for (Unit u : g.getUnits()) { FR.write(u.SerializeFactors()); FR.newLine(); } @@ -1085,14 +1208,14 @@ public void WriteFactorList(String filename, Scenario scenario ) throws IOExcept FR.close(); - if ( !message.isEmpty() ) { + if (!message.isEmpty()) { Media.Messager("Could not write out the following:\n" + message); } } - public String CSVFormat( String data ) { - if ( data.contains(",") ) + public String CSVFormat(String data) { + if (data.contains(",")) return "\"" + data + "\","; else return data + ","; diff --git a/sswlib/src/main/java/filehandlers/TXTWriter.java b/sswlib/src/main/java/filehandlers/TXTWriter.java index 0f9db93d..fc9108ac 100644 --- a/sswlib/src/main/java/filehandlers/TXTWriter.java +++ b/sswlib/src/main/java/filehandlers/TXTWriter.java @@ -49,33 +49,34 @@ public class TXTWriter { private Mech CurMech; - private String NL, - tformat = "$6.2f"; + private String NL, tformat = "$6.2f"; private ArrayList forces; public boolean CurrentLoadoutOnly = false; public TXTWriter() { - NL = System.getProperty( "line.separator" ); + NL = System.getProperty("line.separator"); } - public TXTWriter( ArrayList forces ) { + public TXTWriter(ArrayList forces) { this.forces = forces; } - public TXTWriter( Mech m ) { + public TXTWriter(Mech m) { this(); CurMech = m; - if( CurMech.UsingFractionalAccounting() ) { + if (CurMech.UsingFractionalAccounting()) { tformat = "$7.3f"; } else { tformat = "$6.2f"; } } - public void Write( String filename ) throws IOException { - if ( !filename.endsWith(".txt") ) { filename += ".txt"; } - BufferedWriter FR = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ); + public void Write(String filename) throws IOException { + if (!filename.endsWith(".txt")) { + filename += ".txt"; + } + BufferedWriter FR = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")); for (Force force : forces) { FR.write(force.SerializeClipboard()); @@ -83,16 +84,18 @@ public void Write( String filename ) throws IOException { } FR.close(); } - - public void WriteForces( String filename, Force force ) throws IOException { + + public void WriteForces(String filename, Force force) throws IOException { forces = new ArrayList(); forces.add(force); - WriteForces( filename, forces ); + WriteForces(filename, forces); } - public void WriteForces( String filename, ArrayList forces ) throws IOException { - if ( !filename.endsWith(".txt") ) { filename += ".txt"; } - BufferedWriter FR = new BufferedWriter( new FileWriter(filename) ); + public void WriteForces(String filename, ArrayList forces) throws IOException { + if (!filename.endsWith(".txt")) { + filename += ".txt"; + } + BufferedWriter FR = new BufferedWriter(new FileWriter(filename)); for (Force force : forces) { FR.write(force.SerializeClipboard()); @@ -101,24 +104,25 @@ public void WriteForces( String filename, ArrayList forces ) throws IOExc FR.close(); } -// This is a text formating string (80 chars) I keep around for when it's needed -// "----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+" - public void WriteTXT( String filename ) throws IOException { - BufferedWriter FR = new BufferedWriter( new FileWriter( filename ) ); + // This is a text formating string (80 chars) I keep around for when it's needed + // "----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+" + public void WriteTXT(String filename) throws IOException { + BufferedWriter FR = new BufferedWriter(new FileWriter(filename)); // get the text export and write it - FR.write( GetTextExport() ); + FR.write(GetTextExport()); // all done FR.close(); } - public String GetChatStats( Mech m ) { + public String GetChatStats(Mech m) { // a fun convenience routine for those who talk in chat or forums. String retval = ""; // pondering some sort of GetChatName() for abplaceables. - retval += m.GetTonnage() + " tons, " + m.GetAdjustedWalkingMP( false, true ) + "/" + m.GetAdjustedRunningMP( false, true ) + "/" + m.GetAdjustedJumpingMP( false ); + retval += m.GetTonnage() + " tons, " + m.GetAdjustedWalkingMP(false, true) + "/" + + m.GetAdjustedRunningMP(false, true) + "/" + m.GetAdjustedJumpingMP(false); return retval; } @@ -126,65 +130,68 @@ public String GetChatStats( Mech m ) { public String GetTextExport() { String retval = ""; - if( CurMech.IsOmnimech() ) { - // start out with the base chassis. we'll switch later when needed - CurMech.SetCurLoadout( common.Constants.BASELOADOUT_NAME ); + if (CurMech.IsOmnimech()) { + // start out with the base chassis. we'll switch later when needed + CurMech.SetCurLoadout(common.Constants.BASELOADOUT_NAME); } retval += CurMech.GetName() + " " + CurMech.GetModel() + NL + NL; retval += "Mass: " + CurMech.GetTonnage() + " tons" + NL; - if( CurMech.IsPrimitive() ) { - retval += "Tech Base: " + CommonTools.GetTechbaseString( CurMech.GetBaseTechbase() ) + " (Primitive)" + NL; + if (CurMech.IsPrimitive()) { + retval += "Tech Base: " + CommonTools.GetTechbaseString(CurMech.GetBaseTechbase()) + " (Primitive)" + NL; } else { - retval += "Tech Base: " + CommonTools.GetTechbaseString( CurMech.GetBaseTechbase() ) + NL; + retval += "Tech Base: " + CommonTools.GetTechbaseString(CurMech.GetBaseTechbase()) + NL; } - if( CurMech.IsQuad() ) { - if( CurMech.IsOmnimech() ) { + if (CurMech.IsQuad()) { + if (CurMech.IsOmnimech()) { retval += "Chassis Config: Quad Omnimech" + NL; } else { - if( CurMech.IsIndustrialmech() ) { + if (CurMech.IsIndustrialmech()) { retval += "Chassis Config: Quad IndustrialMech" + NL; } else { retval += "Chassis Config: Quad" + NL; } } } else { - if( CurMech.IsOmnimech() ) { + if (CurMech.IsOmnimech()) { retval += "Chassis Config: Biped Omnimech" + NL; } else { - if( CurMech.IsIndustrialmech() ) { + if (CurMech.IsIndustrialmech()) { retval += "Chassis Config: Biped IndustrialMech" + NL; } else { retval += "Chassis Config: Biped" + NL; } } } - retval += "Rules Level: " + CommonTools.GetRulesLevelString( CurMech.GetRulesLevel() ) + NL; - retval += "Era: " + CommonTools.DecodeEra( CurMech.GetEra() ) + NL; + retval += "Rules Level: " + CommonTools.GetRulesLevelString(CurMech.GetRulesLevel()) + NL; + retval += "Era: " + CommonTools.DecodeEra(CurMech.GetEra()) + NL; retval += "Tech Rating/Era Availability: " + CurMech.GetAvailability().GetBestCombinedCode() + NL; retval += "Production Year: " + CurMech.GetYear() + NL; - retval += "Dry Cost: " + String.format( "%1$,.0f", CurMech.GetDryCost()) + " C-Bills" + NL; - retval += "Total Cost: " + String.format( "%1$,.0f", CurMech.GetTotalCost() ) + " C-Bills" + NL; - retval += "Battle Value: " + String.format( "%1$,d", CurMech.GetCurrentBV() ) + NL + NL; + retval += "Dry Cost: " + String.format("%1$,.0f", CurMech.GetDryCost()) + " C-Bills" + NL; + retval += "Total Cost: " + String.format("%1$,.0f", CurMech.GetTotalCost()) + " C-Bills" + NL; + retval += "Battle Value: " + String.format("%1$,d", CurMech.GetCurrentBV()) + NL + NL; - if( CurMech.UsingFractionalAccounting() ) { + if (CurMech.UsingFractionalAccounting()) { retval += "Construction Options: Fractional Accounting" + NL + NL; } retval += "Chassis: " + CurMech.GetChassisModel() + " " + CurMech.GetIntStruc().CritName() + NL; - retval += "Power Plant: " + CurMech.GetEngineManufacturer() + " " + CurMech.GetEngine().GetRating() + " " + CurMech.GetEngine() + NL; - if( CurMech.GetAdjustedWalkingMP( false, true ) != CurMech.GetWalkingMP() ) { - retval += "Walking Speed: " + CommonTools.FormatSpeed( CurMech.GetWalkingMP() * 10.8 ) + " km/h (" + CommonTools.FormatSpeed( CurMech.GetAdjustedWalkingMP( false, true ) * 10.8 ) + " km/h)" + NL; + retval += "Power Plant: " + CurMech.GetEngineManufacturer() + " " + CurMech.GetEngine().GetRating() + " " + + CurMech.GetEngine() + NL; + if (CurMech.GetAdjustedWalkingMP(false, true) != CurMech.GetWalkingMP()) { + retval += "Walking Speed: " + CommonTools.FormatSpeed(CurMech.GetWalkingMP() * 10.8) + " km/h (" + + CommonTools.FormatSpeed(CurMech.GetAdjustedWalkingMP(false, true) * 10.8) + " km/h)" + NL; } else { - retval += "Walking Speed: " + CommonTools.FormatSpeed( CurMech.GetWalkingMP() * 10.8 ) + " km/h" + NL; + retval += "Walking Speed: " + CommonTools.FormatSpeed(CurMech.GetWalkingMP() * 10.8) + " km/h" + NL; } - if( CurMech.GetAdjustedRunningMP( false, true ) != CurMech.GetRunningMP() ) { - retval += "Maximum Speed: " + CommonTools.FormatSpeed( CurMech.GetRunningMP() * 10.8 ) + " km/h (" + CommonTools.FormatSpeed( CurMech.GetAdjustedRunningMP( false, true ) * 10.8 ) + " km/h)" + NL; + if (CurMech.GetAdjustedRunningMP(false, true) != CurMech.GetRunningMP()) { + retval += "Maximum Speed: " + CommonTools.FormatSpeed(CurMech.GetRunningMP() * 10.8) + " km/h (" + + CommonTools.FormatSpeed(CurMech.GetAdjustedRunningMP(false, true) * 10.8) + " km/h)" + NL; } else { - retval += "Maximum Speed: " + CommonTools.FormatSpeed( CurMech.GetRunningMP() * 10.8 ) + " km/h" + NL; + retval += "Maximum Speed: " + CommonTools.FormatSpeed(CurMech.GetRunningMP() * 10.8) + " km/h" + NL; } retval += "Jump Jets: " + CurMech.GetJJModel() + NL; retval += " Jump Capacity: " + GetJumpJetDistanceLine() + NL; - if( CurMech.HasCTCase()|| CurMech.HasLTCase() || CurMech.HasRTCase() ) { + if (CurMech.HasCTCase() || CurMech.HasLTCase() || CurMech.HasRTCase()) { retval += "Armor: " + CurMech.GetArmorModel() + " " + CurMech.GetArmor().CritName() + " w/ CASE" + NL; } else { retval += "Armor: " + CurMech.GetArmorModel() + " " + CurMech.GetArmor().CritName() + NL; @@ -194,34 +201,36 @@ public String GetTextExport() { retval += "Manufacturer: " + CurMech.GetCompany() + NL; retval += " Primary Factory: " + CurMech.GetLocation() + NL; retval += BuildComputerBlock() + NL + NL; -// retval += "================================================================================" + NL; - if( ! CurMech.GetOverview().equals( "" ) ) { + // retval += + // "================================================================================" + // + NL; + if (!CurMech.GetOverview().equals("")) { retval += "Overview:" + NL; - retval += FormatFluff( CurMech.GetOverview() ) + NL + NL; + retval += FormatFluff(CurMech.GetOverview()) + NL + NL; } - if( ! CurMech.GetCapabilities().equals( "" ) ) { + if (!CurMech.GetCapabilities().equals("")) { retval += "Capabilities:" + NL; - retval += FormatFluff( CurMech.GetCapabilities() ) + NL + NL; + retval += FormatFluff(CurMech.GetCapabilities()) + NL + NL; } - if( ! CurMech.GetHistory().equals( "" ) ) { + if (!CurMech.GetHistory().equals("")) { retval += "Battle History:" + NL; - retval += FormatFluff( CurMech.GetHistory() ) + NL + NL; + retval += FormatFluff(CurMech.GetHistory()) + NL + NL; } - if( ! CurMech.GetDeployment().equals( "" ) ) { + if (!CurMech.GetDeployment().equals("")) { retval += "Deployment:" + NL; - retval += FormatFluff( CurMech.GetDeployment() ) + NL + NL; + retval += FormatFluff(CurMech.GetDeployment()) + NL + NL; } - if( ! CurMech.GetVariants().equals( "" ) ) { + if (!CurMech.GetVariants().equals("")) { retval += "Variants:" + NL; - retval += FormatFluff( CurMech.GetVariants() ) + NL + NL; + retval += FormatFluff(CurMech.GetVariants()) + NL + NL; } - if( ! CurMech.GetNotables().equals( "" ) ) { + if (!CurMech.GetNotables().equals("")) { retval += "Notable 'Mechs & MechWarriors: " + NL; - retval += FormatFluff( CurMech.GetNotables() ) + NL + NL; + retval += FormatFluff(CurMech.GetNotables()) + NL + NL; } - if( ! CurMech.GetAdditional().equals( "" ) ) { + if (!CurMech.GetAdditional().equals("")) { retval += "Additional: " + NL; - retval += FormatFluff( CurMech.GetAdditional() ) + NL + NL; + retval += FormatFluff(CurMech.GetAdditional()) + NL + NL; } retval += "================================================================================" + NL; retval += GetMiniTextExport(); @@ -232,169 +241,299 @@ public String GetTextExport() { public String GetMiniTextExport() { String retval = ""; - if ( CurrentLoadoutOnly ) { + if (CurrentLoadoutOnly) { retval += CurMech.GetName() + " " + CurMech.GetModel() + NL + NL; - retval += "Tech Base: " + CommonTools.GetTechbaseString( CurMech.GetTechbase() ) + NL; + retval += "Tech Base: " + CommonTools.GetTechbaseString(CurMech.GetTechbase()) + NL; retval += "Chassis Config: "; String chassisString = "Biped"; - if ( CurMech.IsQuad() ) { chassisString.replace("Biped", "Quad"); } - if ( CurMech.IsOmnimech() ) { chassisString += " Omnimech"; } - if ( CurMech.IsIndustrialmech() ) { chassisString += " IndustrialMech"; } + if (CurMech.IsQuad()) { + chassisString.replace("Biped", "Quad"); + } + if (CurMech.IsOmnimech()) { + chassisString += " Omnimech"; + } + if (CurMech.IsIndustrialmech()) { + chassisString += " IndustrialMech"; + } retval += chassisString + NL; - retval += String.format( "Era: %1$-56s Cost: %2$,.0f", CommonTools.DecodeEra( CurMech.GetEra() ), Math.floor( CurMech.GetTotalCost() + 0.5 ) ) + NL; - retval += String.format( "Tech Rating/Era Availability: %1$-32s BV2: %2$,d", CurMech.GetAvailability().GetBestCombinedCode(), CurMech.GetCurrentBV() ) + NL + NL; + retval += String.format("Era: %1$-56s Cost: %2$,.0f", CommonTools.DecodeEra(CurMech.GetEra()), + Math.floor(CurMech.GetTotalCost() + 0.5)) + NL; + retval += String.format("Tech Rating/Era Availability: %1$-32s BV2: %2$,d", + CurMech.GetAvailability().GetBestCombinedCode(), CurMech.GetCurrentBV()) + NL + NL; } retval += "Equipment Type Rating Mass " + NL; retval += "--------------------------------------------------------------------------------" + NL; - retval += String.format( "Internal Structure: %1$-28s %2$3s points %3" + tformat, CurMech.GetIntStruc().CritName(), CurMech.GetIntStruc().GetTotalPoints(), CurMech.GetIntStruc().GetTonnage() ) + NL; - if( CurMech.GetIntStruc().NumCrits() > 0 ) { - retval += " Internal Locations: " + FileCommon.GetInternalLocations( CurMech ) + NL; - } - retval += String.format( "Engine: %1$-28s %2$3s %3" + tformat, FileCommon.GetExportName( CurMech, CurMech.GetEngine() ), CurMech.GetEngine().GetRating(), CurMech.GetEngine().GetTonnage() ) + NL; - if( CurMech.GetWalkingMP() != CurMech.GetAdjustedWalkingMP( false , true ) ) { - retval += " Walking MP: " + CurMech.GetWalkingMP() + " (" + CurMech.GetAdjustedWalkingMP( false, true ) + ")" + NL; + retval += String.format("Internal Structure: %1$-28s %2$3s points %3" + tformat, + CurMech.GetIntStruc().CritName(), CurMech.GetIntStruc().GetTotalPoints(), + CurMech.GetIntStruc().GetTonnage()) + NL; + if (CurMech.GetIntStruc().NumCrits() > 0) { + retval += " Internal Locations: " + FileCommon.GetInternalLocations(CurMech) + NL; + } + retval += String.format("Engine: %1$-28s %2$3s %3" + tformat, + FileCommon.GetExportName(CurMech, CurMech.GetEngine()), CurMech.GetEngine().GetRating(), + CurMech.GetEngine().GetTonnage()) + NL; + if (CurMech.GetWalkingMP() != CurMech.GetAdjustedWalkingMP(false, true)) { + retval += " Walking MP: " + CurMech.GetWalkingMP() + " (" + CurMech.GetAdjustedWalkingMP(false, true) + + ")" + NL; } else { retval += " Walking MP: " + CurMech.GetWalkingMP() + NL; } - if( CurMech.GetRunningMP() != CurMech.GetAdjustedRunningMP( false, true ) ) { - retval += " Running MP: " + CurMech.GetRunningMP() + " (" + CurMech.GetAdjustedRunningMP( false, true ) + ")" + NL; + if (CurMech.GetRunningMP() != CurMech.GetAdjustedRunningMP(false, true)) { + retval += " Running MP: " + CurMech.GetRunningMP() + " (" + CurMech.GetAdjustedRunningMP(false, true) + + ")" + NL; } else { retval += " Running MP: " + CurMech.GetRunningMP() + NL; } retval += " Jumping MP: " + GetJumpingMPLine() + " " + GetJumpJetTypeLine() + NL; - if( CurMech.GetJumpJets().GetNumJJ() > 0 ) { - retval += String.format( " %1$-68s %2$6.2f", "Jump Jet Locations: " + FileCommon.GetJumpJetLocations( CurMech ), CurMech.GetJumpJets().GetTonnage() ) + NL; - } - retval += String.format( "Heat Sinks: %1$-28s %2$-8s %3" + tformat, GetHSType(), GetHSNum(), CurMech.GetHeatSinks().GetTonnage() ) + NL; - if( CurMech.GetHeatSinks().GetNumHS() > CurMech.GetEngine().InternalHeatSinks() ) { - retval += " Heat Sink Locations: " + FileCommon.GetHeatSinkLocations( CurMech ) + NL; - } - retval += String.format( "Gyro: %1$-52s %2" + tformat, FileCommon.GetExportName( CurMech, CurMech.GetGyro() ), CurMech.GetGyro().GetTonnage() ) + NL; - retval += String.format( "Cockpit: %1$-52s %2" + tformat, FileCommon.GetExportName( CurMech, CurMech.GetCockpit() ), CurMech.GetCockpit().GetTonnage() ) + NL; - if( CurMech.HasEjectionSeat() ) { - retval += String.format( " %1$-68s %2" + tformat, "Ejection Seat:", CurMech.GetEjectionSeat().GetTonnage() ) + NL; - } - if( FileCommon.NeedsCockpitComponentLine( CurMech ) ) { - retval += " " + FileCommon.GetCockpitComponentLine( CurMech ); - } - if( ! CurMech.GetEngine().IsNuclear() ) { - if( CurMech.GetLoadout().GetPowerAmplifier().GetTonnage() > 0 ) { - retval += String.format( "%1$-72s %2" + tformat, "Power Amplifiers:", CurMech.GetLoadout().GetPowerAmplifier().GetTonnage() ) + NL; + if (CurMech.GetJumpJets().GetNumJJ() > 0) { + retval += String.format(" %1$-68s %2$6.2f", + "Jump Jet Locations: " + FileCommon.GetJumpJetLocations(CurMech), + CurMech.GetJumpJets().GetTonnage()) + NL; + } + retval += String.format("Heat Sinks: %1$-28s %2$-8s %3" + tformat, GetHSType(), + GetHSNum(), CurMech.GetHeatSinks().GetTonnage()) + NL; + if (CurMech.GetHeatSinks().GetNumHS() > CurMech.GetEngine().InternalHeatSinks()) { + retval += " Heat Sink Locations: " + FileCommon.GetHeatSinkLocations(CurMech) + NL; + } + retval += String.format("Gyro: %1$-52s %2" + tformat, + FileCommon.GetExportName(CurMech, CurMech.GetGyro()), CurMech.GetGyro().GetTonnage()) + NL; + retval += String.format("Cockpit: %1$-52s %2" + tformat, + FileCommon.GetExportName(CurMech, CurMech.GetCockpit()), CurMech.GetCockpit().GetTonnage()) + NL; + if (CurMech.HasEjectionSeat()) { + retval += String.format(" %1$-68s %2" + tformat, "Ejection Seat:", + CurMech.GetEjectionSeat().GetTonnage()) + NL; + } + if (FileCommon.NeedsCockpitComponentLine(CurMech)) { + retval += " " + FileCommon.GetCockpitComponentLine(CurMech); + } + if (!CurMech.GetEngine().IsNuclear()) { + if (CurMech.GetLoadout().GetPowerAmplifier().GetTonnage() > 0) { + retval += String.format("%1$-72s %2" + tformat, "Power Amplifiers:", + CurMech.GetLoadout().GetPowerAmplifier().GetTonnage()) + NL; } } - if( FileCommon.NeedsLegActuatorLine( CurMech ) ) { - retval += " Arm Actuators: " + FileCommon.BuildActuators( CurMech, false ) + NL; - retval += " Leg Actuators: " + FileCommon.BuildLegActuators( CurMech, false ) + NL; + if (FileCommon.NeedsLegActuatorLine(CurMech)) { + retval += " Arm Actuators: " + FileCommon.BuildActuators(CurMech, false) + NL; + retval += " Leg Actuators: " + FileCommon.BuildLegActuators(CurMech, false) + NL; } else { - retval += " Actuators: " + FileCommon.BuildActuators( CurMech, false ) + NL; + retval += " Actuators: " + FileCommon.BuildActuators(CurMech, false) + NL; } - if( CurMech.GetPhysEnhance().IsTSM() ) { - retval += " TSM Locations: " + FileCommon.GetTSMLocations( CurMech ) + NL; + if (CurMech.GetPhysEnhance().IsTSM()) { + retval += " TSM Locations: " + FileCommon.GetTSMLocations(CurMech) + NL; } - if( CurMech.GetArmor().GetBAR() < 10 ) { - retval += String.format( "Armor: %1$-28s AV - %2$3s %3" + tformat, CurMech.GetArmor().CritName() + " (BAR: " + CurMech.GetArmor().GetBAR() +")", CurMech.GetArmor().GetArmorValue(), CurMech.GetArmor().GetTonnage() ) + NL; + if (CurMech.GetArmor().GetBAR() < 10) { + retval += String.format("Armor: %1$-28s AV - %2$3s %3" + tformat, + CurMech.GetArmor().CritName() + " (BAR: " + CurMech.GetArmor().GetBAR() + ")", + CurMech.GetArmor().GetArmorValue(), CurMech.GetArmor().GetTonnage()) + NL; } else { - retval += String.format( "Armor: %1$-28s AV - %2$3s %3" + tformat, CurMech.GetArmor().CritName(), CurMech.GetArmor().GetArmorValue(), CurMech.GetArmor().GetTonnage() ) + NL; + retval += String.format("Armor: %1$-28s AV - %2$3s %3" + tformat, + CurMech.GetArmor().CritName(), CurMech.GetArmor().GetArmorValue(), CurMech.GetArmor().GetTonnage()) + + NL; } - if( CurMech.GetArmor().NumCrits() > 0 ) { - retval += " Armor Locations: " + FileCommon.GetArmorLocations( CurMech ) + NL; + if (CurMech.GetArmor().NumCrits() > 0) { + retval += " Armor Locations: " + FileCommon.GetArmorLocations(CurMech) + NL; } - if( CurMech.GetLoadout().IsUsingClanCASE() ) { + if (CurMech.GetLoadout().IsUsingClanCASE()) { int[] Locs = CurMech.GetLoadout().FindExplosiveInstances(); boolean check = false; - for( int i = 0; i < Locs.length; i++ ) { - if( Locs[i] > 0 ) { + for (int i = 0; i < Locs.length; i++) { + if (Locs[i] > 0) { check = true; } } - if( check ) { - retval += String.format( " %1$-68s %2" + tformat, "CASE Locations: " + FileCommon.GetCaseLocations( CurMech ), CurMech.GetCaseTonnage() ) + NL; + if (check) { + retval += String.format(" %1$-68s %2" + tformat, + "CASE Locations: " + FileCommon.GetCaseLocations(CurMech), CurMech.GetCaseTonnage()) + NL; } } else { - if( CurMech.GetCaseTonnage() != 0.0f ) { - retval += String.format( " %1$-68s %2" + tformat, "CASE Locations: " + FileCommon.GetCaseLocations( CurMech ), CurMech.GetCaseTonnage() ) + NL; + if (CurMech.GetCaseTonnage() != 0.0f) { + retval += String.format(" %1$-68s %2" + tformat, + "CASE Locations: " + FileCommon.GetCaseLocations(CurMech), CurMech.GetCaseTonnage()) + NL; } } - if( CurMech.GetCASEIITonnage() != 0.0f ) { - retval += String.format( " %1$-68s %2" + tformat, "CASE II Locations: " + FileCommon.GetCaseIILocations( CurMech ), CurMech.GetCASEIITonnage() ) + NL; + if (CurMech.GetCASEIITonnage() != 0.0f) { + retval += String.format(" %1$-68s %2" + tformat, + "CASE II Locations: " + FileCommon.GetCaseIILocations(CurMech), CurMech.GetCASEIITonnage()) + NL; } retval += NL + " Internal Armor " + NL; retval += " Structure Factor " + NL; - if( CurMech.GetArmor().IsPatchwork() ) { - retval += String.format( " Head %1$29s %2$-3s %3$-3s ", "(" + CurMech.GetArmor().GetHDArmorType().LookupName() + ")", CurMech.GetIntStruc().GetHeadPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_HD ) ) + NL; - retval += String.format( " Center Torso %1$29s %2$-3s %3$-3s ", "(" + CurMech.GetArmor().GetCTArmorType().LookupName() + ")", CurMech.GetIntStruc().GetCTPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_CT ) ) + NL; - retval += String.format( " Center Torso (rear) %1$-3s ", CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_CTR ) ) + NL; - retval += String.format( " Left Torso %1$29s %2$-3s %3$-3s ", "(" + CurMech.GetArmor().GetLTArmorType().LookupName() + ")", CurMech.GetIntStruc().GetSidePoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LT ) ) + NL; - retval += String.format( " Left Torso (rear) %1$-3s ", CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LTR ) ) + NL; - retval += String.format( " Right Torso %1$29s %2$-3s %3$-3s ", "(" + CurMech.GetArmor().GetRTArmorType().LookupName() + ")", CurMech.GetIntStruc().GetSidePoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RT ) ) + NL; - retval += String.format( " Right Torso (rear) %1$-3s ", CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RTR ) ) + NL; - if( CurMech.IsQuad() ) { - retval += String.format( " Left Front Leg %1$29s %2$-3s %3$-3s ", "(" + CurMech.GetArmor().GetLAArmorType().LookupName() + ")", CurMech.GetIntStruc().GetArmPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LA ) ) + NL; - retval += String.format( " Right Front Leg %1$29s %2$-3s %3$-3s ", "(" + CurMech.GetArmor().GetRAArmorType().LookupName() + ")", CurMech.GetIntStruc().GetArmPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RA ) ) + NL; - retval += String.format( " Left Rear Leg %1$29s %2$-3s %3$-3s ", "(" + CurMech.GetArmor().GetLLArmorType().LookupName() + ")", CurMech.GetIntStruc().GetLegPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LL ) ) + NL; - retval += String.format( " Right Rear Leg %1$29s %2$-3s %3$-3s ", "(" + CurMech.GetArmor().GetRLArmorType().LookupName() + ")", CurMech.GetIntStruc().GetLegPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RL ) ) + NL; + if (CurMech.GetArmor().IsPatchwork()) { + retval += String.format(" Head %1$29s %2$-3s %3$-3s ", + "(" + CurMech.GetArmor().GetHDArmorType().LookupName() + ")", CurMech.GetIntStruc().GetHeadPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_HD)) + NL; + retval += String.format(" Center Torso %1$29s %2$-3s %3$-3s ", + "(" + CurMech.GetArmor().GetCTArmorType().LookupName() + ")", CurMech.GetIntStruc().GetCTPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_CT)) + NL; + retval += String.format( + " Center Torso (rear) %1$-3s ", + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_CTR)) + NL; + retval += String.format(" Left Torso %1$29s %2$-3s %3$-3s ", + "(" + CurMech.GetArmor().GetLTArmorType().LookupName() + ")", CurMech.GetIntStruc().GetSidePoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LT)) + NL; + retval += String.format( + " Left Torso (rear) %1$-3s ", + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LTR)) + NL; + retval += String.format(" Right Torso %1$29s %2$-3s %3$-3s ", + "(" + CurMech.GetArmor().GetRTArmorType().LookupName() + ")", CurMech.GetIntStruc().GetSidePoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RT)) + NL; + retval += String.format( + " Right Torso (rear) %1$-3s ", + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RTR)) + NL; + if (CurMech.IsQuad()) { + retval += String.format(" Left Front Leg %1$29s %2$-3s %3$-3s ", + "(" + CurMech.GetArmor().GetLAArmorType().LookupName() + ")", + CurMech.GetIntStruc().GetArmPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LA)) + NL; + retval += String.format(" Right Front Leg %1$29s %2$-3s %3$-3s ", + "(" + CurMech.GetArmor().GetRAArmorType().LookupName() + ")", + CurMech.GetIntStruc().GetArmPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RA)) + NL; + retval += String.format(" Left Rear Leg %1$29s %2$-3s %3$-3s ", + "(" + CurMech.GetArmor().GetLLArmorType().LookupName() + ")", + CurMech.GetIntStruc().GetLegPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LL)) + NL; + retval += String.format(" Right Rear Leg %1$29s %2$-3s %3$-3s ", + "(" + CurMech.GetArmor().GetRLArmorType().LookupName() + ")", + CurMech.GetIntStruc().GetLegPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RL)) + NL; } else { - retval += String.format( " Left Arm %1$29s %2$-3s %3$-3s ", "(" + CurMech.GetArmor().GetLAArmorType().LookupName() + ")", CurMech.GetIntStruc().GetArmPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LA ) ) + NL; - retval += String.format( " Right Arm %1$29s %2$-3s %3$-3s ", "(" + CurMech.GetArmor().GetRAArmorType().LookupName() + ")", CurMech.GetIntStruc().GetArmPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RA ) ) + NL; - retval += String.format( " Left Leg %1$29s %2$-3s %3$-3s ", "(" + CurMech.GetArmor().GetLLArmorType().LookupName() + ")", CurMech.GetIntStruc().GetLegPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LL ) ) + NL; - retval += String.format( " Right Leg %1$29s %2$-3s %3$-3s ", "(" + CurMech.GetArmor().GetRLArmorType().LookupName() + ")", CurMech.GetIntStruc().GetLegPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RL ) ) + NL; + retval += String.format(" Left Arm %1$29s %2$-3s %3$-3s ", + "(" + CurMech.GetArmor().GetLAArmorType().LookupName() + ")", + CurMech.GetIntStruc().GetArmPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LA)) + NL; + retval += String.format(" Right Arm %1$29s %2$-3s %3$-3s ", + "(" + CurMech.GetArmor().GetRAArmorType().LookupName() + ")", + CurMech.GetIntStruc().GetArmPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RA)) + NL; + retval += String.format(" Left Leg %1$29s %2$-3s %3$-3s ", + "(" + CurMech.GetArmor().GetLLArmorType().LookupName() + ")", + CurMech.GetIntStruc().GetLegPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LL)) + NL; + retval += String.format(" Right Leg %1$29s %2$-3s %3$-3s ", + "(" + CurMech.GetArmor().GetRLArmorType().LookupName() + ")", + CurMech.GetIntStruc().GetLegPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RL)) + NL; } } else { - retval += String.format( " Head %1$-3s %2$-3s ", CurMech.GetIntStruc().GetHeadPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_HD ) ) + NL; - retval += String.format( " Center Torso %1$-3s %2$-3s ", CurMech.GetIntStruc().GetCTPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_CT ) ) + NL; - retval += String.format( " Center Torso (rear) %1$-3s ", CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_CTR ) ) + NL; - if( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LT ) != CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RT ) ) { - retval += String.format( " Left Torso %1$-3s %2$-3s ", CurMech.GetIntStruc().GetSidePoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LT ) ) + NL; - retval += String.format( " Right Torso %1$-3s %2$-3s ", CurMech.GetIntStruc().GetSidePoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RT ) ) + NL; + retval += String.format( + " Head %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetHeadPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_HD)) + NL; + retval += String.format( + " Center Torso %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetCTPoints(), CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_CT)) + + NL; + retval += String.format( + " Center Torso (rear) %1$-3s ", + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_CTR)) + NL; + if (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LT) != CurMech.GetArmor() + .GetLocationArmor(LocationIndex.MECH_LOC_RT)) { + retval += String.format( + " Left Torso %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetSidePoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LT)) + NL; + retval += String.format( + " Right Torso %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetSidePoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RT)) + NL; } else { - retval += String.format( " L/R Torso %1$-3s %2$-3s ", CurMech.GetIntStruc().GetSidePoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LT ) ) + NL; + retval += String.format( + " L/R Torso %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetSidePoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LT)) + NL; } - if( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LTR ) != CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RTR ) ) { - retval += String.format( " Left Torso (rear) %1$-3s ", CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LTR ) ) + NL; - retval += String.format( " Right Torso (rear) %1$-3s ", CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RTR ) ) + NL; + if (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LTR) != CurMech.GetArmor() + .GetLocationArmor(LocationIndex.MECH_LOC_RTR)) { + retval += String.format( + " Left Torso (rear) %1$-3s ", + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LTR)) + NL; + retval += String.format( + " Right Torso (rear) %1$-3s ", + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RTR)) + NL; } else { - retval += String.format( " L/R Torso (rear) %1$-3s ", CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LTR ) ) + NL; + retval += String.format( + " L/R Torso (rear) %1$-3s ", + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LTR)) + NL; } - if( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LA ) != CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RA ) ) { - if( CurMech.IsQuad() ) { - retval += String.format( " Left Front Leg %1$-3s %2$-3s ", CurMech.GetIntStruc().GetArmPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LA ) ) + NL; - retval += String.format( " Right Front Leg %1$-3s %2$-3s ", CurMech.GetIntStruc().GetArmPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RA ) ) + NL; + if (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LA) != CurMech.GetArmor() + .GetLocationArmor(LocationIndex.MECH_LOC_RA)) { + if (CurMech.IsQuad()) { + retval += String.format( + " Left Front Leg %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetArmPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LA)) + NL; + retval += String.format( + " Right Front Leg %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetArmPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RA)) + NL; } else { - retval += String.format( " Left Arm %1$-3s %2$-3s ", CurMech.GetIntStruc().GetArmPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LA ) ) + NL; - retval += String.format( " Right Arm %1$-3s %2$-3s ", CurMech.GetIntStruc().GetArmPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RA ) ) + NL; + retval += String.format( + " Left Arm %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetArmPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LA)) + NL; + retval += String.format( + " Right Arm %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetArmPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RA)) + NL; } } else { - if( CurMech.IsQuad() ) { - retval += String.format( " L/R Front Leg %1$-3s %2$-3s ", CurMech.GetIntStruc().GetArmPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LA ) ) + NL; + if (CurMech.IsQuad()) { + retval += String.format( + " L/R Front Leg %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetArmPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LA)) + NL; } else { - retval += String.format( " L/R Arm %1$-3s %2$-3s ", CurMech.GetIntStruc().GetArmPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LA ) ) + NL; + retval += String.format( + " L/R Arm %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetArmPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LA)) + NL; } } - if( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LL ) != CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RL ) ) { - if( CurMech.IsQuad() ) { - retval += String.format( " Left Rear Leg %1$-3s %2$-3s ", CurMech.GetIntStruc().GetLegPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LL ) ) + NL; - retval += String.format( " Right Rear Leg %1$-3s %2$-3s ", CurMech.GetIntStruc().GetLegPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RL ) ) + NL; + if (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LL) != CurMech.GetArmor() + .GetLocationArmor(LocationIndex.MECH_LOC_RL)) { + if (CurMech.IsQuad()) { + retval += String.format( + " Left Rear Leg %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetLegPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LL)) + NL; + retval += String.format( + " Right Rear Leg %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetLegPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RL)) + NL; } else { - retval += String.format( " Left Leg %1$-3s %2$-3s ", CurMech.GetIntStruc().GetLegPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LL ) ) + NL; - retval += String.format( " Right Leg %1$-3s %2$-3s ", CurMech.GetIntStruc().GetLegPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RL ) ) + NL; + retval += String.format( + " Left Leg %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetLegPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LL)) + NL; + retval += String.format( + " Right Leg %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetLegPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RL)) + NL; } } else { - if( CurMech.IsQuad() ) { - retval += String.format( " L/R Rear Leg %1$-3s %2$-3s ", CurMech.GetIntStruc().GetLegPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LL ) ) + NL; + if (CurMech.IsQuad()) { + retval += String.format( + " L/R Rear Leg %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetLegPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LL)) + NL; } else { - retval += String.format( " L/R Leg %1$-3s %2$-3s ", CurMech.GetIntStruc().GetLegPoints(), CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LL ) ) + NL; + retval += String.format( + " L/R Leg %1$-3s %2$-3s ", + CurMech.GetIntStruc().GetLegPoints(), + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LL)) + NL; } } } - if( CurMech.IsOmnimech() ) { + if (CurMech.IsOmnimech()) { ArrayList l = CurMech.GetLoadouts(); - if ( !CurrentLoadoutOnly ) { - CurMech.SetCurLoadout( common.Constants.BASELOADOUT_NAME ); + if (!CurrentLoadoutOnly) { + CurMech.SetCurLoadout(common.Constants.BASELOADOUT_NAME); retval += NL; retval += BuildEquipmentBlock() + NL; - for( int i = 0; i < l.size(); i++ ) { - CurMech.SetCurLoadout( ((ifMechLoadout) l.get( i )).GetName() ); - retval += NL + "================================================================================" + NL; + for (int i = 0; i < l.size(); i++) { + CurMech.SetCurLoadout(((ifMechLoadout) l.get(i)).GetName()); + retval += NL + "================================================================================" + + NL; retval += BuildOmniLoadout() + NL; } } else { @@ -402,7 +541,9 @@ public String GetMiniTextExport() { retval += BuildOmniLoadout() + NL; } } else { - //retval += NL + "================================================================================" + NL; + // retval += NL + + // "================================================================================" + // + NL; retval += NL; retval += BuildEquipmentBlock() + NL; } @@ -411,159 +552,180 @@ public String GetMiniTextExport() { } private String GetArmament() { - ArrayList v = CurMech.GetLoadout().GetNonCore(); - ArrayList w = new ArrayList(); - ArrayList EQ = new ArrayList(); + ArrayList v = CurMech.GetLoadout().GetNonCore(); + ArrayList w = new ArrayList(); + ArrayList EQ = new ArrayList(); String Armament = ""; // find only the armaments - for( int i = 0; i < v.size(); i++ ) { - if( v.get( i ) instanceof ifWeapon ) { - w.add( v.get( i ) ); + for (int i = 0; i < v.size(); i++) { + if (v.get(i) instanceof ifWeapon) { + w.add(v.get(i)); } else { - EQ.add( v.get( i ) ); + EQ.add(v.get(i)); } } // do we need to continue? - if( w.size() <= 0 ) { - if( CurMech.IsOmnimech() ) { - return " " + ( CurMech.GetTonnage() - CurMech.GetCurrentTons() ) + " tons of pod space." + NL; + if (w.size() <= 0) { + if (CurMech.IsOmnimech()) { + return " " + (CurMech.GetTonnage() - CurMech.GetCurrentTons()) + " tons of pod space." + NL; } else { return " None" + NL; } } // sort the weapons according to current BV, assuming front facing - abPlaceable[] weapons = CurMech.SortWeapons( w, false ); - ArrayList Temp = new ArrayList(); + ArrayList weapons = CurMech.SortWeapons(w, false); + ArrayList Temp = new ArrayList(); // add in the rest of the equipment - for( int i = 0; i < weapons.length; i++ ) { - Temp.add( weapons[i] ); + for (int i = 0; i < weapons.size(); i++) { + Temp.add(weapons.get(i)); } - for( int i = 0; i < EQ.size(); i++ ) { - if( ! ( EQ.get( i ) instanceof Ammunition ) ) { - Temp.add( EQ.get( i ) ); + for (int i = 0; i < EQ.size(); i++) { + if (!(EQ.get(i) instanceof Ammunition)) { + Temp.add(EQ.get(i)); } } - weapons = new abPlaceable[Temp.size()]; - for( int i = 0; i < Temp.size(); i++ ) { - weapons[i] = (abPlaceable) Temp.get( i ); + weapons = new ArrayList(); + for (int i = 0; i < Temp.size(); i++) { + weapons.set(i, Temp.get(i)); } // initialize the next loop int numthistype = 1; - abPlaceable cur = weapons[0]; - weapons[0] = null; + abPlaceable cur = weapons.get(0); + weapons.set(0, null); // do we need to continue? - if( weapons.length <= 1 ) { - if( cur instanceof RangedWeapon ) { - if( ((RangedWeapon) cur).IsUsingFCS() ) { - Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.GetFluffName( CurMech, cur ) + " w/ " + ((abPlaceable) ((RangedWeapon) cur).GetFCS()).CritName() + NL; + if (weapons.size() <= 1) { + if (cur instanceof RangedWeapon) { + if (((RangedWeapon) cur).IsUsingFCS()) { + Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.GetFluffName(CurMech, cur) + " w/ " + + ((abPlaceable) ((RangedWeapon) cur).GetFCS()).CritName() + NL; } else { - Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.GetFluffName( CurMech, cur ) + NL; + Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.GetFluffName(CurMech, cur) + NL; } } else { - if( cur instanceof Equipment ) { - if( ((Equipment) cur).IsVariableSize() ) { + if (cur instanceof Equipment) { + if (((Equipment) cur).IsVariableSize()) { Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + cur.CritName() + NL; } else { - Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.GetFluffName( CurMech, cur ) + NL; + Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.GetFluffName(CurMech, cur) + NL; } } else { - Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.GetFluffName( CurMech, cur ) + NL; + Armament = " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.GetFluffName(CurMech, cur) + NL; } } - if( CurMech.IsOmnimech() ) { - Armament += " " + ( CurMech.GetTonnage() - CurMech.GetCurrentTons() ) + " tons of pod space." + NL; + if (CurMech.IsOmnimech()) { + Armament += " " + (CurMech.GetTonnage() - CurMech.GetCurrentTons()) + " tons of pod space." + NL; } return Armament; } // count up individual weapons and build their string String plural = ""; - for( int i = 1; i <= weapons.length; i++ ) { + for (int i = 1; i <= weapons.size(); i++) { // find any other weapons of this type - for( int j = 0; j < weapons.length; j++ ) { - if( weapons[j] != null ) { - if( cur instanceof Equipment ) { - if( ((Equipment) cur).IsVariableSize() ) { - if( weapons[j].CritName().equals( cur.CritName() ) && weapons[j].GetManufacturer().equals( cur.GetManufacturer() ) ) { + for (int j = 0; j < weapons.size(); j++) { + if (weapons.get(j) != null) { + if (cur instanceof Equipment) { + if (((Equipment) cur).IsVariableSize()) { + if (weapons.get(j).CritName().equals(cur.CritName()) + && weapons.get(j).GetManufacturer().equals(cur.GetManufacturer())) { numthistype++; - weapons[j] = null; + weapons.set(j, null); } } else { - if( FileCommon.LookupStripArc( weapons[j].LookupName() ).equals( FileCommon.LookupStripArc( cur.LookupName() ) ) && weapons[j].GetManufacturer().equals( cur.GetManufacturer() ) ) { + if (FileCommon.LookupStripArc(weapons.get(j).LookupName()) + .equals(FileCommon.LookupStripArc(cur.LookupName())) + && weapons.get(j).GetManufacturer().equals(cur.GetManufacturer())) { numthistype++; - weapons[j] = null; + weapons.set(j, null); } } } else { - if( FileCommon.LookupStripArc( weapons[j].LookupName() ).equals( FileCommon.LookupStripArc( cur.LookupName() ) ) && weapons[j].GetManufacturer().equals( cur.GetManufacturer() ) ) { + if (FileCommon.LookupStripArc(weapons.get(j).LookupName()) + .equals(FileCommon.LookupStripArc(cur.LookupName())) + && weapons.get(j).GetManufacturer().equals(cur.GetManufacturer())) { numthistype++; - weapons[j] = null; + weapons.set(j, null); } } } } // add the current weapon to the armament string - if( numthistype > 1 ) { + if (numthistype > 1) { plural = "s"; } else { plural = ""; } - if( cur instanceof RangedWeapon ) { - if( CurMech.GetLoadout().GetTechBase() == AvailableCode.TECH_BOTH ) { - if( ((RangedWeapon) cur).IsUsingFCS() ) { - Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.LookupStripArc( cur.LookupName() ) + plural + " w/ " + ((abPlaceable) ((RangedWeapon) cur).GetFCS()).LookupName() + NL; + if (cur instanceof RangedWeapon) { + if (CurMech.GetLoadout().GetTechBase() == AvailableCode.TECH_BOTH) { + if (((RangedWeapon) cur).IsUsingFCS()) { + Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.LookupStripArc(cur.LookupName()) + plural + " w/ " + + ((abPlaceable) ((RangedWeapon) cur).GetFCS()).LookupName() + NL; } else { - Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.LookupStripArc( cur.LookupName() ) + plural + NL; + Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.LookupStripArc(cur.LookupName()) + plural + NL; } } else { - if( ((RangedWeapon) cur).IsUsingFCS() ) { - Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.LookupStripArc( cur.CritName() ) + plural + " w/ " + ((abPlaceable) ((RangedWeapon) cur).GetFCS()).CritName() + NL; + if (((RangedWeapon) cur).IsUsingFCS()) { + Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.LookupStripArc(cur.CritName()) + plural + " w/ " + + ((abPlaceable) ((RangedWeapon) cur).GetFCS()).CritName() + NL; } else { - Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.LookupStripArc( cur.CritName() ) + plural + NL; + Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.LookupStripArc(cur.CritName()) + plural + NL; } } } else { - if( CurMech.GetLoadout().GetTechBase() == AvailableCode.TECH_BOTH ) { - if( cur instanceof Equipment ) { - if( ((Equipment) cur).IsVariableSize() ) { + if (CurMech.GetLoadout().GetTechBase() == AvailableCode.TECH_BOTH) { + if (cur instanceof Equipment) { + if (((Equipment) cur).IsVariableSize()) { Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + cur.CritName() + NL; } else { - Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.LookupStripArc( cur.LookupName() ) + plural + NL; + Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.LookupStripArc(cur.LookupName()) + plural + NL; } } else { - Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.LookupStripArc( cur.LookupName() ) + plural + NL; + Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.LookupStripArc(cur.LookupName()) + plural + NL; } } else { - Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + FileCommon.LookupStripArc( cur.CritName() ) + plural + NL; + Armament += " " + numthistype + " " + cur.GetManufacturer() + " " + + FileCommon.LookupStripArc(cur.CritName()) + plural + NL; } } // find the next weapon type and set it to current cur = null; numthistype = 0; - for( int j = 0; j < weapons.length; j++ ) { - if( weapons[j] != null ) { - cur = weapons[j]; - weapons[j] = null; + for (int j = 0; j < weapons.size(); j++) { + if (weapons.get(j) != null) { + cur = weapons.get(j); + weapons.set(j, null); numthistype = 1; break; } } // do we need to continue? - if( cur == null ) { break; } + if (cur == null) { + break; + } } - if( CurMech.IsOmnimech() ) { - Armament += " " + ( CurMech.GetTonnage() - CurMech.GetCurrentTons() ) + " tons of pod space." + NL; + if (CurMech.IsOmnimech()) { + Armament += " " + (CurMech.GetTonnage() - CurMech.GetCurrentTons()) + " tons of pod space." + NL; } // all done @@ -572,8 +734,8 @@ private String GetArmament() { private String GetHSType() { String retval = CurMech.GetHeatSinks().GetCurrentState().LookupName(); - if( CurMech.GetTechBase() == AvailableCode.TECH_BOTH ) { - if( CurMech.GetHeatSinks().GetTechBase() == AvailableCode.TECH_CLAN ) { + if (CurMech.GetTechBase() == AvailableCode.TECH_BOTH) { + if (CurMech.GetHeatSinks().GetTechBase() == AvailableCode.TECH_CLAN) { retval = "(CL) " + retval; } else { retval = "(IS) " + retval; @@ -583,34 +745,33 @@ private String GetHSType() { } private String GetHSNum() { - // provides a formated heat sink dissipation string + // provides a formated heat sink dissipation string int extraDHS = 0; boolean isProto = CurMech.GetHeatSinks().IsProtoDHS(); ArrayList equipment = CurMech.GetLoadout().GetEquipment(); - - for (int i = 0; i < equipment.size(); i++){ - if (equipment.get(i) instanceof EquipmentProtoSuccWarsDoubleHeatSink){ + + for (int i = 0; i < equipment.size(); i++) { + if (equipment.get(i) instanceof EquipmentProtoSuccWarsDoubleHeatSink) { extraDHS += 1; - } else if (equipment.get(i) instanceof EquipmentProtoStarLeagueDoubleHeatSink){ + } else if (equipment.get(i) instanceof EquipmentProtoStarLeagueDoubleHeatSink) { extraDHS += 1; } } - - if (isProto || extraDHS != 0){ + + if (isProto || extraDHS != 0) { int numberOfHS = CurMech.GetHeatSinks().GetNumHS(); int internalHS = CurMech.GetHeatSinks().InternalHeatSinks(); int singles; int doubles; - if (isProto) - { + if (isProto) { singles = numberOfHS < internalHS ? numberOfHS : internalHS; doubles = (numberOfHS - singles) + extraDHS; } else { singles = numberOfHS; doubles = extraDHS; - } + } return singles + " + " + doubles + "(" + CurMech.GetHeatSinks().TotalDissipation() + ")"; - } else if( CurMech.GetHeatSinks().IsDouble() ) { + } else if (CurMech.GetHeatSinks().IsDouble()) { return CurMech.GetHeatSinks().GetNumHS() + "(" + CurMech.GetHeatSinks().TotalDissipation() + ")"; } else { return "" + CurMech.GetHeatSinks().GetNumHS(); @@ -619,102 +780,106 @@ private String GetHSNum() { private String BuildEquipmentBlock() { // this routine builds the big equipment block at the bottom of the file -// String retval = "Equipment Location Critical Mass " + NL; + // String retval = "Equipment Location Critical Mass " + NL; String loc = ""; String crits = ""; ArrayList v = (ArrayList) CurMech.GetLoadout().GetNonCore().clone(); // add in MASC and the targeting computer if needed. - if( CurMech.GetPhysEnhance().IsMASC() ) { - v.add( CurMech.GetPhysEnhance() ); + if (CurMech.GetPhysEnhance().IsMASC()) { + v.add(CurMech.GetPhysEnhance()); } - if( CurMech.UsingTC() ) { - v.add( CurMech.GetTC() ); + if (CurMech.UsingTC()) { + v.add(CurMech.GetTC()); } - if( CurMech.HasCommandConsole() ) { - v.add( CurMech.GetCommandConsole() ); + if (CurMech.HasCommandConsole()) { + v.add(CurMech.GetCommandConsole()); } - if( CurMech.UsingPartialWing() ) { - v.add( CurMech.GetPartialWing() ); + if (CurMech.UsingPartialWing()) { + v.add(CurMech.GetPartialWing()); } - if( CurMech.GetLoadout().HasSupercharger() ) { - v.add( CurMech.GetLoadout().GetSupercharger() ); + if (CurMech.GetLoadout().HasSupercharger()) { + v.add(CurMech.GetLoadout().GetSupercharger()); } - if( CurMech.GetLoadout().HasBoobyTrap() ) { - v.add( CurMech.GetLoadout().GetBoobyTrap() ); + if (CurMech.GetLoadout().HasBoobyTrap()) { + v.add(CurMech.GetLoadout().GetBoobyTrap()); } - if( CurMech.IsQuad() ) { - if( CurMech.HasLegAES() ) { - v.add( CurMech.GetRAAES() ); - v.add( CurMech.GetLAAES() ); - v.add( CurMech.GetRLAES() ); - v.add( CurMech.GetLLAES() ); + if (CurMech.IsQuad()) { + if (CurMech.HasLegAES()) { + v.add(CurMech.GetRAAES()); + v.add(CurMech.GetLAAES()); + v.add(CurMech.GetRLAES()); + v.add(CurMech.GetLLAES()); } } else { - if( CurMech.HasRAAES() ) { - v.add( CurMech.GetRAAES() ); + if (CurMech.HasRAAES()) { + v.add(CurMech.GetRAAES()); } - if( CurMech.HasLAAES() ){ - v.add( CurMech.GetLAAES() ); + if (CurMech.HasLAAES()) { + v.add(CurMech.GetLAAES()); } - if( CurMech.HasLegAES() ) { - v.add( CurMech.GetRLAES() ); - v.add( CurMech.GetLLAES() ); + if (CurMech.HasLegAES()) { + v.add(CurMech.GetRLAES()); + v.add(CurMech.GetLLAES()); } } - if( v.size() < 1 ) { return ""; } + if (v.size() < 1) { + return ""; + } String retval = "================================================================================" + NL; retval += "Equipment Location Heat Critical Mass " + NL; retval += "--------------------------------------------------------------------------------" + NL; // now sort the equipment by location - v = FileCommon.SortEquipmentForStats( CurMech, v ); + v = FileCommon.SortEquipmentForStats(CurMech, v); // turn the equipment into an array abPlaceable[] equips = new abPlaceable[v.size()]; - for( int i = 0; i < v.size(); i++ ) { - equips[i] = (abPlaceable) v.get( i ); + for (int i = 0; i < v.size(); i++) { + equips[i] = (abPlaceable) v.get(i); } // we'll want to consolidate equipment within locations. int numthisloc = 1; abPlaceable cur = equips[0]; equips[0] = null; -/* - if( equips.length <= 1 ) { - retval += ProcessEquipStatLines( cur, FileCommon.EncodeLocation( CurMech.GetLoadout().Find( cur ), CurMech.IsQuad() ), "" + cur.NumCrits(), 1 ); - return retval; - } -*/ + /* + * if( equips.length <= 1 ) { retval += ProcessEquipStatLines( cur, + * FileCommon.EncodeLocation( CurMech.GetLoadout().Find( cur ), CurMech.IsQuad() + * ), "" + cur.NumCrits(), 1 ); return retval; } + */ // count up individual weapons and build their string - for( int i = 1; i <= equips.length; i++ ) { + for (int i = 1; i <= equips.length; i++) { // find any other weapons of this type - if( cur.CanSplit() |! cur.Contiguous() || cur instanceof MGArray ) { + if (cur.CanSplit() | !cur.Contiguous() || cur instanceof MGArray) { // splittable items are generally too big for two in one - // location or are split into different areas. just avoid. - int[] check = CurMech.GetLoadout().FindInstances( cur ); - loc = FileCommon.EncodeLocations( check, CurMech.IsQuad() ); - crits = FileCommon.DecodeCrits( check ); - retval += ProcessEquipStatLines( cur, loc, crits, 1 ); + // location or are split into different areas. just avoid. + int[] check = CurMech.GetLoadout().FindInstances(cur); + loc = FileCommon.EncodeLocations(check, CurMech.IsQuad()); + crits = FileCommon.DecodeCrits(check); + retval += ProcessEquipStatLines(cur, loc, crits, 1); } else { - int locint = CurMech.GetLoadout().Find( cur ); - for( int j = 0; j < equips.length; j++ ) { - if( equips[j] != null ) { - if( cur instanceof Equipment ) { - if( ((Equipment) cur).IsVariableSize() ) { - if( equips[j].CritName().equals( cur.CritName() ) && CurMech.GetLoadout().Find( equips[j] ) == locint ) { + int locint = CurMech.GetLoadout().Find(cur); + for (int j = 0; j < equips.length; j++) { + if (equips[j] != null) { + if (cur instanceof Equipment) { + if (((Equipment) cur).IsVariableSize()) { + if (equips[j].CritName().equals(cur.CritName()) + && CurMech.GetLoadout().Find(equips[j]) == locint) { numthisloc++; equips[j] = null; } } else { - if( equips[j].LookupName().equals( cur.LookupName() ) && CurMech.GetLoadout().Find( equips[j] ) == locint ) { + if (equips[j].LookupName().equals(cur.LookupName()) + && CurMech.GetLoadout().Find(equips[j]) == locint) { numthisloc++; equips[j] = null; } } } else { - if( equips[j].LookupName().equals( cur.LookupName() ) && CurMech.GetLoadout().Find( equips[j] ) == locint ) { + if (equips[j].LookupName().equals(cur.LookupName()) + && CurMech.GetLoadout().Find(equips[j]) == locint) { numthisloc++; equips[j] = null; } @@ -722,21 +887,21 @@ private String BuildEquipmentBlock() { } } - if( numthisloc > 1) { - crits = "" + ( cur.NumCrits() * numthisloc ); + if (numthisloc > 1) { + crits = "" + (cur.NumCrits() * numthisloc); } else { crits = "" + cur.NumCrits(); } - loc = FileCommon.EncodeLocation( locint, CurMech.IsQuad() ); + loc = FileCommon.EncodeLocation(locint, CurMech.IsQuad()); // add the current weapon to the armament string - retval += ProcessEquipStatLines( cur, loc, crits, numthisloc ); + retval += ProcessEquipStatLines(cur, loc, crits, numthisloc); } // find the next weapon type and set it to current cur = null; numthisloc = 0; - for( int j = 0; j < equips.length; j++ ) { - if( equips[j] != null ) { + for (int j = 0; j < equips.length; j++) { + if (equips[j] != null) { cur = equips[j]; equips[j] = null; numthisloc = 1; @@ -745,91 +910,122 @@ private String BuildEquipmentBlock() { } // do we need to continue? - if( cur == null ) { break; } + if (cur == null) { + break; + } } // add in any special systems boolean Special = false; - if( CurMech.GetBaseLoadout().HasHDTurret() ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, FileCommon.GetExportName( CurMech, CurMech.GetBaseLoadout().GetHDTurret() ), "CT", "-", 1, CurMech.GetBaseLoadout().GetHDTurret().GetTonnage() ) + NL; - } - if( CurMech.GetBaseLoadout().HasLTTurret() ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, FileCommon.GetExportName( CurMech, CurMech.GetBaseLoadout().GetLTTurret() ), "LT", "-", 1, CurMech.GetBaseLoadout().GetLTTurret().GetTonnage() ) + NL; - } - if( CurMech.GetBaseLoadout().HasRTTurret() ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, FileCommon.GetExportName( CurMech, CurMech.GetBaseLoadout().GetRTTurret() ), "RT", "-", 1, CurMech.GetBaseLoadout().GetRTTurret().GetTonnage() ) + NL; - } - if( CurMech.HasNullSig() ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, CurMech.GetNullSig().CritName(), "*", "10", 7, 0.0 ) + NL; + if (CurMech.GetBaseLoadout().HasHDTurret()) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, + FileCommon.GetExportName(CurMech, CurMech.GetBaseLoadout().GetHDTurret()), "CT", "-", 1, + CurMech.GetBaseLoadout().GetHDTurret().GetTonnage()) + NL; + } + if (CurMech.GetBaseLoadout().HasLTTurret()) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, + FileCommon.GetExportName(CurMech, CurMech.GetBaseLoadout().GetLTTurret()), "LT", "-", 1, + CurMech.GetBaseLoadout().GetLTTurret().GetTonnage()) + NL; + } + if (CurMech.GetBaseLoadout().HasRTTurret()) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, + FileCommon.GetExportName(CurMech, CurMech.GetBaseLoadout().GetRTTurret()), "RT", "-", 1, + CurMech.GetBaseLoadout().GetRTTurret().GetTonnage()) + NL; + } + if (CurMech.HasNullSig()) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, CurMech.GetNullSig().CritName(), "*", + "10", 7, 0.0) + NL; Special = true; } - if( CurMech.HasVoidSig() ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, CurMech.GetVoidSig().CritName(), "*", "10", 7, 0.0 ) + NL; + if (CurMech.HasVoidSig()) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, CurMech.GetVoidSig().CritName(), "*", + "10", 7, 0.0) + NL; Special = true; } - if( CurMech.HasChameleon() ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, CurMech.GetChameleon().CritName(), "*", "6", 6, 0.0 ) + NL; + if (CurMech.HasChameleon()) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, CurMech.GetChameleon().CritName(), "*", + "6", 6, 0.0) + NL; Special = true; } - if( CurMech.HasBlueShield() ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, CurMech.GetBlueShield().CritName(), "*", "-", 7, 3.0 ) + NL; + if (CurMech.HasBlueShield()) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, CurMech.GetBlueShield().CritName(), + "*", "-", 7, 3.0) + NL; Special = true; } - if( CurMech.UsingJumpBooster() ) { - if( CurMech.IsQuad() ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, FileCommon.GetExportName( CurMech, CurMech.GetJumpBooster() ), "*", "-", 8, CurMech.GetJumpBooster().GetTonnage() ) + NL; + if (CurMech.UsingJumpBooster()) { + if (CurMech.IsQuad()) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, + FileCommon.GetExportName(CurMech, CurMech.GetJumpBooster()), "*", "-", 8, + CurMech.GetJumpBooster().GetTonnage()) + NL; } else { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, FileCommon.GetExportName( CurMech, CurMech.GetJumpBooster() ), "*", "-", 4, CurMech.GetJumpBooster().GetTonnage() ) + NL; + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, + FileCommon.GetExportName(CurMech, CurMech.GetJumpBooster()), "*", "-", 4, + CurMech.GetJumpBooster().GetTonnage()) + NL; } Special = true; } - if( CurMech.HasEnviroSealing() ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, CurMech.GetEnviroSealing().CritName(), "*", "-", 8, 0.0 ) + NL; + if (CurMech.HasEnviroSealing()) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, CurMech.GetEnviroSealing().CritName(), + "*", "-", 8, 0.0) + NL; Special = true; } - if( CurMech.HasTracks() ) { - if( CurMech.IsQuad() ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, FileCommon.GetExportName( CurMech, CurMech.GetTracks() ), "*", "-", 4, CurMech.GetTracks().GetTonnage() ) + NL; + if (CurMech.HasTracks()) { + if (CurMech.IsQuad()) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, + FileCommon.GetExportName(CurMech, CurMech.GetTracks()), "*", "-", 4, + CurMech.GetTracks().GetTonnage()) + NL; } else { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, FileCommon.GetExportName( CurMech, CurMech.GetTracks() ), "*", "-", 2, CurMech.GetTracks().GetTonnage() ) + NL; + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, + FileCommon.GetExportName(CurMech, CurMech.GetTracks()), "*", "-", 2, + CurMech.GetTracks().GetTonnage()) + NL; } Special = true; } - retval += String.format( "%1$s %2$-2s", " Free Critical Slots:", CurMech.GetLoadout().FreeCrits() + NL ); + retval += String.format("%1$s %2$-2s", " Free Critical Slots:", + CurMech.GetLoadout().FreeCrits() + NL); - if( Special ) { + if (Special) { retval += NL; } // add in the equipment footers if needed - if( CurMech.HasNullSig() ) { - retval += "* The " + CurMech.GetNullSig().LookupName() + " occupies 1 slot in every location except the HD." + NL; + if (CurMech.HasNullSig()) { + retval += "* The " + CurMech.GetNullSig().LookupName() + " occupies 1 slot in every location except the HD." + + NL; } - if( CurMech.HasVoidSig() ) { - retval += "* The " + CurMech.GetVoidSig().LookupName() + " occupies 1 slot in every location except the HD." + NL; + if (CurMech.HasVoidSig()) { + retval += "* The " + CurMech.GetVoidSig().LookupName() + " occupies 1 slot in every location except the HD." + + NL; } - if( CurMech.HasChameleon() ) { - retval += "* The " + CurMech.GetChameleon().LookupName() + " occupies 1 slot in every location except the HD and CT." + NL; + if (CurMech.HasChameleon()) { + retval += "* The " + CurMech.GetChameleon().LookupName() + + " occupies 1 slot in every location except the HD and CT." + NL; } - if( CurMech.HasBlueShield() ) { - retval += "* The " + CurMech.GetBlueShield().LookupName() + " occupies 1 slot in every location except the HD." + NL; + if (CurMech.HasBlueShield()) { + retval += "* The " + CurMech.GetBlueShield().LookupName() + + " occupies 1 slot in every location except the HD." + NL; } - if( CurMech.UsingJumpBooster() ) { + if (CurMech.UsingJumpBooster()) { retval += "* The " + CurMech.GetJumpBooster().LookupName() + " occupies 2 slots in each leg." + NL; } - if( CurMech.HasEnviroSealing() ) { + if (CurMech.HasEnviroSealing()) { retval += "* The " + CurMech.GetEnviroSealing().LookupName() + " occupies 1 slot in every location." + NL; } - if( CurMech.HasTracks() ) { + if (CurMech.HasTracks()) { retval += "* " + CurMech.GetTracks().LookupName() + " occupy 1 slot in every leg location." + NL; } - BattleForceStats bfs = new BattleForceStats( CurMech ); - int [] BFdmg = CurMech.GetBFDamage( bfs ); + BattleForceStats bfs = new BattleForceStats(CurMech); + int[] BFdmg = CurMech.GetBFDamage(bfs); retval += NL + "BattleForce Statistics" + NL; - retval += String.format( "MV S (+0) M (+2) L (+4) E (+6) Wt. Ov Armor: %1$2s Points: " + CurMech.GetBFPoints(), CurMech.GetBFArmor() ) + NL; - retval += String.format( "%1$-6s %2$2s %3$2s %4$2s %5$2s %6$1s %7$1s Structure: %8$2s", BattleForceTools.GetMovementString( CurMech ), BFdmg[BFConstants.BF_SHORT], BFdmg[BFConstants.BF_MEDIUM], BFdmg[BFConstants.BF_LONG], BFdmg[BFConstants.BF_EXTREME], CurMech.GetBFSize(), BFdmg[BFConstants.BF_OV], CurMech.GetBFStructure() ) + NL; + retval += String.format("MV S (+0) M (+2) L (+4) E (+6) Wt. Ov Armor: %1$2s Points: " + + CurMech.GetBFPoints(), CurMech.GetBFArmor()) + NL; + retval += String.format( + "%1$-6s %2$2s %3$2s %4$2s %5$2s %6$1s %7$1s Structure: %8$2s", + BattleForceTools.GetMovementString(CurMech), BFdmg[BFConstants.BF_SHORT], BFdmg[BFConstants.BF_MEDIUM], + BFdmg[BFConstants.BF_LONG], BFdmg[BFConstants.BF_EXTREME], CurMech.GetBFSize(), + BFdmg[BFConstants.BF_OV], CurMech.GetBFStructure()) + NL; retval += "Special Abilities: " + bfs.getAbilitiesString() + NL; return retval; @@ -842,137 +1038,157 @@ private String BuildOmniLoadout() { String crits = ""; ArrayList v = (ArrayList) CurMech.GetLoadout().GetNonCore().clone(); - retval += String.format( "Loadout Name: %1$-46s Cost: %2$,.0f", CurMech.GetLoadout().GetName(), Math.floor( CurMech.GetTotalCost() + 0.5 ) ) + NL; - retval += String.format( "Tech Rating/Era Availability: %1$-31s BV2: %2$,d", CurMech.GetAvailability().GetBestCombinedCode(), CurMech.GetCurrentBV() ) + NL; - if( CurMech.GetBaseRulesLevel() != CurMech.GetLoadout().GetRulesLevel() ) { - if( CurMech.GetBaseTechbase() != CurMech.GetLoadout().GetTechBase() ) { - retval += String.format( "Rules Level: %1$-42s %2$s", CommonTools.GetRulesLevelString( CurMech.GetLoadout().GetRulesLevel() ), "Tech Base: " + CommonTools.GetTechbaseString( CurMech.GetLoadout().GetTechBase() ) ) + NL; + retval += String.format("Loadout Name: %1$-46s Cost: %2$,.0f", CurMech.GetLoadout().GetName(), + Math.floor(CurMech.GetTotalCost() + 0.5)) + NL; + retval += String.format("Tech Rating/Era Availability: %1$-31s BV2: %2$,d", + CurMech.GetAvailability().GetBestCombinedCode(), CurMech.GetCurrentBV()) + NL; + if (CurMech.GetBaseRulesLevel() != CurMech.GetLoadout().GetRulesLevel()) { + if (CurMech.GetBaseTechbase() != CurMech.GetLoadout().GetTechBase()) { + retval += String.format("Rules Level: %1$-42s %2$s", + CommonTools.GetRulesLevelString(CurMech.GetLoadout().GetRulesLevel()), + "Tech Base: " + CommonTools.GetTechbaseString(CurMech.GetLoadout().GetTechBase())) + NL; } else { - retval += "Rules Level: " + CommonTools.GetRulesLevelString( CurMech.GetLoadout().GetRulesLevel() ) + NL; + retval += "Rules Level: " + CommonTools.GetRulesLevelString(CurMech.GetLoadout().GetRulesLevel()) + NL; } } // build the starting block for the loadout information retval += NL + "Equipment Type Rating Mass " + NL; retval += "--------------------------------------------------------------------------------" + NL; - if( CurMech.GetJumpJets().GetNumJJ() > 0 ) { - if( CurMech.GetJumpJets().IsImproved() ) { - if( CurMech.GetAdjustedJumpingMP( false ) != CurMech.GetJumpJets().GetNumJJ() ) { - retval += " Jumping MP: " + CurMech.GetJumpJets().GetNumJJ() + " (" + CurMech.GetAdjustedJumpingMP( false ) + ") (Improved)" + NL; + if (CurMech.GetJumpJets().GetNumJJ() > 0) { + if (CurMech.GetJumpJets().IsImproved()) { + if (CurMech.GetAdjustedJumpingMP(false) != CurMech.GetJumpJets().GetNumJJ()) { + retval += " Jumping MP: " + CurMech.GetJumpJets().GetNumJJ() + " (" + + CurMech.GetAdjustedJumpingMP(false) + ") (Improved)" + NL; } else { retval += " Jumping MP: " + CurMech.GetJumpJets().GetNumJJ() + " (Improved)" + NL; } } else { - if( CurMech.GetJumpJets().IsUMU() ) { + if (CurMech.GetJumpJets().IsUMU()) { retval += " Jumping MP: " + CurMech.GetJumpJets().GetNumJJ() + " (UMU)" + NL; } else { - if( CurMech.GetAdjustedJumpingMP( false ) != CurMech.GetJumpJets().GetNumJJ() ) { - retval += " Jumping MP: " + CurMech.GetJumpJets().GetNumJJ() + " (" + CurMech.GetAdjustedJumpingMP( false ) + ") (Standard)" + NL; + if (CurMech.GetAdjustedJumpingMP(false) != CurMech.GetJumpJets().GetNumJJ()) { + retval += " Jumping MP: " + CurMech.GetJumpJets().GetNumJJ() + " (" + + CurMech.GetAdjustedJumpingMP(false) + ") (Standard)" + NL; } else { retval += " Jumping MP: " + CurMech.GetJumpJets().GetNumJJ() + " (Standard)" + NL; } } } } - if( CurMech.GetJumpJets().GetNumJJ() > 0 ) { - retval += String.format( " %1$-68s %2$6.2f", "Jump Jet Locations: " + FileCommon.GetJumpJetLocations( CurMech ), CurMech.GetJumpJets().GetOmniTonnage() ) + NL; + if (CurMech.GetJumpJets().GetNumJJ() > 0) { + retval += String.format(" %1$-68s %2$6.2f", + "Jump Jet Locations: " + FileCommon.GetJumpJetLocations(CurMech), + CurMech.GetJumpJets().GetOmniTonnage()) + NL; } - if( CurMech.GetHeatSinks().GetNumHS() > CurMech.GetHeatSinks().GetBaseLoadoutNumHS() ) { - retval += String.format( "Heat Sinks: %1$-28s %2$-8s %3" + tformat, GetHSType(), GetHSNum(), CurMech.GetHeatSinks().GetOmniTonnage() ) + NL; - if( CurMech.GetHeatSinks().GetNumHS() > CurMech.GetEngine().InternalHeatSinks() ) { - retval += " Heat Sink Locations: " + FileCommon.GetHeatSinkLocations( CurMech ) + NL; + if (CurMech.GetHeatSinks().GetNumHS() > CurMech.GetHeatSinks().GetBaseLoadoutNumHS()) { + retval += String.format("Heat Sinks: %1$-28s %2$-8s %3" + tformat, GetHSType(), + GetHSNum(), CurMech.GetHeatSinks().GetOmniTonnage()) + NL; + if (CurMech.GetHeatSinks().GetNumHS() > CurMech.GetEngine().InternalHeatSinks()) { + retval += " Heat Sink Locations: " + FileCommon.GetHeatSinkLocations(CurMech) + NL; } } - if( CurMech.GetLoadout().IsUsingClanCASE() ) { + if (CurMech.GetLoadout().IsUsingClanCASE()) { int[] Locs = CurMech.GetLoadout().FindExplosiveInstances(); boolean check = false; - for( int i = 0; i < Locs.length; i++ ) { - if( Locs[i] > 0 ) { + for (int i = 0; i < Locs.length; i++) { + if (Locs[i] > 0) { check = true; } } - if( check ) { - retval += String.format( " %1$-68s %2" + tformat, "CASE Locations: " + FileCommon.GetCaseLocations( CurMech ), CurMech.GetCaseTonnage() ) + NL; + if (check) { + retval += String.format(" %1$-68s %2" + tformat, + "CASE Locations: " + FileCommon.GetCaseLocations(CurMech), CurMech.GetCaseTonnage()) + NL; } } else { - if( CurMech.GetCaseTonnage() != 0.0f ) { - retval += String.format( " %1$-68s %2" + tformat, "CASE Locations: " + FileCommon.GetCaseLocations( CurMech ), CurMech.GetCaseTonnage() ) + NL; + if (CurMech.GetCaseTonnage() != 0.0f) { + retval += String.format(" %1$-68s %2" + tformat, + "CASE Locations: " + FileCommon.GetCaseLocations(CurMech), CurMech.GetCaseTonnage()) + NL; } } - if( CurMech.GetCASEIITonnage() != 0.0f ) { - retval += String.format( " %1$-68s %2" + tformat, "CASE II Locations: " + FileCommon.GetCaseIILocations( CurMech ), CurMech.GetCASEIITonnage() ) + NL; + if (CurMech.GetCASEIITonnage() != 0.0f) { + retval += String.format(" %1$-68s %2" + tformat, + "CASE II Locations: " + FileCommon.GetCaseIILocations(CurMech), CurMech.GetCASEIITonnage()) + NL; } - if( ! CurMech.GetEngine().IsNuclear() ) { - if( CurMech.GetLoadout().GetPowerAmplifier().GetTonnage() > 0 ) { - retval += String.format( "%1$-72s %2" + tformat, "Power Amplifiers:", CurMech.GetLoadout().GetPowerAmplifier().GetTonnage() ) + NL; + if (!CurMech.GetEngine().IsNuclear()) { + if (CurMech.GetLoadout().GetPowerAmplifier().GetTonnage() > 0) { + retval += String.format("%1$-72s %2" + tformat, "Power Amplifiers:", + CurMech.GetLoadout().GetPowerAmplifier().GetTonnage()) + NL; } } - retval += " Actuators: " + FileCommon.BuildActuators( CurMech, false ) + NL; + retval += " Actuators: " + FileCommon.BuildActuators(CurMech, false) + NL; // add in MASC and the targeting computer if needed. - if( CurMech.GetPhysEnhance().IsMASC() ) { - v.add( CurMech.GetPhysEnhance() ); + if (CurMech.GetPhysEnhance().IsMASC()) { + v.add(CurMech.GetPhysEnhance()); } - if( CurMech.UsingTC() ) { - v.add( CurMech.GetTC() ); + if (CurMech.UsingTC()) { + v.add(CurMech.GetTC()); } - if( CurMech.GetLoadout().HasSupercharger() ) { - v.add( CurMech.GetLoadout().GetSupercharger() ); + if (CurMech.GetLoadout().HasSupercharger()) { + v.add(CurMech.GetLoadout().GetSupercharger()); } // now sort the equipment by location - v = FileCommon.SortEquipmentForStats( CurMech, v ); + v = FileCommon.SortEquipmentForStats(CurMech, v); // turn the equipment into an array abPlaceable[] equips = new abPlaceable[v.size()]; - for( int i = 0; i < v.size(); i++ ) { - equips[i] = (abPlaceable) v.get( i ); + for (int i = 0; i < v.size(); i++) { + equips[i] = (abPlaceable) v.get(i); } // the basic equipment block header retval += NL + "Equipment Location Heat Critical Mass " + NL; retval += "--------------------------------------------------------------------------------" + NL; - if( equips.length < 1 ) { return retval; } + if (equips.length < 1) { + return retval; + } // we'll want to consolidate equipment within locations. int numthisloc = 1; abPlaceable cur = equips[0]; equips[0] = null; - if( equips.length <= 1 ) { - retval += ProcessEquipStatLines( cur, FileCommon.EncodeLocation( CurMech.GetLoadout().Find( cur ), CurMech.IsQuad() ), "" + cur.NumCrits(), 1 ); + if (equips.length <= 1) { + retval += ProcessEquipStatLines(cur, + FileCommon.EncodeLocation(CurMech.GetLoadout().Find(cur), CurMech.IsQuad()), "" + cur.NumCrits(), + 1); return retval; } // count up individual weapons and build their string - for( int i = 1; i <= equips.length; i++ ) { + for (int i = 1; i <= equips.length; i++) { // find any other weapons of this type - if( cur.CanSplit() |! cur.Contiguous() || cur instanceof MGArray ) { + if (cur.CanSplit() | !cur.Contiguous() || cur instanceof MGArray) { // splittable items are generally too big for two in one - // location or are split into different areas. just avoid. - int[] check = CurMech.GetLoadout().FindInstances( cur ); - loc = FileCommon.EncodeLocations( check, CurMech.IsQuad() ); - crits = FileCommon.DecodeCrits( check ); - retval += ProcessEquipStatLines( cur, loc, crits, 1 ); + // location or are split into different areas. just avoid. + int[] check = CurMech.GetLoadout().FindInstances(cur); + loc = FileCommon.EncodeLocations(check, CurMech.IsQuad()); + crits = FileCommon.DecodeCrits(check); + retval += ProcessEquipStatLines(cur, loc, crits, 1); } else { - int locint = CurMech.GetLoadout().Find( cur ); - for( int j = 0; j < equips.length; j++ ) { - if( equips[j] != null ) { - if( cur instanceof Equipment ) { - if( ((Equipment) cur).IsVariableSize() ) { - if( equips[j].CritName().equals( cur.CritName() ) && CurMech.GetLoadout().Find( equips[j] ) == locint ) { + int locint = CurMech.GetLoadout().Find(cur); + for (int j = 0; j < equips.length; j++) { + if (equips[j] != null) { + if (cur instanceof Equipment) { + if (((Equipment) cur).IsVariableSize()) { + if (equips[j].CritName().equals(cur.CritName()) + && CurMech.GetLoadout().Find(equips[j]) == locint) { numthisloc++; equips[j] = null; } } else { - if( equips[j].LookupName().equals( cur.LookupName() ) && CurMech.GetLoadout().Find( equips[j] ) == locint ) { + if (equips[j].LookupName().equals(cur.LookupName()) + && CurMech.GetLoadout().Find(equips[j]) == locint) { numthisloc++; equips[j] = null; } } } else { - if( equips[j].LookupName().equals( cur.LookupName() ) && CurMech.GetLoadout().Find( equips[j] ) == locint ) { + if (equips[j].LookupName().equals(cur.LookupName()) + && CurMech.GetLoadout().Find(equips[j]) == locint) { numthisloc++; equips[j] = null; } @@ -980,21 +1196,21 @@ private String BuildOmniLoadout() { } } - if( numthisloc > 1) { - crits = "" + ( cur.NumCrits() * numthisloc ); + if (numthisloc > 1) { + crits = "" + (cur.NumCrits() * numthisloc); } else { crits = "" + cur.NumCrits(); } - loc = FileCommon.EncodeLocation( locint, CurMech.IsQuad() ); + loc = FileCommon.EncodeLocation(locint, CurMech.IsQuad()); // add the current weapon to the armament string - retval += ProcessEquipStatLines( cur, loc, crits, numthisloc ); + retval += ProcessEquipStatLines(cur, loc, crits, numthisloc); } // find the next weapon type and set it to current cur = null; numthisloc = 0; - for( int j = 0; j < equips.length; j++ ) { - if( equips[j] != null ) { + for (int j = 0; j < equips.length; j++) { + if (equips[j] != null) { cur = equips[j]; equips[j] = null; numthisloc = 1; @@ -1003,25 +1219,39 @@ private String BuildOmniLoadout() { } // do we need to continue? - if( cur == null ) { break; } + if (cur == null) { + break; + } } - if( CurMech.GetLoadout().HasHDTurret() ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, FileCommon.GetExportName( CurMech, CurMech.GetLoadout().GetHDTurret() ), "CT", "-", 1, CurMech.GetLoadout().GetHDTurret().GetTonnage() ) + NL; + if (CurMech.GetLoadout().HasHDTurret()) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, + FileCommon.GetExportName(CurMech, CurMech.GetLoadout().GetHDTurret()), "CT", "-", 1, + CurMech.GetLoadout().GetHDTurret().GetTonnage()) + NL; } - if( CurMech.GetLoadout().HasLTTurret() ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, FileCommon.GetExportName( CurMech, CurMech.GetLoadout().GetLTTurret() ), "LT", "-", 1, CurMech.GetLoadout().GetLTTurret().GetTonnage() ) + NL; + if (CurMech.GetLoadout().HasLTTurret()) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, + FileCommon.GetExportName(CurMech, CurMech.GetLoadout().GetLTTurret()), "LT", "-", 1, + CurMech.GetLoadout().GetLTTurret().GetTonnage()) + NL; } - if( CurMech.GetLoadout().HasRTTurret() ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, FileCommon.GetExportName( CurMech, CurMech.GetLoadout().GetRTTurret() ), "RT", "-", 1, CurMech.GetLoadout().GetRTTurret().GetTonnage() ) + NL; + if (CurMech.GetLoadout().HasRTTurret()) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, + FileCommon.GetExportName(CurMech, CurMech.GetLoadout().GetRTTurret()), "RT", "-", 1, + CurMech.GetLoadout().GetRTTurret().GetTonnage()) + NL; } - retval += String.format( "%1$s %2$-2s", " Free Critical Slots:", CurMech.GetLoadout().FreeCrits() + NL ); + retval += String.format("%1$s %2$-2s", " Free Critical Slots:", + CurMech.GetLoadout().FreeCrits() + NL); - BattleForceStats bfs = new BattleForceStats( CurMech ); - int [] BFdmg = CurMech.GetBFDamage( bfs ); + BattleForceStats bfs = new BattleForceStats(CurMech); + int[] BFdmg = CurMech.GetBFDamage(bfs); retval += NL + "BattleForce Statistics" + NL; - retval += String.format( "MV S (+0) M (+2) L (+4) E (+6) Wt. Ov Armor: %1$2s Points: " + CurMech.GetBFPoints(), CurMech.GetBFArmor() ) + NL; - retval += String.format( "%1$-6s %2$2s %3$2s %4$2s %5$2s %6$1s %7$1s Structure: %8$2s", BattleForceTools.GetMovementString( CurMech ), BFdmg[BFConstants.BF_SHORT], BFdmg[BFConstants.BF_MEDIUM], BFdmg[BFConstants.BF_LONG], BFdmg[BFConstants.BF_EXTREME], CurMech.GetBFSize(), BFdmg[BFConstants.BF_OV], CurMech.GetBFStructure() ) + NL; + retval += String.format("MV S (+0) M (+2) L (+4) E (+6) Wt. Ov Armor: %1$2s Points: " + + CurMech.GetBFPoints(), CurMech.GetBFArmor()) + NL; + retval += String.format( + "%1$-6s %2$2s %3$2s %4$2s %5$2s %6$1s %7$1s Structure: %8$2s", + BattleForceTools.GetMovementString(CurMech), BFdmg[BFConstants.BF_SHORT], BFdmg[BFConstants.BF_MEDIUM], + BFdmg[BFConstants.BF_LONG], BFdmg[BFConstants.BF_EXTREME], CurMech.GetBFSize(), + BFdmg[BFConstants.BF_OV], CurMech.GetBFStructure()) + NL; retval += "Special Abilities: " + bfs.getAbilitiesString() + NL; return retval; @@ -1029,126 +1259,124 @@ private String BuildOmniLoadout() { private String BuildComputerBlock() { String retval = ""; -/* - abPlaceable ECM = FileCommon.HasECM( CurMech ); - abPlaceable BAP = FileCommon.HasBAP( CurMech ); - Object[] C3 = FileCommon.HasC3( CurMech ); -*/ + /* + * abPlaceable ECM = FileCommon.HasECM( CurMech ); abPlaceable BAP = + * FileCommon.HasBAP( CurMech ); Object[] C3 = FileCommon.HasC3( CurMech ); + */ // start communications system line retval += "Communications System: " + CurMech.GetCommSystem() + NL; -/* - if( ! ( ECM instanceof EmptyItem ) ) { - retval += NL + " w/ " + ECM.GetManufacturer() + " " + ECM.GetCritName(); - if( C3 != null ) { - for( int i = 0; i < C3.length; i++ ) { - retval += NL + " and " + ((abPlaceable) C3[i]).GetManufacturer() + " " + ((abPlaceable) C3[i]).GetCritName(); - } - } - } else { - if( C3 != null ) { - for( int i = 0; i < C3.length; i++ ) { - if( i == 0 ) { - retval += NL + " w/ " + ((abPlaceable) C3[i]).GetManufacturer() + " " + ((abPlaceable) C3[i]).GetCritName(); - } else { - retval += NL + " and " + ((abPlaceable) C3[i]).GetManufacturer() + " " + ((abPlaceable) C3[i]).GetCritName(); - } - } - } - } - retval += NL; -*/ + /* + * if( ! ( ECM instanceof EmptyItem ) ) { retval += NL + " w/ " + + * ECM.GetManufacturer() + " " + ECM.GetCritName(); if( C3 != null ) { for( int + * i = 0; i < C3.length; i++ ) { retval += NL + " and " + ((abPlaceable) + * C3[i]).GetManufacturer() + " " + ((abPlaceable) C3[i]).GetCritName(); } } } + * else { if( C3 != null ) { for( int i = 0; i < C3.length; i++ ) { if( i == 0 ) + * { retval += NL + " w/ " + ((abPlaceable) C3[i]).GetManufacturer() + " " + + * ((abPlaceable) C3[i]).GetCritName(); } else { retval += NL + " and " + + * ((abPlaceable) C3[i]).GetManufacturer() + " " + ((abPlaceable) + * C3[i]).GetCritName(); } } } } retval += NL; + */ // start targeting and tracking system line retval += "Targeting and Tracking System: " + CurMech.GetTandTSystem(); -/* if( ! ( BAP instanceof EmptyItem ) ) { - if( CurMech.UsingTC() ) { - retval += NL + " w/ " + BAP.GetManufacturer() + " " + BAP.GetCritName() + NL + " and " + CurMech.GetTC().GetCritName(); - } else { - retval += NL + " w/ " + BAP.GetManufacturer() + " " + BAP.GetCritName(); - } - } else { - if( CurMech.UsingTC() ) { - retval += NL + " w/ " + CurMech.GetTC().GetCritName(); - } - } -*/ + /* + * if( ! ( BAP instanceof EmptyItem ) ) { if( CurMech.UsingTC() ) { retval += NL + * + " w/ " + BAP.GetManufacturer() + " " + BAP.GetCritName() + NL + + * " and " + CurMech.GetTC().GetCritName(); } else { retval += NL + " w/ " + * + BAP.GetManufacturer() + " " + BAP.GetCritName(); } } else { if( + * CurMech.UsingTC() ) { retval += NL + " w/ " + + * CurMech.GetTC().GetCritName(); } } + */ return retval; } - private String ProcessEquipStatLines( abPlaceable p, String loc, String crits, int numthisloc ) { + private String ProcessEquipStatLines(abPlaceable p, String loc, String crits, int numthisloc) { String retval = ""; - String name = FileCommon.GetExportName( CurMech, p ); - if( numthisloc > 1 ) { + String name = FileCommon.GetExportName(CurMech, p); + if (numthisloc > 1) { name = numthisloc + " " + name + "s"; } // build the string based on the type of equipment - if( p instanceof Ammunition ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, FileCommon.FormatAmmoExportName( (Ammunition) p, numthisloc ), loc, "-", crits, p.GetTonnage() * numthisloc ) + NL; - } else if( p instanceof RangedWeapon ) { + if (p instanceof Ammunition) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, + FileCommon.FormatAmmoExportName((Ammunition) p, numthisloc), loc, "-", crits, + p.GetTonnage() * numthisloc) + NL; + } else if (p instanceof RangedWeapon) { double tons = p.GetTonnage(); String add = ""; - if( ((RangedWeapon) p).IsUsingFCS() ) { + if (((RangedWeapon) p).IsUsingFCS()) { abPlaceable a = (abPlaceable) ((RangedWeapon) p).GetFCS(); tons -= a.GetTonnage(); - add += String.format( " %1$-40s %2$-9s %3$-9s %4$-7s %5" + tformat, FileCommon.GetExportName( CurMech, a ), loc, "-", a.NumCrits() * numthisloc, a.GetTonnage() * numthisloc ) + NL; + add += String.format(" %1$-40s %2$-9s %3$-9s %4$-7s %5" + tformat, + FileCommon.GetExportName(CurMech, a), loc, "-", a.NumCrits() * numthisloc, + a.GetTonnage() * numthisloc) + NL; } - if( ((RangedWeapon) p).IsUsingCapacitor() ) { + if (((RangedWeapon) p).IsUsingCapacitor()) { tons -= 1.0f; abPlaceable a = ((RangedWeapon) p).GetCapacitor(); - add += String.format( " %1$-40s %2$-9s %3$-9s %4$-7s %5" + tformat, FileCommon.GetExportName( CurMech, p ), loc, numthisloc * 5 + "*", a.NumCrits(), a.GetTonnage() * numthisloc ) + NL; + add += String.format(" %1$-40s %2$-9s %3$-9s %4$-7s %5" + tformat, + FileCommon.GetExportName(CurMech, p), loc, numthisloc * 5 + "*", a.NumCrits(), + a.GetTonnage() * numthisloc) + NL; } - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, name, loc, ((RangedWeapon) p).GetHeat() * numthisloc, crits, tons * numthisloc ) + NL + add; - } else if( p instanceof MGArray ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, name, loc, "-", crits, ((MGArray) p).GetBaseTons() ) + NL; + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, name, loc, + ((RangedWeapon) p).GetHeat() * numthisloc, crits, tons * numthisloc) + NL + add; + } else if (p instanceof MGArray) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, name, loc, "-", crits, + ((MGArray) p).GetBaseTons()) + NL; abPlaceable a = ((MGArray) p).GetMGType(); - retval += String.format( " %1$-40s %2$-9s %3$-9s %4$-7s %5" + tformat, ((MGArray) p).GetNumMGs() + " " + FileCommon.GetExportName( CurMech, a ) + "s", loc, ((RangedWeapon) a).GetHeat() * ((MGArray) p).GetNumMGs(), ((MGArray) p).GetNumMGs(), ( ((MGArray) p).GetMGTons() * ((MGArray) p).GetNumMGs() ) ) + NL; - } else if( p instanceof Equipment ) { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, name, loc, ((Equipment) p).GetHeat() * numthisloc, crits, p.GetTonnage() * numthisloc ) + NL; + retval += String.format(" %1$-40s %2$-9s %3$-9s %4$-7s %5" + tformat, + ((MGArray) p).GetNumMGs() + " " + FileCommon.GetExportName(CurMech, a) + "s", loc, + ((RangedWeapon) a).GetHeat() * ((MGArray) p).GetNumMGs(), ((MGArray) p).GetNumMGs(), + (((MGArray) p).GetMGTons() * ((MGArray) p).GetNumMGs())) + NL; + } else if (p instanceof Equipment) { + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, name, loc, + ((Equipment) p).GetHeat() * numthisloc, crits, p.GetTonnage() * numthisloc) + NL; } else { - retval += String.format( "%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, name, loc, "-", crits, p.GetTonnage() * numthisloc ) + NL; + retval += String.format("%1$-44s %2$-9s %3$-9s %4$-7s %5" + tformat, name, loc, "-", crits, + p.GetTonnage() * numthisloc) + NL; } return retval; } - private String FormatFluff( String s ) { + private String FormatFluff(String s) { // we're basically checking length here to limit it to 80 chars in length // first, seperate out all the newlines. - s = s.replaceAll( "\n\r", "\n" ); - s = s.replace( " ", "" ); - s = s.replace( " ", "" ); - s = s.replace( "

", "" ); - s = s.replaceAll( "\t", " " ); - s = s.replace( "

", "\n" ); - String[] newline = s.split( "\n" ); + s = s.replaceAll("\n\r", "\n"); + s = s.replace(" ", ""); + s = s.replace(" ", ""); + s = s.replace("

", ""); + s = s.replaceAll("\t", " "); + s = s.replace("

", "\n"); + String[] newline = s.split("\n"); String retval = ""; - for( int i = 0; i < newline.length; i++ ) { - String[] temp = wrapText( newline[i], 80 ); + for (int i = 0; i < newline.length; i++) { + String[] temp = wrapText(newline[i], 80); // put the string back together - for( int j = 0; j < temp.length; j++ ) { + for (int j = 0; j < temp.length; j++) { retval += temp[j] + NL; } } return retval; } - static String [] wrapText (String text, int len) { + static String[] wrapText(String text, int len) { // return empty array for null text if (text == null) - return new String [] {}; + return new String[] {}; // return text if len is zero or less if (len <= 0) - return new String [] {text}; + return new String[] { text }; // return text if less than length if (text.length() <= len) - return new String [] {text}; + return new String[] { text }; // before the wrapping, replace any special characters - text = text.replace( "\t", " " ); + text = text.replace("\t", " "); - char [] chars = text.toCharArray(); + char[] chars = text.toCharArray(); ArrayList lines = new ArrayList(); StringBuffer line = new StringBuffer(); StringBuffer word = new StringBuffer(); @@ -1181,10 +1409,10 @@ private String FormatFluff( String s ) { lines.add(line.toString()); } - String [] ret = new String[lines.size()]; + String[] ret = new String[lines.size()]; int c = 0; // counter Iterator itr = lines.iterator(); - while(itr.hasNext()) { + while (itr.hasNext()) { ret[c] = (String) itr.next(); c++; } @@ -1193,14 +1421,14 @@ private String FormatFluff( String s ) { } private String GetJumpJetDistanceLine() { - String retval = ( CurMech.GetJumpJets().GetNumJJ() * 30 ) + " meters"; - if( CurMech.GetAdjustedJumpingMP( false ) != CurMech.GetJumpJets().GetNumJJ() ) { - retval += " (" + ( CurMech.GetAdjustedJumpingMP( false ) * 30 ) + " meters)"; - } - if( CurMech.UsingJumpBooster() ) { - retval += " / " + ( CurMech.GetJumpBoosterMP() * 30 ) + " meters"; - if( CurMech.GetJumpBoosterMP() != CurMech.GetAdjustedBoosterMP( false ) ) { - retval += " (" + ( CurMech.GetAdjustedBoosterMP( false ) * 30 ) + " meters)"; + String retval = (CurMech.GetJumpJets().GetNumJJ() * 30) + " meters"; + if (CurMech.GetAdjustedJumpingMP(false) != CurMech.GetJumpJets().GetNumJJ()) { + retval += " (" + (CurMech.GetAdjustedJumpingMP(false) * 30) + " meters)"; + } + if (CurMech.UsingJumpBooster()) { + retval += " / " + (CurMech.GetJumpBoosterMP() * 30) + " meters"; + if (CurMech.GetJumpBoosterMP() != CurMech.GetAdjustedBoosterMP(false)) { + retval += " (" + (CurMech.GetAdjustedBoosterMP(false) * 30) + " meters)"; } } return retval; @@ -1208,13 +1436,13 @@ private String GetJumpJetDistanceLine() { private String GetJumpingMPLine() { String retval = "" + CurMech.GetJumpJets().GetNumJJ(); - if( CurMech.GetAdjustedJumpingMP( false ) != CurMech.GetJumpJets().GetNumJJ() ) { - retval += " (" + CurMech.GetAdjustedJumpingMP( false ) + ")"; + if (CurMech.GetAdjustedJumpingMP(false) != CurMech.GetJumpJets().GetNumJJ()) { + retval += " (" + CurMech.GetAdjustedJumpingMP(false) + ")"; } - if( CurMech.UsingJumpBooster() ) { + if (CurMech.UsingJumpBooster()) { retval += " / " + CurMech.GetJumpBoosterMP(); - if( CurMech.GetJumpBoosterMP() != CurMech.GetAdjustedBoosterMP( false ) ) { - retval += " (" + CurMech.GetAdjustedBoosterMP( false ) + ")"; + if (CurMech.GetJumpBoosterMP() != CurMech.GetAdjustedBoosterMP(false)) { + retval += " (" + CurMech.GetAdjustedBoosterMP(false) + ")"; } } return retval; @@ -1222,30 +1450,30 @@ private String GetJumpingMPLine() { private String GetJumpJetTypeLine() { String retval = ""; - if( CurMech.UsingJumpBooster() ) { - if( CurMech.GetJumpJets().GetNumJJ() <= 0 ) { + if (CurMech.UsingJumpBooster()) { + if (CurMech.GetJumpJets().GetNumJJ() <= 0) { retval = "Jump Booster"; } else { - if( CurMech.GetJumpJets().IsImproved() ) { + if (CurMech.GetJumpJets().IsImproved()) { retval = "Improved + Jump Booster"; } else { - if( CurMech.GetJumpJets().IsUMU() ) { + if (CurMech.GetJumpJets().IsUMU()) { retval = "UMU + Jump Booster"; - } else{ + } else { retval = "Standard + Jump Booster"; } } } } else { - if( CurMech.GetJumpJets().GetNumJJ() <= 0 ) { + if (CurMech.GetJumpJets().GetNumJJ() <= 0) { retval = ""; } else { - if( CurMech.GetJumpJets().IsImproved() ) { + if (CurMech.GetJumpJets().IsImproved()) { retval = "Improved"; } else { - if( CurMech.GetJumpJets().IsUMU() ) { + if (CurMech.GetJumpJets().IsUMU()) { retval = "UMU"; - } else{ + } else { retval = "Standard"; } } @@ -1254,100 +1482,107 @@ private String GetJumpJetTypeLine() { return retval; } - public void WriteList(String filename, Scenario scenario) throws IOException { - if ( !filename.endsWith(".csv") ) { filename += ".csv"; } - BufferedWriter FR = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ); - - FR.write( CSVFormat("unit_type") ); - FR.write( CSVFormat("sub_unit_type") ); - FR.write( CSVFormat("unit_name") ); - FR.write( CSVFormat("model_number") ); - FR.write( CSVFormat("tonnage") ); - FR.write( CSVFormat("bv2") ); - FR.write( CSVFormat("tw rules_level") ); - FR.write( CSVFormat("technology base") ); - FR.write( CSVFormat("source") ); - FR.write( CSVFormat("date") ); - FR.write( CSVFormat("era") ); - FR.write( "PV,Wt,MV,S,M,L,E,OV,Armor,Internal,Special Abilities" ); + if (!filename.endsWith(".csv")) { + filename += ".csv"; + } + BufferedWriter FR = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")); + + FR.write(CSVFormat("unit_type")); + FR.write(CSVFormat("sub_unit_type")); + FR.write(CSVFormat("unit_name")); + FR.write(CSVFormat("model_number")); + FR.write(CSVFormat("tonnage")); + FR.write(CSVFormat("bv2")); + FR.write(CSVFormat("tw rules_level")); + FR.write(CSVFormat("technology base")); + FR.write(CSVFormat("source")); + FR.write(CSVFormat("date")); + FR.write(CSVFormat("era")); + FR.write("PV,Wt,MV,S,M,L,E,OV,Armor,Internal,Special Abilities"); FR.newLine(); String datum = ""; - for ( Unit u : scenario.getUnits() ) { - FR.write( CSVFormat(CommonTools.UnitTypes[u.UnitType]) ); + for (Unit u : scenario.getUnits()) { + FR.write(CSVFormat(CommonTools.UnitTypes[u.UnitType])); datum = "BattleMech"; - if ( u.IsOmni() ) { datum = "OmniMech"; } - FR.write( CSVFormat(datum) ); - FR.write( CSVFormat(u.Name )); - FR.write( CSVFormat((u.Model + " " + u.Configuration).trim()) ); - FR.write( CSVFormat(u.Tonnage+"") ); - FR.write( CSVFormat(u.BaseBV+"") ); - FR.write( CSVFormat("") ); - FR.write( CSVFormat("") ); - FR.write( CSVFormat("") ); - FR.write( CSVFormat("") ); - FR.write( CSVFormat("") ); - FR.write( u.getBFStats().SerializeCSV( false ) ); + if (u.IsOmni()) { + datum = "OmniMech"; + } + FR.write(CSVFormat(datum)); + FR.write(CSVFormat(u.Name)); + FR.write(CSVFormat((u.Model + " " + u.Configuration).trim())); + FR.write(CSVFormat(u.Tonnage + "")); + FR.write(CSVFormat(u.BaseBV + "")); + FR.write(CSVFormat("")); + FR.write(CSVFormat("")); + FR.write(CSVFormat("")); + FR.write(CSVFormat("")); + FR.write(CSVFormat("")); + FR.write(u.getBFStats().SerializeCSV(false)); FR.newLine(); } FR.close(); } public void WriteList(String filename, UnitList list) throws IOException { - if ( !filename.endsWith(".csv") ) { filename += ".csv"; } - BufferedWriter FR = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ); - - FR.write( CSVFormat("unit_type") ); - FR.write( CSVFormat("sub_unit_type") ); - FR.write( CSVFormat("unit_name") ); - FR.write( CSVFormat("model_number") ); - FR.write( CSVFormat("tonnage") ); - FR.write( CSVFormat("bv2") ); - FR.write( CSVFormat("tw rules_level") ); - FR.write( CSVFormat("technology base") ); - FR.write( CSVFormat("source") ); - FR.write( CSVFormat("date") ); - FR.write( CSVFormat("era") ); - FR.write( CSVFormat("cost") ); - FR.write( "PV,Wt,MV,S,M,L,E,OV,Armor,Internal,Special Abilities" ); + if (!filename.endsWith(".csv")) { + filename += ".csv"; + } + BufferedWriter FR = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")); + + FR.write(CSVFormat("unit_type")); + FR.write(CSVFormat("sub_unit_type")); + FR.write(CSVFormat("unit_name")); + FR.write(CSVFormat("model_number")); + FR.write(CSVFormat("tonnage")); + FR.write(CSVFormat("bv2")); + FR.write(CSVFormat("tw rules_level")); + FR.write(CSVFormat("technology base")); + FR.write(CSVFormat("source")); + FR.write(CSVFormat("date")); + FR.write(CSVFormat("era")); + FR.write(CSVFormat("cost")); + FR.write("PV,Wt,MV,S,M,L,E,OV,Armor,Internal,Special Abilities"); FR.newLine(); String datum = "", omniname = ""; - for (int i=0; i < list.Size(); i++) { + for (int i = 0; i < list.Size(); i++) { UnitListData data = (UnitListData) list.Get(i); - switch(data.getUnitType()) { + switch (data.getUnitType()) { case CommonTools.BattleMech: datum = "BattleMech"; - omniname = data.isOmni() ? "OmniMech":datum; + omniname = data.isOmni() ? "OmniMech" : datum; break; case CommonTools.Vehicle: datum = "Combat Vehicle"; - omniname = data.isOmni() ? "OmniVehicle":datum; + omniname = data.isOmni() ? "OmniVehicle" : datum; break; } - FR.write( CSVFormat(datum) ); - FR.write( CSVFormat(omniname) ); - FR.write( CSVFormat(data.getName()) ); - FR.write( CSVFormat((data.getModel() + " " + data.getConfig()).trim()) ); - FR.write( CSVFormat(data.getTonnage()+"") ); - FR.write( CSVFormat(data.getBV()+"") ); - FR.write( CSVFormat(data.getLevel()) ); - FR.write( CSVFormat(data.getTech()) ); - FR.write( CSVFormat(data.getSource()) ); - FR.write( CSVFormat(data.getYear()+"") ); - FR.write( CSVFormat(data.getEra()) ); - FR.write( CSVFormat(data.getCost()+"") ); - FR.write( data.getBattleForceStats().SerializeCSV( false ) ); + FR.write(CSVFormat(datum)); + FR.write(CSVFormat(omniname)); + FR.write(CSVFormat(data.getName())); + FR.write(CSVFormat((data.getModel() + " " + data.getConfig()).trim())); + FR.write(CSVFormat(data.getTonnage() + "")); + FR.write(CSVFormat(data.getBV() + "")); + FR.write(CSVFormat(data.getLevel())); + FR.write(CSVFormat(data.getTech())); + FR.write(CSVFormat(data.getSource())); + FR.write(CSVFormat(data.getYear() + "")); + FR.write(CSVFormat(data.getEra())); + FR.write(CSVFormat(data.getCost() + "")); + FR.write(data.getBattleForceStats().SerializeCSV(false)); FR.newLine(); } FR.close(); } - public void WriteCost( Mech m, String filename ) throws IOException { + public void WriteCost(Mech m, String filename) throws IOException { filename += m.GetFullName(); - if ( !filename.endsWith(".txt") ) { filename += ".txt"; } - BufferedWriter FR = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ); + if (!filename.endsWith(".txt")) { + filename += ".txt"; + } + BufferedWriter FR = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")); CostBVBreakdown cost = new CostBVBreakdown(m); FR.write(cost.Render()); @@ -1355,59 +1590,67 @@ public void WriteCost( Mech m, String filename ) throws IOException { } public void WriteBFList(String filename, UnitList list) throws IOException { - if ( !filename.endsWith(".csv") ) { filename += ".csv"; } - BufferedWriter FR = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ); + if (!filename.endsWith(".csv")) { + filename += ".csv"; + } + BufferedWriter FR = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")); String message = ""; FR.write("Element,PV,Wt,MV,S,M,L,E,OV,Armor,Internal,Special Abilities"); FR.newLine(); - for ( UnitListData mech : list.getList() ) { - FR.write(mech.getBattleForceStats().SerializeCSV( true )); + for (UnitListData mech : list.getList()) { + FR.write(mech.getBattleForceStats().SerializeCSV(true)); FR.newLine(); } FR.close(); - if ( !message.isEmpty() ) { + if (!message.isEmpty()) { Media.Messager("Could not write out the following:\n" + message); } } public void WriteBFList(String filename, Scenario scenario) throws IOException { - if ( !filename.endsWith(".csv") ) { filename += ".csv"; } - BufferedWriter FR = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ); + if (!filename.endsWith(".csv")) { + filename += ".csv"; + } + BufferedWriter FR = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")); - String message = "", force= "", group = ""; + String message = "", force = "", group = ""; FR.write("Force,Group,Element,PV,Wt,MV,S,M,L,E,OV,Armor,Internal,Special Abilities"); FR.newLine(); - for ( Force f : scenario.getForces() ) { + for (Force f : scenario.getForces()) { force = f.ForceName; - for ( Unit u : f.getUnits() ) { + for (Unit u : f.getUnits()) { group = u.getGroup(); - FR.write(CSVFormat(force) + CSVFormat(group) + u.getBFStats().SerializeCSV( true )); + FR.write(CSVFormat(force) + CSVFormat(group) + u.getBFStats().SerializeCSV(true)); FR.newLine(); } } FR.close(); - if ( !message.isEmpty() ) { + if (!message.isEmpty()) { Media.Messager("Could not write out the following:\n" + message); } } - public void WriteFactorList(String filename, Scenario scenario ) throws IOException { - if ( !filename.endsWith(".csv") ) { filename += ".csv"; } - BufferedWriter FR = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ); + public void WriteFactorList(String filename, Scenario scenario) throws IOException { + if (!filename.endsWith(".csv")) { + filename += ".csv"; + } + BufferedWriter FR = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")); String message = ""; FR.write("Unit,Type,Prb,ECM,Spd,Jmp,TSM,Phys,Armr,TC,8+,10+,Hd Cap,Tot Dmg,Base BV, Adj BV"); FR.newLine(); - for ( Force f : scenario.getForces() ) { - if ( !f.ForceName.isEmpty()) {FR.write(f.ForceName);} - for ( Group g : f.Groups ) { + for (Force f : scenario.getForces()) { + if (!f.ForceName.isEmpty()) { + FR.write(f.ForceName); + } + for (Group g : f.Groups) { FR.newLine(); - for ( Unit u : g.getUnits() ) { + for (Unit u : g.getUnits()) { FR.write(u.SerializeFactors()); FR.newLine(); } @@ -1419,14 +1662,14 @@ public void WriteFactorList(String filename, Scenario scenario ) throws IOExcept FR.close(); - if ( !message.isEmpty() ) { + if (!message.isEmpty()) { Media.Messager("Could not write out the following:\n" + message); } } - public String CSVFormat( String data ) { - if ( data.contains(",") ) + public String CSVFormat(String data) { + if (data.contains(",")) return "\"" + data + "\","; else return data + ","; diff --git a/sswlib/src/main/java/utilities/CostBVBreakdown.java b/sswlib/src/main/java/utilities/CostBVBreakdown.java index eb5fe2b5..dc54512b 100644 --- a/sswlib/src/main/java/utilities/CostBVBreakdown.java +++ b/sswlib/src/main/java/utilities/CostBVBreakdown.java @@ -34,7 +34,7 @@ public class CostBVBreakdown { private Mech CurMech = null; - private String NL = System.getProperty( "line.separator" ); + private String NL = System.getProperty("line.separator"); public CostBVBreakdown(Mech mech) { CurMech = mech; @@ -42,213 +42,434 @@ public CostBVBreakdown(Mech mech) { public String Render() { // this method returns a formated string with the cost/bv breakdown - // ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + // ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ String retval = ""; - retval += String.format( "Mech Name: %1$-41s Tonnage: %2$d", CurMech.GetName() + " " + CurMech.GetModel(), CurMech.GetTonnage() ) + NL; - retval += String.format( "Rules Level: %1$-41s Total Cost: %2$,.0f", CommonTools.GetRulesLevelString( CurMech.GetRulesLevel() ), CurMech.GetTotalCost() ) + NL; - retval += String.format( "Tech Base: %1$-41s Total BV: %2$,d", CommonTools.GetTechbaseString( CurMech.GetLoadout().GetTechBase() ), CurMech.GetCurrentBV() ) + NL; + retval += String.format("Mech Name: %1$-41s Tonnage: %2$d", CurMech.GetName() + " " + CurMech.GetModel(), + CurMech.GetTonnage()) + NL; + retval += String.format("Rules Level: %1$-41s Total Cost: %2$,.0f", + CommonTools.GetRulesLevelString(CurMech.GetRulesLevel()), CurMech.GetTotalCost()) + NL; + retval += String.format("Tech Base: %1$-41s Total BV: %2$,d", + CommonTools.GetTechbaseString(CurMech.GetLoadout().GetTechBase()), CurMech.GetCurrentBV()) + NL; retval += NL; - retval += "Item DefBV OffBV Cost" + NL; - retval += String.format( "Internal Structure - %1$-22s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetIntStruc().toString(), CurMech.GetIntStruc().GetDefensiveBV(), CurMech.GetIntStruc().GetOffensiveBV(), CurMech.GetIntStruc().GetCost() ) + NL; - retval += String.format( "Engine - %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetEngine().CritName(), CurMech.GetEngine().GetDefensiveBV(), CurMech.GetEngine().GetOffensiveBV(), CurMech.GetEngine().GetCost() ) + NL; - retval += String.format( "Gyro - %1$-36s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetGyro().CritName(), CurMech.GetGyro().GetDefensiveBV(), CurMech.GetGyro().GetOffensiveBV(), CurMech.GetGyro().GetCost() ) + NL; - if( CurMech.IsPrimitive() && CurMech.GetYear() < 2450 ) { - if( CurMech.IsIndustrialmech() ) { - retval += String.format( "Cockpit - %1$-33s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetCockpit().GetReportName() + " (early)", CurMech.GetCockpit().GetDefensiveBV(), CurMech.GetCockpit().GetOffensiveBV(), CurMech.GetCockpit().GetCost() + 50000.0f ) + NL; + retval += "Item DefBV OffBV Cost" + NL; + retval += String.format("Internal Structure - %1$-22s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetIntStruc().toString(), CurMech.GetIntStruc().GetDefensiveBV(), + CurMech.GetIntStruc().GetOffensiveBV(), CurMech.GetIntStruc().GetCost()) + NL; + retval += String.format("Engine - %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetEngine().CritName(), + CurMech.GetEngine().GetDefensiveBV(), CurMech.GetEngine().GetOffensiveBV(), + CurMech.GetEngine().GetCost()) + NL; + retval += String.format("Gyro - %1$-36s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetGyro().CritName(), + CurMech.GetGyro().GetDefensiveBV(), CurMech.GetGyro().GetOffensiveBV(), CurMech.GetGyro().GetCost()) + + NL; + if (CurMech.IsPrimitive() && CurMech.GetYear() < 2450) { + if (CurMech.IsIndustrialmech()) { + retval += String.format("Cockpit - %1$-33s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetCockpit().GetReportName() + " (early)", CurMech.GetCockpit().GetDefensiveBV(), + CurMech.GetCockpit().GetOffensiveBV(), CurMech.GetCockpit().GetCost() + 50000.0f) + NL; } else { - retval += String.format( "Cockpit - %1$-33s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetCockpit().GetReportName() + " (early)", CurMech.GetCockpit().GetDefensiveBV(), CurMech.GetCockpit().GetOffensiveBV(), CurMech.GetCockpit().GetCost() + 100000.0f ) + NL; + retval += String.format("Cockpit - %1$-33s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetCockpit().GetReportName() + " (early)", CurMech.GetCockpit().GetDefensiveBV(), + CurMech.GetCockpit().GetOffensiveBV(), CurMech.GetCockpit().GetCost() + 100000.0f) + NL; } } else { - retval += String.format( "Cockpit - %1$-33s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetCockpit().GetReportName(), CurMech.GetCockpit().GetDefensiveBV(), CurMech.GetCockpit().GetOffensiveBV(), CurMech.GetCockpit().GetCost() ) + NL; - } - retval += String.format( "Heat Sinks - %1$-30s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetHeatSinks().LookupName(), CurMech.GetHeatSinks().GetDefensiveBV(), CurMech.GetHeatSinks().GetOffensiveBV(), CurMech.GetHeatSinks().GetCost() ) + NL; - if( CurMech.GetPhysEnhance().IsTSM() ) { - retval += String.format( "Musculature - %1$-29s %2$,6.0f %3$,6.0f %4$,16.2f", "Triple-Strength", CurMech.GetPhysEnhance().GetDefensiveBV(), CurMech.GetPhysEnhance().GetOffensiveBV(), CurMech.GetPhysEnhance().GetCost() ) + NL; + retval += String.format("Cockpit - %1$-33s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetCockpit().GetReportName(), CurMech.GetCockpit().GetDefensiveBV(), + CurMech.GetCockpit().GetOffensiveBV(), CurMech.GetCockpit().GetCost()) + NL; + } + retval += String.format("Heat Sinks - %1$-30s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetHeatSinks().LookupName(), CurMech.GetHeatSinks().GetDefensiveBV(), + CurMech.GetHeatSinks().GetOffensiveBV(), CurMech.GetHeatSinks().GetCost()) + NL; + if (CurMech.GetPhysEnhance().IsTSM()) { + retval += String.format("Musculature - %1$-29s %2$,6.0f %3$,6.0f %4$,16.2f", "Triple-Strength", + CurMech.GetPhysEnhance().GetDefensiveBV(), CurMech.GetPhysEnhance().GetOffensiveBV(), + CurMech.GetPhysEnhance().GetCost()) + NL; } else { - if( CurMech.IsPrimitive() ) { - if( CurMech.GetYear() < 2450 ) { - retval += String.format( "Musculature - %1$-29s %2$,6.0f %3$,6.0f %4$,16.2f", "Primitive (early)", 0.0f, CurMech.GetTonnage() * 1.0f, CurMech.GetTonnage() * 2000.0f ) + NL; + if (CurMech.IsPrimitive()) { + if (CurMech.GetYear() < 2450) { + retval += String.format("Musculature - %1$-29s %2$,6.0f %3$,6.0f %4$,16.2f", + "Primitive (early)", 0.0f, CurMech.GetTonnage() * 1.0f, CurMech.GetTonnage() * 2000.0f) + + NL; } else { - retval += String.format( "Musculature - %1$-29s %2$,6.0f %3$,6.0f %4$,16.2f", "Primitive", 0.0f, CurMech.GetTonnage() * 1.0f, CurMech.GetTonnage() * 1000.0f ) + NL; + retval += String.format("Musculature - %1$-29s %2$,6.0f %3$,6.0f %4$,16.2f", "Primitive", + 0.0f, CurMech.GetTonnage() * 1.0f, CurMech.GetTonnage() * 1000.0f) + NL; } } else { - retval += String.format( "Musculature - %1$-29s %2$,6.0f %3$,6.0f %4$,16.2f", "Standard", 0.0f, CurMech.GetTonnage() * 1.0f, CurMech.GetTonnage() * 2000.0f ) + NL; + retval += String.format("Musculature - %1$-29s %2$,6.0f %3$,6.0f %4$,16.2f", "Standard", 0.0f, + CurMech.GetTonnage() * 1.0f, CurMech.GetTonnage() * 2000.0f) + NL; } } - retval += String.format( "Actuators %1$-33s %2$,6.0f %3$,6.0f %4$,16.2f", "", CurMech.GetActuators().GetDefensiveBV(), CurMech.GetActuators().GetOffensiveBV(), CurMech.GetActuators().GetCost() ) + NL; - if( CurMech.GetJumpJets().GetNumJJ() > 0 ) { - retval += String.format( "Jump Jets - %1$-31s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetJumpJets().LookupName(), CurMech.GetJumpJets().GetDefensiveBV(), CurMech.GetJumpJets().GetOffensiveBV(), CurMech.GetJumpJets().GetCost() ) + NL; - } - if( CurMech.GetPhysEnhance().IsMASC() ) { - retval += String.format( "%1$-43s %2$,6.0f %3$,6.0f %4$,16.2f", "MASC", CurMech.GetPhysEnhance().GetDefensiveBV(), CurMech.GetPhysEnhance().GetOffensiveBV(), CurMech.GetPhysEnhance().GetCost() ) + NL; - } - if( ! CurMech.GetEngine().IsNuclear() ) { - retval += String.format( "%1$-43s %2$,6.0f %3$,6.0f %4$,16.2f", "Power Amplifiers", 0.0f, 0.0f, CurMech.GetLoadout().GetPowerAmplifier().GetCost() ) + NL; - } - if( CurMech.IsPrimitive() && CurMech.GetYear() < 2450 ) { - retval += String.format( "Armor - %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().LookupName() + " (early)", CurMech.GetArmor().GetDefensiveBV(), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetCost() ) + NL; - if(CurMech.GetArmor().IsPatchwork()) { + retval += String.format("Actuators %1$-33s %2$,6.0f %3$,6.0f %4$,16.2f", "", + CurMech.GetActuators().GetDefensiveBV(), CurMech.GetActuators().GetOffensiveBV(), + CurMech.GetActuators().GetCost()) + NL; + if (CurMech.GetJumpJets().GetNumJJ() > 0) { + retval += String.format("Jump Jets - %1$-31s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetJumpJets().LookupName(), CurMech.GetJumpJets().GetDefensiveBV(), + CurMech.GetJumpJets().GetOffensiveBV(), CurMech.GetJumpJets().GetCost()) + NL; + } + if (CurMech.GetPhysEnhance().IsMASC()) { + retval += String.format("%1$-43s %2$,6.0f %3$,6.0f %4$,16.2f", "MASC", + CurMech.GetPhysEnhance().GetDefensiveBV(), CurMech.GetPhysEnhance().GetOffensiveBV(), + CurMech.GetPhysEnhance().GetCost()) + NL; + } + if (!CurMech.GetEngine().IsNuclear()) { + retval += String.format("%1$-43s %2$,6.0f %3$,6.0f %4$,16.2f", "Power Amplifiers", 0.0f, 0.0f, + CurMech.GetLoadout().GetPowerAmplifier().GetCost()) + NL; + } + if (CurMech.IsPrimitive() && CurMech.GetYear() < 2450) { + retval += String.format("Armor - %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().LookupName() + " (early)", CurMech.GetArmor().GetDefensiveBV(), + CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetCost()) + NL; + if (CurMech.GetArmor().IsPatchwork()) { int[] ModArmor = CurMech.GetLoadout().FindModularArmor(); - if( CurMech.IsQuad() ) { - retval += String.format( " HD: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetHDArmorType().LookupName(), CurMech.GetArmor().GetHDDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetHDCost() ) + NL; - retval += String.format( " CT: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetCTArmorType().LookupName(), CurMech.GetArmor().GetCTDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetCTCost() ) + NL; - retval += String.format( " LT: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetLTArmorType().LookupName(), CurMech.GetArmor().GetLTDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetLTCost() ) + NL; - retval += String.format( " RT: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetRTArmorType().LookupName(), CurMech.GetArmor().GetRTDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetRTCost() ) + NL; - retval += String.format( " FLL: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetLAArmorType().LookupName(), CurMech.GetArmor().GetLADefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetLACost() ) + NL; - retval += String.format( " FRL: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetRAArmorType().LookupName(), CurMech.GetArmor().GetRADefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetRACost() ) + NL; - retval += String.format( " RLL: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetLLArmorType().LookupName(), CurMech.GetArmor().GetLLDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetLLCost() ) + NL; - retval += String.format( " RRL: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetRLArmorType().LookupName(), CurMech.GetArmor().GetRLDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetRLCost() ) + NL; + if (CurMech.IsQuad()) { + retval += String.format(" HD: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetHDArmorType().LookupName(), + CurMech.GetArmor().GetHDDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetHDCost()) + NL; + retval += String.format(" CT: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetCTArmorType().LookupName(), + CurMech.GetArmor().GetCTDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetCTCost()) + NL; + retval += String.format(" LT: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetLTArmorType().LookupName(), + CurMech.GetArmor().GetLTDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetLTCost()) + NL; + retval += String.format(" RT: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetRTArmorType().LookupName(), + CurMech.GetArmor().GetRTDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetRTCost()) + NL; + retval += String.format(" FLL: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetLAArmorType().LookupName(), + CurMech.GetArmor().GetLADefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetLACost()) + NL; + retval += String.format(" FRL: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetRAArmorType().LookupName(), + CurMech.GetArmor().GetRADefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetRACost()) + NL; + retval += String.format(" RLL: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetLLArmorType().LookupName(), + CurMech.GetArmor().GetLLDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetLLCost()) + NL; + retval += String.format(" RRL: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetRLArmorType().LookupName(), + CurMech.GetArmor().GetRLDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetRLCost()) + NL; } else { - retval += String.format( " HD: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetHDArmorType().LookupName(), CurMech.GetArmor().GetHDDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetHDCost() ) + NL; - retval += String.format( " CT: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetCTArmorType().LookupName(), CurMech.GetArmor().GetCTDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetCTCost() ) + NL; - retval += String.format( " LT: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetLTArmorType().LookupName(), CurMech.GetArmor().GetLTDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetLTCost() ) + NL; - retval += String.format( " RT: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetRTArmorType().LookupName(), CurMech.GetArmor().GetRTDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetRTCost() ) + NL; - retval += String.format( " LA: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetLAArmorType().LookupName(), CurMech.GetArmor().GetLADefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetLACost() ) + NL; - retval += String.format( " RA: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetRAArmorType().LookupName(), CurMech.GetArmor().GetRADefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetRACost() ) + NL; - retval += String.format( " LL: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetLLArmorType().LookupName(), CurMech.GetArmor().GetLLDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetLLCost() ) + NL; - retval += String.format( " RL: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetRLArmorType().LookupName(), CurMech.GetArmor().GetRLDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetRLCost() ) + NL; + retval += String.format(" HD: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetHDArmorType().LookupName(), + CurMech.GetArmor().GetHDDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetHDCost()) + NL; + retval += String.format(" CT: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetCTArmorType().LookupName(), + CurMech.GetArmor().GetCTDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetCTCost()) + NL; + retval += String.format(" LT: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetLTArmorType().LookupName(), + CurMech.GetArmor().GetLTDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetLTCost()) + NL; + retval += String.format(" RT: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetRTArmorType().LookupName(), + CurMech.GetArmor().GetRTDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetRTCost()) + NL; + retval += String.format(" LA: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetLAArmorType().LookupName(), + CurMech.GetArmor().GetLADefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetLACost()) + NL; + retval += String.format(" RA: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetRAArmorType().LookupName(), + CurMech.GetArmor().GetRADefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetRACost()) + NL; + retval += String.format(" LL: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetLLArmorType().LookupName(), + CurMech.GetArmor().GetLLDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetLLCost()) + NL; + retval += String.format(" RL: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetRLArmorType().LookupName(), + CurMech.GetArmor().GetRLDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetRLCost()) + NL; } } } else { - retval += String.format( "Armor - %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().LookupName(), CurMech.GetArmor().GetDefensiveBV(), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetCost() ) + NL; - if(CurMech.GetArmor().IsPatchwork()) { + retval += String.format("Armor - %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().LookupName(), CurMech.GetArmor().GetDefensiveBV(), + CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetCost()) + NL; + if (CurMech.GetArmor().IsPatchwork()) { int[] ModArmor = CurMech.GetLoadout().FindModularArmor(); - if( CurMech.IsQuad() ) { - retval += String.format( " HD: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetHDArmorType().LookupName(), CurMech.GetArmor().GetHDDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetHDCost() ) + NL; - retval += String.format( " CT: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetCTArmorType().LookupName(), CurMech.GetArmor().GetCTDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetCTCost() ) + NL; - retval += String.format( " LT: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetLTArmorType().LookupName(), CurMech.GetArmor().GetLTDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetLTCost() ) + NL; - retval += String.format( " RT: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetRTArmorType().LookupName(), CurMech.GetArmor().GetRTDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetRTCost() ) + NL; - retval += String.format( " FLL: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetLAArmorType().LookupName(), CurMech.GetArmor().GetLADefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetLACost() ) + NL; - retval += String.format( " FRL: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetRAArmorType().LookupName(), CurMech.GetArmor().GetRADefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetRACost() ) + NL; - retval += String.format( " RLL: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetLLArmorType().LookupName(), CurMech.GetArmor().GetLLDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetLLCost() ) + NL; - retval += String.format( " RRL: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetRLArmorType().LookupName(), CurMech.GetArmor().GetRLDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetRLCost() ) + NL; + if (CurMech.IsQuad()) { + retval += String.format(" HD: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetHDArmorType().LookupName(), + CurMech.GetArmor().GetHDDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetHDCost()) + NL; + retval += String.format(" CT: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetCTArmorType().LookupName(), + CurMech.GetArmor().GetCTDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetCTCost()) + NL; + retval += String.format(" LT: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetLTArmorType().LookupName(), + CurMech.GetArmor().GetLTDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetLTCost()) + NL; + retval += String.format(" RT: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetRTArmorType().LookupName(), + CurMech.GetArmor().GetRTDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetRTCost()) + NL; + retval += String.format(" FLL: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetLAArmorType().LookupName(), + CurMech.GetArmor().GetLADefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetLACost()) + NL; + retval += String.format(" FRL: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetRAArmorType().LookupName(), + CurMech.GetArmor().GetRADefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetRACost()) + NL; + retval += String.format(" RLL: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetLLArmorType().LookupName(), + CurMech.GetArmor().GetLLDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetLLCost()) + NL; + retval += String.format(" RRL: %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetRLArmorType().LookupName(), + CurMech.GetArmor().GetRLDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetRLCost()) + NL; } else { - retval += String.format( " HD: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetHDArmorType().LookupName(), CurMech.GetArmor().GetHDDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetHDCost() ) + NL; - retval += String.format( " CT: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetCTArmorType().LookupName(), CurMech.GetArmor().GetCTDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetCTCost() ) + NL; - retval += String.format( " LT: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetLTArmorType().LookupName(), CurMech.GetArmor().GetLTDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetLTCost() ) + NL; - retval += String.format( " RT: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetRTArmorType().LookupName(), CurMech.GetArmor().GetRTDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetRTCost() ) + NL; - retval += String.format( " LA: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetLAArmorType().LookupName(), CurMech.GetArmor().GetLADefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetLACost() ) + NL; - retval += String.format( " RA: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetRAArmorType().LookupName(), CurMech.GetArmor().GetRADefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetRACost() ) + NL; - retval += String.format( " LL: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetLLArmorType().LookupName(), CurMech.GetArmor().GetLLDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetLLCost() ) + NL; - retval += String.format( " RL: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurMech.GetArmor().GetRLArmorType().LookupName(), CurMech.GetArmor().GetRLDefensiveBV( ModArmor ), CurMech.GetArmor().GetOffensiveBV(), CurMech.GetArmor().GetRLCost() ) + NL; + retval += String.format(" HD: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetHDArmorType().LookupName(), + CurMech.GetArmor().GetHDDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetHDCost()) + NL; + retval += String.format(" CT: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetCTArmorType().LookupName(), + CurMech.GetArmor().GetCTDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetCTCost()) + NL; + retval += String.format(" LT: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetLTArmorType().LookupName(), + CurMech.GetArmor().GetLTDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetLTCost()) + NL; + retval += String.format(" RT: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetRTArmorType().LookupName(), + CurMech.GetArmor().GetRTDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetRTCost()) + NL; + retval += String.format(" LA: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetLAArmorType().LookupName(), + CurMech.GetArmor().GetLADefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetLACost()) + NL; + retval += String.format(" RA: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetRAArmorType().LookupName(), + CurMech.GetArmor().GetRADefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetRACost()) + NL; + retval += String.format(" LL: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetLLArmorType().LookupName(), + CurMech.GetArmor().GetLLDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetLLCost()) + NL; + retval += String.format(" RL: %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurMech.GetArmor().GetRLArmorType().LookupName(), + CurMech.GetArmor().GetRLDefensiveBV(ModArmor), CurMech.GetArmor().GetOffensiveBV(), + CurMech.GetArmor().GetRLCost()) + NL; } } } retval += NL; retval += GetEquipmentCostLines(); retval += NL; - retval += String.format( "Cost Multiplier %1$,1.3f", CurMech.GetCostMult() ) + NL; - retval += String.format( "Dry Cost %1$,13.0f", CurMech.GetDryCost() ) + NL; - retval += String.format( "Total Cost %1$,13.0f", CurMech.GetTotalCost() ) + NL; + retval += String.format("Cost Multiplier %1$,1.3f", + CurMech.GetCostMult()) + NL; + retval += String.format("Dry Cost %1$,13.0f", + CurMech.GetDryCost()) + NL; + retval += String.format("Total Cost %1$,13.0f", + CurMech.GetTotalCost()) + NL; retval += NL + NL; retval += "Defensive BV Calculation Breakdown" + NL; - if( CurMech.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL ) { + if (CurMech.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL) { retval += "(Note: BV Calculations include defensive BV for armored components.)" + NL; } retval += "________________________________________________________________________________" + NL; - if(CurMech.GetArmor().IsPatchwork() || CurMech.GetArmor().HasHarjelMod()) { + if (CurMech.GetArmor().IsPatchwork() || CurMech.GetArmor().HasHarjelMod()) { String line; if (CurMech.GetArmor().IsPatchwork()) { retval += "Patchwork Armor Calculations" + NL; } - if( CurMech.GetCockpit().IsTorsoMounted() ) { + if (CurMech.GetCockpit().IsTorsoMounted()) { retval += " (Front and Rear CT armor value doubled due to Torso-Mounted Cockpit)" + NL; } int[] ModArmor = CurMech.GetLoadout().FindModularArmor(); - line = "HD Armor Factor (" + ( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_HD) + ModArmor[LocationIndex.MECH_LOC_HD] * 10 ) + ") * Armor Type Modifier (" + CurMech.GetArmor().GetHDArmorType().GetBVTypeMult() + ")"; + line = "HD Armor Factor (" + + (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_HD) + + ModArmor[LocationIndex.MECH_LOC_HD] * 10) + + ") * Armor Type Modifier (" + CurMech.GetArmor().GetHDArmorType().GetBVTypeMult() + ")"; if (CurMech.GetArmor().HasHarjelMod(LocationIndex.MECH_LOC_HD)) { line += " * HarJel Modifier (" + CurMech.GetArmor().GetHarjelMod(LocationIndex.MECH_LOC_HD) + ")"; } - retval += String.format(" %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetHDDefensiveBV( ModArmor ) ) + NL; - if( CurMech.GetCockpit().IsTorsoMounted() ) { - retval += String.format( " %1$-72s %2$,8.2f", "( CT Armor Factor (" + ( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_CT ) + ModArmor[LocationIndex.MECH_LOC_CT] * 10 + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_CTR ) + ModArmor[LocationIndex.MECH_LOC_CTR] * 10 ) + ") ) * 2 * Armor Type Modifier (" + CurMech.GetArmor().GetCTArmorType().GetBVTypeMult() + ")", CurMech.GetArmor().GetCTDefensiveBV( ModArmor ) ) + NL; + retval += String.format(" %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetHDDefensiveBV(ModArmor)) + NL; + if (CurMech.GetCockpit().IsTorsoMounted()) { + retval += String.format(" %1$-72s %2$,8.2f", + "( CT Armor Factor (" + + (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_CT) + + ModArmor[LocationIndex.MECH_LOC_CT] * 10 + + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_CTR) + + ModArmor[LocationIndex.MECH_LOC_CTR] * 10) + + ") ) * 2 * Armor Type Modifier (" + + CurMech.GetArmor().GetCTArmorType().GetBVTypeMult() + ")", + CurMech.GetArmor().GetCTDefensiveBV(ModArmor)) + NL; } else { - line = "CT Armor Factor (" + ( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_CT ) + ModArmor[LocationIndex.MECH_LOC_CT] * 10 + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_CTR ) + ModArmor[LocationIndex.MECH_LOC_CTR] * 10 ) + ") * Armor Type Modifier (" + CurMech.GetArmor().GetCTArmorType().GetBVTypeMult() + ")"; + line = "CT Armor Factor (" + + (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_CT) + + ModArmor[LocationIndex.MECH_LOC_CT] * 10 + + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_CTR) + + ModArmor[LocationIndex.MECH_LOC_CTR] * 10) + + ") * Armor Type Modifier (" + CurMech.GetArmor().GetCTArmorType().GetBVTypeMult() + ")"; if (CurMech.GetArmor().HasHarjelMod(LocationIndex.MECH_LOC_CT)) { line += " * HarJel Modifier (" + CurMech.GetArmor().GetHarjelMod(LocationIndex.MECH_LOC_CT) + ")"; } - retval += String.format(" %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetCTDefensiveBV( ModArmor )) + NL; + retval += String.format(" %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetCTDefensiveBV(ModArmor)) + + NL; } - line = "LT Armor Factor (" + ( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LT ) + ModArmor[LocationIndex.MECH_LOC_LT] * 10 + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LTR ) + ModArmor[LocationIndex.MECH_LOC_LTR] * 10 ) + ") * Armor Type Modifier (" + CurMech.GetArmor().GetLTArmorType().GetBVTypeMult() + ")"; + line = "LT Armor Factor (" + + (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LT) + + ModArmor[LocationIndex.MECH_LOC_LT] * 10 + + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LTR) + + ModArmor[LocationIndex.MECH_LOC_LTR] * 10) + + ") * Armor Type Modifier (" + CurMech.GetArmor().GetLTArmorType().GetBVTypeMult() + ")"; if (CurMech.GetArmor().HasHarjelMod(LocationIndex.MECH_LOC_LT)) { line += " * HarJel Modifier (" + CurMech.GetArmor().GetHarjelMod(LocationIndex.MECH_LOC_LT) + ")"; } - retval += String.format(" %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetLTDefensiveBV( ModArmor )) + NL; - line = "RT Armor Factor (" + ( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RT ) + ModArmor[LocationIndex.MECH_LOC_RT] * 10 + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RTR ) + ModArmor[LocationIndex.MECH_LOC_RTR] * 10 ) + ") * Armor Type Modifier (" + CurMech.GetArmor().GetRTArmorType().GetBVTypeMult() + ")"; + retval += String.format(" %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetLTDefensiveBV(ModArmor)) + NL; + line = "RT Armor Factor (" + + (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RT) + + ModArmor[LocationIndex.MECH_LOC_RT] * 10 + + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RTR) + + ModArmor[LocationIndex.MECH_LOC_RTR] * 10) + + ") * Armor Type Modifier (" + CurMech.GetArmor().GetRTArmorType().GetBVTypeMult() + ")"; if (CurMech.GetArmor().HasHarjelMod(LocationIndex.MECH_LOC_RT)) { line += " * HarJel Modifier (" + CurMech.GetArmor().GetHarjelMod(LocationIndex.MECH_LOC_RT) + ")"; } - retval += String.format(" %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetRTDefensiveBV( ModArmor )) + NL; - if( CurMech.IsQuad() ) { - line = "FLL Armor Factor (" + ( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LA ) + ModArmor[LocationIndex.MECH_LOC_LA] * 10 ) + ") * Armor Type Modifier (" + CurMech.GetArmor().GetLAArmorType().GetBVTypeMult() + ")"; + retval += String.format(" %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetRTDefensiveBV(ModArmor)) + NL; + if (CurMech.IsQuad()) { + line = "FLL Armor Factor (" + + (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LA) + + ModArmor[LocationIndex.MECH_LOC_LA] * 10) + + ") * Armor Type Modifier (" + CurMech.GetArmor().GetLAArmorType().GetBVTypeMult() + ")"; if (CurMech.GetArmor().HasHarjelMod(LocationIndex.MECH_LOC_LA)) { line += " * HarJel Modifier (" + CurMech.GetArmor().GetHarjelMod(LocationIndex.MECH_LOC_LA) + ")"; } - retval += String.format( " %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetLADefensiveBV( ModArmor ) ) + NL; - line = "FRL Armor Factor (" + ( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RA ) + ModArmor[LocationIndex.MECH_LOC_RA] * 10 ) + ") * Armor Type Modifier (" + CurMech.GetArmor().GetRAArmorType().GetBVTypeMult() + ")"; + retval += String.format(" %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetLADefensiveBV(ModArmor)) + + NL; + line = "FRL Armor Factor (" + + (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RA) + + ModArmor[LocationIndex.MECH_LOC_RA] * 10) + + ") * Armor Type Modifier (" + CurMech.GetArmor().GetRAArmorType().GetBVTypeMult() + ")"; if (CurMech.GetArmor().HasHarjelMod(LocationIndex.MECH_LOC_RA)) { line += " * HarJel Modifier (" + CurMech.GetArmor().GetHarjelMod(LocationIndex.MECH_LOC_RA) + ")"; } - retval += String.format( " %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetRADefensiveBV( ModArmor ) ) + NL; - line = "RLL Armor Factor (" + ( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LL ) + ModArmor[LocationIndex.MECH_LOC_LL] * 10 ) + ") * Armor Type Modifier (" + CurMech.GetArmor().GetLLArmorType().GetBVTypeMult() + ")"; + retval += String.format(" %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetRADefensiveBV(ModArmor)) + + NL; + line = "RLL Armor Factor (" + + (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LL) + + ModArmor[LocationIndex.MECH_LOC_LL] * 10) + + ") * Armor Type Modifier (" + CurMech.GetArmor().GetLLArmorType().GetBVTypeMult() + ")"; if (CurMech.GetArmor().HasHarjelMod(LocationIndex.MECH_LOC_LL)) { line += " * HarJel Modifier (" + CurMech.GetArmor().GetHarjelMod(LocationIndex.MECH_LOC_LL) + ")"; } - retval += String.format( " %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetLLDefensiveBV( ModArmor ) ) + NL; - line = "RRL Armor Factor (" + ( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RA ) + ModArmor[LocationIndex.MECH_LOC_RL] * 10 ) + ") * Armor Type Modifier (" + CurMech.GetArmor().GetRLArmorType().GetBVTypeMult() + ")"; + retval += String.format(" %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetLLDefensiveBV(ModArmor)) + + NL; + line = "RRL Armor Factor (" + + (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RA) + + ModArmor[LocationIndex.MECH_LOC_RL] * 10) + + ") * Armor Type Modifier (" + CurMech.GetArmor().GetRLArmorType().GetBVTypeMult() + ")"; if (CurMech.GetArmor().HasHarjelMod(LocationIndex.MECH_LOC_RL)) { line += " * HarJel Modifier (" + CurMech.GetArmor().GetHarjelMod(LocationIndex.MECH_LOC_RL) + ")"; } - retval += String.format( " %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetRLDefensiveBV( ModArmor ) ) + NL; + retval += String.format(" %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetRLDefensiveBV(ModArmor)) + + NL; } else { - line = "LA Armor Factor (" + ( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LA ) + ModArmor[LocationIndex.MECH_LOC_LA] * 10 ) + ") * Armor Type Modifier (" + CurMech.GetArmor().GetLAArmorType().GetBVTypeMult() + ")"; + line = "LA Armor Factor (" + + (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LA) + + ModArmor[LocationIndex.MECH_LOC_LA] * 10) + + ") * Armor Type Modifier (" + CurMech.GetArmor().GetLAArmorType().GetBVTypeMult() + ")"; if (CurMech.GetArmor().HasHarjelMod(LocationIndex.MECH_LOC_LA)) { line += " * HarJel Modifier (" + CurMech.GetArmor().GetHarjelMod(LocationIndex.MECH_LOC_LA) + ")"; } - retval += String.format( " %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetLADefensiveBV( ModArmor ) ) + NL; - line = "RA Armor Factor (" + ( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RA ) + ModArmor[LocationIndex.MECH_LOC_RA] * 10 ) + ") * Armor Type Modifier (" + CurMech.GetArmor().GetRAArmorType().GetBVTypeMult() + ")"; + retval += String.format(" %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetLADefensiveBV(ModArmor)) + + NL; + line = "RA Armor Factor (" + + (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RA) + + ModArmor[LocationIndex.MECH_LOC_RA] * 10) + + ") * Armor Type Modifier (" + CurMech.GetArmor().GetRAArmorType().GetBVTypeMult() + ")"; if (CurMech.GetArmor().HasHarjelMod(LocationIndex.MECH_LOC_RA)) { line += " * HarJel Modifier (" + CurMech.GetArmor().GetHarjelMod(LocationIndex.MECH_LOC_RA) + ")"; } - retval += String.format( " %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetRADefensiveBV( ModArmor ) ) + NL; - line = "LL Armor Factor (" + ( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LL ) + ModArmor[LocationIndex.MECH_LOC_LL] * 10 ) + ") * Armor Type Modifier (" + CurMech.GetArmor().GetLLArmorType().GetBVTypeMult() + ")"; + retval += String.format(" %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetRADefensiveBV(ModArmor)) + + NL; + line = "LL Armor Factor (" + + (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LL) + + ModArmor[LocationIndex.MECH_LOC_LL] * 10) + + ") * Armor Type Modifier (" + CurMech.GetArmor().GetLLArmorType().GetBVTypeMult() + ")"; if (CurMech.GetArmor().HasHarjelMod(LocationIndex.MECH_LOC_LL)) { line += " * HarJel Modifier (" + CurMech.GetArmor().GetHarjelMod(LocationIndex.MECH_LOC_LL) + ")"; } - retval += String.format( " %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetLLDefensiveBV( ModArmor ) ) + NL; - line = "RL Armor Factor (" + ( CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RL ) + ModArmor[LocationIndex.MECH_LOC_RL] * 10 ) + ") * Armor Type Modifier (" + CurMech.GetArmor().GetRLArmorType().GetBVTypeMult() + ")"; + retval += String.format(" %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetLLDefensiveBV(ModArmor)) + + NL; + line = "RL Armor Factor (" + + (CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RL) + + ModArmor[LocationIndex.MECH_LOC_RL] * 10) + + ") * Armor Type Modifier (" + CurMech.GetArmor().GetRLArmorType().GetBVTypeMult() + ")"; if (CurMech.GetArmor().HasHarjelMod(LocationIndex.MECH_LOC_RL)) { line += " * HarJel Modifier (" + CurMech.GetArmor().GetHarjelMod(LocationIndex.MECH_LOC_RL) + ")"; } - retval += String.format( " %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetRLDefensiveBV( ModArmor ) ) + NL; + retval += String.format(" %1$-72s %2$,8.2f", line, CurMech.GetArmor().GetRLDefensiveBV(ModArmor)) + + NL; } - retval += String.format( "%1$-71s %2$,8.2f", " Total Location Armor BV (" + ( CurMech.GetArmor().GetHDDefensiveBV( ModArmor ) + CurMech.GetArmor().GetCTDefensiveBV( ModArmor ) + CurMech.GetArmor().GetRTDefensiveBV( ModArmor ) + CurMech.GetArmor().GetLTDefensiveBV( ModArmor ) + CurMech.GetArmor().GetRADefensiveBV( ModArmor ) + CurMech.GetArmor().GetLADefensiveBV( ModArmor ) + CurMech.GetArmor().GetRLDefensiveBV( ModArmor ) + CurMech.GetArmor().GetLLDefensiveBV( ModArmor ) ) + ") * 2.5", CurMech.GetArmor().GetDefensiveBV() ) + NL; + retval += String.format("%1$-71s %2$,8.2f", + " Total Location Armor BV (" + (CurMech.GetArmor().GetHDDefensiveBV(ModArmor) + + CurMech.GetArmor().GetCTDefensiveBV(ModArmor) + + CurMech.GetArmor().GetRTDefensiveBV(ModArmor) + + CurMech.GetArmor().GetLTDefensiveBV(ModArmor) + + CurMech.GetArmor().GetRADefensiveBV(ModArmor) + + CurMech.GetArmor().GetLADefensiveBV(ModArmor) + + CurMech.GetArmor().GetRLDefensiveBV(ModArmor) + + CurMech.GetArmor().GetLLDefensiveBV(ModArmor)) + ") * 2.5", + CurMech.GetArmor().GetDefensiveBV()) + NL; } else { - if( CurMech.GetCockpit().IsTorsoMounted() ) { - retval += "( Total Armor Factor (" + ( CurMech.GetArmor().GetArmorValue() + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_CT) + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_CTR) ) + ") * Armor Type Modifier (" + CurMech.GetArmor().GetBVTypeMult() + ")" + NL; - retval += String.format( "%1$-71s %2$,8.2f", " + Modular Armor Value (" + CurMech.GetArmor().GetModularArmorValue() + ") ) * 2.5", CurMech.GetArmor().GetDefensiveBV() ) + NL; + if (CurMech.GetCockpit().IsTorsoMounted()) { + retval += "( Total Armor Factor (" + + (CurMech.GetArmor().GetArmorValue() + + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_CT) + + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_CTR)) + + ") * Armor Type Modifier (" + CurMech.GetArmor().GetBVTypeMult() + ")" + NL; + retval += String.format("%1$-71s %2$,8.2f", + " + Modular Armor Value (" + CurMech.GetArmor().GetModularArmorValue() + ") ) * 2.5", + CurMech.GetArmor().GetDefensiveBV()) + NL; retval += " (Front and Rear CT armor value doubled due to Torso-Mounted Cockpit)" + NL; } else { - retval += String.format( "%1$-71s %2$,8.2f", "Total Armor Factor (" + CurMech.GetArmor().GetArmorValue() + ") * Armor Type Modifier (" + CurMech.GetArmor().GetBVTypeMult() + ") * 2.5", CurMech.GetArmor().GetDefensiveBV() ) + NL; + retval += String.format("%1$-71s %2$,8.2f", + "Total Armor Factor (" + CurMech.GetArmor().GetArmorValue() + ") * Armor Type Modifier (" + + CurMech.GetArmor().GetBVTypeMult() + ") * 2.5", + CurMech.GetArmor().GetDefensiveBV()) + NL; } } - retval += "Total Structure Points (" + CurMech.GetIntStruc().GetTotalPoints() + ") * Structure Type Modifier (" + CurMech.GetIntStruc().GetBVTypeMult() + ")" + NL; - retval += String.format( "%1$-71s %2$,8.2f", " * Engine Type Modifier (" + CurMech.GetEngine().GetBVMult() + ") * 1.5", CurMech.GetIntStruc().GetDefensiveBV() ) + NL; - retval += String.format( "%1$-71s %2$,8.2f", "Mech Tonnage (" + CurMech.GetTonnage() + ") * Gyro Type Modifer (" + CurMech.GetGyro().GetBVTypeMult() + ")", CurMech.GetGyro().GetDefensiveBV() ) + NL; - retval += String.format( "%1$-71s %2$,8.2f", "Total Defensive BV of all Equipment", CurMech.GetDefensiveEquipBV() ) + NL; - retval += String.format( "%1$-71s %2$,8.2f", "Excessive Ammunition Penalty", CurMech.GetDefensiveExcessiveAmmoPenalty() ) + NL; - retval += String.format( "%1$-71s %2$,8.2f", "Explosive Ammunition Penalty", CurMech.GetExplosiveAmmoPenalty() ) + NL; - retval += String.format( "%1$-71s %2$,8.2f", "Explosive Item Penalty ", CurMech.GetExplosiveWeaponPenalty() ) + NL; - retval += String.format( "%1$-71s %2$,8.2f", "Subtotal", CurMech.GetUnmodifiedDefensiveBV() ) + NL; + retval += "Total Structure Points (" + CurMech.GetIntStruc().GetTotalPoints() + ") * Structure Type Modifier (" + + CurMech.GetIntStruc().GetBVTypeMult() + ")" + NL; + retval += String.format("%1$-71s %2$,8.2f", + " * Engine Type Modifier (" + CurMech.GetEngine().GetBVMult() + ") * 1.5", + CurMech.GetIntStruc().GetDefensiveBV()) + NL; + retval += String.format("%1$-71s %2$,8.2f", "Mech Tonnage (" + CurMech.GetTonnage() + ") * Gyro Type Modifer (" + + CurMech.GetGyro().GetBVTypeMult() + ")", CurMech.GetGyro().GetDefensiveBV()) + NL; + retval += String.format("%1$-71s %2$,8.2f", "Total Defensive BV of all Equipment", + CurMech.GetDefensiveEquipBV()) + NL; + retval += String.format("%1$-71s %2$,8.2f", "Excessive Ammunition Penalty", + CurMech.GetDefensiveExcessiveAmmoPenalty()) + NL; + retval += String.format("%1$-71s %2$,8.2f", "Explosive Ammunition Penalty", CurMech.GetExplosiveAmmoPenalty()) + + NL; + retval += String.format("%1$-71s %2$,8.2f", "Explosive Item Penalty ", CurMech.GetExplosiveWeaponPenalty()) + + NL; + retval += String.format("%1$-71s %2$,8.2f", "Subtotal", CurMech.GetUnmodifiedDefensiveBV()) + NL; retval += "Defensive Speed Factor Breakdown:" + NL; retval += PrintDefensiveFactorCalculations(); - retval += String.format( "%1$-71s %2$,8.2f", "Total DBV (Subtotal * Defensive Speed Factor (" + String.format( "%1$,4.2f", CurMech.GetDefensiveFactor() ) + "))", CurMech.GetDefensiveBV() ) + NL; + retval += String.format("%1$-71s %2$,8.2f", + "Total DBV (Subtotal * Defensive Speed Factor (" + + String.format("%1$,4.2f", CurMech.GetDefensiveFactor()) + "))", + CurMech.GetDefensiveBV()) + NL; retval += NL + NL; retval += "Offensive BV Calculation Breakdown" + NL; retval += "________________________________________________________________________________" + NL; - - - retval += "Heat Efficiency (6 + " + CurMech.GetHeatSinks().TotalDissipation() + " (Dissipation) - " + CurMech.GetBVMovementHeat() + " (Movement Heat)"; + + retval += "Heat Efficiency (6 + " + CurMech.GetHeatSinks().TotalDissipation() + " (Dissipation) - " + + CurMech.GetBVMovementHeat() + " (Movement Heat)"; double heatEfficiency = 6 + CurMech.GetHeatSinks().TotalDissipation() - CurMech.GetBVMovementHeat(); if (CurMech.HasChameleon()) { retval += " - 6 (Chameleon LPS)"; @@ -262,31 +483,40 @@ public String Render() { retval += " - 10 (Void-Signature System)"; heatEfficiency -= 10; } - if( HasBonusFromCP() ) { + if (HasBonusFromCP()) { heatEfficiency += GetBonusFromCP(); - retval += " + " + GetBonusFromCP() + " (Coolant Pods)) = " + heatEfficiency + NL; + retval += " + " + GetBonusFromCP() + " (Coolant Pods)) = " + heatEfficiency + NL; } else { retval += ") = " + heatEfficiency + NL; } if (CurMech.GetLoadout().HasItem("Radical Heat Sink")) { - retval += "(Dissipation includes bonus from Radical Heat Sinks: " + (int)Math.ceil(CurMech.GetHeatSinks().GetNumHS() * 0.4) + ")" + NL; + retval += "(Dissipation includes bonus from Radical Heat Sinks: " + + (int) Math.ceil(CurMech.GetHeatSinks().GetNumHS() * 0.4) + ")" + NL; } - retval += String.format( "%1$-71s %2$,8.2f", "Adjusted Weapon BV Total WBV", CurMech.GetHeatAdjustedWeaponBV() ) + NL; + retval += String.format("%1$-71s %2$,8.2f", "Adjusted Weapon BV Total WBV", CurMech.GetHeatAdjustedWeaponBV()) + + NL; retval += PrintHeatAdjustedWeaponBV(); - retval += String.format( "%1$-71s %2$,8.2f", "Non-Heat Equipment Total NHBV", CurMech.GetNonHeatEquipBV() ) + NL; + retval += String.format("%1$-71s %2$,8.2f", "Non-Heat Equipment Total NHBV", CurMech.GetNonHeatEquipBV()) + NL; retval += PrintNonHeatEquipBV(); - retval += String.format( "%1$-71s %2$,8.2f", "Excessive Ammunition Penalty", CurMech.GetExcessiveAmmoPenalty() ) + NL; - retval += String.format( "%1$-71s %2$,8.2f", "Mech Tonnage Bonus", CurMech.GetTonnageBV() ) + NL; - retval += String.format( "%1$-71s %2$,8.2f", "Subtotal (WBV + NHBV - Excessive Ammo + Tonnage Bonus)", CurMech.GetUnmodifiedOffensiveBV() ) + NL; + retval += String.format("%1$-71s %2$,8.2f", "Excessive Ammunition Penalty", CurMech.GetExcessiveAmmoPenalty()) + + NL; + retval += String.format("%1$-71s %2$,8.2f", "Mech Tonnage Bonus", CurMech.GetTonnageBV()) + NL; + retval += String.format("%1$-71s %2$,8.2f", "Subtotal (WBV + NHBV - Excessive Ammo + Tonnage Bonus)", + CurMech.GetUnmodifiedOffensiveBV()) + NL; retval += "Offensive Speed Factor Breakdown:" + NL; retval += PrintOffensiveFactorCalculations(); - retval += String.format( "%1$-71s %2$,8.2f", "Total OBV (Subtotal * Offensive Speed Factor (" + CurMech.GetOffensiveFactor() + "))", CurMech.GetOffensiveBV() ) + NL; + retval += String.format("%1$-71s %2$,8.2f", + "Total OBV (Subtotal * Offensive Speed Factor (" + CurMech.GetOffensiveFactor() + "))", + CurMech.GetOffensiveBV()) + NL; retval += NL + NL; - if( CurMech.GetCockpit().BVMod() != 1.0f ) { - retval += String.format( "%1$-71s %2$,8.2f", CurMech.GetCockpit().CritName() + " modifier", CurMech.GetCockpit().BVMod() ) + NL; - retval += String.format( "%1$-73s %2$,6d", "Total Battle Value ((DBV + OBV) * cockpit modifier, round off)", CurMech.GetCurrentBV() ); + if (CurMech.GetCockpit().BVMod() != 1.0f) { + retval += String.format("%1$-71s %2$,8.2f", CurMech.GetCockpit().CritName() + " modifier", + CurMech.GetCockpit().BVMod()) + NL; + retval += String.format("%1$-73s %2$,6d", "Total Battle Value ((DBV + OBV) * cockpit modifier, round off)", + CurMech.GetCurrentBV()); } else { - retval += String.format( "%1$-73s %2$,6d", "Total Battle Value (DBV + OBV, round off)", CurMech.GetCurrentBV() ); + retval += String.format("%1$-73s %2$,6d", "Total Battle Value (DBV + OBV, round off)", + CurMech.GetCurrentBV()); } return retval; } @@ -296,106 +526,166 @@ private String GetEquipmentCostLines() { String retval = ""; ArrayList v = CurMech.GetLoadout().GetNonCore(); abPlaceable a; - for( int i = 0; i < v.size(); i++ ) { - a = (abPlaceable) v.get( i ); - if( a instanceof RangedWeapon ) { - if( ((RangedWeapon) a).IsUsingFCS() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", a.CritName() + " w/ " + ((abPlaceable) ((RangedWeapon) a).GetFCS()).CritName(), a.GetDefensiveBV(), a.GetOffensiveBV(), a.GetCost() ) + NL; + for (int i = 0; i < v.size(); i++) { + a = (abPlaceable) v.get(i); + if (a instanceof RangedWeapon) { + if (((RangedWeapon) a).IsUsingFCS()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", + a.CritName() + " w/ " + ((abPlaceable) ((RangedWeapon) a).GetFCS()).CritName(), + a.GetDefensiveBV(), a.GetOffensiveBV(), a.GetCost()) + NL; } else { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", a.CritName(), a.GetDefensiveBV(), a.GetOffensiveBV(), a.GetCost() ) + NL; + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", a.CritName(), + a.GetDefensiveBV(), a.GetOffensiveBV(), a.GetCost()) + NL; } } else { - if( a instanceof Equipment && ((Equipment)a).LookupName().equals("Radical Heat Sink")) - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", a.CritName(), a.GetDefensiveBV(), a.GetOffensiveBV(), a.GetCost() ) + NL; + if (a instanceof Equipment && ((Equipment) a).LookupName().equals("Radical Heat Sink")) + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", a.CritName(), + a.GetDefensiveBV(), a.GetOffensiveBV(), a.GetCost()) + NL; else - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", a.CritName(), a.GetDefensiveBV(), a.GetOffensiveBV(), a.GetCost() ) + NL; + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", a.CritName(), + a.GetDefensiveBV(), a.GetOffensiveBV(), a.GetCost()) + NL; } } - if( CurMech.HasCommandConsole() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetCommandConsole().CritName(), CurMech.GetCommandConsole().GetDefensiveBV(), CurMech.GetCommandConsole().GetOffensiveBV(), CurMech.GetCommandConsole().GetCost() ) + NL; - } - if( CurMech.UsingTC() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "Targeting Computer", CurMech.GetTC().GetDefensiveBV(), CurMech.GetTC().GetOffensiveBV(), CurMech.GetTC().GetCost() ) + NL; - } - if( CurMech.HasNullSig() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetNullSig().CritName(), CurMech.GetNullSig().GetDefensiveBV(), CurMech.GetNullSig().GetOffensiveBV(), CurMech.GetNullSig().GetCost() ) + NL; - } - if( CurMech.HasChameleon() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetChameleon().CritName(), CurMech.GetChameleon().GetDefensiveBV(), CurMech.GetChameleon().GetOffensiveBV(), CurMech.GetChameleon().GetCost() ) + NL; - } - if( CurMech.HasVoidSig() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetVoidSig().CritName(), CurMech.GetVoidSig().GetDefensiveBV(), CurMech.GetVoidSig().GetOffensiveBV(), CurMech.GetVoidSig().GetCost() ) + NL; - } - if( CurMech.HasBlueShield() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetBlueShield().CritName(), CurMech.GetBlueShield().GetDefensiveBV(), CurMech.GetBlueShield().GetOffensiveBV(), CurMech.GetBlueShield().GetCost() ) + NL; - } - if( CurMech.UsingPartialWing() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetPartialWing().CritName(), CurMech.GetPartialWing().GetDefensiveBV(), CurMech.GetPartialWing().GetOffensiveBV(), CurMech.GetPartialWing().GetCost() ) + NL; + if (CurMech.HasCommandConsole()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetCommandConsole().CritName(), + CurMech.GetCommandConsole().GetDefensiveBV(), CurMech.GetCommandConsole().GetOffensiveBV(), + CurMech.GetCommandConsole().GetCost()) + NL; } - if( CurMech.UsingJumpBooster() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetJumpBooster().CritName(), CurMech.GetJumpBooster().GetDefensiveBV(), CurMech.GetJumpBooster().GetOffensiveBV(), CurMech.GetJumpBooster().GetCost() ) + NL; + if (CurMech.UsingTC()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "Targeting Computer", + CurMech.GetTC().GetDefensiveBV(), CurMech.GetTC().GetOffensiveBV(), CurMech.GetTC().GetCost()) + NL; } - if( CurMech.GetLoadout().HasSupercharger() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetLoadout().GetSupercharger().CritName(), CurMech.GetLoadout().GetSupercharger().GetDefensiveBV(), CurMech.GetLoadout().GetSupercharger().GetOffensiveBV(), CurMech.GetLoadout().GetSupercharger().GetCost() ) + NL; - } - if( CurMech.HasLAAES() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetLAAES().CritName(), CurMech.GetLAAES().GetDefensiveBV(), CurMech.GetLAAES().GetOffensiveBV(), CurMech.GetLAAES().GetCost() ) + NL; + if (CurMech.HasNullSig()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetNullSig().CritName(), + CurMech.GetNullSig().GetDefensiveBV(), CurMech.GetNullSig().GetOffensiveBV(), + CurMech.GetNullSig().GetCost()) + NL; } - if( CurMech.HasRAAES() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetRAAES().CritName(), CurMech.GetRAAES().GetDefensiveBV(), CurMech.GetRAAES().GetOffensiveBV(), CurMech.GetRAAES().GetCost() ) + NL; + if (CurMech.HasChameleon()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetChameleon().CritName(), + CurMech.GetChameleon().GetDefensiveBV(), CurMech.GetChameleon().GetOffensiveBV(), + CurMech.GetChameleon().GetCost()) + NL; } - if( CurMech.HasLegAES() ) { - if( CurMech.IsQuad() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetRLAES().CritName(), CurMech.GetRLAES().GetDefensiveBV(), CurMech.GetRLAES().GetOffensiveBV(), CurMech.GetRLAES().GetCost() ) + NL; - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetRLAES().CritName(), CurMech.GetRLAES().GetDefensiveBV(), CurMech.GetRLAES().GetOffensiveBV(), CurMech.GetRLAES().GetCost() ) + NL; - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetRLAES().CritName(), CurMech.GetRLAES().GetDefensiveBV(), CurMech.GetRLAES().GetOffensiveBV(), CurMech.GetRLAES().GetCost() ) + NL; - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetRLAES().CritName(), CurMech.GetRLAES().GetDefensiveBV(), CurMech.GetRLAES().GetOffensiveBV(), CurMech.GetRLAES().GetCost() ) + NL; + if (CurMech.HasVoidSig()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetVoidSig().CritName(), + CurMech.GetVoidSig().GetDefensiveBV(), CurMech.GetVoidSig().GetOffensiveBV(), + CurMech.GetVoidSig().GetCost()) + NL; + } + if (CurMech.HasBlueShield()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetBlueShield().CritName(), + CurMech.GetBlueShield().GetDefensiveBV(), CurMech.GetBlueShield().GetOffensiveBV(), + CurMech.GetBlueShield().GetCost()) + NL; + } + if (CurMech.UsingPartialWing()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetPartialWing().CritName(), + CurMech.GetPartialWing().GetDefensiveBV(), CurMech.GetPartialWing().GetOffensiveBV(), + CurMech.GetPartialWing().GetCost()) + NL; + } + if (CurMech.UsingJumpBooster()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetJumpBooster().CritName(), + CurMech.GetJumpBooster().GetDefensiveBV(), CurMech.GetJumpBooster().GetOffensiveBV(), + CurMech.GetJumpBooster().GetCost()) + NL; + } + if (CurMech.GetLoadout().HasSupercharger()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", + CurMech.GetLoadout().GetSupercharger().CritName(), + CurMech.GetLoadout().GetSupercharger().GetDefensiveBV(), + CurMech.GetLoadout().GetSupercharger().GetOffensiveBV(), + CurMech.GetLoadout().GetSupercharger().GetCost()) + NL; + } + if (CurMech.HasLAAES()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetLAAES().CritName(), + CurMech.GetLAAES().GetDefensiveBV(), CurMech.GetLAAES().GetOffensiveBV(), + CurMech.GetLAAES().GetCost()) + NL; + } + if (CurMech.HasRAAES()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetRAAES().CritName(), + CurMech.GetRAAES().GetDefensiveBV(), CurMech.GetRAAES().GetOffensiveBV(), + CurMech.GetRAAES().GetCost()) + NL; + } + if (CurMech.HasLegAES()) { + if (CurMech.IsQuad()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetRLAES().CritName(), + CurMech.GetRLAES().GetDefensiveBV(), CurMech.GetRLAES().GetOffensiveBV(), + CurMech.GetRLAES().GetCost()) + NL; + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetRLAES().CritName(), + CurMech.GetRLAES().GetDefensiveBV(), CurMech.GetRLAES().GetOffensiveBV(), + CurMech.GetRLAES().GetCost()) + NL; + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetRLAES().CritName(), + CurMech.GetRLAES().GetDefensiveBV(), CurMech.GetRLAES().GetOffensiveBV(), + CurMech.GetRLAES().GetCost()) + NL; + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetRLAES().CritName(), + CurMech.GetRLAES().GetDefensiveBV(), CurMech.GetRLAES().GetOffensiveBV(), + CurMech.GetRLAES().GetCost()) + NL; } else { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetRLAES().CritName(), CurMech.GetRLAES().GetDefensiveBV(), CurMech.GetRLAES().GetOffensiveBV(), CurMech.GetRLAES().GetCost() ) + NL; - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetRLAES().CritName(), CurMech.GetRLAES().GetDefensiveBV(), CurMech.GetRLAES().GetOffensiveBV(), CurMech.GetRLAES().GetCost() ) + NL; + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetRLAES().CritName(), + CurMech.GetRLAES().GetDefensiveBV(), CurMech.GetRLAES().GetOffensiveBV(), + CurMech.GetRLAES().GetCost()) + NL; + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetRLAES().CritName(), + CurMech.GetRLAES().GetDefensiveBV(), CurMech.GetRLAES().GetOffensiveBV(), + CurMech.GetRLAES().GetCost()) + NL; } } - if( CurMech.GetLoadout().HasHDTurret() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetLoadout().GetHDTurret().CritName(), CurMech.GetLoadout().GetHDTurret().GetDefensiveBV(), CurMech.GetLoadout().GetHDTurret().GetOffensiveBV(), CurMech.GetLoadout().GetHDTurret().GetCost() ) + NL; + if (CurMech.GetLoadout().HasHDTurret()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", + CurMech.GetLoadout().GetHDTurret().CritName(), CurMech.GetLoadout().GetHDTurret().GetDefensiveBV(), + CurMech.GetLoadout().GetHDTurret().GetOffensiveBV(), CurMech.GetLoadout().GetHDTurret().GetCost()) + + NL; } - if( CurMech.GetLoadout().HasLTTurret() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetLoadout().GetLTTurret().CritName(), CurMech.GetLoadout().GetLTTurret().GetDefensiveBV(), CurMech.GetLoadout().GetLTTurret().GetOffensiveBV(), CurMech.GetLoadout().GetLTTurret().GetCost() ) + NL; + if (CurMech.GetLoadout().HasLTTurret()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", + CurMech.GetLoadout().GetLTTurret().CritName(), CurMech.GetLoadout().GetLTTurret().GetDefensiveBV(), + CurMech.GetLoadout().GetLTTurret().GetOffensiveBV(), CurMech.GetLoadout().GetLTTurret().GetCost()) + + NL; } - if( CurMech.GetLoadout().HasRTTurret() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurMech.GetLoadout().GetRTTurret().CritName(), CurMech.GetLoadout().GetRTTurret().GetDefensiveBV(), CurMech.GetLoadout().GetRTTurret().GetOffensiveBV(), CurMech.GetLoadout().GetRTTurret().GetCost() ) + NL; + if (CurMech.GetLoadout().HasRTTurret()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", + CurMech.GetLoadout().GetRTTurret().CritName(), CurMech.GetLoadout().GetRTTurret().GetDefensiveBV(), + CurMech.GetLoadout().GetRTTurret().GetOffensiveBV(), CurMech.GetLoadout().GetRTTurret().GetCost()) + + NL; } - if( CurMech.HasCTCase() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE", 0.0, 0.0, CurMech.GetLoadout().GetCTCase().GetCost() ) + NL; + if (CurMech.HasCTCase()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE", 0.0, 0.0, + CurMech.GetLoadout().GetCTCase().GetCost()) + NL; } - if( CurMech.HasLTCase() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE", 0.0, 0.0, CurMech.GetLoadout().GetLTCase().GetCost() ) + NL; + if (CurMech.HasLTCase()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE", 0.0, 0.0, + CurMech.GetLoadout().GetLTCase().GetCost()) + NL; } - if( CurMech.HasRTCase() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE", 0.0, 0.0, CurMech.GetLoadout().GetRTCase().GetCost() ) + NL; + if (CurMech.HasRTCase()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE", 0.0, 0.0, + CurMech.GetLoadout().GetRTCase().GetCost()) + NL; } - if( CurMech.GetLoadout().HasHDCASEII() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE II", 0.0, 0.0, CurMech.GetLoadout().GetHDCaseII().GetCost() ) + NL; + if (CurMech.GetLoadout().HasHDCASEII()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE II", 0.0, 0.0, + CurMech.GetLoadout().GetHDCaseII().GetCost()) + NL; } - if( CurMech.GetLoadout().HasCTCASEII() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE II", 0.0, 0.0, CurMech.GetLoadout().GetCTCaseII().GetCost() ) + NL; + if (CurMech.GetLoadout().HasCTCASEII()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE II", 0.0, 0.0, + CurMech.GetLoadout().GetCTCaseII().GetCost()) + NL; } - if( CurMech.GetLoadout().HasLTCASEII() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE II", 0.0, 0.0, CurMech.GetLoadout().GetLTCaseII().GetCost() ) + NL; + if (CurMech.GetLoadout().HasLTCASEII()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE II", 0.0, 0.0, + CurMech.GetLoadout().GetLTCaseII().GetCost()) + NL; } - if( CurMech.GetLoadout().HasRTCASEII() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE II", 0.0, 0.0, CurMech.GetLoadout().GetRTCaseII().GetCost() ) + NL; + if (CurMech.GetLoadout().HasRTCASEII()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE II", 0.0, 0.0, + CurMech.GetLoadout().GetRTCaseII().GetCost()) + NL; } - if( CurMech.GetLoadout().HasLACASEII() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE II", 0.0, 0.0, CurMech.GetLoadout().GetLACaseII().GetCost() ) + NL; + if (CurMech.GetLoadout().HasLACASEII()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE II", 0.0, 0.0, + CurMech.GetLoadout().GetLACaseII().GetCost()) + NL; } - if( CurMech.GetLoadout().HasRACASEII() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE II", 0.0, 0.0, CurMech.GetLoadout().GetRACaseII().GetCost() ) + NL; + if (CurMech.GetLoadout().HasRACASEII()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE II", 0.0, 0.0, + CurMech.GetLoadout().GetRACaseII().GetCost()) + NL; } - if( CurMech.GetLoadout().HasLLCASEII() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE II", 0.0, 0.0, CurMech.GetLoadout().GetLLCaseII().GetCost() ) + NL; + if (CurMech.GetLoadout().HasLLCASEII()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE II", 0.0, 0.0, + CurMech.GetLoadout().GetLLCaseII().GetCost()) + NL; } - if( CurMech.GetLoadout().HasRLCASEII() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE II", 0.0, 0.0, CurMech.GetLoadout().GetRLCaseII().GetCost() ) + NL; + if (CurMech.GetLoadout().HasRLCASEII()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "CASE II", 0.0, 0.0, + CurMech.GetLoadout().GetRLCaseII().GetCost()) + NL; } return retval; } @@ -406,37 +696,40 @@ public String PrintNonHeatEquipBV() { abPlaceable a = null; String retval = ""; - for( int i = 0; i < v.size(); i++ ) { - if( ! ( v.get( i ) instanceof ifWeapon ) ) { - a = ((abPlaceable) v.get( i )); - retval += String.format( "%1$-71s %2$,8.2f", " -> " + a.CritName(), a.GetOffensiveBV() ) + NL; + for (int i = 0; i < v.size(); i++) { + if (!(v.get(i) instanceof ifWeapon)) { + a = ((abPlaceable) v.get(i)); + retval += String.format("%1$-71s %2$,8.2f", " -> " + a.CritName(), a.GetOffensiveBV()) + NL; } } return retval; } public String PrintHeatAdjustedWeaponBV() { - ArrayList v = CurMech.GetLoadout().GetNonCore(), wep = new ArrayList(); + ArrayList v = CurMech.GetLoadout().GetNonCore(), + wep = new ArrayList(); double foreBV = 0.0, rearBV = 0.0; boolean UseRear = false, TC = CurMech.UsingTC(), UseAESMod = false, Robotic = CurMech.UsingRoboticCockpit(); String retval = ""; abPlaceable a; // is it even worth performing all this? - if( v.size() <= 0 ) { + if (v.size() <= 0) { // nope return retval; } // trim out the other equipment and get a list of offensive weapons only. - for( int i = 0; i < v.size(); i++ ) { - if( v.get( i ) instanceof ifWeapon ) { - wep.add( v.get( i ) ); + for (int i = 0; i < v.size(); i++) { + if (v.get(i) instanceof ifWeapon) { + wep.add(v.get(i)); } } // just to save us a headache if there are no weapons - if( wep.size() <= 0 ) { return retval; } + if (wep.size() <= 0) { + return retval; + } // now get the mech's heat efficiency and the total heat from weapons double heff = 6 + CurMech.GetHeatSinks().TotalDissipation() - CurMech.GetBVMovementHeat(); @@ -444,59 +737,69 @@ public String PrintHeatAdjustedWeaponBV() { double wheat = CurMech.GetBVWeaponHeat(); // find out the total BV of rear and forward firing weapons - for( int i = 0; i < wep.size(); i++ ) { - a = ((abPlaceable) wep.get( i )); + for (int i = 0; i < wep.size(); i++) { + a = ((abPlaceable) wep.get(i)); // arm mounted weapons always count their full BV, so ignore them. - int loc = CurMech.GetLoadout().Find( a ); - if( loc != LocationIndex.MECH_LOC_LA && loc != LocationIndex.MECH_LOC_RA ) { - UseAESMod = CurMech.UseAESModifier( a ); - if( a.IsMountedRear() ) { - rearBV += a.GetCurOffensiveBV( true, TC, UseAESMod, Robotic ); + int loc = CurMech.GetLoadout().Find(a); + if (loc != LocationIndex.MECH_LOC_LA && loc != LocationIndex.MECH_LOC_RA) { + UseAESMod = CurMech.UseAESModifier(a); + if (a.IsMountedRear()) { + rearBV += a.GetCurOffensiveBV(true, TC, UseAESMod, Robotic); } else { - foreBV += a.GetCurOffensiveBV( false, TC, UseAESMod, Robotic ); + foreBV += a.GetCurOffensiveBV(false, TC, UseAESMod, Robotic); } } } - if( rearBV > foreBV ) { UseRear = true; } + if (rearBV > foreBV) { + UseRear = true; + } // see if we need to run heat calculations - if( heff - wheat >= 0 ) { + if (heff - wheat >= 0) { // no need for extensive calculations, return the weapon BV - for( int i = 0; i < wep.size(); i++ ) { - a = ((abPlaceable) wep.get( i )); - int loc = CurMech.GetLoadout().Find( a ); - UseAESMod = CurMech.UseAESModifier( ((abPlaceable) wep.get( i )) ); - if( loc != LocationIndex.MECH_LOC_LA && loc != LocationIndex.MECH_LOC_RA ) { - retval += String.format( "%1$-71s %2$,8.2f", " -> " + a.CritName(), a.GetCurOffensiveBV( UseRear, TC, UseAESMod ) ) + NL; + for (int i = 0; i < wep.size(); i++) { + a = ((abPlaceable) wep.get(i)); + int loc = CurMech.GetLoadout().Find(a); + UseAESMod = CurMech.UseAESModifier(((abPlaceable) wep.get(i))); + if (loc != LocationIndex.MECH_LOC_LA && loc != LocationIndex.MECH_LOC_RA) { + retval += String.format("%1$-71s %2$,8.2f", " -> " + a.CritName(), + a.GetCurOffensiveBV(UseRear, TC, UseAESMod)) + NL; } else { - retval += String.format( "%1$-71s %2$,8.2f", " -> " + a.CritName(), a.GetCurOffensiveBV( false, TC, UseAESMod ) ) + NL; + retval += String.format("%1$-71s %2$,8.2f", " -> " + a.CritName(), + a.GetCurOffensiveBV(false, TC, UseAESMod)) + NL; } } return retval; } // Sort the weapon list - abPlaceable[] sorted = CurMech.SortWeapons( wep, UseRear ); + ArrayList sorted = CurMech.SortWeapons(wep, UseRear); // calculate the BV of the weapons based on heat int curheat = 0; - for( int i = 0; i < sorted.length; i++ ) { + for (int i = 0; i < sorted.size(); i++) { boolean DoRear = UseRear; - a = sorted[i]; - int loc = CurMech.GetLoadout().Find( a ); - //changed below to DoRear = false because it would set Rear to true if it was false to begin with. - if( loc == LocationIndex.MECH_LOC_LA || loc == LocationIndex.MECH_LOC_RA ) { DoRear = false; } //!DoRear; } - UseAESMod = CurMech.UseAESModifier( a ); - if( curheat < heff ) { - retval += String.format( "%1$-71s %2$,8.2f", " -> " + a.CritName(), a.GetCurOffensiveBV( DoRear, TC, UseAESMod ) ) + NL; + a = sorted.get(i); + int loc = CurMech.GetLoadout().Find(a); + // changed below to DoRear = false because it would set Rear to true if it was + // false to begin with. + if (loc == LocationIndex.MECH_LOC_LA || loc == LocationIndex.MECH_LOC_RA) { + DoRear = false; + } // !DoRear; } + UseAESMod = CurMech.UseAESModifier(a); + if (curheat < heff) { + retval += String.format("%1$-71s %2$,8.2f", " -> " + a.CritName(), + a.GetCurOffensiveBV(DoRear, TC, UseAESMod)) + NL; } else { - if( ((ifWeapon) sorted[i]).GetBVHeat() <= 0 ) { - retval += String.format( "%1$-71s %2$,8.2f", " -> " + a.CritName(), a.GetCurOffensiveBV( DoRear, TC, UseAESMod ) ) + NL; + if (((ifWeapon) sorted.get(i)).GetBVHeat() <= 0) { + retval += String.format("%1$-71s %2$,8.2f", " -> " + a.CritName(), + a.GetCurOffensiveBV(DoRear, TC, UseAESMod)) + NL; } else { - retval += String.format( "%1$-71s %2$,8.2f", " -> " + a.CritName(), a.GetCurOffensiveBV( DoRear, TC, UseAESMod ) * 0.5 ) + NL; + retval += String.format("%1$-71s %2$,8.2f", " -> " + a.CritName(), + a.GetCurOffensiveBV(DoRear, TC, UseAESMod) * 0.5) + NL; } } - curheat += ((ifWeapon) sorted[i]).GetBVHeat(); + curheat += ((ifWeapon) sorted.get(i)).GetBVHeat(); } return retval; } @@ -507,37 +810,43 @@ public String PrintDefensiveFactorCalculations() { String retval = ""; // subtract one since we're indexing an array - int RunMP = CurMech.GetAdjustedRunningMP( true, true ) - 1; + int RunMP = CurMech.GetAdjustedRunningMP(true, true) - 1; int JumpMP = 0; // this is a safeguard for using MASC on an incredibly speedy chassis // there is currently no way to get a bonus higher anyway. - if( RunMP > 29 ) { RunMP = 29; } + if (RunMP > 29) { + RunMP = 29; + } // safeguard for low walk mp (Modular Armor, for instance) - if( RunMP < 0 ) { RunMP = 0; } + if (RunMP < 0) { + RunMP = 0; + } // Get the defensive factors for jumping and running movement double ground = Mech.DefensiveFactor[RunMP]; double jump = 0.0; - if( CurMech.GetJumpJets().GetNumJJ() > 0 ) { - JumpMP = CurMech.GetAdjustedJumpingMP( true ) - 1; - jump = Mech.DefensiveFactor[JumpMP] + 0.1; + if (CurMech.GetJumpJets().GetNumJJ() > 0) { + JumpMP = CurMech.GetAdjustedJumpingMP(true) - 1; + jump = Mech.DefensiveFactor[JumpMP] + 0.1; } - if( CurMech.UsingJumpBooster() ) { + if (CurMech.UsingJumpBooster()) { int boostMP = CurMech.GetJumpBoosterMP(); - if( boostMP > JumpMP ) { + if (boostMP > JumpMP) { JumpMP = boostMP; jump = Mech.DefensiveFactor[JumpMP] + 0.1; } } - MechModifier m = CurMech.GetTotalModifiers( true, true ); + MechModifier m = CurMech.GetTotalModifiers(true, true); - retval += " Maximum Ground Movement Modifier: " + String.format( "%1$,.2f", ground ) + NL; - retval += " Maximum Jump Movement Modifier: " + String.format( "%1$,.2f", jump ) + NL; - retval += " Defensive Speed Factor Bonus from Equipment: " + String.format( "%1$,.2f", m.DefensiveBonus() ) + NL; - retval += " Minimum Defensive Speed Factor: " + String.format( "%1$,.2f", m.MinimumDefensiveBonus() ) + NL; - retval += " (Max of Run or Jump) + DSF Bonus = " + String.format( "%1$,.2f", CurMech.GetDefensiveFactor() ) + NL; + retval += " Maximum Ground Movement Modifier: " + String.format("%1$,.2f", ground) + NL; + retval += " Maximum Jump Movement Modifier: " + String.format("%1$,.2f", jump) + NL; + retval += " Defensive Speed Factor Bonus from Equipment: " + String.format("%1$,.2f", m.DefensiveBonus()) + + NL; + retval += " Minimum Defensive Speed Factor: " + String.format("%1$,.2f", m.MinimumDefensiveBonus()) + NL; + retval += " (Max of Run or Jump) + DSF Bonus = " + String.format("%1$,.2f", CurMech.GetDefensiveFactor()) + + NL; return retval; } @@ -546,23 +855,42 @@ public String PrintOffensiveFactorCalculations() { String retval = ""; double temp; - if( CurMech.UsingJumpBooster() ) { - int boost = CurMech.GetAdjustedBoosterMP( true ); - int jump = CurMech.GetAdjustedJumpingMP( true ); - if( jump >= boost ) { - temp = (double) (CurMech.GetAdjustedRunningMP(true, true) + (Math.floor(CurMech.GetAdjustedJumpingMP(true) * 0.5 + 0.5)) - 5.0); - retval += " Adjusted Running MP (" + CurMech.GetAdjustedRunningMP( true, true ) + ") + ( Adjusted Jumping MP (" + CurMech.GetAdjustedJumpingMP( true ) + ") / 2 ) - 5 = " + String.format( "%1$,.2f", CurMech.GetAdjustedRunningMP( true, true ) + ( Math.floor( CurMech.GetAdjustedJumpingMP( true ) * 0.5 + 0.5 ) ) - 5.0 ) + NL; + if (CurMech.UsingJumpBooster()) { + int boost = CurMech.GetAdjustedBoosterMP(true); + int jump = CurMech.GetAdjustedJumpingMP(true); + if (jump >= boost) { + temp = (double) (CurMech.GetAdjustedRunningMP(true, true) + + (Math.floor(CurMech.GetAdjustedJumpingMP(true) * 0.5 + 0.5)) - 5.0); + retval += " Adjusted Running MP (" + CurMech.GetAdjustedRunningMP(true, true) + + ") + ( Adjusted Jumping MP (" + CurMech.GetAdjustedJumpingMP(true) + ") / 2 ) - 5 = " + String + .format("%1$,.2f", + CurMech.GetAdjustedRunningMP(true, true) + + (Math.floor(CurMech.GetAdjustedJumpingMP(true) * 0.5 + 0.5)) - 5.0) + + NL; } else { - temp = (double) (CurMech.GetAdjustedRunningMP(true, true) + (Math.floor(CurMech.GetAdjustedBoosterMP(true) * 0.5 + 0.5)) - 5.0); - retval += " Adjusted Running MP (" + CurMech.GetAdjustedRunningMP( true, true ) + ") + ( Adjusted Jumping MP (" + CurMech.GetAdjustedBoosterMP( true ) + ") / 2 ) - 5 = " + String.format( "%1$,.2f", CurMech.GetAdjustedRunningMP( true, true ) + ( Math.floor( CurMech.GetAdjustedBoosterMP( true ) * 0.5 + 0.5 ) ) - 5.0 ) + NL; + temp = (double) (CurMech.GetAdjustedRunningMP(true, true) + + (Math.floor(CurMech.GetAdjustedBoosterMP(true) * 0.5 + 0.5)) - 5.0); + retval += " Adjusted Running MP (" + CurMech.GetAdjustedRunningMP(true, true) + + ") + ( Adjusted Jumping MP (" + CurMech.GetAdjustedBoosterMP(true) + ") / 2 ) - 5 = " + String + .format("%1$,.2f", + CurMech.GetAdjustedRunningMP(true, true) + + (Math.floor(CurMech.GetAdjustedBoosterMP(true) * 0.5 + 0.5)) - 5.0) + + NL; } } else { - temp = (double) (CurMech.GetAdjustedRunningMP(true, true) + (Math.floor(CurMech.GetAdjustedJumpingMP(true) * 0.5 + 0.5)) - 5.0); - retval += " Adjusted Running MP (" + CurMech.GetAdjustedRunningMP( true, true ) + ") + ( Adjusted Jumping MP (" + CurMech.GetAdjustedJumpingMP( true ) + ") / 2 ) - 5 = " + String.format( "%1$,.2f", CurMech.GetAdjustedRunningMP( true, true ) + ( Math.floor( CurMech.GetAdjustedJumpingMP( true ) * 0.5 + 0.5 ) ) - 5.0 ) + NL; - } - retval += " " + String.format( "%1$,.2f", temp ) + " / 10 + 1 = " + String.format( "%1$.3f", ( temp * 0.1 + 1.0 ) ) + NL; + temp = (double) (CurMech.GetAdjustedRunningMP(true, true) + + (Math.floor(CurMech.GetAdjustedJumpingMP(true) * 0.5 + 0.5)) - 5.0); + retval += " Adjusted Running MP (" + CurMech.GetAdjustedRunningMP(true, true) + + ") + ( Adjusted Jumping MP (" + CurMech.GetAdjustedJumpingMP(true) + ") / 2 ) - 5 = " + + String.format("%1$,.2f", CurMech.GetAdjustedRunningMP(true, true) + + (Math.floor(CurMech.GetAdjustedJumpingMP(true) * 0.5 + 0.5)) - 5.0) + + NL; + } + retval += " " + String.format("%1$,.2f", temp) + " / 10 + 1 = " + String.format("%1$.3f", (temp * 0.1 + 1.0)) + + NL; temp = temp * 0.1 + 1.0; - retval += " " + String.format( "%1$,.2f", temp ) + " ^ 1.2 = " + (double) Math.floor( ( Math.pow( temp, 1.2 ) ) * 100 + 0.5 ) / 100 + " (rounded off to two digits)" + NL; + retval += " " + String.format("%1$,.2f", temp) + " ^ 1.2 = " + + (double) Math.floor((Math.pow(temp, 1.2)) * 100 + 0.5) / 100 + " (rounded off to two digits)" + NL; return retval; } @@ -570,12 +898,12 @@ public String PrintOffensiveFactorCalculations() { private boolean HasBonusFromCP() { ArrayList v = CurMech.GetLoadout().GetNonCore(); abPlaceable a; - if( CurMech.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL ) { + if (CurMech.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL) { // check for coolant pods - for( int i = 0; i < v.size(); i++ ) { - a = (abPlaceable) v.get( i ); - if( a instanceof Equipment ) { - if( ((Equipment) a).LookupName().equals( "Coolant Pod" ) ) { + for (int i = 0; i < v.size(); i++) { + a = (abPlaceable) v.get(i); + if (a instanceof Equipment) { + if (((Equipment) a).LookupName().equals("Coolant Pod")) { return true; } } @@ -590,19 +918,21 @@ private int GetBonusFromCP() { ArrayList v = CurMech.GetLoadout().GetNonCore(); abPlaceable a; - if( CurMech.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL ) { + if (CurMech.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL) { // check for coolant pods - for( int i = 0; i < v.size(); i++ ) { - a = (abPlaceable) v.get( i ); - if( a instanceof Equipment ) { - if( ((Equipment) a).LookupName().equals( "Coolant Pod" ) ) { + for (int i = 0; i < v.size(); i++) { + a = (abPlaceable) v.get(i); + if (a instanceof Equipment) { + if (((Equipment) a).LookupName().equals("Coolant Pod")) { NumPods++; } } } // get the heat sink bonus - BonusFromCP = (int) Math.ceil( (double) NumHS * ( (double) NumPods * 0.2 ) ); - if( BonusFromCP > MaxHSBonus ) { BonusFromCP = MaxHSBonus; } + BonusFromCP = (int) Math.ceil((double) NumHS * ((double) NumPods * 0.2)); + if (BonusFromCP > MaxHSBonus) { + BonusFromCP = MaxHSBonus; + } retval += BonusFromCP; } return retval; diff --git a/sswlib/src/main/java/visitors/VFCSArtemisVLoader.java b/sswlib/src/main/java/visitors/VFCSArtemisVLoader.java index 8f3f45f7..4986c9f8 100644 --- a/sswlib/src/main/java/visitors/VFCSArtemisVLoader.java +++ b/sswlib/src/main/java/visitors/VFCSArtemisVLoader.java @@ -45,7 +45,7 @@ public void LoadLocations(LocationIndex[] locs) { } public void Visit( Mech m ) { - ArrayList test = m.GetLoadout().GetNonCore(); + ArrayList test = m.GetLoadout().GetNonCore(); abPlaceable p; abPlaceable FCS; for( int i = 0; i < test.size(); i++ ) { @@ -127,18 +127,18 @@ private void SwitchSystem( RangedWeapon MW, Mech m ) { } public void Visit( CombatVehicle v ) throws Exception { - ArrayList test = v.GetLoadout().GetNonCore(); + ArrayList test = v.GetLoadout().GetNonCore(); abPlaceable p; - + for( int i = 0; i < test.size(); i++ ) { p = (abPlaceable) test.get( i ); //Is it a Ranged Weapon if( p instanceof RangedWeapon ) { RangedWeapon MW = (RangedWeapon) p; - + //if the weapon cannot do FCS let's move on quickly if ( !MW.IsFCSCapable() ) continue; - + //if the location is locked...stop here! if( v.IsOmni() && MW.LocationLocked() ) { result = false; From 5895f1b82feee73f9502aeec07d7f300e4bd22c3 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 21:17:51 -0600 Subject: [PATCH 050/126] sswlib/src/main/java/visitors - VFCSArtemisIVLoader - Strick Type Enforcement - VC Code Formatting --- .../java/visitors/VFCSArtemisIVLoader.java | 124 +++++++++--------- 1 file changed, 63 insertions(+), 61 deletions(-) diff --git a/sswlib/src/main/java/visitors/VFCSArtemisIVLoader.java b/sswlib/src/main/java/visitors/VFCSArtemisIVLoader.java index f469f859..b7883b8d 100644 --- a/sswlib/src/main/java/visitors/VFCSArtemisIVLoader.java +++ b/sswlib/src/main/java/visitors/VFCSArtemisIVLoader.java @@ -33,69 +33,70 @@ public class VFCSArtemisIVLoader implements ifVisitor { // this is normally set to true since we simply unallocate items that can't - // fit their artemis. For Omnimechs with locked missile launchers it's + // fit their artemis. For Omnimechs with locked missile launchers it's // another matter entirely. boolean result = true; - public void SetClan( boolean clan ) { + public void SetClan(boolean clan) { } public void LoadLocations(LocationIndex[] locs) { // does nothing here, but may later. } - public void Visit( Mech m ) { - ArrayList test = m.GetLoadout().GetNonCore(); + public void Visit(Mech m) { + ArrayList test = m.GetLoadout().GetNonCore(); abPlaceable p; abPlaceable FCS; - for( int i = 0; i < test.size(); i++ ) { - p = (abPlaceable) test.get( i ); - if( p instanceof RangedWeapon ) { + for (int i = 0; i < test.size(); i++) { + p = (abPlaceable) test.get(i); + if (p instanceof RangedWeapon) { RangedWeapon MW = (RangedWeapon) p; - if( MW.GetFCSType() == ifMissileGuidance.FCS_ArtemisIV || MW.GetFCSType() == ifMissileGuidance.FCS_ArtemisV ) { - if( m.UsingArtemisIV() ) { - if( MW.IsUsingFCS() ) { - if( m.IsOmnimech() ) { - if( MW.LocationLocked() ) { + if (MW.GetFCSType() == ifMissileGuidance.FCS_ArtemisIV + || MW.GetFCSType() == ifMissileGuidance.FCS_ArtemisV) { + if (m.UsingArtemisIV()) { + if (MW.IsUsingFCS()) { + if (m.IsOmnimech()) { + if (MW.LocationLocked()) { result = false; return; } else { - if( ! ( MW.GetFCS() instanceof ArtemisIVFCS ) ) { - SwitchSystem( MW, m ); + if (!(MW.GetFCS() instanceof ArtemisIVFCS)) { + SwitchSystem(MW, m); } } } else { - if( ! ( MW.GetFCS() instanceof ArtemisIVFCS ) ) { - SwitchSystem( MW, m ); + if (!(MW.GetFCS() instanceof ArtemisIVFCS)) { + SwitchSystem(MW, m); } } } else { - MW.UseFCS( true, ifMissileGuidance.FCS_ArtemisIV ); + MW.UseFCS(true, ifMissileGuidance.FCS_ArtemisIV); FCS = (abPlaceable) MW.GetFCS(); - LocationIndex index = m.GetLoadout().FindIndex( MW ); - if( index.Location >= 0 ) { + LocationIndex index = m.GetLoadout().FindIndex(MW); + if (index.Location >= 0) { try { - m.GetLoadout().AddTo( FCS, index.Location, index.Index + MW.NumCrits() ); - } catch ( Exception e ) { - m.GetLoadout().UnallocateAll( MW, false ); + m.GetLoadout().AddTo(FCS, index.Location, index.Index + MW.NumCrits()); + } catch (Exception e) { + m.GetLoadout().UnallocateAll(MW, false); } } } } else { - if( MW.GetFCS() instanceof ArtemisIVFCS ) { - if( m.IsOmnimech() ) { - if( MW.LocationLocked() ) { + if (MW.GetFCS() instanceof ArtemisIVFCS) { + if (m.IsOmnimech()) { + if (MW.LocationLocked()) { result = false; return; } else { FCS = (abPlaceable) MW.GetFCS(); - m.GetLoadout().UnallocateAll( FCS, true ); - MW.UseFCS( false, ifMissileGuidance.FCS_ArtemisIV ); + m.GetLoadout().UnallocateAll(FCS, true); + MW.UseFCS(false, ifMissileGuidance.FCS_ArtemisIV); } } else { FCS = (abPlaceable) MW.GetFCS(); - m.GetLoadout().UnallocateAll( FCS, true ); - MW.UseFCS( false, ifMissileGuidance.FCS_ArtemisIV ); + m.GetLoadout().UnallocateAll(FCS, true); + MW.UseFCS(false, ifMissileGuidance.FCS_ArtemisIV); } } } @@ -110,37 +111,38 @@ public boolean GetResult() { return result; } - private void SwitchSystem( RangedWeapon MW, Mech m ) { + private void SwitchSystem(RangedWeapon MW, Mech m) { abPlaceable FCS = (abPlaceable) MW.GetFCS(); - m.GetLoadout().UnallocateAll( FCS, true ); - MW.UseFCS( false, ifMissileGuidance.FCS_ArtemisIV ); - MW.UseFCS( true, ifMissileGuidance.FCS_ArtemisIV ); + m.GetLoadout().UnallocateAll(FCS, true); + MW.UseFCS(false, ifMissileGuidance.FCS_ArtemisIV); + MW.UseFCS(true, ifMissileGuidance.FCS_ArtemisIV); FCS = (abPlaceable) MW.GetFCS(); - LocationIndex index = m.GetLoadout().FindIndex( MW ); - if( index.Location >= 0 ) { + LocationIndex index = m.GetLoadout().FindIndex(MW); + if (index.Location >= 0) { try { - m.GetLoadout().AddTo( FCS, index.Location, index.Index + MW.NumCrits() ); - } catch ( Exception e ) { - m.GetLoadout().UnallocateAll( MW, false ); + m.GetLoadout().AddTo(FCS, index.Location, index.Index + MW.NumCrits()); + } catch (Exception e) { + m.GetLoadout().UnallocateAll(MW, false); } } } - public void Visit( CombatVehicle v ) throws Exception { - ArrayList test = v.GetLoadout().GetNonCore(); + public void Visit(CombatVehicle v) throws Exception { + ArrayList test = v.GetLoadout().GetNonCore(); abPlaceable p; - - for( int i = 0; i < test.size(); i++ ) { - p = (abPlaceable) test.get( i ); - //Is it a Ranged Weapon - if( p instanceof RangedWeapon ) { + + for (int i = 0; i < test.size(); i++) { + p = (abPlaceable) test.get(i); + // Is it a Ranged Weapon + if (p instanceof RangedWeapon) { RangedWeapon MW = (RangedWeapon) p; - - //if the weapon cannot do FCS let's move on quickly - if ( !MW.IsFCSCapable() ) continue; - - //if the location is locked...stop here! - if( v.IsOmni() && MW.LocationLocked() ) { + + // if the weapon cannot do FCS let's move on quickly + if (!MW.IsFCSCapable()) + continue; + + // if the location is locked...stop here! + if (v.IsOmni() && MW.LocationLocked()) { result = false; return; } @@ -149,43 +151,43 @@ public void Visit( CombatVehicle v ) throws Exception { } } - public void Visit( Infantry i ) throws Exception { + public void Visit(Infantry i) throws Exception { // does nothing at the moment } - public void Visit( SupportVehicle s ) throws Exception { + public void Visit(SupportVehicle s) throws Exception { // does nothing at the moment } - public void Visit( BattleArmor b ) throws Exception { + public void Visit(BattleArmor b) throws Exception { // does nothing at the moment } - public void Visit( Fighter f ) throws Exception { + public void Visit(Fighter f) throws Exception { // does nothing at the moment } - public void Visit( Spaceship s ) throws Exception { + public void Visit(Spaceship s) throws Exception { // does nothing at the moment } - public void Visit( SpaceStation s ) throws Exception { + public void Visit(SpaceStation s) throws Exception { // does nothing at the moment } - public void Visit( ProtoMech p ) throws Exception { + public void Visit(ProtoMech p) throws Exception { // does nothing at the moment } - public void Visit( MobileStructure m ) throws Exception { + public void Visit(MobileStructure m) throws Exception { // does nothing at the moment } - public void Visit( LargeSupportVehicle l ) throws Exception { + public void Visit(LargeSupportVehicle l) throws Exception { // does nothing at the moment } - public void Visit( Dropship d ) throws Exception { + public void Visit(Dropship d) throws Exception { // does nothing at the moment } } From c47a176aa8fa86ce4ba64c0b5e321fa3b1f6fea8 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 21:18:54 -0600 Subject: [PATCH 051/126] sswlib/src/main/java/visitors - VFCSApolloLoader - Type Enforcement - VS Code Formatting --- .../main/java/visitors/VFCSApolloLoader.java | 125 +++++++++--------- 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/sswlib/src/main/java/visitors/VFCSApolloLoader.java b/sswlib/src/main/java/visitors/VFCSApolloLoader.java index c99f4600..6131bee6 100644 --- a/sswlib/src/main/java/visitors/VFCSApolloLoader.java +++ b/sswlib/src/main/java/visitors/VFCSApolloLoader.java @@ -33,69 +33,69 @@ public class VFCSApolloLoader implements ifVisitor { // this is normally set to true since we simply unallocate items that can't - // fit their artemis. For Omnimechs with locked missile launchers it's + // fit their artemis. For Omnimechs with locked missile launchers it's // another matter entirely. boolean result = true; - public void SetClan( boolean clan ) { + public void SetClan(boolean clan) { } - public void LoadLocations( LocationIndex[] locs ) { + public void LoadLocations(LocationIndex[] locs) { // does nothing here, but may later. } - public void Visit( Mech m ) { - ArrayList test = m.GetLoadout().GetNonCore(); + public void Visit(Mech m) { + ArrayList test = m.GetLoadout().GetNonCore(); abPlaceable p; abPlaceable FCS; - for( int i = 0; i < test.size(); i++ ) { - p = (abPlaceable) test.get( i ); - if( p instanceof RangedWeapon ) { + for (int i = 0; i < test.size(); i++) { + p = (abPlaceable) test.get(i); + if (p instanceof RangedWeapon) { RangedWeapon MW = (RangedWeapon) p; - if( MW.GetFCSType() == ifMissileGuidance.FCS_Apollo ) { - if( m.UsingApollo() ) { - if( MW.IsUsingFCS() ) { - if( m.IsOmnimech() ) { - if( MW.LocationLocked() ) { + if (MW.GetFCSType() == ifMissileGuidance.FCS_Apollo) { + if (m.UsingApollo()) { + if (MW.IsUsingFCS()) { + if (m.IsOmnimech()) { + if (MW.LocationLocked()) { result = false; return; } else { - if( ! ( MW.GetFCS() instanceof ApolloFCS ) ) { - SwitchSystem( MW, m ); + if (!(MW.GetFCS() instanceof ApolloFCS)) { + SwitchSystem(MW, m); } } } else { - if( ! ( MW.GetFCS() instanceof ApolloFCS ) ) { - SwitchSystem( MW, m ); + if (!(MW.GetFCS() instanceof ApolloFCS)) { + SwitchSystem(MW, m); } } } else { - MW.UseFCS( true, ifMissileGuidance.FCS_Apollo ); + MW.UseFCS(true, ifMissileGuidance.FCS_Apollo); FCS = (abPlaceable) MW.GetFCS(); - LocationIndex index = m.GetLoadout().FindIndex( MW ); - if( index.Location >= 0 ) { + LocationIndex index = m.GetLoadout().FindIndex(MW); + if (index.Location >= 0) { try { - m.GetLoadout().AddTo( FCS, index.Location, index.Index + MW.NumCrits() ); - } catch ( Exception e ) { - m.GetLoadout().UnallocateAll( MW, false ); + m.GetLoadout().AddTo(FCS, index.Location, index.Index + MW.NumCrits()); + } catch (Exception e) { + m.GetLoadout().UnallocateAll(MW, false); } } } } else { - if( MW.GetFCS() instanceof ApolloFCS ) { - if( m.IsOmnimech() ) { - if( MW.LocationLocked() ) { + if (MW.GetFCS() instanceof ApolloFCS) { + if (m.IsOmnimech()) { + if (MW.LocationLocked()) { result = false; return; } else { FCS = (abPlaceable) MW.GetFCS(); - m.GetLoadout().UnallocateAll( FCS, true ); - MW.UseFCS( false, ifMissileGuidance.FCS_Apollo ); + m.GetLoadout().UnallocateAll(FCS, true); + MW.UseFCS(false, ifMissileGuidance.FCS_Apollo); } } else { FCS = (abPlaceable) MW.GetFCS(); - m.GetLoadout().UnallocateAll( FCS, true ); - MW.UseFCS( false, ifMissileGuidance.FCS_Apollo ); + m.GetLoadout().UnallocateAll(FCS, true); + MW.UseFCS(false, ifMissileGuidance.FCS_Apollo); } } } @@ -110,37 +110,38 @@ public boolean GetResult() { return result; } - private void SwitchSystem( RangedWeapon MW, Mech m ) { + private void SwitchSystem(RangedWeapon MW, Mech m) { abPlaceable FCS = (abPlaceable) MW.GetFCS(); - m.GetLoadout().UnallocateAll( FCS, true ); - MW.UseFCS( false, ifMissileGuidance.FCS_Apollo ); - MW.UseFCS( true, ifMissileGuidance.FCS_Apollo ); + m.GetLoadout().UnallocateAll(FCS, true); + MW.UseFCS(false, ifMissileGuidance.FCS_Apollo); + MW.UseFCS(true, ifMissileGuidance.FCS_Apollo); FCS = (abPlaceable) MW.GetFCS(); - LocationIndex index = m.GetLoadout().FindIndex( MW ); - if( index.Location >= 0 ) { + LocationIndex index = m.GetLoadout().FindIndex(MW); + if (index.Location >= 0) { try { - m.GetLoadout().AddTo( FCS, index.Location, index.Index + MW.NumCrits() ); - } catch ( Exception e ) { - m.GetLoadout().UnallocateAll( MW, false ); + m.GetLoadout().AddTo(FCS, index.Location, index.Index + MW.NumCrits()); + } catch (Exception e) { + m.GetLoadout().UnallocateAll(MW, false); } } } - public void Visit( CombatVehicle v ) throws Exception { - ArrayList test = v.GetLoadout().GetNonCore(); + public void Visit(CombatVehicle v) throws Exception { + ArrayList test = v.GetLoadout().GetNonCore(); abPlaceable p; - - for( int i = 0; i < test.size(); i++ ) { - p = (abPlaceable) test.get( i ); - //Is it a Ranged Weapon - if( p instanceof RangedWeapon ) { + + for (int i = 0; i < test.size(); i++) { + p = (abPlaceable) test.get(i); + // Is it a Ranged Weapon + if (p instanceof RangedWeapon) { RangedWeapon MW = (RangedWeapon) p; - - //if the weapon cannot do FCS let's move on quickly - if ( !MW.IsFCSCapable() ) continue; - - //if the location is locked...stop here! - if( v.IsOmni() && MW.LocationLocked() ) { + + // if the weapon cannot do FCS let's move on quickly + if (!MW.IsFCSCapable()) + continue; + + // if the location is locked...stop here! + if (v.IsOmni() && MW.LocationLocked()) { result = false; return; } @@ -149,43 +150,43 @@ public void Visit( CombatVehicle v ) throws Exception { } } - public void Visit( Infantry i ) throws Exception { + public void Visit(Infantry i) throws Exception { // does nothing at the moment } - public void Visit( SupportVehicle s ) throws Exception { + public void Visit(SupportVehicle s) throws Exception { // does nothing at the moment } - public void Visit( BattleArmor b ) throws Exception { + public void Visit(BattleArmor b) throws Exception { // does nothing at the moment } - public void Visit( Fighter f ) throws Exception { + public void Visit(Fighter f) throws Exception { // does nothing at the moment } - public void Visit( Spaceship s ) throws Exception { + public void Visit(Spaceship s) throws Exception { // does nothing at the moment } - public void Visit( SpaceStation s ) throws Exception { + public void Visit(SpaceStation s) throws Exception { // does nothing at the moment } - public void Visit( ProtoMech p ) throws Exception { + public void Visit(ProtoMech p) throws Exception { // does nothing at the moment } - public void Visit( MobileStructure m ) throws Exception { + public void Visit(MobileStructure m) throws Exception { // does nothing at the moment } - public void Visit( LargeSupportVehicle l ) throws Exception { + public void Visit(LargeSupportVehicle l) throws Exception { // does nothing at the moment } - public void Visit( Dropship d ) throws Exception { + public void Visit(Dropship d) throws Exception { // does nothing at the moment } } From befb4cdacd6e2039e9597e7acd31c5ea396f750a Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 21:20:10 -0600 Subject: [PATCH 052/126] sswlib/src/main/java/visitors - VArmorSetVStealth - Commented out variables not being used. --- .../main/java/visitors/VArmorSetVStealth.java | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/sswlib/src/main/java/visitors/VArmorSetVStealth.java b/sswlib/src/main/java/visitors/VArmorSetVStealth.java index c9e3ec49..91bef3f1 100644 --- a/sswlib/src/main/java/visitors/VArmorSetVStealth.java +++ b/sswlib/src/main/java/visitors/VArmorSetVStealth.java @@ -32,19 +32,19 @@ public class VArmorSetVStealth implements ifVisitor { // sets the mech's armor to stealth - private Mech CurMech; - private LocationIndex[] Locs = null; + // private Mech CurMech; + // private LocationIndex[] Locs = null; public VArmorSetVStealth() { } - public void LoadLocations( LocationIndex[] locs ) { - // loads up any location indexes needed to place this. mainly for use + public void LoadLocations(LocationIndex[] locs) { + // loads up any location indexes needed to place this. mainly for use // when loading a 'Mech up. - Locs = locs; + // Locs = locs; } - public void SetClan( boolean clan ) { + public void SetClan(boolean clan) { } public void Visit(Mech m) throws Exception { @@ -52,47 +52,47 @@ public void Visit(Mech m) throws Exception { throw new Exception("Vehicular Stealth Armor cannot be placed on a 'Mech."); } - public void Visit( CombatVehicle v ) throws Exception { + public void Visit(CombatVehicle v) throws Exception { v.GetArmor().SetISVST(); } - public void Visit( Infantry i ) throws Exception { + public void Visit(Infantry i) throws Exception { // does nothing at the moment } - public void Visit( SupportVehicle s ) throws Exception { + public void Visit(SupportVehicle s) throws Exception { // does nothing at the moment } - public void Visit( BattleArmor b ) throws Exception { + public void Visit(BattleArmor b) throws Exception { // does nothing at the moment } - public void Visit( Fighter f ) throws Exception { + public void Visit(Fighter f) throws Exception { // does nothing at the moment } - public void Visit( Spaceship s ) throws Exception { + public void Visit(Spaceship s) throws Exception { // does nothing at the moment } - public void Visit( SpaceStation s ) throws Exception { + public void Visit(SpaceStation s) throws Exception { // does nothing at the moment } - public void Visit( ProtoMech p ) throws Exception { + public void Visit(ProtoMech p) throws Exception { // does nothing at the moment } - public void Visit( MobileStructure m ) throws Exception { + public void Visit(MobileStructure m) throws Exception { // does nothing at the moment } - public void Visit( LargeSupportVehicle l ) throws Exception { + public void Visit(LargeSupportVehicle l) throws Exception { // does nothing at the moment } - public void Visit( Dropship d ) throws Exception { + public void Visit(Dropship d) throws Exception { // does nothing at the moment } } From a51fdb4cb4119cb9822fa6536094164ce739e446 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 21:22:42 -0600 Subject: [PATCH 053/126] sswlib/src/main/java/visitors - VArmorSetPatchworkLocation - Type Enforcement - VS Code Formatting --- .../main/java/components/ifMechLoadout.java | 2 +- .../visitors/VArmorSetPatchworkLocation.java | 254 +++++++++--------- 2 files changed, 130 insertions(+), 126 deletions(-) diff --git a/sswlib/src/main/java/components/ifMechLoadout.java b/sswlib/src/main/java/components/ifMechLoadout.java index a0678bce..c178b3a3 100644 --- a/sswlib/src/main/java/components/ifMechLoadout.java +++ b/sswlib/src/main/java/components/ifMechLoadout.java @@ -180,7 +180,7 @@ public interface ifMechLoadout { public int[] FindInstances(abPlaceable p); - public ArrayList FindIndexes(abPlaceable p); + public ArrayList FindIndexes(abPlaceable p); public List FindIndexesByName(String n); diff --git a/sswlib/src/main/java/visitors/VArmorSetPatchworkLocation.java b/sswlib/src/main/java/visitors/VArmorSetPatchworkLocation.java index 32da4155..44be831f 100644 --- a/sswlib/src/main/java/visitors/VArmorSetPatchworkLocation.java +++ b/sswlib/src/main/java/visitors/VArmorSetPatchworkLocation.java @@ -39,223 +39,227 @@ public class VArmorSetPatchworkLocation implements ifVisitor { private int Location = -1; private boolean Clan = false; - public void SetClan( boolean clan ) { + public void SetClan(boolean clan) { Clan = clan; } - public void SetLocation( int i ) { + public void SetLocation(int i) { Location = i; } - public void LoadLocations( LocationIndex[] locs ) { + public void LoadLocations(LocationIndex[] locs) { Locs = locs; } - public void SetPatchworkType( String type ) { + public void SetPatchworkType(String type) { Type = type; } - public void Visit( Mech m ) throws Exception { + public void Visit(Mech m) throws Exception { // only the armor changes, so pass us off CurMech = m; ifMechLoadout l = CurMech.GetLoadout(); MechArmor a = CurMech.GetArmor(); // remove old armor from this location, if needed. - ArrayList v = l.FindIndexes( a ); + ArrayList v = l.FindIndexes(a); LocationIndex[] OldLocs = new LocationIndex[v.size()]; - for( int i = 0; i < v.size(); i++ ) { - OldLocs[i] = (LocationIndex) v.get( i ); + for (int i = 0; i < v.size(); i++) { + OldLocs[i] = (LocationIndex) v.get(i); } - OldLocs = this.GetLocations( Location, OldLocs ); - if( OldLocs != null ) { - RemoveByLocation( l, OldLocs ); + OldLocs = this.GetLocations(Location, OldLocs); + if (OldLocs != null) { + RemoveByLocation(l, OldLocs); } // Setting the patchwork type will automatically add it in. - if( Type == null ) { - a.SetIndustrial( Location ); + if (Type == null) { + a.SetIndustrial(Location); } else { - if( Locs == null ) { - SetType( a, Type, Location ); + if (Locs == null) { + SetType(a, Type, Location); } else { - LocationIndex[] foundlocs = GetLocations( Location, Locs ); - SetType( a, Type, Location, foundlocs ); + LocationIndex[] foundlocs = GetLocations(Location, Locs); + SetType(a, Type, Location, foundlocs); } } - if( a.GetMechModifier() != null ) { - CurMech.AddMechModifier( a.GetMechModifier() ); + if (a.GetMechModifier() != null) { + CurMech.AddMechModifier(a.GetMechModifier()); } } - public void Visit( CombatVehicle v ) throws Exception { + public void Visit(CombatVehicle v) throws Exception { // does nothing at the moment } - public void Visit( Infantry i ) throws Exception { + public void Visit(Infantry i) throws Exception { // does nothing at the moment } - public void Visit( SupportVehicle s ) throws Exception { + public void Visit(SupportVehicle s) throws Exception { // does nothing at the moment } - public void Visit( BattleArmor b ) throws Exception { + public void Visit(BattleArmor b) throws Exception { // does nothing at the moment } - public void Visit( Fighter f ) throws Exception { + public void Visit(Fighter f) throws Exception { // does nothing at the moment } - public void Visit( Spaceship s ) throws Exception { + public void Visit(Spaceship s) throws Exception { // does nothing at the moment } - public void Visit( SpaceStation s ) throws Exception { + public void Visit(SpaceStation s) throws Exception { // does nothing at the moment } - public void Visit( ProtoMech p ) throws Exception { + public void Visit(ProtoMech p) throws Exception { // does nothing at the moment } - public void Visit( MobileStructure m ) throws Exception { + public void Visit(MobileStructure m) throws Exception { // does nothing at the moment } - public void Visit( LargeSupportVehicle l ) throws Exception { + public void Visit(LargeSupportVehicle l) throws Exception { // does nothing at the moment } - public void Visit( Dropship d ) throws Exception { + public void Visit(Dropship d) throws Exception { // does nothing at the moment } - private void SetType( MechArmor a, String Type, int loc ) throws Exception { - if( Type.equals( "Ferro-Fibrous" ) ) { - if( Clan ) { - a.SetCLFF( loc ); + private void SetType(MechArmor a, String Type, int loc) throws Exception { + if (Type.equals("Ferro-Fibrous")) { + if (Clan) { + a.SetCLFF(loc); } else { - a.SetISFF( loc ); + a.SetISFF(loc); } - } else if( Type.equals( "(CL) Ferro-Fibrous" ) ) { - a.SetCLFF( loc ); - } else if( Type.equals( "(IS) Ferro-Fibrous" ) ) { - a.SetISFF( loc ); - } else if( Type.equals( "Stealth Armor" ) ) { - a.SetISST( loc ); - } else if( Type.equals( "Laser-Reflective" ) ) { - if( Clan ) { - a.SetCLLR( loc ); + } else if (Type.equals("(CL) Ferro-Fibrous")) { + a.SetCLFF(loc); + } else if (Type.equals("(IS) Ferro-Fibrous")) { + a.SetISFF(loc); + } else if (Type.equals("Stealth Armor")) { + a.SetISST(loc); + } else if (Type.equals("Laser-Reflective")) { + if (Clan) { + a.SetCLLR(loc); } else { - a.SetISLR( loc ); + a.SetISLR(loc); } - } else if( Type.equals( "(CL) Laser-Reflective" ) ) { - a.SetCLLR( loc ); - } else if( Type.equals( "(IS) Laser-Reflective" ) ) { - a.SetISLR( loc ); - } else if( Type.equals( "Standard Armor" ) ) { - a.SetStandard( loc ); - } else if( Type.equals( "Light Ferro-Fibrous" ) ) { - a.SetISLF( loc ); - } else if( Type.equals( "Heavy Ferro-Fibrous" ) ) { - a.SetISHF( loc ); - } else if( Type.equals( "Ferro-Lamellor" ) ) { - a.SetCLFL( loc ); - } else if( Type.equals( "Hardened Armor" ) ) { - a.SetHardened( loc ); - } else if( Type.equals( "Industrial Armor" ) ) { - a.SetIndustrial( loc ); - } else if( Type.equals( "Commercial Armor" ) ) { - a.SetCommercial( loc ); - } else if( Type.equals( "Reactive Armor" ) ) { - if( Clan ) { - a.SetCLRE( loc ); + } else if (Type.equals("(CL) Laser-Reflective")) { + a.SetCLLR(loc); + } else if (Type.equals("(IS) Laser-Reflective")) { + a.SetISLR(loc); + } else if (Type.equals("Standard Armor")) { + a.SetStandard(loc); + } else if (Type.equals("Light Ferro-Fibrous")) { + a.SetISLF(loc); + } else if (Type.equals("Heavy Ferro-Fibrous")) { + a.SetISHF(loc); + } else if (Type.equals("Ferro-Lamellor")) { + a.SetCLFL(loc); + } else if (Type.equals("Hardened Armor")) { + a.SetHardened(loc); + } else if (Type.equals("Industrial Armor")) { + a.SetIndustrial(loc); + } else if (Type.equals("Commercial Armor")) { + a.SetCommercial(loc); + } else if (Type.equals("Reactive Armor")) { + if (Clan) { + a.SetCLRE(loc); } else { - a.SetISRE( loc ); + a.SetISRE(loc); } - } else if( Type.equals( "(IS) Reactive Armor" ) ) { - a.SetISRE( loc ); - } else if( Type.equals( "(CL) Reactive Armor" ) ) { - a.SetCLRE( loc ); + } else if (Type.equals("(IS) Reactive Armor")) { + a.SetISRE(loc); + } else if (Type.equals("(CL) Reactive Armor")) { + a.SetCLRE(loc); } } - private void SetType( MechArmor a, String Type, int loc, LocationIndex[] locs ) throws Exception { - if( Type.equals( "Ferro-Fibrous" ) ) { - if( Clan ) { - a.SetCLFF( loc, locs ); + private void SetType(MechArmor a, String Type, int loc, LocationIndex[] locs) throws Exception { + if (Type.equals("Ferro-Fibrous")) { + if (Clan) { + a.SetCLFF(loc, locs); } else { - a.SetISFF( loc, locs ); + a.SetISFF(loc, locs); } - } else if( Type.equals( "(CL) Ferro-Fibrous" ) ) { - a.SetCLFF( loc, locs ); - } else if( Type.equals( "(IS) Ferro-Fibrous" ) ) { - a.SetISFF( loc, locs ); - } else if( Type.equals( "Stealth Armor" ) ) { - a.SetISST( loc, locs ); - } else if( Type.equals( "Laser-Reflective" ) ) { - if( Clan ) { - a.SetCLLR( loc, locs ); + } else if (Type.equals("(CL) Ferro-Fibrous")) { + a.SetCLFF(loc, locs); + } else if (Type.equals("(IS) Ferro-Fibrous")) { + a.SetISFF(loc, locs); + } else if (Type.equals("Stealth Armor")) { + a.SetISST(loc, locs); + } else if (Type.equals("Laser-Reflective")) { + if (Clan) { + a.SetCLLR(loc, locs); } else { - a.SetISLR( loc, locs ); + a.SetISLR(loc, locs); } - } else if( Type.equals( "(CL) Laser-Reflective" ) ) { - a.SetCLLR( loc, locs ); - } else if( Type.equals( "(IS) Laser-Reflective" ) ) { - a.SetISLR( loc, locs ); - } else if( Type.equals( "Standard Armor" ) ) { - a.SetStandard( loc ); - } else if( Type.equals( "Light Ferro-Fibrous" ) ) { - a.SetISLF( loc, locs ); - } else if( Type.equals( "Heavy Ferro-Fibrous" ) ) { - a.SetISHF( loc, locs ); - } else if( Type.equals( "Ferro-Lamellor" ) ) { - a.SetCLFL( loc, locs ); - } else if( Type.equals( "Hardened Armor" ) ) { - a.SetHardened( loc ); - } else if( Type.equals( "Industrial Armor" ) ) { - a.SetIndustrial( loc ); - } else if( Type.equals( "Commercial Armor" ) ) { - a.SetCommercial( loc ); - } else if( Type.equals( "Reactive Armor" ) ) { - if( Clan ) { - a.SetCLRE( loc, locs ); + } else if (Type.equals("(CL) Laser-Reflective")) { + a.SetCLLR(loc, locs); + } else if (Type.equals("(IS) Laser-Reflective")) { + a.SetISLR(loc, locs); + } else if (Type.equals("Standard Armor")) { + a.SetStandard(loc); + } else if (Type.equals("Light Ferro-Fibrous")) { + a.SetISLF(loc, locs); + } else if (Type.equals("Heavy Ferro-Fibrous")) { + a.SetISHF(loc, locs); + } else if (Type.equals("Ferro-Lamellor")) { + a.SetCLFL(loc, locs); + } else if (Type.equals("Hardened Armor")) { + a.SetHardened(loc); + } else if (Type.equals("Industrial Armor")) { + a.SetIndustrial(loc); + } else if (Type.equals("Commercial Armor")) { + a.SetCommercial(loc); + } else if (Type.equals("Reactive Armor")) { + if (Clan) { + a.SetCLRE(loc, locs); } else { - a.SetISRE( loc, locs ); + a.SetISRE(loc, locs); } - } else if( Type.equals( "(IS) Reactive Armor" ) ) { - a.SetISRE( loc, locs ); - } else if( Type.equals( "(CL) Reactive Armor" ) ) { - a.SetCLRE( loc, locs ); + } else if (Type.equals("(IS) Reactive Armor")) { + a.SetISRE(loc, locs); + } else if (Type.equals("(CL) Reactive Armor")) { + a.SetCLRE(loc, locs); } } - private LocationIndex[] GetLocations( int loc, LocationIndex[] locs ) { + private LocationIndex[] GetLocations(int loc, LocationIndex[] locs) { LocationIndex[] retval = null; ArrayList Found = new ArrayList(); - for( int i = 0; i < locs.length; i++ ) { - if( locs[i].Location == loc ) { - Found.add( locs[i] ); + for (int i = 0; i < locs.length; i++) { + if (locs[i].Location == loc) { + Found.add(locs[i]); } } - if( Found.size() > 0 ) { + if (Found.size() > 0) { retval = new LocationIndex[Found.size()]; - for( int i = 0; i < Found.size(); i++ ) { - retval[i] = Found.get( i ); + for (int i = 0; i < Found.size(); i++) { + retval[i] = Found.get(i); } } return retval; } - private void RemoveByLocation( ifMechLoadout l, LocationIndex[] Loc ) { - if( Loc == null ) { return; } - if( Loc.length <= 0 ) { return; } - abPlaceable[] a = l.GetCrits( Loc[0].Location ); - for( int i = 0; i < Loc.length; i++ ) { - l.UnallocateByIndex( Loc[i].Index, a ); + private void RemoveByLocation(ifMechLoadout l, LocationIndex[] Loc) { + if (Loc == null) { + return; + } + if (Loc.length <= 0) { + return; + } + abPlaceable[] a = l.GetCrits(Loc[0].Location); + for (int i = 0; i < Loc.length; i++) { + l.UnallocateByIndex(Loc[i].Index, a); } } } From 214f93bac8901365f00ea67e765d05a7ef5cdda6 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 21:23:29 -0600 Subject: [PATCH 054/126] sswlib/src/main/java/visitors - VArmorSetIR - Commented out variable not being used --- .../src/main/java/visitors/VArmorSetIR.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/sswlib/src/main/java/visitors/VArmorSetIR.java b/sswlib/src/main/java/visitors/VArmorSetIR.java index 3e3cb331..45b24508 100644 --- a/sswlib/src/main/java/visitors/VArmorSetIR.java +++ b/sswlib/src/main/java/visitors/VArmorSetIR.java @@ -33,13 +33,13 @@ public class VArmorSetIR implements ifVisitor { // sets the mech's armor to ablation private Mech CurMech; - private boolean Clan = false; + // private boolean Clan = false; // Not being used public void LoadLocations(LocationIndex[] locs) { // does nothing here, but may later. } - public void SetClan( boolean clan ) { + public void SetClan(boolean clan) { } public void Visit(Mech m) { @@ -49,61 +49,61 @@ public void Visit(Mech m) { MechArmor a = CurMech.GetArmor(); // remove the old armor, if needed - l.Remove( a ); + l.Remove(a); a.ResetPatchworkConfigs(); // set the armor type a.SetISIR(); - + // place the armor - a.Place( l ); + a.Place(l); // check for and add any MechModifier - if( a.GetMechModifier() != null ) { - CurMech.AddMechModifier( a.GetMechModifier() ); + if (a.GetMechModifier() != null) { + CurMech.AddMechModifier(a.GetMechModifier()); } } - public void Visit( CombatVehicle v ) throws Exception { - //Not allowed + public void Visit(CombatVehicle v) throws Exception { + // Not allowed } - public void Visit( Infantry i ) throws Exception { + public void Visit(Infantry i) throws Exception { // does nothing at the moment } - public void Visit( SupportVehicle s ) throws Exception { + public void Visit(SupportVehicle s) throws Exception { // does nothing at the moment } - public void Visit( BattleArmor b ) throws Exception { + public void Visit(BattleArmor b) throws Exception { // does nothing at the moment } - public void Visit( Fighter f ) throws Exception { + public void Visit(Fighter f) throws Exception { // does nothing at the moment } - public void Visit( Spaceship s ) throws Exception { + public void Visit(Spaceship s) throws Exception { // does nothing at the moment } - public void Visit( SpaceStation s ) throws Exception { + public void Visit(SpaceStation s) throws Exception { // does nothing at the moment } - public void Visit( ProtoMech p ) throws Exception { + public void Visit(ProtoMech p) throws Exception { // does nothing at the moment } - public void Visit( MobileStructure m ) throws Exception { + public void Visit(MobileStructure m) throws Exception { // does nothing at the moment } - public void Visit( LargeSupportVehicle l ) throws Exception { + public void Visit(LargeSupportVehicle l) throws Exception { // does nothing at the moment } - public void Visit( Dropship d ) throws Exception { + public void Visit(Dropship d) throws Exception { // does nothing at the moment } } From 5855693fa26896f45f3655f7e38ebfe26dd18866 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 21:24:14 -0600 Subject: [PATCH 055/126] sswlib/src/main/java/visitors - Commented out variable not being used. --- .../src/main/java/visitors/VArmorSetHD.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/sswlib/src/main/java/visitors/VArmorSetHD.java b/sswlib/src/main/java/visitors/VArmorSetHD.java index 0965eb27..760be8f1 100644 --- a/sswlib/src/main/java/visitors/VArmorSetHD.java +++ b/sswlib/src/main/java/visitors/VArmorSetHD.java @@ -33,14 +33,14 @@ public class VArmorSetHD implements ifVisitor { // sets the mech's armor to ablation private Mech CurMech; - private boolean Clan = false; + // private boolean Clan = false; public void LoadLocations(LocationIndex[] locs) { // does nothing here, but may later. } - public void SetClan( boolean clan ) { - Clan = clan; + public void SetClan(boolean clan) { + // Clan = clan; } public void Visit(Mech m) { @@ -50,61 +50,61 @@ public void Visit(Mech m) { MechArmor a = CurMech.GetArmor(); // remove the old armor, if needed - l.Remove( a ); + l.Remove(a); a.ResetPatchworkConfigs(); // set the armor type a.SetHD(); - + // place the armor - a.Place( l ); + a.Place(l); // check for and add any MechModifier - if( a.GetMechModifier() != null ) { - CurMech.AddMechModifier( a.GetMechModifier() ); + if (a.GetMechModifier() != null) { + CurMech.AddMechModifier(a.GetMechModifier()); } } - public void Visit( CombatVehicle v ) throws Exception { + public void Visit(CombatVehicle v) throws Exception { v.GetArmor().SetISAB(); } - public void Visit( Infantry i ) throws Exception { + public void Visit(Infantry i) throws Exception { // does nothing at the moment } - public void Visit( SupportVehicle s ) throws Exception { + public void Visit(SupportVehicle s) throws Exception { // does nothing at the moment } - public void Visit( BattleArmor b ) throws Exception { + public void Visit(BattleArmor b) throws Exception { // does nothing at the moment } - public void Visit( Fighter f ) throws Exception { + public void Visit(Fighter f) throws Exception { // does nothing at the moment } - public void Visit( Spaceship s ) throws Exception { + public void Visit(Spaceship s) throws Exception { // does nothing at the moment } - public void Visit( SpaceStation s ) throws Exception { + public void Visit(SpaceStation s) throws Exception { // does nothing at the moment } - public void Visit( ProtoMech p ) throws Exception { + public void Visit(ProtoMech p) throws Exception { // does nothing at the moment } - public void Visit( MobileStructure m ) throws Exception { + public void Visit(MobileStructure m) throws Exception { // does nothing at the moment } - public void Visit( LargeSupportVehicle l ) throws Exception { + public void Visit(LargeSupportVehicle l) throws Exception { // does nothing at the moment } - public void Visit( Dropship d ) throws Exception { + public void Visit(Dropship d) throws Exception { // does nothing at the moment } } From 078fc9b7538a7880f9388c69e042f2ed783ad1c8 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 21:25:14 -0600 Subject: [PATCH 056/126] sswlib/src/main/java/visitors - VArmorSetBR - Commented out variables not being used --- .../src/main/java/visitors/VArmorSetBR.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/sswlib/src/main/java/visitors/VArmorSetBR.java b/sswlib/src/main/java/visitors/VArmorSetBR.java index 9a4bc9d8..b6e08535 100644 --- a/sswlib/src/main/java/visitors/VArmorSetBR.java +++ b/sswlib/src/main/java/visitors/VArmorSetBR.java @@ -33,13 +33,13 @@ public class VArmorSetBR implements ifVisitor { // sets the mech's armor to ablation private Mech CurMech; - private boolean Clan = false; + // private boolean Clan = false; // Not being used public void LoadLocations(LocationIndex[] locs) { // does nothing here, but may later. } - public void SetClan( boolean clan ) { + public void SetClan(boolean clan) { } public void Visit(Mech m) { @@ -49,61 +49,61 @@ public void Visit(Mech m) { MechArmor a = CurMech.GetArmor(); // remove the old armor, if needed - l.Remove( a ); + l.Remove(a); a.ResetPatchworkConfigs(); // set the armor type a.SetISBR(); - + // place the armor - a.Place( l ); + a.Place(l); // check for and add any MechModifier - if( a.GetMechModifier() != null ) { - CurMech.AddMechModifier( a.GetMechModifier() ); + if (a.GetMechModifier() != null) { + CurMech.AddMechModifier(a.GetMechModifier()); } } - public void Visit( CombatVehicle v ) throws Exception { + public void Visit(CombatVehicle v) throws Exception { v.GetArmor().SetISBR(); } - public void Visit( Infantry i ) throws Exception { + public void Visit(Infantry i) throws Exception { // does nothing at the moment } - public void Visit( SupportVehicle s ) throws Exception { + public void Visit(SupportVehicle s) throws Exception { // does nothing at the moment } - public void Visit( BattleArmor b ) throws Exception { + public void Visit(BattleArmor b) throws Exception { // does nothing at the moment } - public void Visit( Fighter f ) throws Exception { + public void Visit(Fighter f) throws Exception { // does nothing at the moment } - public void Visit( Spaceship s ) throws Exception { + public void Visit(Spaceship s) throws Exception { // does nothing at the moment } - public void Visit( SpaceStation s ) throws Exception { + public void Visit(SpaceStation s) throws Exception { // does nothing at the moment } - public void Visit( ProtoMech p ) throws Exception { + public void Visit(ProtoMech p) throws Exception { // does nothing at the moment } - public void Visit( MobileStructure m ) throws Exception { + public void Visit(MobileStructure m) throws Exception { // does nothing at the moment } - public void Visit( LargeSupportVehicle l ) throws Exception { + public void Visit(LargeSupportVehicle l) throws Exception { // does nothing at the moment } - public void Visit( Dropship d ) throws Exception { + public void Visit(Dropship d) throws Exception { // does nothing at the moment } } From d5d2709b084bd84b8bea6ea12ac6aa7d9b3e9552 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 21:26:19 -0600 Subject: [PATCH 057/126] sswlib/src/main/java/visitors - VArmorSetAB - Commented out variable not in use - VS Code Formatting --- .../src/main/java/visitors/VArmorSetAB.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/sswlib/src/main/java/visitors/VArmorSetAB.java b/sswlib/src/main/java/visitors/VArmorSetAB.java index 0be760ca..4d9ae2f8 100644 --- a/sswlib/src/main/java/visitors/VArmorSetAB.java +++ b/sswlib/src/main/java/visitors/VArmorSetAB.java @@ -33,13 +33,13 @@ public class VArmorSetAB implements ifVisitor { // sets the mech's armor to ablation private Mech CurMech; - private boolean Clan = false; + // private boolean Clan = false; // Not being used public void LoadLocations(LocationIndex[] locs) { // does nothing here, but may later. } - public void SetClan( boolean clan ) { + public void SetClan(boolean clan) { } public void Visit(Mech m) { @@ -49,61 +49,61 @@ public void Visit(Mech m) { MechArmor a = CurMech.GetArmor(); // remove the old armor, if needed - l.Remove( a ); + l.Remove(a); a.ResetPatchworkConfigs(); // set the armor type - a.SetISAB(); - + a.SetISAB(); + // place the armor - a.Place( l ); + a.Place(l); // check for and add any MechModifier - if( a.GetMechModifier() != null ) { - CurMech.AddMechModifier( a.GetMechModifier() ); + if (a.GetMechModifier() != null) { + CurMech.AddMechModifier(a.GetMechModifier()); } } - public void Visit( CombatVehicle v ) throws Exception { + public void Visit(CombatVehicle v) throws Exception { v.GetArmor().SetISAB(); } - public void Visit( Infantry i ) throws Exception { + public void Visit(Infantry i) throws Exception { // does nothing at the moment } - public void Visit( SupportVehicle s ) throws Exception { + public void Visit(SupportVehicle s) throws Exception { // does nothing at the moment } - public void Visit( BattleArmor b ) throws Exception { + public void Visit(BattleArmor b) throws Exception { // does nothing at the moment } - public void Visit( Fighter f ) throws Exception { + public void Visit(Fighter f) throws Exception { // does nothing at the moment } - public void Visit( Spaceship s ) throws Exception { + public void Visit(Spaceship s) throws Exception { // does nothing at the moment } - public void Visit( SpaceStation s ) throws Exception { + public void Visit(SpaceStation s) throws Exception { // does nothing at the moment } - public void Visit( ProtoMech p ) throws Exception { + public void Visit(ProtoMech p) throws Exception { // does nothing at the moment } - public void Visit( MobileStructure m ) throws Exception { + public void Visit(MobileStructure m) throws Exception { // does nothing at the moment } - public void Visit( LargeSupportVehicle l ) throws Exception { + public void Visit(LargeSupportVehicle l) throws Exception { // does nothing at the moment } - public void Visit( Dropship d ) throws Exception { + public void Visit(Dropship d) throws Exception { // does nothing at the moment } } From 4f79d46ed01e513427933811c33bdbf74e84f416 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 21:38:43 -0600 Subject: [PATCH 058/126] sswlib/src/main/java/utilities - CVCostBVBreakdown - Strict Type Enforcement - Commented out variables not being used - VS Code Formatting --- .../java/utilities/CVCostBVBreakdown.java | 276 +++++++++++------- 1 file changed, 173 insertions(+), 103 deletions(-) diff --git a/sswlib/src/main/java/utilities/CVCostBVBreakdown.java b/sswlib/src/main/java/utilities/CVCostBVBreakdown.java index 3b7243bd..ea3ccba2 100644 --- a/sswlib/src/main/java/utilities/CVCostBVBreakdown.java +++ b/sswlib/src/main/java/utilities/CVCostBVBreakdown.java @@ -34,7 +34,7 @@ public class CVCostBVBreakdown { private CombatVehicle CurUnit = null; - private String NL = System.getProperty( "line.separator" ); + private String NL = System.getProperty("line.separator"); public CVCostBVBreakdown(CombatVehicle v) { CurUnit = v; @@ -42,121 +42,177 @@ public CVCostBVBreakdown(CombatVehicle v) { public String Render() { // this method returns a formated string with the cost/bv breakdown - // ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + // ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ String retval = ""; - retval += String.format( "Vehicle Name: %1$-41s Tonnage: %2$d", CurUnit.GetName() + " " + CurUnit.GetModel(), CurUnit.GetTonnage() ) + NL; - retval += String.format( "Rules Level: %1$-41s Total Cost: %2$,.0f", CommonTools.GetRulesLevelString( CurUnit.GetRulesLevel() ), CurUnit.GetTotalCost() ) + NL; - retval += String.format( "Tech Base: %1$-41s Total BV: %2$,d", CommonTools.GetTechbaseString( CurUnit.GetLoadout().GetTechBase() ), CurUnit.GetCurrentBV() ) + NL; + retval += String.format("Vehicle Name: %1$-41s Tonnage: %2$d", + CurUnit.GetName() + " " + CurUnit.GetModel(), CurUnit.GetTonnage()) + NL; + retval += String.format("Rules Level: %1$-41s Total Cost: %2$,.0f", + CommonTools.GetRulesLevelString(CurUnit.GetRulesLevel()), CurUnit.GetTotalCost()) + NL; + retval += String.format("Tech Base: %1$-41s Total BV: %2$,d", + CommonTools.GetTechbaseString(CurUnit.GetLoadout().GetTechBase()), CurUnit.GetCurrentBV()) + NL; retval += NL; - retval += "Item DefBV OffBV Cost" + NL; - retval += String.format( "Internal Structure - %1$-22s %2$,6.0f %3$,6.0f %4$,16.2f", CurUnit.GetIntStruc().toString(), CurUnit.GetIntStruc().GetDefensiveBV(), CurUnit.GetIntStruc().GetOffensiveBV(), CurUnit.GetIntStruc().GetCost() ) + NL; - retval += String.format( "%1$-43s %2$,6.0f %3$,6.0f %4$,16.2f", "Controls", 0.0, 0.0, CurUnit.GetControlsCost() ) + NL; - retval += String.format( "%1$-43s %2$,6.0f %3$,6.0f %4$,16.2f", (CurUnit.IsVTOL()) ? "Rotors" : "Lift Equipment", 0.0, 0.0, CurUnit.GetLiftEquipmentCost() ) + NL; - retval += String.format( "Engine - %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurUnit.GetEngine().CritName(), CurUnit.GetEngine().GetDefensiveBV(), CurUnit.GetEngine().GetOffensiveBV(), CurUnit.GetEngine().GetCost() ) + NL; - retval += String.format( "Heat Sinks - %1$-30s %2$,6.0f %3$,6.0f %4$,16.2f", CurUnit.GetHeatSinks().LookupName(), CurUnit.GetHeatSinks().GetDefensiveBV(), CurUnit.GetHeatSinks().GetOffensiveBV(), CurUnit.GetHeatSinks().GetCost() ) + NL; - if( CurUnit.GetJumpJets().GetNumJJ() > 0 ) { - retval += String.format( "Jump Jets - %1$-31s %2$,6.0f %3$,6.0f %4$,16.2f", CurUnit.GetJumpJets().LookupName(), CurUnit.GetJumpJets().GetDefensiveBV(), CurUnit.GetJumpJets().GetOffensiveBV(), CurUnit.GetJumpJets().GetCost() ) + NL; + retval += "Item DefBV OffBV Cost" + NL; + retval += String.format("Internal Structure - %1$-22s %2$,6.0f %3$,6.0f %4$,16.2f", + CurUnit.GetIntStruc().toString(), CurUnit.GetIntStruc().GetDefensiveBV(), + CurUnit.GetIntStruc().GetOffensiveBV(), CurUnit.GetIntStruc().GetCost()) + NL; + retval += String.format("%1$-43s %2$,6.0f %3$,6.0f %4$,16.2f", "Controls", 0.0, 0.0, + CurUnit.GetControlsCost()) + NL; + retval += String.format("%1$-43s %2$,6.0f %3$,6.0f %4$,16.2f", + (CurUnit.IsVTOL()) ? "Rotors" : "Lift Equipment", 0.0, 0.0, CurUnit.GetLiftEquipmentCost()) + NL; + retval += String.format("Engine - %1$-34s %2$,6.0f %3$,6.0f %4$,16.2f", CurUnit.GetEngine().CritName(), + CurUnit.GetEngine().GetDefensiveBV(), CurUnit.GetEngine().GetOffensiveBV(), + CurUnit.GetEngine().GetCost()) + NL; + retval += String.format("Heat Sinks - %1$-30s %2$,6.0f %3$,6.0f %4$,16.2f", + CurUnit.GetHeatSinks().LookupName(), CurUnit.GetHeatSinks().GetDefensiveBV(), + CurUnit.GetHeatSinks().GetOffensiveBV(), CurUnit.GetHeatSinks().GetCost()) + NL; + if (CurUnit.GetJumpJets().GetNumJJ() > 0) { + retval += String.format("Jump Jets - %1$-31s %2$,6.0f %3$,6.0f %4$,16.2f", + CurUnit.GetJumpJets().LookupName(), CurUnit.GetJumpJets().GetDefensiveBV(), + CurUnit.GetJumpJets().GetOffensiveBV(), CurUnit.GetJumpJets().GetCost()) + NL; } - if( ! CurUnit.GetEngine().IsNuclear() ) { - retval += String.format( "%1$-43s %2$,6.0f %3$,6.0f %4$,16.2f", "Power Amplifiers", 0.0f, 0.0f, CurUnit.GetLoadout().GetPowerAmplifier().GetCost() ) + NL; + if (!CurUnit.GetEngine().IsNuclear()) { + retval += String.format("%1$-43s %2$,6.0f %3$,6.0f %4$,16.2f", "Power Amplifiers", 0.0f, 0.0f, + CurUnit.GetLoadout().GetPowerAmplifier().GetCost()) + NL; } - if( CurUnit.IsPrimitive() && CurUnit.GetYear() < 2450 ) { - retval += String.format( "Armor - %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurUnit.GetArmor().LookupName() + " (early)", CurUnit.GetArmor().GetDefensiveBV(), CurUnit.GetArmor().GetOffensiveBV(), CurUnit.GetArmor().GetCost() ) + NL; + if (CurUnit.IsPrimitive() && CurUnit.GetYear() < 2450) { + retval += String.format("Armor - %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurUnit.GetArmor().LookupName() + " (early)", CurUnit.GetArmor().GetDefensiveBV(), + CurUnit.GetArmor().GetOffensiveBV(), CurUnit.GetArmor().GetCost()) + NL; } else { - retval += String.format( "Armor - %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", CurUnit.GetArmor().LookupName(), CurUnit.GetArmor().GetDefensiveBV(), CurUnit.GetArmor().GetOffensiveBV(), CurUnit.GetArmor().GetCost() ) + NL; + retval += String.format("Armor - %1$-35s %2$,6.0f %3$,6.0f %4$,16.2f", + CurUnit.GetArmor().LookupName(), CurUnit.GetArmor().GetDefensiveBV(), + CurUnit.GetArmor().GetOffensiveBV(), CurUnit.GetArmor().GetCost()) + NL; } - if ( CurUnit.isHasTurret1() ) - retval += String.format( "%1$-43s %2$,6.0f %3$,6.0f %4$,16.2f", "Turret", CurUnit.GetLoadout().GetTurret().GetDefensiveBV(), CurUnit.GetLoadout().GetTurret().GetOffensiveBV(), CurUnit.GetLoadout().GetTurret().GetCost() ) + NL; - if ( CurUnit.isHasTurret2() ) - retval += String.format( "%1$-43s %2$,6.0f %3$,6.0f %4$,16.2f", "Rear Turret", CurUnit.GetLoadout().GetRearTurret().GetDefensiveBV(), CurUnit.GetLoadout().GetRearTurret().GetOffensiveBV(), CurUnit.GetLoadout().GetRearTurret().GetCost() ) + NL; - if ( CurUnit.isHasSponsonTurret() ) { - retval += String.format( "%1$-43s %2$,6.0f %3$,6.0f %4$,16.2f", "Sponson Turret", 0.0, 0.0, CurUnit.GetLoadout().GetSponsonTurretCost() ) + NL; // Sponsons don't directly contribute to BV + if (CurUnit.isHasTurret1()) + retval += String.format("%1$-43s %2$,6.0f %3$,6.0f %4$,16.2f", "Turret", + CurUnit.GetLoadout().GetTurret().GetDefensiveBV(), + CurUnit.GetLoadout().GetTurret().GetOffensiveBV(), CurUnit.GetLoadout().GetTurret().GetCost()) + NL; + if (CurUnit.isHasTurret2()) + retval += String.format("%1$-43s %2$,6.0f %3$,6.0f %4$,16.2f", "Rear Turret", + CurUnit.GetLoadout().GetRearTurret().GetDefensiveBV(), + CurUnit.GetLoadout().GetRearTurret().GetOffensiveBV(), + CurUnit.GetLoadout().GetRearTurret().GetCost()) + NL; + if (CurUnit.isHasSponsonTurret()) { + retval += String.format("%1$-43s %2$,6.0f %3$,6.0f %4$,16.2f", "Sponson Turret", 0.0, 0.0, + CurUnit.GetLoadout().GetSponsonTurretCost()) + NL; // Sponsons don't directly contribute to BV } retval += NL; retval += GetEquipmentCostLines(); retval += NL; - retval += String.format( "Cost Multiplier %1$,1.3f", CurUnit.GetCostMult() ) + NL; - retval += String.format( "Chassis Modifier %1$,1.3f", CurUnit.GetConfigMultiplier() ) + NL; - retval += String.format( "Dry Cost %1$,13.0f", CurUnit.GetDryCost() ) + NL; - retval += String.format( "Total Cost %1$,13.0f", CurUnit.GetTotalCost() ) + NL; + retval += String.format("Cost Multiplier %1$,1.3f", + CurUnit.GetCostMult()) + NL; + retval += String.format("Chassis Modifier %1$,1.3f", + CurUnit.GetConfigMultiplier()) + NL; + retval += String.format("Dry Cost %1$,13.0f", + CurUnit.GetDryCost()) + NL; + retval += String.format("Total Cost %1$,13.0f", + CurUnit.GetTotalCost()) + NL; retval += NL + NL; retval += "Defensive BV Calculation Breakdown" + NL; - if( CurUnit.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL ) { + if (CurUnit.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL) { retval += "(Note: BV Calculations include defensive BV for armored components.)" + NL; } retval += "________________________________________________________________________________" + NL; - retval += String.format( "%1$-71s %2$,8.2f", "Total Armor Factor (" + CurUnit.GetArmor().GetArmorValue() + ") * Armor Type Modifier (" + CurUnit.GetArmor().GetBVTypeMult() + ") * 2.5", CurUnit.GetArmor().GetDefensiveBV() ) + NL; - retval += "Total Structure Points (" + CurUnit.GetIntStruc().GetTotalPoints() + ") * Structure Type Modifier (" + CurUnit.GetIntStruc().GetBVTypeMult() + ")" + NL; - retval += String.format( "%1$-71s %2$,8.2f", " * 1.5", CurUnit.GetIntStruc().GetDefensiveBV() ) + NL; - //retval += String.format( "%1$-71s", "Vehicle Tonnage (" + CurUnit.GetTonnage() + ") ") + NL; - retval += String.format( "%1$-71s %2$,8.2f", "Total Defensive BV of all Equipment", CurUnit.GetDefensiveEquipBV() ) + NL; - retval += String.format( "%1$-71s %2$,8.2f", "Excessive Ammunition Penalty", CurUnit.GetDefensiveExcessiveAmmoPenalty() ) + NL; - //retval += String.format( "%1$-71s %2$,8.2f", "Explosive Ammunition Penalty", CurUnit.GetExplosiveAmmoPenalty() ) + NL; - //retval += String.format( "%1$-71s %2$,8.2f", "Explosive Item Penalty ", CurUnit.GetExplosiveWeaponPenalty() ) + NL; - retval += String.format( "%1$-71s %2$,8.2f", "Subtotal", CurUnit.GetUnmodifiedDefensiveBV() ) + NL; - //retval += "Defensive Speed Factor Breakdown:" + NL; - //retval += PrintDefensiveFactorCalculations(); - retval += String.format( "%1$-71s %2$,8.2f", "Vehicle Type Modifier ", CurUnit.GetDefensiveModifier() ) + NL; - if ( CurUnit.GetChassisModifierString().length() > 0 ) - retval += String.format( "%1$-81s", CurUnit.GetChassisModifierString() ) + NL; - retval += String.format( "%1$-71s %2$,8.2f", "Total DBV (Subtotal * Vehicle Type Modifier * Defensive Factor (" + String.format( "%1$,4.2f", CurUnit.GetDefensiveFactor() ) + "))", CurUnit.GetDefensiveBV() ) + NL; + retval += String.format( + "%1$-71s %2$,8.2f", "Total Armor Factor (" + CurUnit.GetArmor().GetArmorValue() + + ") * Armor Type Modifier (" + CurUnit.GetArmor().GetBVTypeMult() + ") * 2.5", + CurUnit.GetArmor().GetDefensiveBV()) + NL; + retval += "Total Structure Points (" + CurUnit.GetIntStruc().GetTotalPoints() + ") * Structure Type Modifier (" + + CurUnit.GetIntStruc().GetBVTypeMult() + ")" + NL; + retval += String.format("%1$-71s %2$,8.2f", " * 1.5", CurUnit.GetIntStruc().GetDefensiveBV()) + NL; + // retval += String.format( "%1$-71s", "Vehicle Tonnage (" + + // CurUnit.GetTonnage() + ") ") + NL; + retval += String.format("%1$-71s %2$,8.2f", "Total Defensive BV of all Equipment", + CurUnit.GetDefensiveEquipBV()) + NL; + retval += String.format("%1$-71s %2$,8.2f", "Excessive Ammunition Penalty", + CurUnit.GetDefensiveExcessiveAmmoPenalty()) + NL; + // retval += String.format( "%1$-71s %2$,8.2f", "Explosive Ammunition Penalty", + // CurUnit.GetExplosiveAmmoPenalty() ) + NL; + // retval += String.format( "%1$-71s %2$,8.2f", "Explosive Item Penalty ", + // CurUnit.GetExplosiveWeaponPenalty() ) + NL; + retval += String.format("%1$-71s %2$,8.2f", "Subtotal", CurUnit.GetUnmodifiedDefensiveBV()) + NL; + // retval += "Defensive Speed Factor Breakdown:" + NL; + // retval += PrintDefensiveFactorCalculations(); + retval += String.format("%1$-71s %2$,8.2f", "Vehicle Type Modifier ", CurUnit.GetDefensiveModifier()) + NL; + if (CurUnit.GetChassisModifierString().length() > 0) + retval += String.format("%1$-81s", CurUnit.GetChassisModifierString()) + NL; + retval += String.format("%1$-71s %2$,8.2f", + "Total DBV (Subtotal * Vehicle Type Modifier * Defensive Factor (" + + String.format("%1$,4.2f", CurUnit.GetDefensiveFactor()) + "))", + CurUnit.GetDefensiveBV()) + NL; retval += NL + NL; retval += "Offensive BV Calculation Breakdown" + NL; retval += "________________________________________________________________________________" + NL; - retval += String.format( "%1$-71s %2$,8.2f", "Weapon BV Total WBV", CurUnit.GetWeaponBV() ) + NL; + retval += String.format("%1$-71s %2$,8.2f", "Weapon BV Total WBV", CurUnit.GetWeaponBV()) + NL; retval += PrintHeatAdjustedWeaponBV(); - retval += String.format( "%1$-71s %2$,8.2f", "Non-Heat Equipment Total NHBV", CurUnit.GetNonHeatEquipBV() ) + NL; + retval += String.format("%1$-71s %2$,8.2f", "Non-Heat Equipment Total NHBV", CurUnit.GetNonHeatEquipBV()) + NL; retval += PrintNonHeatEquipBV(); - retval += String.format( "%1$-71s %2$,8.2f", "Excessive Ammunition Penalty", CurUnit.GetExcessiveAmmoPenalty() ) + NL; - retval += String.format( "%1$-71s %2$,8.2f", "Vehicle Tonnage Bonus", CurUnit.GetTonnageBV() ) + NL; - retval += String.format( "%1$-71s %2$,8.2f", "Subtotal (WBV + NHBV + Tonnage Bonus)", CurUnit.GetUnmodifiedOffensiveBV() ) + NL; + retval += String.format("%1$-71s %2$,8.2f", "Excessive Ammunition Penalty", CurUnit.GetExcessiveAmmoPenalty()) + + NL; + retval += String.format("%1$-71s %2$,8.2f", "Vehicle Tonnage Bonus", CurUnit.GetTonnageBV()) + NL; + retval += String.format("%1$-71s %2$,8.2f", "Subtotal (WBV + NHBV + Tonnage Bonus)", + CurUnit.GetUnmodifiedOffensiveBV()) + NL; retval += "Offensive Speed Factor Breakdown:" + NL; retval += PrintOffensiveFactorCalculations(); - retval += String.format( "%1$-71s %2$,8.2f", "Total OBV (Subtotal * Offensive Speed Factor (" + CurUnit.GetOffensiveFactor() + "))", CurUnit.GetOffensiveBV() ) + NL; + retval += String.format("%1$-71s %2$,8.2f", + "Total OBV (Subtotal * Offensive Speed Factor (" + CurUnit.GetOffensiveFactor() + "))", + CurUnit.GetOffensiveBV()) + NL; retval += NL + NL; - retval += String.format( "%1$-73s %2$,6d", "Total Battle Value (DBV + OBV, round off)", CurUnit.GetCurrentBV() ); + retval += String.format("%1$-73s %2$,6d", "Total Battle Value (DBV + OBV, round off)", CurUnit.GetCurrentBV()); return retval; } private String GetEquipmentCostLines() { // returns a block of lines for the cost breakdown String retval = ""; - ArrayList v = CurUnit.GetLoadout().GetNonCore(); + ArrayList v = CurUnit.GetLoadout().GetNonCore(); abPlaceable a; - for( int i = 0; i < v.size(); i++ ) { - a = (abPlaceable) v.get( i ); - if( a instanceof RangedWeapon ) { - if( ((RangedWeapon) a).IsUsingFCS() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", a.CritName() + " w/ " + ((abPlaceable) ((RangedWeapon) a).GetFCS()).CritName(), a.GetDefensiveBV(), a.GetOffensiveBV(), a.GetCost() ) + NL; + for (int i = 0; i < v.size(); i++) { + a = (abPlaceable) v.get(i); + if (a instanceof RangedWeapon) { + if (((RangedWeapon) a).IsUsingFCS()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", + a.CritName() + " w/ " + ((abPlaceable) ((RangedWeapon) a).GetFCS()).CritName(), + a.GetDefensiveBV(), a.GetOffensiveBV(), a.GetCost()) + NL; } else { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", a.CritName(), a.GetDefensiveBV(), a.GetOffensiveBV(), a.GetCost() ) + NL; + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", a.CritName(), + a.GetDefensiveBV(), a.GetOffensiveBV(), a.GetCost()) + NL; } } else { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", a.CritName(), a.GetDefensiveBV(), a.GetOffensiveBV(), a.GetCost() ) + NL; + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", a.CritName(), a.GetDefensiveBV(), + a.GetOffensiveBV(), a.GetCost()) + NL; } } - if( CurUnit.UsingTC() ) { - //retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "Targeting Computer", CurUnit.GetTC().GetDefensiveBV(), CurUnit.GetTC().GetOffensiveBV(), CurUnit.GetTC().GetCost() ) + NL; + if (CurUnit.UsingTC()) { + // retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", "Targeting + // Computer", CurUnit.GetTC().GetDefensiveBV(), + // CurUnit.GetTC().GetOffensiveBV(), CurUnit.GetTC().GetCost() ) + NL; } - if( CurUnit.HasBlueShield() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurUnit.GetBlueShield().CritName(), CurUnit.GetBlueShield().GetDefensiveBV(), CurUnit.GetBlueShield().GetOffensiveBV(), CurUnit.GetBlueShield().GetCost() ) + NL; + if (CurUnit.HasBlueShield()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurUnit.GetBlueShield().CritName(), + CurUnit.GetBlueShield().GetDefensiveBV(), CurUnit.GetBlueShield().GetOffensiveBV(), + CurUnit.GetBlueShield().GetCost()) + NL; } - if( CurUnit.GetLoadout().HasSupercharger() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurUnit.GetLoadout().GetSupercharger().CritName(), CurUnit.GetLoadout().GetSupercharger().GetDefensiveBV(), CurUnit.GetLoadout().GetSupercharger().GetOffensiveBV(), CurUnit.GetLoadout().GetSupercharger().GetCost() ) + NL; + if (CurUnit.GetLoadout().HasSupercharger()) { + retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", + CurUnit.GetLoadout().GetSupercharger().CritName(), + CurUnit.GetLoadout().GetSupercharger().GetDefensiveBV(), + CurUnit.GetLoadout().GetSupercharger().GetOffensiveBV(), + CurUnit.GetLoadout().GetSupercharger().GetCost()) + NL; } return retval; } public String PrintNonHeatEquipBV() { // return the BV of all offensive equipment - ArrayList v = CurUnit.GetLoadout().GetNonCore(); + ArrayList v = CurUnit.GetLoadout().GetNonCore(); abPlaceable a = null; String retval = ""; - for( int i = 0; i < v.size(); i++ ) { - if( ! ( v.get( i ) instanceof ifWeapon ) ) { - a = ((abPlaceable) v.get( i )); - retval += String.format( "%1$-71s %2$,8.2f", " -> " + a.CritName(), a.GetOffensiveBV() ) + NL; + for (int i = 0; i < v.size(); i++) { + if (!(v.get(i) instanceof ifWeapon)) { + a = ((abPlaceable) v.get(i)); + retval += String.format("%1$-71s %2$,8.2f", " -> " + a.CritName(), a.GetOffensiveBV()) + NL; } } return retval; @@ -170,7 +226,7 @@ public String PrintHeatAdjustedWeaponBV() { ArrayList> FrontRear = new ArrayList>(); FrontRear.add(CurUnit.GetLoadout().GetFrontItems()); FrontRear.add(CurUnit.GetLoadout().GetRearItems()); - + ArrayList> Locations = new ArrayList>(); Locations.add(CurUnit.GetLoadout().GetLeftItems()); Locations.add(CurUnit.GetLoadout().GetRightItems()); @@ -178,40 +234,44 @@ public String PrintHeatAdjustedWeaponBV() { Locations.add(CurUnit.GetLoadout().GetTurret2Items()); Locations.add(CurUnit.GetLoadout().GetSponsonTurretLeftItems()); Locations.add(CurUnit.GetLoadout().GetSponsonTurretRightItems()); - + // is it even worth performing all this? - if( CurUnit.GetLoadout().GetNonCore().size() <= 0 ) { + if (CurUnit.GetLoadout().GetNonCore().size() <= 0) { // nope return retval; } // find out the total BV of rear and forward firing weapons - for ( abPlaceable w : CurUnit.GetLoadout().GetFrontItems() ) { - if ( w instanceof ifWeapon ) + for (abPlaceable w : CurUnit.GetLoadout().GetFrontItems()) { + if (w instanceof ifWeapon) foreBV += w.GetCurOffensiveBV(false, TC, false); } - for ( abPlaceable w : CurUnit.GetLoadout().GetRearItems() ) { - if ( w instanceof ifWeapon ) + for (abPlaceable w : CurUnit.GetLoadout().GetRearItems()) { + if (w instanceof ifWeapon) rearBV += w.GetCurOffensiveBV(true, TC, false); } - if( rearBV > foreBV ) { UseRear = true; } + if (rearBV > foreBV) { + UseRear = true; + } - //Re-calculate values now based on rear adjustment - for ( ArrayList list : FrontRear ) { - for ( abPlaceable w : list ) { - if ( w instanceof ifWeapon) - retval += String.format( "%1$-71s %2$,8.2f", " -> " + w.CritName(), w.GetCurOffensiveBV( UseRear, TC, UseAESMod ) ) + NL; + // Re-calculate values now based on rear adjustment + for (ArrayList list : FrontRear) { + for (abPlaceable w : list) { + if (w instanceof ifWeapon) + retval += String.format("%1$-71s %2$,8.2f", " -> " + w.CritName(), + w.GetCurOffensiveBV(UseRear, TC, UseAESMod)) + NL; } } - - //Sides and Turrets are full value no matter what - for ( ArrayList list : Locations ) { - for ( abPlaceable w : list ) { - if ( w instanceof ifWeapon) - retval += String.format( "%1$-71s %2$,8.2f", " -> " + w.CritName(), w.GetCurOffensiveBV( false, TC, UseAESMod ) ) + NL; + + // Sides and Turrets are full value no matter what + for (ArrayList list : Locations) { + for (abPlaceable w : list) { + if (w instanceof ifWeapon) + retval += String.format("%1$-71s %2$,8.2f", " -> " + w.CritName(), + w.GetCurOffensiveBV(false, TC, UseAESMod)) + NL; } } - + return retval; } @@ -222,25 +282,31 @@ public String PrintDefensiveFactorCalculations() { // subtract one since we're indexing an array int RunMP = CurUnit.getCruiseMP() - 1; - int JumpMP = 0; + // int JumpMP = 0; // Not being used. // this is a safeguard for using MASC on an incredibly speedy chassis // there is currently no way to get a bonus higher anyway. - if( RunMP > 29 ) { RunMP = 29; } + if (RunMP > 29) { + RunMP = 29; + } // safeguard for low walk mp (Modular Armor, for instance) - if( RunMP < 0 ) { RunMP = 0; } + if (RunMP < 0) { + RunMP = 0; + } // Get the defensive factors for jumping and running movement double ground = Mech.DefensiveFactor[RunMP]; double jump = 0.0; - MechModifier m = CurUnit.GetTotalModifiers( true, true ); + MechModifier m = CurUnit.GetTotalModifiers(true, true); - retval += " Maximum Ground Movement Modifier: " + String.format( "%1$,.2f", ground ) + NL; - retval += " Maximum Jump Movement Modifier: " + String.format( "%1$,.2f", jump ) + NL; - retval += " Defensive Speed Factor Bonus from Equipment: " + String.format( "%1$,.2f", m.DefensiveBonus() ) + NL; - retval += " Minimum Defensive Speed Factor: " + String.format( "%1$,.2f", m.MinimumDefensiveBonus() ) + NL; - retval += " (Max of Run or Jump) + DSF Bonus = " + String.format( "%1$,.2f", CurUnit.GetDefensiveFactor() ) + NL; + retval += " Maximum Ground Movement Modifier: " + String.format("%1$,.2f", ground) + NL; + retval += " Maximum Jump Movement Modifier: " + String.format("%1$,.2f", jump) + NL; + retval += " Defensive Speed Factor Bonus from Equipment: " + String.format("%1$,.2f", m.DefensiveBonus()) + + NL; + retval += " Minimum Defensive Speed Factor: " + String.format("%1$,.2f", m.MinimumDefensiveBonus()) + NL; + retval += " (Max of Run or Jump) + DSF Bonus = " + String.format("%1$,.2f", CurUnit.GetDefensiveFactor()) + + NL; return retval; } @@ -249,11 +315,15 @@ public String PrintOffensiveFactorCalculations() { String retval = ""; double temp; - temp = (double) (CurUnit.getFlankMP() + ( Math.floor( 0 * 0.5 + 0.5 ) ) - 5.0 ); - retval += " Adjusted Flank MP (" + CurUnit.getFlankMP( ) + ") + ( Adjusted Jumping MP (" + 0 + ") / 2 ) - 5 = " + String.format( "%1$,.2f", CurUnit.getFlankMP() + ( Math.floor( 0 * 0.5 + 0.5 ) ) - 5.0 ) + NL; - retval += " " + String.format( "%1$,.2f", temp ) + " / 10 + 1 = " + String.format( "%1$.3f", ( temp * 0.1 + 1.0 ) ) + NL; + temp = (double) (CurUnit.getFlankMP() + (Math.floor(0 * 0.5 + 0.5)) - 5.0); + retval += " Adjusted Flank MP (" + CurUnit.getFlankMP() + ") + ( Adjusted Jumping MP (" + 0 + + ") / 2 ) - 5 = " + String.format("%1$,.2f", CurUnit.getFlankMP() + (Math.floor(0 * 0.5 + 0.5)) - 5.0) + + NL; + retval += " " + String.format("%1$,.2f", temp) + " / 10 + 1 = " + String.format("%1$.3f", (temp * 0.1 + 1.0)) + + NL; temp = temp * 0.1 + 1.0; - retval += " " + String.format( "%1$,.2f", temp ) + " ^ 1.2 = " + (double) Math.floor( ( Math.pow( temp, 1.2 ) ) * 100 + 0.5 ) / 100 + " (rounded off to two digits)" + NL; + retval += " " + String.format("%1$,.2f", temp) + " ^ 1.2 = " + + (double) Math.floor((Math.pow(temp, 1.2)) * 100 + 0.5) / 100 + " (rounded off to two digits)" + NL; return retval; } From d8b8b4513540c847badae26bd01813d2ed536252 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 21:41:29 -0600 Subject: [PATCH 059/126] sswlib/src/main/java/utilities - CostBVBreakdown - Strict Type Enforcement --- .../main/java/utilities/CostBVBreakdown.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/sswlib/src/main/java/utilities/CostBVBreakdown.java b/sswlib/src/main/java/utilities/CostBVBreakdown.java index dc54512b..452a1281 100644 --- a/sswlib/src/main/java/utilities/CostBVBreakdown.java +++ b/sswlib/src/main/java/utilities/CostBVBreakdown.java @@ -524,10 +524,10 @@ public String Render() { private String GetEquipmentCostLines() { // returns a block of lines for the cost breakdown String retval = ""; - ArrayList v = CurMech.GetLoadout().GetNonCore(); + ArrayList v = CurMech.GetLoadout().GetNonCore(); abPlaceable a; for (int i = 0; i < v.size(); i++) { - a = (abPlaceable) v.get(i); + a = v.get(i); if (a instanceof RangedWeapon) { if (((RangedWeapon) a).IsUsingFCS()) { retval += String.format("%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", @@ -692,13 +692,13 @@ private String GetEquipmentCostLines() { public String PrintNonHeatEquipBV() { // return the BV of all offensive equipment - ArrayList v = CurMech.GetLoadout().GetNonCore(); + ArrayList v = CurMech.GetLoadout().GetNonCore(); abPlaceable a = null; String retval = ""; for (int i = 0; i < v.size(); i++) { if (!(v.get(i) instanceof ifWeapon)) { - a = ((abPlaceable) v.get(i)); + a = v.get(i); retval += String.format("%1$-71s %2$,8.2f", " -> " + a.CritName(), a.GetOffensiveBV()) + NL; } } @@ -706,8 +706,7 @@ public String PrintNonHeatEquipBV() { } public String PrintHeatAdjustedWeaponBV() { - ArrayList v = CurMech.GetLoadout().GetNonCore(), - wep = new ArrayList(); + ArrayList v = CurMech.GetLoadout().GetNonCore(), wep = new ArrayList(); double foreBV = 0.0, rearBV = 0.0; boolean UseRear = false, TC = CurMech.UsingTC(), UseAESMod = false, Robotic = CurMech.UsingRoboticCockpit(); String retval = ""; @@ -896,12 +895,12 @@ public String PrintOffensiveFactorCalculations() { } private boolean HasBonusFromCP() { - ArrayList v = CurMech.GetLoadout().GetNonCore(); + ArrayList v = CurMech.GetLoadout().GetNonCore(); abPlaceable a; if (CurMech.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL) { // check for coolant pods for (int i = 0; i < v.size(); i++) { - a = (abPlaceable) v.get(i); + a = v.get(i); if (a instanceof Equipment) { if (((Equipment) a).LookupName().equals("Coolant Pod")) { return true; @@ -915,13 +914,13 @@ private boolean HasBonusFromCP() { private int GetBonusFromCP() { int BonusFromCP, retval = 0; int NumHS = CurMech.GetHeatSinks().GetNumHS(), MaxHSBonus = NumHS * 2, NumPods = 0; - ArrayList v = CurMech.GetLoadout().GetNonCore(); + ArrayList v = CurMech.GetLoadout().GetNonCore(); abPlaceable a; if (CurMech.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL) { // check for coolant pods for (int i = 0; i < v.size(); i++) { - a = (abPlaceable) v.get(i); + a = v.get(i); if (a instanceof Equipment) { if (((Equipment) a).LookupName().equals("Coolant Pod")) { NumPods++; From 3f7ed209d5a08a0320fc583f22c003f02b6b3549 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 21:44:53 -0600 Subject: [PATCH 060/126] sswlib/src/main/java/states - stEngineNone - Commented out methods not being used --- sswlib/src/main/java/states/stEngineNone.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sswlib/src/main/java/states/stEngineNone.java b/sswlib/src/main/java/states/stEngineNone.java index 0434d110..d48ded78 100644 --- a/sswlib/src/main/java/states/stEngineNone.java +++ b/sswlib/src/main/java/states/stEngineNone.java @@ -28,7 +28,7 @@ package states; -import common.CommonTools; +// import common.CommonTools; import components.AvailableCode; import components.Engine; import components.Mech; @@ -65,15 +65,15 @@ public boolean HasCounterpart() { public double GetTonnage( int Rating, boolean fractional ) { return 0; } - + public int GetCTCrits() { return 0; } - + public int GetSideTorsoCrits() { return 0; } - + public int NumCTBlocks() { return 0; } @@ -117,7 +117,7 @@ public String BookReference() { public double GetCost( int MechTonnage, int Rating ) { return 0; } - + public AvailableCode GetAvailability() { if( Owner.GetRating() > 400 ) { return LARGE_AC; } return AC; @@ -130,7 +130,7 @@ public int FreeHeatSinks() { public double GetBVMult() { return 0.0f; } - + public boolean IsFusion() { return false; } @@ -145,18 +145,24 @@ public int GetFullCrits() { return 0; } + /* + * Not Used Locally private int GetIndex( int Rating ) { return 0; } + */ + /* + * Not used locally private int GetBFIndex( int tonnage ) { return 0; } + */ public int GetBFStructure( int tonnage ) { return 0; } - + public int MaxMovementHeat() { return 0; } From 5e91af92c21108686d6f287c94df7e08a981f16c Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 21:46:10 -0600 Subject: [PATCH 061/126] sswlib/src/main/java/states - stChassisCVIS - Commented out method not being used --- .../src/main/java/states/stChassisCVIS.java | 69 ++++++++++--------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/sswlib/src/main/java/states/stChassisCVIS.java b/sswlib/src/main/java/states/stChassisCVIS.java index 3175271b..2b14af0e 100644 --- a/sswlib/src/main/java/states/stChassisCVIS.java +++ b/sswlib/src/main/java/states/stChassisCVIS.java @@ -34,16 +34,17 @@ public class stChassisCVIS implements ifChassis, ifState { // Combat Vehicle Internal Structure - private final static AvailableCode AC = new AvailableCode( AvailableCode.TECH_BOTH ); + private final static AvailableCode AC = new AvailableCode(AvailableCode.TECH_BOTH); public stChassisCVIS() { - AC.SetISCodes( 'D', 'A', 'A', 'A', 'A' ); - AC.SetISDates( 0, 0, false, 2470, 0, 0, false, false ); - AC.SetISFactions( "", "", "TH", "" ); - AC.SetCLCodes( 'D', 'X', 'A', 'A', 'A' ); - AC.SetCLDates( 0, 0, false, 2470, 0, 0, false, false ); - AC.SetCLFactions( "", "", "TH", "" ); - AC.SetRulesLevels( AvailableCode.RULES_INTRODUCTORY, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); + AC.SetISCodes('D', 'A', 'A', 'A', 'A'); + AC.SetISDates(0, 0, false, 2470, 0, 0, false, false); + AC.SetISFactions("", "", "TH", ""); + AC.SetCLCodes('D', 'X', 'A', 'A', 'A'); + AC.SetCLDates(0, 0, false, 2470, 0, 0, false, false); + AC.SetCLFactions("", "", "TH", ""); + AC.SetRulesLevels(AvailableCode.RULES_INTRODUCTORY, AvailableCode.RULES_UNALLOWED, + AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED); } public boolean HasCounterpart() { @@ -53,7 +54,7 @@ public boolean HasCounterpart() { public int GetCrits() { return 0; } - + public String ActualName() { return "Combat Vehicle Structure"; } @@ -70,7 +71,7 @@ public String ChatName() { return "Std"; } - public String MegaMekName( boolean UseRear ) { + public String MegaMekName(boolean UseRear) { return "Standard"; } @@ -78,54 +79,55 @@ public String BookReference() { return "Tech Manual"; } - public double GetStrucTon( int Tonnage, boolean fractional ) { - if ( !fractional ) - return CommonTools.RoundHalfUp((double)Tonnage / 10.0); + public double GetStrucTon(int Tonnage, boolean fractional) { + if (!fractional) + return CommonTools.RoundHalfUp((double) Tonnage / 10.0); else - return (double)Tonnage / 10.0; + return (double) Tonnage / 10.0; } - + public boolean IsQuad() { return false; } - + /** * Determines if this Chassis is a Tripod + * * @return True if this chassis is a Tripod */ public boolean IsTripod() { return false; } - + public int GetHeadPoints() { // All mech heads have 3 internal structure points return 0; } - public int GetCTPoints( int Tonnage ) { + public int GetCTPoints(int Tonnage) { return 0; } - public int GetSidePoints( int Tonnage ) { + public int GetSidePoints(int Tonnage) { return 0; } - - public int GetArmPoints( int Tonnage ) { + + public int GetArmPoints(int Tonnage) { return 0; } - public int GetLegPoints( int Tonnage ) { + public int GetLegPoints(int Tonnage) { return 0; } - - public double GetCost( int Tonnage ) { - return 10000 * GetStrucTon( Tonnage, false ); + + public double GetCost(int Tonnage) { + return 10000 * GetStrucTon(Tonnage, false); } - + public double GetBVMult() { return 1.0f; } - + public boolean IncrementPlaced() { return false; } @@ -138,9 +140,12 @@ public AvailableCode GetAvailability() { return AC; } - private int GetIndex( int Tonnage ) { - return Tonnage / 5 - 2; - } + /* + * Not used locally + * private int GetIndex( int Tonnage ) { + * return Tonnage / 5 - 2; + * } + */ public MechModifier GetMechModifier() { return null; @@ -152,7 +157,7 @@ public String toString() { return "Standard"; } - public int GetCVPoints( int Tonnage ) { - return (int)Math.ceil(Tonnage / 10.0); + public int GetCVPoints(int Tonnage) { + return (int) Math.ceil(Tonnage / 10.0); } } From 23aa8a9c15297c3b31d2efbf30b07e729b22a7c0 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 21:49:08 -0600 Subject: [PATCH 062/126] sswlib/src/main/java/Print - TWVTOLPoints - Commented out variable not being used --- sswlib/src/main/java/Print/TWVTOLPoints.java | 191 ++++++++++--------- 1 file changed, 97 insertions(+), 94 deletions(-) diff --git a/sswlib/src/main/java/Print/TWVTOLPoints.java b/sswlib/src/main/java/Print/TWVTOLPoints.java index b915fa49..0eb38e41 100644 --- a/sswlib/src/main/java/Print/TWVTOLPoints.java +++ b/sswlib/src/main/java/Print/TWVTOLPoints.java @@ -33,133 +33,136 @@ import java.util.ArrayList; public class TWVTOLPoints implements ifPrintPoints { - + private final static Point[] FrontArmorPoints = { - new Point( 467, 64 ), new Point( 474, 64 ), new Point( 481, 64 ), new Point( 488, 64 ), - new Point( 460, 71 ), new Point( 467, 71 ), new Point( 474, 71 ), new Point( 481, 71 ), new Point( 488, 71 ), new Point( 495, 71 ), - new Point( 460, 78 ), new Point( 467, 78 ), new Point( 474, 78 ), new Point( 481, 78 ), new Point( 488, 78 ), new Point( 495, 78 ), - new Point( 467, 85 ), new Point( 474, 85 ), new Point( 481, 85 ), new Point( 488, 85 ), - new Point( 467, 92 ), new Point( 474, 92 ), new Point( 481, 92 ), new Point( 488, 92 ), - new Point( 467, 99 ), new Point( 474, 99 ), new Point( 481, 99 ), new Point( 488, 99 ), + new Point( 467, 64 ), new Point( 474, 64 ), new Point( 481, 64 ), new Point( 488, 64 ), + new Point( 460, 71 ), new Point( 467, 71 ), new Point( 474, 71 ), new Point( 481, 71 ), new Point( 488, 71 ), new Point( 495, 71 ), + new Point( 460, 78 ), new Point( 467, 78 ), new Point( 474, 78 ), new Point( 481, 78 ), new Point( 488, 78 ), new Point( 495, 78 ), + new Point( 467, 85 ), new Point( 474, 85 ), new Point( 481, 85 ), new Point( 488, 85 ), + new Point( 467, 92 ), new Point( 474, 92 ), new Point( 481, 92 ), new Point( 488, 92 ), + new Point( 467, 99 ), new Point( 474, 99 ), new Point( 481, 99 ), new Point( 488, 99 ), }; - + private final static Point[] FrontInternalPoints = { - new Point( 477, 107 ), - new Point( 477, 115 ), - new Point( 477, 123 ), + new Point( 477, 107 ), + new Point( 477, 115 ), + new Point( 477, 123 ), }; - + private final static Point[] LeftArmorPoints = { new Point( 447, 92), //top left set - new Point( 447, 99), - new Point( 447, 106), - new Point( 447, 113), + new Point( 447, 99), + new Point( 447, 106), + new Point( 447, 113), new Point( 447, 120), new Point( 456, 96), //top right set - new Point( 456, 102), - new Point( 456, 109), - new Point( 456, 116), + new Point( 456, 102), + new Point( 456, 109), + new Point( 456, 116), new Point( 456, 123), new Point( 458, 147), //bottom set - new Point( 458, 154), - new Point( 458, 161), - new Point( 458, 168), - new Point( 458, 175), - new Point( 458, 182), + new Point( 458, 154), + new Point( 458, 161), + new Point( 458, 168), + new Point( 458, 175), + new Point( 458, 182), }; - + private final static Point[] LeftInternalPoints = { - new Point( 471, 157), - new Point( 471, 169), - new Point( 471, 181), + new Point( 471, 157), + new Point( 471, 169), + new Point( 471, 181), }; private final static Point[] RightArmorPoints = { new Point( 507, 92), //top right set - new Point( 507, 99), - new Point( 507, 106), - new Point( 507, 113), - new Point( 507, 120), + new Point( 507, 99), + new Point( 507, 106), + new Point( 507, 113), + new Point( 507, 120), new Point( 498, 96), //top left set - new Point( 498, 102), - new Point( 498, 109), - new Point( 498, 116), + new Point( 498, 102), + new Point( 498, 109), + new Point( 498, 116), new Point( 498, 123), new Point( 496, 147), //bottom set - new Point( 496, 154), - new Point( 496, 161), - new Point( 496, 168), - new Point( 496, 175), - new Point( 496, 182), + new Point( 496, 154), + new Point( 496, 161), + new Point( 496, 168), + new Point( 496, 175), + new Point( 496, 182), }; - + private final static Point[] RightInternalPoints = { - new Point( 483, 157), - new Point( 483, 169), - new Point( 483, 181), + new Point( 483, 157), + new Point( 483, 169), + new Point( 483, 181), }; - + + /* + * Not being used private final static Point[] RearArmorPoints = { - new Point( 478, 237), - new Point( 478, 243), - new Point( 478, 249), - new Point( 478, 255), - new Point( 478, 261), - new Point( 478, 267), - new Point( 478, 273), - new Point( 478, 279), - new Point( 478, 285), - new Point( 478, 291), - new Point( 478, 297), + new Point( 478, 237), + new Point( 478, 243), + new Point( 478, 249), + new Point( 478, 255), + new Point( 478, 261), + new Point( 478, 267), + new Point( 478, 273), + new Point( 478, 279), + new Point( 478, 285), + new Point( 478, 291), + new Point( 478, 297), }; - + */ + private final static Point[] RearInternalPoints = { - new Point( 478, 207), - new Point( 478, 215), - new Point( 478, 223), + new Point( 478, 207), + new Point( 478, 215), + new Point( 478, 223), }; - + private final static Point[] TurretArmorPoints = { new Point( 461, 215), new Point( 467, 215), new Point( 473, 215), new Point( 479, 215), new Point( 485, 215), new Point( 491, 215), new Point( 497, 215), - new Point( 455, 221), new Point( 461, 221), new Point( 467, 221), new Point( 473, 221), new Point( 479, 221), new Point( 485, 221), new Point( 491, 221), new Point( 497, 221), new Point( 503, 221), - new Point( 455, 227), new Point( 461, 227), new Point( 467, 227), new Point( 473, 227), new Point( 479, 227), new Point( 485, 227), new Point( 491, 227), new Point( 497, 227), new Point( 503, 227), - new Point( 455, 233), new Point( 461, 233), new Point( 467, 233), new Point( 473, 233), new Point( 479, 233), new Point( 485, 233), new Point( 491, 233), new Point( 497, 233), new Point( 503, 233), - new Point( 455, 239), new Point( 461, 239), new Point( 467, 239), new Point( 473, 239), new Point( 479, 239), new Point( 485, 239), new Point( 491, 239), new Point( 497, 239), new Point( 503, 239), - new Point( 455, 245), new Point( 461, 245), new Point( 467, 245), new Point( 473, 245), new Point( 479, 245), new Point( 485, 245), new Point( 491, 245), new Point( 497, 245), new Point( 503, 245), - new Point( 455, 251), new Point( 461, 251), new Point( 467, 251), new Point( 473, 251), new Point( 479, 251), new Point( 485, 251), new Point( 491, 251), new Point( 497, 251), new Point( 503, 251), + new Point( 455, 221), new Point( 461, 221), new Point( 467, 221), new Point( 473, 221), new Point( 479, 221), new Point( 485, 221), new Point( 491, 221), new Point( 497, 221), new Point( 503, 221), + new Point( 455, 227), new Point( 461, 227), new Point( 467, 227), new Point( 473, 227), new Point( 479, 227), new Point( 485, 227), new Point( 491, 227), new Point( 497, 227), new Point( 503, 227), + new Point( 455, 233), new Point( 461, 233), new Point( 467, 233), new Point( 473, 233), new Point( 479, 233), new Point( 485, 233), new Point( 491, 233), new Point( 497, 233), new Point( 503, 233), + new Point( 455, 239), new Point( 461, 239), new Point( 467, 239), new Point( 473, 239), new Point( 479, 239), new Point( 485, 239), new Point( 491, 239), new Point( 497, 239), new Point( 503, 239), + new Point( 455, 245), new Point( 461, 245), new Point( 467, 245), new Point( 473, 245), new Point( 479, 245), new Point( 485, 245), new Point( 491, 245), new Point( 497, 245), new Point( 503, 245), + new Point( 455, 251), new Point( 461, 251), new Point( 467, 251), new Point( 473, 251), new Point( 479, 251), new Point( 485, 251), new Point( 491, 251), new Point( 497, 251), new Point( 503, 251), }; - + private final static Point[] TurretInternalPoints = { new Point( 467, 200), new Point( 473, 200), new Point( 479, 200), new Point( 485, 200), new Point( 491, 200), new Point( 467, 206), new Point( 473, 206), new Point( 479, 206), new Point( 485, 206), new Point( 491, 206), }; - + private final static Point[] Turret2ArmorPoints = { - new Point( 528, 59 ), new Point( 534, 59 ), new Point( 528, 65 ), new Point( 534, 65 ), - new Point( 540, 65 ), new Point( 546, 65 ), new Point( 528, 71 ), new Point( 534, 71 ), - new Point( 540, 71 ), new Point( 546, 71 ), new Point( 528, 77 ), new Point( 534, 77 ), - new Point( 540, 77 ), new Point( 546, 77 ), new Point( 528, 83 ), new Point( 534, 83 ), - new Point( 540, 83 ), new Point( 546, 83 ), new Point( 534, 89 ), new Point( 540, 89 ), - new Point( 534, 95 ), new Point( 540, 95 ), new Point( 534, 101 ), new Point( 540, 101 ), - new Point( 534, 107 ), new Point( 540, 107 ), new Point( 534, 113 ), new Point( 540, 113 ), - new Point( 534, 119 ), new Point( 540, 119 ), new Point( 534, 125 ), new Point( 540, 125 ), - new Point( 534, 131 ), new Point( 540, 131 ) + new Point( 528, 59 ), new Point( 534, 59 ), new Point( 528, 65 ), new Point( 534, 65 ), + new Point( 540, 65 ), new Point( 546, 65 ), new Point( 528, 71 ), new Point( 534, 71 ), + new Point( 540, 71 ), new Point( 546, 71 ), new Point( 528, 77 ), new Point( 534, 77 ), + new Point( 540, 77 ), new Point( 546, 77 ), new Point( 528, 83 ), new Point( 534, 83 ), + new Point( 540, 83 ), new Point( 546, 83 ), new Point( 534, 89 ), new Point( 540, 89 ), + new Point( 534, 95 ), new Point( 540, 95 ), new Point( 534, 101 ), new Point( 540, 101 ), + new Point( 534, 107 ), new Point( 540, 107 ), new Point( 534, 113 ), new Point( 540, 113 ), + new Point( 534, 119 ), new Point( 540, 119 ), new Point( 534, 125 ), new Point( 540, 125 ), + new Point( 534, 131 ), new Point( 540, 131 ) }; - + private final static Point[] Turret2InternalPoints = { new Point( 450, 266), }; - + private final static Point[] RotorArmorPoints = { - new Point( 396, 134 ), new Point( 558, 134 ) + new Point( 396, 134 ), new Point( 558, 134 ) }; - + private final static Point[] RotorInternalPoints = { new Point( 477, 134), //center new Point( 427, 134), //left new Point( 526, 134), //right }; - + private final static Point[] WeaponPoints = { new Point( 10, 190 ), //count new Point( 28, 190 ), //name @@ -170,7 +173,7 @@ public class TWVTOLPoints implements ifPrintPoints { new Point( 174, 190 ), //sht new Point( 188, 190 ), //med new Point( 206, 190 ) }; //lng - + private final static Point[] DataPoints = { new Point( 32, 105 ), //MechName = 0 new Point( 58, 129 ), //WALKMP = 1, @@ -187,7 +190,7 @@ public class TWVTOLPoints implements ifPrintPoints { new Point( 497, 592 ), //HEATSINK_NUMBER = 12 new Point( 511, 592 ), //HEATSINK_DISSIPATION = 13 new Point( 522, 699 ), - new Point( 522, 713 ), + new Point( 522, 713 ), new Point( 142, 354 ), //MAX_HEAT = 16 new Point( 440, 28 ), //TOTAL_ARMOR = 17 new Point( 122, 708 ), //STATS = 18; @@ -195,7 +198,7 @@ public class TWVTOLPoints implements ifPrintPoints { new Point( 62, 163 ), // Engine Type = 20 new Point(35, 355) // AMMO = 21 }; - + private final static Point[] ArmorInfo = { new Point( 468, 48 ), // Front new Point( 404, 185 ), // left @@ -221,8 +224,8 @@ public Point[] GetArmorRightPoints() { public Point[] GetArmorRearPoints() { ArrayList Rows = new ArrayList(); - Point start = new Point( 478, 237); - Point offset = new Point(6,6); + Point start = new Point(478, 237); + Point offset = new Point(6, 6); Rows.add(new PIPRow(new Point(start.x, start.y), 11, offset.x, offset.y)); return PIPRow.RenderColumns(Rows); } @@ -252,15 +255,15 @@ public Point[] GetDataChartPoints() { } public Point GetMechImageLoc() { - return new Point( 231, 248 ); + return new Point(231, 248); } public Point GetImageBounds() { - return new Point( 175, 123 ); + return new Point(175, 123); } - + public Point GetLogoImageLoc() { - return new Point( 331, 195 ); + return new Point(331, 195); } public Point[] GetInternalFrontPoints() { @@ -290,8 +293,8 @@ public Point[] GetInternalTurret2Points() { public Point[] GetInternalRotorPoints() { return RotorInternalPoints; } - - // + + // public Point[] GetCritHDPoints() { throw new UnsupportedOperationException("Not supported yet."); } @@ -407,6 +410,6 @@ public Point[] GetInternalInfoPoints() { public Point[] GetHeatSinkPoints() { throw new UnsupportedOperationException("Not supported yet."); } - // + // } From bbd0dc20b1a7f7181bbf052f83af415081b9ef7f Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 21:50:41 -0600 Subject: [PATCH 063/126] sswlib/src/main/java/Print - TWNavalPoints - Commented out variables not being used. --- sswlib/src/main/java/Print/TWNavalPoints.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sswlib/src/main/java/Print/TWNavalPoints.java b/sswlib/src/main/java/Print/TWNavalPoints.java index 5ead7bb1..1694d696 100644 --- a/sswlib/src/main/java/Print/TWNavalPoints.java +++ b/sswlib/src/main/java/Print/TWNavalPoints.java @@ -44,7 +44,7 @@ public class TWNavalPoints implements ifPrintPoints { new Point( 174, 200 ), //sht new Point( 188, 200 ), //med new Point( 206, 200 ) }; //lng - + private final static Point[] DataPoints = { new Point( 32, 104 ), //MechName new Point( 58, 129 ), //WALKMP = 1, @@ -61,7 +61,7 @@ public class TWNavalPoints implements ifPrintPoints { new Point( 497, 592 ), //HEATSINK_NUMBER = 12 new Point( 511, 592 ), //HEATSINK_DISSIPATION = 13 new Point( 522, 699 ), - new Point( 522, 713 ), + new Point( 522, 713 ), new Point( 142, 354 ), //MAX_HEAT = 16 new Point( 438, 26 ), //TOTAL_ARMOR = 17 new Point( 122, 708 ), //STATS = 18; @@ -69,7 +69,7 @@ public class TWNavalPoints implements ifPrintPoints { new Point( 62, 162 ), // Engine Type = 20 new Point( 35, 373 ) // AMMO = 21 }; - + private final static Point[] ArmorInfo = { new Point( 468, 40 ), // Front new Point( 372, 305 ), // left @@ -81,9 +81,9 @@ public class TWNavalPoints implements ifPrintPoints { new Point( 0, 0 ), // body }; //
- + public Point[] GetArmorFrontPoints() { - ArrayList Points = new ArrayList(); + // ArrayList Points = new ArrayList(); // Not Being Used ArrayList Rows = new ArrayList(); Rows.add(new PIPRow(new Point(453,56), 6, 8, 8)); Rows.add(new PIPRow(new Point(445,64), 8, 8, 8)); @@ -94,12 +94,12 @@ public Point[] GetArmorFrontPoints() { Rows.add(new PIPRow(new Point(413,104), 16, 8, 8)); Rows.add(new PIPRow(new Point(405,112), 18, 8, 8)); Rows.add(new PIPRow(new Point(405,120), 18, 8, 8)); - + return PIPRow.RenderRows(Rows); } public Point[] GetArmorLeftPoints() { - ArrayList Points = new ArrayList(); + // ArrayList Points = new ArrayList(); // Not Being Used ArrayList Rows = new ArrayList(); Point starting = new Point(394, 156); Rows.add(new PIPRow(new Point( 395, 140), 1, 9, 8)); @@ -116,12 +116,12 @@ public Point[] GetArmorLeftPoints() { Rows.add(new PIPRow(new Point( 411, starting.y+(8*5)), 2, 9, 8)); Rows.add(new PIPRow(new Point( 411, starting.y+(8*6)), 2, 9, 8)); Rows.add(new PIPRow(new Point( 411, starting.y+(8*7)), 2, 9, 8)); - + return PIPRow.RenderRows(Rows); } public Point[] GetArmorRightPoints() { - ArrayList Points = new ArrayList(); + // ArrayList Points = new ArrayList(); // Not Being Used ArrayList Rows = new ArrayList(); Point starting = new Point(394, 156); Rows.add(new PIPRow(new Point( 553, 140), 1, -9, 8)); @@ -138,12 +138,12 @@ public Point[] GetArmorRightPoints() { Rows.add(new PIPRow(new Point( 537, starting.y+(8*5)), 2, -9, 8)); Rows.add(new PIPRow(new Point( 537, starting.y+(8*6)), 2, -9, 8)); Rows.add(new PIPRow(new Point( 537, starting.y+(8*7)), 2, -9, 8)); - + return PIPRow.RenderRows(Rows); } public Point[] GetArmorRearPoints() { - ArrayList Points = new ArrayList(); + // ArrayList Points = new ArrayList(); // Not Being Used ArrayList Rows = new ArrayList(); Point starting = new Point(437, 530); for (int i = 0; i < 5; i++) { @@ -160,12 +160,12 @@ public Point[] GetArmorRearPoints() { Rows.add(new PIPRow(new Point( starting.x, starting.y+8), 6, 8, 8)); starting = new Point( starting.x, starting.y+8); } - + return PIPRow.RenderRows(Rows); } public Point[] GetArmorTurretPoints() { - ArrayList Points = new ArrayList(); + // ArrayList Points = new ArrayList(); // Not Being Used ArrayList Rows = new ArrayList(); Point starting = new Point(438, 275); Point offset = new Point(8, 8); @@ -178,7 +178,7 @@ public Point[] GetArmorTurretPoints() { Rows.add(new PIPRow(new Point(starting.x, starting.y), 10, offset.x, offset.y)); starting.setLocation(starting.x, starting.y+offset.y); } - + return PIPRow.RenderRows(Rows); } @@ -209,7 +209,7 @@ public Point GetMechImageLoc() { public Point GetImageBounds() { return new Point( 175, 123 ); } - + public Point GetLogoImageLoc() { return new Point( 331, 195 ); } @@ -283,7 +283,7 @@ public Point[] GetInternalTurret2Points() { public Point[] GetInternalRotorPoints() { return PIPRow.RenderRows(new ArrayList()); } - + // public Point[] GetCritHDPoints() { throw new UnsupportedOperationException("Not supported yet."); From 468faa67a8e04e8ae03bdea35b75b371ab08003b Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 21:52:31 -0600 Subject: [PATCH 064/126] sswlib/src/main/java/Print - TWAdvGroundPoints - Commented out variables not being used. --- .../main/java/Print/TWAdvGroundPoints.java | 83 +++++++++++-------- 1 file changed, 49 insertions(+), 34 deletions(-) diff --git a/sswlib/src/main/java/Print/TWAdvGroundPoints.java b/sswlib/src/main/java/Print/TWAdvGroundPoints.java index 7fed617c..3708a628 100644 --- a/sswlib/src/main/java/Print/TWAdvGroundPoints.java +++ b/sswlib/src/main/java/Print/TWAdvGroundPoints.java @@ -34,52 +34,67 @@ public class TWAdvGroundPoints implements ifPrintPoints { - // + // + /* + * Not Being Used private final static Point[] FrontInternalPoints = { - new Point( 464, 134 ), new Point( 471, 134 ), new Point( 478, 134 ), new Point( 485, 134 ), new Point( 492, 134 ), - new Point( 464, 142 ), new Point( 471, 142 ), new Point( 478, 142 ), new Point( 485, 142 ), new Point( 492, 142 ), + new Point( 464, 134 ), new Point( 471, 134 ), new Point( 478, 134 ), new Point( 485, 134 ), new Point( 492, 134 ), + new Point( 464, 142 ), new Point( 471, 142 ), new Point( 478, 142 ), new Point( 485, 142 ), new Point( 492, 142 ), }; - + */ + + /* + * Not Being Used private final static Point[] TurretArmorPoints = { new Point( 461, 215), new Point( 467, 215), new Point( 473, 215), new Point( 479, 215), new Point( 485, 215), new Point( 491, 215), new Point( 497, 215), - new Point( 455, 221), new Point( 461, 221), new Point( 467, 221), new Point( 473, 221), new Point( 479, 221), new Point( 485, 221), new Point( 491, 221), new Point( 497, 221), new Point( 503, 221), - new Point( 455, 227), new Point( 461, 227), new Point( 467, 227), new Point( 473, 227), new Point( 479, 227), new Point( 485, 227), new Point( 491, 227), new Point( 497, 227), new Point( 503, 227), - new Point( 455, 233), new Point( 461, 233), new Point( 467, 233), new Point( 473, 233), new Point( 479, 233), new Point( 485, 233), new Point( 491, 233), new Point( 497, 233), new Point( 503, 233), - new Point( 455, 239), new Point( 461, 239), new Point( 467, 239), new Point( 473, 239), new Point( 479, 239), new Point( 485, 239), new Point( 491, 239), new Point( 497, 239), new Point( 503, 239), - new Point( 455, 245), new Point( 461, 245), new Point( 467, 245), new Point( 473, 245), new Point( 479, 245), new Point( 485, 245), new Point( 491, 245), new Point( 497, 245), new Point( 503, 245), - new Point( 455, 251), new Point( 461, 251), new Point( 467, 251), new Point( 473, 251), new Point( 479, 251), new Point( 485, 251), new Point( 491, 251), new Point( 497, 251), new Point( 503, 251), + new Point( 455, 221), new Point( 461, 221), new Point( 467, 221), new Point( 473, 221), new Point( 479, 221), new Point( 485, 221), new Point( 491, 221), new Point( 497, 221), new Point( 503, 221), + new Point( 455, 227), new Point( 461, 227), new Point( 467, 227), new Point( 473, 227), new Point( 479, 227), new Point( 485, 227), new Point( 491, 227), new Point( 497, 227), new Point( 503, 227), + new Point( 455, 233), new Point( 461, 233), new Point( 467, 233), new Point( 473, 233), new Point( 479, 233), new Point( 485, 233), new Point( 491, 233), new Point( 497, 233), new Point( 503, 233), + new Point( 455, 239), new Point( 461, 239), new Point( 467, 239), new Point( 473, 239), new Point( 479, 239), new Point( 485, 239), new Point( 491, 239), new Point( 497, 239), new Point( 503, 239), + new Point( 455, 245), new Point( 461, 245), new Point( 467, 245), new Point( 473, 245), new Point( 479, 245), new Point( 485, 245), new Point( 491, 245), new Point( 497, 245), new Point( 503, 245), + new Point( 455, 251), new Point( 461, 251), new Point( 467, 251), new Point( 473, 251), new Point( 479, 251), new Point( 485, 251), new Point( 491, 251), new Point( 497, 251), new Point( 503, 251), }; - + */ + + /* + * Not Being Used private final static Point[] TurretInternalPoints = { new Point( 467, 200), new Point( 473, 200), new Point( 479, 200), new Point( 485, 200), new Point( 491, 200), new Point( 467, 206), new Point( 473, 206), new Point( 479, 206), new Point( 485, 206), new Point( 491, 206), }; - + */ + + /* + * Not Being Used private final static Point[] Turret2ArmorPoints = { - new Point( 528, 59 ), new Point( 534, 59 ), new Point( 528, 65 ), new Point( 534, 65 ), - new Point( 540, 65 ), new Point( 546, 65 ), new Point( 528, 71 ), new Point( 534, 71 ), - new Point( 540, 71 ), new Point( 546, 71 ), new Point( 528, 77 ), new Point( 534, 77 ), - new Point( 540, 77 ), new Point( 546, 77 ), new Point( 528, 83 ), new Point( 534, 83 ), - new Point( 540, 83 ), new Point( 546, 83 ), new Point( 534, 89 ), new Point( 540, 89 ), - new Point( 534, 95 ), new Point( 540, 95 ), new Point( 534, 101 ), new Point( 540, 101 ), - new Point( 534, 107 ), new Point( 540, 107 ), new Point( 534, 113 ), new Point( 540, 113 ), - new Point( 534, 119 ), new Point( 540, 119 ), new Point( 534, 125 ), new Point( 540, 125 ), - new Point( 534, 131 ), new Point( 540, 131 ) + new Point( 528, 59 ), new Point( 534, 59 ), new Point( 528, 65 ), new Point( 534, 65 ), + new Point( 540, 65 ), new Point( 546, 65 ), new Point( 528, 71 ), new Point( 534, 71 ), + new Point( 540, 71 ), new Point( 546, 71 ), new Point( 528, 77 ), new Point( 534, 77 ), + new Point( 540, 77 ), new Point( 546, 77 ), new Point( 528, 83 ), new Point( 534, 83 ), + new Point( 540, 83 ), new Point( 546, 83 ), new Point( 534, 89 ), new Point( 540, 89 ), + new Point( 534, 95 ), new Point( 540, 95 ), new Point( 534, 101 ), new Point( 540, 101 ), + new Point( 534, 107 ), new Point( 540, 107 ), new Point( 534, 113 ), new Point( 540, 113 ), + new Point( 534, 119 ), new Point( 540, 119 ), new Point( 534, 125 ), new Point( 540, 125 ), + new Point( 534, 131 ), new Point( 540, 131 ) }; - + */ + + /* + * Not being used private final static Point[] Turret2InternalPoints = { new Point( 450, 266), }; - + */ + private final static Point[] RotorArmorPoints = { - new Point( 449, 158 ), new Point( 443, 158 ) + new Point( 449, 158 ), new Point( 443, 158 ) }; - + private final static Point[] RotorInternalPoints = { new Point( 450, 266), }; // - + private final static Point[] WeaponPoints = { new Point( 10, 200 ), //count new Point( 28, 200 ), //name @@ -90,7 +105,7 @@ public class TWAdvGroundPoints implements ifPrintPoints { new Point( 174, 200 ), //sht new Point( 188, 200 ), //med new Point( 206, 200 ) }; //lng - + private final static Point[] DataPoints = { new Point( 32, 104 ), //MechName new Point( 58, 129 ), //WALKMP = 1, @@ -107,7 +122,7 @@ public class TWAdvGroundPoints implements ifPrintPoints { new Point( 497, 592 ), //HEATSINK_NUMBER = 12 new Point( 511, 592 ), //HEATSINK_DISSIPATION = 13 new Point( 522, 699 ), - new Point( 522, 713 ), + new Point( 522, 713 ), new Point( 142, 354 ), //MAX_HEAT = 16 new Point( 440, 26 ), //TOTAL_ARMOR = 17 new Point( 122, 708 ), //STATS = 18; @@ -115,7 +130,7 @@ public class TWAdvGroundPoints implements ifPrintPoints { new Point( 62, 162 ), // Engine Type = 20 new Point( 35, 353 ) // AMMO = 21 }; - + private final static Point[] ArmorInfo = { new Point( 470, 42 ), // Front new Point( 386, 172 ), // left @@ -147,7 +162,7 @@ public Point[] GetArmorFrontPoints() { start.setLocation(433,50); Rows.add(new PIPRow(new Point(start.x-offset.x, start.y-3), 1, offset.x, offset.y)); Rows.add(new PIPRow(new Point(start.x+(14*offset.x), start.y-3), 1, offset.x, offset.y)); - + return PIPRow.RenderRows(Rows); } @@ -166,7 +181,7 @@ public Point[] GetArmorLeftPoints() { Rows.add(new PIPRow(new Point(start.x+(offset.x*2), start.y+(offset.y*6)+1), 8, offset.x, offset.y)); //5th Col Rows.add(new PIPRow(new Point(start.x+(offset.x*3), start.y+(offset.y*9)+2), 3, offset.x, offset.y)); - + return PIPRow.RenderColumns(Rows); } @@ -185,7 +200,7 @@ public Point[] GetArmorRightPoints() { Rows.add(new PIPRow(new Point(start.x-(offset.x*2), start.y+(offset.y*6)+1), 8, offset.x, offset.y)); //5th Col Rows.add(new PIPRow(new Point(start.x-(offset.x*3), start.y+(offset.y*9)+2), 3, offset.x, offset.y)); - + return PIPRow.RenderColumns(Rows); } @@ -246,7 +261,7 @@ public Point GetMechImageLoc() { public Point GetImageBounds() { return new Point( 175, 123 ); } - + public Point GetLogoImageLoc() { return new Point( 331, 195 ); } @@ -309,7 +324,7 @@ public Point[] GetInternalTurret2Points() { public Point[] GetInternalRotorPoints() { return RotorInternalPoints; } - + // public Point[] GetCritHDPoints() { throw new UnsupportedOperationException("Not supported yet."); From 1b0d3f2c1006ed08098a44aa694ce8d5ffd308c8 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 22:03:10 -0600 Subject: [PATCH 065/126] sswlib/src/main/java/print - ScenarioPrinter - Commented out variables not being used. --- .../src/main/java/Print/ScenarioPrinter.java | 109 +++++++++--------- 1 file changed, 57 insertions(+), 52 deletions(-) diff --git a/sswlib/src/main/java/Print/ScenarioPrinter.java b/sswlib/src/main/java/Print/ScenarioPrinter.java index 4282bc0b..869467a4 100644 --- a/sswlib/src/main/java/Print/ScenarioPrinter.java +++ b/sswlib/src/main/java/Print/ScenarioPrinter.java @@ -20,36 +20,39 @@ public class ScenarioPrinter implements Printable { public Graphics2D Graphic; private Scenario scenario = null; private PageFormat format = null; - private String Title = "Scenario Information"; - private int characterWidth = 125, - characterHalfWidth = 68, - pageWidth = 0, - pageHalfWidth = 0; - private Point currentLocation = new Point(0, 0), - savePoint = new Point(0, 0); + // private String Title = "Scenario Information"; + private int characterWidth = 125; + // characterHalfWidth = 68, // None are used locally + // pageWidth = 0 + // pageHalfWidth = 0; + + private Point currentLocation = new Point(0, 0); // , savePoint = new Point(0, 0); // Not used. private ImageTracker imageTracker; - public ScenarioPrinter( ImageTracker imageTracker ) { + public ScenarioPrinter(ImageTracker imageTracker) { this.imageTracker = imageTracker; } - public ScenarioPrinter( Scenario scenario, ImageTracker imageTracker ) { + public ScenarioPrinter(Scenario scenario, ImageTracker imageTracker) { this.scenario = scenario; this.imageTracker = imageTracker; } - public void SetScenario( Scenario scenario ) { + public void SetScenario(Scenario scenario) { this.scenario = scenario; } public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { - if( scenario == null ) { return Printable.NO_SUCH_PAGE; } + if (scenario == null) { + return Printable.NO_SUCH_PAGE; + } Graphic = (Graphics2D) graphics; format = pageFormat; - pageWidth = (int) ( pageFormat.getImageableWidth() - ( pageFormat.getImageableX() * 2.0 ) ); - pageHalfWidth = pageWidth / 2; + // Neither are accessed anywhere. + // pageWidth = (int) ( pageFormat.getImageableWidth() - ( pageFormat.getImageableX() * 2.0 ) ); + // pageHalfWidth = pageWidth / 2; Reset(); - Graphic.translate( pageFormat.getImageableX(), pageFormat.getImageableY() ); + Graphic.translate(pageFormat.getImageableX(), pageFormat.getImageableY()); PreparePrint(); return Printable.PAGE_EXISTS; } @@ -57,86 +60,88 @@ public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws private void PreparePrint() { Reset(); - //Battletech Logo on top of sheet - Image Recordsheet = imageTracker.getImage( PrintConsts.BT_LOGO ); - Graphic.drawImage( Recordsheet, ((int) format.getImageableWidth())-306, 0, 306, 49, null); - //currentLocation.y += 50; + // Battletech Logo on top of sheet + Image Recordsheet = imageTracker.getImage(PrintConsts.BT_LOGO); + Graphic.drawImage(Recordsheet, ((int) format.getImageableWidth()) - 306, 0, 306, 49, null); + // currentLocation.y += 50; - Graphic.setFont( PrintConsts.TitleFont); - for ( String t : PrintConsts.wrapText(scenario.getName(), 28, true) ) { + Graphic.setFont(PrintConsts.TitleFont); + for (String t : PrintConsts.wrapText(scenario.getName(), 28, true)) { Graphic.drawString(t, currentLocation.x, currentLocation.y); - currentLocation.y += Graphic.getFont().getSize()+1; + currentLocation.y += Graphic.getFont().getSize() + 1; } RenderTitle("SITUATION"); - RenderText( scenario.getSituation(), characterWidth ); + RenderText(scenario.getSituation(), characterWidth); RenderTitle("GAME SETUP"); - RenderText( scenario.getSetup(), characterWidth ); + RenderText(scenario.getSetup(), characterWidth); RenderItalic("Attacker"); - RenderText( scenario.getAttacker(), characterWidth ); + RenderText(scenario.getAttacker(), characterWidth); RenderItalic("Defender"); - RenderText( scenario.getDefender(), characterWidth ); + RenderText(scenario.getDefender(), characterWidth); - if ( scenario.getWarchest().getTrackCost() > 0 ) { + if (scenario.getWarchest().getTrackCost() > 0) { RenderTitle("Track Cost: " + scenario.getWarchest().getTrackCost()); currentLocation.y += 10; } - if ( scenario.getWarchest().getBonuses().size() > 0 ) { + if (scenario.getWarchest().getBonuses().size() > 0) { RenderItalic("Optional Bonuses"); - for ( Bonus b : scenario.getWarchest().getBonuses() ) { - RenderLine( b.toPrint(), characterWidth ); + for (Bonus b : scenario.getWarchest().getBonuses()) { + RenderLine(b.toPrint(), characterWidth); } currentLocation.y += 10; } - if ( scenario.getWarchest().getObjectives().size() > 0 ) { + if (scenario.getWarchest().getObjectives().size() > 0) { RenderItalic("Objectives"); - for ( Objective o : scenario.getWarchest().getObjectives() ) { - RenderLine( o.toPrint(), characterWidth ); + for (Objective o : scenario.getWarchest().getObjectives()) { + RenderLine(o.toPrint(), characterWidth); } currentLocation.y += 10; } - + RenderTitle("SPECIAL RULES"); - RenderText( scenario.getSpecialRules(), characterWidth ); + RenderText(scenario.getSpecialRules(), characterWidth); - if ( !scenario.getVictoryConditions().isEmpty() ) { + if (!scenario.getVictoryConditions().isEmpty()) { RenderTitle("VICTORY CONDITIONS"); - RenderText( scenario.getVictoryConditions(), characterWidth ); + RenderText(scenario.getVictoryConditions(), characterWidth); } RenderTitle("AFTERMATH"); - RenderText( scenario.getAftermath(), characterWidth ); - - //Graphic.setFont( PrintConsts.SmallBoldFont ); - //Graphic.drawString(PrintConsts.getCopyright()[0], 100, (int)format.getHeight()-40); - //Graphic.drawString(PrintConsts.getCopyright()[1], 60, (int)format.getHeight()-30); + RenderText(scenario.getAftermath(), characterWidth); + + // Graphic.setFont( PrintConsts.SmallBoldFont ); + // Graphic.drawString(PrintConsts.getCopyright()[0], 100, + // (int)format.getHeight()-40); + // Graphic.drawString(PrintConsts.getCopyright()[1], 60, + // (int)format.getHeight()-30); } - private void RenderTitle( String title) { - Graphic.setFont( PrintConsts.BoldFont ); - RenderLine( title, characterWidth ); + private void RenderTitle(String title) { + Graphic.setFont(PrintConsts.BoldFont); + RenderLine(title, characterWidth); setPlain(); } - private void RenderItalic( String title ) { - Graphic.setFont( PrintConsts.ItalicFont ); - RenderLine( title, characterWidth ); + private void RenderItalic(String title) { + Graphic.setFont(PrintConsts.ItalicFont); + RenderLine(title, characterWidth); setPlain(); } - private void RenderText( String text, int Width ) { - RenderLine( text, Width ); + private void RenderText(String text, int Width) { + RenderLine(text, Width); currentLocation.y += Graphic.getFont().getSize(); } - private void RenderLine( String text, int Width ) { + private void RenderLine(String text, int Width) { String[] formattedText = PrintConsts.wrapText(text, Width, false); - for ( String line : formattedText ) { + for (String line : formattedText) { Graphic.drawString(line, currentLocation.x, currentLocation.y); currentLocation.y += Graphic.getFont().getSize(); } @@ -147,6 +152,6 @@ public void Reset() { } private void setPlain() { - Graphic.setFont( PrintConsts.PlainFont ); + Graphic.setFont(PrintConsts.PlainFont); } } From fe48a8bd69bca3d7c123e79a740248d4ff02dca8 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 22:04:16 -0600 Subject: [PATCH 066/126] sswlib/src/main/java/Print - QuickStrieCardPrinter - Commented out variables/import not being used --- sswlib/src/main/java/Print/QuickStrikeCardPrinter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sswlib/src/main/java/Print/QuickStrikeCardPrinter.java b/sswlib/src/main/java/Print/QuickStrikeCardPrinter.java index efed6c26..240b6d11 100644 --- a/sswlib/src/main/java/Print/QuickStrikeCardPrinter.java +++ b/sswlib/src/main/java/Print/QuickStrikeCardPrinter.java @@ -40,7 +40,7 @@ import battleforce.BattleForceStats; import filehandlers.ImageTracker; import java.awt.Font; -import java.awt.Point; +// import java.awt.Point; // Not Used public class QuickStrikeCardPrinter implements Printable { private BattleForce battleforce; @@ -70,7 +70,7 @@ public QuickStrikeCardPrinter(ImageTracker images) { public void Add( BattleForceStats stat ) { getBattleforce().BattleForceStats.add(stat); } - + public void setUnitSheet( String item ) { Unit = imageTracker.getImage( item ); } @@ -84,7 +84,7 @@ public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws Render(); return Printable.PAGE_EXISTS; } - + public void Render() { int elementCount = 0; Image icon = null; @@ -115,7 +115,7 @@ public void Render() { Image image = imageTracker.getImage(stats.getImage()); Dimension dim = imageTracker.media.reSize(image, 100d, 130d); image.getScaledInstance(dim.width, dim.height, Image.SCALE_SMOOTH); - Point offset = imageTracker.media.offsetImageBottom( new Dimension(100, 130), dim); + // Point offset = imageTracker.media.offsetImageBottom( new Dimension(100, 130), dim); // Set but not accessed graphic.drawImage(image, x+UnitImageWidth-dim.width-5, y+25, dim.width, dim.height, null); if ( icon != null && printLogo ) { From 3cfac451007d407d64760ef1366967b886c9b29d Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 22:09:15 -0600 Subject: [PATCH 067/126] sswlib/src/main/java/print - QSVerticalCardPrinter - Commented out variables not being used - Added brackets to If statements to clear up what code gets ran --- .../java/Print/QSVerticalCardPrinter.java | 276 +++++++++--------- 1 file changed, 143 insertions(+), 133 deletions(-) diff --git a/sswlib/src/main/java/Print/QSVerticalCardPrinter.java b/sswlib/src/main/java/Print/QSVerticalCardPrinter.java index 12e492e6..9a72a6c4 100644 --- a/sswlib/src/main/java/Print/QSVerticalCardPrinter.java +++ b/sswlib/src/main/java/Print/QSVerticalCardPrinter.java @@ -45,63 +45,49 @@ public class QSVerticalCardPrinter implements Printable { private BattleForce battleforce; private ImageTracker imageTracker; private Graphics2D graphic; - private Image Background, CardBack; + private Image Background, CardBack; private Image[] BFIcons; - private int UnitImageWidth = PaperSize.getInchesInPixels(2.5), - UnitImageHeight = PaperSize.getInchesInPixels(3.5), - HorizontalLimit = 4, - MaxUnits = 8; + private int UnitImageWidth = PaperSize.getInchesInPixels(2.5), UnitImageHeight = PaperSize.getInchesInPixels(3.5), + HorizontalLimit = 4; // , MaxUnits = 8; // Not being used - private boolean printMechs = true, - printLogo = true, - printWarriorData = true, - useTerrainMod = false, - printCardBack = false; + private boolean printMechs = true, printLogo = true, printWarriorData = true, useTerrainMod = false, + printCardBack = false; private Point defaultPoint = new Point(0, 0); - private int x = 0, - y = 0; + private int x = 0, y = 0; - private Color Shadow = Color.BLACK, //Color.DARK_GRAY, - DarkShadow = Color.BLACK, - OVColor = new Color(204, 0, 0), - PVColor = Color.WHITE, - MoveColor = Color.ORANGE, - SkillColor = new Color(238, 216, 0), - NameColor = Color.ORANGE, - PilotColor = Color.ORANGE, - SizeColor = new Color(242, 242, 242); + private Color Shadow = Color.BLACK, // Color.DARK_GRAY, + DarkShadow = Color.BLACK, OVColor = new Color(204, 0, 0), PVColor = Color.WHITE, MoveColor = Color.ORANGE, + SkillColor = new Color(238, 216, 0), NameColor = Color.ORANGE, PilotColor = Color.ORANGE, + SizeColor = new Color(242, 242, 242); - - - public QSVerticalCardPrinter( BattleForce f, ImageTracker images) { + public QSVerticalCardPrinter(BattleForce f, ImageTracker images) { battleforce = f; imageTracker = images; - Background = imageTracker.getImage( PrintConsts.COLOR_VERT_QS_CARD ); - CardBack = imageTracker.getImage( PrintConsts.COLOR_VERT_QS_CARD_BACK ); + Background = imageTracker.getImage(PrintConsts.COLOR_VERT_QS_CARD); + CardBack = imageTracker.getImage(PrintConsts.COLOR_VERT_QS_CARD_BACK); } public QSVerticalCardPrinter(ImageTracker images) { this(new BattleForce(), images); } - public void Add( BattleForceStats stat ) { + public void Add(BattleForceStats stat) { getBattleforce().BattleForceStats.add(stat); } - public void setCardBack( boolean Value ) { + public void setCardBack(boolean Value) { printCardBack = Value; - if ( Value) - BFIcons = new Image[]{ imageTracker.getImage( PrintConsts.BF_ICON_INDUSTRIAL ), - imageTracker.getImage( PrintConsts.BF_ICON_LIGHT ), - imageTracker.getImage( PrintConsts.BF_ICON_MEDIUM ), - imageTracker.getImage( PrintConsts.BF_ICON_HEAVY ), - imageTracker.getImage( PrintConsts.BF_ICON_ASSAULT ) }; + if (Value) + BFIcons = new Image[] { imageTracker.getImage(PrintConsts.BF_ICON_INDUSTRIAL), + imageTracker.getImage(PrintConsts.BF_ICON_LIGHT), imageTracker.getImage(PrintConsts.BF_ICON_MEDIUM), + imageTracker.getImage(PrintConsts.BF_ICON_HEAVY), + imageTracker.getImage(PrintConsts.BF_ICON_ASSAULT) }; } public void setBlackAndWhite() { - Background = imageTracker.getImage( PrintConsts.BW_VERT_QS_CARD ); - CardBack =imageTracker.getImage( PrintConsts.BW_VERT_QS_CARD_BACK ); + Background = imageTracker.getImage(PrintConsts.BW_VERT_QS_CARD); + CardBack = imageTracker.getImage(PrintConsts.BW_VERT_QS_CARD_BACK); OVColor = Color.BLACK; PVColor = OVColor; MoveColor = OVColor; @@ -112,194 +98,218 @@ public void setBlackAndWhite() { Shadow = Color.WHITE; DarkShadow = Color.WHITE; - if ( printCardBack ) - BFIcons = new Image[]{ imageTracker.getImage( PrintConsts.BF_ICON_INDUSTRIAL_BW ), - imageTracker.getImage( PrintConsts.BF_ICON_LIGHT_BW ), - imageTracker.getImage( PrintConsts.BF_ICON_MEDIUM_BW ), - imageTracker.getImage( PrintConsts.BF_ICON_HEAVY_BW ), - imageTracker.getImage( PrintConsts.BF_ICON_ASSAULT_BW ) }; + if (printCardBack) + BFIcons = new Image[] { imageTracker.getImage(PrintConsts.BF_ICON_INDUSTRIAL_BW), + imageTracker.getImage(PrintConsts.BF_ICON_LIGHT_BW), + imageTracker.getImage(PrintConsts.BF_ICON_MEDIUM_BW), + imageTracker.getImage(PrintConsts.BF_ICON_HEAVY_BW), + imageTracker.getImage(PrintConsts.BF_ICON_ASSAULT_BW) }; } public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { - //if( RecordSheet == null) { return Printable.NO_SUCH_PAGE; } + // if( RecordSheet == null) { return Printable.NO_SUCH_PAGE; } defaultPoint.x = (int) pageFormat.getImageableX(); defaultPoint.y = (int) pageFormat.getImageableY(); x = defaultPoint.x; y = defaultPoint.y; - ((Graphics2D) graphics).translate( pageFormat.getImageableX(), pageFormat.getImageableY() ); + ((Graphics2D) graphics).translate(pageFormat.getImageableX(), pageFormat.getImageableY()); graphic = (Graphics2D) graphics; - //setBlackAndWhite(); + // setBlackAndWhite(); Render(); return Printable.PAGE_EXISTS; } - + public void Render() { int elementCount = 0; - for ( BattleForceStats stats : getBattleforce().BattleForceStats ) { - if ( elementCount == HorizontalLimit ) { - //if ( !printCardBack ) elementCount = 0; + for (BattleForceStats stats : getBattleforce().BattleForceStats) { + if (elementCount == HorizontalLimit) { + // if ( !printCardBack ) elementCount = 0; x = defaultPoint.x; - y += UnitImageHeight+1; + y += UnitImageHeight + 1; } elementCount += 1; - printCardFront( stats ); + printCardFront(stats); x += UnitImageWidth + 1; } - if ( printCardBack ) { + if (printCardBack) { x = defaultPoint.x; - y += UnitImageHeight+1; + y += UnitImageHeight + 1; - - for ( BattleForceStats stats : getBattleforce().BattleForceStats ) { - printCardBack( stats ); + for (BattleForceStats stats : getBattleforce().BattleForceStats) { + printCardBack(stats); x += UnitImageWidth + 1; } } - graphic.setFont( PrintConsts.RegularFont ); + graphic.setFont(PrintConsts.RegularFont); } - - private void printCardBack( BattleForceStats stats ) { - Point p = new Point(0,0); - graphic.drawImage( CardBack, x, y, UnitImageWidth, UnitImageHeight, null); + private void printCardBack(BattleForceStats stats) { + Point p = new Point(0, 0); + + graphic.drawImage(CardBack, x, y, UnitImageWidth, UnitImageHeight, null); - //Unit Name - PrintConsts.ShadowText( graphic, PrintConsts.SmallBoldFont, NameColor, DarkShadow, stats.getModel(), x+16, y+48); + // Unit Name + PrintConsts.ShadowText(graphic, PrintConsts.SmallBoldFont, NameColor, DarkShadow, stats.getModel(), x + 16, y + 48); p.y = y + 58; - for ( String line : PrintConsts.wrapText(stats.getName().toUpperCase(), 12, false) ) { - PrintConsts.ShadowText( graphic, PrintConsts.BoldFont, NameColor, DarkShadow, line, x+16, p.y); + + for (String line : PrintConsts.wrapText(stats.getName().toUpperCase(), 12, false)) { + PrintConsts.ShadowText(graphic, PrintConsts.BoldFont, NameColor, DarkShadow, line, x + 16, p.y); p.y += graphic.getFont().getSize(); } - graphic.drawImage( BFIcons[stats.getWeight()], x+112, y+40, 54, 28, null); + graphic.drawImage(BFIcons[stats.getWeight()], x + 112, y + 40, 54, 28, null); graphic.setFont(PrintConsts.SmallBoldFont); - graphic.drawString("Notes:", x+20, y+82); + graphic.drawString("Notes:", x + 20, y + 82); } - private void printCardFront( BattleForceStats stats ) { - Point p = new Point(0,0); + private void printCardFront(BattleForceStats stats) { + Point p = new Point(0, 0); - //Image - if ( printMechs ) { + // Image + if (printMechs) { stats.setImage(imageTracker.media.DetermineMatchingImage(stats.getName(), stats.getModel(), stats.getImage())); - if ( !stats.getImage().isEmpty() ) { + + if (!stats.getImage().isEmpty()) { p.x = 16; p.y = 43; Image image = imageTracker.getImage(stats.getImage()); Dimension dim = imageTracker.media.reSize(image, 85d, 128d); image.getScaledInstance(dim.width, dim.height, Image.SCALE_SMOOTH); - Point offset = imageTracker.media.offsetImageCenter( new Dimension(85, 128), dim); - graphic.drawImage(image, x+p.x+offset.x, y+p.y+offset.y, dim.width, dim.height, null); + Point offset = imageTracker.media.offsetImageCenter(new Dimension(85, 128), dim); + graphic.drawImage(image, x + p.x + offset.x, y + p.y + offset.y, dim.width, dim.height, null); } } - - if ( printLogo ) { - if ( !stats.getLogo().isEmpty() ) { + + if (printLogo) { + if (!stats.getLogo().isEmpty()) { p.x = 19; p.y = 154; Image logo = imageTracker.getImage(stats.getLogo()); - graphic.drawImage(logo, x+p.x, y+p.y, 15, 15, null); + graphic.drawImage(logo, x + p.x, y + p.y, 15, 15, null); } } - graphic.drawImage( Background, x, y, UnitImageWidth, UnitImageHeight, null); + graphic.drawImage(Background, x, y, UnitImageWidth, UnitImageHeight, null); - //Overheat (OV) - PrintConsts.ShadowText( graphic, PrintConsts.OVFont, OVColor, Shadow, stats.getOverheat()+"", (double) x+121.5, (double) y+54); + // Overheat (OV) + PrintConsts.ShadowText(graphic, PrintConsts.OVFont, OVColor, Shadow, stats.getOverheat() + "", (double) x + 121.5, (double) y + 54); - //PV - PrintConsts.ShadowText( graphic, PrintConsts.BoldFont, PVColor, DarkShadow, stats.getPointValue()+" POINTS", x+116, y+16); + // PV + PrintConsts.ShadowText(graphic, PrintConsts.BoldFont, PVColor, DarkShadow, stats.getPointValue() + " POINTS", x + 116, y + 16); - //Unit Name - PrintConsts.ShadowText( graphic, PrintConsts.SmallBoldFont, NameColor, DarkShadow, stats.getModel(), x+5, y+10); + // Unit Name + PrintConsts.ShadowText(graphic, PrintConsts.SmallBoldFont, NameColor, DarkShadow, stats.getModel(), x + 5, y + 10); p.y = y + 19; - for ( String line : PrintConsts.wrapText(stats.getName().toUpperCase(), 14, false) ) { - PrintConsts.ShadowText( graphic, PrintConsts.BoldFont, NameColor, DarkShadow, line, x+5, p.y); - p.y += graphic.getFont().getSize()-2; + for (String line : PrintConsts.wrapText(stats.getName().toUpperCase(), 14, false)) { + PrintConsts.ShadowText(graphic, PrintConsts.BoldFont, NameColor, DarkShadow, line, x + 5, p.y); + p.y += graphic.getFont().getSize() - 2; } - if ( printWarriorData ) { - p.setLocation(x+5, y+32); - //Pilot Name + if (printWarriorData) { + p.setLocation(x + 5, y + 32); + // Pilot Name String Info = "Pilot [Unit, Force]"; - if ( !stats.getWarrior().isEmpty() ) Info = Info.replace("Pilot", stats.getWarrior()); - if ( !stats.getUnit().isEmpty() ) Info = Info.replace("Unit", stats.getUnit()); - if ( !stats.getForceName().isEmpty() ) Info = Info.replace("Force", stats.getForceName()); + + if (!stats.getWarrior().isEmpty()) { + Info = Info.replace("Pilot", stats.getWarrior()); + } + + if (!stats.getUnit().isEmpty()) { + Info = Info.replace("Unit", stats.getUnit()); + } + + if (!stats.getForceName().isEmpty()) { + Info = Info.replace("Force", stats.getForceName()); + } + Info = Info.replace("Pilot", "").replace("Unit", "").replace("Force", "").replace("[, ]", "").trim(); - if ( Info.trim().startsWith("[, ") ) + + if (Info.trim().startsWith("[, ")) { Info = Info.replace("[, ", "").replace("]", "").trim(); - else + } else { Info = Info.replace("[, ", "[").replace(", ]", "]").trim(); - PrintConsts.ShadowText( graphic, PrintConsts.XtraSmallBoldFont, PilotColor, DarkShadow, Info, p.x, p.getY()); + } + + PrintConsts.ShadowText(graphic, PrintConsts.XtraSmallBoldFont, PilotColor, DarkShadow, Info, p.x, p.getY()); - //Unit Name - //PrintConsts.ShadowText( graphic, PrintConsts.XtraSmallBoldFont, PilotColor, DarkShadow, (stats.getUnit() + " [" + battleforce.ForceName + "]").replace("[]", ""), x+6, p.y+1); + // Unit Name + // PrintConsts.ShadowText( graphic, PrintConsts.XtraSmallBoldFont, PilotColor, DarkShadow, (stats.getUnit() + " [" + battleforce.ForceName + "]").replace("[]", ""), x+6, p.y+1); - //Skill - PrintConsts.ShadowText( graphic, PrintConsts.OVFont, SkillColor, Shadow, stats.getSkill()+"", x+43, y+204); + // Skill + PrintConsts.ShadowText(graphic, PrintConsts.OVFont, SkillColor, Shadow, stats.getSkill() + "", x + 43, y + 204); } p.y = 204; - //Movement (MV) + // Movement (MV) p.x = x + 24; p.x -= stats.getMovement(useTerrainMod).length() * 2; - if ( stats.getMovement(useTerrainMod).length() > 3 ) p.x -= 4; - PrintConsts.ShadowText( graphic, PrintConsts.OVFont, MoveColor, Shadow, stats.getMovement(useTerrainMod), p.x, y+p.y ); - //Weight Class - PrintConsts.ShadowText( graphic, PrintConsts.OVFont, SizeColor, Shadow, stats.getWeight()+"", x+62, y+p.y); + if (stats.getMovement(useTerrainMod).length() > 3) { + p.x -= 4; + } + + PrintConsts.ShadowText(graphic, PrintConsts.OVFont, MoveColor, Shadow, stats.getMovement(useTerrainMod), p.x, y + p.y); + + // Weight Class + PrintConsts.ShadowText(graphic, PrintConsts.OVFont, SizeColor, Shadow, stats.getWeight() + "", x + 62, y + p.y); - int[] data = {78, 93, 114, 135, 154}; + int[] data = { 78, 93, 114, 135, 154 }; p.y = 201; - //Damage Values (S,M,L,E) - PrintConsts.ShadowText( graphic, PrintConsts.SmallBoldFont, PVColor, Shadow, stats.getShort()+"", x+data[1], y+p.y); - PrintConsts.ShadowText( graphic, PrintConsts.SmallBoldFont, PVColor, Shadow, stats.getMedium()+"", x+data[2], y+p.y); - PrintConsts.ShadowText( graphic, PrintConsts.SmallBoldFont, PVColor, Shadow, stats.getLong()+"", x+data[3], y+p.y); - PrintConsts.ShadowText( graphic, PrintConsts.SmallBoldFont, PVColor, Shadow, stats.getExtreme()+"", x+data[4], y+p.y); + // Damage Values (S,M,L,E) + PrintConsts.ShadowText(graphic, PrintConsts.SmallBoldFont, PVColor, Shadow, stats.getShort() + "", x + data[1], y + p.y); + PrintConsts.ShadowText(graphic, PrintConsts.SmallBoldFont, PVColor, Shadow, stats.getMedium() + "", x + data[2], y + p.y); + PrintConsts.ShadowText(graphic, PrintConsts.SmallBoldFont, PVColor, Shadow, stats.getLong() + "", x + data[3], y + p.y); + PrintConsts.ShadowText(graphic, PrintConsts.SmallBoldFont, PVColor, Shadow, stats.getExtreme() + "", x + data[4], y + p.y); p.y += graphic.getFont().getSize(); - for ( String[] ability : stats.getDamageAbilities() ) { - PrintConsts.ShadowText( graphic, PrintConsts.XtraSmallBoldFont, PVColor, Shadow, ability[0]+"", x+data[0], y+p.y); - PrintConsts.ShadowText( graphic, PrintConsts.XtraSmallBoldFont, PVColor, Shadow, ability[1]+"", x+data[1]+1, y+p.y); - PrintConsts.ShadowText( graphic, PrintConsts.XtraSmallBoldFont, PVColor, Shadow, ability[2]+"", x+data[2]+1, y+p.y); - PrintConsts.ShadowText( graphic, PrintConsts.XtraSmallBoldFont, PVColor, Shadow, ability[3]+"", x+data[3]+1, y+p.y); - PrintConsts.ShadowText( graphic, PrintConsts.XtraSmallBoldFont, PVColor, Shadow, ability[4]+"", x+data[4]+1, y+p.y); + for (String[] ability : stats.getDamageAbilities()) { + PrintConsts.ShadowText(graphic, PrintConsts.XtraSmallBoldFont, PVColor, Shadow, ability[0] + "", x + data[0], y + p.y); + PrintConsts.ShadowText(graphic, PrintConsts.XtraSmallBoldFont, PVColor, Shadow, ability[1] + "", x + data[1] + 1, y + p.y); + PrintConsts.ShadowText(graphic, PrintConsts.XtraSmallBoldFont, PVColor, Shadow, ability[2] + "", x + data[2] + 1, y + p.y); + PrintConsts.ShadowText(graphic, PrintConsts.XtraSmallBoldFont, PVColor, Shadow, ability[3] + "", x + data[3] + 1, y + p.y); + PrintConsts.ShadowText(graphic, PrintConsts.XtraSmallBoldFont, PVColor, Shadow, ability[4] + "", x + data[4] + 1, y + p.y); p.y += graphic.getFont().getSize(); } - //Armor + // Armor p.setLocation(120, 65); int indexer = 0; - for ( int a=0; a < stats.getArmor(); a++ ) { - if ( indexer == 5 ) { p.setLocation(120, p.y+9); indexer = 0; } - PrintConsts.FilledCircle( graphic, Color.BLACK, Color.WHITE, 8, x+p.x, y+p.y); + for (int a = 0; a < stats.getArmor(); a++) { + if (indexer == 5) { + p.setLocation(120, p.y + 9); + indexer = 0; + } + PrintConsts.FilledCircle(graphic, Color.BLACK, Color.WHITE, 8, x + p.x, y + p.y); indexer += 1; p.x += 9; } - //Internal Structure + // Internal Structure indexer = 0; - p.setLocation(120, p.y+10); - for ( int s=0; s < stats.getInternal(); s++ ) { - if ( indexer == 5 ) { p.setLocation(120, p.y+9); indexer = 0; } - PrintConsts.FilledCircle( graphic, Color.BLACK, Color.LIGHT_GRAY, 8, x+p.x, y+p.y); + p.setLocation(120, p.y + 10); + for (int s = 0; s < stats.getInternal(); s++) { + if (indexer == 5) { + p.setLocation(120, p.y + 9); + indexer = 0; + } + PrintConsts.FilledCircle(graphic, Color.BLACK, Color.LIGHT_GRAY, 8, x + p.x, y + p.y); indexer += 1; p.x += 9; } - //Abilities + // Abilities p.setLocation(118, 130); - graphic.setFont( PrintConsts.XtraSmallFont ); - for ( String ability : stats.getFilteredAbilities() ) { - //ShadowText( PrintConsts.XtraSmallFont, Color.BLACK, Color.LIGHT_GRAY, ability, x+p.x, y+p.y); - graphic.drawString(ability, x+p.x, y+p.y); + graphic.setFont(PrintConsts.XtraSmallFont); + for (String ability : stats.getFilteredAbilities()) { + // ShadowText( PrintConsts.XtraSmallFont, Color.BLACK, Color.LIGHT_GRAY, ability, x+p.x, y+p.y); + graphic.drawString(ability, x + p.x, y + p.y); p.y += graphic.getFont().getSize(); } } @@ -328,7 +338,7 @@ public void setTerrain(boolean useTerrainMod) { this.useTerrainMod = useTerrainMod; } - public void setPrintWarriorData( boolean printData ) { + public void setPrintWarriorData(boolean printData) { this.printWarriorData = printData; } } From ca418572ffe39c48120bcc8bd3d74b0b22da0b2f Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Sat, 26 Dec 2020 22:12:46 -0600 Subject: [PATCH 068/126] sswlib/src/main/java/print - QSHorizontalCardPrinter - Commented out variables not being used. --- .../main/java/Print/QSHorizontalCardPrinter.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sswlib/src/main/java/Print/QSHorizontalCardPrinter.java b/sswlib/src/main/java/Print/QSHorizontalCardPrinter.java index d8eb8076..d5c91cb3 100644 --- a/sswlib/src/main/java/Print/QSHorizontalCardPrinter.java +++ b/sswlib/src/main/java/Print/QSHorizontalCardPrinter.java @@ -49,8 +49,8 @@ public class QSHorizontalCardPrinter implements Printable { private Image[] BFIcons; private int UnitImageWidth = PaperSize.getInchesInPixels(3.5), UnitImageHeight = PaperSize.getInchesInPixels(2.5), - HorizontalLimit = 2, - MaxUnits = 8; + HorizontalLimit = 2; + // MaxUnits = 8; // Not being used. private boolean printMechs = true, printLogo = true, @@ -71,7 +71,7 @@ public class QSHorizontalCardPrinter implements Printable { MoveColor = Color.ORANGE, SkillColor = new Color(238, 216, 0), NameColor = Color.ORANGE, - PilotColor = Color.ORANGE, + // PilotColor = Color.ORANGE, // Not being used SizeColor = new Color(242, 242, 242); public QSHorizontalCardPrinter( BattleForce f, ImageTracker images) { @@ -104,7 +104,7 @@ public void setBlackAndWhite() { MoveColor = OVColor; SkillColor = OVColor; NameColor = OVColor; - PilotColor = OVColor; + // PilotColor = OVColor; // Being assigned but not used SizeColor = OVColor; Shadow = Color.WHITE; DarkShadow = Color.WHITE; @@ -128,7 +128,7 @@ public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws Render(); return Printable.PAGE_EXISTS; } - + public void Render() { int elementCount = 0; Image icon = null; @@ -203,7 +203,7 @@ public void Render() { //Unit Name //PrintConsts.ShadowText( graphic, PrintConsts.XtraSmallBoldFont, NameColor, DarkShadow, (stats.getUnit() + " [" + battleforce.ForceName + "]").replace("[]", ""), x+10, y+p.y+1 ); - + //Skill PrintConsts.ShadowText( graphic, PrintConsts.Small8Font, SkillColor, Shadow, stats.getSkill()+"", x+128.0, (double) y+49.50); } @@ -261,7 +261,7 @@ public void Render() { graphic.drawImage(logo, x+p.x, y+p.y, 15, 15, null); } } - + x += UnitImageWidth + 1; if ( printCardBack ) { From 216a0f5848f6065f4d89444ac38d0f05e9db711c Mon Sep 17 00:00:00 2001 From: algebro Date: Mon, 4 Jan 2021 12:09:45 -0500 Subject: [PATCH 069/126] reset quirks when clicking new mech button --- ssw/src/main/java/ssw/gui/frmMain.java | 1 + ssw/src/main/java/ssw/gui/frmMainWide.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/ssw/src/main/java/ssw/gui/frmMain.java b/ssw/src/main/java/ssw/gui/frmMain.java index 2272123f..54717c53 100644 --- a/ssw/src/main/java/ssw/gui/frmMain.java +++ b/ssw/src/main/java/ssw/gui/frmMain.java @@ -2845,6 +2845,7 @@ private void ResetQuirks() { new String [] { "Cost", "Quirk" })); + CurMech.SetQuirks(quirks); } private void UnallocateAll() { diff --git a/ssw/src/main/java/ssw/gui/frmMainWide.java b/ssw/src/main/java/ssw/gui/frmMainWide.java index c5ba912b..b912cb2d 100644 --- a/ssw/src/main/java/ssw/gui/frmMainWide.java +++ b/ssw/src/main/java/ssw/gui/frmMainWide.java @@ -2704,6 +2704,7 @@ private void GetNewMech() { RefreshInfoPane(); SetWeaponChoosers(); ResetAmmo(); + ResetQuirks(); Overview.StartNewDocument(); Capabilities.StartNewDocument(); @@ -2744,6 +2745,21 @@ private void GetInfoOn() { ItemInfo.setVisible( true ); } } + + private void ResetQuirks() { + quirks = new ArrayList<>(); + tblQuirks.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {null, null}, + {null, null}, + {null, null}, + {null, null} + }, + new String [] { + "Cost", "Quirk" + })); + CurMech.SetQuirks(quirks); + } private void UnallocateAll() { // unallocates all crits for the current item from the loadout From 2f0c5fcfd0fe0c363ab7051f5f6e0b17405f3a4a Mon Sep 17 00:00:00 2001 From: algebro Date: Mon, 4 Jan 2021 12:12:06 -0500 Subject: [PATCH 070/126] fix indentation --- ssw/src/main/java/ssw/gui/frmMainWide.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssw/src/main/java/ssw/gui/frmMainWide.java b/ssw/src/main/java/ssw/gui/frmMainWide.java index b912cb2d..527a35a3 100644 --- a/ssw/src/main/java/ssw/gui/frmMainWide.java +++ b/ssw/src/main/java/ssw/gui/frmMainWide.java @@ -2746,7 +2746,7 @@ private void GetInfoOn() { } } - private void ResetQuirks() { + private void ResetQuirks() { quirks = new ArrayList<>(); tblQuirks.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { From bec23e45cdda963d45429e11ce5de14ce4f97131 Mon Sep 17 00:00:00 2001 From: algebro Date: Mon, 4 Jan 2021 13:30:09 -0500 Subject: [PATCH 071/126] set curlotsize when deserializing Ammunition --- sswlib/src/main/java/filehandlers/JsonReader.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sswlib/src/main/java/filehandlers/JsonReader.java b/sswlib/src/main/java/filehandlers/JsonReader.java index f9a77a04..efc37361 100644 --- a/sswlib/src/main/java/filehandlers/JsonReader.java +++ b/sswlib/src/main/java/filehandlers/JsonReader.java @@ -29,6 +29,10 @@ public class JsonReader { public ArrayList ReadAllAmmo(Path f) throws Exception { Type collectionType = new TypeToken>(){}.getType(); Map map = gson.fromJson(new FileReader(f.toString()), collectionType); + // hack to get the lot size showing correctly in the GUI + for (Ammunition ammo : map.values()) { + ammo.SetLotSize(ammo.GetMaxLotSize()); + } return new ArrayList<>(map.values()); } From 42a49abc9e2be99b75bb6f971a3274493268977f Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 10:08:02 -0600 Subject: [PATCH 072/126] ssw/filehandlers/HMPReader.java - Adjusted unused variable to not be needed. - VS Code Formatting --- .../main/java/ssw/filehandlers/HMPReader.java | 805 ++++++++++-------- 1 file changed, 434 insertions(+), 371 deletions(-) diff --git a/ssw/src/main/java/ssw/filehandlers/HMPReader.java b/ssw/src/main/java/ssw/filehandlers/HMPReader.java index 9f2cbcd9..e467fc89 100644 --- a/ssw/src/main/java/ssw/filehandlers/HMPReader.java +++ b/ssw/src/main/java/ssw/filehandlers/HMPReader.java @@ -60,70 +60,72 @@ public HMPReader() { public String GetErrors() { String retval = ""; - for( int i = 0; i < Errors.size(); i++ ) { - retval += ((ErrorReport) Errors.get( i )).GetErrorReport() + "\n\n"; + for (int i = 0; i < Errors.size(); i++) { + retval += ((ErrorReport) Errors.get(i)).GetErrorReport() + "\n\n"; } return retval; } - public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws Exception { + public Mech GetMech(String filename, boolean SuppressOmniNotification) throws Exception { Errors.clear(); byte[] buffer = new byte[5]; int[] Armor = new int[11]; DataInputStream FR; - FR = new DataInputStream( new FileInputStream( filename ) ); + FR = new DataInputStream(new FileInputStream(filename)); Mech m = new Mech(); // From the MegaMek code, this seems to be "padding". FR.read(buffer); - readUnsignedByte( FR ); + readUnsignedByte(FR); FR.skipBytes(11); - m.SetTonnage( readUnsignedShort(FR) ); + m.SetTonnage(readUnsignedShort(FR)); buffer = new byte[readUnsignedShort(FR)]; FR.read(buffer); - m.SetName( new String( buffer ) ); + m.SetName(new String(buffer)); buffer = new byte[readUnsignedShort(FR)]; FR.read(buffer); - m.SetModel( new String(buffer) ); + m.SetModel(new String(buffer)); - // we're never going to restrict HMP 'Mechs since HMP didn't have that functionality - m.SetYear( readUnsignedShort(FR), false ); + // we're never going to restrict HMP 'Mechs since HMP didn't have that + // functionality + m.SetYear(readUnsignedShort(FR), false); int Rules = readUnsignedShort(FR); - if( Rules < 0 || Rules > 3 ) { - throw new Exception( "Invalid Rules Level: " + Rules ); + if (Rules < 0 || Rules > 3) { + throw new Exception("Invalid Rules Level: " + Rules); } else { - m.SetRulesLevel( DecodeRulesLevel( Rules ) ); + m.SetRulesLevel(DecodeRulesLevel(Rules)); } // more padding readUnsignedInt(FR); FR.skipBytes(22); int bf2Length = readUnsignedShort(FR); - FR.skipBytes( bf2Length ); + FR.skipBytes(bf2Length); int TechBase = readUnsignedShort(FR); - if( TechBase < 0 || TechBase > 2 ) { - throw new Exception( "Invalid Tech Base: " + TechBase ); + if (TechBase < 0 || TechBase > 2) { + throw new Exception("Invalid Tech Base: " + TechBase); } - // Per the MegaMek code, this gets hairy. I'm keeping their comments + // Per the MegaMek code, this gets hairy. I'm keeping their comments // Fortunately the TechBase from HMP lines up with SSW's internal boolean OmniMech = false; int IntStrucTechBase = TechBase; int EngineTechBase = TechBase; int HSTechBase = TechBase; - int PhysicalWeaponTechBase = TechBase; // Used to read forward bytes in the file. + // int PhysicalWeaponTechBase = TechBase; // Used to read forward bytes in the + // file. int EnhanceTechBase = TechBase; int TCTechBase = TechBase; int ArmorTechBase = TechBase; - if ( TechBase == AvailableCode.TECH_BOTH ) { + if (TechBase == AvailableCode.TECH_BOTH) { // We've got a total of 7 shorts here. // The first one is the mech's "base" chassis technology type. // It also doubles as the internal structure type. @@ -135,14 +137,16 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws // whether the specific equipment exists on the mech or not. EngineTechBase = readUnsignedShort(FR); HSTechBase = readUnsignedShort(FR); - PhysicalWeaponTechBase = readUnsignedShort(FR); // Used to read forward bytes in the file. + // PhysicalWeaponTechBase = readUnsignedShort(FR); // Used to read forward bytes + // in the file. + readUnsignedShort(FR); // PhysicalWeaponTechBase without the variable storage that isn't used EnhanceTechBase = readUnsignedShort(FR); TCTechBase = readUnsignedShort(FR); ArmorTechBase = readUnsignedShort(FR); } int MotiveType = readUnsignedShort(FR); - switch( MotiveType ) { + switch (MotiveType) { case 0: // biped m.SetBiped(); @@ -153,31 +157,33 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws break; case 2: // LAM - throw new Exception( "SSW does not support and cannot load LAMs." ); + throw new Exception("SSW does not support and cannot load LAMs."); case 3: // armless - throw new Exception( "SSW does not support and cannot load armless 'Mechs." ); + throw new Exception("SSW does not support and cannot load armless 'Mechs."); case 10: // biped omnimech - if( ! SuppressOmniNotification ) { - Errors.add( new ErrorReport( "This 'Mech is flagged as an OmniMech but only one loadout will be created." ) ); + if (!SuppressOmniNotification) { + Errors.add(new ErrorReport( + "This 'Mech is flagged as an OmniMech but only one loadout will be created.")); } OmniMech = true; m.SetBiped(); break; case 11: // quad omnimech - if( ! SuppressOmniNotification ) { - Errors.add( new ErrorReport( "This 'Mech is flagged as an OmniMech but only one loadout will be created." ) ); + if (!SuppressOmniNotification) { + Errors.add(new ErrorReport( + "This 'Mech is flagged as an OmniMech but only one loadout will be created.")); } OmniMech = true; m.SetQuad(); break; default: - throw new Exception( "Invalid Motive Type: " + MotiveType ); + throw new Exception("Invalid Motive Type: " + MotiveType); } - switch( TechBase ) { + switch (TechBase) { case AvailableCode.TECH_INNER_SPHERE: m.SetInnerSphere(); break; @@ -188,45 +194,45 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws m.SetMixed(); break; default: - throw new Exception( "Could not find a suitable Tech Base." ); + throw new Exception("Could not find a suitable Tech Base."); } // we'll have to jury-rig the era since it isn't in the HMP files. // this is important for the BFB.GUI - if( m.GetYear() < 2443 ) { - m.SetEra( AvailableCode.ERA_STAR_LEAGUE ); - } else if( m.GetYear() >= 2443 && m.GetYear() < 2801 ) { - m.SetEra( AvailableCode.ERA_STAR_LEAGUE ); - } else if( m.GetYear() >= 2801 && m.GetYear() < 3051 ) { - m.SetEra( AvailableCode.ERA_SUCCESSION ); - } else if( m.GetYear() >= 3051 && m.GetYear() < 3132 ) { - m.SetEra( AvailableCode.ERA_CLAN_INVASION ); + if (m.GetYear() < 2443) { + m.SetEra(AvailableCode.ERA_STAR_LEAGUE); + } else if (m.GetYear() >= 2443 && m.GetYear() < 2801) { + m.SetEra(AvailableCode.ERA_STAR_LEAGUE); + } else if (m.GetYear() >= 2801 && m.GetYear() < 3051) { + m.SetEra(AvailableCode.ERA_SUCCESSION); + } else if (m.GetYear() >= 3051 && m.GetYear() < 3132) { + m.SetEra(AvailableCode.ERA_CLAN_INVASION); } else { - m.SetEra( AvailableCode.ERA_DARK_AGES ); + m.SetEra(AvailableCode.ERA_DARK_AGES); } - if( m.GetTechbase() == AvailableCode.TECH_CLAN ) { - if( m.GetEra() < AvailableCode.ERA_SUCCESSION ) { - m.SetEra( AvailableCode.ERA_SUCCESSION ); + if (m.GetTechbase() == AvailableCode.TECH_CLAN) { + if (m.GetEra() < AvailableCode.ERA_SUCCESSION) { + m.SetEra(AvailableCode.ERA_SUCCESSION); } else { - m.SetEra( AvailableCode.ERA_CLAN_INVASION ); + m.SetEra(AvailableCode.ERA_CLAN_INVASION); } } // although we can still have a mixed chassis earlier, most designs will // be Clan Invasion era - if( m.GetTechbase() == AvailableCode.TECH_BOTH ) { - if( m.GetEra() < AvailableCode.ERA_CLAN_INVASION ) { - m.SetEra( AvailableCode.ERA_CLAN_INVASION ); + if (m.GetTechbase() == AvailableCode.TECH_BOTH) { + if (m.GetEra() < AvailableCode.ERA_CLAN_INVASION) { + m.SetEra(AvailableCode.ERA_CLAN_INVASION); } } int IntStrucType = readUnsignedShort(FR); String IntStrucLookup = ""; - switch( IntStrucType ) { + switch (IntStrucType) { case 0: IntStrucLookup = "Standard Structure"; break; case 1: - IntStrucLookup = BuildLookupName( "Endo-Steel", m.GetTechbase(), IntStrucTechBase ); + IntStrucLookup = BuildLookupName("Endo-Steel", m.GetTechbase(), IntStrucTechBase); break; case 2: IntStrucLookup = "Composite Structure"; @@ -238,21 +244,21 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws IntStrucLookup = "Industrial Structure"; break; default: - throw new Exception( "Invalid Internal Structure Type: " + IntStrucType ); + throw new Exception("Invalid Internal Structure Type: " + IntStrucType); } int EngineRating = readUnsignedShort(FR); int EngineType = readUnsignedShort(FR); String EngineLookup = ""; - switch( EngineType ) { + switch (EngineType) { case 0: EngineLookup = "Fusion Engine"; break; case 1: - EngineLookup = BuildLookupName( "XL Engine", m.GetTechbase(), EngineTechBase ); + EngineLookup = BuildLookupName("XL Engine", m.GetTechbase(), EngineTechBase); break; case 2: - EngineLookup = BuildLookupName( "XXL Engine", m.GetTechbase(), EngineTechBase ); + EngineLookup = BuildLookupName("XXL Engine", m.GetTechbase(), EngineTechBase); break; case 3: EngineLookup = "Compact Fusion Engine"; @@ -264,7 +270,7 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws EngineLookup = "Light Fusion Engine"; break; default: - throw new Exception( "Invalid Engine Type: " + EngineType ); + throw new Exception("Invalid Engine Type: " + EngineType); } // this used to get the walking MP but we already have the engine rating @@ -274,35 +280,35 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws int NumHS = readUnsignedShort(FR); int HSType = readUnsignedShort(FR); String HSLookup = ""; - switch( HSType ) { + switch (HSType) { case 0: HSLookup = "Single Heat Sink"; break; case 1: - HSLookup = BuildLookupName( "Double Heat Sink", m.GetTechbase(), HSTechBase ); + HSLookup = BuildLookupName("Double Heat Sink", m.GetTechbase(), HSTechBase); break; case 2: - throw new Exception( "SSW does not yet support Compact Heat Sinks." ); + throw new Exception("SSW does not yet support Compact Heat Sinks."); case 3: - throw new Exception( "SSW does not yet support Laser Heat Sinks." ); + throw new Exception("SSW does not yet support Laser Heat Sinks."); default: - throw new Exception( "Invalid Heat Sink Type: " + HSType ); + throw new Exception("Invalid Heat Sink Type: " + HSType); } String ArmorLookup = ""; int ArmorType = readUnsignedShort(FR); - switch( ArmorType ) { + switch (ArmorType) { case 0: ArmorLookup = "Standard Armor"; break; case 1: - ArmorLookup = BuildLookupName( "Ferro-Fibrous", m.GetTechbase(), ArmorTechBase ); + ArmorLookup = BuildLookupName("Ferro-Fibrous", m.GetTechbase(), ArmorTechBase); break; case 2: - ArmorLookup = BuildLookupName( "Reactive Armor", m.GetTechbase(), ArmorTechBase ); + ArmorLookup = BuildLookupName("Reactive Armor", m.GetTechbase(), ArmorTechBase); break; case 3: - ArmorLookup = BuildLookupName( "Laser-Reflective", m.GetTechbase(), ArmorTechBase ); + ArmorLookup = BuildLookupName("Laser-Reflective", m.GetTechbase(), ArmorTechBase); break; case 4: ArmorLookup = "Hardened Armor"; @@ -314,12 +320,12 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws ArmorLookup = "Heavy Ferro-Fibrous"; break; case 7: - throw new Exception( "SSW does not support pre-Tactical Operations Patchwork Armor." ); + throw new Exception("SSW does not support pre-Tactical Operations Patchwork Armor."); case 8: ArmorLookup = "Stealth Armor"; break; default: - throw new Exception( "Invalid Armor Type: " + ArmorType ); + throw new Exception("Invalid Armor Type: " + ArmorType); } FR.skipBytes(2); // ?? @@ -337,7 +343,7 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws // WTF is this doing here??? int JJType = readUnsignedShort(FR); String JJLookup = ""; - switch( JJType ) { + switch (JJType) { case 0: JJLookup = "Standard Jump Jet"; break; @@ -345,7 +351,7 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws JJLookup = "Improved Jump Jet"; break; default: - throw new Exception( "Invalid Jump Jet Type: " + JJType ); + throw new Exception("Invalid Jump Jet Type: " + JJType); } // back to armor I guess... @@ -361,7 +367,7 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws int EnhanceType = readUnsignedShort(FR); String EnhanceLookup = ""; - switch( EnhanceType ) { + switch (EnhanceType) { case 0: EnhanceLookup = "No Enhancement"; break; @@ -369,13 +375,13 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws EnhanceLookup = "TSM"; break; case 2: - EnhanceLookup = BuildLookupName( "MASC", m.GetTechbase(), EnhanceTechBase ); + EnhanceLookup = BuildLookupName("MASC", m.GetTechbase(), EnhanceTechBase); break; case 3: EnhanceLookup = "Industrial TSM"; break; default: - throw new Exception( "Invalid Physical Enhancement Type: " + EnhanceType ); + throw new Exception("Invalid Physical Enhancement Type: " + EnhanceType); } int WeaponCount = readUnsignedShort(FR); @@ -388,34 +394,34 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws FR.skipBytes(2); // ?? - // manufacturer name. Shame it's in a number format instead of a String + // manufacturer name. Shame it's in a number format instead of a String FR.skipBytes(readUnsignedShort(FR)); } // now get the criticals long[][] Criticals = new long[8][12]; - for( int i = 0; i < 12; i++ ) { + for (int i = 0; i < 12; i++) { Criticals[LocationIndex.MECH_LOC_LA][i] = readUnsignedInt(FR); } - for( int i = 0; i < 12; i++ ) { + for (int i = 0; i < 12; i++) { Criticals[LocationIndex.MECH_LOC_LT][i] = readUnsignedInt(FR); } - for( int i = 0; i < 12; i++ ) { + for (int i = 0; i < 12; i++) { Criticals[LocationIndex.MECH_LOC_LL][i] = readUnsignedInt(FR); } - for( int i = 0; i < 12; i++ ) { + for (int i = 0; i < 12; i++) { Criticals[LocationIndex.MECH_LOC_RA][i] = readUnsignedInt(FR); } - for( int i = 0; i < 12; i++ ) { + for (int i = 0; i < 12; i++) { Criticals[LocationIndex.MECH_LOC_RT][i] = readUnsignedInt(FR); } - for( int i = 0; i < 12; i++ ) { + for (int i = 0; i < 12; i++) { Criticals[LocationIndex.MECH_LOC_RL][i] = readUnsignedInt(FR); } - for( int i = 0; i < 12; i++ ) { + for (int i = 0; i < 12; i++) { Criticals[LocationIndex.MECH_LOC_HD][i] = readUnsignedInt(FR); } - for( int i = 0; i < 12; i++ ) { + for (int i = 0; i < 12; i++) { Criticals[LocationIndex.MECH_LOC_CT][i] = readUnsignedInt(FR); } @@ -428,32 +434,32 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws buffer = new byte[readUnsignedShort(FR)]; FR.read(buffer); Fluff = new String(buffer); - m.SetOverview( Fluff ); + m.SetOverview(Fluff); buffer = new byte[readUnsignedShort(FR)]; FR.read(buffer); Fluff = new String(buffer); - m.SetCapabilities( Fluff ); + m.SetCapabilities(Fluff); buffer = new byte[readUnsignedShort(FR)]; FR.read(buffer); Fluff = new String(buffer); - m.SetHistory( Fluff ); + m.SetHistory(Fluff); buffer = new byte[readUnsignedShort(FR)]; FR.read(buffer); Fluff = new String(buffer); - m.SetVariants( Fluff ); + m.SetVariants(Fluff); buffer = new byte[readUnsignedShort(FR)]; FR.read(buffer); Fluff = new String(buffer); - m.SetNotables( Fluff ); + m.SetNotables(Fluff); buffer = new byte[readUnsignedShort(FR)]; FR.read(buffer); Fluff = new String(buffer); - m.SetDeployment( Fluff ); + m.SetDeployment(Fluff); // non printing notes // could probably put these in Additional, but I'm not sure of the file format. @@ -464,55 +470,59 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws buffer = new byte[readUnsignedShort(FR)]; FR.read(buffer); Fluff += "\n" + new String(buffer); - m.SetAdditional( Fluff ); + m.SetAdditional(Fluff); - FR.skipBytes(8); // mechs with supercharger have an 01 in here, but we can identify from the criticals // Sounds good, MM dudes. + FR.skipBytes(8); // mechs with supercharger have an 01 in here, but we can identify from the + // criticals // Sounds good, MM dudes. String GyroLookup = "Standard Gyro"; String CockpitLookup = "Standard Cockpit"; boolean CommandConsole = false; // Get cockpit and gyro type, if any. - if( m.GetRulesLevel() > AvailableCode.RULES_ADVANCED ) { + if (m.GetRulesLevel() > AvailableCode.RULES_ADVANCED) { int GyroType = readUnsignedShort(FR); int CockpitType = readUnsignedShort(FR); - switch( GyroType ) { + switch (GyroType) { case 0: GyroLookup = "Standard Gyro"; break; case 1: - if( m.GetTechbase() == AvailableCode.TECH_CLAN ) { + if (m.GetTechbase() == AvailableCode.TECH_CLAN) { // this is not allowed under current rules. GyroLookup = "Standard Gyro"; - Errors.add( new ErrorReport( "An XL Gyro was specified for a Clan TechBase, which is not allowed under current rules.\nUse either Mixed or Inner Sphere Tech. A Standard Gyro was used instead." ) ); + Errors.add(new ErrorReport( + "An XL Gyro was specified for a Clan TechBase, which is not allowed under current rules.\nUse either Mixed or Inner Sphere Tech. A Standard Gyro was used instead.")); } else { GyroLookup = "Extra-Light Gyro"; } break; case 2: - if( m.GetTechbase() == AvailableCode.TECH_CLAN ) { + if (m.GetTechbase() == AvailableCode.TECH_CLAN) { // this is not allowed under current rules. GyroLookup = "Standard Gyro"; - Errors.add( new ErrorReport( "A Compact Gyro was specified for a Clan TechBase, which is not allowed under current rules.\nUse either Mixed or Inner Sphere Tech. A Standard Gyro was used instead." ) ); + Errors.add(new ErrorReport( + "A Compact Gyro was specified for a Clan TechBase, which is not allowed under current rules.\nUse either Mixed or Inner Sphere Tech. A Standard Gyro was used instead.")); } else { GyroLookup = "Compact Gyro"; } break; case 3: - if( m.GetTechbase() == AvailableCode.TECH_CLAN ) { + if (m.GetTechbase() == AvailableCode.TECH_CLAN) { // this is not allowed under current rules. GyroLookup = "Standard Gyro"; - Errors.add( new ErrorReport( "A Heavy-Duty Gyro was specified for a Clan TechBase, which is not allowed under current rules.\nUse either Mixed or Inner Sphere Tech. A Standard Gyro was used instead." ) ); + Errors.add(new ErrorReport( + "A Heavy-Duty Gyro was specified for a Clan TechBase, which is not allowed under current rules.\nUse either Mixed or Inner Sphere Tech. A Standard Gyro was used instead.")); } else { GyroLookup = "Heavy-Duty Gyro"; } break; default: - throw new Exception( "A non-standard Gyro type was specified: " + GyroType ); + throw new Exception("A non-standard Gyro type was specified: " + GyroType); } - switch( CockpitType ) { + switch (CockpitType) { case 0: CockpitLookup = "Standard Cockpit"; break; @@ -520,10 +530,11 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws CockpitLookup = "Torso-Mounted Cockpit"; break; case 2: - if( m.GetTechbase() == AvailableCode.TECH_CLAN ) { + if (m.GetTechbase() == AvailableCode.TECH_CLAN) { // this is not allowed under current rules. CockpitLookup = "Standard Cockpit"; - Errors.add( new ErrorReport( "A Small Cockpit was specified for a Clan TechBase, which is not allowed under Tactical Operations.\nUse either Mixed or Inner Sphere Tech. A Standard Cockpit was used instead." ) ); + Errors.add(new ErrorReport( + "A Small Cockpit was specified for a Clan TechBase, which is not allowed under Tactical Operations.\nUse either Mixed or Inner Sphere Tech. A Standard Cockpit was used instead.")); } else { CockpitLookup = "Small Cockpit"; } @@ -535,12 +546,13 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws case 4: CockpitLookup = "Standard Cockpit"; CommandConsole = true; - Errors.add( new ErrorReport( "A Dual Cockpit was specified, which is not supported in SSW.\nThe 'Mech has been set to use a Command Console instead." ) ); + Errors.add(new ErrorReport( + "A Dual Cockpit was specified, which is not supported in SSW.\nThe 'Mech has been set to use a Command Console instead.")); case 5: CockpitLookup = "Industrial Cockpit"; break; default: - throw new Exception( "A non-standard Cockpit type was specified: " + CockpitType ); + throw new Exception("A non-standard Cockpit type was specified: " + CockpitType); } } @@ -548,207 +560,216 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws FR.close(); // check for advanced stuff on the 'Mech - if( Rules == 2 ) { - for( int i = 0; i < 8; i++ ) { - for( int j = 0; j < 12; j++ ) { - if( Criticals[i][j] == 0x55 || Criticals[i][j] == 0x71 || Criticals[i][j] == 0xC9 ) { - m.SetRulesLevel( AvailableCode.RULES_ADVANCED ); + if (Rules == 2) { + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 12; j++) { + if (Criticals[i][j] == 0x55 || Criticals[i][j] == 0x71 || Criticals[i][j] == 0xC9) { + m.SetRulesLevel(AvailableCode.RULES_ADVANCED); } } } } // before we go all crazy, figure out our arm actuator situation - if( Criticals[LocationIndex.MECH_LOC_LA][3] != 0x04 ) { + if (Criticals[LocationIndex.MECH_LOC_LA][3] != 0x04) { m.GetActuators().RemoveLeftHand(); } - if( Criticals[LocationIndex.MECH_LOC_LA][2] != 0x03 ) { + if (Criticals[LocationIndex.MECH_LOC_LA][2] != 0x03) { m.GetActuators().RemoveLeftLowerArm(); } - if( Criticals[LocationIndex.MECH_LOC_RA][3] != 0x04 ) { + if (Criticals[LocationIndex.MECH_LOC_RA][3] != 0x04) { m.GetActuators().RemoveRightHand(); } - if( Criticals[LocationIndex.MECH_LOC_RA][2] != 0x03 ) { + if (Criticals[LocationIndex.MECH_LOC_RA][2] != 0x03) { m.GetActuators().RemoveRightLowerArm(); } // we need a special check here for Stealth armor, since you can move the // crits around LocationIndex[] Stealth = null; - if( ArmorLookup.equals( "Stealth Armor" ) ) { + if (ArmorLookup.equals("Stealth Armor")) { long test = 0x23; Vector STLocs = new Vector(); - for( int i = 0; i < 8; i++ ) { - for( int j = 0; j < 12; j++ ) { + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 12; j++) { // for every instance of Stealth Armor, mark the location - if( Criticals[i][j] == test ) { - STLocs.add( new LocationIndex( j, i, 1 ) ); + if (Criticals[i][j] == test) { + STLocs.add(new LocationIndex(j, i, 1)); Criticals[i][j] = 0x00; } } } // Convert to an array so we can load it into the visitor later Stealth = new LocationIndex[STLocs.size()]; - for( int i = 0; i < STLocs.size(); i++ ) { - Stealth[i] = (LocationIndex) STLocs.get( i ); + for (int i = 0; i < STLocs.size(); i++) { + Stealth[i] = (LocationIndex) STLocs.get(i); } } // let's check for engine criticals in the side torsos as well int LTEngineStart = 0, RTEngineStart = 0; - for( int i = 0; i < 12; i++ ) { - if( Criticals[LocationIndex.MECH_LOC_LT][i] == 0x0F ) { + for (int i = 0; i < 12; i++) { + if (Criticals[LocationIndex.MECH_LOC_LT][i] == 0x0F) { LTEngineStart = i; break; } } - for( int i = 0; i < 12; i++ ) { - if( Criticals[LocationIndex.MECH_LOC_RT][i] == 0x0F ) { + for (int i = 0; i < 12; i++) { + if (Criticals[LocationIndex.MECH_LOC_RT][i] == 0x0F) { RTEngineStart = i; break; } } - LocationIndex[] EngineLocs = { new LocationIndex( LTEngineStart, LocationIndex.MECH_LOC_LT, 1 ), new LocationIndex( RTEngineStart, LocationIndex.MECH_LOC_RT, 1 ) }; + LocationIndex[] EngineLocs = { new LocationIndex(LTEngineStart, LocationIndex.MECH_LOC_LT, 1), + new LocationIndex(RTEngineStart, LocationIndex.MECH_LOC_RT, 1) }; // build the 'Mech based on what we've come up with - ifVisitor v = m.Lookup( IntStrucLookup ); - m.Visit( v ); - v = m.Lookup( EngineLookup ); - v.LoadLocations( EngineLocs ); - m.Visit( v ); - m.SetEngineRating( EngineRating ); - v = m.Lookup( ArmorLookup ); - if( ArmorLookup.equals( "Stealth Armor" ) ) { - v.LoadLocations( Stealth ); + ifVisitor v = m.Lookup(IntStrucLookup); + m.Visit(v); + v = m.Lookup(EngineLookup); + v.LoadLocations(EngineLocs); + m.Visit(v); + m.SetEngineRating(EngineRating); + v = m.Lookup(ArmorLookup); + if (ArmorLookup.equals("Stealth Armor")) { + v.LoadLocations(Stealth); } - m.Visit( v ); - v = m.Lookup( GyroLookup ); - m.Visit( v ); - v = m.Lookup( CockpitLookup ); - m.Visit( v ); - m.SetCommandConsole( CommandConsole ); - v = m.Lookup( HSLookup ); - m.Visit( v ); - m.GetLoadout().GetHeatSinks().SetNumHS( NumHS ); - v = m.Lookup( EnhanceLookup ); - m.Visit( v ); - v = m.Lookup( JJLookup ); - m.Visit( v ); - for( int i = 0; i < NumJJ; i++ ) { + m.Visit(v); + v = m.Lookup(GyroLookup); + m.Visit(v); + v = m.Lookup(CockpitLookup); + m.Visit(v); + m.SetCommandConsole(CommandConsole); + v = m.Lookup(HSLookup); + m.Visit(v); + m.GetLoadout().GetHeatSinks().SetNumHS(NumHS); + v = m.Lookup(EnhanceLookup); + m.Visit(v); + v = m.Lookup(JJLookup); + m.Visit(v); + for (int i = 0; i < NumJJ; i++) { m.GetLoadout().GetJumpJets().IncrementNumJJ(); } // set the armor - m.GetArmor().SetArmor( LocationIndex.MECH_LOC_HD, Armor[LocationIndex.MECH_LOC_HD] ); - m.GetArmor().SetArmor( LocationIndex.MECH_LOC_CT, Armor[LocationIndex.MECH_LOC_CT] ); - m.GetArmor().SetArmor( LocationIndex.MECH_LOC_LT, Armor[LocationIndex.MECH_LOC_LT] ); - m.GetArmor().SetArmor( LocationIndex.MECH_LOC_RT, Armor[LocationIndex.MECH_LOC_RT] ); - m.GetArmor().SetArmor( LocationIndex.MECH_LOC_LA, Armor[LocationIndex.MECH_LOC_LA] ); - m.GetArmor().SetArmor( LocationIndex.MECH_LOC_RA, Armor[LocationIndex.MECH_LOC_RA] ); - m.GetArmor().SetArmor( LocationIndex.MECH_LOC_LL, Armor[LocationIndex.MECH_LOC_LL] ); - m.GetArmor().SetArmor( LocationIndex.MECH_LOC_RL, Armor[LocationIndex.MECH_LOC_RL] ); - m.GetArmor().SetArmor( LocationIndex.MECH_LOC_CTR, Armor[LocationIndex.MECH_LOC_CTR] ); - m.GetArmor().SetArmor( LocationIndex.MECH_LOC_LTR, Armor[LocationIndex.MECH_LOC_LTR] ); - m.GetArmor().SetArmor( LocationIndex.MECH_LOC_RTR, Armor[LocationIndex.MECH_LOC_RTR] ); - - // now check for excess armor due to rounding. This is the newer rules, + m.GetArmor().SetArmor(LocationIndex.MECH_LOC_HD, Armor[LocationIndex.MECH_LOC_HD]); + m.GetArmor().SetArmor(LocationIndex.MECH_LOC_CT, Armor[LocationIndex.MECH_LOC_CT]); + m.GetArmor().SetArmor(LocationIndex.MECH_LOC_LT, Armor[LocationIndex.MECH_LOC_LT]); + m.GetArmor().SetArmor(LocationIndex.MECH_LOC_RT, Armor[LocationIndex.MECH_LOC_RT]); + m.GetArmor().SetArmor(LocationIndex.MECH_LOC_LA, Armor[LocationIndex.MECH_LOC_LA]); + m.GetArmor().SetArmor(LocationIndex.MECH_LOC_RA, Armor[LocationIndex.MECH_LOC_RA]); + m.GetArmor().SetArmor(LocationIndex.MECH_LOC_LL, Armor[LocationIndex.MECH_LOC_LL]); + m.GetArmor().SetArmor(LocationIndex.MECH_LOC_RL, Armor[LocationIndex.MECH_LOC_RL]); + m.GetArmor().SetArmor(LocationIndex.MECH_LOC_CTR, Armor[LocationIndex.MECH_LOC_CTR]); + m.GetArmor().SetArmor(LocationIndex.MECH_LOC_LTR, Armor[LocationIndex.MECH_LOC_LTR]); + m.GetArmor().SetArmor(LocationIndex.MECH_LOC_RTR, Armor[LocationIndex.MECH_LOC_RTR]); + + // now check for excess armor due to rounding. This is the newer rules, // we'll simply remove the excess from the CT front. - double RoundAV = ( m.GetArmor().GetArmorValue() - 1 ) / ( 8 * m.GetArmor().GetAVMult() ); - int mid = (int) Math.floor( RoundAV + 0.9999 ); + double RoundAV = (m.GetArmor().GetArmorValue() - 1) / (8 * m.GetArmor().GetAVMult()); + int mid = (int) Math.floor(RoundAV + 0.9999); RoundAV = mid * 0.5; - if( m.GetArmor().GetTonnage() > RoundAV ) { - m.GetArmor().SetArmor( LocationIndex.MECH_LOC_CT, m.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_CT ) - 1 ); + if (m.GetArmor().GetTonnage() > RoundAV) { + m.GetArmor().SetArmor(LocationIndex.MECH_LOC_CT, + m.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_CT) - 1); } - // first, let's find all the instances of base chassis items. Structure first - if( m.GetIntStruc().NumCrits() > 0 ) { + // first, let's find all the instances of base chassis items. Structure first + if (m.GetIntStruc().NumCrits() > 0) { // since the only structure that HMP has with more than 1 crit is // Endo-Steel, we'll look for it directly. long test = 0x14; Vector ISLocs = new Vector(); - for( int i = 0; i < 8; i++ ) { - for( int j = 0; j < 12; j++ ) { + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 12; j++) { // for every instance of Endo-Steel, mark the location - if( Criticals[i][j] == test ) { - ISLocs.add( new LocationIndex( j, i, 1 ) ); + if (Criticals[i][j] == test) { + ISLocs.add(new LocationIndex(j, i, 1)); Criticals[i][j] = 0x00; } } } // now allocate the endo-steel - for( int i = 0; i < ISLocs.size(); i++ ) { - LocationIndex l = (LocationIndex) ISLocs.get( i ); - m.GetLoadout().AddTo( m.GetIntStruc(), l.Location, l.Index ); + for (int i = 0; i < ISLocs.size(); i++) { + LocationIndex l = (LocationIndex) ISLocs.get(i); + m.GetLoadout().AddTo(m.GetIntStruc(), l.Location, l.Index); } } // armor next - if( m.GetArmor().NumCrits() > 0 &! m.GetArmor().IsStealth() ) { + if (m.GetArmor().NumCrits() > 0 & !m.GetArmor().IsStealth()) { // find out what kind of armor we have. long ArmorNum = 0; String test = m.GetArmor().LookupName(); - if( test.equals( "Ferro-Fibrous" ) ) { + if (test.equals("Ferro-Fibrous")) { ArmorNum = 0x15; - } else if( test.equals( "Reactive Armor" ) ) { + } else if (test.equals("Reactive Armor")) { ArmorNum = 0x1c; - } else if( test.equals( "Laser-Reflective" ) ) { + } else if (test.equals("Laser-Reflective")) { ArmorNum = 0x1d; - } else if( test.equals( "Light Ferro-Fibrous" ) ) { + } else if (test.equals("Light Ferro-Fibrous")) { ArmorNum = 0x21; - } else if( test.equals( "Heavy Ferro-Fibrous" ) ) { + } else if (test.equals("Heavy Ferro-Fibrous")) { ArmorNum = 0x23; } - if( ArmorNum == 0 ) { throw new Exception( "An armor type with critical spaces was specified but we can't find where to put them.\nLoading aborted." ); } + if (ArmorNum == 0) { + throw new Exception( + "An armor type with critical spaces was specified but we can't find where to put them.\nLoading aborted."); + } Vector ARLocs = new Vector(); - for( int i = 0; i < 8; i++ ) { - for( int j = 0; j < 12; j++ ) { + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 12; j++) { // for every instance of Endo-Steel, mark the location - if( Criticals[i][j] == ArmorNum ) { - ARLocs.add( new LocationIndex( j, i, 1 ) ); + if (Criticals[i][j] == ArmorNum) { + ARLocs.add(new LocationIndex(j, i, 1)); Criticals[i][j] = 0x00; } } } // now allocate the armor - for( int i = 0; i < ARLocs.size(); i++ ) { - LocationIndex l = (LocationIndex) ARLocs.get( i ); - m.GetLoadout().AddTo( m.GetArmor(), l.Location, l.Index ); + for (int i = 0; i < ARLocs.size(); i++) { + LocationIndex l = (LocationIndex) ARLocs.get(i); + m.GetLoadout().AddTo(m.GetArmor(), l.Location, l.Index); } } // on to jump jets - if( m.GetJumpJets().GetNumJJ() > 0 ) { + if (m.GetJumpJets().GetNumJJ() > 0) { long test = 0x0B; Vector JJLocs = new Vector(); boolean improved = m.GetJumpJets().IsImproved(); - for( int i = 0; i < 8; i++ ) { - for( int j = 0; j < 12; j++ ) { - if( Criticals[i][j] == test ) { - JJLocs.add( new LocationIndex( j, i, 1 ) ); + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 12; j++) { + if (Criticals[i][j] == test) { + JJLocs.add(new LocationIndex(j, i, 1)); Criticals[i][j] = 0x00; - if( improved ) { j++; Criticals[i][j] = 0x00; } + if (improved) { + j++; + Criticals[i][j] = 0x00; + } } } } JumpJet[] jjList = m.GetJumpJets().GetPlacedJumps(); - if( JJLocs.size() != jjList.length ) { - throw new Exception( "The number of jump jets specified does not match the number allocated.\nLoading aborted." ); + if (JJLocs.size() != jjList.length) { + throw new Exception( + "The number of jump jets specified does not match the number allocated.\nLoading aborted."); } // now allocate the jump jets - for( int i = 0; i < JJLocs.size(); i++ ) { - // place each jump jet - LocationIndex l = (LocationIndex) JJLocs.get( i ); - m.GetLoadout().AddTo( jjList[i], l.Location, l.Index ); + for (int i = 0; i < JJLocs.size(); i++) { + // place each jump jet + LocationIndex l = (LocationIndex) JJLocs.get(i); + m.GetLoadout().AddTo(jjList[i], l.Location, l.Index); } } // heat sinks next - if( m.GetHeatSinks().GetPlacedHeatSinks().length > 0 ) { + if (m.GetHeatSinks().GetPlacedHeatSinks().length > 0) { long test = 0x00; int size = 0; - if( m.GetHeatSinks().IsDouble() ) { + if (m.GetHeatSinks().IsDouble()) { test = 0x0A; - if( m.GetHeatSinks().GetTechBase() == AvailableCode.TECH_CLAN ) { + if (m.GetHeatSinks().GetTechBase() == AvailableCode.TECH_CLAN) { size = 1; } else { size = 2; @@ -757,15 +778,15 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws test = 0x09; } Vector HSLocs = new Vector(); - for( int i = 0; i < 8; i++ ) { - for( int j = 0; j < 12; j++ ) { - if( Criticals[i][j] == test ) { - HSLocs.add( new LocationIndex( j, i, 1 ) ); + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 12; j++) { + if (Criticals[i][j] == test) { + HSLocs.add(new LocationIndex(j, i, 1)); Criticals[i][j] = 0x00; - if( size > 0 ) { - Criticals[i][j+1] = 0x00; - if( size > 1 ) { - Criticals[i][j+2] = 0x00; + if (size > 0) { + Criticals[i][j + 1] = 0x00; + if (size > 1) { + Criticals[i][j + 2] = 0x00; } } j += size; @@ -773,109 +794,117 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws } } HeatSink[] HSList = m.GetHeatSinks().GetPlacedHeatSinks(); - if( HSLocs.size() != HSList.length ) { - if( OmniMech ) { - throw new Exception( "The number of heat sinks outside the engine does not match the number allocated.\nThis is most likely an issue with fixed heat sinks in an OmniMech loadout.\nSSW does not know how many heat sinks are fixed in the base loadout.\nLoading aborted." ); + if (HSLocs.size() != HSList.length) { + if (OmniMech) { + throw new Exception( + "The number of heat sinks outside the engine does not match the number allocated.\nThis is most likely an issue with fixed heat sinks in an OmniMech loadout.\nSSW does not know how many heat sinks are fixed in the base loadout.\nLoading aborted."); } else { - throw new Exception( "The number of heat sinks outside the engine does not match the number allocated.\nLoading aborted." ); + throw new Exception( + "The number of heat sinks outside the engine does not match the number allocated.\nLoading aborted."); } } // now allocate them - for( int i = 0; i < HSLocs.size(); i++ ) { - LocationIndex l = (LocationIndex) HSLocs.get( i ); - m.GetLoadout().AddTo( HSList[i], l.Location, l.Index ); + for (int i = 0; i < HSLocs.size(); i++) { + LocationIndex l = (LocationIndex) HSLocs.get(i); + m.GetLoadout().AddTo(HSList[i], l.Location, l.Index); } } // see if we have a physical enhancement - if( m.GetPhysEnhance().NumCrits() > 0 ) { + if (m.GetPhysEnhance().NumCrits() > 0) { long test = 0x00; - if( m.GetPhysEnhance().Contiguous() ) { + if (m.GetPhysEnhance().Contiguous()) { test = 0x17; // MASC boolean found = false; - for( int i = 0; i < 8; i ++ ) { - for( int j = 0; j < 12; j++ ) { - if( Criticals[i][j] == test ) { - m.GetLoadout().AddTo( m.GetPhysEnhance(), i, j ); - for( int x = j; x < m.GetPhysEnhance().NumCrits() + j; x++ ) { + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 12; j++) { + if (Criticals[i][j] == test) { + m.GetLoadout().AddTo(m.GetPhysEnhance(), i, j); + for (int x = j; x < m.GetPhysEnhance().NumCrits() + j; x++) { Criticals[i][x] = 0x00; } found = true; break; } } - if( found ) { break; } + if (found) { + break; + } } } else { test = 0x16; // TSM (of either sort, apparently) Vector TSMLocs = new Vector(); - for( int i = 0; i < 8; i++ ) { - for( int j = 0; j < 12; j++ ) { - if( Criticals[i][j] == test ) { - TSMLocs.add( new LocationIndex( j, i, 1 ) ); + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 12; j++) { + if (Criticals[i][j] == test) { + TSMLocs.add(new LocationIndex(j, i, 1)); Criticals[i][j] = 0x00; } } } - if( TSMLocs.size() != m.GetPhysEnhance().NumCrits() ) { - throw new Exception( "The number of TSM crits specified does not match the number allocated.\nLoading aborted." ); + if (TSMLocs.size() != m.GetPhysEnhance().NumCrits()) { + throw new Exception( + "The number of TSM crits specified does not match the number allocated.\nLoading aborted."); } - for( int i = 0; i < TSMLocs.size(); i++ ) { - LocationIndex l = (LocationIndex) TSMLocs.get( i ); - m.GetLoadout().AddTo( m.GetPhysEnhance(), l.Location, l.Index ); + for (int i = 0; i < TSMLocs.size(); i++) { + LocationIndex l = (LocationIndex) TSMLocs.get(i); + m.GetLoadout().AddTo(m.GetPhysEnhance(), l.Location, l.Index); } } } // figure out if we have any CASE crits to handle - for( int i = 0; i < 8; i++ ) { - for( int j = 0; j < 12; j++ ) { - if( Criticals[i][j] == 0x19 ) { + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 12; j++) { + if (Criticals[i][j] == 0x19) { // IS CASE - switch( i ) { + switch (i) { case LocationIndex.MECH_LOC_CT: - m.GetLoadout().SetCTCASE( true, j ); + m.GetLoadout().SetCTCASE(true, j); break; case LocationIndex.MECH_LOC_LT: - m.GetLoadout().SetLTCASE( true, j ); + m.GetLoadout().SetLTCASE(true, j); break; case LocationIndex.MECH_LOC_RT: - m.GetLoadout().SetRTCASE( true, j ); + m.GetLoadout().SetRTCASE(true, j); break; default: - Errors.add( new ErrorReport( "Inner Sphere CASE was specified for the " + LocationIndex.MechLocs[i] + "\nThis is not allowed and the item will not be added." ) ); + Errors.add(new ErrorReport( + "Inner Sphere CASE was specified for the " + LocationIndex.MechLocs[i] + + "\nThis is not allowed and the item will not be added.")); break; } } - if( Criticals[i][j] == 0x26 ) { + if (Criticals[i][j] == 0x26) { // CASE II - switch( i ) { + switch (i) { case LocationIndex.MECH_LOC_HD: - m.GetLoadout().SetHDCASEII( true, j, false ); + m.GetLoadout().SetHDCASEII(true, j, false); break; case LocationIndex.MECH_LOC_CT: - m.GetLoadout().SetCTCASEII( true, j, false ); + m.GetLoadout().SetCTCASEII(true, j, false); break; case LocationIndex.MECH_LOC_LT: - m.GetLoadout().SetLTCASEII( true, j, false ); + m.GetLoadout().SetLTCASEII(true, j, false); break; case LocationIndex.MECH_LOC_RT: - m.GetLoadout().SetRTCASEII( true, j, false ); + m.GetLoadout().SetRTCASEII(true, j, false); break; case LocationIndex.MECH_LOC_LA: - m.GetLoadout().SetLACASEII( true, j, false ); + m.GetLoadout().SetLACASEII(true, j, false); break; case LocationIndex.MECH_LOC_RA: - m.GetLoadout().SetRACASEII( true, j, false ); + m.GetLoadout().SetRACASEII(true, j, false); break; case LocationIndex.MECH_LOC_LL: - m.GetLoadout().SetLLCASEII( true, j, false ); + m.GetLoadout().SetLLCASEII(true, j, false); break; case LocationIndex.MECH_LOC_RL: - m.GetLoadout().SetRLCASEII( true, j, false ); + m.GetLoadout().SetRLCASEII(true, j, false); break; default: - Errors.add( new ErrorReport( "CASE II was specified for an invalid location.\nThe item will not be added." ) ); + Errors.add(new ErrorReport( + "CASE II was specified for an invalid location.\nThe item will not be added.")); break; } } @@ -886,9 +915,9 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws int TCLoc = -1; int TCIdx = -1; boolean HasTC = false; - for( int i = 0; i < 8; i++ ) { - for( int j = 0; j < 8; j++ ) { - if( Criticals[i][j] == 0x12 ) { + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 8; j++) { + if (Criticals[i][j] == 0x12) { // found the start location. TCLoc = i; TCIdx = j; @@ -896,28 +925,33 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws break; } } - if( HasTC ) { break; } + if (HasTC) { + break; + } } // do we have Missile FCS boolean HasFCS = false; - for( int i = 0; i < 8; i++ ) { - for( int j = 0; j < 8; j++ ) { - if( Criticals[i][j] == 0x18 ) { - m.SetFCSArtemisIV( true ); + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 8; j++) { + if (Criticals[i][j] == 0x18) { + m.SetFCSArtemisIV(true); HasFCS = true; break; } } - if( HasFCS ) { break; } + if (HasFCS) { + break; + } } // clear out all of the engine, gyro, cockpit, and actuator locations // needed for later lookups since we don't load each critical slot // independently, we do it per item - for( int i = 0; i < 8; i++ ) { - for( int j = 0; j < 12; j++ ) { - if( Criticals[i][j] > 0x00 && Criticals[i][j] < 0x11 || Criticals[i][j] == 0x12 || Criticals[i][j] == 0x18 || Criticals[i][j] == 0x19 || Criticals[i][j] == 0x26 ) { + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 12; j++) { + if (Criticals[i][j] > 0x00 && Criticals[i][j] < 0x11 || Criticals[i][j] == 0x12 + || Criticals[i][j] == 0x18 || Criticals[i][j] == 0x19 || Criticals[i][j] == 0x26) { Criticals[i][j] = 0x00; } } @@ -926,57 +960,61 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws // now for equipment. // get the secondary hash table for lookups Hashtable Other = null; - if( IntStrucTechBase == AvailableCode.TECH_CLAN ) { + if (IntStrucTechBase == AvailableCode.TECH_CLAN) { Other = Clan; } else { Other = Sphere; } // now we get to fish through the loadout trying to figure out what // equipment this 'Mech has. - DataFactory df = new DataFactory( m ); - for( int i = 0; i < 8; i++ ) { - for( int j = 0; j < 12; j++ ) { - if( Criticals[i][j] != 0x00 ) { - // transform the lookup number. we'll also find out if it was rear-mounted - Long lookup = GetLookupNum( Criticals[i][j] ); - boolean rear = IsRearMounted( Criticals[i][j] ); + DataFactory df = new DataFactory(m); + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 12; j++) { + if (Criticals[i][j] != 0x00) { + // transform the lookup number. we'll also find out if it was rear-mounted + Long lookup = GetLookupNum(Criticals[i][j]); + boolean rear = IsRearMounted(Criticals[i][j]); boolean found = true; // for each critical, we'll need to find the appropriate item // if we can't find it, create an error to let the user know - String Name = Common.get( lookup ); - if( Name == null ) { - Name = (String) Other.get( lookup ); - if( Name == null ) { + String Name = Common.get(lookup); + if (Name == null) { + Name = (String) Other.get(lookup); + if (Name == null) { found = false; } } - if( found ) { + if (found) { // fetch the item from the database - if( m.UsingArtemisIV() ) { - if( Name.contains( "@ LRM" ) || Name.contains( "@ SRM" ) ) { Name += " (Artemis IV Capable)"; } + if (m.UsingArtemisIV()) { + if (Name.contains("@ LRM") || Name.contains("@ SRM")) { + Name += " (Artemis IV Capable)"; + } } - abPlaceable neweq = df.GetEquipment().GetByName( Name, m ); - if( neweq != null ) { + abPlaceable neweq = df.GetEquipment().GetByName(Name, m); + if (neweq != null) { // is the item splittable? - if( neweq.CanSplit() ) { + if (neweq.CanSplit()) { // if it is splittable, figure out how many criticals are here int S1Index = j; int S1Num = 0; - for( int k = j; k < 12; k++ ) { - if( ( Criticals[i][k] & 0x0000FFFF ) == ( 0x0000FFFF & lookup ) ) { S1Num++; } + for (int k = j; k < 12; k++) { + if ((Criticals[i][k] & 0x0000FFFF) == (0x0000FFFF & lookup)) { + S1Num++; + } } // do we need to check adjacent locations? - if( S1Num == neweq.NumCrits() ) { + if (S1Num == neweq.NumCrits()) { // nope just allocate it - m.GetLoadout().AddToQueue( neweq ); - m.GetLoadout().AddTo( neweq, i, S1Index ); + m.GetLoadout().AddToQueue(neweq); + m.GetLoadout().AddTo(neweq, i, S1Index); Criticals[i][j] = 0x00; - if( neweq.NumCrits() > 1 ) { + if (neweq.NumCrits() > 1) { // we'll need to clear out the rest of the // criticals so we don't "find" this again - for( int k = 1; k < neweq.NumCrits(); k++ ) { + for (int k = 1; k < neweq.NumCrits(); k++) { Criticals[i][j + k] = 0x00; } } @@ -985,7 +1023,7 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws int SecondLoc = -1; int ThirdLoc = -1; int FourthLoc = -1; - switch( i ) { + switch (i) { case LocationIndex.MECH_LOC_CT: SecondLoc = LocationIndex.MECH_LOC_LT; ThirdLoc = LocationIndex.MECH_LOC_RT; @@ -1014,80 +1052,92 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws break; } // how many locations do we have to check? - // this whole process is retarded. Keeping the criticals in a series of arrays - // is so backwards... How do you differentiate between two items of the same type? - // Suppose we'll just have to keep count before we annihalate the item in the Criticals... + // this whole process is retarded. Keeping the criticals in a series of arrays + // is so backwards... How do you differentiate between two items of the same + // type? + // Suppose we'll just have to keep count before we annihalate the item in the + // Criticals... int S2Num = 0; int S2Index = -1; int S2Loc = -1; int NumLeft = neweq.NumCrits() - S1Num; - if( SecondLoc > 0 ) { - if( ThirdLoc > 0 ) { - if( FourthLoc > 0 ) { + if (SecondLoc > 0) { + if (ThirdLoc > 0) { + if (FourthLoc > 0) { // Check all three locations - for( int k = 0; k < 12; k++ ) { - if( S2Index < 0 ) { - if( ( Criticals[SecondLoc][k] & 0x0000FFFF ) == ( lookup & 0x0000FFFF ) ) { + for (int k = 0; k < 12; k++) { + if (S2Index < 0) { + if ((Criticals[SecondLoc][k] & 0x0000FFFF) == (lookup + & 0x0000FFFF)) { S2Num++; S2Index = k; S2Loc = SecondLoc; } } else { - if( ( Criticals[SecondLoc][k] & 0x0000FFFF ) == ( lookup & 0x0000FFFF ) ) { + if ((Criticals[SecondLoc][k] & 0x0000FFFF) == (lookup + & 0x0000FFFF)) { S2Num++; } } } - for( int k = 0; k < 12; k++ ) { - if( S2Index < 0 ) { - if( ( Criticals[ThirdLoc][k] & 0x0000FFFF ) == ( lookup & 0x0000FFFF ) ) { + for (int k = 0; k < 12; k++) { + if (S2Index < 0) { + if ((Criticals[ThirdLoc][k] & 0x0000FFFF) == (lookup + & 0x0000FFFF)) { S2Num++; S2Index = k; S2Loc = ThirdLoc; } } else { - if( ( Criticals[ThirdLoc][k] & 0x0000FFFF ) == ( lookup & 0x0000FFFF ) ) { + if ((Criticals[ThirdLoc][k] & 0x0000FFFF) == (lookup + & 0x0000FFFF)) { S2Num++; } } } - for( int k = 0; k < 12; k++ ) { - if( S2Index < 0 ) { - if( ( Criticals[FourthLoc][k] & 0x0000FFFF ) == ( lookup & 0x0000FFFF ) ) { + for (int k = 0; k < 12; k++) { + if (S2Index < 0) { + if ((Criticals[FourthLoc][k] & 0x0000FFFF) == (lookup + & 0x0000FFFF)) { S2Num++; S2Index = k; S2Loc = FourthLoc; } } else { - if( ( Criticals[FourthLoc][k] & 0x0000FFFF ) == ( lookup & 0x0000FFFF ) ) { + if ((Criticals[FourthLoc][k] & 0x0000FFFF) == (lookup + & 0x0000FFFF)) { S2Num++; } } } } else { // Check both locations - for( int k = 0; k < 12; k++ ) { - if( S2Index < 0 ) { - if( ( Criticals[SecondLoc][k] & 0x0000FFFF ) == ( lookup & 0x0000FFFF ) ) { + for (int k = 0; k < 12; k++) { + if (S2Index < 0) { + if ((Criticals[SecondLoc][k] & 0x0000FFFF) == (lookup + & 0x0000FFFF)) { S2Num++; S2Index = k; S2Loc = SecondLoc; } } else { - if( ( Criticals[SecondLoc][k] & 0x0000FFFF ) == ( lookup & 0x0000FFFF ) ) { + if ((Criticals[SecondLoc][k] & 0x0000FFFF) == (lookup + & 0x0000FFFF)) { S2Num++; } } } - for( int k = 0; k < 12; k++ ) { - if( S2Index < 0 ) { - if( ( Criticals[ThirdLoc][k] & 0x0000FFFF ) == ( lookup & 0x0000FFFF ) ) { + for (int k = 0; k < 12; k++) { + if (S2Index < 0) { + if ((Criticals[ThirdLoc][k] & 0x0000FFFF) == (lookup + & 0x0000FFFF)) { S2Num++; S2Index = k; S2Loc = ThirdLoc; } } else { - if( ( Criticals[ThirdLoc][k] & 0x0000FFFF ) == ( lookup & 0x0000FFFF ) ) { + if ((Criticals[ThirdLoc][k] & 0x0000FFFF) == (lookup + & 0x0000FFFF)) { S2Num++; } } @@ -1095,41 +1145,45 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws } } else { // check the other location - for( int k = 0; k < 12; k++ ) { - if( S2Index < 0 ) { - if( ( Criticals[SecondLoc][k] & 0x0000FFFF ) == ( lookup & 0x0000FFFF ) ) { + for (int k = 0; k < 12; k++) { + if (S2Index < 0) { + if ((Criticals[SecondLoc][k] & 0x0000FFFF) == (lookup + & 0x0000FFFF)) { S2Num++; S2Index = k; S2Loc = SecondLoc; } } else { - if( ( Criticals[SecondLoc][k] & 0x0000FFFF ) == ( lookup & 0x0000FFFF ) ) { + if ((Criticals[SecondLoc][k] & 0x0000FFFF) == (lookup + & 0x0000FFFF)) { S2Num++; } } } } - if( S2Num < NumLeft ) { + if (S2Num < NumLeft) { // Specified but not enough crits to fit - Errors.add( new ErrorReport( Name + "\nHas too many crits to fit in the " + LocationIndex.MechLocs[i] + "\n and we could not find another location for it.\nAdd and place the item normally." ) ); + Errors.add(new ErrorReport(Name + "\nHas too many crits to fit in the " + + LocationIndex.MechLocs[i] + + "\n and we could not find another location for it.\nAdd and place the item normally.")); } else { - if( S2Num > NumLeft ) { - // we have another item. This one goes on top, I guess. + if (S2Num > NumLeft) { + // we have another item. This one goes on top, I guess. S2Num = NumLeft; } // now we can allocate the stupid item - m.GetLoadout().AddToQueue( neweq ); - m.GetLoadout().RemoveFromQueue( neweq ); - m.GetLoadout().AddTo( m.GetLoadout().GetCrits( i ), neweq, S1Index, S1Num ); - m.GetLoadout().AddTo( m.GetLoadout().GetCrits( S2Loc ), neweq, S2Index, S2Num ); - if( rear ) { - neweq.MountRear( rear ); + m.GetLoadout().AddToQueue(neweq); + m.GetLoadout().RemoveFromQueue(neweq); + m.GetLoadout().AddTo(m.GetLoadout().GetCrits(i), neweq, S1Index, S1Num); + m.GetLoadout().AddTo(m.GetLoadout().GetCrits(S2Loc), neweq, S2Index, S2Num); + if (rear) { + neweq.MountRear(rear); } // Clear out the old slots in the retarded criticals array - for( int k = S1Index; k < S1Index + S1Num; k++ ) { + for (int k = S1Index; k < S1Index + S1Num; k++) { Criticals[i][k] = 0x00; } - for( int k = S2Index; k < S2Index + S2Num; k++ ) { + for (int k = S2Index; k < S2Index + S2Num; k++) { Criticals[S2Loc][k] = 0x00; } } @@ -1138,32 +1192,36 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws } else { // easier. int size = neweq.NumCrits(); - if( m.UsingArtemisIV() && neweq instanceof RangedWeapon ) { - if( m.UsingArtemisIV() ) { ((RangedWeapon) neweq).UseFCS( true, ifMissileGuidance.FCS_ArtemisIV ); } + if (m.UsingArtemisIV() && neweq instanceof RangedWeapon) { + if (m.UsingArtemisIV()) { + ((RangedWeapon) neweq).UseFCS(true, ifMissileGuidance.FCS_ArtemisIV); + } } - m.GetLoadout().AddToQueue( neweq ); - m.GetLoadout().AddTo( neweq, i, j ); - if( rear ) { - neweq.MountRear( rear ); + m.GetLoadout().AddToQueue(neweq); + m.GetLoadout().AddTo(neweq, i, j); + if (rear) { + neweq.MountRear(rear); } Criticals[i][j] = 0x00; - if( size > 1 ) { + if (size > 1) { // we'll need to clear out the rest of the // criticals so we don't "find" this again - for( int k = 1; k < size; k++ ) { + for (int k = 1; k < size; k++) { Criticals[i][j + k] = 0x00; } } } } else { - Errors.add( new ErrorReport( lookup, Name ) ); + Errors.add(new ErrorReport(lookup, Name)); } } else { - String name = Unused.get( lookup ); - if( name == null ) { - Errors.add( new ErrorReport( "The equipment specified by HMP_REF: " + lookup + " could not be found.\nSkipping that item." ) ); + String name = Unused.get(lookup); + if (name == null) { + Errors.add(new ErrorReport("The equipment specified by HMP_REF: " + lookup + + " could not be found.\nSkipping that item.")); } else { - Errors.add( new ErrorReport( name + "\nis unused by SSW or is not a valid piece of equipment.\nSkipping that item." ) ); + Errors.add(new ErrorReport(name + + "\nis unused by SSW or is not a valid piece of equipment.\nSkipping that item.")); } } } @@ -1171,11 +1229,13 @@ public Mech GetMech( String filename, boolean SuppressOmniNotification ) throws } // do we have a targeting computer - if( HasTC ) { + if (HasTC) { boolean TCTB = false; - if( TCTechBase == AvailableCode.TECH_CLAN ) { TCTB = true; } - m.GetLoadout().UseTC( true, TCTB ); - m.GetLoadout().AddTo( m.GetLoadout().GetTC(), TCLoc, TCIdx ); + if (TCTechBase == AvailableCode.TECH_CLAN) { + TCTB = true; + } + m.GetLoadout().UseTC(true, TCTB); + m.GetLoadout().AddTo(m.GetLoadout().GetTC(), TCLoc, TCIdx); } return m; @@ -1185,13 +1245,13 @@ private void BuildHash() { Unused.put(Long.valueOf(0x25), "IS2 Compact Heat Sinks"); // cockpit -// BFB.Common.put(Long.valueOf(0x0C), "Life Support"); -// BFB.Common.put(Long.valueOf(0x0D), "Sensors"); -// BFB.Common.put(Long.valueOf(0x0E), "Cockpit"); + // BFB.Common.put(Long.valueOf(0x0C), "Life Support"); + // BFB.Common.put(Long.valueOf(0x0D), "Sensors"); + // BFB.Common.put(Long.valueOf(0x0E), "Cockpit"); // targeting computers and FCS -// BFB.Common.put(Long.valueOf(0x12), "Targeting Computer"); -// BFB.Common.put(Long.valueOf(0x18), "Artemis IV"); + // BFB.Common.put(Long.valueOf(0x12), "Targeting Computer"); + // BFB.Common.put(Long.valueOf(0x18), "Artemis IV"); // specialty equipment Common.put(Long.valueOf(0x20), "Supercharger"); @@ -1268,9 +1328,11 @@ private void BuildHash() { Sphere.put(Long.valueOf(0x49), "(IS) Medium X-Pulse Laser"); Sphere.put(Long.valueOf(0x4A), "(IS) Small X-Pulse Laser"); Sphere.put(Long.valueOf(0x52), "Heavy Flamer"); - //Sphere.put(Long.valueOf(0x53), "ISPPCCapacitor"); // HMP uses this code for ERPPC + // Sphere.put(Long.valueOf(0x53), "ISPPCCapacitor"); // HMP uses this code for + // ERPPC Sphere.put(Long.valueOf(0x58), "(CL) ER Micro Laser"); - //Sphere.put(Long.valueOf(0x59), "ISPPCCapacitor"); // HMP uses this code for standard PPC + // Sphere.put(Long.valueOf(0x59), "ISPPCCapacitor"); // HMP uses this code for + // standard PPC Sphere.put(Long.valueOf(0x5A), "(IS) ER Medium Laser"); Sphere.put(Long.valueOf(0x5B), "(IS) ER Small Laser"); Sphere.put(Long.valueOf(0x85), "Vehicle Flamer"); @@ -1315,9 +1377,10 @@ private void BuildHash() { Clan.put(Long.valueOf(0x98), "(IS) Large X-Pulse Laser"); Clan.put(Long.valueOf(0x99), "(IS) Medium X-Pulse Laser"); Clan.put(Long.valueOf(0x9A), "(IS) Small X-Pulse Laser"); - //Clan.put(Long.valueOf(0xA3), "ISPPCCapacitor"); // HMP uses this code for ERPPC + // Clan.put(Long.valueOf(0xA3), "ISPPCCapacitor"); // HMP uses this code for + // ERPPC Clan.put(Long.valueOf(0xA8), "(CL) Micro Pulse Laser"); - //Clan.put(Long.valueOf(0xA9), "ISPPCCapacitor"); // HMP uses this code for PPC + // Clan.put(Long.valueOf(0xA9), "ISPPCCapacitor"); // HMP uses this code for PPC Clan.put(Long.valueOf(0xAA), "(IS) ER Medium Laser"); Clan.put(Long.valueOf(0xAB), "(IS) ER Small Laser"); Clan.put(Long.valueOf(0xD5), "Vehicle Flamer"); @@ -1628,9 +1691,9 @@ private void BuildHash() { Common.put(Long.valueOf(0x2b5), "(CL) @ Rotary AC/5"); // special for ammo mutator // 28c-28f = atm - //BFB.Common.put(Long.valueOf(0x100000298L), "ISLBXAC2 Ammo (THB)"); - //BFB.Common.put(Long.valueOf(0x100000299L), "ISLBXAC5 Ammo (THB)"); - //BFB.Common.put(Long.valueOf(0x10000029AL), "ISLBXAC20 Ammo (THB)"); + // BFB.Common.put(Long.valueOf(0x100000298L), "ISLBXAC2 Ammo (THB)"); + // BFB.Common.put(Long.valueOf(0x100000299L), "ISLBXAC5 Ammo (THB)"); + // BFB.Common.put(Long.valueOf(0x10000029AL), "ISLBXAC20 Ammo (THB)"); Sphere.put(Long.valueOf(0x01CE), "(IS) @ AC/2"); Sphere.put(Long.valueOf(0x01CF), "(IS) @ AC/5"); Sphere.put(Long.valueOf(0x01D0), "(IS) @ AC/10"); @@ -1948,8 +2011,8 @@ private void BuildHash() { Unused.put(Long.valueOf(0x127), "CLRotaryAC20"); } - private int DecodeRulesLevel( int OldRules ) { - switch( OldRules ) { + private int DecodeRulesLevel(int OldRules) { + switch (OldRules) { case 1: return AvailableCode.RULES_INTRODUCTORY; case 2: @@ -1992,20 +2055,20 @@ private long readUnsignedInt(DataInputStream dis) throws Exception { return b1 + b2 + b3 + b4; } - private boolean IsRearMounted( long critical ) { - return ( critical & 0xFFFF0000 ) != 0; + private boolean IsRearMounted(long critical) { + return (critical & 0xFFFF0000) != 0; } - private Long GetLookupNum( long l ) { + private Long GetLookupNum(long l) { // According to HMPFile.java, this will return the actual lookup number. // the first two bytes of the critical location number are the type. - Long retval = Long.valueOf( l & 0xFFFF ); + Long retval = Long.valueOf(l & 0xFFFF); return retval; } - private String BuildLookupName( String name, int mechbase, int techbase ) { - if( mechbase == AvailableCode.TECH_BOTH ) { - if( techbase == 0 ) { + private String BuildLookupName(String name, int mechbase, int techbase) { + if (mechbase == AvailableCode.TECH_BOTH) { + if (techbase == 0) { return "(IS) " + name; } else { return "(CL) " + name; @@ -2020,18 +2083,18 @@ private class ErrorReport { private String CustomError = null; private boolean HasCustom = false; - public ErrorReport( Long num, String name ) { + public ErrorReport(Long num, String name) { HMPNumber = num; EQName = name; } - public ErrorReport( String custom ) { + public ErrorReport(String custom) { CustomError = custom; HasCustom = true; } public String GetErrorReport() { - if( HasCustom ) { + if (HasCustom) { return CustomError; } else { return "The following item could not be loaded:\nHMP_REF: " + HMPNumber + ", NAME: " + EQName; From d8df7657a696f0d4862125c75db87c87dcfb821c Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 10:24:40 -0600 Subject: [PATCH 073/126] ssw/gui/dlgBatchHMP.java - Added Serial Version - Commented out variable not being used - VS Code Formatting --- ssw/src/main/java/ssw/gui/dlgBatchHMP.java | 149 +++++++++++---------- 1 file changed, 79 insertions(+), 70 deletions(-) diff --git a/ssw/src/main/java/ssw/gui/dlgBatchHMP.java b/ssw/src/main/java/ssw/gui/dlgBatchHMP.java index 79b09743..ce8a02e1 100644 --- a/ssw/src/main/java/ssw/gui/dlgBatchHMP.java +++ b/ssw/src/main/java/ssw/gui/dlgBatchHMP.java @@ -40,28 +40,34 @@ public class dlgBatchHMP extends javax.swing.JDialog implements PropertyChangeListener { + /** + * + */ + private static final long serialVersionUID = 7759558535085918814L; + /** Creates new form dlgTextExport */ - public dlgBatchHMP(java.awt.Frame parent, boolean modal ) { + public dlgBatchHMP(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); - setTitle( "Import Multiple HMP Files" ); + setTitle("Import Multiple HMP Files"); } - public void propertyChange( PropertyChangeEvent e ) { - prgImporting.setValue( ((Importer) e.getSource()).getProgress() ); + public void propertyChange(PropertyChangeEvent e) { + prgImporting.setValue(((Importer) e.getSource()).getProgress()); } - private class Importer extends SwingWorker { - dlgBatchHMP Owner; - public Importer( dlgBatchHMP owner ) { - Owner = owner; + private class Importer extends SwingWorker { + // dlgBatchHMP Owner; // Not Used + + public Importer(dlgBatchHMP owner) { + // Owner = owner; // Only assigned but never used. } @Override public void done() { - setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) ); - Media.Messager( "Finished! Check the log for errors." ); - prgImporting.setValue( 0 ); + setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + Media.Messager("Finished! Check the log for errors."); + prgImporting.setValue(0); } @Override @@ -73,70 +79,71 @@ protected Void doInBackground() throws Exception { Vector files = new Vector(); // load up the list of files - File d = new File( txtSource.getText() ); - if ( d.isDirectory() ) { - if( d.listFiles() == null ) { - throw new Exception( "There are no files in the source directory.\nCannot continue." ); + File d = new File(txtSource.getText()); + if (d.isDirectory()) { + if (d.listFiles() == null) { + throw new Exception("There are no files in the source directory.\nCannot continue."); } - for ( File f : d.listFiles() ) { - if ( f.isFile() && f.getPath().endsWith(".hmp") ) { - files.add( f ); + for (File f : d.listFiles()) { + if (f.isFile() && f.getPath().endsWith(".hmp")) { + files.add(f); } } } else { - throw new Exception( "The source is not a directory.\nCannot continue." ); + throw new Exception("The source is not a directory.\nCannot continue."); } - if( files.size() < 1 ) { - throw new Exception( "No HMP files found in the source directory.\nCannot continue." ); + if (files.size() < 1) { + throw new Exception("No HMP files found in the source directory.\nCannot continue."); } - for( int i = 0; i < files.size(); i++ ) { - File f = files.get( i ); - String basename = f.getName().replace( ".hmp", "" ); + for (int i = 0; i < files.size(); i++) { + File f = files.get(i); + String basename = f.getName().replace(".hmp", ""); try { // import the new 'Mech - Mech m = HMPr.GetMech( f.getCanonicalPath(), true ); + Mech m = HMPr.GetMech(f.getCanonicalPath(), true); MsgTemp = HMPr.GetErrors(); // save it off to SSW format - XMLw.setMech( m ); - XMLw.WriteXML( txtDestination.getText() + File.separator + basename + ".ssw" ); - } catch( Exception e ) { - // had a problem loading the mech. let the user know. - if( e.getMessage() == null ) { + XMLw.setMech(m); + XMLw.WriteXML(txtDestination.getText() + File.separator + basename + ".ssw"); + } catch (Exception e) { + // had a problem loading the mech. let the user know. + if (e.getMessage() == null) { Messages += "An unknown error has occured.\n" + f.getName() + " is not loadable.\n\n"; } else { Messages += e.getMessage() + "\n" + f.getName() + "\n\n"; } } - if( MsgTemp.length() > 0 ) { + if (MsgTemp.length() > 0) { Messages += MsgTemp + "\n" + f.getName() + "\n\n"; } - if( Messages.length() != LastMsgLength ) { + if (Messages.length() != LastMsgLength) { LastMsgLength = Messages.length(); - txtMessages.setText( Messages ); - txtMessages.setCaretPosition( 0 ); + txtMessages.setText(Messages); + txtMessages.setCaretPosition(0); } - int progress = ((int) (( ((double) i + 1) / (double) files.size() ) * 100.0 ) ); - setProgress( progress ); + int progress = ((int) ((((double) i + 1) / (double) files.size()) * 100.0)); + setProgress(progress); } return null; } } - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents + + // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; @@ -270,48 +277,50 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pack(); }// //GEN-END:initComponents -private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed - dispose(); -}//GEN-LAST:event_btnCloseActionPerformed + private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCloseActionPerformed + dispose(); + }// GEN-LAST:event_btnCloseActionPerformed -private void btnSourceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSourceActionPerformed - Media media = new Media(); - String dirPath = media.GetDirectorySelection( this ); - txtSource.setText( dirPath ); -}//GEN-LAST:event_btnSourceActionPerformed + private void btnSourceActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnSourceActionPerformed + Media media = new Media(); + String dirPath = media.GetDirectorySelection(this); + txtSource.setText(dirPath); + }// GEN-LAST:event_btnSourceActionPerformed -private void btnDestinationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDestinationActionPerformed - Media media = new Media(); - String dirPath = media.GetDirectorySelection( this ); - txtDestination.setText( dirPath ); -}//GEN-LAST:event_btnDestinationActionPerformed + private void btnDestinationActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnDestinationActionPerformed + Media media = new Media(); + String dirPath = media.GetDirectorySelection(this); + txtDestination.setText(dirPath); + }// GEN-LAST:event_btnDestinationActionPerformed -private void btnImportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImportActionPerformed + private void btnImportActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnImportActionPerformed prgImporting.setValue(0); - if( txtSource.getText().length() < 1 ) { - Media.Messager( this, "The Source directory is empty.\nPlease choose a Source directory." ); + if (txtSource.getText().length() < 1) { + Media.Messager(this, "The Source directory is empty.\nPlease choose a Source directory."); return; } - if( txtDestination.getText().length() < 1 ) { - Media.Messager( this, "The Destination directory is empty.\nPlease choose a Destination directory." ); + if (txtDestination.getText().length() < 1) { + Media.Messager(this, "The Destination directory is empty.\nPlease choose a Destination directory."); return; } - int Response = javax.swing.JOptionPane.showConfirmDialog( this, "This will import each HMP file in the Source directory\nand save it to an SSW file in the Destination directory.\nThis process could take a few minutes, are you ready?", "Batch HMP Import", javax.swing.JOptionPane.YES_NO_OPTION ); - if( Response == javax.swing.JOptionPane.YES_OPTION ) { - setCursor( Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR ) ); + int Response = javax.swing.JOptionPane.showConfirmDialog(this, + "This will import each HMP file in the Source directory\nand save it to an SSW file in the Destination directory.\nThis process could take a few minutes, are you ready?", + "Batch HMP Import", javax.swing.JOptionPane.YES_NO_OPTION); + if (Response == javax.swing.JOptionPane.YES_OPTION) { + setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { - Importer Import = new Importer( this ); - Import.addPropertyChangeListener( this ); + Importer Import = new Importer(this); + Import.addPropertyChangeListener(this); Import.execute(); - } catch( Exception e ) { - // fatal error. let the user know - Media.Messager( this, "A fatal error occured while processing the 'Mechs:\n" + e.getMessage() ); + } catch (Exception e) { + // fatal error. let the user know + Media.Messager(this, "A fatal error occured while processing the 'Mechs:\n" + e.getMessage()); e.printStackTrace(); } - setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) ); + setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); prgImporting.setValue(0); } -}//GEN-LAST:event_btnImportActionPerformed + }// GEN-LAST:event_btnImportActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnClose; From 82cbd7bef4ecb9b53d6aaf5d53b0c22d13c041b0 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 10:35:31 -0600 Subject: [PATCH 074/126] ssw/gui - dlgBracketCharts.java - Added serialization IDs - Strict typing of template variables - VS Code Styling --- .../main/java/ssw/gui/dlgBracketCharts.java | 272 ++++++++++-------- 1 file changed, 151 insertions(+), 121 deletions(-) diff --git a/ssw/src/main/java/ssw/gui/dlgBracketCharts.java b/ssw/src/main/java/ssw/gui/dlgBracketCharts.java index ea8f3cfa..4f9a59c4 100644 --- a/ssw/src/main/java/ssw/gui/dlgBracketCharts.java +++ b/ssw/src/main/java/ssw/gui/dlgBracketCharts.java @@ -32,17 +32,22 @@ import javax.swing.table.DefaultTableCellRenderer; import components.Ammunition; import components.Mech; +import components.abPlaceable; import components.ifWeapon; import common.CommonTools; public class dlgBracketCharts extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -5822861093556971031L; private Mech CurMech; private String[][] data; /** Creates new form dlgBracketCharts */ - public dlgBracketCharts( java.awt.Frame parent, boolean modal, Mech m ) { - super( parent, modal ); + public dlgBracketCharts(java.awt.Frame parent, boolean modal, Mech m) { + super(parent, modal); CurMech = m; GetWeaponData(); initComponents(); @@ -50,150 +55,168 @@ public dlgBracketCharts( java.awt.Frame parent, boolean modal, Mech m ) { } private void GetWeaponData() { - ArrayList v = CurMech.GetLoadout().GetNonCore(); + ArrayList v = CurMech.GetLoadout().GetNonCore(); ArrayList wep = new ArrayList(); ArrayList ammo = new ArrayList(); ArrayList temp = new ArrayList(); int cols = 0; - for( int i = 0; i < v.size(); i++ ) { - if( v.get( i ) instanceof ifWeapon ) { - ifWeapon w = (ifWeapon) v.get( i ); + for (int i = 0; i < v.size(); i++) { + if (v.get(i) instanceof ifWeapon) { + ifWeapon w = (ifWeapon) v.get(i); // do we already have a weapon of this name in the ArrayList? boolean add = true; - for( int x = 0; x < wep.size(); x++ ) { - if( wep.get( x ).LookupName().equals( w.LookupName() ) ) { + for (int x = 0; x < wep.size(); x++) { + if (wep.get(x).LookupName().equals(w.LookupName())) { add = false; } } - if( add ) { - wep.add( w ); - if( w.GetRangeLong() > cols ) { cols = w.GetRangeLong(); } + if (add) { + wep.add(w); + if (w.GetRangeLong() > cols) { + cols = w.GetRangeLong(); + } } - } else if( v.get( i ) instanceof Ammunition ) { - Ammunition a = (Ammunition) v.get( i ); + } else if (v.get(i) instanceof Ammunition) { + Ammunition a = (Ammunition) v.get(i); // do we already have an ammo of this name in the ArrayList? boolean add = true; - for( int x = 0; x < ammo.size(); x++ ) { - if( ammo.get( x ).LookupName().equals( a.LookupName() ) ) { + for (int x = 0; x < ammo.size(); x++) { + if (ammo.get(x).LookupName().equals(a.LookupName())) { add = false; } } - if( add ) { - ammo.add( a ); - if( a.GetLongRange() > cols ) { cols = a.GetLongRange(); } + if (add) { + ammo.add(a); + if (a.GetLongRange() > cols) { + cols = a.GetLongRange(); + } } } } // construct the data ArrayList - for( int i = 0; i < wep.size(); i++ ) { - ifWeapon w = wep.get( i ); - if( w.HasAmmo() ) { + for (int i = 0; i < wep.size(); i++) { + ifWeapon w = wep.get(i); + if (w.HasAmmo()) { boolean added = false; // search for other ammunition for this weapon. - for( int x = ammo.size() - 1; x >= 0; x-- ) { - Ammunition a = ammo.get( x ); - if( w.GetAmmoIndex() == a.GetAmmoIndex() ) { - temp.add( new WeaponInfo( w, a ) ); - ammo.remove( a ); + for (int x = ammo.size() - 1; x >= 0; x--) { + Ammunition a = ammo.get(x); + if (w.GetAmmoIndex() == a.GetAmmoIndex()) { + temp.add(new WeaponInfo(w, a)); + ammo.remove(a); added = true; } } - if( ! added ) { + if (!added) { // add the weapon in by itself - temp.add( new WeaponInfo( w ) ); + temp.add(new WeaponInfo(w)); } } else { - temp.add( new WeaponInfo( w ) ); + temp.add(new WeaponInfo(w)); } } // sort the weapon info by range - SortWeapons( temp ); + SortWeapons(temp); // turn the temporary ArrayList into an array cols += 1; - data = new String[temp.size()*2][cols]; - for( int i = 0; i < temp.size(); i++ ) { - WeaponInfo w = temp.get( i ); - for( int x = 0; x < cols; x++ ) { - if( x == 0 ) { - data[i*2][x] = w.GetName(); - data[i*2+1][x] = ""; + data = new String[temp.size() * 2][cols]; + for (int i = 0; i < temp.size(); i++) { + WeaponInfo w = temp.get(i); + for (int x = 0; x < cols; x++) { + if (x == 0) { + data[i * 2][x] = w.GetName(); + data[i * 2 + 1][x] = ""; } else { - int tohit = w.GetToHit( x ); - if( CurMech.UsingTC() ) { - if( tohit != 12 && w.CanUseTC() ) { tohit -= 1; } + int tohit = w.GetToHit(x); + if (CurMech.UsingTC()) { + if (tohit != 12 && w.CanUseTC()) { + tohit -= 1; + } } - if( tohit >= 0 ) { - data[i*2][x] = "+" + tohit; + if (tohit >= 0) { + data[i * 2][x] = "+" + tohit; } else { - data[i*2][x] = "" + tohit; + data[i * 2][x] = "" + tohit; } - data[i*2+1][x] = "" + w.GetDamage( x ); + data[i * 2 + 1][x] = "" + w.GetDamage(x); } } } } private void ResetTable() { - tblBrackets.setDefaultRenderer( Object.class, new BracketRenderer() ); - tblBrackets.setModel( new javax.swing.table.AbstractTableModel() { + tblBrackets.setDefaultRenderer(Object.class, new BracketRenderer()); + tblBrackets.setModel(new javax.swing.table.AbstractTableModel() { + /** + * + */ + private static final long serialVersionUID = 1L; + @Override - public String getColumnName( int col ) { - if( col == 0 ) { + public String getColumnName(int col) { + if (col == 0) { return "Weapon Name"; } else { return "" + col; } } - public int getRowCount() { return data.length; } - public int getColumnCount() { return data[0].length; } - public Object getValueAt( int row, int col ) { - if( row % 2 == 1 ) { + + public int getRowCount() { + return data.length; + } + + public int getColumnCount() { + return data[0].length; + } + + public Object getValueAt(int row, int col) { + if (row % 2 == 1) { // damage - if( data[row][col].equals( "0" ) ) { + if (data[row][col].equals("0")) { return "-"; } else { return data[row][col]; } } else { // to-hits - if( data[row][col].equals( "+12" ) ) { + if (data[row][col].equals("+12")) { return "-"; } else { return data[row][col]; } } } - } ); - for( int i = 1; i < tblBrackets.getColumnCount(); i++ ) { - tblBrackets.getColumnModel().getColumn( i ).setPreferredWidth( 35 ); - tblBrackets.getColumnModel().getColumn( i ).setMinWidth( 35 ); - tblBrackets.getColumnModel().getColumn( i ).setMaxWidth( 35 ); + }); + for (int i = 1; i < tblBrackets.getColumnCount(); i++) { + tblBrackets.getColumnModel().getColumn(i).setPreferredWidth(35); + tblBrackets.getColumnModel().getColumn(i).setMinWidth(35); + tblBrackets.getColumnModel().getColumn(i).setMaxWidth(35); } - tblBrackets.getColumnModel().getColumn( 0 ).setCellRenderer( new DefaultTableCellRenderer() ); - tblBrackets.getColumnModel().getColumn( 0 ).setMinWidth( 125 ); + tblBrackets.getColumnModel().getColumn(0).setCellRenderer(new DefaultTableCellRenderer()); + tblBrackets.getColumnModel().getColumn(0).setMinWidth(125); } - private void SortWeapons( ArrayList v ) { - // sort by longest range (using gnomesort for less code. may have to change - // this depending on the slowness of the program. I figure lower overhead + private void SortWeapons(ArrayList v) { + // sort by longest range (using gnomesort for less code. may have to change + // this depending on the slowness of the program. I figure lower overhead // will have better results at this time, and mechs typically don't - // carry more than twelve to fifteen weapons. I'll have to test this. + // carry more than twelve to fifteen weapons. I'll have to test this. int i = 1, j = 2; WeaponInfo swap; - while( i < v.size() ) { + while (i < v.size()) { // get the two items we'll be comparing - if( v.get( i - 1 ).GetLongRange() >= v.get( i ).GetLongRange() ) { + if (v.get(i - 1).GetLongRange() >= v.get(i).GetLongRange()) { i = j; j += 1; } else { - swap = v.get( i - 1 ); - v.set( i - 1, v.get( i ) ); - v.set( i, swap ); + swap = v.get(i - 1); + v.set(i - 1, v.get(i)); + v.set(i, swap); i -= 1; - if( i == 0 ) { + if (i == 0) { i = 1; } } @@ -201,6 +224,11 @@ private void SortWeapons( ArrayList v ) { } private class BracketRenderer extends DefaultTableCellRenderer { + /** + * + */ + private static final long serialVersionUID = -86997043469401101L; + @Override public int getHorizontalAlignment() { return javax.swing.SwingConstants.CENTER; @@ -216,35 +244,47 @@ private class WeaponInfo { private ifWeapon wep; private Ammunition ammo; - public WeaponInfo( ifWeapon w ) { wep = w; } - public WeaponInfo( ifWeapon w, Ammunition a ) { wep = w; ammo = a; } + public WeaponInfo(ifWeapon w) { + wep = w; + } + + public WeaponInfo(ifWeapon w, Ammunition a) { + wep = w; + ammo = a; + } public String GetName() { - if( HasAmmo() ) { return ammo.CritName().replace( "@", "" ); } + if (HasAmmo()) { + return ammo.CritName().replace("@", ""); + } return wep.CritName(); } public boolean HasAmmo() { - if( ammo == null ) { return false; } + if (ammo == null) { + return false; + } return true; } - public int GetToHit( int range ) { - if( HasAmmo() ) { - return CommonTools.GetToHitAtRange( ammo, range ); + public int GetToHit(int range) { + if (HasAmmo()) { + return CommonTools.GetToHitAtRange(ammo, range); } - return CommonTools.GetToHitAtRange( wep, range ); + return CommonTools.GetToHitAtRange(wep, range); } - public int GetDamage( int range ) { - if( HasAmmo() ) { - return CommonTools.GetAverageDamageAtRange( wep, ammo, range ); + public int GetDamage(int range) { + if (HasAmmo()) { + return CommonTools.GetAverageDamageAtRange(wep, ammo, range); } - return CommonTools.GetAverageDamageAtRange( wep, range ); + return CommonTools.GetAverageDamageAtRange(wep, range); } public int GetLongRange() { - if( HasAmmo() ) { return ammo.GetLongRange(); } + if (HasAmmo()) { + return ammo.GetLongRange(); + } return wep.GetRangeLong(); } @@ -253,13 +293,13 @@ public boolean CanUseTC() { } } - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents + // //GEN-BEGIN:initComponents private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); @@ -271,17 +311,11 @@ private void initComponents() { jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - tblBrackets.setModel(new javax.swing.table.DefaultTableModel( - new Object [][] { - {null, null, null, null}, - {null, null, null, null}, - {null, null, null, null}, - {null, null, null, null} - }, - new String [] { - "Title 1", "Title 2", "Title 3", "Title 4" - } - )); + tblBrackets + .setModel(new javax.swing.table.DefaultTableModel( + new Object[][] { { null, null, null, null }, { null, null, null, null }, + { null, null, null, null }, { null, null, null, null } }, + new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); tblBrackets.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); tblBrackets.setAutoscrolls(false); jScrollPane1.setViewportView(tblBrackets); @@ -295,31 +329,27 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 722, Short.MAX_VALUE) - .addComponent(btnClose)) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap() - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnClose) - .addContainerGap()) - ); + layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( + javax.swing.GroupLayout.Alignment.TRAILING, + layout.createSequentialGroup().addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, + javax.swing.GroupLayout.DEFAULT_SIZE, 722, Short.MAX_VALUE) + .addComponent(btnClose)) + .addContainerGap())); + layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( + javax.swing.GroupLayout.Alignment.TRAILING, + layout.createSequentialGroup().addContainerGap() + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(btnClose) + .addContainerGap())); pack(); }// //GEN-END:initComponents - private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed + private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCloseActionPerformed dispose(); - }//GEN-LAST:event_btnCloseActionPerformed + }// GEN-LAST:event_btnCloseActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnClose; From 9477df3cfbaef2d4919003eac9a07714afc3ed74 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 10:58:30 -0600 Subject: [PATCH 075/126] Mass Update - serialVersionUID Added --- BFB/src/main/java/BFB/GUI/frmBase.java | 32 ++- saw/src/main/java/saw/gui/dlgPrefs.java | 4 + saw/src/main/java/saw/gui/frmVee.java | 223 +++++++++++------- saw/src/main/java/saw/gui/frmVeeWide.java | 175 +++++++++----- .../java/ssw/gui/EquipmentListRenderer.java | 4 + .../ssw/gui/EquipmentSelectedRenderer.java | 6 +- ssw/src/main/java/ssw/gui/ImagePreview.java | 4 + .../java/ssw/gui/LocationDragDatagram.java | 4 + .../java/ssw/gui/MechLoadoutRenderer.java | 4 + ssw/src/main/java/ssw/gui/NumberRenderer.java | 5 + ssw/src/main/java/ssw/gui/dlgCCGMech.java | 5 +- .../main/java/ssw/gui/dlgCostBVBreakdown.java | 4 + ssw/src/main/java/ssw/gui/dlgCredits.java | 13 +- ssw/src/main/java/ssw/gui/dlgLicense.java | 7 +- ssw/src/main/java/ssw/gui/dlgOmniBase.java | 8 +- ssw/src/main/java/ssw/gui/dlgOpen.java | 18 +- .../main/java/ssw/gui/dlgPlaceableInfo.java | 4 + .../main/java/ssw/gui/dlgPrintBatchMechs.java | 7 +- .../java/ssw/gui/dlgPrintBattleforce.java | 4 + .../main/java/ssw/gui/dlgPrintOptions.java | 12 +- .../ssw/gui/dlgPrintSavedMechOptions.java | 6 +- ssw/src/main/java/ssw/gui/dlgQuirks.java | 8 +- ssw/src/main/java/ssw/gui/dlgSSWFiles.java | 4 + .../java/ssw/gui/dlgSelectiveAllocate.java | 42 ++-- ssw/src/main/java/ssw/gui/dlgSplitCrits.java | 8 +- ssw/src/main/java/ssw/gui/dlgSummaryInfo.java | 8 +- .../main/java/ssw/gui/dlgTechBaseChooser.java | 4 + ssw/src/main/java/ssw/gui/dlgTextExport.java | 5 + .../main/java/ssw/gui/dlgVariableSize.java | 4 + ssw/src/main/java/ssw/gui/dlgWeaponInfo.java | 8 +- ssw/src/main/java/ssw/gui/frmCompat.java | 5 + ssw/src/main/java/ssw/gui/frmMain.java | 46 ++-- ssw/src/main/java/ssw/gui/frmMainWide.java | 33 ++- .../java/ssw/gui/thCLTransferHandler.java | 4 + .../java/ssw/gui/thCTTransferHandler.java | 4 + .../java/ssw/gui/thHDTransferHandler.java | 4 + .../java/ssw/gui/thLATransferHandler.java | 4 + .../java/ssw/gui/thLLTransferHandler.java | 4 + .../java/ssw/gui/thLTTransferHandler.java | 4 + .../java/ssw/gui/thQueueTransferHandler.java | 7 +- .../java/ssw/gui/thRATransferHandler.java | 4 + .../java/ssw/gui/thRLTransferHandler.java | 4 + .../java/ssw/gui/thRTTransferHandler.java | 4 + .../java/ssw/printpreview/BrowseAction.java | 11 +- .../main/java/ssw/printpreview/Preview.java | 22 +- .../java/ssw/printpreview/PreviewDialog.java | 40 ++-- .../java/ssw/printpreview/ZoomAction.java | 11 +- .../java/ssw/printpreview/dlgBFPreview.java | 4 + .../java/ssw/printpreview/dlgPreview.java | 6 +- sswlib/src/main/java/Force/Force.java | 8 +- sswlib/src/main/java/Force/View/abTable.java | 4 + .../main/java/Force/View/tbBattleForce.java | 5 + .../src/main/java/Force/View/tbChatInfo.java | 5 + .../src/main/java/Force/View/tbFactors.java | 5 + .../main/java/Force/View/tbTotalWarfare.java | 7 +- .../java/Force/View/tbTotalWarfareSmall.java | 5 + sswlib/src/main/java/Force/Warchest.java | 22 +- sswlib/src/main/java/Force/Warriors.java | 6 +- .../main/java/Print/preview/BrowseAction.java | 7 +- .../src/main/java/Print/preview/Preview.java | 22 +- .../java/Print/preview/PreviewDialog.java | 40 ++-- .../main/java/Print/preview/ZoomAction.java | 7 +- .../main/java/Print/preview/dlgPreview.java | 26 +- sswlib/src/main/java/common/ImagePreview.java | 4 + .../main/java/dialog/AmmoChooserRenderer.java | 4 + .../src/main/java/dialog/dlgAmmoChooser.java | 14 +- sswlib/src/main/java/dialog/dlgImageMgr.java | 10 +- .../src/main/java/dialog/dlgManeiDomini.java | 19 +- sswlib/src/main/java/dialog/dlgPrint.java | 8 +- sswlib/src/main/java/dialog/dlgUnit.java | 18 +- sswlib/src/main/java/dialog/frmForce.java | 8 +- sswlib/src/main/java/gui/HTMLPane.java | 36 ++- sswlib/src/main/java/gui/TextPane.java | 4 + .../main/java/list/view/NumberRenderer.java | 5 + sswlib/src/main/java/list/view/abView.java | 6 +- .../java/list/view/tbBattleForceView.java | 9 +- .../java/list/view/tbChatInformation.java | 7 +- sswlib/src/main/java/list/view/tbQuirks.java | 4 + .../java/list/view/tbTotalWarfareCompact.java | 7 +- .../java/list/view/tbTotalWarfareView.java | 7 +- 80 files changed, 854 insertions(+), 346 deletions(-) diff --git a/BFB/src/main/java/BFB/GUI/frmBase.java b/BFB/src/main/java/BFB/GUI/frmBase.java index 5d70b20c..3c1faa8f 100644 --- a/BFB/src/main/java/BFB/GUI/frmBase.java +++ b/BFB/src/main/java/BFB/GUI/frmBase.java @@ -76,13 +76,17 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import list.view.*; public class frmBase extends javax.swing.JFrame implements java.awt.datatransfer.ClipboardOwner { + /** + * + */ + private static final long serialVersionUID = -2205387839854272044L; public Scenario scenario = new Scenario(); public Preferences Prefs; private dlgOpen dOpen; private Media media = new Media(); private ImageTracker images = new ImageTracker(); private Force addToForce = new Force(); - + private UnitList list = new UnitList(), filtered, chosen = new UnitList(); private abView currentView = new tbTotalWarfareView(list); private String MechListPath = "", BaseRUSPath = "./Data/Tables/", RUSDirectory = "", RUSPath = BaseRUSPath, CurrentFile = ""; @@ -124,7 +128,7 @@ public frmBase() { initComponents(); Prefs = Preferences.userRoot().node( Constants.BFBPrefs ); MechListPath = Prefs.get("ListPath", ""); - + popUtilities.add(popGroup); popUtilities.add(popSkill); popUtilities.add(popName); @@ -149,7 +153,7 @@ public frmBase() { edtSpecialRules.addKeyListener(KeyTyped); edtVictoryConditions.addKeyListener(KeyTyped); edtAftermath.addKeyListener(KeyTyped); - + Refresh(); lblStatusUpdate.setText(""); LoadRUSOptions(); @@ -174,7 +178,7 @@ public void Refresh() { } else { btnISTop.setSelected(true); } - + if ( scenario.getDefenderForce().getType().equals(BattleForce.Comstar) ) { btnCSBottom.setSelected(true); } else if ( scenario.getDefenderForce().getType().equals(BattleForce.Clan) ) { @@ -184,7 +188,7 @@ public void Refresh() { } lblForceMod.setText( String.format( "%1$,.2f", CommonTools.GetForceSizeMultiplier( scenario.getAttackerForce().getUnits().size(), scenario.getDefenderForce().getUnits().size() )) ); - + updateFields(); } @@ -317,7 +321,7 @@ private void updateFields() { private void loadScenario( String filename ) { if ( filename.isEmpty() ) { return; } - + BFBReader reader = new BFBReader(); //Force[] forces; try { @@ -2668,6 +2672,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { ); jList1.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = -8856346254604751858L; String[] strings = { "Light", "Medium", "Heavy", "Assault" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -3429,7 +3437,7 @@ private void mnuLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST System.out.println(e.getMessage()); return; } - + DefaultCursor(); } }//GEN-LAST:event_mnuLoadActionPerformed @@ -3537,7 +3545,7 @@ private void mnuSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST XMLWriter writer = new XMLWriter(); writer.WriteScenario(scenario, filename); - + Prefs.put("LastOpenBFBFile", filename); //Prefs.put("CurrentBFBFile", filename); CurrentFile = filename; @@ -3626,7 +3634,7 @@ private void btnMULExportActionPerformed(java.awt.event.ActionEvent evt) {//GEN- MULWriter mw = new MULWriter(); String dir = ""; dir = media.GetDirectorySelection(this, Prefs.get("MULDirectory", "")); - if ( dir.isEmpty() ) { + if ( dir.isEmpty() ) { DefaultCursor(); return; } @@ -3941,11 +3949,11 @@ private void mnuBVListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR //Media.Messager("This will output a csv list of mechs and also a list of EVERY SINGLE Mech's cost and BV2 calculation!"); WaitCursor(); if ( list == null ) { LoadList(true); } - + TXTWriter out = new TXTWriter(); String dir = ""; dir = media.GetDirectorySelection(this, Prefs.get("ListDirectory", "")); - if ( dir.isEmpty() ) { + if ( dir.isEmpty() ) { DefaultCursor(); return; } @@ -4197,7 +4205,7 @@ private void btnAddGeneric1ActionPerformed(java.awt.event.ActionEvent evt) {//GE dlgGen.setLocationRelativeTo(this); dlgGen.setVisible(true); }//GEN-LAST:event_btnAddGeneric1ActionPerformed - + private void setTooltip(UnitListData data) { spnMechTable.setToolTipText(data.getInfo()); txtInfo.setText(data.getInfo()); diff --git a/saw/src/main/java/saw/gui/dlgPrefs.java b/saw/src/main/java/saw/gui/dlgPrefs.java index d2ad7bdb..0ba5cdfe 100644 --- a/saw/src/main/java/saw/gui/dlgPrefs.java +++ b/saw/src/main/java/saw/gui/dlgPrefs.java @@ -47,6 +47,10 @@ public class dlgPrefs extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -7677951752003414280L; private Preferences Prefs; /** Creates new form dlfPrefs */ diff --git a/saw/src/main/java/saw/gui/frmVee.java b/saw/src/main/java/saw/gui/frmVee.java index 4ab98b78..1ed07d9b 100644 --- a/saw/src/main/java/saw/gui/frmVee.java +++ b/saw/src/main/java/saw/gui/frmVee.java @@ -61,6 +61,10 @@ import java.util.prefs.Preferences; public final class frmVee extends javax.swing.JFrame implements java.awt.datatransfer.ClipboardOwner, common.DesignForm, ifVeeForm { + /** + * + */ + private static final long serialVersionUID = -6521335178197994074L; CombatVehicle CurVee; abPlaceable CurItem; Preferences Prefs; @@ -89,7 +93,7 @@ public final class frmVee extends javax.swing.JFrame implements java.awt.datatra private ImageTracker imageTracker = new ImageTracker(); public dlgOpen dOpen = new dlgOpen(this, true); public frmForce dForce = new frmForce(this, imageTracker); - + TextPane Overview = new TextPane(); TextPane Capabilities = new TextPane(); TextPane Deployment = new TextPane(); @@ -142,7 +146,7 @@ public void run() { } } }; - + /** Creates new form frmMain2 */ public frmVee() { CurVee = new CombatVehicle( ); @@ -197,7 +201,7 @@ public frmVee() { System.err.println( e.getMessage() ); e.printStackTrace(); } - + Overview.SetEditorSize( 310, 380 ); Capabilities.SetEditorSize( 310, 380 ); Deployment.SetEditorSize( 310, 380 ); @@ -214,7 +218,7 @@ public frmVee() { pnlNotables.add( Notables ); pack(); - + mnuDetails.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { GetInfoOn(); @@ -245,7 +249,7 @@ public void actionPerformed(ActionEvent e) { LaserInsulator(); } }); - + mnuAddPulseModule.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { PulseModule(); @@ -353,7 +357,7 @@ public void actionPerformed(ActionEvent e) { mnuCaseless.setVisible( false ); mnuVGLArc.setVisible( false ); mnuVGLAmmo.setVisible( false ); - + // set the program options cmbRulesLevel.setSelectedItem( Prefs.get( "NewCV_RulesLevel", "Tournament Legal" ) ); cmbEra.setSelectedItem( Prefs.get( "NewCV_Era", "Age of War/Star League" ) ); @@ -403,9 +407,14 @@ public void actionPerformed(ActionEvent e) { mnuFluff.add( mnuFluffCut ); mnuFluff.add( mnuFluffCopy ); mnuFluff.add( mnuFluffPaste ); - - + + tblWeaponManufacturers.setModel( new javax.swing.table.AbstractTableModel() { + /** + * + */ + private static final long serialVersionUID = 26737927964153641L; + @Override public String getColumnName( int col ) { if( col == 1 ) { @@ -451,7 +460,7 @@ public void setValueAt( Object value, int row, int col ) { } } } ); - + tblWeaponManufacturers.getInputMap( javax.swing.JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_TAB, 0, false ), "selectNextRow" ); //if( Prefs.getBoolean( "LoadLastMech", false ) ) { LoadVehicleFromFile(Prefs.get("LastOpenCVDirectory", "") + Prefs.get("LastOpenCVFile", "") ); } @@ -471,7 +480,7 @@ private void GetInfoOn() { ItemInfo.setVisible( true ); } } - + private void SetAmmoLotSize() { if( CurItem instanceof Ammunition ) { dlgAmmoLotSize ammo = new dlgAmmoLotSize( this, true, (Ammunition) CurItem ); @@ -481,7 +490,7 @@ private void SetAmmoLotSize() { RefreshSummary(); RefreshInfoPane(); } - + private void PPCCapacitor() { // if the current item can support a capacitor, adds one on if( CurItem instanceof RangedWeapon ) { @@ -553,7 +562,7 @@ private void LaserInsulator() { RefreshInfoPane(); RefreshSelectedEquipment(); } - + private void PulseModule() { // if the current item can support a Pulse Module, adds one on if( CurItem instanceof RangedWeapon ) { @@ -592,7 +601,7 @@ private void PulseModule() { private void DumperMount() { if ( CurItem instanceof Equipment ) { - + } } @@ -721,7 +730,7 @@ public void SetVariableSize() { } } } - + private void RefreshSelectedEquipment() { Equipment[SELECTED] = CurVee.GetLoadout().GetNonCore().toArray(); lstSelectedEquipment.setListData( Equipment[SELECTED] ); @@ -883,7 +892,7 @@ public void RefreshInfoPane() { txtInfoTonnage.setForeground( Color.BLACK ); txtInfoFreeTons.setForeground( Color.BLACK ); } - + if ( CurVee.GetAvailableSlots() < 0 ) { txtInfoFreeCrits.setForeground(Color.red); } else { @@ -900,7 +909,7 @@ public void RefreshInfoPane() { } txtInfoBattleValue.setText( "BV: " + String.format( "%1$,d", CurVee.GetCurrentBV() ) ); txtInfoCost.setText( "Cost: " + String.format( "%1$,.0f", Math.floor( CurVee.GetTotalCost() + 0.5f ) ) ); - + javax.swing.table.AbstractTableModel m = (javax.swing.table.AbstractTableModel) tblWeaponManufacturers.getModel(); m.fireTableDataChanged(); } @@ -3371,6 +3380,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jScrollPane8.setPreferredSize(new java.awt.Dimension(200, 260)); lstChooseBallistic.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = 7688535481179759741L; String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -3442,6 +3455,10 @@ public void mouseClicked( MouseEvent e ) { jScrollPane9.setPreferredSize(new java.awt.Dimension(200, 260)); lstChooseEnergy.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = 8369795550536444386L; String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -3490,6 +3507,10 @@ public void mouseClicked( MouseEvent e ) { jScrollPane19.setPreferredSize(new java.awt.Dimension(200, 260)); lstChooseMissile.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = -3432729488010626263L; String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -3538,6 +3559,10 @@ public void mouseClicked( MouseEvent e ) { jScrollPane20.setPreferredSize(new java.awt.Dimension(200, 260)); lstChoosePhysical.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = 1033503556159949886L; String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -3586,6 +3611,10 @@ public void mouseClicked( MouseEvent e ) { jScrollPane21.setPreferredSize(new java.awt.Dimension(200, 260)); lstChooseEquipment.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = 8602319704060431038L; String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -3634,6 +3663,10 @@ public void mouseClicked( MouseEvent e ) { jScrollPane24.setPreferredSize(new java.awt.Dimension(200, 260)); lstChooseArtillery.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = 3827871612159282459L; String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -3682,6 +3715,10 @@ public void mouseClicked( MouseEvent e ) { jScrollPane22.setPreferredSize(new java.awt.Dimension(200, 260)); lstChooseAmmunition.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = -4289075475235304500L; String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -4173,6 +4210,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pnlControls.add(cmbNumEquips, gridBagConstraints); cmbLocation.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = -444407369062653192L; String[] strings = { "Front", "Left", "Right", "Rear", "Body", "Turret", "Rear Turret" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -4607,7 +4648,11 @@ public void mousePressed( MouseEvent e ) { "Weapon", "Manufacturer" } ) { - boolean[] canEdit = new boolean [] { + /** + * + */ + private static final long serialVersionUID = 3165475862023659786L; + boolean[] canEdit = new boolean[] { false, true }; @@ -4707,7 +4752,11 @@ public void mousePressed( MouseEvent e ) { "Quirk", "Cost" } ) { - Class[] types = new Class [] { + /** + * + */ + private static final long serialVersionUID = 4587039009477835105L; + Class[] types = new Class[] { java.lang.String.class, java.lang.Integer.class }; boolean[] canEdit = new boolean [] { @@ -5259,7 +5308,7 @@ private void RefreshSummary() { private void RecalcArmorPlacement() { if ( Load ) return; - + double tonnage = CurVee.GetArmor().GetTonnage(); ArmorTons.SetArmorTonnage( tonnage ); try { @@ -5276,10 +5325,10 @@ private void RecalcArmorPlacement() { RefreshSummary(); RefreshInfoPane(); } - + private void RecalcArmorLocations() { pnlRotorArmor.setVisible(false); - + if ( cmbTurret.getSelectedItem().toString().equals("No Turret") ) { spnTurretArmor.setValue(0); spnRearTurretArmor.setValue(0); @@ -5293,7 +5342,7 @@ private void RecalcArmorLocations() { pnlTurretArmor.setVisible(true); pnlRearTurretArmor.setVisible(true); } - if ( CurVee.IsVTOL() ) + if ( CurVee.IsVTOL() ) pnlRotorArmor.setVisible(true); else spnRotorArmor.setValue(0); @@ -5353,7 +5402,7 @@ private void SolidifyVehicle() { private void BuildLocationSelector() { int curSelection = Math.max(cmbLocation.getSelectedIndex(), 0); - + ArrayList locs = new ArrayList(); locs.add("Front"); locs.add("Left"); @@ -5366,13 +5415,13 @@ private void BuildLocationSelector() { locs.add("Body"); if ( CurVee.isHasTurret1() ) locs.add("Turret"); - if ( CurVee.isHasTurret2() ) + if ( CurVee.isHasTurret2() ) locs.add("Rear Turret"); - + cmbLocation.setModel(new DefaultComboBoxModel(locs.toArray())); cmbLocation.setSelectedIndex(curSelection); } - + private void BuildArmorSelector() { // builds the armor selection box ArrayList list = new ArrayList(); @@ -5394,7 +5443,7 @@ private void BuildArmorSelector() { // now set the armor chooser cmbArmorType.setModel( new javax.swing.DefaultComboBoxModel( temp ) ); - + cmbArmorType.setSelectedItem(CurVee.GetArmor().ActualName()); } @@ -5452,7 +5501,7 @@ private void FixArmorSpinners() { // fixes the armor spinners to match the new tonnage / motive type CVArmor a = CurVee.GetArmor(); a.SetMaxArmor(CurVee.GetArmorableLocationCount()); - + spnFrontArmor.setModel( new javax.swing.SpinnerNumberModel( a.GetLocationArmor( LocationIndex.CV_LOC_FRONT ), 0, a.GetLocationMax(LocationIndex.CV_LOC_FRONT), 1) ); spnLeftArmor.setModel( new javax.swing.SpinnerNumberModel( a.GetLocationArmor( LocationIndex.CV_LOC_LEFT ), 0, a.GetLocationMax(LocationIndex.CV_LOC_LEFT), 1) ); spnRightArmor.setModel( new javax.swing.SpinnerNumberModel( a.GetLocationArmor( LocationIndex.CV_LOC_RIGHT ), 0, a.GetLocationMax(LocationIndex.CV_LOC_RIGHT), 1) ); @@ -5466,7 +5515,7 @@ private void FixArmorSpinners() { ((JSpinner.DefaultEditor)spnCruiseMP.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnJumpMP.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnHeatSinks.getEditor()).getTextField().addFocusListener(spinners); - + //Setup Spinner focus ((JSpinner.DefaultEditor)spnFrontArmor.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnLeftArmor.getEditor()).getTextField().addFocusListener(spinners); @@ -5498,10 +5547,10 @@ public void FixTonnageSpinner( int MinTonnage, int MaxTonnage ) { int CurVal = Integer.parseInt(spnTonnage.getValue().toString()); if ( CurVal < MinTonnage ) CurVal = MinTonnage; - + if ( CurVal > MaxTonnage ) CurVal = MaxTonnage; - + spnTonnage.setModel( new javax.swing.SpinnerNumberModel(CurVal, MinTonnage, MaxTonnage, 1) ); spnTonnageStateChanged(null); } @@ -5540,7 +5589,7 @@ private void cmbRulesLevelActionPerformed(java.awt.event.ActionEvent evt) {//GEN CurVee.SetRulesLevel( NewLevel ); CheckTonnage( true ); CurVee.SetChanged(true); - + // get the currently chosen selections SaveSelections(); BuildTechBaseSelector(); @@ -5595,7 +5644,7 @@ public void CheckTonnage( boolean RulesChange ) { if( CurVee.GetTonnage() < 1 ) { spnTonnage.setValue(1); } - + if ( CurVee.GetTonnage() > CurVee.GetMaxTonnage() ) { spnTonnage.setValue(CurVee.GetMaxTonnage()); } @@ -5697,7 +5746,7 @@ private void BuildChassisSelector() chkEnviroSealing.setEnabled(false); } } - + private void BuildExpEquipmentSelector() { JCheckBox[] ExpEquipmentCheckboxes = { chkArmoredMotive, chkSupercharger, @@ -5719,7 +5768,7 @@ private void BuildExpEquipmentSelector() { private void cmbMotiveTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbMotiveTypeActionPerformed if ( Load ) return; boolean wasVtol = CurVee.IsVTOL(); - + switch ( cmbMotiveType.getSelectedIndex() ) { case 0: //Hovercraft CurVee.SetHover(); @@ -5761,7 +5810,7 @@ private void cmbMotiveTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN } else { chkTrailer.setEnabled(true); } - + BuildTurretSelector(); cmbTurretActionPerformed(null); BuildChassisSelector(); @@ -6019,7 +6068,7 @@ private void ShowInfoOn( abPlaceable p ) { } private void chkSuperchargerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkSuperchargerActionPerformed - + }//GEN-LAST:event_chkSuperchargerActionPerformed private void chkUseTCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkUseTCActionPerformed @@ -6128,7 +6177,7 @@ private void chkClanCASEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F RefreshInfoPane(); return; } - + try { switch ( CurVee.GetTechBase() ) { case AvailableCode.TECH_INNER_SPHERE: @@ -6409,13 +6458,13 @@ private void spnCruiseMPStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-F try { // the commitedit worked, so set the engine rating and report the running mp int walkMP = Math.min(n.getNumber().intValue(), CurVee.getMaxCruiseMP()); - + if ( !CurVee.GetEngine().RequiresControls() && walkMP > 0 ) { spnCruiseMP.setValue(0); //Media.Messager("Please select an engine first"); return; } - + CurVee.setCruiseMP( walkMP ); } catch( Exception e ) { Media.Messager( e.getMessage() ); @@ -6447,7 +6496,7 @@ private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST setCursor( NormalCursor ); return; } - + //Since we are saving to a new file update the stored prefs try { Prefs.put("LastOpenCVDirectory", savevee.getCanonicalPath().replace(savevee.getName(), "")); @@ -6705,7 +6754,7 @@ private boolean VerifyVehicle( ActionEvent evt ) { private void spnTonnageStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnTonnageStateChanged if( Load ) { return; } - + // We have to decode the selected index to set values. A bit safer, I // think, because we can directly set the values ourselves. int Tons = 0; @@ -6718,7 +6767,7 @@ private void spnTonnageStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI } if ( Tons == 0 ) Tons = 1; - + if ( Tons >= 0 && Tons <= 39) lblVeeClass.setText("Light Vee"); if ( Tons >= 40 && Tons <= 59 ) @@ -6807,12 +6856,12 @@ private void RecalcEngine() { private void GetNewVee() { boolean Omni = CurVee.IsOmni(); - + CurVee = new CombatVehicle(); spnTonnage.setModel(new SpinnerNumberModel(CurVee.GetTonnage(), 1, CurVee.GetMaxTonnage(), 1)); spnCruiseMP.setModel(new SpinnerNumberModel(CurVee.getCruiseMP(), 1, CurVee.getMaxCruiseMP(), 1)); spnHeatSinks.setModel(new SpinnerNumberModel(CurVee.GetHeatSinks().GetNumHS(), 0, 50, 1)); - + cmbMotiveType.setSelectedIndex( 0 ); chkYearRestrict.setSelected( false ); txtProdYear.setText( "" ); @@ -6859,7 +6908,7 @@ private void GetNewVee() { CurVee.SetYear( 0, false ); break; } - + cmbTechBase.setSelectedItem( Prefs.get( "NewVee_Techbase", "Inner Sphere" ) ); switch( cmbTechBase.getSelectedIndex() ) { case AvailableCode.TECH_INNER_SPHERE: @@ -7008,7 +7057,7 @@ private void RefreshEquipment() { chkClanCASE.setSelected(false); chkClanCASE.setEnabled(false); } - + // fix Artemis IV controls ifMissileGuidance ArtCheck = new ArtemisIVFCS( null ); if( CommonTools.IsAllowed( ArtCheck.GetAvailability(), CurVee ) ) { @@ -7160,7 +7209,7 @@ private void SetWeaponChoosers() { // get the equipment lists for the choices. if ( data == null ) return; - + Equipment[ENERGY] = data.GetEquipment().GetEnergyWeapons( CurVee ); Equipment[MISSILE] = data.GetEquipment().GetMissileWeapons( CurVee ); Equipment[BALLISTIC] = data.GetEquipment().GetBallisticWeapons( CurVee ); @@ -7190,7 +7239,7 @@ private void SetWeaponChoosers() { lstSelectedEquipment.setListData( Equipment[SELECTED] ); lstChooseArtillery.setListData( Equipment[ARTILLERY] ); lstSelectedEquipment.repaint(); - + ResetAmmo(); } @@ -7198,7 +7247,7 @@ private void UnlockGUIFromOmni() { // this should be used anytime a new mech is made or when unlocking // an Omni. isLocked = false; - + chkOmniVee.setSelected( false ); chkOmniVee.setEnabled( true ); mnuUnlock.setEnabled( false ); @@ -7422,7 +7471,7 @@ private void cmbEngineTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN if( BuildLookupName( CurVee.GetEngine().GetCurrentState() ).equals( (String) cmbEngineType.getSelectedItem() ) ) { // only nuclear-powered mechs may use jump jets /*if( CurVee.GetEngine().IsNuclear() ) { - + if( cmbJumpJetType.getSelectedItem() == null ) { EnableJumpJets( false ); } else { @@ -7440,7 +7489,7 @@ private void cmbEngineTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN //When the engine changes we need to re-check the Heat Sinks CurVee.ResetHeatSinks(); - + // only nuclear-powered mechs may use jump jets /*if( CurVee.GetEngine().IsNuclear() ) { /* @@ -7449,7 +7498,7 @@ private void cmbEngineTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN } else { EnableJumpJets( true ); } - + } else { EnableJumpJets( false ); }*/ @@ -7622,7 +7671,7 @@ private void btnMaximizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F // this simply maximizes the mech's armor CVArmor a = CurVee.GetArmor(); a.Maximize(); - + // if we fix the spinner models, they should refresh the screen FixArmorSpinners(); @@ -7939,7 +7988,7 @@ private void spnHeatSinksStateChanged(javax.swing.event.ChangeEvent evt) {//GEN- RefreshSummary(); RefreshInfoPane(); }//GEN-LAST:event_spnHeatSinksStateChanged - + private void FixHeatSinkSpinnerModel() { // mainly provided for Omnis. if( CurVee.IsOmni() ) { @@ -7995,18 +8044,18 @@ private void spnFrontArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN locArmor = a.GetLocationArmor( LocationIndex.CV_LOC_FRONT ); } } - + // now we need to set the rear armor spinner correctly and update n = (SpinnerNumberModel) spnFrontArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_FRONT ) ); - + if( chkBalanceFRArmor.isSelected() ) { n = (SpinnerNumberModel) spnFrontArmor.getModel(); a.SetArmor( LocationIndex.CV_LOC_REAR, n.getNumber().intValue() ); n = (SpinnerNumberModel) spnRearArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_FRONT ) ); } - + // now refresh the information panes RefreshSummary(); RefreshInfoPane(); @@ -8046,11 +8095,11 @@ private void spnLeftArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN- locArmor = a.GetLocationArmor( LocationIndex.CV_LOC_LEFT ); } } - + // now we need to set the rear armor spinner correctly and update n = (SpinnerNumberModel) spnLeftArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_LEFT ) ); - + if( chkBalanceLRArmor.isSelected() ) { n = (SpinnerNumberModel) spnLeftArmor.getModel(); a.SetArmor( LocationIndex.CV_LOC_RIGHT, n.getNumber().intValue() ); @@ -8097,18 +8146,18 @@ private void spnRightArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN locArmor = a.GetLocationArmor( LocationIndex.CV_LOC_RIGHT ); } } - + // now we need to set the rear armor spinner correctly and update n = (SpinnerNumberModel) spnRightArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_RIGHT ) ); - + if( chkBalanceLRArmor.isSelected() ) { n = (SpinnerNumberModel) spnRightArmor.getModel(); a.SetArmor( LocationIndex.CV_LOC_LEFT, n.getNumber().intValue() ); n = (SpinnerNumberModel) spnLeftArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_RIGHT ) ); } - + // now refresh the information panes RefreshSummary(); RefreshInfoPane(); @@ -8148,18 +8197,18 @@ private void spnRearArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN- locArmor = a.GetLocationArmor( LocationIndex.CV_LOC_REAR ); } } - + // now we need to set the rear armor spinner correctly and update n = (SpinnerNumberModel) spnRearArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_REAR ) ); - + if( chkBalanceFRArmor.isSelected() ) { n = (SpinnerNumberModel) spnRearArmor.getModel(); a.SetArmor( LocationIndex.CV_LOC_FRONT, n.getNumber().intValue() ); n = (SpinnerNumberModel) spnFrontArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_REAR ) ); } - + // now refresh the information panes RefreshSummary(); RefreshInfoPane(); @@ -8203,7 +8252,7 @@ private void spnTurretArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GE // now we need to set the rear armor spinner correctly and update n = (SpinnerNumberModel) spnTurretArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_TURRET1 ) ); - + // now refresh the information panes RefreshSummary(); RefreshInfoPane(); @@ -8369,7 +8418,7 @@ private void spnRotorArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN // now we need to set the rear armor spinner correctly and update n = (SpinnerNumberModel) spnRotorArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_ROTOR ) ); - + // now refresh the information panes RefreshSummary(); RefreshInfoPane(); @@ -8396,7 +8445,7 @@ private void btnLockChassisActionPerformed(java.awt.event.ActionEvent evt) {//GE Media.Messager( this, "Omnivees are not allowed to have " + CurVee.GetArmor().ActualName()); return; } - + int choice = javax.swing.JOptionPane.showConfirmDialog(this, "Are you sure you want to lock the chassis?\nAll items in the base " + "loadout will be locked in location\nand most chassis specifications " @@ -8460,7 +8509,7 @@ private void RefreshOmniChoices() { // equipment it has loaded. CheckEquipment(); } - + private void CheckEquipment() { // consolidating some code here. if( CurVee.UsingArtemisIV() ) { @@ -8497,11 +8546,11 @@ private void CheckEquipment() { chkClanCASE.setSelected( false ); } } - + private void LockGUIForOmni() { // this locks most of the GUI controls. Used mainly by Omnimechs. isLocked = true; - + chkOmniVee.setSelected( true ); chkOmniVee.setEnabled( false ); mnuUnlock.setEnabled( true ); @@ -8815,7 +8864,7 @@ public void LoadVehicleIntoGUI() { // Put it in the gui. UnlockGUIFromOmni(); - + chkYearRestrict.setSelected( CurVee.IsYearRestricted() ); txtProdYear.setText( "" + CurVee.GetYear() ); cmbEra.setEnabled( true ); @@ -8851,21 +8900,21 @@ public void LoadVehicleIntoGUI() { cmbTechBase.setEnabled( false ); txtProdYear.setEnabled( false ); } - + //Set all the inputs txtVehicleName.setText( CurVee.GetName() ); txtModel.setText( CurVee.GetModel() ); cmbTechBase.setSelectedIndex( CurVee.GetLoadout().GetTechBase() ); cmbMotiveType.setSelectedItem( CurVee.GetMotiveLookupName() ); spnTonnage.setModel( new javax.swing.SpinnerNumberModel(CurVee.GetTonnage(), 1, CurVee.GetMaxTonnage(), 1) ); - spnCruiseMP.setModel( new javax.swing.SpinnerNumberModel(CurVee.getCruiseMP(), CurVee.getMinCruiseMP(), CurVee.getMaxCruiseMP(), 1) ); + spnCruiseMP.setModel( new javax.swing.SpinnerNumberModel(CurVee.getCruiseMP(), CurVee.getMinCruiseMP(), CurVee.getMaxCruiseMP(), 1) ); if ( CurVee.isHasTurret1() ) cmbTurret.setSelectedItem("Single Turret"); if ( CurVee.isHasTurret2() ) cmbTurret.setSelectedItem("Dual Turret"); FixArmorSpinners(); // now that we're done with the special stuff... Load = false; - + if( CurVee.IsOmni() ) { if ( CurVee.isHasTurret1() ) spnTurretTonnage.setModel( new SpinnerNumberModel(CurVee.GetBaseLoadout().GetTurret().GetMaxTonnage(), 0, 99.0, 0.5) ); @@ -8933,8 +8982,8 @@ public void LoadVehicleIntoGUI() { CurVee.SetChanged(false); } - - + + private void mnuImportHMPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuImportHMPActionPerformed if (CurVee.HasChanged()) { int choice = javax.swing.JOptionPane.showConfirmDialog(this, @@ -9222,7 +9271,7 @@ public void QuickSave() { mnuSaveActionPerformed(null); } } - + private void mnuExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExitActionPerformed if (CurVee.HasChanged()) { int choice = javax.swing.JOptionPane.showConfirmDialog(this, @@ -9249,7 +9298,7 @@ private void CloseProgram() { System.exit(0); } - + private void mnuSummaryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSummaryActionPerformed SolidifyVehicle(); dlgSummaryInfo Summary = new dlgSummaryInfo(this, true, CurVee); @@ -9619,7 +9668,7 @@ private void spnTurretTonnageStateChanged(javax.swing.event.ChangeEvent evt) {// Media.Messager(e.getMessage()); return; } - + RefreshSummary(); RefreshInfoPane(); }//GEN-LAST:event_spnTurretTonnageStateChanged @@ -9646,7 +9695,7 @@ private void chkTrailerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI } catch (Exception ex) { Media.Messager(ex.getMessage()); } - if ( curEngine == "No Engine" ) + if ( curEngine == "No Engine" ) cmbEngineType.setSelectedIndex(0); else cmbEngineType.setSelectedItem(curEngine); @@ -9759,7 +9808,7 @@ private void chkFullAmphActionPerformed(java.awt.event.ActionEvent evt) { RefreshSummary(); RefreshInfoPane(); } - + private PagePrinter SetupPrinter() { PagePrinter printer = new PagePrinter(); Media media = new Media(); @@ -9770,10 +9819,10 @@ private PagePrinter SetupPrinter() { sheet.setPrintMech(true); sheet.setUnitImage(media.GetImage(CurVee.GetSSWImage())); printer.Append(BFBPrinter.Letter.toPage(), sheet); - + return printer; } - + private void FixMPSpinner() { // This fixes the walking MP spinner if the mech's tonnage changes. int MaxWalk = CurVee.getMaxCruiseMP(); @@ -10261,12 +10310,12 @@ public void lostOwnership(Clipboard clipboard, Transferable contents) { public void setUnit(ArrayList v) { this.setVee( (CombatVehicle) v.get(0) ); } - + public void setVee( CombatVehicle v ) { CurVee = v; LoadVehicleIntoGUI(); } - + public void loadUnitIntoGUI() { this.LoadVehicleIntoGUI(); } diff --git a/saw/src/main/java/saw/gui/frmVeeWide.java b/saw/src/main/java/saw/gui/frmVeeWide.java index f88fb033..b188bb78 100644 --- a/saw/src/main/java/saw/gui/frmVeeWide.java +++ b/saw/src/main/java/saw/gui/frmVeeWide.java @@ -61,6 +61,10 @@ import java.util.prefs.Preferences; public final class frmVeeWide extends javax.swing.JFrame implements java.awt.datatransfer.ClipboardOwner, common.DesignForm, ifVeeForm { + /** + * + */ + private static final long serialVersionUID = 6114216721636138809L; CombatVehicle CurVee; abPlaceable CurItem; Preferences Prefs; @@ -89,7 +93,7 @@ public final class frmVeeWide extends javax.swing.JFrame implements java.awt.dat private ImageTracker imageTracker = new ImageTracker(); public dlgOpen dOpen = new dlgOpen(this, true); public frmForce dForce = new frmForce(this, imageTracker); - + TextPane Overview = new TextPane(); TextPane Capabilities = new TextPane(); TextPane Deployment = new TextPane(); @@ -142,7 +146,7 @@ public void run() { } } }; - + /** Creates new form frmMain2 */ public frmVeeWide() { CurVee = new CombatVehicle( ); @@ -197,7 +201,7 @@ public frmVeeWide() { System.err.println( e.getMessage() ); e.printStackTrace(); } - + Overview.SetEditorSize( 310, 380 ); Capabilities.SetEditorSize( 310, 380 ); Deployment.SetEditorSize( 310, 380 ); @@ -214,7 +218,7 @@ public frmVeeWide() { pnlNotables.add( Notables ); pack(); - + mnuDetails.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { GetInfoOn(); @@ -245,7 +249,7 @@ public void actionPerformed(ActionEvent e) { LaserInsulator(); } }); - + mnuAddPulseModule.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { PulseModule(); @@ -352,7 +356,7 @@ public void actionPerformed(ActionEvent e) { mnuCaseless.setVisible( false ); mnuVGLArc.setVisible( false ); mnuVGLAmmo.setVisible( false ); - + // set the program options cmbRulesLevel.setSelectedItem( Prefs.get( "NewCV_RulesLevel", "Tournament Legal" ) ); cmbEra.setSelectedItem( Prefs.get( "NewCV_Era", "Age of War/Star League" ) ); @@ -402,9 +406,14 @@ public void actionPerformed(ActionEvent e) { mnuFluff.add( mnuFluffCut ); mnuFluff.add( mnuFluffCopy ); mnuFluff.add( mnuFluffPaste ); - - + + tblWeaponManufacturers.setModel( new javax.swing.table.AbstractTableModel() { + /** + * + */ + private static final long serialVersionUID = 1027739665192439978L; + @Override public String getColumnName( int col ) { if( col == 1 ) { @@ -450,7 +459,7 @@ public void setValueAt( Object value, int row, int col ) { } } } ); - + tblWeaponManufacturers.getInputMap( javax.swing.JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_TAB, 0, false ), "selectNextRow" ); if( Prefs.getBoolean( "LoadLastMech", false ) ) { LoadVehicleFromFile(Prefs.get("LastOpenCVDirectory", "") + Prefs.get("LastOpenCVFile", "") ); } @@ -470,7 +479,7 @@ private void GetInfoOn() { ItemInfo.setVisible( true ); } } - + private void SetAmmoLotSize() { if( CurItem instanceof Ammunition ) { dlgAmmoLotSize ammo = new dlgAmmoLotSize( this, true, (Ammunition) CurItem ); @@ -480,7 +489,7 @@ private void SetAmmoLotSize() { RefreshSummary(); RefreshInfoPane(); } - + private void PPCCapacitor() { // if the current item can support a capacitor, adds one on if( CurItem instanceof RangedWeapon ) { @@ -552,7 +561,7 @@ private void LaserInsulator() { RefreshInfoPane(); RefreshSelectedEquipment(); } - + private void PulseModule() { // if the current item can support a Pulse Module, adds one on if( CurItem instanceof RangedWeapon ) { @@ -591,7 +600,7 @@ private void PulseModule() { private void DumperMount() { if ( CurItem instanceof Equipment ) { - + } } @@ -720,7 +729,7 @@ public void SetVariableSize() { } } } - + private void setViewToolbar(boolean Visible) { tlbIconBar.setVisible(Visible); @@ -876,7 +885,7 @@ public void RefreshInfoPane() { txtInfoTonnage.setForeground( Color.BLACK ); txtInfoFreeTons.setForeground( Color.BLACK ); } - + if ( CurVee.GetAvailableSlots() < 0 ) { txtInfoFreeCrits.setForeground(Color.red); } else { @@ -893,7 +902,7 @@ public void RefreshInfoPane() { } txtInfoBattleValue.setText( "BV: " + String.format( "%1$,d", CurVee.GetCurrentBV() ) ); txtInfoCost.setText( "Cost: " + String.format( "%1$,.0f", Math.floor( CurVee.GetTotalCost() + 0.5f ) ) ); - + javax.swing.table.AbstractTableModel m = (javax.swing.table.AbstractTableModel) tblWeaponManufacturers.getModel(); m.fireTableDataChanged(); } @@ -3730,6 +3739,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pnlControls.add(cmbNumEquips, gridBagConstraints); cmbLocation.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = 6607094205086585053L; String[] strings = { "Front", "Left", "Right", "Rear", "Body", "Turret", "Rear Turret" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -3817,6 +3830,10 @@ public void mousePressed( MouseEvent e ) { jScrollPane8.setPreferredSize(new java.awt.Dimension(200, 260)); lstChooseBallistic.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = 2433844261035717237L; String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -3888,6 +3905,10 @@ public void mouseClicked( MouseEvent e ) { jScrollPane9.setPreferredSize(new java.awt.Dimension(200, 260)); lstChooseEnergy.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = 4552970694988880397L; String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -3936,6 +3957,10 @@ public void mouseClicked( MouseEvent e ) { jScrollPane19.setPreferredSize(new java.awt.Dimension(200, 260)); lstChooseMissile.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = -6303064750127198085L; String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -3984,6 +4009,10 @@ public void mouseClicked( MouseEvent e ) { jScrollPane20.setPreferredSize(new java.awt.Dimension(200, 260)); lstChoosePhysical.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = 3346025583569549620L; String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -4032,6 +4061,10 @@ public void mouseClicked( MouseEvent e ) { jScrollPane21.setPreferredSize(new java.awt.Dimension(200, 260)); lstChooseEquipment.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = -1009305224943806201L; String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -4080,6 +4113,10 @@ public void mouseClicked( MouseEvent e ) { jScrollPane24.setPreferredSize(new java.awt.Dimension(200, 260)); lstChooseArtillery.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = -7135129452270788564L; String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -4128,6 +4165,10 @@ public void mouseClicked( MouseEvent e ) { jScrollPane22.setPreferredSize(new java.awt.Dimension(200, 260)); lstChooseAmmunition.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = -9035730903467367294L; String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -4524,7 +4565,11 @@ public void mousePressed( MouseEvent e ) { "Weapon", "Manufacturer" } ) { - boolean[] canEdit = new boolean [] { + /** + * + */ + private static final long serialVersionUID = 6177729480923711245L; + boolean[] canEdit = new boolean[] { false, true }; @@ -4624,7 +4669,11 @@ public void mousePressed( MouseEvent e ) { "Quirk", "Cost" } ) { - Class[] types = new Class [] { + /** + * + */ + private static final long serialVersionUID = -8164275073930441102L; + Class[] types = new Class[] { java.lang.String.class, java.lang.Integer.class }; boolean[] canEdit = new boolean [] { @@ -5213,7 +5262,7 @@ private void RefreshSummary() { private void RecalcArmorPlacement() { if ( Load ) return; - + double tonnage = CurVee.GetArmor().GetTonnage(); ArmorTons.SetArmorTonnage( tonnage ); try { @@ -5230,10 +5279,10 @@ private void RecalcArmorPlacement() { RefreshSummary(); RefreshInfoPane(); } - + private void RecalcArmorLocations() { pnlRotorArmor.setVisible(false); - + if ( cmbTurret.getSelectedItem().toString().equals("No Turret") ) { spnTurretArmor.setValue(0); spnRearTurretArmor.setValue(0); @@ -5247,7 +5296,7 @@ private void RecalcArmorLocations() { pnlTurretArmor.setVisible(true); pnlRearTurretArmor.setVisible(true); } - if ( CurVee.IsVTOL() ) + if ( CurVee.IsVTOL() ) pnlRotorArmor.setVisible(true); else spnRotorArmor.setValue(0); @@ -5307,7 +5356,7 @@ private void SolidifyVehicle() { private void BuildLocationSelector() { int curSelection = Math.max(cmbLocation.getSelectedIndex(), 0); - + ArrayList locs = new ArrayList(); locs.add("Front"); locs.add("Left"); @@ -5320,13 +5369,13 @@ private void BuildLocationSelector() { locs.add("Body"); if ( CurVee.isHasTurret1() ) locs.add("Turret"); - if ( CurVee.isHasTurret2() ) + if ( CurVee.isHasTurret2() ) locs.add("Rear Turret"); - + cmbLocation.setModel(new DefaultComboBoxModel(locs.toArray())); cmbLocation.setSelectedIndex(curSelection); } - + private void BuildArmorSelector() { // builds the armor selection box ArrayList list = new ArrayList(); @@ -5348,7 +5397,7 @@ private void BuildArmorSelector() { // now set the armor chooser cmbArmorType.setModel( new javax.swing.DefaultComboBoxModel( temp ) ); - + cmbArmorType.setSelectedItem(CurVee.GetArmor().ActualName()); } @@ -5402,7 +5451,7 @@ private void FixArmorSpinners() { // fixes the armor spinners to match the new tonnage / motive type CVArmor a = CurVee.GetArmor(); a.SetMaxArmor(CurVee.GetArmorableLocationCount()); - + spnFrontArmor.setModel( new javax.swing.SpinnerNumberModel( a.GetLocationArmor( LocationIndex.CV_LOC_FRONT ), 0, a.GetLocationMax(LocationIndex.CV_LOC_FRONT), 1) ); spnLeftArmor.setModel( new javax.swing.SpinnerNumberModel( a.GetLocationArmor( LocationIndex.CV_LOC_LEFT ), 0, a.GetLocationMax(LocationIndex.CV_LOC_LEFT), 1) ); spnRightArmor.setModel( new javax.swing.SpinnerNumberModel( a.GetLocationArmor( LocationIndex.CV_LOC_RIGHT ), 0, a.GetLocationMax(LocationIndex.CV_LOC_RIGHT), 1) ); @@ -5416,7 +5465,7 @@ private void FixArmorSpinners() { ((JSpinner.DefaultEditor)spnCruiseMP.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnJumpMP.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnHeatSinks.getEditor()).getTextField().addFocusListener(spinners); - + //Setup Spinner focus ((JSpinner.DefaultEditor)spnFrontArmor.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnLeftArmor.getEditor()).getTextField().addFocusListener(spinners); @@ -5446,10 +5495,10 @@ public String BuildLookupName( ifState s ) { public void FixTonnageSpinner( int MinTonnage, int MaximumTonnage ) { int CurVal = Integer.parseInt(spnTonnage.getValue().toString()); - + if ( CurVal < MinTonnage ) CurVal = MinTonnage; - + if ( CurVal > MaximumTonnage ) CurVal = MaximumTonnage; @@ -5461,7 +5510,7 @@ public void CheckTonnage( boolean RulesChange ) { if( CurVee.GetTonnage() < 1 ) { spnTonnage.setValue(1); } - + if ( CurVee.GetTonnage() > CurVee.GetMaxTonnage() ) { spnTonnage.setValue(CurVee.GetMaxTonnage()); } @@ -5564,7 +5613,7 @@ private void BuildChassisSelector() chkEnviroSealing.setEnabled(false); } } - + private void BuildExpEquipmentSelector() { JCheckBox[] ExpEquipmentCheckboxes = { chkArmoredMotive, chkSupercharger, @@ -5842,7 +5891,7 @@ private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST setCursor( NormalCursor ); return; } - + //Since we are saving to a new file update the stored prefs try { Prefs.put("LastOpenCVDirectory", savevee.getCanonicalPath().replace(savevee.getName(), "")); @@ -6144,12 +6193,12 @@ private void RecalcEngine() { private void GetNewVee() { boolean Omni = CurVee.IsOmni(); - + CurVee = new CombatVehicle(); spnTonnage.setModel(new SpinnerNumberModel(CurVee.GetTonnage(), 1, CurVee.GetMaxTonnage(), 1)); spnCruiseMP.setModel(new SpinnerNumberModel(CurVee.getCruiseMP(), 1, CurVee.getMaxCruiseMP(), 1)); spnHeatSinks.setModel(new SpinnerNumberModel(CurVee.GetHeatSinks().GetNumHS(), 0, 50, 1)); - + cmbMotiveType.setSelectedIndex( 0 ); chkYearRestrict.setSelected( false ); txtProdYear.setText( "" ); @@ -6195,7 +6244,7 @@ private void GetNewVee() { CurVee.SetYear( 0, false ); break; } - + cmbTechBase.setSelectedItem( Prefs.get( "NewVee_Techbase", "Inner Sphere" ) ); switch( cmbTechBase.getSelectedIndex() ) { case AvailableCode.TECH_INNER_SPHERE: @@ -6522,7 +6571,7 @@ private void SetWeaponChoosers() { lstSelectedEquipment.setListData( Equipment[SELECTED] ); lstChooseArtillery.setListData( Equipment[ARTILLERY] ); lstSelectedEquipment.repaint(); - + ResetAmmo(); } @@ -6530,7 +6579,7 @@ private void UnlockGUIFromOmni() { // this should be used anytime a new mech is made or when unlocking // an Omni. isLocked = false; - + chkOmniVee.setSelected( false ); chkOmniVee.setEnabled( true ); mnuUnlock.setEnabled( false ); @@ -6748,7 +6797,7 @@ private void RecalcEquipment() { clan = true; } } - + private void FixHeatSinkSpinnerModel() { // mainly provided for Omnis. if( CurVee.IsOmni() ) { @@ -6794,7 +6843,7 @@ private void RefreshOmniChoices() { // equipment it has loaded. CheckEquipment(); } - + private void CheckEquipment() { // consolidating some code here. if( CurVee.UsingArtemisIV() ) { @@ -6831,11 +6880,11 @@ private void CheckEquipment() { chkClanCASE.setSelected( false ); } } - + private void LockGUIForOmni() { // this locks most of the GUI controls. Used mainly by Omnimechs. isLocked = true; - + chkOmniVee.setSelected( true ); chkOmniVee.setEnabled( false ); mnuUnlock.setEnabled( true ); @@ -7026,7 +7075,7 @@ public void LoadVehicleIntoGUI() { // Put it in the gui. UnlockGUIFromOmni(); - + chkYearRestrict.setSelected( CurVee.IsYearRestricted() ); txtProdYear.setText( "" + CurVee.GetYear() ); cmbEra.setEnabled( true ); @@ -7060,21 +7109,21 @@ public void LoadVehicleIntoGUI() { cmbTechBase.setEnabled( false ); txtProdYear.setEnabled( false ); } - + //Set all the inputs txtVehicleName.setText( CurVee.GetName() ); txtModel.setText( CurVee.GetModel() ); cmbTechBase.setSelectedIndex( CurVee.GetLoadout().GetTechBase() ); cmbMotiveType.setSelectedItem( CurVee.GetMotiveLookupName() ); spnTonnage.setModel( new javax.swing.SpinnerNumberModel(CurVee.GetTonnage(), 1, CurVee.GetMaxTonnage(), 1) ); - spnCruiseMP.setModel( new javax.swing.SpinnerNumberModel(CurVee.getCruiseMP(), 1, CurVee.getMaxCruiseMP(), 1) ); + spnCruiseMP.setModel( new javax.swing.SpinnerNumberModel(CurVee.getCruiseMP(), 1, CurVee.getMaxCruiseMP(), 1) ); if ( CurVee.isHasTurret1() ) cmbTurret.setSelectedItem("Single Turret"); if ( CurVee.isHasTurret2() ) cmbTurret.setSelectedItem("Dual Turret"); FixArmorSpinners(); // now that we're done with the special stuff... Load = false; - + if( CurVee.IsOmni() ) { if ( CurVee.isHasTurret1() ) spnTurretTonnage.setModel( new SpinnerNumberModel(CurVee.GetBaseLoadout().GetTurret().GetMaxTonnage(), 0, 99.0, 0.5) ); @@ -7139,8 +7188,8 @@ public void LoadVehicleIntoGUI() { CurVee.SetChanged(false); } - - + + private void mnuImportHMPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuImportHMPActionPerformed if (CurVee.HasChanged()) { int choice = javax.swing.JOptionPane.showConfirmDialog(this, @@ -7428,7 +7477,7 @@ public void QuickSave() { mnuSaveActionPerformed(null); } } - + private void mnuExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExitActionPerformed if (CurVee.HasChanged()) { int choice = javax.swing.JOptionPane.showConfirmDialog(this, @@ -7455,7 +7504,7 @@ private void CloseProgram() { System.exit(0); } - + private void mnuSummaryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSummaryActionPerformed SolidifyVehicle(); dlgSummaryInfo Summary = new dlgSummaryInfo(this, true, CurVee); @@ -8207,7 +8256,7 @@ private void chkFCSAIVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR } // now refresh the information panes RefreshSummary(); - RefreshInfoPane(); + RefreshInfoPane(); }//GEN-LAST:event_chkFCSAIVActionPerformed private void chkUseTCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkUseTCActionPerformed @@ -8299,7 +8348,7 @@ private void btnMaximizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F // this simply maximizes the mech's armor CVArmor a = CurVee.GetArmor(); a.Maximize(); - + // if we fix the spinner models, they should refresh the screen FixArmorSpinners(); @@ -8837,7 +8886,7 @@ private void btnLockChassisActionPerformed(java.awt.event.ActionEvent evt) {//GE // currently testing right now. SaveOmniFluffInfo(); String VariantName = ""; - + // 2020-11-13 Omnis can't have Hardened Armor, but we wrote this generic // in case later other armor types come along if (!CurVee.GetArmor().AllowOmni()){ @@ -8906,7 +8955,7 @@ private void chkFractionalActionPerformed(java.awt.event.ActionEvent evt) {//GEN }//GEN-LAST:event_chkFractionalActionPerformed private void chkSuperchargerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkSuperchargerActionPerformed - + }//GEN-LAST:event_chkSuperchargerActionPerformed private void chkEnviroSealingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkEnviroSealingActionPerformed @@ -9099,10 +9148,10 @@ private void cmbEngineTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN } RecalcEngine(); FixMPSpinner(); - + //When the engine changes we need to re-check the Heat Sinks CurVee.ResetHeatSinks(); - + // only nuclear-powered mechs may use jump jets if (CurVee.GetEngine().IsNuclear()) { /* @@ -9243,7 +9292,7 @@ private void chkOmniVeeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI private void cmbMotiveTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbMotiveTypeActionPerformed if ( Load ) return; boolean wasVtol = CurVee.IsVTOL(); - + switch (cmbMotiveType.getSelectedIndex()) { case 0: //Hovercraft CurVee.SetHover(); @@ -9762,7 +9811,7 @@ private void mnuReloadEquipmentActionPerformed(java.awt.event.ActionEvent evt) { } SetWeaponChoosers(); }//GEN-LAST:event_mnuReloadEquipmentActionPerformed - + private PagePrinter SetupPrinter() { PagePrinter printer = new PagePrinter(); Media media = new Media(); @@ -9773,10 +9822,10 @@ private PagePrinter SetupPrinter() { sheet.setPrintMech(true); sheet.setUnitImage(media.GetImage(CurVee.GetSSWImage())); printer.Append(BFBPrinter.Letter.toPage(), sheet); - + return printer; } - + private void FixMPSpinner() { // This fixes the walking MP spinner if the mech's tonnage changes. int MaxWalk = CurVee.getMaxCruiseMP(); @@ -10261,12 +10310,12 @@ public void lostOwnership(Clipboard clipboard, Transferable contents) { public void setUnit(ArrayList v) { this.setVee( (CombatVehicle) v.get(0) ); } - + public void setVee( CombatVehicle v ) { CurVee = v; LoadVehicleIntoGUI(); } - + public void loadUnitIntoGUI() { this.LoadVehicleIntoGUI(); } diff --git a/ssw/src/main/java/ssw/gui/EquipmentListRenderer.java b/ssw/src/main/java/ssw/gui/EquipmentListRenderer.java index c3f4b11b..0d927ab4 100644 --- a/ssw/src/main/java/ssw/gui/EquipmentListRenderer.java +++ b/ssw/src/main/java/ssw/gui/EquipmentListRenderer.java @@ -39,6 +39,10 @@ import filehandlers.FileCommon; public class EquipmentListRenderer extends DefaultListCellRenderer { + /** + * + */ + private static final long serialVersionUID = -8848264932602618278L; private ifMechForm Parent; private abPlaceable a = null; diff --git a/ssw/src/main/java/ssw/gui/EquipmentSelectedRenderer.java b/ssw/src/main/java/ssw/gui/EquipmentSelectedRenderer.java index 6248b4d4..3c626a97 100644 --- a/ssw/src/main/java/ssw/gui/EquipmentSelectedRenderer.java +++ b/ssw/src/main/java/ssw/gui/EquipmentSelectedRenderer.java @@ -36,6 +36,10 @@ import filehandlers.FileCommon; public class EquipmentSelectedRenderer extends DefaultListCellRenderer { + /** + * + */ + private static final long serialVersionUID = 7437464798284019170L; private ifMechForm Parent; private abPlaceable a = null; @@ -72,4 +76,4 @@ public Component getListCellRendererComponent(JList list, Object value, int inde return label; } -} \ No newline at end of file +} diff --git a/ssw/src/main/java/ssw/gui/ImagePreview.java b/ssw/src/main/java/ssw/gui/ImagePreview.java index b7b1c5ac..c92e2ffb 100644 --- a/ssw/src/main/java/ssw/gui/ImagePreview.java +++ b/ssw/src/main/java/ssw/gui/ImagePreview.java @@ -8,6 +8,10 @@ /* ImagePreview.java by FileChooserDemo2.java. */ public class ImagePreview extends JComponent implements PropertyChangeListener { + /** + * + */ + private static final long serialVersionUID = -785642359105414636L; ImageIcon thumbnail = null; File file = null; diff --git a/ssw/src/main/java/ssw/gui/LocationDragDatagram.java b/ssw/src/main/java/ssw/gui/LocationDragDatagram.java index 07a7f2ed..36dfa76b 100644 --- a/ssw/src/main/java/ssw/gui/LocationDragDatagram.java +++ b/ssw/src/main/java/ssw/gui/LocationDragDatagram.java @@ -35,6 +35,10 @@ import java.io.Serializable; public class LocationDragDatagram implements Serializable, Transferable { + /** + * + */ + private static final long serialVersionUID = 5755641028016259584L; public int Location = -1; public int SourceIndex = -1; public boolean Locked = false; diff --git a/ssw/src/main/java/ssw/gui/MechLoadoutRenderer.java b/ssw/src/main/java/ssw/gui/MechLoadoutRenderer.java index 0c62386f..83b70a0c 100644 --- a/ssw/src/main/java/ssw/gui/MechLoadoutRenderer.java +++ b/ssw/src/main/java/ssw/gui/MechLoadoutRenderer.java @@ -36,6 +36,10 @@ import components.*; public class MechLoadoutRenderer extends DefaultListCellRenderer { + /** + * + */ + private static final long serialVersionUID = -6819033611138896545L; private ifMechForm Parent; private Color EmptyFG, EmptyBG, diff --git a/ssw/src/main/java/ssw/gui/NumberRenderer.java b/ssw/src/main/java/ssw/gui/NumberRenderer.java index d808a6e9..bd3b5681 100644 --- a/ssw/src/main/java/ssw/gui/NumberRenderer.java +++ b/ssw/src/main/java/ssw/gui/NumberRenderer.java @@ -15,6 +15,11 @@ */ public class NumberRenderer extends DefaultTableCellRenderer { + /** + * + */ + private static final long serialVersionUID = 6548255602356231727L; + public NumberRenderer() { } diff --git a/ssw/src/main/java/ssw/gui/dlgCCGMech.java b/ssw/src/main/java/ssw/gui/dlgCCGMech.java index ddf3becf..3ea94a28 100644 --- a/ssw/src/main/java/ssw/gui/dlgCCGMech.java +++ b/ssw/src/main/java/ssw/gui/dlgCCGMech.java @@ -22,6 +22,10 @@ */ public class dlgCCGMech extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -4454863213045636732L; private Mech CurMech; private String NL; @@ -190,4 +194,3 @@ private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS // End of variables declaration//GEN-END:variables } - diff --git a/ssw/src/main/java/ssw/gui/dlgCostBVBreakdown.java b/ssw/src/main/java/ssw/gui/dlgCostBVBreakdown.java index a31e7070..60890bc2 100644 --- a/ssw/src/main/java/ssw/gui/dlgCostBVBreakdown.java +++ b/ssw/src/main/java/ssw/gui/dlgCostBVBreakdown.java @@ -33,6 +33,10 @@ public class dlgCostBVBreakdown extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = 4927619301628972669L; private Mech CurMech; private String NL; diff --git a/ssw/src/main/java/ssw/gui/dlgCredits.java b/ssw/src/main/java/ssw/gui/dlgCredits.java index 8a9408e2..b7178119 100644 --- a/ssw/src/main/java/ssw/gui/dlgCredits.java +++ b/ssw/src/main/java/ssw/gui/dlgCredits.java @@ -31,7 +31,12 @@ import ssw.constants.SSWConstants; public class dlgCredits extends javax.swing.JDialog { - + + /** + * + */ + private static final long serialVersionUID = 4858716341188790959L; + /** Creates new form dlgCredits */ public dlgCredits(java.awt.Frame parent, boolean modal) { super(parent, modal); @@ -39,7 +44,7 @@ public dlgCredits(java.awt.Frame parent, boolean modal) { setResizable( false ); setTitle( SSWConstants.AppName + " Credits" ); } - + /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is @@ -129,7 +134,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed dispose(); }//GEN-LAST:event_btnCloseActionPerformed - + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnClose; private javax.swing.JLabel jLabel1; @@ -139,5 +144,5 @@ private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel8; // End of variables declaration//GEN-END:variables - + } diff --git a/ssw/src/main/java/ssw/gui/dlgLicense.java b/ssw/src/main/java/ssw/gui/dlgLicense.java index 6b7321fc..c6c9de29 100644 --- a/ssw/src/main/java/ssw/gui/dlgLicense.java +++ b/ssw/src/main/java/ssw/gui/dlgLicense.java @@ -32,6 +32,11 @@ public class dlgLicense extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -4048615687999325205L; + /** Creates new form dlgLicense */ public dlgLicense(java.awt.Frame parent, boolean modal) { super(parent, modal); @@ -130,5 +135,5 @@ private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextArea jTextArea1; // End of variables declaration//GEN-END:variables - + } diff --git a/ssw/src/main/java/ssw/gui/dlgOmniBase.java b/ssw/src/main/java/ssw/gui/dlgOmniBase.java index 7190df80..e1845756 100644 --- a/ssw/src/main/java/ssw/gui/dlgOmniBase.java +++ b/ssw/src/main/java/ssw/gui/dlgOmniBase.java @@ -31,6 +31,10 @@ import filehandlers.Media; public class dlgOmniBase extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -1287880356816080697L; String input = ""; boolean cancel = false; @@ -137,7 +141,7 @@ private void OkayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:ev setVisible( false ); } }//GEN-LAST:event_OkayActionPerformed - + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton Okay; private javax.swing.JButton btnCancel; @@ -147,5 +151,5 @@ private void OkayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:ev private javax.swing.JPanel jPanel1; private javax.swing.JTextField txtLoadoutName; // End of variables declaration//GEN-END:variables - + } diff --git a/ssw/src/main/java/ssw/gui/dlgOpen.java b/ssw/src/main/java/ssw/gui/dlgOpen.java index 0a9eee6c..bef2a818 100644 --- a/ssw/src/main/java/ssw/gui/dlgOpen.java +++ b/ssw/src/main/java/ssw/gui/dlgOpen.java @@ -44,6 +44,10 @@ import ssw.print.Printer; public class dlgOpen extends javax.swing.JFrame implements PropertyChangeListener { + /** + * + */ + private static final long serialVersionUID = 7326880783593697067L; private ifMechForm parent; private UnitList list = new UnitList(); private Media media = new Media(); @@ -63,7 +67,7 @@ public dlgOpen(java.awt.Frame parent, boolean modal) { ImageIcon icon = new ImageIcon(super.getClass().getResource("/ssw/Images/appicon.png")); super.setIconImage(icon.getImage()); this.parent = (ifMechForm) parent; - + prgResaving.setVisible(false); cmbTech.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Tech", "Clan", "Inner Sphere", "Mixed" })); cmbEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Era", "Age of War/Star League", "Succession Wars", "Clan Invasion", "Dark Ages", "All Eras (non-canon)" })); @@ -72,7 +76,7 @@ public dlgOpen(java.awt.Frame parent, boolean modal) { cmbMotive.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Motive", "Biped", "Quad" })); NL = System.getProperty( "line.separator" ); } - + private void LoadMech() { switch ( Requestor ) { case SSW: @@ -139,7 +143,7 @@ public void LoadList(boolean useIndex) { this.lblStatus.setText("Loading Mechs..."); this.txtSelected.setText("0 Units Selected for 0 BV and 0 C-Bills"); this.tblMechData.setModel(new UnitList()); - + if (dirPath.isEmpty()) { dirPath = parent.GetPrefs().get("ListPath", parent.GetPrefs().get( "LastOpenDirectory", "" ) ); @@ -163,7 +167,7 @@ public void LoadList(boolean useIndex) { } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - + list = new UnitList(dirPath, useIndex); if (list.Size() > 0) { @@ -239,7 +243,7 @@ private void setTooltip( UnitListData data ) { //do nothing } } - + public void propertyChange( PropertyChangeEvent e ) { prgResaving.setValue( ((Resaver) e.getSource()).getProgress() ); } @@ -1254,7 +1258,7 @@ private void txtMaxCostFilter(java.awt.event.ActionEvent evt) {//GEN-FIRST:event private void btnClearFilterFilter(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearFilterFilter setupList(list, false); - + //clear the dropdowns cmbEra.setSelectedIndex(0); cmbMotive.setSelectedIndex(0); @@ -1383,7 +1387,7 @@ private void tblMechDataKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:ev private void btnViewForceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnViewForceActionPerformed lblForce.setText(""); - + //if ( tblMechData.getSelectedRowCount() > 0 ) { // btnAdd2ForceActionPerformed(evt); //} diff --git a/ssw/src/main/java/ssw/gui/dlgPlaceableInfo.java b/ssw/src/main/java/ssw/gui/dlgPlaceableInfo.java index 9db131ee..c8afcb2b 100644 --- a/ssw/src/main/java/ssw/gui/dlgPlaceableInfo.java +++ b/ssw/src/main/java/ssw/gui/dlgPlaceableInfo.java @@ -33,6 +33,10 @@ import components.abPlaceable; public class dlgPlaceableInfo extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = 7878421703509892901L; ifMechForm Parent; /** Creates new form dlgPlaceableInfo */ diff --git a/ssw/src/main/java/ssw/gui/dlgPrintBatchMechs.java b/ssw/src/main/java/ssw/gui/dlgPrintBatchMechs.java index 1911a530..b8da9e33 100644 --- a/ssw/src/main/java/ssw/gui/dlgPrintBatchMechs.java +++ b/ssw/src/main/java/ssw/gui/dlgPrintBatchMechs.java @@ -42,7 +42,12 @@ * @author Michael Mills */ public class dlgPrintBatchMechs extends javax.swing.JDialog { - private class mechData{ + /** + * + */ + private static final long serialVersionUID = 2957620689123290536L; + + private class mechData { public String name; public Mech m; public dlgPrintSavedMechOptions POptions; diff --git a/ssw/src/main/java/ssw/gui/dlgPrintBattleforce.java b/ssw/src/main/java/ssw/gui/dlgPrintBattleforce.java index 02c6161f..522991a5 100644 --- a/ssw/src/main/java/ssw/gui/dlgPrintBattleforce.java +++ b/ssw/src/main/java/ssw/gui/dlgPrintBattleforce.java @@ -20,6 +20,10 @@ * @author gblouin */ public class dlgPrintBattleforce extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = 5419050756388713021L; private BattleForce force; public boolean Result = false; public String Sheet = BattleForce.InnerSphere; diff --git a/ssw/src/main/java/ssw/gui/dlgPrintOptions.java b/ssw/src/main/java/ssw/gui/dlgPrintOptions.java index 4f6c1147..7d301921 100644 --- a/ssw/src/main/java/ssw/gui/dlgPrintOptions.java +++ b/ssw/src/main/java/ssw/gui/dlgPrintOptions.java @@ -34,6 +34,10 @@ import javax.print.*; public class dlgPrintOptions extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -3854640898103189648L; private Mech CurMech; private ifMechForm Parent; private boolean Result = false; @@ -66,7 +70,7 @@ public dlgPrintOptions( java.awt.Frame parent, boolean modal, Mech m ) { txtWarriorName.setEnabled( false ); } else { chkAdjustBV.setSelected(Parent.GetPrefs().getBoolean("AdjustPG", false)); - lblAdjustBV.setText( String.format( "%1$,.0f", CommonTools.GetAdjustedBV( CurMech.GetCurrentBV(), cmbGunnery.getSelectedIndex(), cmbPiloting.getSelectedIndex() ) ) ); + lblAdjustBV.setText( String.format( "%1$,.0f", CommonTools.GetAdjustedBV( CurMech.GetCurrentBV(), cmbGunnery.getSelectedIndex(), cmbPiloting.getSelectedIndex() ) ) ); } if (Parent.GetPrefs().getBoolean("UseA4", false)) { cmbPaperSize.setSelectedIndex(1); @@ -394,7 +398,7 @@ private void cmbPilotingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F private void cmbGunneryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbGunneryActionPerformed if( chkAdjustBV.isSelected() ) { - lblAdjustBV.setText( String.format( "%1$,.0f", CommonTools.GetAdjustedBV( CurMech.GetCurrentBV(), cmbGunnery.getSelectedIndex(), cmbPiloting.getSelectedIndex() ) ) ); + lblAdjustBV.setText( String.format( "%1$,.0f", CommonTools.GetAdjustedBV( CurMech.GetCurrentBV(), cmbGunnery.getSelectedIndex(), cmbPiloting.getSelectedIndex() ) ) ); } }//GEN-LAST:event_cmbGunneryActionPerformed @@ -416,7 +420,7 @@ private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR private void chkAdjustBVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkAdjustBVActionPerformed if( chkAdjustBV.isSelected() ) { - lblAdjustBV.setText( String.format( "%1$,.0f", CommonTools.GetAdjustedBV( CurMech.GetCurrentBV(), cmbGunnery.getSelectedIndex(), cmbPiloting.getSelectedIndex() ) ) ); + lblAdjustBV.setText( String.format( "%1$,.0f", CommonTools.GetAdjustedBV( CurMech.GetCurrentBV(), cmbGunnery.getSelectedIndex(), cmbPiloting.getSelectedIndex() ) ) ); } else { lblAdjustBV.setText( String.format( "%1$,d", CurMech.GetCurrentBV() ) ); } @@ -431,7 +435,7 @@ private void chkMWStatsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI cmbPiloting.setEnabled( false ); txtWarriorName.setEnabled( false ); } else { - lblAdjustBV.setText( String.format( "%1$,.0f", CommonTools.GetAdjustedBV( CurMech.GetCurrentBV(), cmbGunnery.getSelectedIndex(), cmbPiloting.getSelectedIndex() ) ) ); + lblAdjustBV.setText( String.format( "%1$,.0f", CommonTools.GetAdjustedBV( CurMech.GetCurrentBV(), cmbGunnery.getSelectedIndex(), cmbPiloting.getSelectedIndex() ) ) ); cmbGunnery.setEnabled( true ); cmbPiloting.setEnabled( true ); txtWarriorName.setEnabled( true ); diff --git a/ssw/src/main/java/ssw/gui/dlgPrintSavedMechOptions.java b/ssw/src/main/java/ssw/gui/dlgPrintSavedMechOptions.java index c8969afe..dfba383e 100644 --- a/ssw/src/main/java/ssw/gui/dlgPrintSavedMechOptions.java +++ b/ssw/src/main/java/ssw/gui/dlgPrintSavedMechOptions.java @@ -15,6 +15,10 @@ import Print.PrintMech; public class dlgPrintSavedMechOptions extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = 3443117870878903897L; private Mech CurMech; private ifMechForm Parent; private boolean Result = false; @@ -597,7 +601,7 @@ private void btnChooseImageActionPerformed(java.awt.event.ActionEvent evt) {//GE }//GEN-LAST:event_btnChooseImageActionPerformed private void chkPrintImageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkPrintImageActionPerformed - if ( CurMech != null ) { + if ( CurMech != null ) { btnChooseImage.setEnabled(chkPrintImage.isSelected()); } }//GEN-LAST:event_chkPrintImageActionPerformed diff --git a/ssw/src/main/java/ssw/gui/dlgQuirks.java b/ssw/src/main/java/ssw/gui/dlgQuirks.java index 3ec4471b..7c32584d 100644 --- a/ssw/src/main/java/ssw/gui/dlgQuirks.java +++ b/ssw/src/main/java/ssw/gui/dlgQuirks.java @@ -34,6 +34,10 @@ import list.view.tbQuirks; public class dlgQuirks extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = 4195412552625797884L; private DataFactory list; private ArrayList existingQuirks; private tbQuirks tblQ; @@ -212,13 +216,13 @@ private void btnDoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST private void tblListMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblListMouseClicked if ( evt.getClickCount() == 2 ) { btnAddActionPerformed(null); - } + } }//GEN-LAST:event_tblListMouseClicked private void tblSelectedMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblSelectedMouseClicked if ( evt.getClickCount() == 2 ) { btnRemoveActionPerformed(null); - } + } }//GEN-LAST:event_tblSelectedMouseClicked diff --git a/ssw/src/main/java/ssw/gui/dlgSSWFiles.java b/ssw/src/main/java/ssw/gui/dlgSSWFiles.java index a46c7230..256ebbc2 100644 --- a/ssw/src/main/java/ssw/gui/dlgSSWFiles.java +++ b/ssw/src/main/java/ssw/gui/dlgSSWFiles.java @@ -16,6 +16,10 @@ * @author gblouin */ public class dlgSSWFiles extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -3637541337185137321L; public boolean result = false; /** Creates new form dlgSSWFiles */ diff --git a/ssw/src/main/java/ssw/gui/dlgSelectiveAllocate.java b/ssw/src/main/java/ssw/gui/dlgSelectiveAllocate.java index 8651facf..410b1db2 100644 --- a/ssw/src/main/java/ssw/gui/dlgSelectiveAllocate.java +++ b/ssw/src/main/java/ssw/gui/dlgSelectiveAllocate.java @@ -37,6 +37,10 @@ public class dlgSelectiveAllocate extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -3069566157073941808L; ifMechForm Parent; abPlaceable Item = null; EquipmentCollection Items = null; @@ -119,7 +123,7 @@ private void InitializeSingle() { private void InitializeCollection() { abPlaceable CurItem = Items.GetType(); int size = CurItem.NumCrits(); - + if( Parent.GetMech().IsQuad() ) { ((TitledBorder) pnlRA.getBorder()).setTitle( "RFL" ); ((TitledBorder) pnlLA.getBorder()).setTitle( "LFL" ); @@ -550,9 +554,9 @@ private void spnHDCritsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI // update the labels to reflect the new values. lblHDQuant.setText( Alloc[LocationIndex.MECH_LOC_HD] + " of " + Crits[LocationIndex.MECH_LOC_HD] ); if( Item == null ) { - lblItemCrits.setText( total + " of " + Items.GetSize() + " Allocated" ); + lblItemCrits.setText( total + " of " + Items.GetSize() + " Allocated" ); } else { - lblItemCrits.setText( total + " of " + Item.NumCrits() + " Allocated" ); + lblItemCrits.setText( total + " of " + Item.NumCrits() + " Allocated" ); } }//GEN-LAST:event_spnHDCritsStateChanged @@ -601,9 +605,9 @@ private void spnRTCritsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI // update the labels to reflect the new values. lblRTQuant.setText( Alloc[LocationIndex.MECH_LOC_RT] + " of " + Crits[LocationIndex.MECH_LOC_RT] ); if( Item == null ) { - lblItemCrits.setText( total + " of " + Items.GetSize() + " Allocated" ); + lblItemCrits.setText( total + " of " + Items.GetSize() + " Allocated" ); } else { - lblItemCrits.setText( total + " of " + Item.NumCrits() + " Allocated" ); + lblItemCrits.setText( total + " of " + Item.NumCrits() + " Allocated" ); } }//GEN-LAST:event_spnRTCritsStateChanged @@ -652,9 +656,9 @@ private void spnLTCritsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI // update the labels to reflect the new values. lblLTQuant.setText( Alloc[LocationIndex.MECH_LOC_LT] + " of " + Crits[LocationIndex.MECH_LOC_LT] ); if( Item == null ) { - lblItemCrits.setText( total + " of " + Items.GetSize() + " Allocated" ); + lblItemCrits.setText( total + " of " + Items.GetSize() + " Allocated" ); } else { - lblItemCrits.setText( total + " of " + Item.NumCrits() + " Allocated" ); + lblItemCrits.setText( total + " of " + Item.NumCrits() + " Allocated" ); } }//GEN-LAST:event_spnLTCritsStateChanged @@ -703,9 +707,9 @@ private void spnCTCritsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI // update the labels to reflect the new values. lblCTQuant.setText( Alloc[LocationIndex.MECH_LOC_CT] + " of " + Crits[LocationIndex.MECH_LOC_CT] ); if( Item == null ) { - lblItemCrits.setText( total + " of " + Items.GetSize() + " Allocated" ); + lblItemCrits.setText( total + " of " + Items.GetSize() + " Allocated" ); } else { - lblItemCrits.setText( total + " of " + Item.NumCrits() + " Allocated" ); + lblItemCrits.setText( total + " of " + Item.NumCrits() + " Allocated" ); } }//GEN-LAST:event_spnCTCritsStateChanged @@ -754,9 +758,9 @@ private void spnLACritsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI // update the labels to reflect the new values. lblLAQuant.setText( Alloc[LocationIndex.MECH_LOC_LA] + " of " + Crits[LocationIndex.MECH_LOC_LA] ); if( Item == null ) { - lblItemCrits.setText( total + " of " + Items.GetSize() + " Allocated" ); + lblItemCrits.setText( total + " of " + Items.GetSize() + " Allocated" ); } else { - lblItemCrits.setText( total + " of " + Item.NumCrits() + " Allocated" ); + lblItemCrits.setText( total + " of " + Item.NumCrits() + " Allocated" ); } }//GEN-LAST:event_spnLACritsStateChanged @@ -805,9 +809,9 @@ private void spnRACritsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI // update the labels to reflect the new values. lblRAQuant.setText( Alloc[LocationIndex.MECH_LOC_RA] + " of " + Crits[LocationIndex.MECH_LOC_RA] ); if( Item == null ) { - lblItemCrits.setText( total + " of " + Items.GetSize() + " Allocated" ); + lblItemCrits.setText( total + " of " + Items.GetSize() + " Allocated" ); } else { - lblItemCrits.setText( total + " of " + Item.NumCrits() + " Allocated" ); + lblItemCrits.setText( total + " of " + Item.NumCrits() + " Allocated" ); } }//GEN-LAST:event_spnRACritsStateChanged @@ -856,9 +860,9 @@ private void spnLLCritsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI // update the labels to reflect the new values. lblLLQuant.setText( Alloc[LocationIndex.MECH_LOC_LL] + " of " + Crits[LocationIndex.MECH_LOC_LL] ); if( Item == null ) { - lblItemCrits.setText( total + " of " + Items.GetSize() + " Allocated" ); + lblItemCrits.setText( total + " of " + Items.GetSize() + " Allocated" ); } else { - lblItemCrits.setText( total + " of " + Item.NumCrits() + " Allocated" ); + lblItemCrits.setText( total + " of " + Item.NumCrits() + " Allocated" ); } }//GEN-LAST:event_spnLLCritsStateChanged @@ -907,12 +911,12 @@ private void spnRLCritsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI // update the labels to reflect the new values. lblRLQuant.setText( Alloc[LocationIndex.MECH_LOC_RL] + " of " + Crits[LocationIndex.MECH_LOC_RL] ); if( Item == null ) { - lblItemCrits.setText( total + " of " + Items.GetSize() + " Allocated" ); + lblItemCrits.setText( total + " of " + Items.GetSize() + " Allocated" ); } else { - lblItemCrits.setText( total + " of " + Item.NumCrits() + " Allocated" ); + lblItemCrits.setText( total + " of " + Item.NumCrits() + " Allocated" ); } }//GEN-LAST:event_spnRLCritsStateChanged - + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnCancel; private javax.swing.JButton btnOkay; @@ -944,5 +948,5 @@ private void spnRLCritsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI private javax.swing.JSpinner spnRLCrits; private javax.swing.JSpinner spnRTCrits; // End of variables declaration//GEN-END:variables - + } diff --git a/ssw/src/main/java/ssw/gui/dlgSplitCrits.java b/ssw/src/main/java/ssw/gui/dlgSplitCrits.java index 55bb42f4..7159e760 100644 --- a/ssw/src/main/java/ssw/gui/dlgSplitCrits.java +++ b/ssw/src/main/java/ssw/gui/dlgSplitCrits.java @@ -35,6 +35,10 @@ public class dlgSplitCrits extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = 5607979630893009085L; abPlaceable ItemToPlace; ifMechForm Parent; int FirstLoc = 0, @@ -400,7 +404,7 @@ private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR result = false; setVisible( false ); }//GEN-LAST:event_btnCancelActionPerformed - + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnCancel; private javax.swing.JButton btnOkay; @@ -412,5 +416,5 @@ private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR private javax.swing.JLabel lblFirstLoc; private javax.swing.JLabel lblItemName; // End of variables declaration//GEN-END:variables - + } diff --git a/ssw/src/main/java/ssw/gui/dlgSummaryInfo.java b/ssw/src/main/java/ssw/gui/dlgSummaryInfo.java index 44a8ae58..43912fa9 100644 --- a/ssw/src/main/java/ssw/gui/dlgSummaryInfo.java +++ b/ssw/src/main/java/ssw/gui/dlgSummaryInfo.java @@ -31,6 +31,10 @@ import components.AvailableCode; public class dlgSummaryInfo extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = 2331190294631798531L; ifMechForm Parent; /** Creates new form dlgSummaryInfo */ @@ -433,7 +437,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { private void btnOkayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkayActionPerformed dispose(); }//GEN-LAST:event_btnOkayActionPerformed - + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnOkay; private javax.swing.JLabel jLabel1; @@ -469,5 +473,5 @@ private void btnOkayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST private javax.swing.JLabel lblTotalDryWeight; private javax.swing.JLabel lblTotalWeight; // End of variables declaration//GEN-END:variables - + } diff --git a/ssw/src/main/java/ssw/gui/dlgTechBaseChooser.java b/ssw/src/main/java/ssw/gui/dlgTechBaseChooser.java index eaf2c0ec..f1718599 100644 --- a/ssw/src/main/java/ssw/gui/dlgTechBaseChooser.java +++ b/ssw/src/main/java/ssw/gui/dlgTechBaseChooser.java @@ -29,6 +29,10 @@ package ssw.gui; public class dlgTechBaseChooser extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -639541620979483392L; private boolean Clan = false; /** Creates new form dlgTechBaseChooser */ diff --git a/ssw/src/main/java/ssw/gui/dlgTextExport.java b/ssw/src/main/java/ssw/gui/dlgTextExport.java index 2882f6f7..56084786 100644 --- a/ssw/src/main/java/ssw/gui/dlgTextExport.java +++ b/ssw/src/main/java/ssw/gui/dlgTextExport.java @@ -33,6 +33,11 @@ public class dlgTextExport extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = 7071345474929035366L; + /** Creates new form dlgTextExport */ public dlgTextExport(java.awt.Frame parent, boolean modal, Mech m ) { super(parent, modal); diff --git a/ssw/src/main/java/ssw/gui/dlgVariableSize.java b/ssw/src/main/java/ssw/gui/dlgVariableSize.java index 38950c69..1983e628 100644 --- a/ssw/src/main/java/ssw/gui/dlgVariableSize.java +++ b/ssw/src/main/java/ssw/gui/dlgVariableSize.java @@ -33,6 +33,10 @@ public class dlgVariableSize extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = 6176467832586662183L; private Equipment CurEquip; private double CurTons; private boolean result = true; diff --git a/ssw/src/main/java/ssw/gui/dlgWeaponInfo.java b/ssw/src/main/java/ssw/gui/dlgWeaponInfo.java index 90f3ccac..58b81dd1 100644 --- a/ssw/src/main/java/ssw/gui/dlgWeaponInfo.java +++ b/ssw/src/main/java/ssw/gui/dlgWeaponInfo.java @@ -32,6 +32,10 @@ import components.*; public class dlgWeaponInfo extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -508149963735523810L; ifMechForm Parent; /** Creates new form dlgItemInfo */ @@ -975,7 +979,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed dispose(); }//GEN-LAST:event_btnCloseActionPerformed - + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnClose; private javax.swing.JLabel jLabel1; @@ -1055,5 +1059,5 @@ private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS private javax.swing.JPanel pnlClanAvailability; private javax.swing.JPanel pnlISAvailability; // End of variables declaration//GEN-END:variables - + } diff --git a/ssw/src/main/java/ssw/gui/frmCompat.java b/ssw/src/main/java/ssw/gui/frmCompat.java index dc9ea80d..05a9a4d1 100644 --- a/ssw/src/main/java/ssw/gui/frmCompat.java +++ b/ssw/src/main/java/ssw/gui/frmCompat.java @@ -32,6 +32,11 @@ public class frmCompat extends javax.swing.JFrame { + /** + * + */ + private static final long serialVersionUID = 7124821475700356184L; + /** Creates new form frmCompat */ public frmCompat() { initComponents(); diff --git a/ssw/src/main/java/ssw/gui/frmMain.java b/ssw/src/main/java/ssw/gui/frmMain.java index a57306e2..b9b5b1cf 100644 --- a/ssw/src/main/java/ssw/gui/frmMain.java +++ b/ssw/src/main/java/ssw/gui/frmMain.java @@ -59,6 +59,11 @@ import java.util.prefs.Preferences; public class frmMain extends javax.swing.JFrame implements java.awt.datatransfer.ClipboardOwner, common.DesignForm, ifMechForm { + /** + * + */ + private static final long serialVersionUID = 2308727814118207666L; + FocusAdapter spinners = new FocusAdapter() { @Override public void focusGained(FocusEvent e) { @@ -139,7 +144,7 @@ public void run() { final int BALLISTIC = 0, ENERGY = 1, MISSILE = 2, - PHYSICAL = 3, + PHYSICAL = 3, EQUIPMENT = 4, AMMUNITION = 6, SELECTED = 7, @@ -256,7 +261,7 @@ public void actionPerformed(ActionEvent e) { LaserInsulator(); } }); - + mnuAddPulseModule.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { PulseModule(); @@ -466,6 +471,11 @@ public void actionPerformed(ActionEvent e) { txtSumPAmpsACode.setVisible( false ); tblWeaponManufacturers.setModel( new javax.swing.table.AbstractTableModel() { + /** + * + */ + private static final long serialVersionUID = 6932836760592287993L; + @Override public String getColumnName( int col ) { if( col == 1 ) { @@ -1552,7 +1562,7 @@ private void RecalcCockpit() { String LookupVal = (String) cmbCockpitType.getSelectedItem(); if( OldVal.equals( LookupVal ) ) { return; } ifVisitor v = (ifVisitor) CurMech.Lookup( LookupVal ); - + try { CurMech.Visit( v ); } catch( Exception e ) { @@ -1570,7 +1580,7 @@ private void RecalcCockpit() { if ( !CurMech.GetGyro().LookupName().equals(cmbGyroType.getSelectedItem().toString()) ) cmbGyroType.setSelectedItem(CurMech.GetGyro().LookupName()); - + // check the command console and ejection seat if( CurMech.GetCockpit().CanUseCommandConsole() && CommonTools.IsAllowed( CurMech.GetCommandConsole().GetAvailability(), CurMech ) ) { chkCommandConsole.setEnabled( true ); @@ -2396,7 +2406,7 @@ private void CheckAES() { chkRAAES.setSelected( false ); } else { int index = CurMech.GetLoadout().FindIndex( CurMech.GetRAAES() ).Index; - try { + try { CurMech.SetRAAES( false, -1 ); CurMech.SetRAAES( true, index ); } catch( Exception e ) { @@ -2409,7 +2419,7 @@ private void CheckAES() { chkLAAES.setSelected( false ); } else { int index = CurMech.GetLoadout().FindIndex( CurMech.GetLAAES() ).Index; - try { + try { CurMech.SetLAAES( false, -1 ); CurMech.SetLAAES( true, index ); } catch( Exception e ) { @@ -2831,7 +2841,7 @@ private void GetInfoOn() { ItemInfo.setVisible( true ); } } - + private void ResetQuirks() { quirks = new ArrayList<>(); tblQuirks.setModel(new javax.swing.table.DefaultTableModel( @@ -2992,7 +3002,7 @@ private void ShowInfoOn( abPlaceable p ) { restrict += "Can Split, "; } - // now for weapon and ammo specific + // now for weapon and ammo specific if( p instanceof ifWeapon ) { ifWeapon w = (ifWeapon) p; lblInfoType.setText( w.GetType() ); @@ -3824,7 +3834,7 @@ private void LaserInsulator() { } RefreshInfoPane(); } - + private void PulseModule() { // if the current item can support a Pulse Module, adds one on if( CurItem instanceof RangedWeapon ) { @@ -3918,7 +3928,7 @@ private void TurretMount() { private void DumperMount() { if ( CurItem instanceof Equipment ) { - + } } @@ -4344,7 +4354,7 @@ private void CheckFileName( String s ) throws Exception { private void SolidifyJJManufacturer() { // this method is used mainly for OmniMechs with varying jump jet loads if( ! txtJJModel.getText().equals( "" ) || ! CurMech.GetJJModel().equals( "" ) ) { - if( ! txtJJModel.getText().equals( CurMech.GetJJModel() ) ) { + if( ! txtJJModel.getText().equals( CurMech.GetJJModel() ) ) { CurMech.SetJJModel( txtJJModel.getText() ); } } @@ -4740,7 +4750,7 @@ private void RefreshSelectedEquipment() { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - // + // // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; @@ -10671,7 +10681,7 @@ private void CloseProgram() { System.out.println(e.getMessage()); } System.out.flush(); - + System.exit(0); } @@ -11311,7 +11321,7 @@ private void cmbMotiveTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN cmbCockpitType.setSelectedItem("Standard Cockpit"); RecalcCockpit(); } - + CurMech.SetBiped(); SetPatchworkArmor(); // internal structure is always reset to standard on changing the @@ -12867,7 +12877,7 @@ private void btnLockChassisActionPerformed(java.awt.event.ActionEvent evt) {//GE tbpMainTabPane.setSelectedComponent( pnlCriticals ); return; } - + // 2020-10-19 Omnis can't have Hardened Armor, but we wrote this generic // in case later other armor types com along if (!CurMech.GetArmor().AllowOmni()){ @@ -12966,7 +12976,7 @@ private void btnAddVariantActionPerformed(java.awt.event.ActionEvent evt) {//GEN RefreshInfoPane(); }//GEN-LAST:event_btnAddVariantActionPerformed - private void mnuOpenActionPerformed(java.awt.event.ActionEvent evt) { + private void mnuOpenActionPerformed(java.awt.event.ActionEvent evt) { //dlgOpen dOpen = new dlgOpen(this, true); if( CurMech.HasChanged() ) { int choice = javax.swing.JOptionPane.showConfirmDialog( this, @@ -14952,7 +14962,7 @@ private void chkBoobyTrapActionPerformed(java.awt.event.ActionEvent evt) {//GEN- Media.Messager( this, e.getMessage() ); chkBoobyTrap.setSelected( false ); } - + // now refresh the information panes RefreshEquipment(); RefreshSummary(); @@ -15536,7 +15546,7 @@ private void setViewToolbar(boolean Visible) public ImageTracker getImageTracker() { return imageTracker; } - + public void setUnit( ArrayList v ) { this.setMech( (Mech) v.get(0) ); } diff --git a/ssw/src/main/java/ssw/gui/frmMainWide.java b/ssw/src/main/java/ssw/gui/frmMainWide.java index 6a5bfe4e..596ca1c7 100644 --- a/ssw/src/main/java/ssw/gui/frmMainWide.java +++ b/ssw/src/main/java/ssw/gui/frmMainWide.java @@ -59,6 +59,10 @@ public class frmMainWide extends javax.swing.JFrame implements java.awt.datatransfer.ClipboardOwner, common.DesignForm, ifMechForm { + /** + * + */ + private static final long serialVersionUID = -5685712596481252262L; String[] Selections = { "", "", "", "", "", "", "", "" }; Mech CurMech; VSetArmorTonnage ArmorTons; @@ -124,7 +128,7 @@ public class frmMainWide extends javax.swing.JFrame implements java.awt.datatran final int BALLISTIC = 0, ENERGY = 1, MISSILE = 2, - PHYSICAL = 3, + PHYSICAL = 3, EQUIPMENT = 4, AMMUNITION = 6, SELECTED = 7, @@ -242,7 +246,7 @@ public void actionPerformed(ActionEvent e) { LaserInsulator(); } }); - + mnuAddPulseModule.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { PulseModule(); @@ -446,6 +450,11 @@ public void actionPerformed(ActionEvent e) { txtSumPAmpsACode.setVisible( false ); tblWeaponManufacturers.setModel( new javax.swing.table.AbstractTableModel() { + /** + * + */ + private static final long serialVersionUID = -5390969271554214836L; + @Override public String getColumnName( int col ) { if( col == 1 ) { @@ -1547,7 +1556,7 @@ private void RecalcCockpit() { if ( !CurMech.GetGyro().LookupName().equals(cmbGyroType.getSelectedItem().toString()) ) cmbGyroType.setSelectedItem(CurMech.GetGyro().LookupName()); - + // check the command console and ejection seat if( CurMech.GetCockpit().CanUseCommandConsole() && CommonTools.IsAllowed( CurMech.GetCommandConsole().GetAvailability(), CurMech ) ) { chkCommandConsole.setEnabled( true ); @@ -2373,7 +2382,7 @@ private void CheckAES() { chkRAAES.setSelected( false ); } else { int index = CurMech.GetLoadout().FindIndex( CurMech.GetRAAES() ).Index; - try { + try { CurMech.SetRAAES( false, -1 ); CurMech.SetRAAES( true, index ); } catch( Exception e ) { @@ -2386,7 +2395,7 @@ private void CheckAES() { chkLAAES.setSelected( false ); } else { int index = CurMech.GetLoadout().FindIndex( CurMech.GetLAAES() ).Index; - try { + try { CurMech.SetLAAES( false, -1 ); CurMech.SetLAAES( true, index ); } catch( Exception e ) { @@ -2890,7 +2899,7 @@ private void ShowInfoOn( abPlaceable p ) { restrict += "Can Split, "; } - // now for weapon and ammo specific + // now for weapon and ammo specific if( p instanceof ifWeapon ) { ifWeapon w = (ifWeapon) p; lblInfoType.setText( w.GetType() ); @@ -3724,7 +3733,7 @@ private void LaserInsulator() { } RefreshInfoPane(); } - + private void PulseModule() { // if the current item can support a Pulse Module, adds one on if( CurItem instanceof RangedWeapon ) { @@ -4232,7 +4241,7 @@ private void CheckFileName( String s ) throws Exception { private void SolidifyJJManufacturer() { // this method is used mainly for OmniMechs with varying jump jet loads if( ! txtJJModel.getText().equals( "" ) || ! CurMech.GetJJModel().equals( "" ) ) { - if( ! txtJJModel.getText().equals( CurMech.GetJJModel() ) ) { + if( ! txtJJModel.getText().equals( CurMech.GetJJModel() ) ) { CurMech.SetJJModel( txtJJModel.getText() ); } } @@ -4627,7 +4636,7 @@ private void RefreshSelectedEquipment() { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - // + // // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; @@ -10525,7 +10534,7 @@ private void mnuNewMechActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI Prefs.put("Currentfile", ""); }//GEN-LAST:event_mnuNewMechActionPerformed - private void mnuOpenActionPerformed(java.awt.event.ActionEvent evt) { + private void mnuOpenActionPerformed(java.awt.event.ActionEvent evt) { //dlgOpen dOpen = new dlgOpen(this, true); if( CurMech.HasChanged() ) { int choice = javax.swing.JOptionPane.showConfirmDialog( this, @@ -13666,7 +13675,7 @@ private void btnLockChassisActionPerformed(java.awt.event.ActionEvent evt) {//GE tbpMainTabPane.setSelectedComponent( pnlEquipment ); return; } - + // 2020-10-19 Omnis can't have Hardened Armor, but we wrote this generic // in case later other armor types com along if (!CurMech.GetArmor().AllowOmni()){ @@ -15314,7 +15323,7 @@ private void setViewToolbar(boolean Visible) public ImageTracker getImageTracker() { return imageTracker; } - + public void setUnit( ArrayList v ) { this.setMech( (Mech) v.get(0) ); } diff --git a/ssw/src/main/java/ssw/gui/thCLTransferHandler.java b/ssw/src/main/java/ssw/gui/thCLTransferHandler.java index 0c76cbf9..b97d7d1b 100644 --- a/ssw/src/main/java/ssw/gui/thCLTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thCLTransferHandler.java @@ -38,6 +38,10 @@ import components.*; public class thCLTransferHandler extends TransferHandler { + /** + * + */ + private static final long serialVersionUID = 7787779340594172128L; private ifMechForm Parent; private Mech CurMech; diff --git a/ssw/src/main/java/ssw/gui/thCTTransferHandler.java b/ssw/src/main/java/ssw/gui/thCTTransferHandler.java index a8553e6d..ca0495ef 100644 --- a/ssw/src/main/java/ssw/gui/thCTTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thCTTransferHandler.java @@ -38,6 +38,10 @@ import components.*; public class thCTTransferHandler extends TransferHandler { + /** + * + */ + private static final long serialVersionUID = 2118239529569207568L; private ifMechForm Parent; private Mech CurMech; diff --git a/ssw/src/main/java/ssw/gui/thHDTransferHandler.java b/ssw/src/main/java/ssw/gui/thHDTransferHandler.java index 8cc988c6..7987799b 100644 --- a/ssw/src/main/java/ssw/gui/thHDTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thHDTransferHandler.java @@ -36,6 +36,10 @@ import components.*; public class thHDTransferHandler extends TransferHandler { + /** + * + */ + private static final long serialVersionUID = 7929605329416582869L; private ifMechForm Parent; private Mech CurMech; diff --git a/ssw/src/main/java/ssw/gui/thLATransferHandler.java b/ssw/src/main/java/ssw/gui/thLATransferHandler.java index b0d38864..6f7a28a7 100644 --- a/ssw/src/main/java/ssw/gui/thLATransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thLATransferHandler.java @@ -38,6 +38,10 @@ import components.*; public class thLATransferHandler extends TransferHandler { + /** + * + */ + private static final long serialVersionUID = 2852812337385741700L; private ifMechForm Parent; private Mech CurMech; diff --git a/ssw/src/main/java/ssw/gui/thLLTransferHandler.java b/ssw/src/main/java/ssw/gui/thLLTransferHandler.java index 9c172baa..8479040b 100644 --- a/ssw/src/main/java/ssw/gui/thLLTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thLLTransferHandler.java @@ -38,6 +38,10 @@ import components.*; public class thLLTransferHandler extends TransferHandler { + /** + * + */ + private static final long serialVersionUID = -6496360274416983909L; private ifMechForm Parent; private Mech CurMech; diff --git a/ssw/src/main/java/ssw/gui/thLTTransferHandler.java b/ssw/src/main/java/ssw/gui/thLTTransferHandler.java index 634b7054..2f6e03a7 100644 --- a/ssw/src/main/java/ssw/gui/thLTTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thLTTransferHandler.java @@ -38,6 +38,10 @@ import components.*; public class thLTTransferHandler extends TransferHandler { + /** + * + */ + private static final long serialVersionUID = -7426866431514668430L; private ifMechForm Parent; private Mech CurMech; diff --git a/ssw/src/main/java/ssw/gui/thQueueTransferHandler.java b/ssw/src/main/java/ssw/gui/thQueueTransferHandler.java index d96dcdb0..d1ed3bab 100644 --- a/ssw/src/main/java/ssw/gui/thQueueTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thQueueTransferHandler.java @@ -35,6 +35,11 @@ public class thQueueTransferHandler extends TransferHandler { + /** + * + */ + private static final long serialVersionUID = 6747422530397892520L; + // the Queue transfer handler only deals with exporting to other list boxes. // other listeners will deal with adding items to the queue. @Override @@ -50,4 +55,4 @@ public Transferable createTransferable( JComponent comp ) { public int getSourceActions( JComponent c ) { return MOVE; } -} \ No newline at end of file +} diff --git a/ssw/src/main/java/ssw/gui/thRATransferHandler.java b/ssw/src/main/java/ssw/gui/thRATransferHandler.java index 48e7faaa..10004de5 100644 --- a/ssw/src/main/java/ssw/gui/thRATransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thRATransferHandler.java @@ -38,6 +38,10 @@ import components.*; public class thRATransferHandler extends TransferHandler { + /** + * + */ + private static final long serialVersionUID = 1183780725264049577L; private ifMechForm Parent; private Mech CurMech; diff --git a/ssw/src/main/java/ssw/gui/thRLTransferHandler.java b/ssw/src/main/java/ssw/gui/thRLTransferHandler.java index 195077e8..6edd4a17 100644 --- a/ssw/src/main/java/ssw/gui/thRLTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thRLTransferHandler.java @@ -38,6 +38,10 @@ import components.*; public class thRLTransferHandler extends TransferHandler { + /** + * + */ + private static final long serialVersionUID = -5724370124550967979L; private ifMechForm Parent; private Mech CurMech; diff --git a/ssw/src/main/java/ssw/gui/thRTTransferHandler.java b/ssw/src/main/java/ssw/gui/thRTTransferHandler.java index 943e61ff..f568ad0b 100644 --- a/ssw/src/main/java/ssw/gui/thRTTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thRTTransferHandler.java @@ -38,6 +38,10 @@ import components.*; public class thRTTransferHandler extends TransferHandler { + /** + * + */ + private static final long serialVersionUID = -8610406421212093084L; private ifMechForm Parent; private Mech CurMech; diff --git a/ssw/src/main/java/ssw/printpreview/BrowseAction.java b/ssw/src/main/java/ssw/printpreview/BrowseAction.java index 97e30db8..a1c36096 100644 --- a/ssw/src/main/java/ssw/printpreview/BrowseAction.java +++ b/ssw/src/main/java/ssw/printpreview/BrowseAction.java @@ -26,7 +26,12 @@ import javax.swing.ImageIcon; class BrowseAction extends AbstractAction { - public BrowseAction(String name, String iconName, Preview preview, int pageStep ) { + /** + * + */ + private static final long serialVersionUID = -6790125631407379202L; + + public BrowseAction(String name, String iconName, Preview preview, int pageStep) { super(); if ( !name.isEmpty() ) { this.putValue(Action.NAME, name); @@ -45,12 +50,12 @@ public BrowseAction(String name, String iconName, Preview preview, int pageStep public BrowseAction(Preview preview, int pageStep) { this("", "", preview, pageStep); } - + public void actionPerformed(ActionEvent e) { preview.moveIndex(pageStep); preview.repaint(); } - + protected Preview preview; protected int pageStep; } diff --git a/ssw/src/main/java/ssw/printpreview/Preview.java b/ssw/src/main/java/ssw/printpreview/Preview.java index 73f16744..282d3638 100644 --- a/ssw/src/main/java/ssw/printpreview/Preview.java +++ b/ssw/src/main/java/ssw/printpreview/Preview.java @@ -32,6 +32,10 @@ import javax.swing.JComponent; class Preview extends JComponent { + /** + * + */ + private static final long serialVersionUID = 7655013771128802932L; private final static int DEFAULT_PREVIEW_SIZE = 1024; private final static double MINIMUM_ZOOM_FACTOR = 0.1; private Dimension viewportSize; @@ -44,19 +48,19 @@ public Preview(Pageable pageable, double zoom, Dimension viewport) { public Preview(Pageable pageable, double zoom) { this(pageable, zoom, new Dimension(1024,768)); } - + protected void paintPaper(Graphics g, PageFormat format) { g.setColor(Color.white); - g.fillRect(0, 0, (int)format.getWidth(), (int)format.getHeight()); + g.fillRect(0, 0, (int)format.getWidth(), (int)format.getHeight()); g.setColor(Color.black); - g.drawRect(0, 0, (int)format.getWidth() - 1, (int)format.getHeight() - 1); + g.drawRect(0, 0, (int)format.getWidth() - 1, (int)format.getHeight() - 1); } - + public void paint(Graphics g) { Graphics2D g2d = (Graphics2D)g; g2d.scale(zoom, zoom); try { - PageFormat format = pageable.getPageFormat(index); + PageFormat format = pageable.getPageFormat(index); Printable printable = pageable.getPrintable(index); paintPaper(g, format); printable.print(g, format, 0); @@ -84,7 +88,7 @@ public void moveIndex(int indexStep) { } catch (IndexOutOfBoundsException ignored) { } } - + public void changeZoom(double zoom) { this.zoom = Math.max(MINIMUM_ZOOM_FACTOR, this.zoom + zoom); resize(); @@ -108,14 +112,14 @@ public double getHeightZoom() { PageFormat format = pageable.getPageFormat(index); return viewportSize.height / format.getHeight(); } - + public void resize() { PageFormat format = pageable.getPageFormat(index); int size = (int)Math.max(format.getWidth() * zoom, format.getHeight() * zoom); setPreferredSize(new Dimension(size, size)); revalidate(); } - + public Dimension getMinimumSize() { return getPreferredSize(); } @@ -123,7 +127,7 @@ public Dimension getMinimumSize() { public void setViewportSize( Dimension viewportSize ) { this.viewportSize = viewportSize; } - + protected Pageable pageable; protected int index = 0; protected double zoom = 0.0; diff --git a/ssw/src/main/java/ssw/printpreview/PreviewDialog.java b/ssw/src/main/java/ssw/printpreview/PreviewDialog.java index f02ad6e3..a02e1a86 100644 --- a/ssw/src/main/java/ssw/printpreview/PreviewDialog.java +++ b/ssw/src/main/java/ssw/printpreview/PreviewDialog.java @@ -37,11 +37,15 @@ import javax.swing.JToolBar; public class PreviewDialog extends JDialog implements ActionListener { + /** + * + */ + private static final long serialVersionUID = 1605033753736903745L; private final static double DEFAULT_ZOOM_FACTOR_STEP = .5; public PreviewDialog(String title, JFrame owner, Pageable pageable, double zoom) { super(owner, title, true); - this.pageable = pageable; + this.pageable = pageable; Preview preview = new Preview(pageable, zoom); JScrollPane scrollPane = new JScrollPane(preview); getContentPane().add(scrollPane, "Center"); @@ -52,7 +56,7 @@ public PreviewDialog(String title, JFrame owner, Pageable pageable, double zoom) toolbar.add(getButton( "Back", "Back24.gif", new BrowseAction(preview, -1))); toolbar.add(getButton( "Forward", "Forward24.gif", new BrowseAction(preview, 1))); toolbar.add(new JToolBar.Separator()); - toolbar.add(getButton( "Zoom +", "ZoomIn24.gif", new ZoomAction(preview, DEFAULT_ZOOM_FACTOR_STEP))); + toolbar.add(getButton( "Zoom +", "ZoomIn24.gif", new ZoomAction(preview, DEFAULT_ZOOM_FACTOR_STEP))); toolbar.add(getButton( "Zoom -", "ZoomOut24.gif", new ZoomAction(preview, -DEFAULT_ZOOM_FACTOR_STEP))); toolbar.add(new JToolBar.Separator()); JPanel dialog = new JPanel(); @@ -60,9 +64,9 @@ public PreviewDialog(String title, JFrame owner, Pageable pageable, double zoom) JButton ok = new JButton("OK"); ok.addActionListener(this); dialog.add(ok); - getContentPane().add(dialog, "South"); + getContentPane().add(dialog, "South"); } - + public PreviewDialog(String title, JFrame owner, Pageable pageable) { this(title, owner, pageable, 0.0); } @@ -74,33 +78,33 @@ public PreviewDialog(String title, JFrame owner, Printable printable, PageFormat public PreviewDialog(String title, JFrame owner, Printable printable, PageFormat format, int pages) { this(title, owner, printable, format, pages, 0.0); } - + private static class MyPageable implements Pageable { public MyPageable(Printable printable, PageFormat format, int pages) { this.printable = printable; this.format = format; this.pages = pages; } - - public int getNumberOfPages() { - return pages; + + public int getNumberOfPages() { + return pages; } - + public Printable getPrintable(int index) { if (index >= pages) throw new IndexOutOfBoundsException(); return printable; } - + public PageFormat getPageFormat(int index) { if (index >= pages) throw new IndexOutOfBoundsException(); return format; } - + private Printable printable; private PageFormat format; private int pages; } - + private JButton getButton(String iconName) { return getButton(null, iconName, null); } @@ -108,20 +112,20 @@ private JButton getButton(String iconName) { private JButton getButton(String iconName, AbstractAction action) { return getButton(null, iconName, action); } - + private JButton getButton(String name, String iconName, AbstractAction action) { JButton result = null; - ImageIcon icon = null; + ImageIcon icon = null; icon = new ImageIcon(getClass().getResource("/ssw/Images/" + iconName)); if (action != null) { if (icon != null) action.putValue(Action.SMALL_ICON, icon); - if (name != null) action.putValue(Action.NAME, name); + if (name != null) action.putValue(Action.NAME, name); result = new JButton(action); - } else + } else result = new JButton(name, icon); - + return result; } @@ -132,6 +136,6 @@ private void Refresh() { public void actionPerformed(ActionEvent e) { dispose(); } - + protected Pageable pageable; } diff --git a/ssw/src/main/java/ssw/printpreview/ZoomAction.java b/ssw/src/main/java/ssw/printpreview/ZoomAction.java index 39f71fb3..49eeac1d 100644 --- a/ssw/src/main/java/ssw/printpreview/ZoomAction.java +++ b/ssw/src/main/java/ssw/printpreview/ZoomAction.java @@ -26,6 +26,11 @@ import javax.swing.ImageIcon; class ZoomAction extends AbstractAction { + /** + * + */ + private static final long serialVersionUID = -6176865184343138575L; + public ZoomAction(String name, String iconName, Preview preview, double zoomStep, boolean resetZoom) { super(); @@ -47,7 +52,7 @@ public ZoomAction(String name, String iconName, Preview preview, double zoomStep public ZoomAction(Preview preview, double zoomStep) { this("", "", preview, zoomStep, false); } - + public void actionPerformed(ActionEvent e) { if ( resetZoom ) { preview.setZoom(zoomStep); @@ -56,10 +61,8 @@ public void actionPerformed(ActionEvent e) { } preview.repaint(); } - + protected Preview preview; protected double zoomStep; protected boolean resetZoom; } - - diff --git a/ssw/src/main/java/ssw/printpreview/dlgBFPreview.java b/ssw/src/main/java/ssw/printpreview/dlgBFPreview.java index 495d83b0..3d22ca22 100644 --- a/ssw/src/main/java/ssw/printpreview/dlgBFPreview.java +++ b/ssw/src/main/java/ssw/printpreview/dlgBFPreview.java @@ -27,6 +27,10 @@ * @author gblouin */ public class dlgBFPreview extends javax.swing.JFrame implements ActionListener { + /** + * + */ + private static final long serialVersionUID = 4141263480257521396L; private final static double DEFAULT_ZOOM_FACTOR_STEP = .5; protected Pageable pageable; private Printer printer; diff --git a/ssw/src/main/java/ssw/printpreview/dlgPreview.java b/ssw/src/main/java/ssw/printpreview/dlgPreview.java index 1b5340cd..8951cdc1 100644 --- a/ssw/src/main/java/ssw/printpreview/dlgPreview.java +++ b/ssw/src/main/java/ssw/printpreview/dlgPreview.java @@ -21,6 +21,10 @@ import ssw.print.Printer; public class dlgPreview extends javax.swing.JFrame implements ActionListener { + /** + * + */ + private static final long serialVersionUID = 5821445186749448291L; private final static double DEFAULT_ZOOM_FACTOR_STEP = .5; protected Pageable pageable; private Printer printer; @@ -53,7 +57,7 @@ public dlgPreview(String title, JFrame owner, Printer printer, Pageable pageable chkRS.setSelected(sswPrefs.getBoolean("UseRS", false)); cmbPaperSize.setSelectedIndex(sswPrefs.getInt("PaperSize", 0)); if ( chkRS.isSelected() ) { chkRSActionPerformed(null); } - + chkUseHexConversion.setSelected( sswPrefs.getBoolean( "UseMiniConversion", false ) ); if( chkUseHexConversion.isSelected() ) { lblOneHex.setEnabled( true ); diff --git a/sswlib/src/main/java/Force/Force.java b/sswlib/src/main/java/Force/Force.java index 98857e4b..1df4ab50 100644 --- a/sswlib/src/main/java/Force/Force.java +++ b/sswlib/src/main/java/Force/Force.java @@ -47,6 +47,10 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import org.w3c.dom.Node; public class Force extends AbstractTableModel implements ifSerializable { + /** + * + */ + private static final long serialVersionUID = 2799229644232700393L; public ArrayList Units = new ArrayList(); public ArrayList Groups = new ArrayList(); public String ForceName = "", @@ -213,7 +217,7 @@ public void RefreshBV() { for ( Unit u : getUnits() ) { if ( u.UsingC3 ) u.setForceC3BV(TotalC3BV); - + TotalBaseBV += u.BaseBV; TotalModifier += u.MiscMod; TotalTonnage += u.Tonnage; @@ -321,7 +325,7 @@ public void clearEmptyGroups() { for ( Group g : Groups ) { if ( g.getUnits().size() == 0 ) { remove.add(g); } } - + for ( Group d : remove ) { Groups.remove(d); } diff --git a/sswlib/src/main/java/Force/View/abTable.java b/sswlib/src/main/java/Force/View/abTable.java index a6df73ba..7464ea52 100644 --- a/sswlib/src/main/java/Force/View/abTable.java +++ b/sswlib/src/main/java/Force/View/abTable.java @@ -37,6 +37,10 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import list.view.Column; public abstract class abTable extends AbstractTableModel { + /** + * + */ + private static final long serialVersionUID = -567468160100474241L; public ArrayList Columns = new ArrayList(); public ArrayList SortFields = new ArrayList(); public Force force; diff --git a/sswlib/src/main/java/Force/View/tbBattleForce.java b/sswlib/src/main/java/Force/View/tbBattleForce.java index 486a6a4f..11af7311 100644 --- a/sswlib/src/main/java/Force/View/tbBattleForce.java +++ b/sswlib/src/main/java/Force/View/tbBattleForce.java @@ -33,6 +33,11 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import list.view.Column; public class tbBattleForce extends abTable { + /** + * + */ + private static final long serialVersionUID = -5906075737403088343L; + public tbBattleForce() { Columns.add(new Column( 0, "Unit", "TypeModel", 150 )); Columns.add(new Column( 1, "Type", "UnitType", 50 )); diff --git a/sswlib/src/main/java/Force/View/tbChatInfo.java b/sswlib/src/main/java/Force/View/tbChatInfo.java index 906ef965..998fc891 100644 --- a/sswlib/src/main/java/Force/View/tbChatInfo.java +++ b/sswlib/src/main/java/Force/View/tbChatInfo.java @@ -33,6 +33,11 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import list.view.Column; public class tbChatInfo extends abTable { + /** + * + */ + private static final long serialVersionUID = 8285286597171806962L; + public tbChatInfo() { Columns.add(new Column( 0, "Unit", "TypeModel", 100 )); Columns.add(new Column( 1, "Info", "ChatInfo", 400, false)); diff --git a/sswlib/src/main/java/Force/View/tbFactors.java b/sswlib/src/main/java/Force/View/tbFactors.java index 138c9b9e..6a6241a8 100644 --- a/sswlib/src/main/java/Force/View/tbFactors.java +++ b/sswlib/src/main/java/Force/View/tbFactors.java @@ -32,6 +32,11 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import list.view.Column; public class tbFactors extends abTable { + /** + * + */ + private static final long serialVersionUID = -1185896643583141897L; + public tbFactors() { Columns.add(new Column( 0, "Unit", "TypeModel", 150 )); Columns.add(new Column( 1, "Type", "UnitType", 50 )); diff --git a/sswlib/src/main/java/Force/View/tbTotalWarfare.java b/sswlib/src/main/java/Force/View/tbTotalWarfare.java index 8e911405..378724af 100644 --- a/sswlib/src/main/java/Force/View/tbTotalWarfare.java +++ b/sswlib/src/main/java/Force/View/tbTotalWarfare.java @@ -34,7 +34,12 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import list.view.Column; public class tbTotalWarfare extends abTable { - public tbTotalWarfare( ) { + /** + * + */ + private static final long serialVersionUID = 6702798433908299175L; + + public tbTotalWarfare() { Columns.add(new Column( 0, "Unit", "TypeModel", false, 150, String.class, true, SortOrder.ASCENDING )); Columns.add(new Column( 1, "Type", "UnitType", 50 )); Columns.add(new Column( 2, "Mechwarrior", "Mechwarrior", 150, true)); diff --git a/sswlib/src/main/java/Force/View/tbTotalWarfareSmall.java b/sswlib/src/main/java/Force/View/tbTotalWarfareSmall.java index 19b15370..b02f27c5 100644 --- a/sswlib/src/main/java/Force/View/tbTotalWarfareSmall.java +++ b/sswlib/src/main/java/Force/View/tbTotalWarfareSmall.java @@ -34,6 +34,11 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import list.view.Column; public class tbTotalWarfareSmall extends abTable { + /** + * + */ + private static final long serialVersionUID = 143955728876825495L; + public tbTotalWarfareSmall() { Columns.add(new Column( 0, "Unit", "TypeModel", 150 )); Columns.add(new Column( 1, "Type", "UnitType", 50 )); diff --git a/sswlib/src/main/java/Force/Warchest.java b/sswlib/src/main/java/Force/Warchest.java index 50e02ace..3a4ac399 100644 --- a/sswlib/src/main/java/Force/Warchest.java +++ b/sswlib/src/main/java/Force/Warchest.java @@ -39,7 +39,7 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * This object stores information that is specific to the Warchest system * for Battletech. This information includes the cost of the track, the Objectives * and their Rewards and also Optional Bonuses and their amounts. - * + * * @author George Blouin */ public class Warchest implements ifSerializable { @@ -48,9 +48,9 @@ public class Warchest implements ifSerializable { private ArrayList objectives = new ArrayList(); public Warchest() { - + } - + /** * @param node An xml node that contains the required data */ @@ -111,7 +111,7 @@ public String SerializeClipboard() { } data += CommonTools.NL; } - + if ( objectives.size() > 0 ) { data += " Objectives" + CommonTools.NL; for ( Objective o : objectives ) { @@ -173,10 +173,15 @@ public DefaultListModel getBonusList() { } return model; } - + public AbstractTableModel getBonusTable() { AbstractTableModel model = new AbstractTableModel() { + /** + * + */ + private static final long serialVersionUID = -3366882362333693842L; + public int getRowCount() { return bonuses.size(); } @@ -209,6 +214,11 @@ public String getColumnName( int col ) { public AbstractTableModel getObjectiveTable() { AbstractTableModel model = new AbstractTableModel() { + /** + * + */ + private static final long serialVersionUID = 2386484469679345832L; + public int getRowCount() { return objectives.size(); } @@ -237,5 +247,5 @@ public String getColumnName( int col ) { return model; } - + } diff --git a/sswlib/src/main/java/Force/Warriors.java b/sswlib/src/main/java/Force/Warriors.java index dcdc76ca..e0304822 100644 --- a/sswlib/src/main/java/Force/Warriors.java +++ b/sswlib/src/main/java/Force/Warriors.java @@ -47,6 +47,10 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * @author George Blouin */ public class Warriors extends AbstractTableModel { + /** + * + */ + private static final long serialVersionUID = 1333658916698836359L; private ArrayList list = new ArrayList(); private String defaultPath = "data/Personnel/WarriorList.psn", Title = "", @@ -158,7 +162,7 @@ public void setupTable( JTable tbl ) { tbl.getColumnModel().getColumn(1).setPreferredWidth(100); tbl.getColumnModel().getColumn(3).setPreferredWidth(20); } - + @Override public String getColumnName( int col ) { switch( col ) { diff --git a/sswlib/src/main/java/Print/preview/BrowseAction.java b/sswlib/src/main/java/Print/preview/BrowseAction.java index c130c3f1..02404c8c 100644 --- a/sswlib/src/main/java/Print/preview/BrowseAction.java +++ b/sswlib/src/main/java/Print/preview/BrowseAction.java @@ -26,7 +26,12 @@ import javax.swing.ImageIcon; class BrowseAction extends AbstractAction { - public BrowseAction( String name, String iconName, Preview preview, int pageStep ) { + /** + * + */ + private static final long serialVersionUID = 2902692657673095185L; + + public BrowseAction(String name, String iconName, Preview preview, int pageStep) { super(); if ( !name.isEmpty() ) { this.putValue(Action.NAME, name); diff --git a/sswlib/src/main/java/Print/preview/Preview.java b/sswlib/src/main/java/Print/preview/Preview.java index 1506e01f..b22d1781 100644 --- a/sswlib/src/main/java/Print/preview/Preview.java +++ b/sswlib/src/main/java/Print/preview/Preview.java @@ -32,6 +32,10 @@ import javax.swing.JComponent; class Preview extends JComponent { + /** + * + */ + private static final long serialVersionUID = -4169995313258012282L; private final static int DEFAULT_PREVIEW_SIZE = 1024; private final static double MINIMUM_ZOOM_FACTOR = 0.1; private Dimension viewportSize; @@ -44,19 +48,19 @@ public Preview(Pageable pageable, double zoom, Dimension viewport) { public Preview(Pageable pageable, double zoom) { this(pageable, zoom, new Dimension(1024,768)); } - + protected void paintPaper(Graphics g, PageFormat format) { g.setColor(Color.white); - g.fillRect(0, 0, (int)format.getWidth(), (int)format.getHeight()); + g.fillRect(0, 0, (int)format.getWidth(), (int)format.getHeight()); g.setColor(Color.black); - g.drawRect(0, 0, (int)format.getWidth() - 1, (int)format.getHeight() - 1); + g.drawRect(0, 0, (int)format.getWidth() - 1, (int)format.getHeight() - 1); } - + public void paint(Graphics g) { Graphics2D g2d = (Graphics2D)g; g2d.scale(zoom, zoom); try { - PageFormat format = pageable.getPageFormat(index); + PageFormat format = pageable.getPageFormat(index); Printable printable = pageable.getPrintable(index); paintPaper(g, format); printable.print(g, format, 0); @@ -87,7 +91,7 @@ public void moveIndex(int indexStep) { } catch (IndexOutOfBoundsException ignored) { } } - + public void changeZoom(double zoom) { this.zoom = Math.max(MINIMUM_ZOOM_FACTOR, this.zoom + zoom); resize(); @@ -111,14 +115,14 @@ public double getHeightZoom() { PageFormat format = pageable.getPageFormat(index); return viewportSize.height / format.getHeight(); } - + public void resize() { PageFormat format = pageable.getPageFormat(index); int size = (int)Math.max(format.getWidth() * zoom, format.getHeight() * zoom); setPreferredSize(new Dimension(size, size)); revalidate(); } - + public Dimension getMinimumSize() { return getPreferredSize(); } @@ -126,7 +130,7 @@ public Dimension getMinimumSize() { public void setViewportSize( Dimension viewportSize ) { this.viewportSize = viewportSize; } - + protected Pageable pageable; protected int index = 0; protected double zoom = 0.0; diff --git a/sswlib/src/main/java/Print/preview/PreviewDialog.java b/sswlib/src/main/java/Print/preview/PreviewDialog.java index 744e745b..516f9fb5 100644 --- a/sswlib/src/main/java/Print/preview/PreviewDialog.java +++ b/sswlib/src/main/java/Print/preview/PreviewDialog.java @@ -44,11 +44,15 @@ import javax.swing.JToolBar; public class PreviewDialog extends JDialog implements ActionListener { + /** + * + */ + private static final long serialVersionUID = -7637909796176909169L; private final static double DEFAULT_ZOOM_FACTOR_STEP = .5; public PreviewDialog(String title, JFrame owner, Pageable pageable, double zoom) { super(owner, title, true); - this.pageable = pageable; + this.pageable = pageable; Preview preview = new Preview(pageable, zoom); JScrollPane scrollPane = new JScrollPane(preview); getContentPane().add(scrollPane, "Center"); @@ -59,7 +63,7 @@ public PreviewDialog(String title, JFrame owner, Pageable pageable, double zoom) toolbar.add(getButton( "Back", "Back24.gif", new BrowseAction(preview, -1))); toolbar.add(getButton( "Forward", "Forward24.gif", new BrowseAction(preview, 1))); toolbar.add(new JToolBar.Separator()); - toolbar.add(getButton( "Zoom +", "ZoomIn24.gif", new ZoomAction(preview, DEFAULT_ZOOM_FACTOR_STEP))); + toolbar.add(getButton( "Zoom +", "ZoomIn24.gif", new ZoomAction(preview, DEFAULT_ZOOM_FACTOR_STEP))); toolbar.add(getButton( "Zoom -", "ZoomOut24.gif", new ZoomAction(preview, -DEFAULT_ZOOM_FACTOR_STEP))); toolbar.add(new JToolBar.Separator()); JPanel dialog = new JPanel(); @@ -67,9 +71,9 @@ public PreviewDialog(String title, JFrame owner, Pageable pageable, double zoom) JButton ok = new JButton("OK"); ok.addActionListener(this); dialog.add(ok); - getContentPane().add(dialog, "South"); + getContentPane().add(dialog, "South"); } - + public PreviewDialog(String title, JFrame owner, Pageable pageable) { this(title, owner, pageable, 0.0); } @@ -81,33 +85,33 @@ public PreviewDialog(String title, JFrame owner, Printable printable, PageFormat public PreviewDialog(String title, JFrame owner, Printable printable, PageFormat format, int pages) { this(title, owner, printable, format, pages, 0.0); } - + private static class MyPageable implements Pageable { public MyPageable(Printable printable, PageFormat format, int pages) { this.printable = printable; this.format = format; this.pages = pages; } - - public int getNumberOfPages() { - return pages; + + public int getNumberOfPages() { + return pages; } - + public Printable getPrintable(int index) { if (index >= pages) throw new IndexOutOfBoundsException(); return printable; } - + public PageFormat getPageFormat(int index) { if (index >= pages) throw new IndexOutOfBoundsException(); return format; } - + private Printable printable; private PageFormat format; private int pages; } - + private JButton getButton(String iconName) { return getButton(null, iconName, null); } @@ -115,20 +119,20 @@ private JButton getButton(String iconName) { private JButton getButton(String iconName, AbstractAction action) { return getButton(null, iconName, action); } - + private JButton getButton(String name, String iconName, AbstractAction action) { JButton result = null; - ImageIcon icon = null; + ImageIcon icon = null; icon = new ImageIcon(getClass().getResource("/ssw/BFB.Images/" + iconName)); if (action != null) { if (icon != null) action.putValue(Action.SMALL_ICON, icon); - if (name != null) action.putValue(Action.NAME, name); + if (name != null) action.putValue(Action.NAME, name); result = new JButton(action); - } else + } else result = new JButton(name, icon); - + return result; } @@ -139,6 +143,6 @@ private void Refresh() { public void actionPerformed(ActionEvent e) { dispose(); } - + protected Pageable pageable; } diff --git a/sswlib/src/main/java/Print/preview/ZoomAction.java b/sswlib/src/main/java/Print/preview/ZoomAction.java index 3b68d2ea..ed079ff5 100644 --- a/sswlib/src/main/java/Print/preview/ZoomAction.java +++ b/sswlib/src/main/java/Print/preview/ZoomAction.java @@ -26,6 +26,11 @@ import javax.swing.ImageIcon; class ZoomAction extends AbstractAction { + /** + * + */ + private static final long serialVersionUID = -6145976575417201307L; + public ZoomAction(String name, String iconName, Preview preview, double zoomStep, boolean resetZoom) { super(); @@ -61,5 +66,3 @@ public void actionPerformed(ActionEvent e) { protected double zoomStep; protected boolean resetZoom; } - - diff --git a/sswlib/src/main/java/Print/preview/dlgPreview.java b/sswlib/src/main/java/Print/preview/dlgPreview.java index ac84db43..5c0eab2a 100644 --- a/sswlib/src/main/java/Print/preview/dlgPreview.java +++ b/sswlib/src/main/java/Print/preview/dlgPreview.java @@ -25,6 +25,10 @@ import java.util.prefs.Preferences; public class dlgPreview extends javax.swing.JFrame implements ActionListener { + /** + * + */ + private static final long serialVersionUID = 8723654169235549547L; private final static double DEFAULT_ZOOM_FACTOR_STEP = .5; protected Pageable pageable; private Preview preview; @@ -70,13 +74,13 @@ public dlgPreview(String title, Component owner, PagePrinter printer, ImageTrack this(title, owner, printer.Preview(), 0.0, images); setPrinter(printer); } - + public dlgPreview(String title, Component owner, PagePrinter printer, Scenario scenario, ImageTracker images) { this(title, owner, printer.Preview(), 0.0, images); setScenario(scenario); setPrinter(printer); } - + public dlgPreview(String title, Component owner, PagePrinter printer, Scenario scenario, ImageTracker images, boolean RSOnly) { this(title, owner, printer.Preview(), 0.0, images); this.printer = printer; @@ -99,27 +103,27 @@ public void actionPerformed(ActionEvent e) { public void setBFOnly() { chkPrintRecordsheets.setSelected(false); chkPrintRecordsheets.setEnabled(false); - + chkPrintBattleforce.setSelected(true); chkPrintScenario.setSelected(false); chkPrintScenario.setEnabled(false); Verify(); } - + public final void setRSOnly() { chkPrintForce.setSelected(false); chkPrintForce.setEnabled(false); - + chkPrintBattleforce.setSelected(false); chkPrintBattleforce.setEnabled(false); - + chkPrintScenario.setSelected(false); chkPrintScenario.setEnabled(false); - + chkPrintFireChits.setSelected(false); chkPrintFireChits.setEnabled(false); - + chkPrintRecordsheets.setSelected(true); } @@ -274,7 +278,7 @@ private void PrinterSetup() { } } } - + if ( chkPrintForce.isSelected()) { int index = 0; @@ -396,7 +400,7 @@ private void PrinterSetup() { printer.Append( pageSize, hqs); } break; - + case 3: imageTracker.preLoadBattleForceImages(); for ( BattleForce f : scenario.toBattleForceByGroup( 6 ) ) { @@ -511,7 +515,7 @@ private void setPreferences() { bfbPrefs.putBoolean(Constants.Print_Recordsheet, chkPrintRecordsheets.isSelected()); bfbPrefs.putBoolean(Constants.Print_BattleForce, chkPrintBattleforce.isSelected()); bfbPrefs.putBoolean(Constants.Format_OneForcePerPage, chkBFOnePerPage.isSelected()); - + bfbPrefs.putBoolean("BF_Backs", chkBFBacks.isSelected()); bfbPrefs.putBoolean("BF_Color", chkUseColor.isSelected()); diff --git a/sswlib/src/main/java/common/ImagePreview.java b/sswlib/src/main/java/common/ImagePreview.java index ae54b28b..72a32b38 100644 --- a/sswlib/src/main/java/common/ImagePreview.java +++ b/sswlib/src/main/java/common/ImagePreview.java @@ -8,6 +8,10 @@ /* ImagePreview.java by FileChooserDemo2.java. */ public class ImagePreview extends JComponent implements PropertyChangeListener { + /** + * + */ + private static final long serialVersionUID = 4845102379971852871L; ImageIcon thumbnail = null; File file = null; diff --git a/sswlib/src/main/java/dialog/AmmoChooserRenderer.java b/sswlib/src/main/java/dialog/AmmoChooserRenderer.java index 47b0bb5a..ad92e212 100644 --- a/sswlib/src/main/java/dialog/AmmoChooserRenderer.java +++ b/sswlib/src/main/java/dialog/AmmoChooserRenderer.java @@ -39,6 +39,10 @@ import filehandlers.FileCommon; public class AmmoChooserRenderer extends DefaultListCellRenderer { + /** + * + */ + private static final long serialVersionUID = -408196200015299689L; private dlgAmmoChooser Parent; private abPlaceable a = null; diff --git a/sswlib/src/main/java/dialog/dlgAmmoChooser.java b/sswlib/src/main/java/dialog/dlgAmmoChooser.java index 20cbcc66..deddbf41 100644 --- a/sswlib/src/main/java/dialog/dlgAmmoChooser.java +++ b/sswlib/src/main/java/dialog/dlgAmmoChooser.java @@ -37,6 +37,10 @@ public class dlgAmmoChooser extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = 6093818877019978635L; private Mech CurMech; private ArrayList Ammo = new ArrayList(); private DataFactory Data; @@ -129,6 +133,10 @@ private void initComponents() { jScrollPane2.setPreferredSize(new java.awt.Dimension(250, 145)); lstAvailableAmmo.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = -5907520580999585121L; String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -148,6 +156,10 @@ private void initComponents() { jScrollPane1.setPreferredSize(new java.awt.Dimension(250, 145)); lstInstalledAmmo.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = 4090389589630402457L; String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -381,7 +393,7 @@ private void txtAmmoYearKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event }//GEN-LAST:event_txtAmmoYearKeyTyped private void cmbRulesLevelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbRulesLevelActionPerformed - if( cmbRulesLevel.getSelectedIndex() < CurMech.GetRulesLevel() ) { + if( cmbRulesLevel.getSelectedIndex() < CurMech.GetRulesLevel() ) { Media.Messager( this, "You cannot use a Rules Level lower than the 'Mech's." ); cmbRulesLevel.setSelectedIndex( CurMech.GetRulesLevel() ); } diff --git a/sswlib/src/main/java/dialog/dlgImageMgr.java b/sswlib/src/main/java/dialog/dlgImageMgr.java index 39aa89dc..2d0399b1 100644 --- a/sswlib/src/main/java/dialog/dlgImageMgr.java +++ b/sswlib/src/main/java/dialog/dlgImageMgr.java @@ -44,6 +44,10 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import java.util.prefs.Preferences; public class dlgImageMgr extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -5147617552433439077L; public ArrayList forces = new ArrayList(); public boolean hasWork = false; @@ -137,6 +141,10 @@ private void initComponents() { pnlList.setBorder(javax.swing.BorderFactory.createTitledBorder("Designs Missing BFB.Images")); lstUnits.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = 6806666663211325298L; String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -220,7 +228,7 @@ public void valueChanged(javax.swing.event.ListSelectionEvent evt) { private void lstUnitsValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstUnitsValueChanged if ( lstUnits.getSelectedValue() != null ) { Media media = new Media(); - + curUnit = units.get( ( (Object) lstUnits.getSelectedValue() ).toString() ); pnlMech.setBorder(new TitledBorder(curUnit.TypeModel)); lblStatus.setText(curUnit.TypeModel + " Loaded."); diff --git a/sswlib/src/main/java/dialog/dlgManeiDomini.java b/sswlib/src/main/java/dialog/dlgManeiDomini.java index 7a16e1bc..85df4afd 100644 --- a/sswlib/src/main/java/dialog/dlgManeiDomini.java +++ b/sswlib/src/main/java/dialog/dlgManeiDomini.java @@ -6,6 +6,10 @@ import javax.swing.JDialog; public class dlgManeiDomini extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = 3835014964320414921L; public double Modifier = 1.0; public ArrayList Enhancements = new ArrayList(); @@ -51,7 +55,20 @@ private void initComponents() { jLabel4.setText("Select Manei Domini Enhancements"); lstMods.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "0, Cosmetic Enhancement", "0, Prosthetic Hand/Foot/Arm/Leg", "1, Enhanced Prosthetic Hand/Foot/Arm/Leg", "3, Improved Enhanced Prosthetic Hand/Foot/Arm/Leg", "1, Secondary Power Supply", "3, Prosthetic Leg MASC", "2, Pain Shunt", "3, Pheremone Effuser", "4, Toxin Effuser", "2, Cybernetic Eye/Ear/Speech Implants", "3, Multi-Modal Cybernetic Eye/Ear/Speech Implants", "5, Enhanced Multi-Modal Cybernetic Eye/Ear/Speech Implants", "2, Recorder/Transmitter/Receiver/Communications Implant", "4, Boosted Recorder/Transmitter/Receiver/Communications Implants", "3, Filtration Liver/Lung Implants", "3, Vehicular Direct Neural Interface (VDNI)", "5, Buffered VDNI", "4, Myomer Full-Body Implants" }; + /** + * + */ + private static final long serialVersionUID = 8884451191147836064L; + String[] strings = { "0, Cosmetic Enhancement", "0, Prosthetic Hand/Foot/Arm/Leg", + "1, Enhanced Prosthetic Hand/Foot/Arm/Leg", "3, Improved Enhanced Prosthetic Hand/Foot/Arm/Leg", + "1, Secondary Power Supply", "3, Prosthetic Leg MASC", "2, Pain Shunt", "3, Pheremone Effuser", + "4, Toxin Effuser", "2, Cybernetic Eye/Ear/Speech Implants", + "3, Multi-Modal Cybernetic Eye/Ear/Speech Implants", + "5, Enhanced Multi-Modal Cybernetic Eye/Ear/Speech Implants", + "2, Recorder/Transmitter/Receiver/Communications Implant", + "4, Boosted Recorder/Transmitter/Receiver/Communications Implants", + "3, Filtration Liver/Lung Implants", "3, Vehicular Direct Neural Interface (VDNI)", + "5, Buffered VDNI", "4, Myomer Full-Body Implants" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); diff --git a/sswlib/src/main/java/dialog/dlgPrint.java b/sswlib/src/main/java/dialog/dlgPrint.java index e63d91c3..a0a4d673 100644 --- a/sswlib/src/main/java/dialog/dlgPrint.java +++ b/sswlib/src/main/java/dialog/dlgPrint.java @@ -42,6 +42,10 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import java.util.prefs.Preferences; public class dlgPrint extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -4270519652104777795L; private ImageTracker imageTracker; private Scenario scenario; private Preferences bfbPrefs = Preferences.userRoot().node( Constants.BFBPrefs ); @@ -130,7 +134,7 @@ private void Verify() { if (chkTables.isSelected()) { iconPath = "/images/RecordsheetTables_BG.png"; } lblRecordsheetIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource(iconPath))); } - + if ( chkPrintBattleforce.isSelected() ) { iconPath = "/images/BattleForce_BG.png"; switch ( cmbBFSheetType.getSelectedIndex() ) { @@ -244,7 +248,7 @@ private PagePrinter SetupPrinter() { printer.Append( letter, qs); } break; - + default: } } diff --git a/sswlib/src/main/java/dialog/dlgUnit.java b/sswlib/src/main/java/dialog/dlgUnit.java index 53f6c3d0..1a371f55 100644 --- a/sswlib/src/main/java/dialog/dlgUnit.java +++ b/sswlib/src/main/java/dialog/dlgUnit.java @@ -48,6 +48,10 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import javax.swing.SpinnerNumberModel; public class dlgUnit extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -8879297096883466444L; private Force force; private Unit unit; private boolean Default = true; @@ -180,7 +184,7 @@ private void setTRO() { tpnTRO.setCaretPosition(0); break; } - + } private void setC3() { @@ -228,7 +232,7 @@ private void setBattleForce() { stats = new BattleForceStats(unit.v); break; } - + lblBFMV.setText(stats.getMovement()); lblBFShort.setText(stats.getShort()+""); @@ -711,6 +715,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); lstSkills.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = 7250619854461540939L; String[] strings = { "0 / 0 (1000)", "Item 2", "Item 3", "Item 4", "Item 5" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -851,6 +859,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("Mechwarrior List")); lstPersonnel.setModel(new javax.swing.AbstractListModel() { + /** + * + */ + private static final long serialVersionUID = -7184327738128057082L; String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } @@ -1400,7 +1412,7 @@ private void btnSelectWarriorActionPerformed(java.awt.event.ActionEvent evt) {// cmbGunnery.setSelectedIndex(w.getGunnery()); cmbPiloting.setSelectedIndex(w.getPiloting()); txtMod.setText(w.getManeiDomini()+""); - + unit.Refresh(); } }//GEN-LAST:event_btnSelectWarriorActionPerformed diff --git a/sswlib/src/main/java/dialog/frmForce.java b/sswlib/src/main/java/dialog/frmForce.java index 8a958fe4..92aab7bb 100644 --- a/sswlib/src/main/java/dialog/frmForce.java +++ b/sswlib/src/main/java/dialog/frmForce.java @@ -57,6 +57,10 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT public class frmForce extends javax.swing.JFrame implements java.awt.datatransfer.ClipboardOwner { + /** + * + */ + private static final long serialVersionUID = -2004297022968677762L; private Force force = new Force(); private Media media = new Media(); private ImageTracker imageTracker; @@ -991,7 +995,7 @@ private void btnExportMTFsActionPerformed(java.awt.event.ActionEvent evt) {//GEN MTFWriter mtf = new MTFWriter(); String mtfDir = media.GetDirectorySelection(null, prefs.get( "MTFExportPath", "" ) ); if (!mtfDir.endsWith(File.separator)) { mtfDir += File.separator; } - + for ( int i = 0; i < force.getUnits().size(); i++ ) { Unit u = (Unit) force.getUnits().get(i); u.LoadUnit(); @@ -1004,7 +1008,7 @@ private void btnExportMTFsActionPerformed(java.awt.event.ActionEvent evt) {//GEN error += "Attempted " + filename + ": " + ie.getMessage() + "\n"; } } - + if ( !error.isEmpty() ) { Media.Messager(error); } else { diff --git a/sswlib/src/main/java/gui/HTMLPane.java b/sswlib/src/main/java/gui/HTMLPane.java index 075ca984..e845a1f7 100644 --- a/sswlib/src/main/java/gui/HTMLPane.java +++ b/sswlib/src/main/java/gui/HTMLPane.java @@ -73,6 +73,10 @@ public class HTMLPane extends JPanel implements ActionListener { + /** + * + */ + private static final long serialVersionUID = 8903309571492323612L; private HTMLDocument Document; private JPanel Controls = new JPanel(); private JScrollPane Scroller; @@ -433,6 +437,11 @@ public void undoableEditHappened( UndoableEditEvent e ) { } private class UndoAction extends AbstractAction { + /** + * + */ + private static final long serialVersionUID = -611107834653405452L; + public UndoAction() { super( "Undo" ); setEnabled( false ); @@ -461,6 +470,11 @@ protected void update() { } private class RedoAction extends AbstractAction { + /** + * + */ + private static final long serialVersionUID = 3081425073533555277L; + public RedoAction() { super( "Redo" ); setEnabled( false ); @@ -489,6 +503,11 @@ protected void update() { } class SubscriptAction extends StyledEditorKit.StyledTextAction { + /** + * + */ + private static final long serialVersionUID = 7299699244636651073L; + public SubscriptAction() { super( StyleConstants.Subscript.toString() ); } @@ -507,6 +526,11 @@ public void actionPerformed( ActionEvent e ) { } class SuperscriptAction extends StyledEditorKit.StyledTextAction { + /** + * + */ + private static final long serialVersionUID = 7113449619152288273L; + public SuperscriptAction() { super( StyleConstants.Superscript.toString() ); } @@ -525,6 +549,11 @@ public void actionPerformed( ActionEvent e ) { } class StrikeThroughAction extends StyledEditorKit.StyledTextAction { + /** + * + */ + private static final long serialVersionUID = 7776719295905120017L; + public StrikeThroughAction() { super( StyleConstants.StrikeThrough.toString() ); } @@ -543,6 +572,11 @@ public void actionPerformed( ActionEvent e ){ } private class SSWHTMLEditorKit extends HTMLEditorKit { + /** + * + */ + private static final long serialVersionUID = 6286144508677076119L; + @Override public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException { if (doc instanceof HTMLDocument) { @@ -573,5 +607,3 @@ public SSWHTMLWriter( Writer w, HTMLDocument doc, int pos, int len ) { } } } - - diff --git a/sswlib/src/main/java/gui/TextPane.java b/sswlib/src/main/java/gui/TextPane.java index 7251c0b7..e458f70e 100644 --- a/sswlib/src/main/java/gui/TextPane.java +++ b/sswlib/src/main/java/gui/TextPane.java @@ -34,6 +34,10 @@ import javax.swing.JTextPane; public class TextPane extends JPanel { + /** + * + */ + private static final long serialVersionUID = 7256297005490123995L; private JScrollPane Scroller; private JTextPane Text = new JTextPane(); diff --git a/sswlib/src/main/java/list/view/NumberRenderer.java b/sswlib/src/main/java/list/view/NumberRenderer.java index c8d337c8..53fe4c44 100644 --- a/sswlib/src/main/java/list/view/NumberRenderer.java +++ b/sswlib/src/main/java/list/view/NumberRenderer.java @@ -15,6 +15,11 @@ */ public class NumberRenderer extends DefaultTableCellRenderer { + /** + * + */ + private static final long serialVersionUID = 8448429028889590402L; + public NumberRenderer() { } diff --git a/sswlib/src/main/java/list/view/abView.java b/sswlib/src/main/java/list/view/abView.java index d8ce6a09..03e34e20 100644 --- a/sswlib/src/main/java/list/view/abView.java +++ b/sswlib/src/main/java/list/view/abView.java @@ -37,6 +37,10 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import list.UnitList; public abstract class abView extends AbstractTableModel { + /** + * + */ + private static final long serialVersionUID = 4787285225481758727L; public Vector Columns = new Vector(); public Vector SortFields = new Vector(); public UnitList list; @@ -70,7 +74,7 @@ public void setupTable( JTable tbl ) { } } } - + public Object Get( int index ) { return list.Get(index); } diff --git a/sswlib/src/main/java/list/view/tbBattleForceView.java b/sswlib/src/main/java/list/view/tbBattleForceView.java index 14443ec5..e52eb656 100644 --- a/sswlib/src/main/java/list/view/tbBattleForceView.java +++ b/sswlib/src/main/java/list/view/tbBattleForceView.java @@ -32,7 +32,12 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import list.UnitListData; public class tbBattleForceView extends abView { - public tbBattleForceView( UnitList list ) { + /** + * + */ + private static final long serialVersionUID = 1487361433658592322L; + + public tbBattleForceView(UnitList list) { this.list = list; Columns.add(new Column( 0, "Unit", "TypeModel", 200 )); @@ -47,7 +52,7 @@ public tbBattleForceView( UnitList list ) { Columns.add(new Column( 9, "Str", "Structure", 20, Integer.class )); Columns.add(new Column( 10, "Base PV", "BaseBV", 30, Integer.class )); Columns.add(new Column( 11, "Adj PV", "TotalBV", false, 40, Integer.class, true, SortOrder.ASCENDING )); - + Columns.get(0).sortOrder = SortOrder.ASCENDING; Columns.get(6).sortOrder = SortOrder.ASCENDING; diff --git a/sswlib/src/main/java/list/view/tbChatInformation.java b/sswlib/src/main/java/list/view/tbChatInformation.java index 2ecb4908..544ef1a2 100644 --- a/sswlib/src/main/java/list/view/tbChatInformation.java +++ b/sswlib/src/main/java/list/view/tbChatInformation.java @@ -32,7 +32,12 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import list.UnitListData; public class tbChatInformation extends abView { - public tbChatInformation( UnitList list ) { + /** + * + */ + private static final long serialVersionUID = -208845266128004476L; + + public tbChatInformation(UnitList list) { this.list = list; Columns.add(new Column( 0, "Type/Model", "Name", false, 125, String.class, true, SortOrder.ASCENDING )); diff --git a/sswlib/src/main/java/list/view/tbQuirks.java b/sswlib/src/main/java/list/view/tbQuirks.java index 91c73e3d..b15f8afc 100644 --- a/sswlib/src/main/java/list/view/tbQuirks.java +++ b/sswlib/src/main/java/list/view/tbQuirks.java @@ -34,6 +34,10 @@ import javax.swing.table.AbstractTableModel; public class tbQuirks extends AbstractTableModel { + /** + * + */ + private static final long serialVersionUID = -1986433171909626102L; public ArrayList quirklist; public tbQuirks(ArrayList quirks) diff --git a/sswlib/src/main/java/list/view/tbTotalWarfareCompact.java b/sswlib/src/main/java/list/view/tbTotalWarfareCompact.java index b1ea56a4..0a34c624 100644 --- a/sswlib/src/main/java/list/view/tbTotalWarfareCompact.java +++ b/sswlib/src/main/java/list/view/tbTotalWarfareCompact.java @@ -32,7 +32,12 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import list.UnitListData; public class tbTotalWarfareCompact extends abView { - public tbTotalWarfareCompact( UnitList list ) { + /** + * + */ + private static final long serialVersionUID = 5852527095691485580L; + + public tbTotalWarfareCompact(UnitList list) { this.list = list; Columns.add(new Column( 0, "Tons", "Tonnage", false, 20, Integer.class, true, SortOrder.ASCENDING )); diff --git a/sswlib/src/main/java/list/view/tbTotalWarfareView.java b/sswlib/src/main/java/list/view/tbTotalWarfareView.java index 89cacc32..ad1d34e8 100644 --- a/sswlib/src/main/java/list/view/tbTotalWarfareView.java +++ b/sswlib/src/main/java/list/view/tbTotalWarfareView.java @@ -34,7 +34,12 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import list.UnitListData; public class tbTotalWarfareView extends abView { - public tbTotalWarfareView( UnitList list ) { + /** + * + */ + private static final long serialVersionUID = 3746192148272629301L; + + public tbTotalWarfareView(UnitList list) { this.list = list; Columns.add(new Column( 0, "Tons", "Tonnage", false, 20, Integer.class, true, SortOrder.ASCENDING )); From 67e4d8f5fe6587065bc1cf25e786b140dc9e7606 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 11:16:46 -0600 Subject: [PATCH 076/126] ssw/gui/dlgCCGMech.java - Commented out unused variables - Adjusted variable types to prevent unchecked casts. ssw/components/CCGMech.java - Adjusted method declaration and type conversion to better conform with intent. --- ssw/src/main/java/ssw/components/CCGMech.java | 4 +- ssw/src/main/java/ssw/gui/dlgCCGMech.java | 127 +++++++++--------- 2 files changed, 68 insertions(+), 63 deletions(-) diff --git a/ssw/src/main/java/ssw/components/CCGMech.java b/ssw/src/main/java/ssw/components/CCGMech.java index 6e61523a..e3a033c8 100644 --- a/ssw/src/main/java/ssw/components/CCGMech.java +++ b/ssw/src/main/java/ssw/components/CCGMech.java @@ -194,7 +194,7 @@ public void setMass(int mass) { * @param TotalHeatDis The total amount of heat the 'Mech can dissapate in one * turn. */ - public void setAttackValue(ArrayList CurrentLoadout, int MovementHeat, int TotalHeatDis) { + public void setAttackValue(ArrayList CurrentLoadout, int MovementHeat, int TotalHeatDis) { double attackValue = 0.0; double missileValue = 0.0; int vanPPCERLLcount = 0; @@ -202,7 +202,7 @@ public void setAttackValue(ArrayList CurrentLoadout, int MovementHeat, if (CurrentLoadout.size() > 0) { for (int i = 0; i < CurrentLoadout.size(); i++) { if (CurrentLoadout.get(i) instanceof ifWeapon) { - ifWeapon currentWeapon = CurrentLoadout.get(i); + ifWeapon currentWeapon = (ifWeapon) CurrentLoadout.get(i); double currentWeaponAttackValue = 0.0; double currentMissileValue = 0.0; // a bunch of checks to see if we even need to calculated diff --git a/ssw/src/main/java/ssw/gui/dlgCCGMech.java b/ssw/src/main/java/ssw/gui/dlgCCGMech.java index 3ea94a28..ed415e38 100644 --- a/ssw/src/main/java/ssw/gui/dlgCCGMech.java +++ b/ssw/src/main/java/ssw/gui/dlgCCGMech.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import ssw.components.CCGMech; import components.Mech; +import components.abPlaceable; import components.ifMechLoadout; /** @@ -27,15 +28,16 @@ public class dlgCCGMech extends javax.swing.JDialog { */ private static final long serialVersionUID = -4454863213045636732L; private Mech CurMech; - private String NL; + // private String NL; // Not Used /** Creates new form dlgCCGMech */ public dlgCCGMech(java.awt.Frame parent, boolean modal, Mech m) { super(parent, modal); initComponents(); CurMech = m; - NL = System.getProperty( "line.separator" ); - CCGMech ccgMech = GenerateCCGCard(); + // NL = System.getProperty("line.separator"); // Variable is never accessed. + // CCGMech ccgMech = GenerateCCGCard(); + GenerateCCGCard(); // Since variable not used, call without assignment setTitle(CurMech.GetName() + " CCG Card"); } @@ -43,7 +45,7 @@ public dlgCCGMech(java.awt.Frame parent, boolean modal, Mech m) { * GenerateCCGCard() */ private CCGMech GenerateCCGCard() { - //Here goes nothing! + // Here goes nothing! CCGMech card = new CCGMech(CurMech.GetName(), CurMech.GetFullName()); card.setMass(CurMech.GetTonnage()); @@ -51,29 +53,28 @@ private CCGMech GenerateCCGCard() { card.setArmourAndStructure(CurMech.GetArmor().GetArmorValue()); card.setJump(CurMech.GetLoadout().GetJumpJets().GetNumJJ()); - ifMechLoadout loadout = (ifMechLoadout)CurMech.GetLoadout(); - ArrayList CurrentLoadout = loadout.GetNonCore(); + ifMechLoadout loadout = CurMech.GetLoadout(); + ArrayList CurrentLoadout = loadout.GetNonCore(); card.setAttackValue(CurrentLoadout, CurMech.GetBVMovementHeat(), CurMech.GetHeatSinks().TotalDissipation()); lblCardTitle.setText(card.getName()); lblCardCostMassWeapons.setText("Mass: " + card.getMass()); lblCardAbilitiesAndFlavour.setText(card.getSpecial()); - lblArmour.setText(" " + card.getArmour() + "/" + card.getStructure()); + lblArmour.setText(" " + card.getArmour() + "/" + card.getStructure()); lblAttack.setText(" " + card.getAttack()); lblSpeed.setText(card.getSpeed() + ""); return card; } - - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents + + // //GEN-BEGIN:initComponents private void initComponents() { lblCardTitle = new javax.swing.JLabel(); @@ -121,64 +122,68 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(lblSpeed) - .addComponent(lblCardTitle, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE) - .addGroup(layout.createSequentialGroup() - .addComponent(lblCardCostMassWeapons, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(lblCardPictureSpace, javax.swing.GroupLayout.PREFERRED_SIZE, 115, Short.MAX_VALUE)) - .addGroup(layout.createSequentialGroup() - .addComponent(lblArmour, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(lblArtistAndCopyright, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(lblAttack, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(btnClose, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(54, 54, 54)) - .addComponent(lblCardAbilitiesAndFlavour, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE) - .addComponent(lblCardFactionAvailability, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE)) - .addContainerGap()) - ); - - layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {lblArmour, lblArtistAndCopyright, lblAttack}); - - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(lblCardTitle) + layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout + .createSequentialGroup().addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(lblSpeed) + .addComponent(lblCardTitle, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addComponent(lblCardCostMassWeapons, javax.swing.GroupLayout.PREFERRED_SIZE, 65, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(lblCardPictureSpace, javax.swing.GroupLayout.PREFERRED_SIZE, 115, + Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addComponent(lblArmour, javax.swing.GroupLayout.PREFERRED_SIZE, 57, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(lblArtistAndCopyright, javax.swing.GroupLayout.PREFERRED_SIZE, 53, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(lblAttack, javax.swing.GroupLayout.PREFERRED_SIZE, 58, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, + layout.createSequentialGroup() + .addComponent(btnClose, javax.swing.GroupLayout.PREFERRED_SIZE, 69, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(54, 54, 54)) + .addComponent(lblCardAbilitiesAndFlavour, javax.swing.GroupLayout.DEFAULT_SIZE, 186, + Short.MAX_VALUE) + .addComponent(lblCardFactionAvailability, javax.swing.GroupLayout.Alignment.TRAILING, + javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE)) + .addContainerGap())); + + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, + new java.awt.Component[] { lblArmour, lblArtistAndCopyright, lblAttack }); + + layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout + .createSequentialGroup().addComponent(lblCardTitle) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(lblCardCostMassWeapons, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(lblCardPictureSpace, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)) + .addComponent(lblCardCostMassWeapons, javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(lblCardPictureSpace, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblCardFactionAvailability) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(lblSpeed) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(lblSpeed) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(lblCardAbilitiesAndFlavour, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(lblCardAbilitiesAndFlavour, javax.swing.GroupLayout.PREFERRED_SIZE, 71, + javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(lblArmour, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(lblArtistAndCopyright, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(lblAttack, javax.swing.GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnClose) - .addContainerGap(25, Short.MAX_VALUE)) - ); + .addComponent(lblArmour, javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(lblArtistAndCopyright, javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(lblAttack, javax.swing.GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(btnClose) + .addContainerGap(25, Short.MAX_VALUE))); pack(); }// //GEN-END:initComponents - private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed - // TODO add your handling code here: + private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCloseActionPerformed dispose(); -}//GEN-LAST:event_btnCloseActionPerformed + }// GEN-LAST:event_btnCloseActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnClose; From 3b70ef9a27340feef806dde7582055a548781c40 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 11:23:44 -0600 Subject: [PATCH 077/126] print/QSCardSheetPrinter.java - Removed variable not in use --- sswlib/src/main/java/Print/QSCardSheetPrinter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sswlib/src/main/java/Print/QSCardSheetPrinter.java b/sswlib/src/main/java/Print/QSCardSheetPrinter.java index abc65908..b3935db7 100644 --- a/sswlib/src/main/java/Print/QSCardSheetPrinter.java +++ b/sswlib/src/main/java/Print/QSCardSheetPrinter.java @@ -30,7 +30,7 @@ public class QSCardSheetPrinter implements Printable { private Image RecordSheet, Unit, Charts; - private int UnitSize = 4, + private int // UnitSize = 4, // Variable not used UnitImageWidth = 164, //187, UnitImageHeight = 234, ElementLimit = 2; From e85cf9af00286e518a467bae8ed34b18e34a6ac2 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 11:30:17 -0600 Subject: [PATCH 078/126] Mass Update - Removed SuprressWarnings --- ssw/src/main/java/ssw/gui/dlgCostBVBreakdown.java | 2 +- ssw/src/main/java/ssw/gui/dlgPlaceableInfo.java | 2 +- ssw/src/main/java/ssw/gui/dlgPrintBatchMechs.java | 2 +- ssw/src/main/java/ssw/gui/dlgPrintBattleforce.java | 2 +- ssw/src/main/java/ssw/gui/dlgQuirks.java | 2 +- ssw/src/main/java/ssw/gui/dlgSSWFiles.java | 2 +- ssw/src/main/java/ssw/gui/dlgTechBaseChooser.java | 2 +- ssw/src/main/java/ssw/gui/dlgTextExport.java | 2 +- ssw/src/main/java/ssw/gui/dlgVariableSize.java | 2 +- ssw/src/main/java/ssw/printpreview/dlgBFPreview.java | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ssw/src/main/java/ssw/gui/dlgCostBVBreakdown.java b/ssw/src/main/java/ssw/gui/dlgCostBVBreakdown.java index 60890bc2..e406a61a 100644 --- a/ssw/src/main/java/ssw/gui/dlgCostBVBreakdown.java +++ b/ssw/src/main/java/ssw/gui/dlgCostBVBreakdown.java @@ -57,7 +57,7 @@ public dlgCostBVBreakdown(java.awt.Frame parent, boolean modal, Mech m ) { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents private void initComponents() { diff --git a/ssw/src/main/java/ssw/gui/dlgPlaceableInfo.java b/ssw/src/main/java/ssw/gui/dlgPlaceableInfo.java index c8afcb2b..cb4be023 100644 --- a/ssw/src/main/java/ssw/gui/dlgPlaceableInfo.java +++ b/ssw/src/main/java/ssw/gui/dlgPlaceableInfo.java @@ -126,7 +126,7 @@ private void SetState() { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; diff --git a/ssw/src/main/java/ssw/gui/dlgPrintBatchMechs.java b/ssw/src/main/java/ssw/gui/dlgPrintBatchMechs.java index b8da9e33..3fccf7f2 100644 --- a/ssw/src/main/java/ssw/gui/dlgPrintBatchMechs.java +++ b/ssw/src/main/java/ssw/gui/dlgPrintBatchMechs.java @@ -88,7 +88,7 @@ public dlgPrintBatchMechs(java.awt.Frame parent, boolean modal) { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents private void initComponents() { diff --git a/ssw/src/main/java/ssw/gui/dlgPrintBattleforce.java b/ssw/src/main/java/ssw/gui/dlgPrintBattleforce.java index 522991a5..28ee9b77 100644 --- a/ssw/src/main/java/ssw/gui/dlgPrintBattleforce.java +++ b/ssw/src/main/java/ssw/gui/dlgPrintBattleforce.java @@ -61,7 +61,7 @@ public void actionPerformed(ActionEvent e) { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents private void initComponents() { diff --git a/ssw/src/main/java/ssw/gui/dlgQuirks.java b/ssw/src/main/java/ssw/gui/dlgQuirks.java index 7c32584d..bc39503a 100644 --- a/ssw/src/main/java/ssw/gui/dlgQuirks.java +++ b/ssw/src/main/java/ssw/gui/dlgQuirks.java @@ -66,7 +66,7 @@ private void Refresh() * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents private void initComponents() { diff --git a/ssw/src/main/java/ssw/gui/dlgSSWFiles.java b/ssw/src/main/java/ssw/gui/dlgSSWFiles.java index 256ebbc2..3542bc3b 100644 --- a/ssw/src/main/java/ssw/gui/dlgSSWFiles.java +++ b/ssw/src/main/java/ssw/gui/dlgSSWFiles.java @@ -33,7 +33,7 @@ public dlgSSWFiles(java.awt.Frame parent, boolean modal) { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents private void initComponents() { diff --git a/ssw/src/main/java/ssw/gui/dlgTechBaseChooser.java b/ssw/src/main/java/ssw/gui/dlgTechBaseChooser.java index f1718599..f74d59fe 100644 --- a/ssw/src/main/java/ssw/gui/dlgTechBaseChooser.java +++ b/ssw/src/main/java/ssw/gui/dlgTechBaseChooser.java @@ -51,7 +51,7 @@ public boolean IsClan() { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; diff --git a/ssw/src/main/java/ssw/gui/dlgTextExport.java b/ssw/src/main/java/ssw/gui/dlgTextExport.java index 56084786..cf7bb5f2 100644 --- a/ssw/src/main/java/ssw/gui/dlgTextExport.java +++ b/ssw/src/main/java/ssw/gui/dlgTextExport.java @@ -61,7 +61,7 @@ public dlgTextExport( java.awt.Frame parent, boolean modal, String msg ) { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; diff --git a/ssw/src/main/java/ssw/gui/dlgVariableSize.java b/ssw/src/main/java/ssw/gui/dlgVariableSize.java index 1983e628..8e9fd3b0 100644 --- a/ssw/src/main/java/ssw/gui/dlgVariableSize.java +++ b/ssw/src/main/java/ssw/gui/dlgVariableSize.java @@ -65,7 +65,7 @@ public boolean GetResult() { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; diff --git a/ssw/src/main/java/ssw/printpreview/dlgBFPreview.java b/ssw/src/main/java/ssw/printpreview/dlgBFPreview.java index 3d22ca22..81ed2602 100644 --- a/ssw/src/main/java/ssw/printpreview/dlgBFPreview.java +++ b/ssw/src/main/java/ssw/printpreview/dlgBFPreview.java @@ -82,7 +82,7 @@ public dlgBFPreview(String title, JFrame owner, Printer printer, Printable print * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents private void initComponents() { From 034527c092346d68bd37c3b2d75749859c3e860e Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 12:25:13 -0600 Subject: [PATCH 079/126] Single Warning Issues Fixed - Unused Variables - Variable Template Restrictions - Remove unused Imports - Removed null referenceing - Writer Closing - Removed duplicate implements - Removed assignment to variables not used --- .../java/ssw/gui/EquipmentListRenderer.java | 4 +-- .../ssw/gui/EquipmentSelectedRenderer.java | 2 +- .../java/ssw/gui/MechLoadoutRenderer.java | 2 +- ssw/src/main/java/ssw/gui/NumberRenderer.java | 1 - .../main/java/ssw/gui/dlgCostBVBreakdown.java | 4 +-- .../java/ssw/gui/dlgPrintBattleforce.java | 4 +-- ssw/src/main/java/ssw/gui/ifMechForm.java | 2 +- .../java/ssw/gui/thHDTransferHandler.java | 2 +- .../java/ssw/gui/thQueueTransferHandler.java | 2 +- sswlib/src/main/java/Force/Bonus.java | 6 ++-- sswlib/src/main/java/Force/Group.java | 3 +- sswlib/src/main/java/Force/Objective.java | 2 +- sswlib/src/main/java/IO/BFBReader.java | 4 +-- sswlib/src/main/java/IO/XMLReader.java | 4 +-- .../java/Print/AlphaStrikeCardPrinter.java | 8 ++--- .../java/Print/BattleforceCardPrinter.java | 14 ++++---- sswlib/src/main/java/Print/FontLoader.java | 1 - sswlib/src/main/java/Print/PagePrinter.java | 14 ++++---- .../java/battleforce/BattleForceStats.java | 12 +++---- .../main/java/battleforce/ifBattleforce.java | 2 +- sswlib/src/main/java/common/CommonTools.java | 11 +++--- .../src/main/java/components/BoobyTrap.java | 4 +-- .../java/components/CVPowerAmplifier.java | 6 ++-- sswlib/src/main/java/components/Cockpit.java | 35 ++++++++++--------- .../src/main/java/components/MechTurret.java | 4 +-- .../main/java/components/PowerAmplifier.java | 2 +- .../main/java/components/SimplePlaceable.java | 4 +-- .../java/components/TargetingComputer.java | 4 +-- .../src/main/java/components/ifLoadout.java | 4 +-- .../java/filehandlers/UnitCacheParser.java | 3 ++ .../main/java/list/view/NumberRenderer.java | 1 - 31 files changed, 86 insertions(+), 85 deletions(-) diff --git a/ssw/src/main/java/ssw/gui/EquipmentListRenderer.java b/ssw/src/main/java/ssw/gui/EquipmentListRenderer.java index 0d927ab4..1d7c31c1 100644 --- a/ssw/src/main/java/ssw/gui/EquipmentListRenderer.java +++ b/ssw/src/main/java/ssw/gui/EquipmentListRenderer.java @@ -51,8 +51,8 @@ public EquipmentListRenderer( ifMechForm p ) { } @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { - JLabel label = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, hasFocus); + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { + JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, hasFocus); String Text = ""; if( value instanceof abPlaceable ) { a = (abPlaceable) value; diff --git a/ssw/src/main/java/ssw/gui/EquipmentSelectedRenderer.java b/ssw/src/main/java/ssw/gui/EquipmentSelectedRenderer.java index 3c626a97..957463f5 100644 --- a/ssw/src/main/java/ssw/gui/EquipmentSelectedRenderer.java +++ b/ssw/src/main/java/ssw/gui/EquipmentSelectedRenderer.java @@ -48,7 +48,7 @@ public EquipmentSelectedRenderer( ifMechForm p ) { } @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { JLabel label = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, hasFocus); String Text = ""; if( value instanceof abPlaceable ) { diff --git a/ssw/src/main/java/ssw/gui/MechLoadoutRenderer.java b/ssw/src/main/java/ssw/gui/MechLoadoutRenderer.java index 83b70a0c..ccf68d9e 100644 --- a/ssw/src/main/java/ssw/gui/MechLoadoutRenderer.java +++ b/ssw/src/main/java/ssw/gui/MechLoadoutRenderer.java @@ -76,7 +76,7 @@ public void Reset() { } @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { JLabel label = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, hasFocus); String Text = ""; abPlaceable[] Loc = null; diff --git a/ssw/src/main/java/ssw/gui/NumberRenderer.java b/ssw/src/main/java/ssw/gui/NumberRenderer.java index bd3b5681..f3e57534 100644 --- a/ssw/src/main/java/ssw/gui/NumberRenderer.java +++ b/ssw/src/main/java/ssw/gui/NumberRenderer.java @@ -5,7 +5,6 @@ package ssw.gui; -import java.text.Format; import javax.swing.JLabel; import javax.swing.table.DefaultTableCellRenderer; diff --git a/ssw/src/main/java/ssw/gui/dlgCostBVBreakdown.java b/ssw/src/main/java/ssw/gui/dlgCostBVBreakdown.java index e406a61a..ce2bdc67 100644 --- a/ssw/src/main/java/ssw/gui/dlgCostBVBreakdown.java +++ b/ssw/src/main/java/ssw/gui/dlgCostBVBreakdown.java @@ -38,14 +38,14 @@ public class dlgCostBVBreakdown extends javax.swing.JDialog { */ private static final long serialVersionUID = 4927619301628972669L; private Mech CurMech; - private String NL; + // private String NL; /** Creates new form dlgCostBVBreakdown */ public dlgCostBVBreakdown(java.awt.Frame parent, boolean modal, Mech m ) { super(parent, modal); initComponents(); CurMech = m; - NL = System.getProperty( "line.separator" ); + // NL = System.getProperty( "line.separator" ); CostBVBreakdown Breakdown = new CostBVBreakdown(m); txtCostBV.setText( Breakdown.Render() ); txtCostBV.setCaretPosition( 0 ); diff --git a/ssw/src/main/java/ssw/gui/dlgPrintBattleforce.java b/ssw/src/main/java/ssw/gui/dlgPrintBattleforce.java index 28ee9b77..e716dc6a 100644 --- a/ssw/src/main/java/ssw/gui/dlgPrintBattleforce.java +++ b/ssw/src/main/java/ssw/gui/dlgPrintBattleforce.java @@ -24,7 +24,7 @@ public class dlgPrintBattleforce extends javax.swing.JDialog { * */ private static final long serialVersionUID = 5419050756388713021L; - private BattleForce force; + // private BattleForce force; public boolean Result = false; public String Sheet = BattleForce.InnerSphere; @@ -33,7 +33,7 @@ public dlgPrintBattleforce(java.awt.Frame parent, boolean modal, BattleForce for super(parent, modal); initComponents(); - this.force = force; + // this.force = force; lblForce.setText(lblForce.getText().replace("{Force}", force.ForceName).replace("{Units}", force.BattleForceStats.size()+"")); this.setTitle(force.ForceName); diff --git a/ssw/src/main/java/ssw/gui/ifMechForm.java b/ssw/src/main/java/ssw/gui/ifMechForm.java index 2c716327..5565a2c6 100644 --- a/ssw/src/main/java/ssw/gui/ifMechForm.java +++ b/ssw/src/main/java/ssw/gui/ifMechForm.java @@ -36,7 +36,7 @@ public interface ifMechForm { public Preferences GetPrefs(); - public int GetLocation( javax.swing.JList list ); + public int GetLocation( javax.swing.JList list ); public Mech GetMech(); public String BuildLookupName( ifState s ); public abPlaceable GetCurItem(); diff --git a/ssw/src/main/java/ssw/gui/thHDTransferHandler.java b/ssw/src/main/java/ssw/gui/thHDTransferHandler.java index 7987799b..e7b7f4f4 100644 --- a/ssw/src/main/java/ssw/gui/thHDTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thHDTransferHandler.java @@ -55,7 +55,7 @@ public Transferable createTransferable( JComponent comp ) { // all we want to do is transfer the index in the queue LocationDragDatagram d = new LocationDragDatagram(); d.Location = LocationIndex.MECH_LOC_HD; - d.SourceIndex = ((JList) comp).getSelectedIndex(); + d.SourceIndex = ((JList) comp).getSelectedIndex(); d.Locked = CurMech.GetLoadout().GetHDCrits()[d.SourceIndex].LocationLocked(); if( CurMech.GetLoadout().GetHDCrits()[d.SourceIndex] instanceof EmptyItem ) { d.Empty = true; diff --git a/ssw/src/main/java/ssw/gui/thQueueTransferHandler.java b/ssw/src/main/java/ssw/gui/thQueueTransferHandler.java index d1ed3bab..4da744b0 100644 --- a/ssw/src/main/java/ssw/gui/thQueueTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thQueueTransferHandler.java @@ -47,7 +47,7 @@ public Transferable createTransferable( JComponent comp ) { // all we want to do is transfer the index in the queue LocationDragDatagram d = new LocationDragDatagram(); d.Location = -1; - d.SourceIndex = ((JList) comp).getSelectedIndex(); + d.SourceIndex = ((JList) comp).getSelectedIndex(); return d; } diff --git a/sswlib/src/main/java/Force/Bonus.java b/sswlib/src/main/java/Force/Bonus.java index 021527f2..c9238f2c 100644 --- a/sswlib/src/main/java/Force/Bonus.java +++ b/sswlib/src/main/java/Force/Bonus.java @@ -36,11 +36,11 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT /** * This object contains information about a Warchest Optional Bonus */ -public class Bonus extends abWarchestItem implements ifSerializable { +public class Bonus extends abWarchestItem { // implements ifSerializable { // Redundant as already defined in abWarchestItem public Bonus( String Description, int Value ) { super(Description, Value); } - + public Bonus() { super("", 0); } @@ -71,4 +71,4 @@ public String toString() { public String toPrint() { return " " + SerializeClipboard(); } -} \ No newline at end of file +} diff --git a/sswlib/src/main/java/Force/Group.java b/sswlib/src/main/java/Force/Group.java index 819997cd..0e26284f 100644 --- a/sswlib/src/main/java/Force/Group.java +++ b/sswlib/src/main/java/Force/Group.java @@ -9,7 +9,6 @@ import org.w3c.dom.Node; import battleforce.BattleForce; import battleforce.BattleForceStats; -import java.util.ArrayList; import list.view.Column; public class Group { @@ -218,7 +217,7 @@ public float getTotalBV() { } return TotalBV; } - + public int getTotalPV() { TotalPV = 0; for ( Unit u : Units ) { diff --git a/sswlib/src/main/java/Force/Objective.java b/sswlib/src/main/java/Force/Objective.java index 2aab3201..22c86a35 100644 --- a/sswlib/src/main/java/Force/Objective.java +++ b/sswlib/src/main/java/Force/Objective.java @@ -33,7 +33,7 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import java.io.IOException; import org.w3c.dom.Node; -public class Objective extends abWarchestItem implements ifSerializable { +public class Objective extends abWarchestItem { // implements ifSerializable { // Redundant as already defined in abWarchestItem public Objective( String Description, int Value ) { super(Description, Value); } diff --git a/sswlib/src/main/java/IO/BFBReader.java b/sswlib/src/main/java/IO/BFBReader.java index 9bc7d4b1..f4342b6c 100644 --- a/sswlib/src/main/java/IO/BFBReader.java +++ b/sswlib/src/main/java/IO/BFBReader.java @@ -46,7 +46,7 @@ public BFBReader() { dbf.setAttribute(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); dbf.setExpandEntityReferences(false); } - + public Scenario ReadScenario( String filename ) throws Exception { System.out.println("Loading Scenario from " + filename); Scenario scenario = new Scenario(); @@ -93,7 +93,7 @@ public void ReadMUL( Force force, String filename ) throws Exception { db = dbf.newDocumentBuilder(); load = db.parse( filename ); - NodeList n = load.getElementsByTagName("unit"); + // NodeList n = load.getElementsByTagName("unit"); // Unneeded operation as variable is never used. } public Node ReadWarriors( String filename ) throws Exception { diff --git a/sswlib/src/main/java/IO/XMLReader.java b/sswlib/src/main/java/IO/XMLReader.java index 70f7ffc0..fe158141 100644 --- a/sswlib/src/main/java/IO/XMLReader.java +++ b/sswlib/src/main/java/IO/XMLReader.java @@ -69,7 +69,7 @@ public XMLReader() { dbf.setAttribute(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); dbf.setExpandEntityReferences(false); } - + public Scenario ReadScenario( String filename ) throws Exception { System.out.println("Loading Scenario from " + filename); Scenario scenario = new Scenario(); @@ -116,7 +116,7 @@ public void ReadMUL( Force force, String filename ) throws Exception { db = dbf.newDocumentBuilder(); load = db.parse( filename ); - NodeList n = load.getElementsByTagName("unit"); + // NodeList n = load.getElementsByTagName("unit"); // Unneded as variable is never used } public Node ReadWarriors( String filename ) throws Exception { diff --git a/sswlib/src/main/java/Print/AlphaStrikeCardPrinter.java b/sswlib/src/main/java/Print/AlphaStrikeCardPrinter.java index 3b1c5123..de93eeb5 100644 --- a/sswlib/src/main/java/Print/AlphaStrikeCardPrinter.java +++ b/sswlib/src/main/java/Print/AlphaStrikeCardPrinter.java @@ -72,7 +72,7 @@ public AlphaStrikeCardPrinter(ImageTracker images) { public void Add( BattleForceStats stat ) { getBattleforce().BattleForceStats.add(stat); } - + public void setUnitSheet( String item ) { Card = imageTracker.getImage( item ); } @@ -86,7 +86,7 @@ public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws Render(); return Printable.PAGE_EXISTS; } - + public void Render() { int elementCount = 0; Image icon = null; @@ -118,7 +118,7 @@ public void Render() { Image image = imageTracker.getImage(stats.getImage()); Dimension dim = imageTracker.media.reSize(image, 100d, 130d); image.getScaledInstance(dim.width, dim.height, Image.SCALE_SMOOTH); - Point offset = imageTracker.media.offsetImageBottom( new Dimension(100, 130), dim); + // Point offset = imageTracker.media.offsetImageBottom( new Dimension(100, 130), dim); // Not used within scope. graphic.drawImage(image, x+UnitImageWidth-dim.width-5, y+25, dim.width, dim.height, null); if ( icon != null && printLogo ) { @@ -131,7 +131,7 @@ public void Render() { Point minBounds = new Point(6, 6); Point maxBounds = new Point(UnitImageWidth - 6, UnitImageHeight - 6); - + //Print out a grid for dev purposes only for (int j = minBounds.y; i < maxBounds.y; i+=10) { diff --git a/sswlib/src/main/java/Print/BattleforceCardPrinter.java b/sswlib/src/main/java/Print/BattleforceCardPrinter.java index 76df4413..b2c80e49 100644 --- a/sswlib/src/main/java/Print/BattleforceCardPrinter.java +++ b/sswlib/src/main/java/Print/BattleforceCardPrinter.java @@ -49,7 +49,7 @@ public class BattleforceCardPrinter implements Printable { private Image RecordSheet, Unit, Charts; - private int UnitSize = 4, + private int // UnitSize = 4, // Variable not read anywhere UnitImageWidth = 187, UnitImageHeight = 234, ElementLimit = 2; @@ -81,7 +81,7 @@ public void Add( BattleForceStats stat ) { public void setRecordSheet( String sheet ) { RecordSheet = imageTracker.getImage(sheet); } - + public void setUnitSheet( String item ) { Unit = imageTracker.getImage( item ); } @@ -97,15 +97,15 @@ public void setType( String Type ) { } public void setInnerSphere() { - UnitSize = 4; + // UnitSize = 4;// Set but not used } public void setClan() { - UnitSize = 5; + // UnitSize = 5;// Set but not used } public void setComstar() { - UnitSize = 6; + // UnitSize = 6; // Set but not used } public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { @@ -117,7 +117,7 @@ public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws Render(); return Printable.PAGE_EXISTS; } - + public void Render() { int elementCount = 0; Image icon = null; @@ -172,7 +172,7 @@ public void Render() { //graphic.setFont( new Font("Verdana", Font.PLAIN, 8) ); graphic.setFont( PrintConsts.PlainFont ); - + //Unit Name int offset = y + 55; for ( String line : PrintConsts.wrapText(stats.getElement(), 24, false) ) { diff --git a/sswlib/src/main/java/Print/FontLoader.java b/sswlib/src/main/java/Print/FontLoader.java index c13af9c2..9c9f8ed6 100644 --- a/sswlib/src/main/java/Print/FontLoader.java +++ b/sswlib/src/main/java/Print/FontLoader.java @@ -9,7 +9,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStream; -import java.io.InputStreamReader; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/sswlib/src/main/java/Print/PagePrinter.java b/sswlib/src/main/java/Print/PagePrinter.java index 201e414c..98f3ef8c 100644 --- a/sswlib/src/main/java/Print/PagePrinter.java +++ b/sswlib/src/main/java/Print/PagePrinter.java @@ -31,14 +31,14 @@ import filehandlers.Media; import java.awt.print.*; import javax.print.PrintService; -import javax.print.PrintServiceLookup; +// import javax.print.PrintServiceLookup; public class PagePrinter { private String jobName = "Skunkwerks Print"; private boolean DoPrint = true; private Book pages = new Book(); - private PrintService service; + // private PrintService service; // Not used private PrinterJob job = PrinterJob.getPrinterJob(); public PagePrinter() { @@ -57,19 +57,21 @@ public void Clear() { pages = new Book(); } - public void selectService( String printerName ) { + public void selectService(String printerName) { + /* service isn't used so turning into NoOp PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null); for (PrintService printer : services ) { if ( printer.getName().equals(printerName) ) { service = printer; } } + */ } public void selectService( PrintService printerName ) { - service = printerName; + // service = printerName; } - + public Book Preview() { return pages; } @@ -93,7 +95,7 @@ public void Print() { DoPrint = job.printDialog(); job.setPageable(Preview()); - + if( DoPrint ) { try { job.print(); diff --git a/sswlib/src/main/java/battleforce/BattleForceStats.java b/sswlib/src/main/java/battleforce/BattleForceStats.java index 975cab4f..be5d8a2e 100644 --- a/sswlib/src/main/java/battleforce/BattleForceStats.java +++ b/sswlib/src/main/java/battleforce/BattleForceStats.java @@ -53,7 +53,7 @@ public class BattleForceStats { Logo = ""; private double[] Mods = {2.63, 2.24, 1.82, 1.38, 1.00, 0.86, 0.77, 0.68}; - private boolean isTerrainModified = false; + // private boolean isTerrainModified = false; // Not used private ArrayList Abilities = new ArrayList(); private ArrayList AltMunitions = new ArrayList(); private BattleForceData BFData = new BattleForceData(); @@ -156,7 +156,7 @@ public BattleForceStats( CombatVehicle m, String Unit, int Gunnery, int Piloting setGunnery(Gunnery); setPiloting(Piloting); } - + public BattleForceStats( Node n ) throws Exception { try { BasePV = Integer.parseInt(n.getAttributes().getNamedItem("pv").getTextContent()); @@ -259,7 +259,7 @@ public String determineGP( int Skill ) { updateGP(); return Gunnery + "/" + Piloting; } - + private void updateGP() { switch (Skill) { case 0: @@ -373,7 +373,7 @@ public ArrayList getDamageAbilities() { String[] data = ability.replace("AC ", "").replace("SRM ", "").replace("LRM ", "").replace("AC", "").replace("SRM", "").replace("LRM", "").replace("TUR", "").replace("(", "").replace(")", "").split("/"); info[1] = data[0]; info[2] = data[1]; - if ( data.length > 2 ) + if ( data.length > 2 ) info[3] = data[2]; else info[3] = "0"; @@ -637,11 +637,11 @@ public String getLogo() { public void setLogo(String Logo) { this.Logo = Logo; } - + public String getBFType() { return BFType; } - + public void setBFType(String BFType) { this.BFType = BFType; } diff --git a/sswlib/src/main/java/battleforce/ifBattleforce.java b/sswlib/src/main/java/battleforce/ifBattleforce.java index 05f07bfc..beb75553 100644 --- a/sswlib/src/main/java/battleforce/ifBattleforce.java +++ b/sswlib/src/main/java/battleforce/ifBattleforce.java @@ -41,7 +41,7 @@ public interface ifBattleforce { public int GetBFArmor(); public int GetBFStructure(); public int [] GetBFDamage( BattleForceStats bfs ); - public ArrayList GetBFAbilities(); + public ArrayList GetBFAbilities(); public String GetBFConversionStr( ); public int GetBFPoints(); public int GetAmmoCount( int ammoIndex ); diff --git a/sswlib/src/main/java/common/CommonTools.java b/sswlib/src/main/java/common/CommonTools.java index 7cbeb69b..27dc3acd 100644 --- a/sswlib/src/main/java/common/CommonTools.java +++ b/sswlib/src/main/java/common/CommonTools.java @@ -31,7 +31,6 @@ import components.*; import java.io.File; import java.math.BigDecimal; -import java.math.BigInteger; import java.math.RoundingMode; import java.text.DecimalFormat; @@ -53,7 +52,7 @@ public class CommonTools { Dropship = 9, SupportVehicle = 10, MobileStructure = 11; - + public final static String[] UnitTypes = { "BattleMech", "IndustrialMech", "ProtoMech", "Combat Vehicle", "Infantry", "Battle Armor", "Conventional Fighter", @@ -188,14 +187,14 @@ public static boolean IsAllowed( AvailableCode AC, ifUnit u ) { } else { if( AC.IsPrimitiveOnly() ) { return false; } } - + // If this 'Mech is Super Heavy, the equipment must be compatible if ( ((Mech) u).IsSuperheavy() ) { if ( ! AC.IsSuperHeavyCompatible() ) { return false; } } else { if ( AC.IsSuperHeavyOnly() ) { return false; } } - + break; case AvailableCode.UNIT_INDUSTRIALMECH: if( ! ( u instanceof Mech ) ) { return false; } @@ -700,7 +699,7 @@ public static int GetToHitAtRange( ifWeapon w, int range ) { * weapon-specific, it does not account for target or firer movement, or * other modifiers. If the weapon cannot hit at the given range, we return * 12. - * + * * @param w The weapon in question. * @param a The ammunition that the weapon will be using. * @param range The range that the weapon will be hitting a target at. @@ -824,7 +823,7 @@ public static double RoundHalfUp( double d ) { } /*** - * Adds .5 and rounds the result...this should round up to the full integer anything <.4 + * Adds .5 and rounds the result...this should round up to the full integer anything <.4 * @param d Value to round up to the next full integer * @return rounded integer */ diff --git a/sswlib/src/main/java/components/BoobyTrap.java b/sswlib/src/main/java/components/BoobyTrap.java index 034f198c..916781a1 100644 --- a/sswlib/src/main/java/components/BoobyTrap.java +++ b/sswlib/src/main/java/components/BoobyTrap.java @@ -31,7 +31,7 @@ public class BoobyTrap extends abPlaceable { private ifMechLoadout Owner; - private int MP = 0; + // private int MP = 0; // Not Used private static AvailableCode AC = new AvailableCode( AvailableCode.TECH_INNER_SPHERE ); private int Crits = 1; @@ -172,4 +172,4 @@ public boolean LocationLocked() { public AvailableCode GetAvailability() { return AC; } -} \ No newline at end of file +} diff --git a/sswlib/src/main/java/components/CVPowerAmplifier.java b/sswlib/src/main/java/components/CVPowerAmplifier.java index bb1b3308..27218002 100644 --- a/sswlib/src/main/java/components/CVPowerAmplifier.java +++ b/sswlib/src/main/java/components/CVPowerAmplifier.java @@ -54,12 +54,12 @@ public AvailableCode GetAvailability() { public double GetTonnage() { double tons = 0.0; - + //we only use the poweramp if the engine is ICE if ( CurLoadout.GetEngine().IsNuclear()) return tons; - - ArrayList v = CurLoadout.GetNonCore(); + + ArrayList v = CurLoadout.GetNonCore(); for( int i = 0; i < v.size(); i++ ) { if( v.get( i ) instanceof RangedWeapon ) { if ( ((ifWeapon)v.get( i ) ).RequiresPowerAmps() ) diff --git a/sswlib/src/main/java/components/Cockpit.java b/sswlib/src/main/java/components/Cockpit.java index fac82096..ef420064 100644 --- a/sswlib/src/main/java/components/Cockpit.java +++ b/sswlib/src/main/java/components/Cockpit.java @@ -89,7 +89,7 @@ public void SetInterfaceCockpit() { public void SetTorsoMount() { CurConfig = TorsoCockpit; } - + public void SetVirtualRealityPilotingPod(){ CurConfig = VirtualRealityPilotingPod; } @@ -97,14 +97,14 @@ public void SetVirtualRealityPilotingPod(){ public void SetRobotic() { CurConfig = RoboticCockpit; } - + /** * Set this cockpit to a Super Heavy cockpit */ public void SetSuperHeavy() { CurConfig = SuperHeavyCockpit; } - + public ifState GetCurrentState() { return (ifState) CurConfig; @@ -192,7 +192,7 @@ public boolean Place( ifMechLoadout l ) { return false; } } - + return true; } @@ -201,9 +201,10 @@ public boolean Place( ifMechLoadout l, LocationIndex[] locs ) { // Add in the cockpit, life support, and sensors. // Cockpit itself first LocationIndex loc = null; + try { if( locs[0] == null ) { - l.AddTo( this, loc.Location, loc.Index ); + return false; // l.AddTo( this, loc.Location, loc.Index ); // Null Access. } else { l.AddTo( this, locs[0].Location, locs[0].Index); } @@ -265,7 +266,7 @@ public boolean Place( ifMechLoadout l, LocationIndex[] locs ) { return false; } } - + // Do we have a third Life Support Location? if( CurConfig.HasThirdLifeSupport() ) { try { @@ -424,17 +425,17 @@ public boolean CanUseCommandConsole() { } public ifState[] GetStates() { - ifState[] retval = { - (ifState) StandardCockpit, + ifState[] retval = { + (ifState) StandardCockpit, (ifState) SmallCockpit, - (ifState) TorsoCockpit, + (ifState) TorsoCockpit, (ifState) VirtualRealityPilotingPod, - (ifState) IndustrialCockpit, + (ifState) IndustrialCockpit, (ifState) IndusAFCCockpit, - (ifState) InterfaceCockpit, - (ifState) Primitive, - (ifState) PrimIndustrial, - (ifState) PrimIndusAFC, + (ifState) InterfaceCockpit, + (ifState) Primitive, + (ifState) PrimIndustrial, + (ifState) PrimIndusAFC, (ifState) RoboticCockpit, (ifState) SuperHeavyCockpit}; return retval; @@ -452,12 +453,12 @@ public boolean HasThirdSensors() { return CurConfig.HasThirdSensors(); } - + public boolean HasThirdLifeSupport() { return CurConfig.HasThirdLifeSupport(); } - + // the following 3 methods provided for the torso-mounted cockpit for saving public SimplePlaceable GetFirstSensors() { return CurConfig.GetSensors(); @@ -478,7 +479,7 @@ public SimplePlaceable GetFirstLS() { public SimplePlaceable GetSecondLS() { return CurConfig.GetSecondLifeSupport(); } - + public SimplePlaceable GetThirdLS() { return CurConfig.GetThirdLifeSupport(); } diff --git a/sswlib/src/main/java/components/MechTurret.java b/sswlib/src/main/java/components/MechTurret.java index 749cbfa2..94249f77 100644 --- a/sswlib/src/main/java/components/MechTurret.java +++ b/sswlib/src/main/java/components/MechTurret.java @@ -59,7 +59,7 @@ public boolean AddWeapon( ifWeapon w ) { //Make sure if they can split, that they haven't been. if( ((RangedWeapon) w).CanSplit() ) { //Gets all crit slots - ArrayList locations = Owner.FindIndexes( (abPlaceable) w ); + ArrayList locations = Owner.FindIndexes( (abPlaceable) w ); //first one LocationIndex firstSlot = (LocationIndex) locations.get(0); //check all of them @@ -232,4 +232,4 @@ public AvailableCode GetAvailability() { } return AC; } -} \ No newline at end of file +} diff --git a/sswlib/src/main/java/components/PowerAmplifier.java b/sswlib/src/main/java/components/PowerAmplifier.java index 2368ab2d..36e711ee 100644 --- a/sswlib/src/main/java/components/PowerAmplifier.java +++ b/sswlib/src/main/java/components/PowerAmplifier.java @@ -54,7 +54,7 @@ public AvailableCode GetAvailability() { public double GetTonnage() { double tons = 0.0; - ArrayList v = CurLoadout.GetNonCore(); + ArrayList v = CurLoadout.GetNonCore(); for( int i = 0; i < v.size(); i++ ) { if( v.get( i ) instanceof ifWeapon ) { if ( ((ifWeapon)v.get( i ) ).RequiresPowerAmps() ) diff --git a/sswlib/src/main/java/components/SimplePlaceable.java b/sswlib/src/main/java/components/SimplePlaceable.java index 636994d6..05b76f53 100644 --- a/sswlib/src/main/java/components/SimplePlaceable.java +++ b/sswlib/src/main/java/components/SimplePlaceable.java @@ -42,7 +42,7 @@ public class SimplePlaceable extends abPlaceable { private String ActualName, LookupName, CritName, - ChatName, + // ChatName, // Not Used BookReference, MegaMekName; private AvailableCode AC; @@ -112,7 +112,7 @@ public double GetTonnage() { return Tonnage; } } - + public void SetArmoredTonnage(double tonnage){ ArmoredTonnage = tonnage; } diff --git a/sswlib/src/main/java/components/TargetingComputer.java b/sswlib/src/main/java/components/TargetingComputer.java index 11579a8b..ad87b79e 100644 --- a/sswlib/src/main/java/components/TargetingComputer.java +++ b/sswlib/src/main/java/components/TargetingComputer.java @@ -169,7 +169,7 @@ public AvailableCode GetAvailability() { private int GetSize() { double Build = 0.0; - ArrayList V = Owner.GetTCList(); + ArrayList V = Owner.GetTCList(); if( V.size() == 0 ) { return 0; @@ -211,7 +211,7 @@ public boolean CoreComponent() { public String toString() { return CritName(); } - + public String toDisplay() { return " (" + Owner.GetTCList().size() + " items : " + GetTonnage() + " tons)"; } diff --git a/sswlib/src/main/java/components/ifLoadout.java b/sswlib/src/main/java/components/ifLoadout.java index 77e506e6..9097da63 100644 --- a/sswlib/src/main/java/components/ifLoadout.java +++ b/sswlib/src/main/java/components/ifLoadout.java @@ -31,11 +31,11 @@ import java.util.ArrayList; public interface ifLoadout { - public ArrayList GetTCList(); + public ArrayList GetTCList(); public Engine GetEngine(); public boolean UsingFractionalAccounting(); public int GetTechBase(); public int Find( abPlaceable p ); - public ArrayList GetNonCore(); + public ArrayList GetNonCore(); public ifUnit GetUnit(); } diff --git a/sswlib/src/main/java/filehandlers/UnitCacheParser.java b/sswlib/src/main/java/filehandlers/UnitCacheParser.java index 53201d77..dab57bb8 100644 --- a/sswlib/src/main/java/filehandlers/UnitCacheParser.java +++ b/sswlib/src/main/java/filehandlers/UnitCacheParser.java @@ -29,10 +29,13 @@ public static ArrayList LoadUnitCache(BufferedReader br) throws IO public static int WriteUnitCache(ArrayList unitList, BufferedWriter bw) throws IOException { int unitsWritten = 0; CSVPrinter printer = new CSVPrinter(bw, CSVFormat.DEFAULT); + for (UnitListData unit : unitList) { printer.printRecord(unit.toCsvIndex()); unitsWritten++; } + + printer.close(); return unitsWritten; } } diff --git a/sswlib/src/main/java/list/view/NumberRenderer.java b/sswlib/src/main/java/list/view/NumberRenderer.java index 53fe4c44..c884c431 100644 --- a/sswlib/src/main/java/list/view/NumberRenderer.java +++ b/sswlib/src/main/java/list/view/NumberRenderer.java @@ -5,7 +5,6 @@ package list.view; -import java.text.Format; import javax.swing.JLabel; import javax.swing.table.DefaultTableCellRenderer; From b21f0ee5dba318f445d552f79485075af2a143e6 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 13:25:15 -0600 Subject: [PATCH 080/126] 2 Warning Files - Unused Variables - Type Saftey - Removed unused imports --- ssw/src/main/java/ssw/gui/dlgQuirks.java | 4 ++-- .../java/ssw/utilities/FiringSolution.java | 8 ++++---- sswlib/src/main/java/Force/Scenario.java | 7 +++---- sswlib/src/main/java/Print/BFBPrinter.java | 7 +++---- sswlib/src/main/java/common/DesignForm.java | 6 +++--- .../java/components/CVAmmunitionHandler.java | 6 +++--- .../src/main/java/components/Equipment.java | 10 +++++----- .../main/java/components/RangedWeapon.java | 20 +++++++++---------- .../main/java/dialog/AmmoChooserRenderer.java | 4 ++-- sswlib/src/main/java/list/view/tbQuirks.java | 6 +++--- .../java/list/view/tbTotalWarfareView.java | 2 -- 11 files changed, 38 insertions(+), 42 deletions(-) diff --git a/ssw/src/main/java/ssw/gui/dlgQuirks.java b/ssw/src/main/java/ssw/gui/dlgQuirks.java index bc39503a..dd52a7c3 100644 --- a/ssw/src/main/java/ssw/gui/dlgQuirks.java +++ b/ssw/src/main/java/ssw/gui/dlgQuirks.java @@ -39,7 +39,7 @@ public class dlgQuirks extends javax.swing.JDialog { */ private static final long serialVersionUID = 4195412552625797884L; private DataFactory list; - private ArrayList existingQuirks; + // private ArrayList existingQuirks; // Not used private tbQuirks tblQ; /** Creates new form dlgQuirks */ @@ -48,7 +48,7 @@ public dlgQuirks(java.awt.Frame parent, boolean modal, DataFactory quirks, Array initComponents(); list = quirks; - existingQuirks = currentQuirks; + // existingQuirks = currentQuirks; tblQ = new tbQuirks(currentQuirks); tblQ.setupTable(tblSelected); diff --git a/ssw/src/main/java/ssw/utilities/FiringSolution.java b/ssw/src/main/java/ssw/utilities/FiringSolution.java index f1899ba3..43d1c183 100644 --- a/ssw/src/main/java/ssw/utilities/FiringSolution.java +++ b/ssw/src/main/java/ssw/utilities/FiringSolution.java @@ -30,15 +30,15 @@ public class FiringSolution { // provides a class for containing a firing solution at a set range. - private int range = -1; - private String NL; + // private int range = -1; // Variables not used + // private String NL; // Variables not used // This is a text formating string (80 chars) I keep around for when it's needed // "----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+" // retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.0f", a.GetCritName(), a.GetDefensiveBV(), a.GetOffensiveBV(), a.GetCost() ) + NL; public FiringSolution( int r ) { - range = r; - NL = System.getProperty( "line.separator" ); + // range = r; // Variable not used + // NL = System.getProperty( "line.separator" ); // Variables not used } } diff --git a/sswlib/src/main/java/Force/Scenario.java b/sswlib/src/main/java/Force/Scenario.java index 929a759f..abfe7615 100644 --- a/sswlib/src/main/java/Force/Scenario.java +++ b/sswlib/src/main/java/Force/Scenario.java @@ -37,7 +37,6 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import java.io.BufferedWriter; import java.io.IOException; import java.util.ArrayList; -import java.util.ArrayList; import javax.swing.JTable; import javax.swing.event.TableModelListener; import org.w3c.dom.Node; @@ -58,7 +57,7 @@ public class Scenario implements ifSerializable { Aftermath = ""; private ArrayList forces = new ArrayList(); private Warchest warchest = new Warchest(); - private abTable currentModel; + // private abTable currentModel; // Unused Variable public Scenario() { forces.add(new Force()); @@ -144,7 +143,7 @@ public void updateOpFor( boolean UseMod ) { for ( Force f : forces ) { f.useUnevenForceMod = UseMod; } - + if ( UseMod ) { forceSizeModifier = true; setOpFor(); @@ -200,7 +199,7 @@ public ArrayList toBattleForceBySize( int SizeLimit ) { stat.setForceName( f.ForceName ); stat.setLogo(g.getLogo()); bf.BattleForceStats.add(stat); - + if ( bf.BattleForceStats.size() == SizeLimit ) { BattleForces.add(bf); bf = new BattleForce(); diff --git a/sswlib/src/main/java/Print/BFBPrinter.java b/sswlib/src/main/java/Print/BFBPrinter.java index ddb2ebdb..ecceee59 100644 --- a/sswlib/src/main/java/Print/BFBPrinter.java +++ b/sswlib/src/main/java/Print/BFBPrinter.java @@ -33,12 +33,11 @@ import filehandlers.ImageTracker; import java.awt.print.*; import java.util.ArrayList; -import java.util.Vector; public final class BFBPrinter { private String jobName = "Battletech Force Balancer", Title = "Battletech Force Balancer"; - private Boolean useDialog = true; + // private Boolean useDialog = true; // Not Used private ForceListPrinter sheet; private PrintDeclaration chits; private ArrayList forces = new ArrayList(); @@ -100,7 +99,7 @@ public void setPaperSize( PaperSize s ) { } public void Print( boolean useDialog ) { - this.useDialog = useDialog; + // this.useDialog = useDialog; Print(); } @@ -159,4 +158,4 @@ public void setTitle(String Title) { this.Title = Title; sheet.setTitle(Title); } -} \ No newline at end of file +} diff --git a/sswlib/src/main/java/common/DesignForm.java b/sswlib/src/main/java/common/DesignForm.java index aba73678..0268947f 100644 --- a/sswlib/src/main/java/common/DesignForm.java +++ b/sswlib/src/main/java/common/DesignForm.java @@ -34,12 +34,12 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import states.ifState; public interface DesignForm { - public void setUnit( ArrayList v ); + public void setUnit( ArrayList v ); public void loadUnitIntoGUI(); public void showOpenDialog(); - + public Preferences GetPrefs(); - public int GetLocation( javax.swing.JList list ); + public int GetLocation( javax.swing.JList list ); public String BuildLookupName( ifState s ); public abPlaceable GetCurItem(); public void RefreshInfoPane(); diff --git a/sswlib/src/main/java/components/CVAmmunitionHandler.java b/sswlib/src/main/java/components/CVAmmunitionHandler.java index 90e1b29c..8083ab44 100644 --- a/sswlib/src/main/java/components/CVAmmunitionHandler.java +++ b/sswlib/src/main/java/components/CVAmmunitionHandler.java @@ -32,10 +32,10 @@ public class CVAmmunitionHandler { private Vector Ammo = new Vector(); - private CVLoadout Owner; + // private CVLoadout Owner; // Not Used public CVAmmunitionHandler( CVLoadout c ) { - Owner = c; + // Owner = c; } public void AddAmmo( Ammunition a ) { @@ -78,4 +78,4 @@ public int AmmoSpace() { public String toString() { return "Total Ammo (" + String.format( "%1$3.1f", GetTonnage() ) + " tons, " + AmmoSpace() + " spaces)"; } -} \ No newline at end of file +} diff --git a/sswlib/src/main/java/components/Equipment.java b/sswlib/src/main/java/components/Equipment.java index a8bdacad..94295cb1 100644 --- a/sswlib/src/main/java/components/Equipment.java +++ b/sswlib/src/main/java/components/Equipment.java @@ -248,10 +248,10 @@ public String PrintName() { String retval = CritName(); if ( retval.length() >= 20 ) retval = ChatName(); - + return retval; } - + public String LookupName() { if( Rear ) { return "(R) " + LookupName; @@ -500,7 +500,7 @@ public double GetVariableIncrement() { public double GetMaxTons() { return MaxTons; } - + public void SetMaxTons(double Max) { MaxTons = Max; } @@ -527,7 +527,7 @@ public void Validate( Mech m ) throws Exception { throw new Exception(CritName() + " may only be mounted on a quad 'Mech."); } if( MaxAllowed > 0 ) { - ArrayList currentEquipment = m.GetLoadout().GetEquipment(); + ArrayList currentEquipment = m.GetLoadout().GetEquipment(); for (int i = 0, c = 0; i < currentEquipment.size(); ++i) { abPlaceable currentItem = (abPlaceable) currentEquipment.get(i); if (currentItem.LookupName().equals(LookupName)) { @@ -546,7 +546,7 @@ public void Validate( Mech m ) throws Exception { public boolean Validate( CombatVehicle v ) { if( MaxAllowed > 0 ) { - ArrayList currentEquipment = v.GetLoadout().GetEquipment(); + ArrayList currentEquipment = v.GetLoadout().GetEquipment(); for( int i = 0, c = 0; i < currentEquipment.size(); ++i ) { abPlaceable currentItem = (abPlaceable) currentEquipment.get( i ); if( currentItem.LookupName().equals( LookupName ) ) { diff --git a/sswlib/src/main/java/components/RangedWeapon.java b/sswlib/src/main/java/components/RangedWeapon.java index b670d1b2..007c9196 100644 --- a/sswlib/src/main/java/components/RangedWeapon.java +++ b/sswlib/src/main/java/components/RangedWeapon.java @@ -80,9 +80,9 @@ public class RangedWeapon extends abPlaceable implements ifWeapon { CanUseCapacitor = false, CanUseInsulator = false, CanUsePulseModule = false, - CanUseCaseless = false, - CanOS = false, - CanIOS = false; + CanUseCaseless = false; + // CanOS = false, // Unused Variables + // CanIOS = false; private transient boolean MountedRear = false, UsingCapacitor = false, UsingInsulator = false, @@ -629,7 +629,7 @@ public int GetHeat() { if( UsingPulseModule){ tempHeat += 2; } - + return tempHeat; } @@ -855,12 +855,12 @@ public boolean CanAllocArms() { public boolean CanAllocLegs() { return Alloc_Legs; } - + @Override public boolean CanAllocCVBody() { return alloc_body; } - + @Override public boolean CanAllocCVFront() { return alloc_front; @@ -956,7 +956,7 @@ public boolean IsUsingInsulator() { public LaserInsulator GetInsulator() { return Insulator; } - + public boolean CanUsePulseModule() { return CanUsePulseModule; } @@ -1134,10 +1134,10 @@ public String toString() { String retval = CritName; if( MountedRear ) retval = "(R) " + retval; - - if ( UsingFCS ) + + if ( UsingFCS ) retval += " w/" + GetFCS().toString(); - + return retval; } } diff --git a/sswlib/src/main/java/dialog/AmmoChooserRenderer.java b/sswlib/src/main/java/dialog/AmmoChooserRenderer.java index ad92e212..f5fd5573 100644 --- a/sswlib/src/main/java/dialog/AmmoChooserRenderer.java +++ b/sswlib/src/main/java/dialog/AmmoChooserRenderer.java @@ -28,7 +28,7 @@ package dialog; -import dialog.dlgAmmoChooser; +// import dialog.dlgAmmoChooser; import java.awt.Component; import javax.swing.DefaultListCellRenderer; import javax.swing.JLabel; @@ -51,7 +51,7 @@ public AmmoChooserRenderer( dlgAmmoChooser p ) { } @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { JLabel label = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, hasFocus); String Text = ""; if( value instanceof abPlaceable ) { diff --git a/sswlib/src/main/java/list/view/tbQuirks.java b/sswlib/src/main/java/list/view/tbQuirks.java index b15f8afc..db36836a 100644 --- a/sswlib/src/main/java/list/view/tbQuirks.java +++ b/sswlib/src/main/java/list/view/tbQuirks.java @@ -38,9 +38,9 @@ public class tbQuirks extends AbstractTableModel { * */ private static final long serialVersionUID = -1986433171909626102L; - public ArrayList quirklist; + public ArrayList quirklist; - public tbQuirks(ArrayList quirks) + public tbQuirks(ArrayList quirks) { quirklist = quirks; } @@ -50,7 +50,7 @@ public void setupTable( JTable tbl ) { tbl.getColumnModel().getColumn(0).setPreferredWidth(1); } - public Object get( int index ) { + public Quirk get( int index ) { return quirklist.get(index); } diff --git a/sswlib/src/main/java/list/view/tbTotalWarfareView.java b/sswlib/src/main/java/list/view/tbTotalWarfareView.java index ad1d34e8..dc658d4f 100644 --- a/sswlib/src/main/java/list/view/tbTotalWarfareView.java +++ b/sswlib/src/main/java/list/view/tbTotalWarfareView.java @@ -27,9 +27,7 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT package list.view; -import java.text.NumberFormat; import javax.swing.SortOrder; -import javax.swing.text.NumberFormatter; import list.UnitList; import list.UnitListData; From 6279757a622042a1050715da6d2e932e3f1f614e Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 13:46:45 -0600 Subject: [PATCH 081/126] 3 Warning Fixes - Type Enforcement - Commented out code not being used - Commented out unused variables - Removed unused Imports - Ensure Buffer Closes --- .../java/ssw/gui/thCLTransferHandler.java | 4 +- .../java/ssw/gui/thCTTransferHandler.java | 4 +- .../java/ssw/gui/thLATransferHandler.java | 4 +- .../java/ssw/gui/thLLTransferHandler.java | 4 +- .../java/ssw/gui/thLTTransferHandler.java | 4 +- .../java/ssw/gui/thRATransferHandler.java | 4 +- .../java/ssw/gui/thRLTransferHandler.java | 4 +- .../java/ssw/gui/thRTTransferHandler.java | 4 +- .../java/ssw/printpreview/PreviewDialog.java | 5 + .../main/java/ssw/utilities/WeaponInfo.java | 8 +- sswlib/src/main/java/Force/Force.java | 4 +- sswlib/src/main/java/Force/NameGenerator.java | 12 +- sswlib/src/main/java/IO/RUSReader.java | 14 +- .../java/Print/ASHorizontalCardPrinter.java | 18 +- .../src/main/java/Print/PrintDeclaration.java | 4 +- sswlib/src/main/java/components/CVArmor.java | 51 ++--- sswlib/src/main/java/components/Dumper.java | 7 +- .../main/java/components/SupportVehicle.java | 182 +++++++++--------- sswlib/src/main/java/gui/HTMLPane.java | 4 +- 19 files changed, 172 insertions(+), 169 deletions(-) diff --git a/ssw/src/main/java/ssw/gui/thCLTransferHandler.java b/ssw/src/main/java/ssw/gui/thCLTransferHandler.java index b97d7d1b..1d620292 100644 --- a/ssw/src/main/java/ssw/gui/thCLTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thCLTransferHandler.java @@ -57,7 +57,7 @@ public Transferable createTransferable( JComponent comp ) { // all we want to do is transfer the index in the queue LocationDragDatagram d = new LocationDragDatagram(); d.Location = LocationIndex.MECH_LOC_CL; - d.SourceIndex = ((JList) comp).getSelectedIndex(); + d.SourceIndex = ((JList) comp).getSelectedIndex(); d.Locked = CurMech.GetLoadout().GetCLCrits()[d.SourceIndex].LocationLocked(); if( CurMech.GetLoadout().GetCLCrits()[d.SourceIndex] instanceof EmptyItem ) { d.Empty = true; @@ -162,7 +162,7 @@ public boolean importData( TransferHandler.TransferSupport info ) { // get the item abPlaceable a; - ArrayList v = new ArrayList(); + ArrayList v = new ArrayList(); if( DropItem.Location == -1 ) { // from the queue a = CurMech.GetLoadout().GetFromQueueByIndex( DropItem.SourceIndex ); diff --git a/ssw/src/main/java/ssw/gui/thCTTransferHandler.java b/ssw/src/main/java/ssw/gui/thCTTransferHandler.java index ca0495ef..5e6ffe02 100644 --- a/ssw/src/main/java/ssw/gui/thCTTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thCTTransferHandler.java @@ -57,7 +57,7 @@ public Transferable createTransferable( JComponent comp ) { // all we want to do is transfer the index in the queue LocationDragDatagram d = new LocationDragDatagram(); d.Location = LocationIndex.MECH_LOC_CT; - d.SourceIndex = ((JList) comp).getSelectedIndex(); + d.SourceIndex = ((JList) comp).getSelectedIndex(); d.Locked = CurMech.GetLoadout().GetCTCrits()[d.SourceIndex].LocationLocked(); if( CurMech.GetLoadout().GetCTCrits()[d.SourceIndex] instanceof EmptyItem ) { d.Empty = true; @@ -176,7 +176,7 @@ public boolean importData( TransferHandler.TransferSupport info ) { // get the item abPlaceable a; - ArrayList v = new ArrayList(); + ArrayList v = new ArrayList(); if( DropItem.Location == -1 ) { // from the queue a = CurMech.GetLoadout().GetFromQueueByIndex( DropItem.SourceIndex ); diff --git a/ssw/src/main/java/ssw/gui/thLATransferHandler.java b/ssw/src/main/java/ssw/gui/thLATransferHandler.java index 6f7a28a7..8cc42104 100644 --- a/ssw/src/main/java/ssw/gui/thLATransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thLATransferHandler.java @@ -57,7 +57,7 @@ public Transferable createTransferable( JComponent comp ) { // all we want to do is transfer the index in the queue LocationDragDatagram d = new LocationDragDatagram(); d.Location = LocationIndex.MECH_LOC_LA; - d.SourceIndex = ((JList) comp).getSelectedIndex(); + d.SourceIndex = ((JList) comp).getSelectedIndex(); d.Locked = CurMech.GetLoadout().GetLACrits()[d.SourceIndex].LocationLocked(); if( CurMech.GetLoadout().GetLACrits()[d.SourceIndex] instanceof EmptyItem ) { d.Empty = true; @@ -161,7 +161,7 @@ public boolean importData( TransferHandler.TransferSupport info ) { // get the item abPlaceable a; - ArrayList v = new ArrayList(); + ArrayList v = new ArrayList(); if( DropItem.Location == -1 ) { // from the queue a = CurMech.GetLoadout().GetFromQueueByIndex( DropItem.SourceIndex ); diff --git a/ssw/src/main/java/ssw/gui/thLLTransferHandler.java b/ssw/src/main/java/ssw/gui/thLLTransferHandler.java index 8479040b..a5278500 100644 --- a/ssw/src/main/java/ssw/gui/thLLTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thLLTransferHandler.java @@ -57,7 +57,7 @@ public Transferable createTransferable( JComponent comp ) { // all we want to do is transfer the index in the queue LocationDragDatagram d = new LocationDragDatagram(); d.Location = LocationIndex.MECH_LOC_LL; - d.SourceIndex = ((JList) comp).getSelectedIndex(); + d.SourceIndex = ((JList) comp).getSelectedIndex(); d.Locked = CurMech.GetLoadout().GetLLCrits()[d.SourceIndex].LocationLocked(); if( CurMech.GetLoadout().GetLLCrits()[d.SourceIndex] instanceof EmptyItem ) { d.Empty = true; @@ -162,7 +162,7 @@ public boolean importData( TransferHandler.TransferSupport info ) { // get the item abPlaceable a; - ArrayList v = new ArrayList(); + ArrayList v = new ArrayList(); if( DropItem.Location == -1 ) { // from the queue a = CurMech.GetLoadout().GetFromQueueByIndex( DropItem.SourceIndex ); diff --git a/ssw/src/main/java/ssw/gui/thLTTransferHandler.java b/ssw/src/main/java/ssw/gui/thLTTransferHandler.java index 2f6e03a7..741fb74d 100644 --- a/ssw/src/main/java/ssw/gui/thLTTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thLTTransferHandler.java @@ -57,7 +57,7 @@ public Transferable createTransferable( JComponent comp ) { // all we want to do is transfer the index in the queue LocationDragDatagram d = new LocationDragDatagram(); d.Location = LocationIndex.MECH_LOC_LT; - d.SourceIndex = ((JList) comp).getSelectedIndex(); + d.SourceIndex = ((JList) comp).getSelectedIndex(); d.Locked = CurMech.GetLoadout().GetLTCrits()[d.SourceIndex].LocationLocked(); if( CurMech.GetLoadout().GetLTCrits()[d.SourceIndex] instanceof EmptyItem ) { d.Empty = true; @@ -200,7 +200,7 @@ public boolean importData( TransferHandler.TransferSupport info ) { // get the item abPlaceable a; - ArrayList v = new ArrayList(); + ArrayList v = new ArrayList(); if( DropItem.Location == -1 ) { // from the queue a = CurMech.GetLoadout().GetFromQueueByIndex( DropItem.SourceIndex ); diff --git a/ssw/src/main/java/ssw/gui/thRATransferHandler.java b/ssw/src/main/java/ssw/gui/thRATransferHandler.java index 10004de5..5621974a 100644 --- a/ssw/src/main/java/ssw/gui/thRATransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thRATransferHandler.java @@ -57,7 +57,7 @@ public Transferable createTransferable( JComponent comp ) { // all we want to do is transfer the index in the queue LocationDragDatagram d = new LocationDragDatagram(); d.Location = LocationIndex.MECH_LOC_RA; - d.SourceIndex = ((JList) comp).getSelectedIndex(); + d.SourceIndex = ((JList) comp).getSelectedIndex(); d.Locked = CurMech.GetLoadout().GetRACrits()[d.SourceIndex].LocationLocked(); if( CurMech.GetLoadout().GetRACrits()[d.SourceIndex] instanceof EmptyItem ) { d.Empty = true; @@ -161,7 +161,7 @@ public boolean importData( TransferHandler.TransferSupport info ) { // get the item abPlaceable a; - ArrayList v = new ArrayList(); + ArrayList v = new ArrayList(); if( DropItem.Location == -1 ) { // from the queue a = CurMech.GetLoadout().GetFromQueueByIndex( DropItem.SourceIndex ); diff --git a/ssw/src/main/java/ssw/gui/thRLTransferHandler.java b/ssw/src/main/java/ssw/gui/thRLTransferHandler.java index 6edd4a17..7db7fcc8 100644 --- a/ssw/src/main/java/ssw/gui/thRLTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thRLTransferHandler.java @@ -57,7 +57,7 @@ public Transferable createTransferable( JComponent comp ) { // all we want to do is transfer the index in the queue LocationDragDatagram d = new LocationDragDatagram(); d.Location = LocationIndex.MECH_LOC_RL; - d.SourceIndex = ((JList) comp).getSelectedIndex(); + d.SourceIndex = ((JList) comp).getSelectedIndex(); d.Locked = CurMech.GetLoadout().GetRLCrits()[d.SourceIndex].LocationLocked(); if( CurMech.GetLoadout().GetRLCrits()[d.SourceIndex] instanceof EmptyItem ) { d.Empty = true; @@ -162,7 +162,7 @@ public boolean importData( TransferHandler.TransferSupport info ) { // get the item abPlaceable a; - ArrayList v = new ArrayList(); + ArrayList v = new ArrayList(); if( DropItem.Location == -1 ) { // from the queue a = CurMech.GetLoadout().GetFromQueueByIndex( DropItem.SourceIndex ); diff --git a/ssw/src/main/java/ssw/gui/thRTTransferHandler.java b/ssw/src/main/java/ssw/gui/thRTTransferHandler.java index f568ad0b..5ee58dbc 100644 --- a/ssw/src/main/java/ssw/gui/thRTTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thRTTransferHandler.java @@ -57,7 +57,7 @@ public Transferable createTransferable( JComponent comp ) { // all we want to do is transfer the index in the queue LocationDragDatagram d = new LocationDragDatagram(); d.Location = LocationIndex.MECH_LOC_RT; - d.SourceIndex = ((JList) comp).getSelectedIndex(); + d.SourceIndex = ((JList) comp).getSelectedIndex(); d.Locked = CurMech.GetLoadout().GetRTCrits()[d.SourceIndex].LocationLocked(); if( CurMech.GetLoadout().GetRTCrits()[d.SourceIndex] instanceof EmptyItem ) { d.Empty = true; @@ -200,7 +200,7 @@ public boolean importData( TransferHandler.TransferSupport info ) { // get the item abPlaceable a; - ArrayList v = new ArrayList(); + ArrayList v = new ArrayList(); if( DropItem.Location == -1 ) { // from the queue a = CurMech.GetLoadout().GetFromQueueByIndex( DropItem.SourceIndex ); diff --git a/ssw/src/main/java/ssw/printpreview/PreviewDialog.java b/ssw/src/main/java/ssw/printpreview/PreviewDialog.java index a02e1a86..5fb95bce 100644 --- a/ssw/src/main/java/ssw/printpreview/PreviewDialog.java +++ b/ssw/src/main/java/ssw/printpreview/PreviewDialog.java @@ -105,6 +105,8 @@ public PageFormat getPageFormat(int index) { private int pages; } + /* + * Neither are used within class private JButton getButton(String iconName) { return getButton(null, iconName, null); } @@ -112,6 +114,7 @@ private JButton getButton(String iconName) { private JButton getButton(String iconName, AbstractAction action) { return getButton(null, iconName, action); } + */ private JButton getButton(String name, String iconName, AbstractAction action) { JButton result = null; @@ -129,9 +132,11 @@ private JButton getButton(String name, String iconName, AbstractAction action) { return result; } + /* Not used internally private void Refresh() { this.repaint(); } + */ public void actionPerformed(ActionEvent e) { dispose(); diff --git a/ssw/src/main/java/ssw/utilities/WeaponInfo.java b/ssw/src/main/java/ssw/utilities/WeaponInfo.java index c400c9ca..8f25a17a 100644 --- a/ssw/src/main/java/ssw/utilities/WeaponInfo.java +++ b/ssw/src/main/java/ssw/utilities/WeaponInfo.java @@ -37,7 +37,7 @@ public class WeaponInfo { // contains a weapon and ammo pairing (may hold multiple ammos) // may also contain a single weapon if need be private ifWeapon Weapon; - private Vector Ammos = new Vector(); + private Vector Ammos = new Vector(); private int FiringRate = 1; public final static int[][] Clusters = { { 1, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9, 10, 10, 12 }, @@ -88,7 +88,7 @@ public int GetBestDamage( int range ) { int retval = 0; if( Weapon.HasAmmo() ) { - + } else { if( Weapon.IsCluster() ) { return GetDamageAtRange( range ) * Weapon.ClusterSize(); @@ -104,7 +104,7 @@ public int GetBestAverageDamage( int range ) { int retval = 0; if( Weapon.HasAmmo() ) { - + } else { if( Weapon.IsCluster() ) { return GetDamageAtRange( range ) * GetAverageClusterSize(); @@ -161,4 +161,4 @@ private int GetAverageClusterSize() { return 1; } } -} \ No newline at end of file +} diff --git a/sswlib/src/main/java/Force/Force.java b/sswlib/src/main/java/Force/Force.java index 1df4ab50..07b3bc65 100644 --- a/sswlib/src/main/java/Force/Force.java +++ b/sswlib/src/main/java/Force/Force.java @@ -40,7 +40,7 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import java.io.BufferedWriter; import java.io.IOException; import java.util.ArrayList; -import java.util.ArrayList; + import javax.swing.JTable; import javax.swing.table.AbstractTableModel; import list.view.Column; @@ -679,7 +679,7 @@ public String getColumnName( int col ) { public int getRowCount() { return Units.size(); } public int getColumnCount() { return 11; } @Override - public Class getColumnClass(int c) { + public Class getColumnClass(int c) { if (Units.size() > 0) { return getClassOf(0, c).getClass(); } else { diff --git a/sswlib/src/main/java/Force/NameGenerator.java b/sswlib/src/main/java/Force/NameGenerator.java index 1fffdf82..92d3144a 100644 --- a/sswlib/src/main/java/Force/NameGenerator.java +++ b/sswlib/src/main/java/Force/NameGenerator.java @@ -34,8 +34,6 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import java.io.InputStreamReader; import java.util.Random; import java.util.ArrayList; -import java.util.logging.Level; -import java.util.logging.Logger; public class NameGenerator { private ArrayList MaleFirstNames = new ArrayList(); @@ -74,22 +72,24 @@ private void LoadFile( String filename, ArrayList store ) { String line = null; while ((line = reader.readLine()) != null) { // Is there a comma in the line? If not ignore it - if ( line.contains(",") ) { + if (line.contains(",")) { String[] parts = line.split(","); int val = -1; try { //Is the last section of the line numeric? If not ignore it - val = Integer.parseInt(parts[parts.length-1].trim()); - } catch ( Exception e ) { + val = Integer.parseInt(parts[parts.length - 1].trim()); + } catch (Exception e) { //do nothing } if (val >= 0) { - for ( int i=0; i < val; i++ ) { + for (int i = 0; i < val; i++) { store.add(parts[0]); } } } } + + reader.close(); } catch (FileNotFoundException ex) { System.out.println(ex.getMessage()); } catch (IOException ex) { diff --git a/sswlib/src/main/java/IO/RUSReader.java b/sswlib/src/main/java/IO/RUSReader.java index 9dc5d594..ef296f5e 100644 --- a/sswlib/src/main/java/IO/RUSReader.java +++ b/sswlib/src/main/java/IO/RUSReader.java @@ -34,8 +34,6 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; -import java.util.logging.Level; -import java.util.logging.Logger; public class RUSReader { @@ -44,10 +42,10 @@ public class RUSReader { * options provided. * Expected format: AS7-D Atlas,80 * If the last comma in the line contains a numeric value it will be read, otherwise ignored - * + * * @param filename The canonical filename to load this. * @return An RUS object filled with whatever options were in the file - * @throws java.lang.FileNotFoundException + * @throws java.lang.FileNotFoundException */ public void Load( String filename, RUS rus ) throws FileNotFoundException { try { @@ -56,13 +54,13 @@ public void Load( String filename, RUS rus ) throws FileNotFoundException { String line = null; while ((line = reader.readLine()) != null) { // Is there a comma in the line? If not ignore it - if ( line.contains(",") ) { + if (line.contains(",")) { String[] parts = line.split(","); int val = -1; try { //Is the last section of the line numeric? If not ignore it - val = Integer.parseInt(parts[parts.length-1].trim()); - } catch ( Exception e ) { + val = Integer.parseInt(parts[parts.length - 1].trim()); + } catch (Exception e) { //do nothing } if (val >= 0) { @@ -70,6 +68,8 @@ public void Load( String filename, RUS rus ) throws FileNotFoundException { } } } + + reader.close(); } catch (IOException ex) { System.out.println(ex.getMessage()); //Logger.getLogger(RUSReader.class.getName()).log(Level.SEVERE, null, ex); diff --git a/sswlib/src/main/java/Print/ASHorizontalCardPrinter.java b/sswlib/src/main/java/Print/ASHorizontalCardPrinter.java index 2a9facd4..33814987 100644 --- a/sswlib/src/main/java/Print/ASHorizontalCardPrinter.java +++ b/sswlib/src/main/java/Print/ASHorizontalCardPrinter.java @@ -46,11 +46,11 @@ public class ASHorizontalCardPrinter implements Printable { private ImageTracker imageTracker; private Graphics2D graphic; private Image Background, Overlay; - private Image[] BFIcons; + // private Image[] BFIcons; // Not Used private int UnitImageWidth = PaperSize.getInchesInPixels(3.5), UnitImageHeight = PaperSize.getInchesInPixels(2.5), - HorizontalLimit = 2, - MaxUnits = 8; + HorizontalLimit = 2; + // MaxUnits = 8; // Not Used private boolean printMechs = true, printLogo = true, @@ -69,7 +69,7 @@ public class ASHorizontalCardPrinter implements Printable { MoveColor = Color.ORANGE, SkillColor = new Color(238, 216, 0), NameColor = Color.ORANGE, - PilotColor = Color.ORANGE, + // PilotColor = Color.ORANGE, Not Used SizeColor = new Color(242, 242, 242); public ASHorizontalCardPrinter( BattleForce f, ImageTracker images) { @@ -92,7 +92,7 @@ public void setBlackAndWhite() { MoveColor = OVColor; SkillColor = OVColor; NameColor = OVColor; - PilotColor = OVColor; + // PilotColor = OVColor; Not read SizeColor = OVColor; Shadow = Color.WHITE; DarkShadow = Color.WHITE; @@ -109,7 +109,7 @@ public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws Render(); return Printable.PAGE_EXISTS; } - + public void Render() { int elementCount = 0; Image icon = null; @@ -177,7 +177,7 @@ public void Render() { //Unit Name //PrintConsts.ShadowText( graphic, PrintConsts.XtraSmallBoldFont, NameColor, DarkShadow, (stats.getUnit() + " [" + battleforce.ForceName + "]").replace("[]", ""), x+10, y+p.y+1 ); - + //Skill PrintConsts.ShadowText( graphic, PrintConsts.Bold8Font, SkillColor, Shadow, stats.getSkill()+"", x+142.0, (double) y+48.4); } @@ -185,7 +185,7 @@ public void Render() { //Type (TP) p.setLocation(24.0, 48.5); PrintConsts.ShadowText( graphic, PrintConsts.Bold8Font, MoveColor, Shadow, stats.getBFType(), x+p.x, (double) y+p.getY()); - + p.setLocation(54.0, 48.5); //Weight Class PrintConsts.ShadowText( graphic, PrintConsts.Bold8Font, SizeColor, Shadow, stats.getWeight()+"", x+p.x, (double) y+p.getY()); @@ -239,7 +239,7 @@ public void Render() { graphic.drawImage(logo, x+p.x, y+p.y, 20, 20, null); } } - + x += UnitImageWidth + 1; } diff --git a/sswlib/src/main/java/Print/PrintDeclaration.java b/sswlib/src/main/java/Print/PrintDeclaration.java index 612037d3..932b1ead 100644 --- a/sswlib/src/main/java/Print/PrintDeclaration.java +++ b/sswlib/src/main/java/Print/PrintDeclaration.java @@ -34,9 +34,7 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import java.awt.Graphics2D; import java.awt.Image; import java.awt.print.*; -import java.io.PrintWriter; import java.util.ArrayList; -import java.util.Vector; public class PrintDeclaration implements Printable { public Graphics2D Graphic; @@ -45,7 +43,7 @@ public class PrintDeclaration implements Printable { private PageFormat format = null; private ImageTracker imageTracker; private String[] Types = new String[]{" Primary", "Secondary", "Secondary"}; - private String Title = "Fire Declaration Markers"; + // private String Title = "Fire Declaration Markers"; // Not Used private boolean PrintUnitWarrior = true, PrintUnitLogo = true; diff --git a/sswlib/src/main/java/components/CVArmor.java b/sswlib/src/main/java/components/CVArmor.java index d837d336..e4359c27 100644 --- a/sswlib/src/main/java/components/CVArmor.java +++ b/sswlib/src/main/java/components/CVArmor.java @@ -59,8 +59,8 @@ public class CVArmor extends abPlaceable { CLLR = new stArmorCLLR(), CLRE = new stArmorCLRE(), ISAB = new stArmorISAB(), - HeatDiss = new stArmorHD(), - ISIR = new stArmorISIR(), + // HeatDiss = new stArmorHD(), // Variables not used + // ISIR = new stArmorISIR(), ISBR = new stArmorISBR(), Patchwork = new stArmorPatchwork(); private ifArmor Config = Standard, @@ -80,20 +80,21 @@ public CVArmor( CombatVehicle c ) { public final void SetMaxArmor(int locations) { // this sets the maximum array when tonnage changes. - int Percentage = ((!Owner.IsVTOL()) ? GetMaxArmor() : GetMaxArmor()-2) / locations; + // Variable not used within method + // int Percentage = ((!Owner.IsVTOL()) ? GetMaxArmor() : GetMaxArmor()-2) / locations; MaxArmor[LocationIndex.CV_LOC_BODY] = 0; MaxArmor[LocationIndex.CV_LOC_FRONT] = GetMaxArmor(); MaxArmor[LocationIndex.CV_LOC_LEFT] = GetMaxArmor(); MaxArmor[LocationIndex.CV_LOC_RIGHT] = GetMaxArmor(); MaxArmor[LocationIndex.CV_LOC_REAR] = GetMaxArmor(); - + if ( Owner.isHasTurret1() ) MaxArmor[LocationIndex.CV_LOC_TURRET1] = GetMaxArmor(); - + if ( Owner.isHasTurret2() ) MaxArmor[LocationIndex.CV_LOC_TURRET2] = GetMaxArmor(); - + if ( Owner.IsVTOL() ) MaxArmor[LocationIndex.CV_LOC_ROTOR] = 2; } @@ -601,8 +602,8 @@ public void SetCLRE( int Loc ) throws Exception { return; } } - - + + public void SetISAB() { Config = ISAB; } @@ -633,9 +634,9 @@ public void SetISAB( int Loc ) throws Exception { return; } } - - - + + + public void SetISBR() { Config = ISBR; } @@ -667,7 +668,7 @@ public void SetISBR( int Loc ) throws Exception { } } // - + private void CheckPatchworkSpace( ifArmor test, int loc ) throws Exception { if( test.PatchworkSpaces() > Owner.GetLoadout().FreeItems() ) { throw new Exception( "Cannot change " + LocationIndex.CVLocs[loc] + " armor to " + test.CritName() + "\nbecause there is not enough space." ); @@ -744,7 +745,7 @@ public int GetMaxArmor() { // returns the maximum amount of armor allowed.\ return (int) ( Owner.GetTonnage() * 3.5 ) + 40; } - + public int GetArmorPoints(double Tonnage) { return (int) ( Math.floor( Tonnage * 16 * GetAVMult() ) ); } @@ -760,7 +761,7 @@ public int GetArmorValue() { result += ArmorPoints[LocationIndex.CV_LOC_TURRET2]; return result; } - + public void ClearArmorValues() { for (int i = 0; i < ArmorPoints.length; i++) { ArmorPoints[i] = 0; @@ -812,13 +813,13 @@ public boolean IsPatchwork() { if( Config == Patchwork ) { return true; } return false; } - + public boolean IsStealth() { return Config.IsStealth(); } // - + public boolean RequiresExtraRules() { if ( IsHardened() || IsReactive() || IsReflective() || IsStealth() ) { return true; @@ -846,7 +847,7 @@ public boolean CanArmor() { // armor is always roll again, so no armoring return false; } - + public boolean AllowOmni() { return Config.AllowOmni(); @@ -948,28 +949,28 @@ public double GetMaxTonnage() { result = mid * 0.5; return result; } - + public void Maximize() { int AV = GetMaxArmor(); - + // remove all existing amounts so we can reset ClearArmorValues(); - + if ( Owner.IsVTOL() ) { SetArmor(LocationIndex.CV_LOC_ROTOR, 2); AV -= 2; } int split = AV / Owner.getLocationCount(); - + if ( Owner.isHasTurret1() ) SetArmor( LocationIndex.CV_LOC_TURRET1, split); if ( Owner.isHasTurret2() ) SetArmor( LocationIndex.CV_LOC_TURRET2, split); - + SetArmor( LocationIndex.CV_LOC_LEFT, split); SetArmor( LocationIndex.CV_LOC_RIGHT, split); - + SetArmor( LocationIndex.CV_LOC_FRONT, (int)Math.ceil((split * 2) * .6) ); SetArmor( LocationIndex.CV_LOC_REAR, (split * 2)-GetLocationArmor(LocationIndex.CV_LOC_FRONT)); - + if ( GetArmorValue() < GetMaxArmor() ) { int val = GetMaxArmor()-GetArmorValue(); for (int i = 0; i < val; i++) { @@ -1107,4 +1108,4 @@ public ifArmor GetRotorArmorType() public CombatVehicle GetOwner() { return Owner; } -} \ No newline at end of file +} diff --git a/sswlib/src/main/java/components/Dumper.java b/sswlib/src/main/java/components/Dumper.java index 326d3240..d0b1a490 100644 --- a/sswlib/src/main/java/components/Dumper.java +++ b/sswlib/src/main/java/components/Dumper.java @@ -29,7 +29,6 @@ package components; import java.util.ArrayList; -import common.CommonTools; /** * @@ -39,7 +38,7 @@ public class Dumper extends abPlaceable { private ifMechLoadout Owner; private final static AvailableCode AC = new AvailableCode( AvailableCode.TECH_BOTH ); private String DumpDirection; - private LocationIndex DumperLocation; + // private LocationIndex DumperLocation; // Not Used public Dumper( ifMechLoadout l) { @@ -104,7 +103,7 @@ public double GetTonnage() { //TODO: Add dumper calculation based on location double tonnage = 0.0; LocationIndex location = Owner.FindIndex(this); - ArrayList equipment = Owner.GetEquipment(); + ArrayList equipment = Owner.GetEquipment(); for (int i = 0; i < equipment.size(); i++) { abPlaceable currentItem = (abPlaceable) equipment.get( i ); @@ -147,7 +146,7 @@ public double GetCurOffensiveBV( boolean UseRear, boolean UseTC, boolean UseAES public double GetCurOffensiveBV(boolean UseRear, boolean UseTC, boolean UseAES, boolean UseRobotic) { return 0.0; } - + public double GetDefensiveBV() { return 0.0; } diff --git a/sswlib/src/main/java/components/SupportVehicle.java b/sswlib/src/main/java/components/SupportVehicle.java index cbb017cf..b53362ca 100644 --- a/sswlib/src/main/java/components/SupportVehicle.java +++ b/sswlib/src/main/java/components/SupportVehicle.java @@ -44,7 +44,7 @@ public class SupportVehicle { // Properties - Fluff Strings private String Name = "", Model = "", - TechBase = "Inner Sphere", + // TechBase = "Inner Sphere", Overview = "", Capabilities = "", History = "", @@ -69,9 +69,9 @@ public class SupportVehicle { baseMove; // Properties - SV Specific Strings private String motiveType, - size, - techRating, - engineType; + size, + techRating; + // engineType; // Not Used // Properties - SV Specific Doubles private double Tonnage, baseChassisValue, @@ -79,7 +79,7 @@ public class SupportVehicle { // Properties - SV Specific Integers private int cruiseSpeed; // Properties - SV Specific Lists - private LinkedList locations; + // private LinkedList locations; // Not Used // Properties - SV Specific Booleans private boolean TO_Opt_twoTurrets; // Properties - States @@ -217,162 +217,162 @@ public SupportVehicle() { this.size = "Medium"; this.setMotiveType("Wheeled"); } - + // METHODS // Methods - General Accessors - + public String getName() { String nameTemp = this.Name; return nameTemp; } - + public String getModel() { String modelTemp = this.Model; return modelTemp; } - + public String getOverview() { String overviewTemp = this.Overview; return overviewTemp; } - + public String getCapabilites() { String capabilitiesTemp = this.Capabilities; return capabilitiesTemp; } - + public String getHistory() { String historyTemp = this.History; return historyTemp; } - + public String getVariants() { String variantsTemp = this.Variants; return variantsTemp; } - + public String getDeployment() { String deploymentTemp = this.Deployment; return deploymentTemp; } - + public String getCompany() { String companyTemp = this.Company; return companyTemp; } - + public String getAdditional() { String additionalTemp = this.Additional; return additionalTemp; } - + public String getNotables() { String notablesTemp = this.Notables; return notablesTemp; } - + public String getArmorModel() { String armorModelTemp = this.ArmorModel; return armorModelTemp; } - + public String getLocations() { String locationsTemp = this.Location; return locationsTemp; } - + public String getEngineManufacturer() { String engineManTemp = this.EngineManufacturer; return engineManTemp; } - + public String getCommSystem() { String commTemp = this.CommSystem; return commTemp; } - + public String getChassisModel() { String chassisModelTemp = this.ChassisModel; return chassisModelTemp; } - + public String getSolaris7ID() { String solarisIDTemp = this.Solaris7ID; return solarisIDTemp; } - + public String getSolaris7ImageID() { String solarisImageTemp = this.Solaris7ImageID; return solarisImageTemp; } - + public String getTandTSystem() { String targetTemp = this.TandTSystem; return targetTemp; } - + public String getSSWImage() { String sswImageTemp = this.SSWImage; return sswImageTemp; } - + public int getEra() { int eraTemp = this.Era; return eraTemp; } - + public int getYear() { int yearTemp = this.Year; return yearTemp; } - + public int getRulesLevel() { int rulesTemp = this.RulesLevel; return rulesTemp; } - + public double getTonnage() { double tonnageTemp = this.Tonnage; return tonnageTemp; } - + // Methods - SV Specific Accessors - + public String getMotiveType() { String motiveTemp = this.motiveType; return motiveTemp; } - + public String getSize() { String sizeTemp = this.size; return sizeTemp; } - + public String getTechRating() { String trTemp = this.techRating; return trTemp; } - + public double getBCV() { double bcvTemp = this.baseChassisValue; return bcvTemp; } - + public double getBEV() { double bevTemp = this.baseEngineValue; return bevTemp; } - + public double getMinimumTonnage() { double minTemp = this.chassis.getMinimumTonnage(); return minTemp; } - + public Preferences getPref() { Preferences prefTemp = this.pref; return prefTemp; } - + /** * Calculates the structural mass required for the support vehicle. * @return A double containing the structural mass required. @@ -384,7 +384,7 @@ public double getStructuralTonnage() { structureTonnage = structureTonnage * this.chassis.getBCV(); return structureTonnage; } - + /** * Calculates the total structural mass multiplier for the chassis mods. * @return A double containing the structural mass multipler for the chassis mods. @@ -412,7 +412,7 @@ private double getChassisModMultiplier() { if (this.isVSTOL.equals("true")) { multiple = multiple * 2; } return multiple; } - + /** * Returns the structural mass multiplier for the current tech rating. * @return A double containing the structural mass multplier for the current tech rating. @@ -427,11 +427,11 @@ private double getTechRatingMultipler() { else if (this.techRating.equals("F")) { multiple = 0.66; } return multiple; } - + public int getBaseMove() { return this.baseMove; } - + /** * Gets the maximum move (flank MP, max accel, whatever). * @return An integer representing the maximum move. @@ -441,18 +441,18 @@ public int getMaxMove() { maxMove = Math.ceil(maxMove); return (int) maxMove; } - + // Methods - SV Specific Mutators - + public void setTechRating(String newRating) { this.techRating = newRating; } - + /** * Sets motive type and calls appropriate helper methods to manage chassis modifications * and engine types. * @param String newType: The motive type to set. - */ + */ public void setMotiveType(String newType) { if (newType.equals("Airship")) { this.cmAirship(); @@ -498,14 +498,14 @@ else if (newType.equals("WiGE")) { this.setChassis(); this.setLocations(); } - + public void setSize(String newSize) { this.cmSmallCheck(); this.size = newSize; this.setChassis(); this.setLocations(); } - + public void setTonnage(double newTonnage) { if (newTonnage >= this.chassis.getMinimumTonnage()) { if (newTonnage <= this.chassis.getMaximumTonnage()) { @@ -515,7 +515,7 @@ public void setTonnage(double newTonnage) { this.cmSmallCheck(); this.setLocations(); } - + /** * Handles the chassis state. */ @@ -571,115 +571,115 @@ else if (this.motiveType.equals("WiGE")) { else if (this.size.equals("Large")) { this.chassis = this.wigeLarge; } } } - + // Methods - Chassis // Methods - Chassis - Chassis Mods Accessors - + public String getAmphibous() { String amphibiousTemp = this.isAmphibious; return amphibiousTemp; } - + public String getArmored() { String armoredTemp = this.isArmored; return armoredTemp; } - + public String getBicycle() { String bicycleTemp = this.isBicycle; return bicycleTemp; } - + public String getConvertible() { String convertibleTemp = this.isConvertible; return convertibleTemp; } - + public String getDuneBuggy() { String duneBuggyTemp = this.isDuneBuggy; return duneBuggyTemp; } - + public String getEnviroSeal() { String enviroSealTemp = this.isEnvironmentallySealed; return enviroSealTemp; } - + public String getExternalPower() { String externalPowerTemp = this.isExternalPowerPickup; return externalPowerTemp; } - + public String getHydrofoil() { String hydrofoilTemp = this.isHydrofoil; return hydrofoilTemp; } - + public String getMonocycle() { String monocycleTemp = this.isMonocycle; return monocycleTemp; } - + public String getOffRoad() { String offRoadTemp = this.isOffRoad; return offRoadTemp; } - + public String getOmni() { String omniTemp = this.isOmni; return omniTemp; } - + public String getProp() { String propTemp = this.isProp; return propTemp; } - + public String getSnowmobile() { String snowmobileTemp = this.isSnowmobile; return snowmobileTemp; } - + public String getSTOL() { String stolTemp = this.isSTOL; return stolTemp; } - + public String getSubmersible() { String subTemp = this.isSubmersible; return subTemp; } - + public String getTractorGround() { String tractorGTemp = this.isTractorGround; return tractorGTemp; } - + public String getTractorNaval() { String tractorNTemp = this.isTractorNaval; return tractorNTemp; } - + public String getTrailer() { String trailerTemp = this.isTrailer; return trailerTemp; } - + public String getUltraLight() { String ultraLightTemp = this.isUltraLight; return ultraLightTemp; } - + public String getVSTOL() { String vstolTemp = this.isVSTOL; return vstolTemp; } - + // Methods - Chassis - Chassis Mods Controls // These methods control the chassis mods when motive type and/or size are // changed. Do NOT edit them without checking TM and TacOps unless you // want to break something. - + private void cmAirship() { if (this.isAmphibious.equals("no")) { this.isAmphibious = "false"; } this.isArmored = "no"; @@ -700,7 +700,7 @@ private void cmAirship() { if (this.isUltraLight.equals("no")) { this.isUltraLight = "false"; } this.isVSTOL = "no"; } - + private void cmFixedWing() { if (this.isAmphibious.equals("no")) { this.isAmphibious = "false"; } if (this.isArmored.equals("no")) { this.isArmored = "false"; } @@ -721,7 +721,7 @@ private void cmFixedWing() { if (this.isUltraLight.equals("no")) { this.isUltraLight = "false"; } if (this.isVSTOL.equals("no")) { this.isVSTOL = "false"; } } - + private void cmHover() { this.isAmphibious = "no"; if (this.isArmored.equals("no")) { this.isArmored = "false"; } @@ -742,7 +742,7 @@ private void cmHover() { if (this.isUltraLight.equals("no")) { this.isUltraLight = "false"; } this.isVSTOL = "no"; } - + private void cmNaval() { this.isAmphibious = "no"; if (this.isArmored.equals("no")) { this.isArmored = "false"; } @@ -763,7 +763,7 @@ private void cmNaval() { if (this.isUltraLight.equals("no")) { this.isUltraLight = "false"; } this.isVSTOL = "no"; } - + private void cmRail() { if (this.isAmphibious.equals("no")) { this.isAmphibious = "false"; } if (this.isArmored.equals("no")) { this.isArmored = "false"; } @@ -784,7 +784,7 @@ private void cmRail() { if (this.isUltraLight.equals("no")) { this.isUltraLight = "false"; } this.isVSTOL = "no"; } - + private void cmSatellite() { if (this.isAmphibious.equals("no")) { this.isAmphibious = "false"; } if (this.isArmored.equals("no")) { this.isArmored = "false"; } @@ -805,7 +805,7 @@ private void cmSatellite() { if (this.isUltraLight.equals("no")) { this.isUltraLight = "false"; } this.isVSTOL = "no"; } - + private void cmTracked() { if (this.isAmphibious.equals("no")) { this.isAmphibious = "false"; } if (this.isArmored.equals("no")) { this.isArmored = "false"; } @@ -826,7 +826,7 @@ private void cmTracked() { if (this.isUltraLight.equals("no")) { this.isUltraLight = "false"; } this.isVSTOL = "no"; } - + private void cmVTOL() { if (this.isAmphibious.equals("no")) { this.isAmphibious = "false"; } if (this.isArmored.equals("no")) { this.isArmored = "false"; } @@ -847,7 +847,7 @@ private void cmVTOL() { if (this.isUltraLight.equals("no")) { this.isUltraLight = "false"; } this.isVSTOL = "no"; } - + private void cmWheeled() { if (this.isAmphibious.equals("no")) { this.isAmphibious = "false"; } if (this.isArmored.equals("no")) { this.isArmored = "false"; } @@ -868,7 +868,7 @@ private void cmWheeled() { if (this.isUltraLight.equals("no")) { this.isUltraLight = "false"; } this.isVSTOL = "no"; } - + private void cmWiGE() { if (this.isAmphibious.equals("no")) { this.isAmphibious = "false"; } if (this.isArmored.equals("no")) { this.isArmored = "false"; } @@ -889,7 +889,7 @@ private void cmWiGE() { if (this.isUltraLight.equals("no")) { this.isUltraLight = "false"; } this.isVSTOL = "no"; } - + private void cmSmallCheck() { if (this.size.equals("Small") == false) { this.isUltraLight = "no"; @@ -900,7 +900,7 @@ private void cmSmallCheck() { } } } - + // Methods - Chassis - Locations /// Note that this method needs to be updated once armor handling is added. /// As written, it currently discards any existing armor if called. @@ -939,7 +939,7 @@ private void setLocations() { } } } - + // Methods - Engine /** * Checks to see if an engine type is valid. @@ -1032,8 +1032,8 @@ else if (type.equals("Steam")) { throw new Exception("Unknown engine type"); } } - - + + /** * Sets the engine type, if that engine type is valid. * Used to actually process input about the engine type. @@ -1141,20 +1141,20 @@ else if (type.equals("Steam")) { throw new Exception("Invalid engine type"); } } - + public void setCruiseMP(int cruise) { this.cruiseSpeed = cruise; } - + public int getCruiseMP() { return this.cruiseSpeed; } - + public int getFlankMP() { int flank = (int) Math.ceil(this.cruiseSpeed); return flank; } - + public double getEngineTonnage() { this.setEngineTonnage(); double tonnage = this.Tonnage; @@ -1172,7 +1172,7 @@ private void setEngineTonnage() { if (this.techRating.equals("F")) { engineMultiplier = this.engine.getMultipliers().get(5); } this.Tonnage = motiveFactor * engineMultiplier * this.baseEngineValue; } - + // Methods - Other public void Visit( ifVisitor v ) throws Exception { v.Visit( this ); diff --git a/sswlib/src/main/java/gui/HTMLPane.java b/sswlib/src/main/java/gui/HTMLPane.java index e845a1f7..ad1a9783 100644 --- a/sswlib/src/main/java/gui/HTMLPane.java +++ b/sswlib/src/main/java/gui/HTMLPane.java @@ -87,7 +87,7 @@ public class HTMLPane extends JPanel implements ActionListener { private JMenuBar MainMenu; private JMenu EditMenu, Font, FontSize, FontColor, Style; private JMenuItem Black, Yellow, Red, Orange, Blue, Green, Cyan, Magenta, - Undo, Redo, Source, Clear, SelectAll, Bullets, Unordered, + Undo, Redo, Source, Clear, SelectAll, // Bullets, Unordered, // Not Used Subscript, Superscript, Strikethrough; protected UndoableEditListener UndoHandler = new UndoHandler(); @@ -105,7 +105,7 @@ public class HTMLPane extends JPanel implements ActionListener { private Action UnderlineAction = new StyledEditorKit.UnderlineAction(); private Action ItalicAction = new StyledEditorKit.ItalicAction(); - private javax.swing.ImageIcon check = new javax.swing.ImageIcon( getClass().getResource("/images/ui-check-box.png") ); + // private javax.swing.ImageIcon check = new javax.swing.ImageIcon( getClass().getResource("/images/ui-check-box.png") ); // Not Used /* private HTMLEditorKit.InsertHTMLTextAction UnorderedListAction = new HTMLEditorKit.InsertHTMLTextAction( "Bullets", "
", HTML.Tag.P, HTML.Tag.UL ); From 7fc9d11f5263ee8e5265acc588d27d44cc06bbcc Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 13:54:42 -0600 Subject: [PATCH 082/126] Mass Update - Import not used --- .../java/ssw/filehandlers/HTMLWriter.java | 1 - ssw/src/main/java/ssw/print/Printer.java | 11 ++- .../main/java/ssw/printpreview/Preview.java | 1 - sswlib/src/main/java/Force/Skills.java | 5 +- sswlib/src/main/java/Force/Warriors.java | 1 - sswlib/src/main/java/IO/MTFWriter.java | 11 ++- sswlib/src/main/java/Print/PIPPrinter.java | 22 +++--- .../src/main/java/Print/preview/Preview.java | 1 - .../java/Print/preview/PreviewDialog.java | 7 -- .../src/main/java/components/CVLoadout.java | 67 +++++++++---------- .../main/java/components/SponsonTurret.java | 1 - sswlib/src/main/java/dialog/dlgImageMgr.java | 1 - .../filehandlers/CombatVehicleWriter.java | 3 - .../src/main/java/filehandlers/TXTWriter.java | 2 - 14 files changed, 55 insertions(+), 79 deletions(-) diff --git a/ssw/src/main/java/ssw/filehandlers/HTMLWriter.java b/ssw/src/main/java/ssw/filehandlers/HTMLWriter.java index 5c594aa6..f95fb4af 100644 --- a/ssw/src/main/java/ssw/filehandlers/HTMLWriter.java +++ b/ssw/src/main/java/ssw/filehandlers/HTMLWriter.java @@ -39,7 +39,6 @@ import java.util.ArrayList; import common.CommonTools; import filehandlers.FileCommon; -import filehandlers.FileCommon; public class HTMLWriter { diff --git a/ssw/src/main/java/ssw/print/Printer.java b/ssw/src/main/java/ssw/print/Printer.java index be883a36..c4dc25b8 100644 --- a/ssw/src/main/java/ssw/print/Printer.java +++ b/ssw/src/main/java/ssw/print/Printer.java @@ -40,7 +40,6 @@ import common.CommonTools; import components.Mech; import filehandlers.Media; -import gui.*; import Print.*; import filehandlers.ImageTracker; @@ -74,7 +73,7 @@ public class Printer { public Printer() { this(null); } - + public Printer(ifMechForm p) { Parent = p; setPaperSize(Letter); @@ -220,7 +219,7 @@ public void PrintSingles() { if ( ! BatchDialog() ) return; } } - + for (int index=0; index <= Mechs.size()-1; index++) { PrintMech pm = (PrintMech) Mechs.get(index); job.setJobName( pm.CurMech.GetFullName().trim() ); @@ -324,13 +323,13 @@ private Boolean BatchDialog() { if ( !this.logoPath.isEmpty() ) { POptions.setLogo(new File(this.logoPath)); } - + POptions.setVisible( true ); if( ! POptions.Result() ) { return false; } - + for ( int m=0; m <= Mechs.size()-1; m++ ) { PrintMech pMech = (PrintMech) Mechs.get(m); pMech.setPrintPilot(POptions.PrintPilot()); @@ -451,4 +450,4 @@ public void PrintBattleforce() { } } } -} \ No newline at end of file +} diff --git a/ssw/src/main/java/ssw/printpreview/Preview.java b/ssw/src/main/java/ssw/printpreview/Preview.java index 282d3638..c15b0c88 100644 --- a/ssw/src/main/java/ssw/printpreview/Preview.java +++ b/ssw/src/main/java/ssw/printpreview/Preview.java @@ -24,7 +24,6 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; -import java.awt.RenderingHints; import java.awt.print.PageFormat; import java.awt.print.Pageable; import java.awt.print.Printable; diff --git a/sswlib/src/main/java/Force/Skills.java b/sswlib/src/main/java/Force/Skills.java index b758bde3..65914d3c 100644 --- a/sswlib/src/main/java/Force/Skills.java +++ b/sswlib/src/main/java/Force/Skills.java @@ -33,7 +33,6 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import java.io.FileNotFoundException; import java.util.ArrayList; -import java.util.ArrayList; import javax.swing.DefaultListModel; public class Skills { @@ -53,7 +52,7 @@ public class Skills { public Skills() { } - + public Skills(float BV) { this.BV = BV; SetSkills(); @@ -274,7 +273,7 @@ public class Skill { private float BV = 0f; public Skill() { - + } public Skill(int Gunnery, int Piloting, float BV) { diff --git a/sswlib/src/main/java/Force/Warriors.java b/sswlib/src/main/java/Force/Warriors.java index e0304822..dd89ffff 100644 --- a/sswlib/src/main/java/Force/Warriors.java +++ b/sswlib/src/main/java/Force/Warriors.java @@ -32,7 +32,6 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.ArrayList; import javax.swing.DefaultListModel; import javax.swing.JTable; import javax.swing.RowSorter; diff --git a/sswlib/src/main/java/IO/MTFWriter.java b/sswlib/src/main/java/IO/MTFWriter.java index aa782952..b3cfad81 100644 --- a/sswlib/src/main/java/IO/MTFWriter.java +++ b/sswlib/src/main/java/IO/MTFWriter.java @@ -28,7 +28,6 @@ package IO; -import common.CommonTools; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; @@ -50,7 +49,7 @@ public MTFWriter( ) { public MTFWriter( Mech m ) { CurMech = m; } - + public MTFWriter( CombatVehicle v ) { CurVee = v; } @@ -360,7 +359,7 @@ public void WriteMechMTF( String filename ) throws IOException { // all done FR.close(); } - + public void WriteVeeMTF( String filename ) throws IOException { BufferedWriter FR = new BufferedWriter( new FileWriter( filename ) ); @@ -577,18 +576,18 @@ public void WriteVeeMTF( String filename ) throws IOException { // all done FR.close(); } - + public void WriteMTF( String filename ) throws IOException { if (CurMech != null) { WriteMechMTF(filename); return; } - + if ( CurVee != null ) { WriteVeeMTF(filename); return; } - + } public void setMech( Mech m ) { diff --git a/sswlib/src/main/java/Print/PIPPrinter.java b/sswlib/src/main/java/Print/PIPPrinter.java index 8579c796..b7a936cb 100644 --- a/sswlib/src/main/java/Print/PIPPrinter.java +++ b/sswlib/src/main/java/Print/PIPPrinter.java @@ -28,13 +28,11 @@ package Print; -import Print.Points.PIPRow; import components.CombatVehicle; import components.LocationIndex; import components.Mech; import filehandlers.ImageTracker; import java.awt.*; -import java.util.ArrayList; import java.util.HashMap; public class PIPPrinter { @@ -71,7 +69,7 @@ public PIPPrinter(Graphics2D graphics, ImageTracker images) { this.imageTracker = images; this.graphics = graphics; } - + /** * Creates an PIPPrinter object with the given objects * @@ -81,7 +79,7 @@ public PIPPrinter(Graphics2D graphics, ImageTracker images) { public PIPPrinter( Graphics2D graphics, Mech curMech, ImageTracker images ) { this(graphics, curMech, true, false, images); } - + /** * Creates an PIPPrinter object with the given objects * @@ -162,7 +160,7 @@ public PIPPrinter( Graphics2D graphics, CombatVehicle curVee, boolean useCanon, if ( CurVee.isHasTurret2() ) Points = new TWAdvGroundPoints(); if ( CurVee.IsNaval() ) Points = new TWNavalPoints(); if ( CurVee.IsVTOL() ) Points = new TWVTOLPoints(); - + Armor.put(LocationIndex.CV_LOC_FRONT, new PIPSettings(LocationIndex.CV_LOC_FRONT, false, new Point(463,52), new Point(17,20), "FRONT_", Points.GetArmorFrontPoints())); Armor.put(LocationIndex.CV_LOC_LEFT, new PIPSettings(LocationIndex.CV_LOC_LEFT, false, new Point(457,84), new Point(28,88), "LEFT_", Points.GetArmorLeftPoints())); Armor.put(LocationIndex.CV_LOC_RIGHT, new PIPSettings(LocationIndex.CV_LOC_RIGHT, false, new Point(422,66), new Point(32,86), "RIGHT_", Points.GetArmorRightPoints())); @@ -173,7 +171,7 @@ public PIPPrinter( Graphics2D graphics, CombatVehicle curVee, boolean useCanon, Armor.put(LocationIndex.CV_LOC_TURRET2, new PIPSettings(LocationIndex.CV_LOC_TURRET2, false, new Point(556,55), new Point(-30,98), "TURRET2_", Points.GetArmorTurret2Points())); if ( CurVee.IsVTOL() ) Armor.put(LocationIndex.CV_LOC_ROTOR, new PIPSettings(LocationIndex.CV_LOC_ROTOR, false, new Point(400,160), new Point(51,125), "ROTOR_", Points.GetArmorRotorPoints())); - + Internal.put(LocationIndex.CV_LOC_FRONT, new PIPSettings(LocationIndex.CV_LOC_FRONT, true, new Point(452,389), new Point(13,13), "INT_FRONT_", Points.GetInternalFrontPoints())); Internal.put(LocationIndex.CV_LOC_LEFT, new PIPSettings(LocationIndex.CV_LOC_LEFT, true, new Point(450,410), new Point(17,61), "INT_LEFT_", Points.GetInternalLeftPoints())); Internal.put(LocationIndex.CV_LOC_RIGHT, new PIPSettings(LocationIndex.CV_LOC_RIGHT, true, new Point(426,401), new Point(21,59), "INT_RIGHT_", Points.GetInternalRightPoints())); @@ -184,14 +182,14 @@ public PIPPrinter( Graphics2D graphics, CombatVehicle curVee, boolean useCanon, Internal.put(LocationIndex.CV_LOC_TURRET2, new PIPSettings(LocationIndex.CV_LOC_TURRET2, true, new Point(514,400), new Point(-14,75), "INT_TURRET2_", Points.GetInternalTurret2Points())); if ( CurVee.IsVTOL() ) Internal.put(LocationIndex.CV_LOC_ROTOR, new PIPSettings(LocationIndex.CV_LOC_ROTOR, true, new Point(418,463), new Point(25,89), "INT_ROTOR_", Points.GetInternalRotorPoints())); - + } - + public ifPrintPoints GetPoints() { return Points; } - + /** * Renders the armor points for the print out based on the inputs received * @@ -212,7 +210,7 @@ public void Render( Graphics2D graphics, Mech CurMech, boolean useCanon ) { public void Render( Graphics2D graphics, CombatVehicle CurVee, boolean useCanon ) { this.graphics = graphics; this.useCanon = useCanon; - + if ( graphics == null ) { return; } graphics.setStroke(new BasicStroke(.75f)); @@ -233,7 +231,7 @@ public void Render( Graphics2D graphics, CombatVehicle CurVee, boolean useCanon renderImage(settings); } else { for( int i = 0; i < CurVee.GetIntStruc().NumCVSpaces(); i++ ) { - if ( settings.points.length >= i ) + if ( settings.points.length >= i ) PrintConsts.FilledCircle( graphics, Color.BLACK, Color.WHITE, 5, settings.points[i].x, settings.points[i].y); //graphics.drawOval( settings.points[i].x, settings.points[i].y, 5, 5 ); } @@ -357,7 +355,7 @@ public PIPSettings(int LocationID, boolean internal, Point startingPoint, Point public int GetArmor() { return CurMech.GetArmor().GetLocationArmor(LocationID); } - + public int GetArmor(CombatVehicle vee ) { return vee.GetArmor().GetLocationArmor(LocationID); } diff --git a/sswlib/src/main/java/Print/preview/Preview.java b/sswlib/src/main/java/Print/preview/Preview.java index b22d1781..3533bf76 100644 --- a/sswlib/src/main/java/Print/preview/Preview.java +++ b/sswlib/src/main/java/Print/preview/Preview.java @@ -24,7 +24,6 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; -import java.awt.RenderingHints; import java.awt.print.PageFormat; import java.awt.print.Pageable; import java.awt.print.Printable; diff --git a/sswlib/src/main/java/Print/preview/PreviewDialog.java b/sswlib/src/main/java/Print/preview/PreviewDialog.java index 516f9fb5..c113e5ee 100644 --- a/sswlib/src/main/java/Print/preview/PreviewDialog.java +++ b/sswlib/src/main/java/Print/preview/PreviewDialog.java @@ -20,23 +20,16 @@ */ package Print.preview; -import java.awt.Dimension; import java.awt.FlowLayout; -import java.awt.Image; -import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.image.BufferedImage; import java.awt.print.PageFormat; import java.awt.print.Pageable; import java.awt.print.Printable; -import java.io.File; -import java.net.URL; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.ImageIcon; import javax.swing.JButton; -import javax.swing.JCheckBox; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JPanel; diff --git a/sswlib/src/main/java/components/CVLoadout.java b/sswlib/src/main/java/components/CVLoadout.java index ca39b21b..feca0893 100644 --- a/sswlib/src/main/java/components/CVLoadout.java +++ b/sswlib/src/main/java/components/CVLoadout.java @@ -32,7 +32,6 @@ import common.Constants; import java.util.ArrayList; import java.util.LinkedHashSet; -import java.util.List; import visitors.VFCSApolloLoader; import visitors.VFCSArtemisIVLoader; @@ -77,7 +76,7 @@ public class CVLoadout implements ifCVLoadout, ifLoadout { private SponsonTurret SponsonTurretLeft = new SponsonTurret(this, false), SponsonTurretRight = new SponsonTurret(this, false); private CVPowerAmplifier PowerAmplifier = new CVPowerAmplifier(this); - + private int RulesLevel = AvailableCode.RULES_TOURNAMENT, TechBase = AvailableCode.TECH_INNER_SPHERE, Era = AvailableCode.ERA_STAR_LEAGUE, @@ -91,7 +90,7 @@ public CVLoadout( CombatVehicle c ) { Jumps = new CVJumpJetFactory( this ); HeatSinks = new CVHeatSinkFactory( this ); } - + public CVLoadout( String name, CombatVehicle m, int BaseNumHS, CVHeatSinkFactory hs, CVJumpJetFactory jump ) { // provided for cloning purposes Name = name; @@ -99,7 +98,7 @@ public CVLoadout( String name, CombatVehicle m, int BaseNumHS, CVHeatSinkFactory Jumps = new CVJumpJetFactory( this, jump ); HeatSinks = new CVHeatSinkFactory( this, BaseNumHS, hs.CurrentConfig(), hs.GetPlacedHeatSinks() ); } - + public CombatVehicle GetOwner() { return Owner; } @@ -227,7 +226,7 @@ public ArrayList GetNonCore() { public ArrayList GetEquipment() { ArrayList equip = new ArrayList(); for ( abPlaceable a : (ArrayList) GetNonCore() ) { - if ( !(a instanceof Ammunition) ) + if ( !(a instanceof Ammunition) ) equip.add(a); } @@ -273,26 +272,26 @@ public void SafeClearLoadout() { Items.add(Turret2Items); Items.add(SponsonTurretLeftItems); Items.add(SponsonTurretRightItems); - + ArrayList remove = new ArrayList(); - + for ( ArrayList list : Items ) { for ( abPlaceable a : list ) { if ( !a.LocationLocked() ) remove.add(a); } } - + for(abPlaceable a : remove ) { Remove(a); } //reset the number of heat sinks to the Engine base since they got rid of all the weapons. GetHeatSinks().SetNumHS(GetTotalHeat()); - + Owner.SetChanged( true ); } - + public void ResetHeatSinks() { //reset the number of heat sinks to the Engine base since they got rid of all the weapons. GetHeatSinks().SetNumHS(GetTotalHeat()); @@ -347,7 +346,7 @@ public void AddTo(abPlaceable p, int Loc) throws Exception { RearItems.add(p); } else throw new Exception(p.ActualName() + " cannot be allocated to the Rear."); - + break; case LocationIndex.CV_LOC_RIGHT: if ( p.CanAllocCVSide() ) @@ -366,7 +365,7 @@ public void AddTo(abPlaceable p, int Loc) throws Exception { } } else throw new Exception(p.ActualName() + " cannot be allocated to the Turret."); - + break; case LocationIndex.CV_LOC_TURRET2: if ( p.CanAllocCVTurret() ) @@ -397,7 +396,7 @@ public void AddTo(abPlaceable p, int Loc) throws Exception { } RefreshHeatSinks(); } - + private boolean HasHitch(ArrayList items) { for( int i = 0; i < items.size(); ++i ) { @@ -412,10 +411,10 @@ public void RefreshHeatSinks() { GetHeatSinks().SetNumHS(GetTotalHeat()); if ( GetHeatSinks().GetNumHS() < GetEngine().FreeHeatSinks() ) GetHeatSinks().SetNumHS(GetEngine().FreeHeatSinks()); - if ( Owner.IsOmni() && Owner.GetBaseLoadout().GetHeatSinks().GetNumHS() > GetHeatSinks().GetNumHS() ) + if ( Owner.IsOmni() && Owner.GetBaseLoadout().GetHeatSinks().GetNumHS() > GetHeatSinks().GetNumHS() ) GetHeatSinks().SetNumHS(Owner.GetBaseLoadout().GetHeatSinks().GetNumHS()); } - + public double GetItemsTonnage( ArrayList items ) { double total = 0; for( abPlaceable a : items ) { @@ -423,7 +422,7 @@ public double GetItemsTonnage( ArrayList items ) { } return total; } - + public int GetTotalHeat() { int total = 0; for ( abPlaceable a : (ArrayList)GetNonCore() ) { @@ -462,7 +461,7 @@ public void AddToRight(abPlaceable p) throws Exception { if ( p.CanAllocCVSide() ) { AddTo(p, LocationIndex.CV_LOC_RIGHT); Owner.SetChanged( true ); - } else + } else throw new Exception(p.ActualName() + " cannot be allocated to the Side."); } @@ -470,7 +469,7 @@ public void AddToRear(abPlaceable p) throws Exception { if ( !p.CanAllocCVRear() ) { AddTo(p, LocationIndex.CV_LOC_REAR); Owner.SetChanged( true ); - } else + } else throw new Exception(p.ActualName() + " cannot be allocated to the Rear."); } @@ -480,7 +479,7 @@ public void AddToBody(abPlaceable p) throws Exception { Owner.SetChanged( true ); } else throw new Exception(p.ActualName() + " cannot be allocated to the Body."); - + } public void AddToTurret1(abPlaceable p) throws Exception { @@ -691,7 +690,7 @@ public void Remove(abPlaceable p) { if ( FrontItems.contains( p ) ) FrontItems.remove( p ); if ( LeftItems.contains(p)) - LeftItems.remove(p); + LeftItems.remove(p); if ( RightItems.contains(p)) RightItems.remove(p); if ( BodyItems.contains(p)) @@ -747,7 +746,7 @@ public void LockChassis() { Items.add(Turret2Items); Items.add(SponsonTurretLeftItems); Items.add(SponsonTurretRightItems); - + for ( ArrayList list : Items ) { for ( abPlaceable a : list ) { a.SetLocked(true); @@ -766,7 +765,7 @@ public void UnlockChassis() { Items.add(Turret2Items); Items.add(SponsonTurretLeftItems); Items.add(SponsonTurretRightItems); - + for ( ArrayList list : Items ) { for ( abPlaceable a : list ) { a.SetLocked(false); @@ -800,7 +799,7 @@ public ifCVLoadout Clone() { clone.SetTurret2( (ArrayList)Turret2Items.clone() ); clone.SetSponsonTurretLeftItems((ArrayList) SponsonTurretLeftItems.clone()); clone.SetSponsonTurretRightItems((ArrayList) SponsonTurretRightItems.clone()); - + if( TCList.size() > 0 ) { clone.SetTCList( (ArrayList) TCList.clone() ); } @@ -891,7 +890,7 @@ public void RemoveISCase() { UsingCASE = false; Remove(Case); } - + public void SetISCASE() { UsingCASE = true; Remove(Case); @@ -903,7 +902,7 @@ public void SetISCASE() { } public boolean HasISCASE() { - if ( UsingCASE ) return true; + if ( UsingCASE ) return true; if ( Owner.IsOmni() && this != Owner.GetBaseLoadout() ) return Owner.GetBaseLoadout().HasISCASE(); return false; } @@ -1010,7 +1009,7 @@ public void UseTC(boolean use, boolean clan) { public void CheckTC() { // this routine checks to see if the targeting computer can be allocated // and does so if needed. It will also remove the TC if it has to. - + // remove the TC from the loadout Remove( CurTC ); if( ! Use_TC ) { @@ -1018,9 +1017,9 @@ public void CheckTC() { TCList = new ArrayList(); return; } - + BodyItems.add(CurTC); - + Owner.SetChanged( true ); } @@ -1146,7 +1145,7 @@ public Turret GetTurret(){ Turret1.SetItems(Turret1Items); return Turret1; } - + public void SetTurret( Turret t ) { Turret1 = t; } @@ -1155,7 +1154,7 @@ public Turret GetRearTurret() { Turret2.SetItems(Turret2Items); return Turret2; } - + public void SetRearTurret( Turret t ) { Turret2 = t; } @@ -1193,16 +1192,16 @@ public void MoveToQueue( int loc ) { Owner.SetChanged( true ); */ } - + public ifUnit GetUnit() { return Owner; } - + public double GetTurretTonnage() { Turret1.SetItems(Turret1Items); return Turret1.GetTonnage(); } - + public double GetRearTurretTonnage() { Turret2.SetItems(Turret2Items); return Turret2.GetTonnage(); @@ -1229,4 +1228,4 @@ public int NumCVAmmoSpaces() { } return indexes.size(); } -} \ No newline at end of file +} diff --git a/sswlib/src/main/java/components/SponsonTurret.java b/sswlib/src/main/java/components/SponsonTurret.java index 3e983ae6..8fdb0618 100644 --- a/sswlib/src/main/java/components/SponsonTurret.java +++ b/sswlib/src/main/java/components/SponsonTurret.java @@ -28,7 +28,6 @@ package components; -import common.CommonTools; import java.util.ArrayList; public class SponsonTurret extends abPlaceable { diff --git a/sswlib/src/main/java/dialog/dlgImageMgr.java b/sswlib/src/main/java/dialog/dlgImageMgr.java index 2d0399b1..fa4a07fc 100644 --- a/sswlib/src/main/java/dialog/dlgImageMgr.java +++ b/sswlib/src/main/java/dialog/dlgImageMgr.java @@ -40,7 +40,6 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import javax.swing.border.TitledBorder; import filehandlers.MechWriter; import java.util.ArrayList; -import java.util.Vector; import java.util.prefs.Preferences; public class dlgImageMgr extends javax.swing.JDialog { diff --git a/sswlib/src/main/java/filehandlers/CombatVehicleWriter.java b/sswlib/src/main/java/filehandlers/CombatVehicleWriter.java index cbf7797f..1f8d0a13 100644 --- a/sswlib/src/main/java/filehandlers/CombatVehicleWriter.java +++ b/sswlib/src/main/java/filehandlers/CombatVehicleWriter.java @@ -32,9 +32,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; -import java.util.Vector; -import common.*; -import battleforce.BattleForceStats; import components.*; public class CombatVehicleWriter { diff --git a/sswlib/src/main/java/filehandlers/TXTWriter.java b/sswlib/src/main/java/filehandlers/TXTWriter.java index fc9108ac..96ec4eb6 100644 --- a/sswlib/src/main/java/filehandlers/TXTWriter.java +++ b/sswlib/src/main/java/filehandlers/TXTWriter.java @@ -34,14 +34,12 @@ import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; -import java.util.Enumeration; import java.util.ArrayList; import battleforce.BattleForceStats; import battleforce.BattleForceTools; import components.*; import java.io.FileOutputStream; import java.io.OutputStreamWriter; -import java.util.ArrayList; import java.util.Iterator; import list.*; import utilities.CostBVBreakdown; From a1b1acfcc4ded68fd2dc8c62ccce5a4566b9bd64 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 13:58:57 -0600 Subject: [PATCH 083/126] Print - PrintConsts.java --- sswlib/src/main/java/Print/PrintConsts.java | 34 ++++++++++----------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/sswlib/src/main/java/Print/PrintConsts.java b/sswlib/src/main/java/Print/PrintConsts.java index 3d909a41..a8add76d 100644 --- a/sswlib/src/main/java/Print/PrintConsts.java +++ b/sswlib/src/main/java/Print/PrintConsts.java @@ -34,9 +34,7 @@ import java.awt.Font; import java.awt.Graphics2D; import java.util.Calendar; -import java.util.Enumeration; import java.util.ArrayList; -import java.util.Iterator; import java.util.ListIterator; public class PrintConsts { @@ -112,7 +110,7 @@ public class PrintConsts { //public final static Font BaseFont = FontLoader.getFont("Eurosti.ttf").deriveFont(Font.PLAIN, 20); //public final static Font BaseBoldFont = FontLoader.getFont("Eurostib.ttf").deriveFont(Font.PLAIN, 20); - + public final static Font BaseFont = FontLoader.getFont("EurostileLTStd.ttf").deriveFont(Font.PLAIN, 20); public final static Font BaseBoldFont = FontLoader.getFont("EurostileLTStd-Demi.ttf").deriveFont(Font.PLAIN, 20); public final static Font BaseCritFont = FontLoader.getFont("LiberationSans-Regular.ttf").deriveFont(Font.PLAIN, 10); @@ -202,7 +200,7 @@ public static void FilledCircle( Graphics2D graphic, Color foreColor, Color back if (chars[i] == '\n') { line.append(word); lines.add(line.toString()); - + line.delete(0, line.length()); word.delete(0, word.length()); } @@ -221,9 +219,9 @@ public static void FilledCircle( Graphics2D graphic, Color foreColor, Color back if (line.length() > 0) { lines.add(line.toString()); } - + String[] ret = new String[lines.size()]; - + return lines.toArray(ret); } @@ -232,13 +230,13 @@ public static String[] getCopyright() { "Copyright " + (Calendar.getInstance()).get(Calendar.YEAR) + " The Topps Company, Inc. Battletech, 'Mech and BattleMech are trademarks of The Topps Company, Inc. All Rights reserved.", " Catalyst Game Labs and the Catalyst Game Labs logo are trademarks of InMediaRes Productions, LLC. Permission to photocopy for personal use."}; } - + public static String GetPrintName( abPlaceable a, int Techbase, int Loc ) { // returns a modified PrintName, useful for special situations such as // mixed-tech mechs. return GetPrintName( a, Techbase, a.CritName( Loc )); } - + public static String GetPrintName( abPlaceable a, int Techbase, String Name ) { String retval = Name; if( a instanceof RangedWeapon && Techbase == AvailableCode.TECH_BOTH ) { @@ -253,12 +251,12 @@ public static String GetPrintName( abPlaceable a, int Techbase, String Name ) { } return retval; } - + public static ArrayList SortEquipmentByLocation( Mech CurMech, int MiniConvRate ) { boolean HasAmmoData = false; ArrayList v = (ArrayList) CurMech.GetLoadout().GetNonCore().clone(); - + // Remove Proto Double Heatsinks, so they don't clog up the equipment list ListIterator listIterator = v.listIterator(); while (listIterator.hasNext()){ @@ -267,7 +265,7 @@ public static ArrayList SortEquipmentByLocation( Mech CurMech, in listIterator.remove(); } else if(temp instanceof EquipmentProtoStarLeagueDoubleHeatSink) { listIterator.remove(); - } + } } // add in MASC and the targeting computer if needed. if( CurMech.GetPhysEnhance().IsMASC() ) v.add( CurMech.GetPhysEnhance() ); @@ -387,7 +385,7 @@ public static ArrayList SortEquipmentByLocation( Mech CurMech, in return temp; } - + public static ArrayList SortEquipmentByLocation( CombatVehicle CurUnit, int MiniConvRate ) { ArrayList Data = new ArrayList(); @@ -410,16 +408,16 @@ public static ArrayList SortEquipmentByLocation( CombatVehicle Cu Data.addAll(HandleLocation( CurUnit, MiniConvRate, a, LocationIndex.CV_LOC_SPONSON_LEFT)); a = CurUnit.GetLoadout().GetSponsonTurretRightItems().toArray(a); Data.addAll(HandleLocation( CurUnit, MiniConvRate, a, LocationIndex.CV_LOC_SPONSON_RIGHT)); - + return Data; } - + private static ArrayList HandleLocation( CombatVehicle CurUnit, int MiniConvRate, abPlaceable[] items, int Location ) { ArrayList Data = new ArrayList(); PlaceableInfo p = null; int count = 0; boolean HasAmmoData = false; - + for (int i = 0; i < items.length; i++) { if ( items[i] != null ) { if ( items[i] instanceof Ammunition ) continue; @@ -435,7 +433,7 @@ private static ArrayList HandleLocation( CombatVehicle CurUnit, i } } } - + if ( p.name.equals("Targeting Computer") || p.name.equals("AES") ) count = 1; @@ -496,10 +494,10 @@ private static ArrayList HandleLocation( CombatVehicle CurUnit, i } } } - + } } - + return Data; } } From 89d67c34f947a67c4d8d706c22357a279ae9522c Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 13:59:14 -0600 Subject: [PATCH 084/126] Ensure files are closed --- .../java/saw/filehandlers/HTMLWriter.java | 45 +++++++++++++++---- .../java/ssw/filehandlers/HTMLWriter.java | 45 +++++++++++++++---- 2 files changed, 74 insertions(+), 16 deletions(-) diff --git a/saw/src/main/java/saw/filehandlers/HTMLWriter.java b/saw/src/main/java/saw/filehandlers/HTMLWriter.java index c562c4e6..92638d70 100644 --- a/saw/src/main/java/saw/filehandlers/HTMLWriter.java +++ b/saw/src/main/java/saw/filehandlers/HTMLWriter.java @@ -89,7 +89,11 @@ public void WriteHTML( String template, String destfile ) throws IOException { while( end == false ) { read = FR.readLine(); // see if someone forgot to end the fluff line - if( read == null ) { throw new IOException( "Unexpected EOF: No End Equipment Fluff tag."); } + if (read == null) { + FW.close(); + FR.close(); + throw new IOException("Unexpected EOF: No End Equipment Fluff tag."); + } // check for the end, then add the line if( read.contains( "<+-SSW_END_EQUIPMENT_FLUFF_BLOCK-+>" ) ) { end = true; @@ -107,7 +111,11 @@ public void WriteHTML( String template, String destfile ) throws IOException { while( end == false ) { read = FR.readLine(); // see if someone forgot to end the fluff line - if( read == null ) { throw new IOException( "Unexpected EOF: No End Equipment tag."); } + if (read == null) { + FW.close(); + FR.close(); + throw new IOException("Unexpected EOF: No End Equipment tag."); + } // check for the end, then add the line if( read.contains( "<+-SSW_END_EQUIPMENT_STAT_BLOCK-+>" ) ) { end = true; @@ -126,7 +134,11 @@ public void WriteHTML( String template, String destfile ) throws IOException { while( end == false ) { read = FR.readLine(); // see if someone forgot to end the fluff line - if( read == null ) { throw new IOException( "Unexpected EOF: No End Omnimech tag."); } + if (read == null) { + FW.close(); + FR.close(); + throw new IOException("Unexpected EOF: No End Omnimech tag."); + } // check for the end, then add the line if( read.contains( "<+-SSW_END_OMNIMECH_STAT_BLOCK-+>" ) ) { end = true; @@ -141,7 +153,10 @@ public void WriteHTML( String template, String destfile ) throws IOException { try { FW.write( BuildOmniLines( omni ) ); FW.newLine(); - } catch( IOException e ) { + } catch (IOException e) { + FW.close(); + FR.close(); + throw e; } } @@ -152,7 +167,11 @@ public void WriteHTML( String template, String destfile ) throws IOException { while( end == false ) { read = FR.readLine(); // see if someone forgot to end the fluff line - if( read == null ) { throw new IOException( "Unexpected EOF: No End Normal Armor tag."); } + if (read == null) { + FW.close(); + FR.close(); + throw new IOException("Unexpected EOF: No End Normal Armor tag."); + } // check for the end, then add the line if( read.contains( "<+-SSW_END_NORMAL_ARMOR_BLOCK-+>" ) ) { end = true; @@ -169,7 +188,10 @@ public void WriteHTML( String template, String destfile ) throws IOException { FW.write( ProcessLine( (String) armor.get( i ) ) ); FW.newLine(); } - } catch( IOException e ) { + } catch (IOException e) { + FW.close(); + FR.close(); + throw e; } } @@ -180,7 +202,12 @@ public void WriteHTML( String template, String destfile ) throws IOException { while( end == false ) { read = FR.readLine(); // see if someone forgot to end the fluff line - if( read == null ) { throw new IOException( "Unexpected EOF: No End Patchwork Armor tag."); } + if( read == null ) { + FW.close(); + FR.close(); + + throw new IOException("Unexpected EOF: No End Patchwork Armor tag."); + } // check for the end, then add the line if( read.contains( "<+-SSW_END_PATCHWORK_ARMOR_BLOCK-+>" ) ) { end = true; @@ -197,7 +224,9 @@ public void WriteHTML( String template, String destfile ) throws IOException { FW.write( ProcessLine( (String) armor.get( i ) ) ); FW.newLine(); } - } catch( IOException e ) { + } catch (IOException e) { + FW.close(); + FR.close(); throw e; } } diff --git a/ssw/src/main/java/ssw/filehandlers/HTMLWriter.java b/ssw/src/main/java/ssw/filehandlers/HTMLWriter.java index f95fb4af..540bed8b 100644 --- a/ssw/src/main/java/ssw/filehandlers/HTMLWriter.java +++ b/ssw/src/main/java/ssw/filehandlers/HTMLWriter.java @@ -89,7 +89,11 @@ public void WriteHTML( String template, String destfile ) throws IOException { while( end == false ) { read = FR.readLine(); // see if someone forgot to end the fluff line - if( read == null ) { throw new IOException( "Unexpected EOF: No End Equipment Fluff tag."); } + if (read == null) { + FW.close(); + FR.close(); + throw new IOException("Unexpected EOF: No End Equipment Fluff tag."); + } // check for the end, then add the line if( read.contains( "<+-SSW_END_EQUIPMENT_FLUFF_BLOCK-+>" ) ) { end = true; @@ -107,7 +111,11 @@ public void WriteHTML( String template, String destfile ) throws IOException { while( end == false ) { read = FR.readLine(); // see if someone forgot to end the fluff line - if( read == null ) { throw new IOException( "Unexpected EOF: No End Equipment tag."); } + if (read == null) { + FW.close(); + FR.close(); + throw new IOException("Unexpected EOF: No End Equipment tag."); + } // check for the end, then add the line if( read.contains( "<+-SSW_END_EQUIPMENT_STAT_BLOCK-+>" ) ) { end = true; @@ -126,7 +134,11 @@ public void WriteHTML( String template, String destfile ) throws IOException { while( end == false ) { read = FR.readLine(); // see if someone forgot to end the fluff line - if( read == null ) { throw new IOException( "Unexpected EOF: No End Omnimech tag."); } + if (read == null) { + FW.close(); + FR.close(); + throw new IOException("Unexpected EOF: No End Omnimech tag."); + } // check for the end, then add the line if( read.contains( "<+-SSW_END_OMNIMECH_STAT_BLOCK-+>" ) ) { end = true; @@ -141,7 +153,10 @@ public void WriteHTML( String template, String destfile ) throws IOException { try { FW.write( BuildOmniLines( omni ) ); FW.newLine(); - } catch( IOException e ) { + } catch (IOException e) { + FW.close(); + FR.close(); + throw e; } } @@ -152,7 +167,11 @@ public void WriteHTML( String template, String destfile ) throws IOException { while( end == false ) { read = FR.readLine(); // see if someone forgot to end the fluff line - if( read == null ) { throw new IOException( "Unexpected EOF: No End Normal Armor tag."); } + if (read == null) { + FW.close(); + FR.close(); + throw new IOException("Unexpected EOF: No End Normal Armor tag."); + } // check for the end, then add the line if( read.contains( "<+-SSW_END_NORMAL_ARMOR_BLOCK-+>" ) ) { end = true; @@ -169,7 +188,10 @@ public void WriteHTML( String template, String destfile ) throws IOException { FW.write( ProcessLine( (String) armor.get( i ) ) ); FW.newLine(); } - } catch( IOException e ) { + } catch (IOException e) { + FW.close(); + FR.close(); + throw e; } } @@ -180,7 +202,11 @@ public void WriteHTML( String template, String destfile ) throws IOException { while( end == false ) { read = FR.readLine(); // see if someone forgot to end the fluff line - if( read == null ) { throw new IOException( "Unexpected EOF: No End Patchwork Armor tag."); } + if (read == null) { + FW.close(); + FR.close(); + throw new IOException("Unexpected EOF: No End Patchwork Armor tag."); + } // check for the end, then add the line if( read.contains( "<+-SSW_END_PATCHWORK_ARMOR_BLOCK-+>" ) ) { end = true; @@ -197,7 +223,10 @@ public void WriteHTML( String template, String destfile ) throws IOException { FW.write( ProcessLine( (String) armor.get( i ) ) ); FW.newLine(); } - } catch( IOException e ) { + } catch (IOException e) { + FW.close(); + FR.close(); + throw e; } } From e826b08972a60be25b6832fa8faeada144093971 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 15:38:55 -0600 Subject: [PATCH 085/126] ssw/gui - dlgPrintBatchMechs.java - Removed constructor not being used in program - Type enforcement for tempaltes --- ssw/src/main/java/ssw/gui/dlgPrintBatchMechs.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ssw/src/main/java/ssw/gui/dlgPrintBatchMechs.java b/ssw/src/main/java/ssw/gui/dlgPrintBatchMechs.java index 3fccf7f2..16cd45f4 100644 --- a/ssw/src/main/java/ssw/gui/dlgPrintBatchMechs.java +++ b/ssw/src/main/java/ssw/gui/dlgPrintBatchMechs.java @@ -52,11 +52,14 @@ private class mechData { public Mech m; public dlgPrintSavedMechOptions POptions; + /* + // Not used internally or anywhere else in code. public mechData (String name, Mech m, dlgPrintSavedMechOptions POptions){ this.name = name; this.m = m; this.POptions = POptions; } + */ public mechData (String name, Mech m){ this.name = name; @@ -94,7 +97,7 @@ private void initComponents() { jButton1 = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); - lstChoosenMechs = new javax.swing.JList(); + lstChoosenMechs = new javax.swing.JList(); btnRemoveMech = new javax.swing.JButton(); btnPrintAll = new javax.swing.JButton(); btnAddMech = new javax.swing.JButton(); @@ -345,7 +348,7 @@ private Mech LoadMechFromFile(File file) { private javax.swing.JButton btnRemoveMech; private javax.swing.JButton jButton1; private javax.swing.JScrollPane jScrollPane1; - private javax.swing.JList lstChoosenMechs; + private javax.swing.JList lstChoosenMechs; // End of variables declaration//GEN-END:variables } From 3c42b6be774e6c6a084e7662948a38e37f500869 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 15:48:21 -0600 Subject: [PATCH 086/126] ssw/print - Printer.java - Removed unused Variables - Enforced templated types - VS Code Formating --- ssw/src/main/java/ssw/print/Printer.java | 248 ++++++++++++----------- 1 file changed, 132 insertions(+), 116 deletions(-) diff --git a/ssw/src/main/java/ssw/print/Printer.java b/ssw/src/main/java/ssw/print/Printer.java index c4dc25b8..8c972b75 100644 --- a/ssw/src/main/java/ssw/print/Printer.java +++ b/ssw/src/main/java/ssw/print/Printer.java @@ -46,17 +46,11 @@ public class Printer { private ifMechForm Parent; private Vector Mechs = new Vector(); - private Vector battleforces = new Vector(); - private BattleForce battleforce; - private BattleforcePrinter printForce; - private String jobName = "SSW Batch Print", - logoPath = "", - MechImagePath = "", - ChartImageOption = ""; - private Boolean Charts = true, - Canon = true, - useDialog = true, - TRO = false; + private Vector battleforces = new Vector(); + // private BattleForce battleforce; // Not Used + // private BattleforcePrinter printForce; // Not Used + private String jobName = "SSW Batch Print", logoPath = ""; + private Boolean Charts = true, Canon = true, useDialog = true, TRO = false; private ImageTracker images = new ImageTracker(); @@ -65,7 +59,7 @@ public class Printer { private PageFormat page = new PageFormat(); private PrinterJob job = PrinterJob.getPrinterJob(); - //To convert paper size to pixels is inches / 0.0139 rounded down + // To convert paper size to pixels is inches / 0.0139 rounded down public final static PaperSize Letter = new PaperSize(8.5d, 11d); public final static PaperSize A4 = new PaperSize(595, 842, 18, 18, 559, 806); public final static PaperSize Legal = new PaperSize(8.5d, 14.0d); @@ -93,18 +87,14 @@ public PrinterJob getJob() { } public void setPaperSize(PaperSize s) { - paper.setSize( s.PaperWidth, s.PaperHeight ); - paper.setImageableArea( s.ImageableX, s.ImageableY, s.ImageableWidth, s.ImageableHeight ); - if ( s == A4 ) - { - for ( PrintMech pm : Mechs ) - { + paper.setSize(s.PaperWidth, s.PaperHeight); + paper.setImageableArea(s.ImageableX, s.ImageableY, s.ImageableWidth, s.ImageableHeight); + if (s == A4) { + for (PrintMech pm : Mechs) { pm.setA4(); } - } else if ( s == Letter ) - { - for ( PrintMech pm : Mechs ) - { + } else if (s == Letter) { + for (PrintMech pm : Mechs) { pm.setLetter(); } } @@ -114,21 +104,21 @@ public Boolean getCharts() { return Charts; } - public Vector GetMechs() { + public Vector GetMechs() { return Mechs; } public void setCharts(Boolean Charts) { this.Charts = Charts; - for (int index=0; index <= Mechs.size()-1; index++) { + for (int index = 0; index <= Mechs.size() - 1; index++) { PrintMech pm = (PrintMech) Mechs.get(index); pm.setCharts(Charts); } } - public void setCanon( boolean Canon ) { + public void setCanon(boolean Canon) { this.Canon = Canon; - for (int index=0; index <= Mechs.size()-1; index++) { + for (int index = 0; index <= Mechs.size() - 1; index++) { PrintMech pm = (PrintMech) Mechs.get(index); pm.setCanon(Canon); } @@ -144,37 +134,39 @@ public Boolean getTRO() { public void setTRO(Boolean TRO) { this.TRO = TRO; - for (int index=0; index <= Mechs.size()-1; index++) { + for (int index = 0; index <= Mechs.size() - 1; index++) { PrintMech pm = (PrintMech) Mechs.get(index); pm.setTRO(TRO); } } - public void setHexConversion( int Rate ) { - for (int index=0; index <= Mechs.size()-1; index++) { + public void setHexConversion(int Rate) { + for (int index = 0; index <= Mechs.size() - 1; index++) { PrintMech pm = (PrintMech) Mechs.get(index); - pm.SetMiniConversion( Rate ); + pm.SetMiniConversion(Rate); } } - public void setPrintWarrior( boolean value ) { - for (int index=0; index <= Mechs.size()-1; index++) { + public void setPrintWarrior(boolean value) { + for (int index = 0; index <= Mechs.size() - 1; index++) { PrintMech pm = (PrintMech) Mechs.get(index); pm.setPrintPilot(value); } } - public void setWarriorData( int Gunnery, int Piloting, String Name, String Unit ) { - for (int index=0; index <= Mechs.size()-1; index++) { + public void setWarriorData(int Gunnery, int Piloting, String Name, String Unit) { + for (int index = 0; index <= Mechs.size() - 1; index++) { PrintMech pm = (PrintMech) Mechs.get(index); pm.SetPilotData(Name, Gunnery, Piloting); pm.setGroupName(Unit); } } - public void AddMech(Mech m, String Mechwarrior, int Gunnery, int Piloting, boolean Charts, boolean PilotInfo, boolean AdjBV) { + public void AddMech(Mech m, String Mechwarrior, int Gunnery, int Piloting, boolean Charts, boolean PilotInfo, + boolean AdjBV) { double BV = (double) m.GetCurrentBV(); - if (AdjBV) BV = CommonTools.GetAdjustedBV(m.GetCurrentBV(), Gunnery, Piloting); + if (AdjBV) + BV = CommonTools.GetAdjustedBV(m.GetCurrentBV(), Gunnery, Piloting); PrintMech pm = new PrintMech(m, images); pm.SetPilotData(Mechwarrior, Gunnery, Piloting); @@ -187,14 +179,14 @@ public void AddMech(Mech m, String Mechwarrior, int Gunnery, int Piloting) { AddMech(m, Mechwarrior, Gunnery, Piloting, Charts, true, true); } - public void AddMech(Mech m){ + public void AddMech(Mech m) { AddMech(m, "", 4, 5, Charts, true, true); } - public void AddForce( BattleForce f ) { + public void AddForce(BattleForce f) { images.preLoadBattleForceImages(); - //battleforces.add( new PrintBattleforce(f) ); - battleforces.add( new BattleforceCardPrinter(f, images) ); + // battleforces.add( new PrintBattleforce(f) ); + battleforces.add(new BattleforceCardPrinter(f, images)); } public void Clear() { @@ -208,21 +200,25 @@ public void Print(Mech m) { } public void PrintSingles() { - if (Mechs.size() == 0) { return;} + if (Mechs.size() == 0) { + return; + } - page.setPaper( paper ); + page.setPaper(paper); - if ( useDialog ) { + if (useDialog) { if (Mechs.size() == 1) { - if ( ! PrintDialog( (PrintMech) Mechs.get(0) ) ) return; + if (!PrintDialog((PrintMech) Mechs.get(0))) + return; } else { - if ( ! BatchDialog() ) return; + if (!BatchDialog()) + return; } } - for (int index=0; index <= Mechs.size()-1; index++) { + for (int index = 0; index <= Mechs.size() - 1; index++) { PrintMech pm = (PrintMech) Mechs.get(index); - job.setJobName( pm.CurMech.GetFullName().trim() ); + job.setJobName(pm.CurMech.GetFullName().trim()); job.setPrintable(pm); try { job.print(); @@ -232,37 +228,42 @@ public void PrintSingles() { } } - public void Print( boolean useDialog ) { + public void Print(boolean useDialog) { this.useDialog = useDialog; Print(); } public void Print() { - //If they didn't provide a mech exit - if (Mechs.size() == 0) { return; } + // If they didn't provide a mech exit + if (Mechs.size() == 0) { + return; + } job.setJobName(jobName.trim()); - //Here is where we will show the print dialog, determine if it's a single mech or multiples - if ( useDialog ) { + // Here is where we will show the print dialog, determine if it's a single mech + // or multiples + if (useDialog) { if (Mechs.size() == 1) { - if ( ! PrintDialog( (PrintMech) Mechs.get(0) ) ) return; + if (!PrintDialog((PrintMech) Mechs.get(0))) + return; } else { - if ( ! BatchDialog() ) return; + if (!BatchDialog()) + return; } } - //start building the print objects necessary + // start building the print objects necessary GeneratePrints(); job.setPageable(pages); boolean DoPrint = job.printDialog(); - if( DoPrint ) { + if (DoPrint) { try { job.print(); - } catch( PrinterException e ) { - System.err.println( e.getMessage() ); - System.out.println( e.getStackTrace() ); + } catch (PrinterException e) { + System.err.println(e.getMessage()); + System.out.println(e.getStackTrace()); } Mechs.clear(); @@ -275,28 +276,29 @@ public Book Preview() { } private void GeneratePrints() { - //reset the book so we don't get extra pages! + // reset the book so we don't get extra pages! pages = new Book(); - //start building the print objects necessary - page.setPaper( paper ); + // start building the print objects necessary + page.setPaper(paper); - for (int index=0; index <= Mechs.size()-1; index++) { + for (int index = 0; index <= Mechs.size() - 1; index++) { PrintMech pm = (PrintMech) Mechs.get(index); pages.append(pm, page); - if (Mechs.size() == 1) job.setJobName(pm.CurMech.GetFullName().trim()); + if (Mechs.size() == 1) + job.setJobName(pm.CurMech.GetFullName().trim()); } } private Boolean PrintDialog(PrintMech pMech) { - dlgPrintSavedMechOptions POptions = new dlgPrintSavedMechOptions( (javax.swing.JFrame) Parent, true, pMech); - POptions.setTitle( "Printing " + pMech.CurMech.GetFullName() ); - POptions.setLocationRelativeTo( (javax.swing.JFrame) Parent ); + dlgPrintSavedMechOptions POptions = new dlgPrintSavedMechOptions((javax.swing.JFrame) Parent, true, pMech); + POptions.setTitle("Printing " + pMech.CurMech.GetFullName()); + POptions.setLocationRelativeTo((javax.swing.JFrame) Parent); - POptions.setVisible( true ); + POptions.setVisible(true); - if( ! POptions.Result() ) { + if (!POptions.Result()) { return false; } @@ -308,36 +310,42 @@ private Boolean PrintDialog(PrintMech pMech) { pMech.setMechImage(POptions.getImage()); pMech.setLogoImage(POptions.getLogo()); pMech.setCanon(POptions.getCanon()); - if ( POptions.UseMiniConversion() ) { pMech.SetMiniConversion( POptions.GetMiniConversionRate() );} - if ( POptions.UseA4Paper() ) { pMech.setA4(); } + if (POptions.UseMiniConversion()) { + pMech.SetMiniConversion(POptions.GetMiniConversionRate()); + } + if (POptions.UseA4Paper()) { + pMech.setA4(); + } POptions.dispose(); return true; } private Boolean BatchDialog() { - dlgPrintSavedMechOptions POptions = new dlgPrintSavedMechOptions( (javax.swing.JFrame) Parent, true); - POptions.setTitle( "Printing Batched Units"); - POptions.setLocationRelativeTo( (javax.swing.JFrame) Parent ); + dlgPrintSavedMechOptions POptions = new dlgPrintSavedMechOptions((javax.swing.JFrame) Parent, true); + POptions.setTitle("Printing Batched Units"); + POptions.setLocationRelativeTo((javax.swing.JFrame) Parent); - if ( !this.logoPath.isEmpty() ) { + if (!this.logoPath.isEmpty()) { POptions.setLogo(new File(this.logoPath)); } - POptions.setVisible( true ); + POptions.setVisible(true); - if( ! POptions.Result() ) { + if (!POptions.Result()) { return false; } - for ( int m=0; m <= Mechs.size()-1; m++ ) { + for (int m = 0; m <= Mechs.size() - 1; m++) { PrintMech pMech = (PrintMech) Mechs.get(m); pMech.setPrintPilot(POptions.PrintPilot()); pMech.setCharts(POptions.PrintCharts()); pMech.setMechImage(POptions.getImage()); pMech.setLogoImage(POptions.getLogo()); pMech.setCanon(POptions.getCanon()); - if ( POptions.UseMiniConversion() ) { pMech.SetMiniConversion( POptions.GetMiniConversionRate() );} + if (POptions.UseMiniConversion()) { + pMech.SetMiniConversion(POptions.GetMiniConversionRate()); + } } POptions.dispose(); @@ -350,84 +358,92 @@ public String getLogoPath() { public void setLogoPath(String logoPath) { this.logoPath = logoPath; - if ( !logoPath.isEmpty() ) { + if (!logoPath.isEmpty()) { Media media = new Media(); - for (int index=0; index <= Mechs.size()-1; index++) { + for (int index = 0; index <= Mechs.size() - 1; index++) { PrintMech pm = (PrintMech) Mechs.get(index); pm.setLogoImage(media.GetImage(logoPath)); } } else { - for (int index=0; index <= Mechs.size()-1; index++) { + for (int index = 0; index <= Mechs.size() - 1; index++) { PrintMech pm = (PrintMech) Mechs.get(index); pm.setLogoImage(null); } } } - public void setMechImagePath(String MechImagePath) { - this.MechImagePath = MechImagePath; - if ( !MechImagePath.isEmpty() ) { + public void setMechImagePath(String imagePath) { + if (!imagePath.isEmpty()) { Media media = new Media(); - for (int index=0; index <= Mechs.size()-1; index++) { + for (int index = 0; index <= Mechs.size() - 1; index++) { PrintMech pm = (PrintMech) Mechs.get(index); - pm.setMechImage(media.GetImage(MechImagePath)); + pm.setMechImage(media.GetImage(imagePath)); } } else { - for (int index=0; index <= Mechs.size()-1; index++) { + for (int index = 0; index <= Mechs.size() - 1; index++) { PrintMech pm = (PrintMech) Mechs.get(index); pm.setMechImage(null); } } } - public void setChartImageOption( String Option ) { - this.ChartImageOption = Option; + + public void setChartImageOption(String Option) { for (int i = 0; i < Mechs.size(); i++) { - PrintMech pm = (PrintMech)Mechs.get(i); + PrintMech pm = (PrintMech) Mechs.get(i); pm.setChartImageOption(Option); } } - public void setBattleForceSheet( String Type ) { - for ( int i=0; i < battleforces.size(); i++ ) { - ((BattleforcePrinter) battleforces.get(i)).setType(Type); + public void setBattleForceSheet(String Type) { + for (int i = 0; i < battleforces.size(); i++) { + battleforces.get(i).setType(Type); } } public Book PreviewBattleforce() { - if ( battleforces.size() == 0 ) { return new Book(); } + if (battleforces.size() == 0) { + return new Book(); + } pages = new Book(); - page.setPaper( paper ); - for ( int i=0; i < battleforces.size(); i++ ) { - pages.append(((BattleforceCardPrinter) battleforces.get(i)), page); + page.setPaper(paper); + for (int i = 0; i < battleforces.size(); i++) { + pages.append(battleforces.get(i), page); } return pages; } - public void PrintBattleforce( boolean useDialog ) { + public void PrintBattleforce(boolean useDialog) { this.useDialog = useDialog; PrintBattleforce(); } public void PrintBattleforce() { - if ( battleforces.size() == 0 ) { return; } + if (battleforces.size() == 0) { + return; + } pages = new Book(); - page.setPaper( paper ); + page.setPaper(paper); - if ( jobName.isEmpty() ) { jobName = "BattleForce"; } - if ( battleforces.size() == 1 ) { - BattleForce bf = ((BattleforcePrinter) battleforces.get(0)).getBattleforce(); - if ( !bf.ForceName.isEmpty() ) { jobName = bf.ForceName.trim(); } + if (jobName.isEmpty()) { + jobName = "BattleForce"; + } + if (battleforces.size() == 1) { + BattleForce bf = battleforces.get(0).getBattleforce(); + if (!bf.ForceName.isEmpty()) { + jobName = bf.ForceName.trim(); + } } job.setJobName(jobName); - if ( useDialog ) { - for ( int i=0; i < battleforces.size(); i++ ) { - BattleforcePrinter bf = (BattleforcePrinter) battleforces.get(i); - dlgPrintBattleforce pForce = new dlgPrintBattleforce( (javax.swing.JFrame) Parent, true, bf.getBattleforce()); + if (useDialog) { + for (int i = 0; i < battleforces.size(); i++) { + BattleforceCardPrinter bf = battleforces.get(i); + dlgPrintBattleforce pForce = new dlgPrintBattleforce((javax.swing.JFrame) Parent, true, + bf.getBattleforce()); pForce.setLocationRelativeTo((javax.swing.JFrame) Parent); pForce.setVisible(true); - if ( !pForce.Result ) { + if (!pForce.Result) { return; } @@ -435,18 +451,18 @@ public void PrintBattleforce() { } } - for ( int i=0; i < battleforces.size(); i++ ) { - pages.append((BattleforcePrinter) battleforces.get(i), page); + for (int i = 0; i < battleforces.size(); i++) { + pages.append(battleforces.get(i), page); } job.setPageable(pages); boolean DoPrint = job.printDialog(); - if( DoPrint ) { + if (DoPrint) { try { job.print(); - } catch( PrinterException e ) { - System.err.println( e.getMessage() ); - System.out.println( e.getStackTrace() ); + } catch (PrinterException e) { + System.err.println(e.getMessage()); + System.out.println(e.getStackTrace()); } } } From 9e16bbfaa68bff40350fd5f5847373b1270606e9 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 16:07:39 -0600 Subject: [PATCH 087/126] ssw/printpreview - Preview.java - Removed unused variables - remvoed noop code. - adjusted assignment to a variable that isn't used --- ssw/src/main/java/ssw/printpreview/Preview.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ssw/src/main/java/ssw/printpreview/Preview.java b/ssw/src/main/java/ssw/printpreview/Preview.java index c15b0c88..3f0c1ffe 100644 --- a/ssw/src/main/java/ssw/printpreview/Preview.java +++ b/ssw/src/main/java/ssw/printpreview/Preview.java @@ -35,7 +35,7 @@ class Preview extends JComponent { * */ private static final long serialVersionUID = 7655013771128802932L; - private final static int DEFAULT_PREVIEW_SIZE = 1024; + // private final static int DEFAULT_PREVIEW_SIZE = 1024; // Not Used private final static double MINIMUM_ZOOM_FACTOR = 0.1; private Dimension viewportSize; @@ -73,15 +73,16 @@ public void setPageable( Pageable pageable ) { PageFormat format = pageable.getPageFormat(index); if (zoom == 0.0) { this.zoom = viewportSize.width / format.getWidth(); - } else - this.zoom = zoom; + } + resize(); } public void moveIndex(int indexStep) { int newIndex = index + indexStep; try { - Printable printable = pageable.getPrintable(newIndex); + // Printable printable = pageable.getPrintable(newIndex); // Assigned but not used + pageable.getPrintable(newIndex); // Copying here just in case the call is what is important. resize(); index = newIndex; } catch (IndexOutOfBoundsException ignored) { From 4f7670ab48783fee7c10ba605e0343f6cf460004 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 16:10:19 -0600 Subject: [PATCH 088/126] battleforce - BattleForce.java - Commented out variables not in use - Commented out private methods not in use. --- sswlib/src/main/java/battleforce/BattleForce.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sswlib/src/main/java/battleforce/BattleForce.java b/sswlib/src/main/java/battleforce/BattleForce.java index 913d51ac..69fd85f2 100644 --- a/sswlib/src/main/java/battleforce/BattleForce.java +++ b/sswlib/src/main/java/battleforce/BattleForce.java @@ -28,7 +28,6 @@ package battleforce; -import java.awt.Image; import java.util.Vector; public class BattleForce { @@ -36,13 +35,15 @@ public class BattleForce { public String ForceName = "", LogoPath = "", Type = InnerSphere; - private Image Logo = null; - private int PointValue = 0; + // private Image Logo = null; + // private int PointValue = 0; // Not used. public static final String InnerSphere = "Inner Sphere", Clan = "Clan", Comstar = "Comstar"; + /* + // Not used internally private void setInnerSphere() { Type = InnerSphere; } @@ -54,6 +55,7 @@ private void setClan() { private void setComstar() { Type = Comstar; } + */ public int PointValue() { int Total = 0; From 05995eebb293606a3eb977ec63db5beb25cec3ff Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 16:12:16 -0600 Subject: [PATCH 089/126] battleforce - BattleForceData.java - Commented variables not in use - VS Code Formatting --- .../java/battleforce/BattleForceData.java | 259 +++++++++--------- 1 file changed, 137 insertions(+), 122 deletions(-) diff --git a/sswlib/src/main/java/battleforce/BattleForceData.java b/sswlib/src/main/java/battleforce/BattleForceData.java index 476bad7e..6c47bd01 100644 --- a/sswlib/src/main/java/battleforce/BattleForceData.java +++ b/sswlib/src/main/java/battleforce/BattleForceData.java @@ -3,20 +3,20 @@ import java.util.ArrayList; /* - * This class is used to setup basic data for BattleForce calculations. Allows - * for weapon information to be added and will do the work of totalling up the + * This class is used to setup basic data for BattleForce calculations. Allows + * for weapon information to be added and will do the work of totalling up the * amounts and ammunition and determining the final value */ public class BattleForceData { - public DataSet Base = new DataSet(false); - public DataSet AdjBase = new DataSet(false); - public DataSet AC = new DataSet(true); - public DataSet LRM = new DataSet(true); - public DataSet SRM = new DataSet(true); - public DataSet TOR = new DataSet(true); - public DataSet TUR = new DataSet(true); - public DataSet IF = new DataSet(false); - public DataSet FLK = new DataSet(false); + public DataSet Base = new DataSet(false); + public DataSet AdjBase = new DataSet(false); + public DataSet AC = new DataSet(true); + public DataSet LRM = new DataSet(true); + public DataSet SRM = new DataSet(true); + public DataSet TOR = new DataSet(true); + public DataSet TUR = new DataSet(true); + public DataSet IF = new DataSet(false); + public DataSet FLK = new DataSet(false); private int TotalHeatGenerated = 0; private int TotalHeatDissipation = 0; private ArrayList Notes = new ArrayList(); @@ -28,10 +28,10 @@ public BattleForceData() { /** * Set the total heat dissipation for all special damage situations - * - * @param TotalDiss + * + * @param TotalDiss */ - public void SetHeat( int TotalDiss ) { + public void SetHeat(int TotalDiss) { this.TotalHeatDissipation = TotalDiss; Base.SetHeat(TotalHeatGenerated, TotalHeatDissipation); AC.SetHeat(TotalHeatGenerated, TotalHeatDissipation); @@ -43,41 +43,49 @@ public void SetHeat( int TotalDiss ) { FLK.SetHeat(TotalHeatGenerated, TotalHeatDissipation); AdjBase.SetHeat(TotalHeatGenerated, TotalHeatDissipation); - //System.out.println("Heat Set " + TotalHeatGenerated + " [" + TotalHeatDissipation + "]"); + // System.out.println("Heat Set " + TotalHeatGenerated + " [" + + // TotalHeatDissipation + "]"); } /** * Sets the heat levels for calculations - * - * @param TotalHeat Total heat generated when firing everything and moving as fast as possible - * @param TotalDiss Total heat that can be removed in a single turn + * + * @param TotalHeat Total heat generated when firing everything and moving as + * fast as possible + * @param TotalDiss Total heat that can be removed in a single turn */ - public void SetHeat( int TotalHeat, int TotalDiss ) { + public void SetHeat(int TotalHeat, int TotalDiss) { this.TotalHeatGenerated = TotalHeat; SetHeat(TotalDiss); } - + public int BaseMaxShort() { - return Base.BattleForceValue(Base.baseShort); //+ - //Base.BattleForceValue(AC.baseShort) + - //Base.BattleForceValue(SRM.baseShort) + - //Base.BattleForceValue(LRM.baseShort); + return Base.BattleForceValue(Base.baseShort); // + + // Base.BattleForceValue(AC.baseShort) + + // Base.BattleForceValue(SRM.baseShort) + + // Base.BattleForceValue(LRM.baseShort); } public int BaseMaxMedium() { - //System.out.println(AdjBase.BattleForceValue(AdjBase.baseMedium) + "/" + AC.BattleForceValue(AC.baseMedium) + "/" + SRM.BattleForceValue(SRM.baseMedium) + "/" + LRM.BattleForceValue(LRM.baseMedium)); - return Base.BattleForceValue(Base.baseMedium); //+ - //Base.BattleForceValue(AC.baseMedium) + - //Base.BattleForceValue(SRM.baseMedium) + - //Base.BattleForceValue(LRM.baseMedium); + // System.out.println(AdjBase.BattleForceValue(AdjBase.baseMedium) + "/" + + // AC.BattleForceValue(AC.baseMedium) + "/" + + // SRM.BattleForceValue(SRM.baseMedium) + "/" + + // LRM.BattleForceValue(LRM.baseMedium)); + return Base.BattleForceValue(Base.baseMedium); // + + // Base.BattleForceValue(AC.baseMedium) + + // Base.BattleForceValue(SRM.baseMedium) + + // Base.BattleForceValue(LRM.baseMedium); } public int BaseMaxLong() { - //System.out.println(AdjBase.BattleForceValue(AdjBase.baseMedium) + "/" + AC.BattleForceValue(AC.baseMedium) + "/" + SRM.BattleForceValue(SRM.baseMedium) + "/" + LRM.BattleForceValue(LRM.baseMedium)); - return Base.BattleForceValue(Base.baseLong); //+ - //Base.BattleForceValue(AC.baseMedium) + - //Base.BattleForceValue(SRM.baseMedium) + - //Base.BattleForceValue(LRM.baseMedium); + // System.out.println(AdjBase.BattleForceValue(AdjBase.baseMedium) + "/" + + // AC.BattleForceValue(AC.baseMedium) + "/" + + // SRM.BattleForceValue(SRM.baseMedium) + "/" + + // LRM.BattleForceValue(LRM.baseMedium)); + return Base.BattleForceValue(Base.baseLong); // + + // Base.BattleForceValue(AC.baseMedium) + + // Base.BattleForceValue(SRM.baseMedium) + + // Base.BattleForceValue(LRM.baseMedium); } public int AdjustedMaxMedium() { @@ -93,18 +101,18 @@ public void CheckSpecials() { AdjBase.baseLong = Base.baseLong; AdjBase.baseExtreme = Base.baseExtreme; -// Commented out 7/17/2013 because errata changes make it so that base damage -// does not get changed -// if ( AC.CheckSpecial() ) Adjust(AC); -// if ( SRM.CheckSpecial() ) Adjust(SRM); -// if ( LRM.CheckSpecial() ) Adjust(LRM); -// if ( TOR.CheckSpecial() ) Adjust(TOR); - + // Commented out 7/17/2013 because errata changes make it so that base damage + // does not get changed + // if ( AC.CheckSpecial() ) Adjust(AC); + // if ( SRM.CheckSpecial() ) Adjust(SRM); + // if ( LRM.CheckSpecial() ) Adjust(LRM); + // if ( TOR.CheckSpecial() ) Adjust(TOR); + AdjBase.SetHeat(TotalHeatGenerated, TotalHeatDissipation); AdjBase.BattleForceValues(); } - public void Adjust( DataSet special ) { + public void Adjust(DataSet special) { AdjBase.baseShort -= special.baseShort; AdjBase.baseMedium -= special.baseMedium; AdjBase.baseLong -= special.baseLong; @@ -113,36 +121,36 @@ public void Adjust( DataSet special ) { /** * Add weapon data to the base calculations - * + * * @param vals double[] with calculated values for each range */ - public void AddBase( double[] vals ) { + public void AddBase(double[] vals) { Base.AddBase(vals); - TotalHeatGenerated += (int)vals[BFConstants.BF_OV]; + TotalHeatGenerated += (int) vals[BFConstants.BF_OV]; } /** * Add special heat (like Stealth Armor) - * + * * @param Heat Amount of heat to add */ - public void AddHeat( int Heat ) { + public void AddHeat(int Heat) { this.TotalHeatGenerated += Heat; } /** * Collection of notes generated during the calculation process - * + * * @param note Note to add to the list */ - public void AddNote( String note ) { + public void AddNote(String note) { Notes.add(note); } @Override public String toString() { String data = ""; - for ( String note : Notes ) { + for (String note : Notes) { data += note + "\n"; } data += "\n"; @@ -172,7 +180,7 @@ public int getTotalHeatGenerated() { public int getTotalHeatDissipation() { return TotalHeatDissipation; } - + public class DataSet { private double baseShort = 0.0; private double baseMedium = 0.0; @@ -182,10 +190,10 @@ public class DataSet { private double heatMedium = 0.0; private double heatLong = 0.0; private double heatExtreme = 0.0; - private int BFBaseShort = 0; - private int BFBaseMedium = 0; - private int BFBaseLong = 0; - private int BFBaseExtreme = 0; + // private int BFBaseShort = 0; + // private int BFBaseMedium = 0; + // private int BFBaseLong = 0; + // private int BFBaseExtreme = 0; private int BFShort = 0; private int BFMedium = 0; private int BFLong = 0; @@ -194,34 +202,30 @@ public class DataSet { private int TotalHeatDissipation = 0; private int LauncherCount = 0; private int AmmoCount = 0; - private boolean hasOverheat = false, - isSpecial = false, - SpecialDamage = false, - useNormalRound = false, - NotEnoughAmmo = false; + private boolean hasOverheat = false, isSpecial = false, SpecialDamage = false, useNormalRound = false, + NotEnoughAmmo = false; public DataSet() { this(false); } /** - * DateSet holds all the information about the weapons for this specific - * item - * + * DateSet holds all the information about the weapons for this specific item + * * @param isSpecial Is this dataset used for a Special Ability */ - public DataSet( boolean isSpecial ) { + public DataSet(boolean isSpecial) { this.isSpecial = isSpecial; } /** * Determine if there is enough ammo for the launchers - * + * * @return True if enough, false if not. */ public boolean EnoughAmmo() { - if ( LauncherCount > 0 ) { - if ( AmmoCount - (LauncherCount * 10) < 0 ) { + if (LauncherCount > 0) { + if (AmmoCount - (LauncherCount * 10) < 0) { NotEnoughAmmo = true; return false; } @@ -229,22 +233,25 @@ public boolean EnoughAmmo() { NotEnoughAmmo = false; return true; } - + /** * Determines if the unit has special damage or not + * * @return True if using special damage */ public boolean CheckSpecial() { boolean retval = false; - if ( TotalHeatDissipation < TotalHeatGenerated ) { + if (TotalHeatDissipation < TotalHeatGenerated) { hasOverheat = true; - if ( heatMedium > 9.0 ) retval = true; + if (heatMedium > 9.0) + retval = true; } else { - if ( baseMedium > 9.0 ) retval = true; + if (baseMedium > 9.0) + retval = true; } - //if ( !EnoughAmmo() ) - // retval = false; - + // if ( !EnoughAmmo() ) + // retval = false; + SpecialDamage = retval; BattleForceValues(); return retval; @@ -261,64 +268,66 @@ public void Clear() { /** * Returns a / delimited string of values for the ranges - * + * * @return ie. 0/1/1 */ public String GetAbility() { - return BFShort + "/" + BFMedium + "/" + BFLong; //+ "/" + BFExtreme; + return BFShort + "/" + BFMedium + "/" + BFLong; // + "/" + BFExtreme; } - public void AddBase( double[] vals ) { + public void AddBase(double[] vals) { this.baseShort += vals[BFConstants.BF_SHORT]; this.baseMedium += vals[BFConstants.BF_MEDIUM]; this.baseLong += vals[BFConstants.BF_LONG]; this.baseExtreme += vals[BFConstants.BF_EXTREME]; - this.TotalHeatGenerated += (int)vals[BFConstants.BF_OV]; - } - -// /** -// * Add amount of ammo to this specific type -// * -// * @param lotsize Amount of ammo to add -// */ -// public void AddAmmo( int lotsize ) { -// this.AmmoCount += lotsize; -// } -// -// /* -// * Used to increase the count of launchers that need ammunition -// */ -// public void AddLauncher() { -// LauncherCount++; -// } - - public void SetHeat( int TotalHeatGenerated, int TotalHeatDissipation ) { + this.TotalHeatGenerated += (int) vals[BFConstants.BF_OV]; + } + + // /** + // * Add amount of ammo to this specific type + // * + // * @param lotsize Amount of ammo to add + // */ + // public void AddAmmo( int lotsize ) { + // this.AmmoCount += lotsize; + // } + // + // /* + // * Used to increase the count of launchers that need ammunition + // */ + // public void AddLauncher() { + // LauncherCount++; + // } + + public void SetHeat(int TotalHeatGenerated, int TotalHeatDissipation) { this.TotalHeatGenerated = TotalHeatGenerated; this.TotalHeatDissipation = TotalHeatDissipation; - if ( TotalHeatDissipation < TotalHeatGenerated ) hasOverheat = true; + if (TotalHeatDissipation < TotalHeatGenerated) + hasOverheat = true; HeatAdjustments(); BattleForceValues(); } - public double HeatAdjustment( double base ) { - //if (!EnoughAmmo()) { base *= .75; } - if ( TotalHeatGenerated > 0 && TotalHeatDissipation > 0 && base > 0 ) { + public double HeatAdjustment(double base) { + // if (!EnoughAmmo()) { base *= .75; } + if (TotalHeatGenerated > 0 && TotalHeatDissipation > 0 && base > 0) { return Math.ceil((base * TotalHeatDissipation) / TotalHeatGenerated); } return 0.0; } private void HeatAdjustments() { - this.heatShort = HeatAdjustment( baseShort ); - this.heatMedium = HeatAdjustment( baseMedium ); - this.heatLong = HeatAdjustment( baseLong ); - this.heatExtreme = HeatAdjustment( baseExtreme ); + this.heatShort = HeatAdjustment(baseShort); + this.heatMedium = HeatAdjustment(baseMedium); + this.heatLong = HeatAdjustment(baseLong); + this.heatExtreme = HeatAdjustment(baseExtreme); } - public int BattleForceValue( double base ) { - //if (!EnoughAmmo()) { base *= .75; } This is being done in the per weapon damage check - if ( base > 9.0 || SpecialDamage || !isSpecial ) - if ( isSpecial || useNormalRound) + public int BattleForceValue(double base) { + // if (!EnoughAmmo()) { base *= .75; } This is being done in the per weapon + // damage check + if (base > 9.0 || SpecialDamage || !isSpecial) + if (isSpecial || useNormalRound) return (int) Math.round(base / 10); else return (int) Math.ceil(base / 10); @@ -326,27 +335,33 @@ public int BattleForceValue( double base ) { } private void BattleForceValues() { - if ( hasOverheat ) { - this.BFShort = BattleForceValue( heatShort ); - this.BFMedium = BattleForceValue( heatMedium ); - this.BFLong = BattleForceValue( heatLong ); - this.BFExtreme = BattleForceValue( heatExtreme ); + if (hasOverheat) { + this.BFShort = BattleForceValue(heatShort); + this.BFMedium = BattleForceValue(heatMedium); + this.BFLong = BattleForceValue(heatLong); + this.BFExtreme = BattleForceValue(heatExtreme); } else { - this.BFShort = BattleForceValue( baseShort ); - this.BFMedium = BattleForceValue( baseMedium ); - this.BFLong = BattleForceValue( baseLong ); - this.BFExtreme = BattleForceValue( baseExtreme ); + this.BFShort = BattleForceValue(baseShort); + this.BFMedium = BattleForceValue(baseMedium); + this.BFLong = BattleForceValue(baseLong); + this.BFExtreme = BattleForceValue(baseExtreme); } } @Override public String toString() { String data = ""; - data += " Base: " + String.format( "%1$,.2f", baseShort ) + "/" + String.format( "%1$,.2f", baseMedium ) + "/" + String.format( "%1$,.2f", baseLong ) + "/" + String.format( "%1$,.2f", baseExtreme ) + "\n"; - if ( hasOverheat) data += " Heat: " + String.format( "%1$,.2f", heatShort ) + "/" + String.format( "%1$,.2f", heatMedium ) + "/" + String.format( "%1$,.2f", heatLong ) + "/" + String.format( "%1$,.2f", heatExtreme ) + "\n"; + data += " Base: " + String.format("%1$,.2f", baseShort) + "/" + String.format("%1$,.2f", baseMedium) + "/" + + String.format("%1$,.2f", baseLong) + "/" + String.format("%1$,.2f", baseExtreme) + "\n"; + if (hasOverheat) + data += " Heat: " + String.format("%1$,.2f", heatShort) + "/" + String.format("%1$,.2f", heatMedium) + + "/" + String.format("%1$,.2f", heatLong) + "/" + String.format("%1$,.2f", heatExtreme) + "\n"; data += " BF: " + BFShort + "/" + BFMedium + "/" + BFLong + "/" + BFExtreme + "\n"; data += " Separate Damage: " + SpecialDamage + "\n"; - if ( NotEnoughAmmo ) { data += "Not enough ammo for all of the launchers (" + LauncherCount + " launchers with " + AmmoCount + " total ammo; needs " + (LauncherCount * 10) + ")\n"; } + if (NotEnoughAmmo) { + data += "Not enough ammo for all of the launchers (" + LauncherCount + " launchers with " + AmmoCount + + " total ammo; needs " + (LauncherCount * 10) + ")\n"; + } return data; } @@ -492,7 +507,7 @@ public void setTotalHeatDissipation(int TotalHeatDissipation) { HeatAdjustments(); } - public void setNormalRound( boolean useNormal ) { + public void setNormalRound(boolean useNormal) { this.useNormalRound = useNormal; } } From b19ad3340d9e8ab05f6886c29c408725b02169cf Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 16:19:54 -0600 Subject: [PATCH 090/126] components - CVAmmunitionHandler - Removed unchecked Conversion warning --- .../java/components/CVAmmunitionHandler.java | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/sswlib/src/main/java/components/CVAmmunitionHandler.java b/sswlib/src/main/java/components/CVAmmunitionHandler.java index 8083ab44..3fb608d6 100644 --- a/sswlib/src/main/java/components/CVAmmunitionHandler.java +++ b/sswlib/src/main/java/components/CVAmmunitionHandler.java @@ -34,16 +34,16 @@ public class CVAmmunitionHandler { private Vector Ammo = new Vector(); // private CVLoadout Owner; // Not Used - public CVAmmunitionHandler( CVLoadout c ) { - // Owner = c; + public CVAmmunitionHandler(CVLoadout c) { + // Owner = c; } - public void AddAmmo( Ammunition a ) { - Ammo.add( a ); + public void AddAmmo(Ammunition a) { + Ammo.add(a); } - public void RemoveAmmo( Ammunition a ) { - Ammo.remove( a ); + public void RemoveAmmo(Ammunition a) { + Ammo.remove(a); } public Vector GetAmmo() { @@ -52,22 +52,26 @@ public Vector GetAmmo() { public double GetTonnage() { double retval = 0.0; - for( int i = 0; i < Ammo.size(); i++ ) { - retval += Ammo.get( i ).GetTonnage(); + for (int i = 0; i < Ammo.size(); i++) { + retval += Ammo.get(i).GetTonnage(); } return retval; } + // Original was Vector + // Was changed to Vector To remove unchecked warning then apply checking at + // access time public int AmmoSpace() { - Vector check = (Vector) Ammo.clone(); + Vector check = (Vector) Ammo.clone(); int curIDX = 0, retval = 0; - while( check.size() > 0 ) { - curIDX = check.lastElement().GetAmmoIndex(); - check.remove( check.lastElement() ); + while (check.size() > 0) { + curIDX = ((Ammunition) check.lastElement()).GetAmmoIndex(); + check.remove(check.lastElement()); retval++; - for( int i = check.size() - 1; i > -1; i-- ) { - if( check.get( i ).GetAmmoIndex() == curIDX ) { - check.removeElementAt( i ); + + for (int i = check.size() - 1; i > -1; i--) { + if (((Ammunition) check.get(i)).GetAmmoIndex() == curIDX) { + check.removeElementAt(i); } } } @@ -76,6 +80,6 @@ public int AmmoSpace() { @Override public String toString() { - return "Total Ammo (" + String.format( "%1$3.1f", GetTonnage() ) + " tons, " + AmmoSpace() + " spaces)"; + return "Total Ammo (" + String.format("%1$3.1f", GetTonnage()) + " tons, " + AmmoSpace() + " spaces)"; } } From b09a7efd01e4e153c11e23b72a0a433a57cdb58a Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 16:24:52 -0600 Subject: [PATCH 091/126] components - CVHeatSinkFactory - Type enforcement - Removed unused variables - VS Code Formatting --- .../java/components/CVHeatSinkFactory.java | 130 +++++++++--------- 1 file changed, 67 insertions(+), 63 deletions(-) diff --git a/sswlib/src/main/java/components/CVHeatSinkFactory.java b/sswlib/src/main/java/components/CVHeatSinkFactory.java index d61084d4..6098f52b 100644 --- a/sswlib/src/main/java/components/CVHeatSinkFactory.java +++ b/sswlib/src/main/java/components/CVHeatSinkFactory.java @@ -33,14 +33,13 @@ public class CVHeatSinkFactory { // provides a means of getting heatsinks into the loadout easily. - private int NumHS, - BaseLoadoutNumHS = 0; + private int NumHS, BaseLoadoutNumHS = 0; private ifCVLoadout Owner; - private LinkedList CurrentSinks = new LinkedList(); + private LinkedList CurrentSinks = new LinkedList(); private static ifHeatSinkFactory SHS = new stHeatSinkSingle(); private ifHeatSinkFactory CurConfig = SHS; - public CVHeatSinkFactory( ifCVLoadout l ) { + public CVHeatSinkFactory(ifCVLoadout l) { // the basic constructor Owner = l; NumHS = Owner.GetOwner().GetEngine().FreeHeatSinks(); @@ -48,29 +47,29 @@ public CVHeatSinkFactory( ifCVLoadout l ) { // now we have to add heat sinks to the currentsinks if they can't all // fit internal to the engine. int i = NumHS - InternalHeatSinks(); - if( i > 0 ) { - for( ; i > 0; i-- ) { + if (i > 0) { + for (; i > 0; i--) { HeatSink h = (HeatSink) GetHeatSink(); - h.Place( l ); + h.Place(l); } } } - public CVHeatSinkFactory( ifCVLoadout l, int BaseNumHS, ifHeatSinkFactory type, HeatSink[] PlacedHeatSinks ) { - // this constructor is usedzfor cloning purposes. since we should only + public CVHeatSinkFactory(ifCVLoadout l, int BaseNumHS, ifHeatSinkFactory type, HeatSink[] PlacedHeatSinks) { + // this constructor is used for cloning purposes. since we should only // be doing this when we have an omnimech, recalculation is not needed Owner = l; NumHS = BaseNumHS; CurConfig = type; BaseLoadoutNumHS = NumHS; - for( int i = 0; i < PlacedHeatSinks.length; i++ ) { - CurrentSinks.add( PlacedHeatSinks[i] ); + for (int i = 0; i < PlacedHeatSinks.length; i++) { + CurrentSinks.add(PlacedHeatSinks[i]); } } public void SetSingle() { CurConfig = SHS; - Owner.GetOwner().SetChanged( true ); + Owner.GetOwner().SetChanged(true); } public boolean IsDouble() { @@ -101,7 +100,7 @@ public int GetBaseLoadoutNumHS() { return BaseLoadoutNumHS; } - public void SetBaseLoadoutNumHS( int h ) { + public void SetBaseLoadoutNumHS(int h) { BaseLoadoutNumHS = h; } @@ -125,33 +124,35 @@ public ifState[] GetStates() { public void IncrementNumHS() { // do we need a new heat sink? NumHS++; - Owner.GetOwner().SetChanged( true ); + Owner.GetOwner().SetChanged(true); } public boolean DecrementNumHS() { - HeatSink h; + // HeatSink h; // Not Used // Can we actually remove heatsinks? - if( NumHS <= Owner.GetOwner().GetEngine().FreeHeatSinks() ) { + if (NumHS <= Owner.GetOwner().GetEngine().FreeHeatSinks()) { return false; } NumHS--; - Owner.GetOwner().SetChanged( true ); + Owner.GetOwner().SetChanged(true); return true; } - public void SetNumHS( int hs ) { - // sets the number of heat sinks to the specified number. Only really - // used when loading a mech. First, blow out all the sinks. + public void SetNumHS(int hs) { + // sets the number of heat sinks to the specified number. Only really + // used when loading a mech. First, blow out all the sinks. NumHS = 0; // get some required information int BaseHS = Owner.GetOwner().GetEngine().FreeHeatSinks(); - if( BaseHS > hs ) { hs = BaseHS; } + if (BaseHS > hs) { + hs = BaseHS; + } // now get all the heat sinks we need - for( int i = 0; i < hs; i++ ) { + for (int i = 0; i < hs; i++) { IncrementNumHS(); } } @@ -162,53 +163,53 @@ public int TotalDissipation() { public double GetTonnage() { // returns the total tonnage of heat sinks we have. - double tons = ( NumHS - Owner.GetOwner().GetEngine().FreeHeatSinks() ) * CurConfig.GetTonnage(); - if( tons <= 0.0 ) { - // we're still initializing or even. return a 0 answer. - tons = 0.0; + double tons = (NumHS - Owner.GetOwner().GetEngine().FreeHeatSinks()) * CurConfig.GetTonnage(); + if (tons <= 0.0) { + // we're still initializing or even. return a 0 answer. + tons = 0.0; } // now check for armored sinks and add that to the result - for( int i = 0; i < CurrentSinks.size(); i++ ) { - tons += ((HeatSink) CurrentSinks.get( i )).GetTonnage(); + for (int i = 0; i < CurrentSinks.size(); i++) { + tons += ((HeatSink) CurrentSinks.get(i)).GetTonnage(); } return tons; } public double GetLoadoutTonnage() { // returns the tonnage of heatsinks over the base loadout. - double tons = ( NumHS - BaseLoadoutNumHS ) * CurConfig.GetTonnage(); - if( tons <= 0.0 ) { - // we're still initializing or even. return a 0 answer. - tons = 0.0; + double tons = (NumHS - BaseLoadoutNumHS) * CurConfig.GetTonnage(); + if (tons <= 0.0) { + // we're still initializing or even. return a 0 answer. + tons = 0.0; } // now check for armored sinks and add that to the result - for( int i = 0; i < CurrentSinks.size(); i++ ) { - tons += ((HeatSink) CurrentSinks.get( i )).GetTonnage(); + for (int i = 0; i < CurrentSinks.size(); i++) { + tons += ((HeatSink) CurrentSinks.get(i)).GetTonnage(); } return tons; } public double GetOmniTonnage() { // returns the tonnage used by the particular omni loadout - return ( NumHS - BaseLoadoutNumHS ) * CurConfig.GetTonnage(); + return (NumHS - BaseLoadoutNumHS) * CurConfig.GetTonnage(); } public double GetCost() { // returns the cost of these heat sinks double CostHS; - if( CurConfig.IsDouble() || CurConfig.IsLaser() || CurConfig.IsCompact() ) { + if (CurConfig.IsDouble() || CurConfig.IsLaser() || CurConfig.IsCompact()) { CostHS = NumHS * CurConfig.GetCost(); } else { - if( Owner.GetOwner().GetEngine().IsFusion() ) { + if (Owner.GetOwner().GetEngine().IsFusion()) { // free single fusion sinks cost nothing - CostHS = ( NumHS - Owner.GetOwner().GetEngine().FreeHeatSinks() ) * CurConfig.GetCost(); + CostHS = (NumHS - Owner.GetOwner().GetEngine().FreeHeatSinks()) * CurConfig.GetCost(); } else { CostHS = NumHS * CurConfig.GetCost(); } } // now check for armored sinks and add that to the result - for( int i = 0; i < CurrentSinks.size(); i++ ) { - CostHS += ((HeatSink) CurrentSinks.get( i )).GetCost(); + for (int i = 0; i < CurrentSinks.size(); i++) { + CostHS += ((HeatSink) CurrentSinks.get(i)).GetCost(); } return CostHS; } @@ -221,19 +222,21 @@ public abPlaceable GetHeatSink() { public int NumCrits() { int result = CurrentSinks.size() * CurConfig.GetNumCrits(); - if( result < 0 ) { + if (result < 0) { return 0; } else { return result; } } + /* + // Method not used internally private boolean NeedNewHS() { // this returns whether or not we need to get a new heat sink or whether // we can simply increment the number of heatsinks. - if( Owner.GetOwner().IsOmni() ) { - if( IsCompact() ) { - if( FindOpenCompact() == null ) { + if (Owner.GetOwner().IsOmni()) { + if (IsCompact()) { + if (FindOpenCompact() == null) { return true; } else { return false; @@ -241,10 +244,10 @@ private boolean NeedNewHS() { } return true; } else { - if( NumHS >= InternalHeatSinks() ) { + if (NumHS >= InternalHeatSinks()) { // need to get a new sink - if( IsCompact() ) { - if( FindOpenCompact() != null ) { + if (IsCompact()) { + if (FindOpenCompact() != null) { return false; } } @@ -254,21 +257,22 @@ private boolean NeedNewHS() { } } } + */ public HeatSink FindOpenCompact() { // this routine finds the next available single Compact Heat Sink // if it cannot find a single compact, it returns null - for( int i = 0; i < CurrentSinks.size(); i++ ) { - if( ((HeatSink) CurrentSinks.get( i )).NumHeatSinks() == 1 ) { - return (HeatSink) CurrentSinks.get( i ); + for (int i = 0; i < CurrentSinks.size(); i++) { + if (((HeatSink) CurrentSinks.get(i)).NumHeatSinks() == 1) { + return (HeatSink) CurrentSinks.get(i); } } return null; } public int InternalHeatSinks() { - // returns the number of internal heat sinks. needed because of compacts - if( IsCompact() ) { + // returns the number of internal heat sinks. needed because of compacts + if (IsCompact()) { return Owner.GetOwner().GetEngine().InternalHeatSinks() * 2; } else { return Owner.GetOwner().GetEngine().InternalHeatSinks(); @@ -283,21 +287,21 @@ public void ReCalculate() { int temp = NumHS; NumHS = 0; - if( temp < Owner.GetOwner().GetEngine().FreeHeatSinks() ) { + if (temp < Owner.GetOwner().GetEngine().FreeHeatSinks()) { temp = Owner.GetOwner().GetEngine().FreeHeatSinks(); } // blow out all the sinks abPlaceable h; - for( int i = CurrentSinks.size(); i > 0; i-- ) { + for (int i = CurrentSinks.size(); i > 0; i--) { h = (abPlaceable) CurrentSinks.getLast(); - h.Remove( Owner ); + h.Remove(Owner); CurrentSinks.remove(h); } // rebuild the heat sinks - for( ; temp > 0; temp-- ) { - // temp -= NumHS + for (; temp > 0; temp--) { + // temp -= NumHS IncrementNumHS(); } } @@ -305,8 +309,8 @@ public void ReCalculate() { public HeatSink[] GetPlacedHeatSinks() { // returns the currently placed heat sinks in array form HeatSink[] retval = new HeatSink[CurrentSinks.size()]; - for( int i = 0; i < CurrentSinks.size(); i++ ) { - retval[i] = (HeatSink) CurrentSinks.get( i ); + for (int i = 0; i < CurrentSinks.size(); i++) { + retval[i] = (HeatSink) CurrentSinks.get(i); } return retval; } @@ -319,8 +323,8 @@ public AvailableCode GetAvailability() { public double GetOffensiveBV() { // convenience method double result = 0.0; - for( int i = 0; i < CurrentSinks.size(); i++ ) { - result += ((HeatSink) CurrentSinks.get( i )).GetOffensiveBV(); + for (int i = 0; i < CurrentSinks.size(); i++) { + result += ((HeatSink) CurrentSinks.get(i)).GetOffensiveBV(); } return result; } @@ -328,8 +332,8 @@ public double GetOffensiveBV() { public double GetDefensiveBV() { // convenience method double result = 0.0; - for( int i = 0; i < CurrentSinks.size(); i++ ) { - result += ((HeatSink) CurrentSinks.get( i )).GetDefensiveBV(); + for (int i = 0; i < CurrentSinks.size(); i++) { + result += ((HeatSink) CurrentSinks.get(i)).GetDefensiveBV(); } return result; } From 522da8081318a220f3dd8825ab0e13fd1807f9ef Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 16:27:41 -0600 Subject: [PATCH 092/126] components - CVJumpJetFactory.java - Forced Type Linking - VS Code Formatting. --- .../java/components/CVJumpJetFactory.java | 111 +++++++++--------- 1 file changed, 56 insertions(+), 55 deletions(-) diff --git a/sswlib/src/main/java/components/CVJumpJetFactory.java b/sswlib/src/main/java/components/CVJumpJetFactory.java index c7eb5d7a..8de2f683 100644 --- a/sswlib/src/main/java/components/CVJumpJetFactory.java +++ b/sswlib/src/main/java/components/CVJumpJetFactory.java @@ -33,57 +33,56 @@ public class CVJumpJetFactory { // provides a means of getting jump jets into the loadout easily. - private int NumJJ = 0, - BaseLoadoutNumJJ = 0; + private int NumJJ = 0, BaseLoadoutNumJJ = 0; private ifCVLoadout Owner; - private LinkedList CurrentJumps = new LinkedList(); - private static ifJumpJetFactory NJJ = new stJumpJetStandard(), - IJJ = new stJumpJetImproved(), - UMU = new stJumpJetUMU(); + private LinkedList CurrentJumps = new LinkedList(); + private static ifJumpJetFactory NJJ = new stJumpJetStandard(); + private static ifJumpJetFactory IJJ = new stJumpJetImproved(); + private static ifJumpJetFactory UMU = new stJumpJetUMU(); private ifJumpJetFactory CurConfig = NJJ; - public CVJumpJetFactory( ifCVLoadout l ) { + public CVJumpJetFactory(ifCVLoadout l) { // the basic constructor Owner = l; ReCalculate(); } - public CVJumpJetFactory( ifCVLoadout l, CVJumpJetFactory PlacedJumps ) { - // this constructor is used for cloning purposes. since we're only + public CVJumpJetFactory(ifCVLoadout l, CVJumpJetFactory PlacedJumps) { + // this constructor is used for cloning purposes. since we're only // going to do this with Omnimechs, there is no need to recalculate. Owner = l; BaseLoadoutNumJJ = PlacedJumps.NumJJ; NumJJ = BaseLoadoutNumJJ; - if( PlacedJumps.IsImproved() ) { + if (PlacedJumps.IsImproved()) { SetImproved(); - } else if( PlacedJumps.IsUMU() ) { + } else if (PlacedJumps.IsUMU()) { SetUMU(); } else { SetNormal(); } - if( BaseLoadoutNumJJ > 0 ) { + if (BaseLoadoutNumJJ > 0) { JumpJet[] j = PlacedJumps.GetPlacedJumps(); - for( int i = 0; i < j.length; i++ ) { - CurrentJumps.add( j[i] ); + for (int i = 0; i < j.length; i++) { + CurrentJumps.add(j[i]); } } } public void SetNormal() { CurConfig = NJJ; - Owner.GetOwner().SetChanged( true ); + Owner.GetOwner().SetChanged(true); } public void SetImproved() { CurConfig = IJJ; - Owner.GetOwner().SetChanged( true ); + Owner.GetOwner().SetChanged(true); } public void SetUMU() { CurConfig = UMU; - Owner.GetOwner().SetChanged( true ); + Owner.GetOwner().SetChanged(true); } public boolean IsImproved() { @@ -102,7 +101,7 @@ public int GetBaseLoadoutNumJJ() { return BaseLoadoutNumJJ; } - public void SetBaseLoadoutNumJJ( int j ) { + public void SetBaseLoadoutNumJJ(int j) { BaseLoadoutNumJJ = j; } @@ -120,40 +119,42 @@ public String ChatName() { public void IncrementNumJJ() { // can we add a new jump jet? - if( CanAddJJ() ) { + if (CanAddJJ()) { JumpJet j = (JumpJet) GetJumpJet(); - j.Place( Owner ); + j.Place(Owner); NumJJ++; } - Owner.GetOwner().SetChanged( true ); + Owner.GetOwner().SetChanged(true); } public boolean DecrementNumJJ() { JumpJet j = (JumpJet) CurrentJumps.getLast(); - Owner.GetOwner().SetChanged( true ); - return RemoveJJ( j ); + Owner.GetOwner().SetChanged(true); + return RemoveJJ(j); } public double GetTonnage() { // returns the total tonnage of jump jets we have installed - double result = ( NumJJ * Owner.GetOwner().GetJJMult() * CurConfig.GetTonnage() ); - for( int i = 0; i < CurrentJumps.size(); i++ ) { - result += ((JumpJet) CurrentJumps.get( i )).GetTonnage(); + double result = (NumJJ * Owner.GetOwner().GetJJMult() * CurConfig.GetTonnage()); + for (int i = 0; i < CurrentJumps.size(); i++) { + result += ((JumpJet) CurrentJumps.get(i)).GetTonnage(); } return result; } public double GetOmniTonnage() { // returns the total tonnage of jump jets we have installed - return ( ( NumJJ - BaseLoadoutNumJJ ) * Owner.GetOwner().GetJJMult() * CurConfig.GetTonnage() ); + return ((NumJJ - BaseLoadoutNumJJ) * Owner.GetOwner().GetJJMult() * CurConfig.GetTonnage()); } public double GetCost() { // returns the cost of these jump jets - if( NumJJ <= 0 ) { return 0.0; } - double result = ( CurConfig.GetCost() * ( NumJJ * NumJJ ) * Owner.GetOwner().GetTonnage() ); - for( int i = 0; i < CurrentJumps.size(); i++ ) { - result += ((JumpJet) CurrentJumps.get( i )).GetCost(); + if (NumJJ <= 0) { + return 0.0; + } + double result = (CurConfig.GetCost() * (NumJJ * NumJJ) * Owner.GetOwner().GetTonnage()); + for (int i = 0; i < CurrentJumps.size(); i++) { + result += ((JumpJet) CurrentJumps.get(i)).GetCost(); } return result; } @@ -165,18 +166,18 @@ public abPlaceable GetJumpJet() { } public String ReportCrits() { - return ( NumJJ * CurConfig.GetNumCrits() ) + ""; + return (NumJJ * CurConfig.GetNumCrits()) + ""; } private boolean CanAddJJ() { - if( CurConfig.IsImproved() ) { - if( NumJJ < Owner.GetOwner().getFlankMP() ) { + if (CurConfig.IsImproved()) { + if (NumJJ < Owner.GetOwner().getFlankMP()) { return true; } else { return false; } } else { - if( NumJJ < Owner.GetOwner().getCruiseMP() ) { + if (NumJJ < Owner.GetOwner().getCruiseMP()) { return true; } else { return false; @@ -184,57 +185,57 @@ private boolean CanAddJJ() { } } - private boolean RemoveJJ( JumpJet j ) { + private boolean RemoveJJ(JumpJet j) { // can we actually remove Jump Jets? - if( NumJJ <= 0 ) { + if (NumJJ <= 0) { return false; } // remove the Jump Jet - j.Remove( Owner ); - CurrentJumps.remove( j ); + j.Remove(Owner); + CurrentJumps.remove(j); NumJJ--; - Owner.GetOwner().SetChanged( true ); + Owner.GetOwner().SetChanged(true); return true; } public void ClearJumpJets() { // this routine removes all jump jets and sets the number to 0. JumpJet j; - for( int i = CurrentJumps.size() - 1; i >= 0; i-- ) { + for (int i = CurrentJumps.size() - 1; i >= 0; i--) { j = (JumpJet) CurrentJumps.get(i); CurrentJumps.remove(j); - j.Remove( Owner ); + j.Remove(Owner); } NumJJ = 0; - Owner.GetOwner().SetChanged( true ); + Owner.GetOwner().SetChanged(true); } public void ReCalculate() { // clear the loadout of JumpJets JumpJet j; - for( int i = CurrentJumps.size() - 1; i >= 0; i-- ) { + for (int i = CurrentJumps.size() - 1; i >= 0; i--) { j = (JumpJet) CurrentJumps.get(i); CurrentJumps.remove(j); - j.Remove( Owner ); + j.Remove(Owner); } // see if we can still support the number of jumps we had. - if( NumJJ > MaxJumps() ) { + if (NumJJ > MaxJumps()) { // we can't. NumJJ = MaxJumps(); } // Now add the jump jets we need back into the loadout - for( int i = 0; i < NumJJ; i++ ) { + for (int i = 0; i < NumJJ; i++) { j = (JumpJet) GetJumpJet(); - j.Place( Owner ); + j.Place(Owner); } } public int MaxJumps() { // calculates the maximum number of jumps we can have on this mech - if( CurConfig.IsImproved() ) { + if (CurConfig.IsImproved()) { return Owner.GetOwner().getCruiseMP(); } else { return Owner.GetOwner().getFlankMP(); @@ -249,24 +250,24 @@ public ifState[] GetStates() { public JumpJet[] GetPlacedJumps() { // returns the currently placed jumpjets in array form JumpJet[] retval = new JumpJet[CurrentJumps.size()]; - for( int i = CurrentJumps.size() - 1; i >= 0; i-- ) { - retval[i] = (JumpJet) CurrentJumps.get( i ); + for (int i = CurrentJumps.size() - 1; i >= 0; i--) { + retval[i] = (JumpJet) CurrentJumps.get(i); } return retval; } public double GetOffensiveBV() { double result = 0.0; - for( int i = 0; i < CurrentJumps.size(); i++ ) { - result += ((JumpJet) CurrentJumps.get( i )).GetOffensiveBV(); + for (int i = 0; i < CurrentJumps.size(); i++) { + result += ((JumpJet) CurrentJumps.get(i)).GetOffensiveBV(); } return result; } public double GetDefensiveBV() { double result = 0.0; - for( int i = 0; i < CurrentJumps.size(); i++ ) { - result += ((JumpJet) CurrentJumps.get( i )).GetDefensiveBV(); + for (int i = 0; i < CurrentJumps.size(); i++) { + result += ((JumpJet) CurrentJumps.get(i)).GetDefensiveBV(); } return result; } From 7dabe95dfbbfe05e934e5c669966c88fc60538ba Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 16:30:26 -0600 Subject: [PATCH 093/126] components - EquipmentCollection - Type enforcement - Removed unneeded type conversion - VS Code Styling --- .../java/components/EquipmentCollection.java | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/sswlib/src/main/java/components/EquipmentCollection.java b/sswlib/src/main/java/components/EquipmentCollection.java index 6d55ecec..356bd633 100644 --- a/sswlib/src/main/java/components/EquipmentCollection.java +++ b/sswlib/src/main/java/components/EquipmentCollection.java @@ -33,34 +33,34 @@ public class EquipmentCollection { // provides a class for consolidating multiple pieces of equipment in a JList - private Vector equips = new Vector( 10, 5 ); + private Vector equips = new Vector(10, 5); private ifMechLoadout Owner; - public EquipmentCollection( ifMechLoadout l ) { + public EquipmentCollection(ifMechLoadout l) { Owner = l; } public abPlaceable GetType() { - return (abPlaceable) equips.get( 0 ); + return equips.get(0); } - public boolean SameType( abPlaceable p ) { - if( ((abPlaceable) equips.get( 0 )).LookupName().equals( p.LookupName() ) ) { + public boolean SameType(abPlaceable p) { + if (equips.get(0).LookupName().equals(p.LookupName())) { return true; } else { return false; } } - public boolean Add( abPlaceable p ) { + public boolean Add(abPlaceable p) { // ensure that the lookupnames match. - if( equips.size() < 1 ) { - equips.add( p ); + if (equips.size() < 1) { + equips.add(p); return true; } else { - if( SameType( p ) ) { - if( ! equips.contains( p ) ) { - equips.add( p ); + if (SameType(p)) { + if (!equips.contains(p)) { + equips.add(p); } return true; } else { @@ -69,12 +69,12 @@ public boolean Add( abPlaceable p ) { } } - public void Remove( abPlaceable p ) { - equips.remove( p ); + public void Remove(abPlaceable p) { + equips.remove(p); } - public boolean Contains( abPlaceable p ) { - return equips.contains( p ); + public boolean Contains(abPlaceable p) { + return equips.contains(p); } public int GetSize() { @@ -82,7 +82,7 @@ public int GetSize() { } public boolean IsEmpty() { - if( equips.size() < 1 ) { + if (equips.size() < 1) { return true; } else { return false; @@ -91,21 +91,21 @@ public boolean IsEmpty() { @Override public String toString() { - if( equips.size() < 1 ) { + if (equips.size() < 1) { return "EquipmentCollection - 0 elements"; } else { - if( Owner.GetTechBase() == AvailableCode.TECH_BOTH ) { - if( equips.get( 0 ) instanceof Equipment ) { - if( ((Equipment) equips.get( 0 )).IsVariableSize() ) { - return "(" + equips.size() + ") " + ((abPlaceable) equips.get( 0 )).CritName(); + if (Owner.GetTechBase() == AvailableCode.TECH_BOTH) { + if (equips.get(0) instanceof Equipment) { + if (((Equipment) equips.get(0)).IsVariableSize()) { + return "(" + equips.size() + ") " + equips.get(0).CritName(); } else { - return "(" + equips.size() + ") " + ((abPlaceable) equips.get( 0 )).LookupName(); + return "(" + equips.size() + ") " + equips.get(0).LookupName(); } } else { - return "(" + equips.size() + ") " + ((abPlaceable) equips.get( 0 )).LookupName(); + return "(" + equips.size() + ") " + equips.get(0).LookupName(); } } else { - return "(" + equips.size() + ") " + ((abPlaceable) equips.get( 0 )).CritName(); + return "(" + equips.size() + ") " + equips.get(0).CritName(); } } } From c47db3e1f9d88be8a3b377eb9f1b84188d11691f Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 16:40:25 -0600 Subject: [PATCH 094/126] components - HeatSinkFactory - Enforced Tempalte Types - Removed unneeded type conversions - VS Code Formatting --- .../main/java/components/HeatSinkFactory.java | 230 +++++++++--------- 1 file changed, 112 insertions(+), 118 deletions(-) diff --git a/sswlib/src/main/java/components/HeatSinkFactory.java b/sswlib/src/main/java/components/HeatSinkFactory.java index dc0e62c1..1d29febf 100644 --- a/sswlib/src/main/java/components/HeatSinkFactory.java +++ b/sswlib/src/main/java/components/HeatSinkFactory.java @@ -34,20 +34,19 @@ public class HeatSinkFactory { // provides a means of getting heatsinks into the loadout easily. - private int NumHS, - BaseLoadoutNumHS = 0; + private int NumHS, BaseLoadoutNumHS = 0; private ifMechLoadout Owner; - private LinkedList CurrentSinks = new LinkedList(); - private static ifHeatSinkFactory SHS = new stHeatSinkSingle(), - ISDHS = new stHeatSinkISDHS(), - CLDHS = new stHeatSinkCLDHS(), - ISCOM = new stHeatSinkISCompact(), - CLLAS = new stHeatSinkCLLaser(), - StarLeagueProtoDHS = new stHeatSinkStarLeagueProtoDHS(), - SuccWarsProtoDHS = new stHeatSinkSuccWarProtoDHS(); + private LinkedList CurrentSinks = new LinkedList(); + private static ifHeatSinkFactory SHS = new stHeatSinkSingle(); + private static ifHeatSinkFactory ISDHS = new stHeatSinkISDHS(); + private static ifHeatSinkFactory CLDHS = new stHeatSinkCLDHS(); + private static ifHeatSinkFactory ISCOM = new stHeatSinkISCompact(); + private static ifHeatSinkFactory CLLAS = new stHeatSinkCLLaser(); + private static ifHeatSinkFactory StarLeagueProtoDHS = new stHeatSinkStarLeagueProtoDHS(); + private static ifHeatSinkFactory SuccWarsProtoDHS = new stHeatSinkSuccWarProtoDHS(); private ifHeatSinkFactory CurConfig = SHS; - public HeatSinkFactory( ifMechLoadout l ) { + public HeatSinkFactory(ifMechLoadout l) { // the basic constructor Owner = l; NumHS = Owner.GetMech().GetEngine().FreeHeatSinks(); @@ -55,61 +54,61 @@ public HeatSinkFactory( ifMechLoadout l ) { // now we have to add heat sinks to the currentsinks if they can't all // fit internal to the engine. int i = NumHS - InternalHeatSinks(); - if( i > 0 ) { - for( ; i > 0; i-- ) { + if (i > 0) { + for (; i > 0; i--) { HeatSink h = (HeatSink) GetHeatSink(); - h.Place( l ); + h.Place(l); } } } - public HeatSinkFactory( ifMechLoadout l, int BaseNumHS, ifHeatSinkFactory type, HeatSink[] PlacedHeatSinks ) { - // this constructor is used for cloning purposes. since we should only + public HeatSinkFactory(ifMechLoadout l, int BaseNumHS, ifHeatSinkFactory type, HeatSink[] PlacedHeatSinks) { + // this constructor is used for cloning purposes. since we should only // be doing this when we have an omnimech, recalculation is not needed Owner = l; NumHS = BaseNumHS; CurConfig = type; BaseLoadoutNumHS = NumHS; - for( int i = 0; i < PlacedHeatSinks.length; i++ ) { - CurrentSinks.add( PlacedHeatSinks[i] ); + for (int i = 0; i < PlacedHeatSinks.length; i++) { + CurrentSinks.add(PlacedHeatSinks[i]); } } public void SetSingle() { CurConfig = SHS; - Owner.GetMech().SetChanged( true ); + Owner.GetMech().SetChanged(true); } public void SetClanDHS() { CurConfig = CLDHS; - Owner.GetMech().SetChanged( true ); + Owner.GetMech().SetChanged(true); } public void SetISDHS() { CurConfig = ISDHS; - Owner.GetMech().SetChanged( true ); + Owner.GetMech().SetChanged(true); } public void SetISCompact() { CurConfig = ISCOM; - Owner.GetMech().SetChanged( true ); + Owner.GetMech().SetChanged(true); } public void SetCLLaser() { CurConfig = CLLAS; - Owner.GetMech().SetChanged( true ); + Owner.GetMech().SetChanged(true); } - + public void SetStarLeagueProtoDHS() { CurConfig = StarLeagueProtoDHS; - Owner.GetMech().SetChanged( true ); + Owner.GetMech().SetChanged(true); } public void SetSuccWarsProtoDHS() { CurConfig = SuccWarsProtoDHS; - Owner.GetMech().SetChanged( true ); + Owner.GetMech().SetChanged(true); } - + public boolean IsDouble() { return CurConfig.IsDouble(); } @@ -121,8 +120,8 @@ public boolean IsCompact() { public boolean IsLaser() { return CurConfig.IsLaser(); } - - public boolean IsProtoDHS(){ + + public boolean IsProtoDHS() { return CurConfig.IsProtoDHS(); } @@ -142,7 +141,7 @@ public int GetBaseLoadoutNumHS() { return BaseLoadoutNumHS; } - public void SetBaseLoadoutNumHS( int h ) { + public void SetBaseLoadoutNumHS(int h) { BaseLoadoutNumHS = h; } @@ -159,172 +158,166 @@ public String ChatName() { } public ifState[] GetStates() { - ifState[] retval = { (ifState) SHS, (ifState) ISDHS, (ifState) CLDHS, - (ifState) ISCOM, (ifState) CLLAS, - (ifState) StarLeagueProtoDHS, (ifState) SuccWarsProtoDHS }; + ifState[] retval = { (ifState) SHS, (ifState) ISDHS, (ifState) CLDHS, (ifState) ISCOM, (ifState) CLLAS, + (ifState) StarLeagueProtoDHS, (ifState) SuccWarsProtoDHS }; return retval; } public void IncrementNumHS() { // do we need a new heat sink? - if( NeedNewHS() ) { + if (NeedNewHS()) { HeatSink h = (HeatSink) GetHeatSink(); - h.Place( Owner ); + h.Place(Owner); } else { - if( IsCompact() ) { + if (IsCompact()) { HeatSink h = FindOpenCompact(); - if( h == null ) { + if (h == null) { // shouldn't happen, we'll have to figuure out what went wrong } else { - h.SetNumHS( 2 ); + h.SetNumHS(2); } } } NumHS++; - Owner.GetMech().SetChanged( true ); + Owner.GetMech().SetChanged(true); } public boolean DecrementNumHS() { HeatSink h; // Can we actually remove heatsinks? - if( NumHS <= Owner.GetMech().GetEngine().FreeHeatSinks() ) { + if (NumHS <= Owner.GetMech().GetEngine().FreeHeatSinks()) { return false; } - if( CurrentSinks.size() > 0 ) { - if( IsCompact() ) { + if (CurrentSinks.size() > 0) { + if (IsCompact()) { h = FindOpenCompact(); - if( h == null ) { + if (h == null) { // reduce the last Current Sink - ((HeatSink) CurrentSinks.getLast()).SetNumHS( 1 ); + ((HeatSink) CurrentSinks.getLast()).SetNumHS(1); } else { - h.Remove( Owner ); - CurrentSinks.remove( h ); + h.Remove(Owner); + CurrentSinks.remove(h); } } else { h = (HeatSink) CurrentSinks.getLast(); - h.Remove( Owner ); - CurrentSinks.remove( h ); + h.Remove(Owner); + CurrentSinks.remove(h); } } NumHS--; - Owner.GetMech().SetChanged( true ); + Owner.GetMech().SetChanged(true); return true; } - public void SetNumHS( int hs ) { - // sets the number of heat sinks to the specified number. Only really - // used when loading a mech. First, blow out all the sinks. + public void SetNumHS(int hs) { + // sets the number of heat sinks to the specified number. Only really + // used when loading a mech. First, blow out all the sinks. NumHS = 0; - for( int i = 0; i < CurrentSinks.size(); i++ ) { - Owner.Remove( (abPlaceable) CurrentSinks.get( i ) ); + for (int i = 0; i < CurrentSinks.size(); i++) { + Owner.Remove((abPlaceable) CurrentSinks.get(i)); } CurrentSinks.clear(); // get some required information int BaseHS = Owner.GetMech().GetEngine().FreeHeatSinks(); - if( BaseHS > hs ) { hs = BaseHS; } + if (BaseHS > hs) { + hs = BaseHS; + } // now get all the heat sinks we need - for( int i = 0; i < hs; i++ ) { + for (int i = 0; i < hs; i++) { IncrementNumHS(); } } public int TotalDissipation() { int totalDissipation; - + int partialWingBonus = Owner.GetMech().UsingPartialWing() ? 3 : 0; int extraDHSBonus = 0; int radicalHeatSinkBonus = 0; - - ArrayList equipment = Owner.GetMech().GetLoadout().GetEquipment(); - for (int i = 0; i < equipment.size(); i++){ - if (equipment.get(i) instanceof EquipmentProtoSuccWarsDoubleHeatSink){ + + ArrayList equipment = Owner.GetMech().GetLoadout().GetEquipment(); + for (int i = 0; i < equipment.size(); i++) { + if (equipment.get(i) instanceof EquipmentProtoSuccWarsDoubleHeatSink) { extraDHSBonus += 2; - } else if (equipment.get(i) instanceof EquipmentProtoStarLeagueDoubleHeatSink){ + } else if (equipment.get(i) instanceof EquipmentProtoStarLeagueDoubleHeatSink) { extraDHSBonus += 2; } } int baseDissipation = NumHS * CurConfig.GetDissipation(); if (Owner.HasItem("Radical Heat Sink")) { - radicalHeatSinkBonus = (int)Math.ceil(NumHS * 0.4); + radicalHeatSinkBonus = (int) Math.ceil(NumHS * 0.4); } totalDissipation = baseDissipation + partialWingBonus + extraDHSBonus + radicalHeatSinkBonus; - - if (IsProtoDHS()) - { + + if (IsProtoDHS()) { int singleHS = NumHS < InternalHeatSinks() ? NumHS : InternalHeatSinks(); - - totalDissipation = (singleHS * SHS.GetDissipation()) - + ((NumHS - singleHS) * CurConfig.GetDissipation()) - + partialWingBonus - + extraDHSBonus - + radicalHeatSinkBonus; + + totalDissipation = (singleHS * SHS.GetDissipation()) + ((NumHS - singleHS) * CurConfig.GetDissipation()) + + partialWingBonus + extraDHSBonus + radicalHeatSinkBonus; } return totalDissipation; } public double GetTonnage() { // returns the total tonnage of heat sinks we have. - double tons = ( NumHS - Owner.GetMech().GetEngine().FreeHeatSinks() ) * CurConfig.GetTonnage(); - if( tons <= 0.0 ) { - // we're still initializing or even. return a 0 answer. - tons = 0.0; + double tons = (NumHS - Owner.GetMech().GetEngine().FreeHeatSinks()) * CurConfig.GetTonnage(); + if (tons <= 0.0) { + // we're still initializing or even. return a 0 answer. + tons = 0.0; } // now check for armored sinks and add that to the result - for( int i = 0; i < CurrentSinks.size(); i++ ) { - tons += ((HeatSink) CurrentSinks.get( i )).GetTonnage(); + for (int i = 0; i < CurrentSinks.size(); i++) { + tons += ((HeatSink) CurrentSinks.get(i)).GetTonnage(); } return tons; } public double GetLoadoutTonnage() { // returns the tonnage of heatsinks over the base loadout. - double tons = ( NumHS - BaseLoadoutNumHS ) * CurConfig.GetTonnage(); - if( tons <= 0.0 ) { - // we're still initializing or even. return a 0 answer. - tons = 0.0; + double tons = (NumHS - BaseLoadoutNumHS) * CurConfig.GetTonnage(); + if (tons <= 0.0) { + // we're still initializing or even. return a 0 answer. + tons = 0.0; } // now check for armored sinks and add that to the result - for( int i = 0; i < CurrentSinks.size(); i++ ) { - tons += ((HeatSink) CurrentSinks.get( i )).GetTonnage(); + for (int i = 0; i < CurrentSinks.size(); i++) { + tons += CurrentSinks.get(i).GetTonnage(); } return tons; } public double GetOmniTonnage() { // returns the tonnage used by the particular omni loadout - return ( NumHS - BaseLoadoutNumHS ) * CurConfig.GetTonnage(); + return (NumHS - BaseLoadoutNumHS) * CurConfig.GetTonnage(); } public double GetCost() { // returns the cost of these heat sinks double CostHS; - if( CurConfig.IsDouble() || CurConfig.IsLaser() || CurConfig.IsCompact() ) { - if (CurConfig.IsProtoDHS()) - { + if (CurConfig.IsDouble() || CurConfig.IsLaser() || CurConfig.IsCompact()) { + if (CurConfig.IsProtoDHS()) { int singleHS = NumHS < InternalHeatSinks() ? NumHS : InternalHeatSinks(); CostHS = (singleHS * SHS.GetCost()) + ((NumHS - singleHS) * CurConfig.GetCost()); - } - else - { + } else { CostHS = NumHS * CurConfig.GetCost(); } } else { - if( Owner.GetMech().GetEngine().IsFusion() ) { + if (Owner.GetMech().GetEngine().IsFusion()) { // free single fusion sinks cost nothing - CostHS = ( NumHS - Owner.GetMech().GetEngine().FreeHeatSinks() ) * CurConfig.GetCost(); + CostHS = (NumHS - Owner.GetMech().GetEngine().FreeHeatSinks()) * CurConfig.GetCost(); } else { CostHS = NumHS * CurConfig.GetCost(); } } // now check for armored sinks and add that to the result - for( int i = 0; i < CurrentSinks.size(); i++ ) { - CostHS += ((HeatSink) CurrentSinks.get( i )).GetCost(); + for (int i = 0; i < CurrentSinks.size(); i++) { + CostHS += CurrentSinks.get(i).GetCost(); } return CostHS; } @@ -337,7 +330,7 @@ public abPlaceable GetHeatSink() { public int NumCrits() { int result = CurrentSinks.size() * CurConfig.GetNumCrits(); - if( result < 0 ) { + if (result < 0) { return 0; } else { return result; @@ -347,9 +340,9 @@ public int NumCrits() { private boolean NeedNewHS() { // this returns whether or not we need to get a new heat sink or whether // we can simply increment the number of heatsinks. - if( Owner.GetMech().IsOmnimech() ) { - if( IsCompact() ) { - if( FindOpenCompact() == null ) { + if (Owner.GetMech().IsOmnimech()) { + if (IsCompact()) { + if (FindOpenCompact() == null) { return true; } else { return false; @@ -357,10 +350,10 @@ private boolean NeedNewHS() { } return true; } else { - if( NumHS >= InternalHeatSinks() ) { + if (NumHS >= InternalHeatSinks()) { // need to get a new sink - if( IsCompact() ) { - if( FindOpenCompact() != null ) { + if (IsCompact()) { + if (FindOpenCompact() != null) { return false; } } @@ -374,17 +367,17 @@ private boolean NeedNewHS() { public HeatSink FindOpenCompact() { // this routine finds the next available single Compact Heat Sink // if it cannot find a single compact, it returns null - for( int i = 0; i < CurrentSinks.size(); i++ ) { - if( ((HeatSink) CurrentSinks.get( i )).NumHeatSinks() == 1 ) { - return (HeatSink) CurrentSinks.get( i ); + for (int i = 0; i < CurrentSinks.size(); i++) { + if (CurrentSinks.get(i).NumHeatSinks() == 1) { + return CurrentSinks.get(i); } } return null; } public int InternalHeatSinks() { - // returns the number of internal heat sinks. needed because of compacts - if( IsCompact() ) { + // returns the number of internal heat sinks. needed because of compacts + if (IsCompact()) { return Owner.GetMech().GetEngine().InternalHeatSinks() * 2; } else { return Owner.GetMech().GetEngine().InternalHeatSinks(); @@ -399,21 +392,22 @@ public void ReCalculate() { int temp = NumHS; NumHS = 0; - if( temp < Owner.GetMech().GetEngine().FreeHeatSinks() ) { + if (temp < Owner.GetMech().GetEngine().FreeHeatSinks()) { temp = Owner.GetMech().GetEngine().FreeHeatSinks(); } // blow out all the sinks abPlaceable h; - for( int i = CurrentSinks.size(); i > 0; i-- ) { + + for (int i = CurrentSinks.size(); i > 0; i--) { h = (abPlaceable) CurrentSinks.getLast(); - h.Remove( Owner ); + h.Remove(Owner); CurrentSinks.remove(h); } // rebuild the heat sinks - for( ; temp > 0; temp-- ) { - // temp -= NumHS + for (; temp > 0; temp--) { + // temp -= NumHS IncrementNumHS(); } } @@ -421,8 +415,8 @@ public void ReCalculate() { public HeatSink[] GetPlacedHeatSinks() { // returns the currently placed heat sinks in array form HeatSink[] retval = new HeatSink[CurrentSinks.size()]; - for( int i = 0; i < CurrentSinks.size(); i++ ) { - retval[i] = (HeatSink) CurrentSinks.get( i ); + for (int i = 0; i < CurrentSinks.size(); i++) { + retval[i] = CurrentSinks.get(i); } return retval; } @@ -435,8 +429,8 @@ public AvailableCode GetAvailability() { public double GetOffensiveBV() { // convenience method double result = 0.0; - for( int i = 0; i < CurrentSinks.size(); i++ ) { - result += ((HeatSink) CurrentSinks.get( i )).GetOffensiveBV(); + for (int i = 0; i < CurrentSinks.size(); i++) { + result += CurrentSinks.get(i).GetOffensiveBV(); } return result; } @@ -444,8 +438,8 @@ public double GetOffensiveBV() { public double GetDefensiveBV() { // convenience method double result = 0.0; - for( int i = 0; i < CurrentSinks.size(); i++ ) { - result += ((HeatSink) CurrentSinks.get( i )).GetDefensiveBV(); + for (int i = 0; i < CurrentSinks.size(); i++) { + result += CurrentSinks.get(i).GetDefensiveBV(); } return result; } From e162b8154a7ed8773b48bf518092e0a078557438 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 16:53:36 -0600 Subject: [PATCH 095/126] components - ifCVLoadout - Type enforcement for templates - VS Code Formatting --- .../src/main/java/components/ifCVLoadout.java | 251 +++++++++++++----- 1 file changed, 188 insertions(+), 63 deletions(-) diff --git a/sswlib/src/main/java/components/ifCVLoadout.java b/sswlib/src/main/java/components/ifCVLoadout.java index 26041507..dd3c961e 100644 --- a/sswlib/src/main/java/components/ifCVLoadout.java +++ b/sswlib/src/main/java/components/ifCVLoadout.java @@ -32,134 +32,259 @@ public interface ifCVLoadout { public CombatVehicle GetOwner(); - public void SetName( String s ); + + public void SetName(String s); + public String GetName(); - public void SetSource( String s ); + + public void SetSource(String s); + public String GetSource(); + public int GetRulesLevel(); - public boolean SetRulesLevel( int NewLevel ); + + public boolean SetRulesLevel(int NewLevel); + public int GetTechBase(); - public void SetTechBase( int NewLevel ); + + public void SetTechBase(int NewLevel); + public CVJumpJetFactory GetJumpJets(); + public CVHeatSinkFactory GetHeatSinks(); + public int GetEra(); - public boolean SetEra( int era ); + + public boolean SetEra(int era); + public int GetProductionEra(); - public boolean SetProductionEra( int era ); + + public boolean SetProductionEra(int era); + public int GetYear(); - public void SetYear( int year, boolean specified ); + + public void SetYear(int year, boolean specified); + public boolean YearWasSpecified(); - public void SetYearRestricted( boolean b ); + + public void SetYearRestricted(boolean b); + public boolean IsYearRestricted(); - public void AddToQueue( abPlaceable p ); - public void RemoveFromQueue( abPlaceable p ); - public abPlaceable GetFromQueueByIndex( int Index ); - public boolean QueueContains( abPlaceable p ); - public EquipmentCollection GetCollection( abPlaceable p ); - public ArrayList GetQueue(); + + public void AddToQueue(abPlaceable p); + + public void RemoveFromQueue(abPlaceable p); + + public abPlaceable GetFromQueueByIndex(int Index); + + public boolean QueueContains(abPlaceable p); + + public EquipmentCollection GetCollection(abPlaceable p); + + public ArrayList GetQueue(); + public ArrayList GetNonCore(); + public ArrayList GetEquipment(); + public boolean UsingTC(); + public TargetingComputer GetTC(); + public void FullUnallocate(); + public void ClearLoadout(); + public void SafeClearLoadout(); + public void SafeMassUnallocate(); - public void Transfer( ifCVLoadout l ); - public void AddTo( abPlaceable p, int Loc ) throws Exception; - public void AddTo( abPlaceable p, abPlaceable[] Loc ) throws Exception; + + public void Transfer(ifCVLoadout l); + + public void AddTo(abPlaceable p, int Loc) throws Exception; + + public void AddTo(abPlaceable p, abPlaceable[] Loc) throws Exception; + public void RefreshHeatSinks(); - public void AddToFront( abPlaceable p ) throws Exception; - public void AddToLeft( abPlaceable p ) throws Exception; - public void AddToRight( abPlaceable p ) throws Exception; - public void AddToRear( abPlaceable p ) throws Exception; - public void AddToBody( abPlaceable p ) throws Exception; - public void AddToTurret1( abPlaceable p ) throws Exception; - public void AddToTurret2( abPlaceable p ) throws Exception; - public void AddToSponsonTurretLeft(abPlaceable p ) throws Exception; - public void AddToSponsonTurretRight(abPlaceable p ) throws Exception; + + public void AddToFront(abPlaceable p) throws Exception; + + public void AddToLeft(abPlaceable p) throws Exception; + + public void AddToRight(abPlaceable p) throws Exception; + + public void AddToRear(abPlaceable p) throws Exception; + + public void AddToBody(abPlaceable p) throws Exception; + + public void AddToTurret1(abPlaceable p) throws Exception; + + public void AddToTurret2(abPlaceable p) throws Exception; + + public void AddToSponsonTurretLeft(abPlaceable p) throws Exception; + + public void AddToSponsonTurretRight(abPlaceable p) throws Exception; + public ArrayList GetFrontItems(); + public ArrayList GetLeftItems(); + public ArrayList GetRightItems(); + public ArrayList GetRearItems(); + public ArrayList GetBodyItems(); + public ArrayList GetTurret1Items(); + public ArrayList GetTurret2Items(); + public ArrayList GetSponsonTurretLeftItems(); + public ArrayList GetSponsonTurretRightItems(); + public Turret GetTurret(); + public Turret GetRearTurret(); + public SponsonTurret GetSponsonTurretLeft(); + public SponsonTurret GetSponsonTurretRight(); - public abPlaceable[] GetItems( int Loc ); - public int Find( abPlaceable p ); - public LocationIndex FindIndex( abPlaceable p ); - public int[] FindInstances( abPlaceable p ); - public ArrayList FindIndexes( abPlaceable p ); + + public abPlaceable[] GetItems(int Loc); + + public int Find(abPlaceable p); + + public LocationIndex FindIndex(abPlaceable p); + + public int[] FindInstances(abPlaceable p); + + public ArrayList FindIndexes(abPlaceable p); + public int[] FindModularArmor(); + public void FlushIllegal(); - public boolean UnallocateAll( abPlaceable p, boolean override ); - public void Remove( abPlaceable p ); - public void Unallocate( abPlaceable[] a ); - public void AutoAllocate( abPlaceable p ); - public void AutoAllocate( EquipmentCollection e ); - public boolean IsAllocated( abPlaceable p ); + + public boolean UnallocateAll(abPlaceable p, boolean override); + + public void Remove(abPlaceable p); + + public void Unallocate(abPlaceable[] a); + + public void AutoAllocate(abPlaceable p); + + public void AutoAllocate(EquipmentCollection e); + + public boolean IsAllocated(abPlaceable p); + public int UnplacedItems(); + public int FreeItems(); + public void LockChassis(); + public void UnlockChassis(); + public ifCVLoadout Clone(); - public void SetBaseLoadout( ifCVLoadout l ); + + public void SetBaseLoadout(ifCVLoadout l); + public ifCVLoadout GetBaseLoadout(); - public void SetFrontItems( ArrayList c ); - public void SetLeftItems( ArrayList c ); - public void SetRightItems( ArrayList c ); - public void SetRearItems( ArrayList c ); - public void SetBodyItems( ArrayList c ); - public void SetTurret1( ArrayList c ); - public void SetTurret2( ArrayList c ); + + public void SetFrontItems(ArrayList c); + + public void SetLeftItems(ArrayList c); + + public void SetRightItems(ArrayList c); + + public void SetRearItems(ArrayList c); + + public void SetBodyItems(ArrayList c); + + public void SetTurret1(ArrayList c); + + public void SetTurret2(ArrayList c); + public void SetSponsonTurretLeftItems(ArrayList c); + public void SetSponsonTurretRightItems(ArrayList c); - public void SetNonCore( ArrayList v ); - public void SetTCList( ArrayList v ); - public void SetEquipment( ArrayList v ); - public void SetTurret( Turret t ); - public void SetRearTurret( Turret t ); + + public void SetNonCore(ArrayList v); + + public void SetTCList(ArrayList v); + + public void SetEquipment(ArrayList v); + + public void SetTurret(Turret t); + + public void SetRearTurret(Turret t); + public void SetSponsonTurretLeft(SponsonTurret t); + public void SetSponsonTurretRight(SponsonTurret t); + public ArrayList GetMechMods(); + public boolean CanUseClanCASE(); + public boolean IsUsingClanCASE(); - public void SetClanCASE( boolean b ); + + public void SetClanCASE(boolean b); + public void RemoveISCase(); + public void SetISCASE(); + public boolean HasISCASE(); + public CASE GetISCase(); - public void SetFCSArtemisIV( boolean b ) throws Exception; - public void SetFCSArtemisV( boolean b ) throws Exception; - public void SetFCSApollo( boolean b ) throws Exception; + + public void SetFCSArtemisIV(boolean b) throws Exception; + + public void SetFCSArtemisV(boolean b) throws Exception; + + public void SetFCSApollo(boolean b) throws Exception; + public boolean UsingArtemisIV(); + public boolean UsingArtemisV(); + public boolean UsingApollo(); - public void UseTC( boolean use, boolean clan ); + + public void UseTC(boolean use, boolean clan); + public void CheckTC(); + public void UnallocateTC(); - public void SetSupercharger( boolean b ) throws Exception; - public void SetSupercharger( Supercharger s ); + + public void SetSupercharger(boolean b) throws Exception; + + public void SetSupercharger(Supercharger s); + public boolean HasSupercharger(); + public Supercharger GetSupercharger(); + public CVPowerAmplifier GetPowerAmplifier(); - public void CheckExclusions( abPlaceable a ) throws Exception; + + public void CheckExclusions(abPlaceable a) throws Exception; + public void MoveToQueue(int loc); + public double GetTurretTonnage(); + public double GetRearTurretTonnage(); + public double GetSponsonTurretTonnage(); + public double GetSponsonTurretCost(); + public void ResetHeatSinks(); + public int NumCVAmmoSpaces(); -/* - public void AddMechModifier( MechModifier m ); - public void RemoveMechMod( MechModifier m ); - public ArrayList GetMechMods(); - */ + /* + * public void AddMechModifier( MechModifier m ); + * public void RemoveMechMod( MechModifier m ); + * public ArrayList GetMechMods(); + */ } From 6e917de204d16d8a0ec018ac7e7aac49c2ba329e Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 16:55:36 -0600 Subject: [PATCH 096/126] components - ifMechLoadout - Template Type Enforcement --- sswlib/src/main/java/components/ifMechLoadout.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sswlib/src/main/java/components/ifMechLoadout.java b/sswlib/src/main/java/components/ifMechLoadout.java index c178b3a3..504625a7 100644 --- a/sswlib/src/main/java/components/ifMechLoadout.java +++ b/sswlib/src/main/java/components/ifMechLoadout.java @@ -90,7 +90,7 @@ public interface ifMechLoadout { public EquipmentCollection GetCollection(abPlaceable p); - public ArrayList GetQueue(); + public ArrayList GetQueue(); public ArrayList GetNonCore(); @@ -249,11 +249,11 @@ public interface ifMechLoadout { public void SetCLCrits(abPlaceable[] c); - public void SetNonCore(ArrayList v); + public void SetNonCore(ArrayList v); - public void SetTCList(ArrayList v); + public void SetTCList(ArrayList v); - public void SetEquipment(ArrayList v); + public void SetEquipment(ArrayList v); public boolean CanUseClanCASE(); @@ -435,7 +435,7 @@ public interface ifMechLoadout { public void RemoveMechMod(MechModifier m); - public ArrayList GetMechMods(); + public ArrayList GetMechMods(); public void SetBoobyTrap(boolean b) throws Exception; From 95f3f610405353660b7d5bf51e56c65f1969a3d4 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 16:59:36 -0600 Subject: [PATCH 097/126] sswlib/src/main/java/Print - PrintVehicle.java - Removed unused variables and private methods --- sswlib/src/main/java/Print/PrintVehicle.java | 53 ++++++++++++-------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/sswlib/src/main/java/Print/PrintVehicle.java b/sswlib/src/main/java/Print/PrintVehicle.java index a18f7fdb..360b82d2 100644 --- a/sswlib/src/main/java/Print/PrintVehicle.java +++ b/sswlib/src/main/java/Print/PrintVehicle.java @@ -34,6 +34,7 @@ import components.CombatVehicle; import components.LocationIndex; import components.PlaceableInfo; +import components.abPlaceable; import filehandlers.ImageTracker; import java.awt.*; import java.awt.print.PageFormat; @@ -48,7 +49,7 @@ public class PrintVehicle implements Printable { LogoImage = null, RecordSheet = null, ChartImage = null; - private boolean Advanced = false, + private boolean // Advanced = false, Not used Charts = false, PrintPilot = true, UseA4Paper = false, @@ -64,9 +65,9 @@ public class PrintVehicle implements Printable { Gunnery = 4, MiniConvRate = 1; private double BV = 0.0; - private ifPrintPoints points = null; - private Color Black = new Color( 0, 0, 0 ), - Grey = new Color( 128, 128, 128 ); + // private ifPrintPoints points = null; + // private Color Black = new Color( 0, 0, 0 ), // Never used + // Grey = new Color( 128, 128, 128 ); private ImageTracker imageTracker; private Preferences Prefs = Preferences.userRoot().node( Constants.SSWPrefs ); @@ -79,7 +80,7 @@ public PrintVehicle( CombatVehicle m, Image i, boolean adv, boolean A4, ImageTra CurVee = m; imageTracker = images; if ( !m.GetSSWImage().equals("../BFB.Images/No_Image.png") ) UnitImage = imageTracker.getImage(m.GetSSWImage()); - Advanced = adv; + // Advanced = adv; // Assigned but not used. BV = CommonTools.GetAdjustedBV(CurVee.GetCurrentBV(), Gunnery, Piloting); UseA4Paper = A4; GetRecordSheet(imageTracker); @@ -95,7 +96,7 @@ public PrintVehicle( CombatVehicle m, String Warrior, int Gun, int Pilot, ImageT SetPilotData(Warrior, Gun, Pilot); } //
- + // public void SetPilotData( String pname, int pgun, int ppilot ) { PilotName = pname; @@ -188,11 +189,11 @@ public int getGunnery(){ public int getPiloting(){ return Piloting; } - + public Image getUnitImage() { return UnitImage; } - + public Image getLogoImage() { return LogoImage; } @@ -212,7 +213,7 @@ public int print( Graphics graphics, PageFormat pageFormat, int pageIndex ) thro return Printable.PAGE_EXISTS; } } - + private void PreparePrint( Graphics2D graphics ) { Items = PrintConsts.SortEquipmentByLocation( CurVee, MiniConvRate ); ap = new PIPPrinter(graphics, CurVee, Canon, imageTracker); @@ -242,11 +243,11 @@ private void DrawSheet( Graphics2D graphics ) { if( Charts ) { graphics.scale( 0.8d, 0.8d ); } - + graphics.drawImage( RecordSheet, 0, 0, 576, 756, null ); //graphics.drawImage( RecordSheet, 0, 0, 556, 760, null ); vee size? //graphics.drawImage( RecordSheet, 0, 0, 560, 757, null ); - + Point start = ap.GetPoints().GetMechImageLoc(); start.x -= 3; start.y -= 6; @@ -355,7 +356,7 @@ private void DrawMechData( Graphics2D graphics ) { AmmoData CurAmmo = (AmmoData) AmmoList.get(index); graphics.drawString( CurAmmo.Format(), p[0].x, p[0].y + offset); graphics.drawString( CurAmmo.LotSize + "", p[3].x-30, p[3].y + offset); - + //Ammo boxes Point spot = new Point(p[3].x-15, p[3].y + offset - 5); graphics.setStroke(new BasicStroke(0.5f)); @@ -393,12 +394,12 @@ private void DrawMechData( Graphics2D graphics ) { } else { graphics.drawString( CurVee.GetEngine().CritName() + "", p[19].x, p[19].y ); } - + //Jumping Movement! /* String JumpMP = ""; - if ( CurVee.GetJumpJets().GetNumJJ() > 0 ) + if ( CurVee.GetJumpJets().GetNumJJ() > 0 ) JumpMP += (CurVee.GetJumpJets().GetNumJJ() * MiniConvRate) + ""; if (JumpMP.isEmpty()) JumpMP = "0"; @@ -469,7 +470,7 @@ private void DrawMechData( Graphics2D graphics ) { graphics.drawString( "(" + CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_LEFT ) + ")", p[LocationIndex.CV_LOC_LEFT].x, p[LocationIndex.CV_LOC_LEFT].y ); graphics.drawString( "(" + CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_RIGHT ) + ")", p[LocationIndex.CV_LOC_RIGHT].x, p[LocationIndex.CV_LOC_RIGHT].y ); graphics.drawString( "(" + CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_REAR ) + ")", p[LocationIndex.CV_LOC_REAR].x, p[LocationIndex.CV_LOC_REAR].y ); - if ( CurVee.IsVTOL() ) + if ( CurVee.IsVTOL() ) graphics.drawString( "(" + CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_ROTOR ) + ")", p[LocationIndex.CV_LOC_ROTOR].x, p[LocationIndex.CV_LOC_ROTOR].y ); if ( CurVee.isHasTurret1() ) graphics.drawString( "(" + CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_TURRET1 ) + ")", p[LocationIndex.CV_LOC_TURRET1].x, p[LocationIndex.CV_LOC_TURRET1].y ); @@ -477,6 +478,8 @@ private void DrawMechData( Graphics2D graphics ) { graphics.drawString( "(" + CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_TURRET2 ) + ")", p[LocationIndex.CV_LOC_TURRET2].x, p[LocationIndex.CV_LOC_TURRET2].y ); } + /* + // Never used locally private void DrawImages( Graphics2D graphics ) { //PrintMech Image Point start = ap.GetPoints().GetMechImageLoc(); @@ -493,7 +496,9 @@ private void DrawImages( Graphics2D graphics ) { graphics.drawImage( LogoImage, ap.GetPoints().GetLogoImageLoc().x, ap.GetPoints().GetLogoImageLoc().y, 50, 50, null ); } } - + */ + /* + // Never used locally private void DrawGrid( Graphics2D graphics ) { graphics.setFont( PrintConsts.ReallySmallFont ); boolean bPrint = true; @@ -509,10 +514,11 @@ private void DrawGrid( Graphics2D graphics ) { graphics.drawLine(0, y, 576, y); } } + */ private ArrayList GetAmmo() { //Output the list of Ammunition - ArrayList all = CurVee.GetLoadout().GetNonCore(); + ArrayList all = CurVee.GetLoadout().GetNonCore(); ArrayList AmmoLister = new ArrayList(); for ( int index=0; index < all.size(); index++ ) { if( all.get( index ) instanceof Ammunition ) { @@ -535,30 +541,33 @@ private ArrayList GetAmmo() { return AmmoLister; } + /* + // Never used locally private boolean AmmoContains( ArrayList AmmoList, String CheckExpr ) { for ( AmmoData data : AmmoList ) { if ( data.Format().contains(CheckExpr) ) return true; } return false; } + */ private void GetRecordSheet( ImageTracker images ) { // loads the correct record sheet and points based on the information given RecordSheet = images.getImage( PrintConsts.RS_TW_GROUND ); ChartImage = images.getImage(PrintConsts.BP_ChartImage ); - points = new TWGroundPoints(); + // points = new TWGroundPoints(); // Assigned but never used //We have to use the advanced sheet for dual turrets if ( CurVee.isHasTurret2() ) RecordSheet = images.getImage( PrintConsts.RS_TO_GROUND ); - + if ( CurVee.IsVTOL() ) { if ( CurVee.isHasTurret1() ) RecordSheet = images.getImage( PrintConsts.RS_TW_VTOL ); else RecordSheet = images.getImage( PrintConsts.RS_TW_VTOL ); } - + if ( CurVee.IsNaval() ) RecordSheet = images.getImage( PrintConsts.RS_TW_NAVAL ); } @@ -588,7 +597,7 @@ public void setLetter() } private class AmmoData { public String ActualName, - ChatName, + // ChatName, GenericName, CritName, LookupName; @@ -597,7 +606,7 @@ private class AmmoData { public AmmoData( Ammunition ammo ) { this.ActualName = ammo.ActualName(); - this.ChatName = ammo.ChatName(); + // this.ChatName = ammo.ChatName(); // Assigned but never used. this.CritName = ammo.CritName().replace("@", "").trim(); this.LookupName = ammo.LookupName(); From ce50093dea1b9cefee7c4a82fcf99ee5fdce8d23 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 17:05:23 -0600 Subject: [PATCH 098/126] sswlib/src/main/java/Print - PrintMech - Template Type Enforcement - Removed variables and methods not used - VS Code Formatting --- sswlib/src/main/java/Print/PrintMech.java | 944 ++++++++++++---------- 1 file changed, 523 insertions(+), 421 deletions(-) diff --git a/sswlib/src/main/java/Print/PrintMech.java b/sswlib/src/main/java/Print/PrintMech.java index b40d5826..64c5811d 100644 --- a/sswlib/src/main/java/Print/PrintMech.java +++ b/sswlib/src/main/java/Print/PrintMech.java @@ -67,19 +67,20 @@ public class PrintMech implements Printable { private double BV = 0.0; private ifPrintPoints points = null; private ImageTracker imageTracker; - private Preferences Prefs = Preferences.userRoot().node( Constants.SSWPrefs ); + private Preferences Prefs = Preferences.userRoot().node(Constants.SSWPrefs); private ArrayList Items; private PIPPrinter ap; private ArrayList AmmoList; // - public PrintMech( Mech m, Image i, boolean adv, boolean A4, ImageTracker images) { + public PrintMech(Mech m, Image i, boolean adv, boolean A4, ImageTracker images) { CurMech = m; imageTracker = images; - RecordSheet = images.getImage( PrintConsts.RS_TW_BP ); - ChartImage = images.getImage(PrintConsts.BP_ChartImage ); - if ( !m.GetSSWImage().equals("../BFB.Images/No_Image.png") ) MechImage = imageTracker.getImage(m.GetSSWImage()); + RecordSheet = images.getImage(PrintConsts.RS_TW_BP); + ChartImage = images.getImage(PrintConsts.BP_ChartImage); + if (!m.GetSSWImage().equals("../BFB.Images/No_Image.png")) + MechImage = imageTracker.getImage(m.GetSSWImage()); Advanced = adv; BV = CommonTools.GetAdjustedBV(CurMech.GetCurrentBV(), Gunnery, Piloting); UseA4Paper = A4; @@ -87,35 +88,35 @@ public PrintMech( Mech m, Image i, boolean adv, boolean A4, ImageTracker images) AmmoList = GetAmmo(); } - public PrintMech( Mech m, ImageTracker images ) { - this( m, null, false, false, images); + public PrintMech(Mech m, ImageTracker images) { + this(m, null, false, false, images); } - public PrintMech( Mech m, String Warrior, int Gun, int Pilot, ImageTracker images) { - this( m, null, false, false, images); + public PrintMech(Mech m, String Warrior, int Gun, int Pilot, ImageTracker images) { + this(m, null, false, false, images); SetPilotData(Warrior, Gun, Pilot); } // - + // - public void SetPilotData( String pname, int pgun, int ppilot ) { + public void SetPilotData(String pname, int pgun, int ppilot) { PilotName = pname; Piloting = ppilot; Gunnery = pgun; setBV(CommonTools.GetAdjustedBV(BV, Gunnery, Piloting)); } - public void SetOptions( boolean charts, boolean PrintP, double UseBV ) { + public void SetOptions(boolean charts, boolean PrintP, double UseBV) { Charts = charts; setBV(UseBV); PrintPilot = PrintP; } - public void SetMiniConversion( int conv ) { + public void SetMiniConversion(int conv) { useMiniConvRate = false; MiniConvRate = 1; - - if ( conv > 0 ) { + + if (conv > 0) { MiniConvRate = conv; useMiniConvRate = true; } @@ -142,24 +143,24 @@ public void setPrintPilot(Boolean b) { } public void setMechImage(Image MechImage) { - if ( MechImage != null) { + if (MechImage != null) { this.MechImage = MechImage; this.printMech = true; } } - public void setPrintMech( Boolean PrintMech ) { + public void setPrintMech(Boolean PrintMech) { this.printMech = PrintMech; } public void setLogoImage(Image LogoImage) { - if ( LogoImage != null) { + if (LogoImage != null) { this.LogoImage = LogoImage; this.printLogo = true; } } - public void setPrintLogo( Boolean PrintLogo ) { + public void setPrintLogo(Boolean PrintLogo) { this.printLogo = PrintLogo; } @@ -167,7 +168,7 @@ public void setBV(double BV) { this.BV = BV; } - public void setCanon( boolean Canon ) { + public void setCanon(boolean Canon) { this.Canon = Canon; } @@ -177,29 +178,29 @@ public void setTRO(boolean TRO) { setCharts(false); SetMiniConversion(1); setPrintPilot(false); - currentAmmoFormat = Prefs.get( "AmmoNamePrintFormat", "" ); - Prefs.put( "AmmoNamePrintFormat", "Ammo (%P) %L" ); + currentAmmoFormat = Prefs.get("AmmoNamePrintFormat", ""); + Prefs.put("AmmoNamePrintFormat", "Ammo (%P) %L"); } // // - public String getMechwarrior(){ + public String getMechwarrior() { return PilotName; } - public int getGunnery(){ + public int getGunnery() { return Gunnery; } - public int getPiloting(){ + public int getPiloting() { return Piloting; } - + public Image getMechImage() { return MechImage; } - + public Image getLogoImage() { return LogoImage; } @@ -209,54 +210,56 @@ public boolean isTRO() { } // - public int print( Graphics graphics, PageFormat pageFormat, int pageIndex ) throws PrinterException { - ((Graphics2D) graphics).translate( pageFormat.getImageableX(), pageFormat.getImageableY() ); - if( RecordSheet == null ) { + public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { + ((Graphics2D) graphics).translate(pageFormat.getImageableX(), pageFormat.getImageableY()); + if (RecordSheet == null) { return Printable.NO_SUCH_PAGE; } else { - PreparePrint( (Graphics2D) graphics ); - if ( !currentAmmoFormat.isEmpty() ) { Prefs.put( "AmmoNamePrintFormat", currentAmmoFormat); } + PreparePrint((Graphics2D) graphics); + if (!currentAmmoFormat.isEmpty()) { + Prefs.put("AmmoNamePrintFormat", currentAmmoFormat); + } return Printable.PAGE_EXISTS; } } - - private void PreparePrint( Graphics2D graphics ) { - Items = PrintConsts.SortEquipmentByLocation( CurMech, MiniConvRate ); + + private void PreparePrint(Graphics2D graphics) { + Items = PrintConsts.SortEquipmentByLocation(CurMech, MiniConvRate); boolean mechHasShield = CurMech.HasRAShield() || CurMech.HasLAShield(); ap = new PIPPrinter(graphics, CurMech, Canon, mechHasShield, imageTracker); this.BV = CommonTools.GetAdjustedBV(CurMech.GetCurrentBV(), Gunnery, Piloting); GetRecordSheet(imageTracker); - - //DrawImages( graphics ); - DrawSheet( graphics ); - DrawPips( graphics ); - DrawCriticals( graphics ); - DrawMechData( graphics ); - - if( Charts ) { + + // DrawImages( graphics ); + DrawSheet(graphics); + DrawPips(graphics); + DrawCriticals(graphics); + DrawMechData(graphics); + + if (Charts) { // reset the scale and add the charts - graphics.scale( 1.25d, 1.25d ); - graphics.drawImage( ChartImage, 0, 0, 576, 756, null ); - //AddCharts( graphics ); + graphics.scale(1.25d, 1.25d); + graphics.drawImage(ChartImage, 0, 0, 576, 756, null); + // AddCharts( graphics ); } - //DrawGrid( graphics ); + // DrawGrid( graphics ); } - private void DrawSheet( Graphics2D graphics ) { + private void DrawSheet(Graphics2D graphics) { // adjust the printable area for A4 paper size - if( UseA4Paper ) { - graphics.scale( 0.9705d, 0.9705d ); + if (UseA4Paper) { + graphics.scale(0.9705d, 0.9705d); } // adjust the printable area for use with helpful charts - if( Charts ) { - graphics.scale( 0.8d, 0.8d ); + if (Charts) { + graphics.scale(0.8d, 0.8d); } - - graphics.drawImage( RecordSheet, 0, 0, 576, 756, null ); - //graphics.drawImage( RecordSheet, 0, 0, 560, 757, null ); - //Remove old copyright and add new + graphics.drawImage(RecordSheet, 0, 0, 576, 756, null); + // graphics.drawImage( RecordSheet, 0, 0, 560, 757, null ); + + // Remove old copyright and add new graphics.setColor(Color.WHITE); graphics.fillRect(0, 740, 576, 50); graphics.setColor(Color.BLACK); @@ -266,192 +269,224 @@ private void DrawSheet( Graphics2D graphics ) { graphics.drawString(item, 70, line); line += graphics.getFont().getSize(); } - - CheckShields( graphics ); - + + CheckShields(graphics); + Point start = points.GetMechImageLoc(); start.x -= 3; start.y -= 6; - if ( printMech ) { - if (MechImage == null) // fallback to fluff image if user didn't explicitly choose a TRO pic in the print dialog - MechImage = imageTracker.media.GetImage(imageTracker.media.DetermineMatchingImage(CurMech.GetName(), CurMech.GetModel(), CurMech.GetSSWImage())); - if( MechImage != null ) { - //graphics.drawRect(start.x, start.y, 150, 210); + if (printMech) { + if (MechImage == null) // fallback to fluff image if user didn't explicitly choose a TRO pic in the + // print dialog + MechImage = imageTracker.media.GetImage(imageTracker.media.DetermineMatchingImage(CurMech.GetName(), + CurMech.GetModel(), CurMech.GetSSWImage())); + if (MechImage != null) { + // graphics.drawRect(start.x, start.y, 150, 210); Dimension d = imageTracker.media.reSize(getMechImage(), 150, 210); - Point offset = imageTracker.media.offsetImageCenter( new Dimension(150, 210), d); - graphics.drawImage( getMechImage(), start.x + offset.x, start.y + offset.y, d.width, d.height, null ); + Point offset = imageTracker.media.offsetImageCenter(new Dimension(150, 210), d); + graphics.drawImage(getMechImage(), start.x + offset.x, start.y + offset.y, d.width, d.height, null); } } - if ( printLogo && LogoImage != null ) { + if (printLogo && LogoImage != null) { Dimension d = imageTracker.media.reSize(LogoImage, 50, 50); - Point offset = imageTracker.media.offsetImageBottom( new Dimension(150, 210), d); - graphics.drawImage( LogoImage, start.x + offset.x, start.y+offset.y, d.width, d.height, null ); + Point offset = imageTracker.media.offsetImageBottom(new Dimension(150, 210), d); + graphics.drawImage(LogoImage, start.x + offset.x, start.y + offset.y, d.width, d.height, null); } } - private void DrawPips( Graphics2D graphics ) { + private void DrawPips(Graphics2D graphics) { ap.Render(); } - private void DrawCriticals( Graphics2D graphics ) { - graphics.setFont( PrintConsts.CritFont ); - DrawLocationCrits( graphics, LocationIndex.MECH_LOC_HD, CurMech.GetLoadout().GetCrits( LocationIndex.MECH_LOC_HD ), points.GetCritHDPoints() ); - DrawLocationCrits( graphics, LocationIndex.MECH_LOC_CT, CurMech.GetLoadout().GetCrits( LocationIndex.MECH_LOC_CT ), points.GetCritCTPoints() ); - DrawLocationCrits( graphics, LocationIndex.MECH_LOC_RT, CurMech.GetLoadout().GetCrits( LocationIndex.MECH_LOC_RT ), points.GetCritRTPoints() ); - DrawLocationCrits( graphics, LocationIndex.MECH_LOC_LT, CurMech.GetLoadout().GetCrits( LocationIndex.MECH_LOC_LT ), points.GetCritLTPoints() ); - DrawLocationCrits( graphics, LocationIndex.MECH_LOC_RA, CurMech.GetLoadout().GetCrits( LocationIndex.MECH_LOC_RA ), points.GetCritRAPoints() ); - DrawLocationCrits( graphics, LocationIndex.MECH_LOC_LA, CurMech.GetLoadout().GetCrits( LocationIndex.MECH_LOC_LA ), points.GetCritLAPoints() ); - DrawLocationCrits( graphics, LocationIndex.MECH_LOC_RL, CurMech.GetLoadout().GetCrits( LocationIndex.MECH_LOC_RL ), points.GetCritRLPoints() ); - DrawLocationCrits( graphics, LocationIndex.MECH_LOC_LL, CurMech.GetLoadout().GetCrits( LocationIndex.MECH_LOC_LL ), points.GetCritLLPoints() ); + private void DrawCriticals(Graphics2D graphics) { + graphics.setFont(PrintConsts.CritFont); + DrawLocationCrits(graphics, LocationIndex.MECH_LOC_HD, CurMech.GetLoadout().GetCrits(LocationIndex.MECH_LOC_HD), + points.GetCritHDPoints()); + DrawLocationCrits(graphics, LocationIndex.MECH_LOC_CT, CurMech.GetLoadout().GetCrits(LocationIndex.MECH_LOC_CT), + points.GetCritCTPoints()); + DrawLocationCrits(graphics, LocationIndex.MECH_LOC_RT, CurMech.GetLoadout().GetCrits(LocationIndex.MECH_LOC_RT), + points.GetCritRTPoints()); + DrawLocationCrits(graphics, LocationIndex.MECH_LOC_LT, CurMech.GetLoadout().GetCrits(LocationIndex.MECH_LOC_LT), + points.GetCritLTPoints()); + DrawLocationCrits(graphics, LocationIndex.MECH_LOC_RA, CurMech.GetLoadout().GetCrits(LocationIndex.MECH_LOC_RA), + points.GetCritRAPoints()); + DrawLocationCrits(graphics, LocationIndex.MECH_LOC_LA, CurMech.GetLoadout().GetCrits(LocationIndex.MECH_LOC_LA), + points.GetCritLAPoints()); + DrawLocationCrits(graphics, LocationIndex.MECH_LOC_RL, CurMech.GetLoadout().GetCrits(LocationIndex.MECH_LOC_RL), + points.GetCritRLPoints()); + DrawLocationCrits(graphics, LocationIndex.MECH_LOC_LL, CurMech.GetLoadout().GetCrits(LocationIndex.MECH_LOC_LL), + points.GetCritLLPoints()); } - private void DrawLocationCrits( Graphics2D graphics, int Location, abPlaceable[] a, Point[] p ) { + private void DrawLocationCrits(Graphics2D graphics, int Location, abPlaceable[] a, Point[] p) { String Case = FileCommon.HasCase(CurMech, Location); - if (!Case.isEmpty()) DrawNonCritable( graphics, "("+Case+")", p[p.length-1].x, p[p.length-1].y ); - for( int i = 0; i < a.length && i < p.length; i++ ) { + if (!Case.isEmpty()) + DrawNonCritable(graphics, "(" + Case + ")", p[p.length - 1].x, p[p.length - 1].y); + for (int i = 0; i < a.length && i < p.length; i++) { abPlaceable Current = a[i]; - if( a[i].NumCrits() > 1 && a[i].Contiguous() &! ( a[i] instanceof Engine ) &! ( a[i] instanceof Gyro ) ) { + if (a[i].NumCrits() > 1 && a[i].Contiguous() & !(a[i] instanceof Engine) & !(a[i] instanceof Gyro)) { // print the multi-slot indicator before the item int j = i; int End = Current.NumCrits() + j; - if( Current.CanSplit() ) { - int[] check = CurMech.GetLoadout().FindInstances( Current ); + if (Current.CanSplit()) { + int[] check = CurMech.GetLoadout().FindInstances(Current); End = check[Location] + j; } - if( End > a.length ) { + if (End > a.length) { End = a.length - 1; } - for( ; j < End; j++ ) { - if( j == i ) { + for (; j < End; j++) { + if (j == i) { // starting out - graphics.drawLine( p[j].x, p[j].y - 3, p[j].x + 2, p[j].y - 3 ); - graphics.drawLine( p[j].x, p[j].y - 3, p[j].x, p[j].y ); - if( a[j].IsArmored() ) { - graphics.drawOval( p[j].x + 3, p[j].y - 5, 5, 5 ); - graphics.drawString( PrintConsts.GetPrintName( a[j], CurMech.GetLoadout().GetTechBase(), Current.PrintName() ), p[j].x + 10, p[j].y ); + graphics.drawLine(p[j].x, p[j].y - 3, p[j].x + 2, p[j].y - 3); + graphics.drawLine(p[j].x, p[j].y - 3, p[j].x, p[j].y); + if (a[j].IsArmored()) { + graphics.drawOval(p[j].x + 3, p[j].y - 5, 5, 5); + graphics.drawString(PrintConsts.GetPrintName(a[j], CurMech.GetLoadout().GetTechBase(), + Current.PrintName()), p[j].x + 10, p[j].y); } else { - graphics.drawString( PrintConsts.GetPrintName( a[j], CurMech.GetLoadout().GetTechBase(), Current.PrintName() ), p[j].x + 3, p[j].y ); + graphics.drawString(PrintConsts.GetPrintName(a[j], CurMech.GetLoadout().GetTechBase(), + Current.PrintName()), p[j].x + 3, p[j].y); } - } else if( j == End - 1 ) { + } else if (j == End - 1) { // end the line - graphics.drawLine( p[j].x, p[j].y - 2, p[j].x + 2, p[j].y - 2 ); - graphics.drawLine( p[j].x, p[j].y - 2, p[j].x, p[j-1].y ); - if( a[j].IsArmored() ) { - graphics.drawOval( p[j].x + 3, p[j].y - 5, 5, 5 ); - graphics.drawString( PrintConsts.GetPrintName( a[j], CurMech.GetLoadout().GetTechBase(), Current.PrintName() ), p[j].x + 10, p[j].y ); + graphics.drawLine(p[j].x, p[j].y - 2, p[j].x + 2, p[j].y - 2); + graphics.drawLine(p[j].x, p[j].y - 2, p[j].x, p[j - 1].y); + if (a[j].IsArmored()) { + graphics.drawOval(p[j].x + 3, p[j].y - 5, 5, 5); + graphics.drawString(PrintConsts.GetPrintName(a[j], CurMech.GetLoadout().GetTechBase(), + Current.PrintName()), p[j].x + 10, p[j].y); } else { - graphics.drawString( PrintConsts.GetPrintName( a[j], CurMech.GetLoadout().GetTechBase(), Current.PrintName() ), p[j].x + 3, p[j].y ); + graphics.drawString(PrintConsts.GetPrintName(a[j], CurMech.GetLoadout().GetTechBase(), + Current.PrintName()), p[j].x + 3, p[j].y); } } else { // continue the line - graphics.drawLine( p[j].x, p[j].y, p[j].x, p[j-1].y ); - if( a[j].IsArmored() ) { - graphics.drawOval( p[j].x + 3, p[j].y - 5, 5, 5 ); - graphics.drawString( PrintConsts.GetPrintName( a[j], CurMech.GetLoadout().GetTechBase(), Current.PrintName() ), p[j].x + 10, p[j].y ); + graphics.drawLine(p[j].x, p[j].y, p[j].x, p[j - 1].y); + if (a[j].IsArmored()) { + graphics.drawOval(p[j].x + 3, p[j].y - 5, 5, 5); + graphics.drawString(PrintConsts.GetPrintName(a[j], CurMech.GetLoadout().GetTechBase(), + Current.PrintName()), p[j].x + 10, p[j].y); } else { - graphics.drawString( PrintConsts.GetPrintName( a[j], CurMech.GetLoadout().GetTechBase(), Current.PrintName() ), p[j].x + 3, p[j].y ); + graphics.drawString(PrintConsts.GetPrintName(a[j], CurMech.GetLoadout().GetTechBase(), + Current.PrintName()), p[j].x + 3, p[j].y); } } } i = j - 1; } else { // single slot item - if( ! a[i].IsCritable() ) { - DrawNonCritable( graphics, PrintConsts.GetPrintName( a[i], CurMech.GetLoadout().GetTechBase(), Current.PrintName() ), p[i].x + 3, p[i].y ); + if (!a[i].IsCritable()) { + DrawNonCritable(graphics, + PrintConsts.GetPrintName(a[i], CurMech.GetLoadout().GetTechBase(), Current.PrintName()), + p[i].x + 3, p[i].y); } else { - if( a[i].IsArmored() ) { - graphics.drawOval( p[i].x, p[i].y - 5, 5, 5 ); - graphics.drawString( PrintConsts.GetPrintName( a[i], CurMech.GetLoadout().GetTechBase(), Current.PrintName() ), p[i].x + 7, p[i].y ); - } else if( a[i] instanceof Ammunition ) { - graphics.drawString( FileCommon.FormatAmmoPrintName( (Ammunition) a[i], 1, TRO, makeAmmoGeneric ), p[i].x + 3, p[i].y ); + if (a[i].IsArmored()) { + graphics.drawOval(p[i].x, p[i].y - 5, 5, 5); + graphics.drawString( + PrintConsts.GetPrintName(a[i], CurMech.GetLoadout().GetTechBase(), Current.PrintName()), + p[i].x + 7, p[i].y); + } else if (a[i] instanceof Ammunition) { + graphics.drawString(FileCommon.FormatAmmoPrintName((Ammunition) a[i], 1, TRO, makeAmmoGeneric), + p[i].x + 3, p[i].y); } else { - graphics.drawString( PrintConsts.GetPrintName( a[i], CurMech.GetLoadout().GetTechBase(), Current.PrintName() ), p[i].x + 3, p[i].y ); + graphics.drawString( + PrintConsts.GetPrintName(a[i], CurMech.GetLoadout().GetTechBase(), Current.PrintName()), + p[i].x + 3, p[i].y); } - //Add 10 circles for mod armor! - if ( a[i].CritName().equals("Modular Armor") ) { - DrawNonCritable(graphics, "00000", p[i].x+51, p[i].y - 3); - DrawNonCritable(graphics, "00000", p[i].x+51, p[i].y + 3); + // Add 10 circles for mod armor! + if (a[i].CritName().equals("Modular Armor")) { + DrawNonCritable(graphics, "00000", p[i].x + 51, p[i].y - 3); + DrawNonCritable(graphics, "00000", p[i].x + 51, p[i].y + 3); } } } } } - private void DrawNonCritable( Graphics2D graphics, String Item, int X, int Y ) { + private void DrawNonCritable(Graphics2D graphics, String Item, int X, int Y) { // save the old font Font OldFont = graphics.getFont(); - graphics.setFont( PrintConsts.NonCritFont ); - if ( !TRO ) { - graphics.setColor( Color.DARK_GRAY ); + graphics.setFont(PrintConsts.NonCritFont); + if (!TRO) { + graphics.setColor(Color.DARK_GRAY); } - graphics.drawString( Item, X, Y ); - graphics.setFont( OldFont ); - graphics.setColor( Color.BLACK ); + graphics.drawString(Item, X, Y); + graphics.setFont(OldFont); + graphics.setColor(Color.BLACK); } private int TotalItemLines() { int TotItems = Items.size(); - for ( PlaceableInfo item : Items ) { - if ( item.name2.length() > 0 ) { TotItems += 1;} - if ( item.specials.replace("-", "").length() > 0 ) { TotItems += 1;} + for (PlaceableInfo item : Items) { + if (item.name2.length() > 0) { + TotItems += 1; + } + if (item.specials.replace("-", "").length() > 0) { + TotItems += 1; + } } return TotItems; } - private void DrawMechData( Graphics2D graphics ) { + private void DrawMechData(Graphics2D graphics) { Point[] p = null; - //ArrayList a = SortEquipmentByLocation(); + // ArrayList a = SortEquipmentByLocation(); p = points.GetWeaponChartPoints(); - //Range TH Modifiers -// if ( !TRO ) { -// graphics.setFont( PrintConsts.CrazyTinyFont); -// graphics.drawString("+0", p[6].x, p[6].y-15); -// graphics.drawString("+2", p[7].x, p[7].y-15); -// graphics.drawString("+4", p[8].x, p[8].y-15); -// } - - graphics.setFont( PrintConsts.ReallySmallFont ); - if (TotalItemLines() > 15) { graphics.setFont( PrintConsts.TinyFont ); } - if (TotalItemLines() >= 20) { graphics.setFont( PrintConsts.CrazyTinyFont); } - int offset = 0, - xoffset = 0; + // Range TH Modifiers + // if ( !TRO ) { + // graphics.setFont( PrintConsts.CrazyTinyFont); + // graphics.drawString("+0", p[6].x, p[6].y-15); + // graphics.drawString("+2", p[7].x, p[7].y-15); + // graphics.drawString("+4", p[8].x, p[8].y-15); + // } + + graphics.setFont(PrintConsts.ReallySmallFont); + if (TotalItemLines() > 15) { + graphics.setFont(PrintConsts.TinyFont); + } + if (TotalItemLines() >= 20) { + graphics.setFont(PrintConsts.CrazyTinyFont); + } + int offset = 0, xoffset = 0; - //Coverup the (hexes) above the ranges if we are not using traditional measurements - if (useMiniConvRate) - { + // Coverup the (hexes) above the ranges if we are not using traditional + // measurements + if (useMiniConvRate) { graphics.setColor(Color.white); - graphics.fillRect(p[6].x-5, p[6].y-28, 30, 10); + graphics.fillRect(p[6].x - 5, p[6].y - 28, 30, 10); graphics.setColor(Color.black); } - - for ( PlaceableInfo item : Items ) { + + for (PlaceableInfo item : Items) { xoffset = 0; - graphics.drawString( item.Count + "", p[0].x+1, p[0].y + offset ); - graphics.drawString( item.name, p[1].x-3, p[1].y + offset ); - graphics.drawString( item.locName, p[2].x, p[2].y + offset ); - graphics.drawString( item.heat, p[3].x, p[3].y + offset ); - if ( item.damage.length() > 3 ) xoffset = (int)Math.ceil(item.damage.length()); - graphics.drawString( item.damage, p[4].x - xoffset, p[4].y + offset ); - graphics.drawString( item.min, p[5].x, p[5].y + offset ); - graphics.drawString( item.rShort, p[6].x, p[6].y + offset ); - graphics.drawString( item.rMed, p[7].x, p[7].y + offset ); - graphics.drawString( item.rLong, p[8].x, p[8].y + offset ); + graphics.drawString(item.Count + "", p[0].x + 1, p[0].y + offset); + graphics.drawString(item.name, p[1].x - 3, p[1].y + offset); + graphics.drawString(item.locName, p[2].x, p[2].y + offset); + graphics.drawString(item.heat, p[3].x, p[3].y + offset); + if (item.damage.length() > 3) + xoffset = (int) Math.ceil(item.damage.length()); + graphics.drawString(item.damage, p[4].x - xoffset, p[4].y + offset); + graphics.drawString(item.min, p[5].x, p[5].y + offset); + graphics.drawString(item.rShort, p[6].x, p[6].y + offset); + graphics.drawString(item.rMed, p[7].x, p[7].y + offset); + graphics.drawString(item.rLong, p[8].x, p[8].y + offset); offset += graphics.getFont().getSize(); // check to see now if we need to print our special codes or more of the name - if ( (item.specials.replace("-", "").length() > 0) || (item.name2.length() > 0) ) { + if ((item.specials.replace("-", "").length() > 0) || (item.name2.length() > 0)) { int lineoffset = 0; - if ( item.name2.length() > 0 ) { - graphics.drawString( item.name2, p[1].x, p[1].y + offset ); + if (item.name2.length() > 0) { + graphics.drawString(item.name2, p[1].x, p[1].y + offset); lineoffset = graphics.getFont().getSize(); } - if ( item.specials.replace("-", "").length() > 0 ) { - xoffset = (int)Math.ceil(item.specials.length()); - graphics.drawString( item.specials, p[4].x - xoffset, p[4].y + offset ); + if (item.specials.replace("-", "").length() > 0) { + xoffset = (int) Math.ceil(item.specials.length()); + graphics.drawString(item.specials, p[4].x - xoffset, p[4].y + offset); lineoffset = graphics.getFont().getSize(); } offset += lineoffset; @@ -460,9 +495,9 @@ private void DrawMechData( Graphics2D graphics ) { offset += 2; } - //Output the list of Ammunition - if ( !TRO ) { - if ( AmmoList.size() > 0 ) { + // Output the list of Ammunition + if (!TRO) { + if (AmmoList.size() > 0) { offset += 2; graphics.drawString("Ammunition Type", p[0].x, p[0].y + offset); graphics.drawString("Rounds", p[3].x, p[3].y + offset); @@ -470,143 +505,177 @@ private void DrawMechData( Graphics2D graphics ) { graphics.drawLine(p[0].x, p[0].y + offset, p[8].x + 8, p[8].y + offset); offset += graphics.getFont().getSize(); } - for ( int index=0; index < AmmoList.size(); index++ ) { + for (int index = 0; index < AmmoList.size(); index++) { AmmoData CurAmmo = (AmmoData) AmmoList.get(index); - graphics.drawString( CurAmmo.Format(), p[0].x, p[0].y + offset); - graphics.drawString( CurAmmo.LotSize + "", p[3].x, p[3].y + offset); + graphics.drawString(CurAmmo.Format(), p[0].x, p[0].y + offset); + graphics.drawString(CurAmmo.LotSize + "", p[3].x, p[3].y + offset); offset += graphics.getFont().getSize(); } } - graphics.setFont( PrintConsts.DesignNameFont ); + graphics.setFont(PrintConsts.DesignNameFont); p = points.GetDataChartPoints(); - graphics.drawString( CurMech.GetFullName(), p[PrintConsts.MECHNAME].x, p[PrintConsts.MECHNAME].y ); - -// //Movement Heat -// if ( !TRO ) { -// graphics.setFont(PrintConsts.CrazyTinyFont); -// graphics.drawString("1", p[PrintConsts.WALKMP].x-14, p[PrintConsts.WALKMP].y+1); -// graphics.drawString("2", p[PrintConsts.RUNMP].x-14, p[PrintConsts.RUNMP].y+1); -// graphics.drawString("" + CurMech.GetJumpingHeat(), p[PrintConsts.JUMPMP].x-12, p[PrintConsts.JUMPMP].y+1); -// } + graphics.drawString(CurMech.GetFullName(), p[PrintConsts.MECHNAME].x, p[PrintConsts.MECHNAME].y); + + // //Movement Heat + // if ( !TRO ) { + // graphics.setFont(PrintConsts.CrazyTinyFont); + // graphics.drawString("1", p[PrintConsts.WALKMP].x-14, + // p[PrintConsts.WALKMP].y+1); + // graphics.drawString("2", p[PrintConsts.RUNMP].x-14, + // p[PrintConsts.RUNMP].y+1); + // graphics.drawString("" + CurMech.GetJumpingHeat(), + // p[PrintConsts.JUMPMP].x-12, p[PrintConsts.JUMPMP].y+1); + // } // have to hack the movement to print the correct stuff here. - graphics.setFont( PrintConsts.Small8Font ); - if( CurMech.GetAdjustedWalkingMP( false, true ) != CurMech.GetWalkingMP() ) { - graphics.drawString( ( CurMech.GetWalkingMP() * MiniConvRate ) + " (" + ( CurMech.GetAdjustedWalkingMP( false, true ) * MiniConvRate ) + ")", p[PrintConsts.WALKMP].x, p[PrintConsts.WALKMP].y ); + graphics.setFont(PrintConsts.Small8Font); + if (CurMech.GetAdjustedWalkingMP(false, true) != CurMech.GetWalkingMP()) { + graphics.drawString( + (CurMech.GetWalkingMP() * MiniConvRate) + " (" + + (CurMech.GetAdjustedWalkingMP(false, true) * MiniConvRate) + ")", + p[PrintConsts.WALKMP].x, p[PrintConsts.WALKMP].y); } else { - graphics.drawString( ( CurMech.GetWalkingMP() * MiniConvRate ) + "", p[PrintConsts.WALKMP].x, p[PrintConsts.WALKMP].y ); + graphics.drawString((CurMech.GetWalkingMP() * MiniConvRate) + "", p[PrintConsts.WALKMP].x, + p[PrintConsts.WALKMP].y); } - if( CurMech.GetAdjustedRunningMP( false, true ) != CurMech.GetRunningMP() ) { - if( CurMech.GetAdjustedRunningMP( false, true ) < CurMech.GetRunningMP() ) { - graphics.drawString( CurMech.GetAdjustedRunningMP( false, true, MiniConvRate ) + "", p[PrintConsts.RUNMP].x, p[PrintConsts.RUNMP].y ); + if (CurMech.GetAdjustedRunningMP(false, true) != CurMech.GetRunningMP()) { + if (CurMech.GetAdjustedRunningMP(false, true) < CurMech.GetRunningMP()) { + graphics.drawString(CurMech.GetAdjustedRunningMP(false, true, MiniConvRate) + "", + p[PrintConsts.RUNMP].x, p[PrintConsts.RUNMP].y); } else { - graphics.drawString( CurMech.GetRunningMP( MiniConvRate ) + " (" + CurMech.GetAdjustedRunningMP( false, true, MiniConvRate ) + ")", p[PrintConsts.RUNMP].x, p[PrintConsts.RUNMP].y ); + graphics.drawString( + CurMech.GetRunningMP(MiniConvRate) + " (" + + CurMech.GetAdjustedRunningMP(false, true, MiniConvRate) + ")", + p[PrintConsts.RUNMP].x, p[PrintConsts.RUNMP].y); } } else { - graphics.drawString( CurMech.GetRunningMP( MiniConvRate ) + "", p[PrintConsts.RUNMP].x, p[PrintConsts.RUNMP].y ); + graphics.drawString(CurMech.GetRunningMP(MiniConvRate) + "", p[PrintConsts.RUNMP].x, + p[PrintConsts.RUNMP].y); } - //Jumping Movement! + // Jumping Movement! String JumpMP = ""; - if ( CurMech.GetJumpJets().GetNumJJ() > 0 ) + if (CurMech.GetJumpJets().GetNumJJ() > 0) JumpMP += (CurMech.GetJumpJets().GetNumJJ() * MiniConvRate) + ""; - if ( CurMech.GetAdjustedJumpingMP( false ) != CurMech.GetJumpJets().GetNumJJ() ) - JumpMP += " (" + ( CurMech.GetAdjustedJumpingMP( false ) * MiniConvRate ) + ")"; + if (CurMech.GetAdjustedJumpingMP(false) != CurMech.GetJumpJets().GetNumJJ()) + JumpMP += " (" + (CurMech.GetAdjustedJumpingMP(false) * MiniConvRate) + ")"; - if ( CurMech.GetJumpBoosterMP() > 0 ) - { - if ( JumpMP.trim().length() > 0 ) JumpMP += " / "; + if (CurMech.GetJumpBoosterMP() > 0) { + if (JumpMP.trim().length() > 0) + JumpMP += " / "; JumpMP += CurMech.GetJumpBoosterMP() * MiniConvRate; } - if ( CurMech.GetAdjustedBoosterMP(false) != CurMech.GetJumpBoosterMP() ) - JumpMP += " (" + (CurMech.GetAdjustedBoosterMP(false) * MiniConvRate ) + ")"; + if (CurMech.GetAdjustedBoosterMP(false) != CurMech.GetJumpBoosterMP()) + JumpMP += " (" + (CurMech.GetAdjustedBoosterMP(false) * MiniConvRate) + ")"; + + if (JumpMP.isEmpty()) + JumpMP = "0"; + if (CurMech.GetJumpJets().IsImproved()) + JumpMP += " IMP"; + if (CurMech.GetJumpJets().IsUMU()) + JumpMP += " UMU"; - if (JumpMP.isEmpty()) JumpMP = "0"; - if ( CurMech.GetJumpJets().IsImproved() ) JumpMP += " IMP"; - if ( CurMech.GetJumpJets().IsUMU() ) JumpMP += " UMU"; + graphics.drawString(JumpMP, p[PrintConsts.JUMPMP].x, p[PrintConsts.JUMPMP].y); - graphics.drawString( JumpMP, p[PrintConsts.JUMPMP].x, p[PrintConsts.JUMPMP].y ); - // end hacking of movement. - //Tonnage - graphics.drawString( CurMech.GetTonnage() + "", p[PrintConsts.TONNAGE].x, p[PrintConsts.TONNAGE].y ); + // Tonnage + graphics.drawString(CurMech.GetTonnage() + "", p[PrintConsts.TONNAGE].x, p[PrintConsts.TONNAGE].y); - //Cost - graphics.setFont( PrintConsts.SmallFont ); + // Cost + graphics.setFont(PrintConsts.SmallFont); - graphics.drawString( String.format("%1$,.0f C-Bills", CurMech.GetDryCost()), p[PrintConsts.COST].x, p[PrintConsts.COST].y ); - graphics.drawString( String.format("+%1$,.0f (ammo)", CurMech.GetAmmoCosts()), p[PrintConsts.AMMO].x, p[PrintConsts.AMMO].y); + graphics.drawString(String.format("%1$,.0f C-Bills", CurMech.GetDryCost()), p[PrintConsts.COST].x, + p[PrintConsts.COST].y); + graphics.drawString(String.format("+%1$,.0f (ammo)", CurMech.GetAmmoCosts()), p[PrintConsts.AMMO].x, + p[PrintConsts.AMMO].y); - //BV - if ( !TRO ) { - if ( Gunnery == 4 && Piloting == 5 ) - graphics.drawString( String.format( "%1$,d", CurMech.GetCurrentBV() ), p[PrintConsts.BV2].x, p[PrintConsts.BV2].y ); + // BV + if (!TRO) { + if (Gunnery == 4 && Piloting == 5) + graphics.drawString(String.format("%1$,d", CurMech.GetCurrentBV()), p[PrintConsts.BV2].x, + p[PrintConsts.BV2].y); else - graphics.drawString( String.format( "%1$,.0f (Base: %2$,d)", BV, CurMech.GetCurrentBV() ), p[PrintConsts.BV2].x, p[PrintConsts.BV2].y ); - graphics.drawString( "Weapon Heat (" + CurMech.GetWeaponHeat(false, false, true, false) + ")", p[PrintConsts.MAX_HEAT].x-1, p[PrintConsts.MAX_HEAT].y-7 ); - graphics.drawString( "Dissipation (" + CurMech.GetHeatSinks().TotalDissipation() + ")", p[PrintConsts.MAX_HEAT].x-1, p[PrintConsts.MAX_HEAT].y+1 ); - //graphics.drawString( "Weapon Heat (" + CurMech.GetWeaponHeat(false, false, true, false) + ")", p[PrintConsts.MAX_HEAT].x-1, p[PrintConsts.MAX_HEAT].y ); - graphics.setFont( PrintConsts.SmallFont ); - - // The Armor Pts text should be placed just a bit higher on the sheet if using a right arm shield + graphics.drawString(String.format("%1$,.0f (Base: %2$,d)", BV, CurMech.GetCurrentBV()), + p[PrintConsts.BV2].x, p[PrintConsts.BV2].y); + graphics.drawString("Weapon Heat (" + CurMech.GetWeaponHeat(false, false, true, false) + ")", + p[PrintConsts.MAX_HEAT].x - 1, p[PrintConsts.MAX_HEAT].y - 7); + graphics.drawString("Dissipation (" + CurMech.GetHeatSinks().TotalDissipation() + ")", + p[PrintConsts.MAX_HEAT].x - 1, p[PrintConsts.MAX_HEAT].y + 1); + // graphics.drawString( "Weapon Heat (" + CurMech.GetWeaponHeat(false, false, + // true, false) + ")", p[PrintConsts.MAX_HEAT].x-1, p[PrintConsts.MAX_HEAT].y ); + graphics.setFont(PrintConsts.SmallFont); + + // The Armor Pts text should be placed just a bit higher on the sheet if using a + // right arm shield if (CurMech.HasRAShield() == true) - graphics.drawString( "Armor Pts: " + CurMech.GetArmor().GetArmorValue(), p[PrintConsts.TOTAL_ARMOR].x-8, p[PrintConsts.TOTAL_ARMOR].y+0 ); - else - graphics.drawString( "Armor Pts: " + CurMech.GetArmor().GetArmorValue(), p[PrintConsts.TOTAL_ARMOR].x-8, p[PrintConsts.TOTAL_ARMOR].y+16 ); - - graphics.setFont( PrintConsts.BoldFont ); + graphics.drawString("Armor Pts: " + CurMech.GetArmor().GetArmorValue(), + p[PrintConsts.TOTAL_ARMOR].x - 8, p[PrintConsts.TOTAL_ARMOR].y + 0); + else + graphics.drawString("Armor Pts: " + CurMech.GetArmor().GetArmorValue(), + p[PrintConsts.TOTAL_ARMOR].x - 8, p[PrintConsts.TOTAL_ARMOR].y + 16); + + graphics.setFont(PrintConsts.BoldFont); } else { - graphics.drawString( String.format( "%1$,d", CurMech.GetCurrentBV() ), p[PrintConsts.BV2].x, p[PrintConsts.BV2].y ); - } - - //Mechwarrior - graphics.setFont( PrintConsts.PlainFont ); - if ( TRO ) { - graphics.setFont( PrintConsts.BoldFont ); - graphics.drawLine(p[PrintConsts.PILOT_NAME].x+1, p[PrintConsts.PILOT_NAME].y+1, p[PrintConsts.PILOT_NAME].x + 107, p[PrintConsts.PILOT_NAME].y+1); - graphics.drawLine(p[PrintConsts.PILOT_GUN].x, p[PrintConsts.PILOT_GUN].y+1, p[PrintConsts.PILOT_GUN].x + 14, p[PrintConsts.PILOT_GUN].y+1); - graphics.drawLine(p[PrintConsts.PILOT_PILOT].x-4, p[PrintConsts.PILOT_PILOT].y+1, p[PrintConsts.PILOT_PILOT].x + 10, p[PrintConsts.PILOT_PILOT].y+1); - } else if( PrintPilot ) { - graphics.setFont( PrintConsts.SmallFont ); - if ( !GroupName.replace("[]", "").isEmpty() ) { - graphics.drawString( PilotName, p[PrintConsts.PILOT_NAME].x, p[PrintConsts.PILOT_NAME].y-4 ); - graphics.drawString( GroupName.replace("[]", ""), p[PrintConsts.PILOT_NAME].x, p[PrintConsts.PILOT_NAME].y+3 ); + graphics.drawString(String.format("%1$,d", CurMech.GetCurrentBV()), p[PrintConsts.BV2].x, + p[PrintConsts.BV2].y); + } + + // Mechwarrior + graphics.setFont(PrintConsts.PlainFont); + if (TRO) { + graphics.setFont(PrintConsts.BoldFont); + graphics.drawLine(p[PrintConsts.PILOT_NAME].x + 1, p[PrintConsts.PILOT_NAME].y + 1, + p[PrintConsts.PILOT_NAME].x + 107, p[PrintConsts.PILOT_NAME].y + 1); + graphics.drawLine(p[PrintConsts.PILOT_GUN].x, p[PrintConsts.PILOT_GUN].y + 1, + p[PrintConsts.PILOT_GUN].x + 14, p[PrintConsts.PILOT_GUN].y + 1); + graphics.drawLine(p[PrintConsts.PILOT_PILOT].x - 4, p[PrintConsts.PILOT_PILOT].y + 1, + p[PrintConsts.PILOT_PILOT].x + 10, p[PrintConsts.PILOT_PILOT].y + 1); + } else if (PrintPilot) { + graphics.setFont(PrintConsts.SmallFont); + if (!GroupName.replace("[]", "").isEmpty()) { + graphics.drawString(PilotName, p[PrintConsts.PILOT_NAME].x, p[PrintConsts.PILOT_NAME].y - 4); + graphics.drawString(GroupName.replace("[]", ""), p[PrintConsts.PILOT_NAME].x, + p[PrintConsts.PILOT_NAME].y + 3); } else { - graphics.drawString( PilotName, p[PrintConsts.PILOT_NAME].x, p[PrintConsts.PILOT_NAME].y ); + graphics.drawString(PilotName, p[PrintConsts.PILOT_NAME].x, p[PrintConsts.PILOT_NAME].y); } - graphics.setFont( PrintConsts.PlainFont ); - graphics.drawString( Gunnery + "", p[PrintConsts.PILOT_GUN].x, p[PrintConsts.PILOT_GUN].y ); - graphics.drawString( Piloting + "", p[PrintConsts.PILOT_PILOT].x, p[PrintConsts.PILOT_PILOT].y ); + graphics.setFont(PrintConsts.PlainFont); + graphics.drawString(Gunnery + "", p[PrintConsts.PILOT_GUN].x, p[PrintConsts.PILOT_GUN].y); + graphics.drawString(Piloting + "", p[PrintConsts.PILOT_PILOT].x, p[PrintConsts.PILOT_PILOT].y); } // check boxes - graphics.setFont( PrintConsts.PlainFont ); + graphics.setFont(PrintConsts.PlainFont); String temp; - temp = CommonTools.GetTechbaseString( CurMech.GetLoadout().GetTechBase() ); - graphics.drawString( temp, p[PrintConsts.TECH_IS].x, p[PrintConsts.TECH_IS].y ); + temp = CommonTools.GetTechbaseString(CurMech.GetLoadout().GetTechBase()); + graphics.drawString(temp, p[PrintConsts.TECH_IS].x, p[PrintConsts.TECH_IS].y); - graphics.drawString( CurMech.GetYear() + "", p[PrintConsts.TECH_IS].x, p[PrintConsts.TECH_IS].y + 10 ); + graphics.drawString(CurMech.GetYear() + "", p[PrintConsts.TECH_IS].x, p[PrintConsts.TECH_IS].y + 10); - //Armor Information when not Standard - if ( !CurMech.GetArmor().CritName().contains("Standard") ) { - //Armor Type - graphics.setFont( PrintConsts.SmallFont ); - if ( CurMech.IsQuad() ) { graphics.setFont( PrintConsts.XtraSmallFont ); } + // Armor Information when not Standard + if (!CurMech.GetArmor().CritName().contains("Standard")) { + // Armor Type + graphics.setFont(PrintConsts.SmallFont); + if (CurMech.IsQuad()) { + graphics.setFont(PrintConsts.XtraSmallFont); + } - int baseX = points.GetArmorInfoPoints()[LocationIndex.MECH_LOC_CT].x-5; + int baseX = points.GetArmorInfoPoints()[LocationIndex.MECH_LOC_CT].x - 5; int baseY = points.GetArmorInfoPoints()[LocationIndex.MECH_LOC_CT].y + 20; - if ( CurMech.GetArmor().RequiresExtraRules() ) { - graphics.setFont( PrintConsts.SmallBoldFont ); - if ( CurMech.IsQuad() ) { graphics.setFont( PrintConsts.XtraSmallBoldFont ); } + if (CurMech.GetArmor().RequiresExtraRules()) { + graphics.setFont(PrintConsts.SmallBoldFont); + if (CurMech.IsQuad()) { + graphics.setFont(PrintConsts.XtraSmallBoldFont); + } } - //When Patchwork, display the type of armor - if ( CurMech.GetArmor().CritName().equals("Patchwork") ) { + // When Patchwork, display the type of armor + if (CurMech.GetArmor().CritName().equals("Patchwork")) { ArrayList armorTypes = new ArrayList(); armorTypes.add(LocationIndex.MECH_LOC_HD, CurMech.GetArmor().GetHDArmorType()); armorTypes.add(LocationIndex.MECH_LOC_CT, CurMech.GetArmor().GetCTArmorType()); @@ -620,104 +689,101 @@ private void DrawMechData( Graphics2D graphics ) { armorTypes.add(LocationIndex.MECH_LOC_LTR, CurMech.GetArmor().GetLTArmorType()); armorTypes.add(LocationIndex.MECH_LOC_RTR, CurMech.GetArmor().GetRTArmorType()); - for ( int index = 0; index <= armorTypes.size()-1; index++ ) { - graphics.drawString(armorTypes.get(index).AbbrevName(), points.GetArmorInfoPoints()[index].x, points.GetArmorInfoPoints()[index].y+7); + for (int index = 0; index <= armorTypes.size() - 1; index++) { + graphics.drawString(armorTypes.get(index).AbbrevName(), points.GetArmorInfoPoints()[index].x, + points.GetArmorInfoPoints()[index].y + 7); } } - String[] parts = PrintConsts.wrapText(CurMech.GetArmor().CritName().trim(), 8, true); //CurMech.GetArmor().CritName().trim().split(" "); - for (String part: parts) { - if ( !part.trim().isEmpty() ) { - //int xCoord = baseX - ((part.trim().length() / 2) * 3); - graphics.drawString( part, baseX - part.trim().length(), baseY ); + String[] parts = PrintConsts.wrapText(CurMech.GetArmor().CritName().trim(), 8, true); // CurMech.GetArmor().CritName().trim().split(" + // "); + for (String part : parts) { + if (!part.trim().isEmpty()) { + // int xCoord = baseX - ((part.trim().length() / 2) * 3); + graphics.drawString(part, baseX - part.trim().length(), baseY); baseY += graphics.getFont().getSize(); } } - graphics.setFont( PrintConsts.PlainFont ); + graphics.setFont(PrintConsts.PlainFont); } - //Internal Information when not Standard + // Internal Information when not Standard if (!CurMech.GetIntStruc().CritName().equals("Standard")) { - graphics.setFont( PrintConsts.XtraSmallFont ); - //if ( CurMech.IsQuad() ) { graphics.setFont( PrintConsts.XtraSmallFont ); } + graphics.setFont(PrintConsts.XtraSmallFont); + // if ( CurMech.IsQuad() ) { graphics.setFont( PrintConsts.XtraSmallFont ); } int baseX = points.GetInternalInfoPoints()[LocationIndex.MECH_LOC_CT].x; int baseY = points.GetInternalInfoPoints()[LocationIndex.MECH_LOC_CT].y + 15; if (CurMech.GetIntStruc().NumCrits() == 0) { String[] parts = PrintConsts.wrapText(CurMech.GetIntStruc().CritName().trim(), 8, true); - for (String part: parts) { - if ( !part.trim().isEmpty() ) { - graphics.drawString( part, baseX - part.trim().length(), baseY ); + for (String part : parts) { + if (!part.trim().isEmpty()) { + graphics.drawString(part, baseX - part.trim().length(), baseY); baseY += graphics.getFont().getSize(); } } - graphics.setFont( PrintConsts.PlainFont ); + graphics.setFont(PrintConsts.PlainFont); } } - if ( !TRO ) { - //Availability Codes - graphics.drawString(CurMech.GetAvailability().GetBestCombinedCode(), p[PrintConsts.TECH_IS].x, p[PrintConsts.TECH_IS].y+20); + if (!TRO) { + // Availability Codes + graphics.drawString(CurMech.GetAvailability().GetBestCombinedCode(), p[PrintConsts.TECH_IS].x, + p[PrintConsts.TECH_IS].y + 20); } - //heat sinks - Point startingPoint = new Point(507, 615), - currentPoint = (Point) startingPoint.clone(); + // heat sinks + Point startingPoint = new Point(507, 615), currentPoint = (Point) startingPoint.clone(); - int counter = 0, - ovalSize = 7, - spacer = 2; + int counter = 0, ovalSize = 7, spacer = 2; - graphics.setFont( PrintConsts.PlainFont ); + graphics.setFont(PrintConsts.PlainFont); offset = 4; String HS; - String heatSinkType = CurMech.GetHeatSinks().LookupName().split( " " )[0]; + String heatSinkType = CurMech.GetHeatSinks().LookupName().split(" ")[0]; int extraDHS = 0; boolean isProto = CurMech.GetHeatSinks().IsProtoDHS(); - ArrayList equipment = CurMech.GetLoadout().GetEquipment(); - - for (int i = 0; i < equipment.size(); i++){ - if (equipment.get(i) instanceof EquipmentProtoSuccWarsDoubleHeatSink){ + ArrayList equipment = CurMech.GetLoadout().GetEquipment(); + + for (int i = 0; i < equipment.size(); i++) { + if (equipment.get(i) instanceof EquipmentProtoSuccWarsDoubleHeatSink) { extraDHS += 1; - } else if (equipment.get(i) instanceof EquipmentProtoStarLeagueDoubleHeatSink){ + } else if (equipment.get(i) instanceof EquipmentProtoStarLeagueDoubleHeatSink) { extraDHS += 1; } } - - if (!isProto && extraDHS == 0) - { + + if (!isProto && extraDHS == 0) { // Standard heat sink setup HS = CurMech.GetHeatSinks().GetNumHS() + ""; - if ( CurMech.GetHeatSinks().TotalDissipation() > CurMech.GetHeatSinks().GetNumHS() ) { + if (CurMech.GetHeatSinks().TotalDissipation() > CurMech.GetHeatSinks().GetNumHS()) { HS += " (" + CurMech.GetHeatSinks().TotalDissipation() + ")"; offset = 0; } - if ( CurMech.GetHeatSinks().GetNumHS() > 10 && CurMech.GetHeatSinks().GetNumHS() <= 20 ) + if (CurMech.GetHeatSinks().GetNumHS() > 10 && CurMech.GetHeatSinks().GetNumHS() <= 20) currentPoint.x -= 4; - else if ( CurMech.GetHeatSinks().GetNumHS() > 20 ) + else if (CurMech.GetHeatSinks().GetNumHS() > 20) currentPoint.x -= 9; - for( int i = 0; i < CurMech.GetHeatSinks().GetNumHS(); i++ ) { + for (int i = 0; i < CurMech.GetHeatSinks().GetNumHS(); i++) { counter++; - graphics.drawOval( currentPoint.x, currentPoint.y, ovalSize, ovalSize ); + graphics.drawOval(currentPoint.x, currentPoint.y, ovalSize, ovalSize); currentPoint.y += ovalSize + spacer; - if ( counter >= 10 ) { + if (counter >= 10) { currentPoint.x += ovalSize + spacer; currentPoint.y = startingPoint.y; counter = 0; } } - } - else { + } else { int numberOfHS = CurMech.GetHeatSinks().GetNumHS(); int internalHS = CurMech.GetHeatSinks().InternalHeatSinks(); int singles; int doubles; - if (isProto) - { + if (isProto) { singles = numberOfHS < internalHS ? numberOfHS : internalHS; doubles = (numberOfHS - singles) + extraDHS; } else { @@ -735,14 +801,13 @@ else if ( CurMech.GetHeatSinks().GetNumHS() > 20 ) // Fill out the double heat sinks in rows for (int i = 0; i < doubles; i++) { - graphics.drawOval( currentPoint.x, currentPoint.y, ovalSize, ovalSize ); + graphics.drawOval(currentPoint.x, currentPoint.y, ovalSize, ovalSize); - if (++counter >= 4){ + if (++counter >= 4) { counter = 0; currentPoint.y += ovalSize + spacer; currentPoint.x = startingPoint.x; - } - else { + } else { currentPoint.x += ovalSize + spacer; } } @@ -750,8 +815,7 @@ else if ( CurMech.GetHeatSinks().GetNumHS() > 20 ) // Add one row of padding if (counter != 0) { currentPoint.y += (ovalSize + spacer) * 2; - } - else { + } else { currentPoint.y += ovalSize + spacer; } counter = 0; @@ -765,123 +829,161 @@ else if ( CurMech.GetHeatSinks().GetNumHS() > 20 ) // Fill out the standard heat sinks in rows for (int i = 0; i < singles; i++) { - graphics.drawOval( currentPoint.x, currentPoint.y, ovalSize, ovalSize ); + graphics.drawOval(currentPoint.x, currentPoint.y, ovalSize, ovalSize); - if (++counter >= 4){ + if (++counter >= 4) { counter = 0; currentPoint.y += ovalSize + spacer; currentPoint.x = startingPoint.x; - } - else { + } else { currentPoint.x += ovalSize + spacer; } } } graphics.setFont(PrintConsts.SmallFont); - //HS Number - graphics.drawString( HS, p[PrintConsts.HEATSINK_NUMBER].x + offset, p[PrintConsts.HEATSINK_NUMBER].y ); - //HS Type - graphics.drawString( heatSinkType, p[PrintConsts.HEATSINK_NUMBER].x+2, p[PrintConsts.HEATSINK_NUMBER].y + 8 ); - - //Gyro Circles - if ( CurMech.GetGyro().ActualName().equals("Heavy-Duty Gyro")) { - //Add another circle + // HS Number + graphics.drawString(HS, p[PrintConsts.HEATSINK_NUMBER].x + offset, p[PrintConsts.HEATSINK_NUMBER].y); + // HS Type + graphics.drawString(heatSinkType, p[PrintConsts.HEATSINK_NUMBER].x + 2, p[PrintConsts.HEATSINK_NUMBER].y + 8); + + // Gyro Circles + if (CurMech.GetGyro().ActualName().equals("Heavy-Duty Gyro")) { + // Add another circle graphics.drawOval(229, 587, 6, 6); } // internal information - graphics.setFont( PrintConsts.ReallySmallFont ); + graphics.setFont(PrintConsts.ReallySmallFont); p = points.GetInternalInfoPoints(); - graphics.drawString( "(" + CurMech.GetIntStruc().GetCTPoints() + ")", p[LocationIndex.MECH_LOC_CT].x, p[LocationIndex.MECH_LOC_CT].y ); - graphics.drawString( "(" + CurMech.GetIntStruc().GetSidePoints() + ")", p[LocationIndex.MECH_LOC_LT].x, p[LocationIndex.MECH_LOC_LT].y ); - graphics.drawString( "(" + CurMech.GetIntStruc().GetSidePoints() + ")", p[LocationIndex.MECH_LOC_RT].x, p[LocationIndex.MECH_LOC_RT].y ); - graphics.drawString( "(" + CurMech.GetIntStruc().GetArmPoints() + ")", p[LocationIndex.MECH_LOC_LA].x, p[LocationIndex.MECH_LOC_LA].y ); - graphics.drawString( "(" + CurMech.GetIntStruc().GetArmPoints() + ")", p[LocationIndex.MECH_LOC_RA].x, p[LocationIndex.MECH_LOC_RA].y ); - graphics.drawString( "(" + CurMech.GetIntStruc().GetLegPoints() + ")", p[LocationIndex.MECH_LOC_LL].x, p[LocationIndex.MECH_LOC_LL].y ); - graphics.drawString( "(" + CurMech.GetIntStruc().GetLegPoints() + ")", p[LocationIndex.MECH_LOC_RL].x, p[LocationIndex.MECH_LOC_RL].y ); + graphics.drawString("(" + CurMech.GetIntStruc().GetCTPoints() + ")", p[LocationIndex.MECH_LOC_CT].x, + p[LocationIndex.MECH_LOC_CT].y); + graphics.drawString("(" + CurMech.GetIntStruc().GetSidePoints() + ")", p[LocationIndex.MECH_LOC_LT].x, + p[LocationIndex.MECH_LOC_LT].y); + graphics.drawString("(" + CurMech.GetIntStruc().GetSidePoints() + ")", p[LocationIndex.MECH_LOC_RT].x, + p[LocationIndex.MECH_LOC_RT].y); + graphics.drawString("(" + CurMech.GetIntStruc().GetArmPoints() + ")", p[LocationIndex.MECH_LOC_LA].x, + p[LocationIndex.MECH_LOC_LA].y); + graphics.drawString("(" + CurMech.GetIntStruc().GetArmPoints() + ")", p[LocationIndex.MECH_LOC_RA].x, + p[LocationIndex.MECH_LOC_RA].y); + graphics.drawString("(" + CurMech.GetIntStruc().GetLegPoints() + ")", p[LocationIndex.MECH_LOC_LL].x, + p[LocationIndex.MECH_LOC_LL].y); + graphics.drawString("(" + CurMech.GetIntStruc().GetLegPoints() + ")", p[LocationIndex.MECH_LOC_RL].x, + p[LocationIndex.MECH_LOC_RL].y); // armor information p = points.GetArmorInfoPoints(); - graphics.drawString( "(" + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_HD ) + ")", p[LocationIndex.MECH_LOC_HD].x, p[LocationIndex.MECH_LOC_HD].y ); - graphics.drawString( "(" + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_CT ) + ")", p[LocationIndex.MECH_LOC_CT].x, p[LocationIndex.MECH_LOC_CT].y ); - graphics.drawString( "(" + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LT ) + ")", p[LocationIndex.MECH_LOC_LT].x, p[LocationIndex.MECH_LOC_LT].y ); - graphics.drawString( "(" + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RT ) + ")", p[LocationIndex.MECH_LOC_RT].x, p[LocationIndex.MECH_LOC_RT].y ); - graphics.drawString( "(" + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LA ) + ")", p[LocationIndex.MECH_LOC_LA].x, p[LocationIndex.MECH_LOC_LA].y ); - graphics.drawString( "(" + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RA ) + ")", p[LocationIndex.MECH_LOC_RA].x, p[LocationIndex.MECH_LOC_RA].y ); - graphics.drawString( "(" + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LL ) + ")", p[LocationIndex.MECH_LOC_LL].x, p[LocationIndex.MECH_LOC_LL].y ); - graphics.drawString( "(" + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RL ) + ")", p[LocationIndex.MECH_LOC_RL].x, p[LocationIndex.MECH_LOC_RL].y ); - graphics.drawString( "(" + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_CTR ) + ")", p[LocationIndex.MECH_LOC_CTR].x, p[LocationIndex.MECH_LOC_CTR].y ); - graphics.drawString( "(" + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LTR ) + ")", p[LocationIndex.MECH_LOC_LTR].x, p[LocationIndex.MECH_LOC_LTR].y ); - graphics.drawString( "(" + CurMech.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RTR ) + ")", p[LocationIndex.MECH_LOC_RTR].x, p[LocationIndex.MECH_LOC_RTR].y ); - if( CurMech.GetArmor().GetBAR() < 10 ) { - graphics.setFont( PrintConsts.XtraSmallFont ); - graphics.drawString( "BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_HD].x, p[LocationIndex.MECH_LOC_HD].y + 7 ); - graphics.drawString( "BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_CT].x - 5, p[LocationIndex.MECH_LOC_CT].y + 8 ); - graphics.drawString( "BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_LT].x - 4, p[LocationIndex.MECH_LOC_LT].y + 7 ); - graphics.drawString( "BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_RT].x - 4, p[LocationIndex.MECH_LOC_RT].y + 7 ); - graphics.drawString( "BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_LA].x - 4, p[LocationIndex.MECH_LOC_LA].y + 8 ); - graphics.drawString( "BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_RA].x - 5, p[LocationIndex.MECH_LOC_RA].y + 8 ); - graphics.drawString( "BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_LL].x - 4, p[LocationIndex.MECH_LOC_LL].y + 8 ); - graphics.drawString( "BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_RL].x - 4, p[LocationIndex.MECH_LOC_RL].y + 8 ); - graphics.drawString( "BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_CTR].x + 2, p[LocationIndex.MECH_LOC_CTR].y + 8 ); - graphics.drawString( "BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_LTR].x + 13, p[LocationIndex.MECH_LOC_LTR].y ); - graphics.drawString( "BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_RTR].x - 22, p[LocationIndex.MECH_LOC_RTR].y ); - graphics.setFont( PrintConsts.SmallFont ); - } - } - - private void DrawImages( Graphics2D graphics ) { - //PrintMech Image + graphics.drawString("(" + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_HD) + ")", + p[LocationIndex.MECH_LOC_HD].x, p[LocationIndex.MECH_LOC_HD].y); + graphics.drawString("(" + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_CT) + ")", + p[LocationIndex.MECH_LOC_CT].x, p[LocationIndex.MECH_LOC_CT].y); + graphics.drawString("(" + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LT) + ")", + p[LocationIndex.MECH_LOC_LT].x, p[LocationIndex.MECH_LOC_LT].y); + graphics.drawString("(" + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RT) + ")", + p[LocationIndex.MECH_LOC_RT].x, p[LocationIndex.MECH_LOC_RT].y); + graphics.drawString("(" + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LA) + ")", + p[LocationIndex.MECH_LOC_LA].x, p[LocationIndex.MECH_LOC_LA].y); + graphics.drawString("(" + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RA) + ")", + p[LocationIndex.MECH_LOC_RA].x, p[LocationIndex.MECH_LOC_RA].y); + graphics.drawString("(" + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LL) + ")", + p[LocationIndex.MECH_LOC_LL].x, p[LocationIndex.MECH_LOC_LL].y); + graphics.drawString("(" + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RL) + ")", + p[LocationIndex.MECH_LOC_RL].x, p[LocationIndex.MECH_LOC_RL].y); + graphics.drawString("(" + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_CTR) + ")", + p[LocationIndex.MECH_LOC_CTR].x, p[LocationIndex.MECH_LOC_CTR].y); + graphics.drawString("(" + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_LTR) + ")", + p[LocationIndex.MECH_LOC_LTR].x, p[LocationIndex.MECH_LOC_LTR].y); + graphics.drawString("(" + CurMech.GetArmor().GetLocationArmor(LocationIndex.MECH_LOC_RTR) + ")", + p[LocationIndex.MECH_LOC_RTR].x, p[LocationIndex.MECH_LOC_RTR].y); + if (CurMech.GetArmor().GetBAR() < 10) { + graphics.setFont(PrintConsts.XtraSmallFont); + graphics.drawString("BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_HD].x, + p[LocationIndex.MECH_LOC_HD].y + 7); + graphics.drawString("BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_CT].x - 5, + p[LocationIndex.MECH_LOC_CT].y + 8); + graphics.drawString("BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_LT].x - 4, + p[LocationIndex.MECH_LOC_LT].y + 7); + graphics.drawString("BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_RT].x - 4, + p[LocationIndex.MECH_LOC_RT].y + 7); + graphics.drawString("BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_LA].x - 4, + p[LocationIndex.MECH_LOC_LA].y + 8); + graphics.drawString("BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_RA].x - 5, + p[LocationIndex.MECH_LOC_RA].y + 8); + graphics.drawString("BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_LL].x - 4, + p[LocationIndex.MECH_LOC_LL].y + 8); + graphics.drawString("BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_RL].x - 4, + p[LocationIndex.MECH_LOC_RL].y + 8); + graphics.drawString("BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_CTR].x + 2, + p[LocationIndex.MECH_LOC_CTR].y + 8); + graphics.drawString("BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_LTR].x + 13, + p[LocationIndex.MECH_LOC_LTR].y); + graphics.drawString("BAR:" + CurMech.GetArmor().GetBAR(), p[LocationIndex.MECH_LOC_RTR].x - 22, + p[LocationIndex.MECH_LOC_RTR].y); + graphics.setFont(PrintConsts.SmallFont); + } + } + + /* + // Not used locally + private void DrawImages(Graphics2D graphics) { + // PrintMech Image Point start = points.GetMechImageLoc(); start.x -= 3; start.y -= 6; - if( getMechImage() != null ) { - //graphics.drawRect(start.x, start.y, 160, 200); + if (getMechImage() != null) { + // graphics.drawRect(start.x, start.y, 160, 200); Dimension d = imageTracker.media.reSize(getMechImage(), 160, 200); - Point offset = imageTracker.media.offsetImageCenter( new Dimension(160, 200), d); - graphics.drawImage( getMechImage(), start.x + offset.x, start.y + offset.y, d.width, d.height, null ); + Point offset = imageTracker.media.offsetImageCenter(new Dimension(160, 200), d); + graphics.drawImage(getMechImage(), start.x + offset.x, start.y + offset.y, d.width, d.height, null); } - if ( LogoImage != null ) { - graphics.drawImage( LogoImage, points.GetLogoImageLoc().x, points.GetLogoImageLoc().y, 50, 50, null ); + if (LogoImage != null) { + graphics.drawImage(LogoImage, points.GetLogoImageLoc().x, points.GetLogoImageLoc().y, 50, 50, null); } } + */ - private void DrawGrid( Graphics2D graphics ) { - graphics.setFont( PrintConsts.ReallySmallFont ); + /* + // Not Used Locally + private void DrawGrid(Graphics2D graphics) { + graphics.setFont(PrintConsts.ReallySmallFont); boolean bPrint = true; for (int x = 0; x <= 576; x += 10) { - if (bPrint) { graphics.drawString(x+"", x-5, 5); } + if (bPrint) { + graphics.drawString(x + "", x - 5, 5); + } bPrint = !bPrint; graphics.drawLine(x, 0, x, 756); } bPrint = false; for (int y = 0; y <= 756; y += 10) { - if (bPrint) { graphics.drawString(y+"", 0, y+5); } + if (bPrint) { + graphics.drawString(y + "", 0, y + 5); + } bPrint = !bPrint; graphics.drawLine(0, y, 576, y); } } + */ private ArrayList GetAmmo() { - //Output the list of Ammunition - ArrayList all = CurMech.GetLoadout().GetNonCore(); + // Output the list of Ammunition + ArrayList all = CurMech.GetLoadout().GetNonCore(); ArrayList AmmoLister = new ArrayList(); - for ( int index=0; index < all.size(); index++ ) { - if( all.get( index ) instanceof Ammunition ) { + for (int index = 0; index < all.size(); index++) { + if (all.get(index) instanceof Ammunition) { AmmoData CurAmmo = new AmmoData((Ammunition) all.get(index)); CurAmmo.makeGeneric = makeAmmoGeneric; boolean found = false; - for ( int internal=0; internal < AmmoLister.size(); internal++ ) { + for (int internal = 0; internal < AmmoLister.size(); internal++) { AmmoData existAmmo = (AmmoData) AmmoLister.get(internal); - if ( CurAmmo.Name().equals( existAmmo.Name() ) ) { + if (CurAmmo.Name().equals(existAmmo.Name())) { existAmmo.LotSize += CurAmmo.LotSize; found = true; break; } } - if ( !found ) { + if (!found) { AmmoLister.add(CurAmmo); } } @@ -889,20 +991,24 @@ private ArrayList GetAmmo() { return AmmoLister; } - private boolean AmmoContains( ArrayList AmmoList, String CheckExpr ) { - for ( AmmoData data : AmmoList ) { - if ( data.Format().contains(CheckExpr) ) return true; + /* + // Not used locally + private boolean AmmoContains(ArrayList AmmoList, String CheckExpr) { + for (AmmoData data : AmmoList) { + if (data.Format().contains(CheckExpr)) + return true; } return false; } + */ - private void CheckShields( Graphics2D graphics ) { + private void CheckShields(Graphics2D graphics) { Image shieldImage; - Point startingLocation = new Point(0,0); - for ( PlaceableInfo item : Items ) { - if ( item.Item instanceof PhysicalWeapon ) { - if ( ((PhysicalWeapon) item.Item).GetPWClass() == PhysicalWeapon.PW_CLASS_SHIELD ) { - switch ( item.Location ) { + Point startingLocation = new Point(0, 0); + for (PlaceableInfo item : Items) { + if (item.Item instanceof PhysicalWeapon) { + if (((PhysicalWeapon) item.Item).GetPWClass() == PhysicalWeapon.PW_CLASS_SHIELD) { + switch (item.Location) { case LocationIndex.MECH_LOC_LA: shieldImage = imageTracker.getImage(PrintConsts.LA_Shield); startingLocation = new Point(375, 7); @@ -919,45 +1025,47 @@ private void CheckShields( Graphics2D graphics ) { break; } - if ( item.Item.ActualName().contains("Small") ) { - ap.AddArmor(FileCommon.EncodeLocation(item.Location, CurMech.IsQuad()) + "_SH_" , startingLocation, new Point(34, 101), 11); + if (item.Item.ActualName().contains("Small")) { + ap.AddArmor(FileCommon.EncodeLocation(item.Location, CurMech.IsQuad()) + "_SH_", + startingLocation, new Point(34, 101), 11); } - if ( item.Item.ActualName().contains("Medium") ) { - ap.AddArmor(FileCommon.EncodeLocation(item.Location, CurMech.IsQuad()) + "_SH_", startingLocation, new Point(34, 101), 18); + if (item.Item.ActualName().contains("Medium")) { + ap.AddArmor(FileCommon.EncodeLocation(item.Location, CurMech.IsQuad()) + "_SH_", + startingLocation, new Point(34, 101), 18); } - if ( item.Item.ActualName().contains("Large") ) { - ap.AddArmor(FileCommon.EncodeLocation(item.Location, CurMech.IsQuad()) + "_SH_", startingLocation, new Point(34, 101), 25); + if (item.Item.ActualName().contains("Large")) { + ap.AddArmor(FileCommon.EncodeLocation(item.Location, CurMech.IsQuad()) + "_SH_", + startingLocation, new Point(34, 101), 25); } } } } } - private void GetRecordSheet( ImageTracker images ) { + private void GetRecordSheet(ImageTracker images) { // loads the correct record sheet and points based on the information given points = new TWBipedPoints(); - if ( ChartImageOption.equals("Minimal") ) + if (ChartImageOption.equals("Minimal")) ChartImage = images.getImage(PrintConsts.BP_ChartImage_Minimal); - - if ( CurMech.IsQuad() ) { - RecordSheet = images.getImage( PrintConsts.RS_TW_QD ); - if ( !ChartImageOption.equals("Minimal")) - ChartImage = images.getImage(PrintConsts.QD_ChartImage); + + if (CurMech.IsQuad()) { + RecordSheet = images.getImage(PrintConsts.RS_TW_QD); + if (!ChartImageOption.equals("Minimal")) + ChartImage = images.getImage(PrintConsts.QD_ChartImage); else ChartImage = images.getImage(PrintConsts.QD_ChartImage_Minimal); - + points = new TWQuadPoints(); } - if ( Advanced ) { - RecordSheet = images.getImage( PrintConsts.RS_TO_BP ); + if (Advanced) { + RecordSheet = images.getImage(PrintConsts.RS_TO_BP); } } - public String getGroupName() { return GroupName; } @@ -966,38 +1074,32 @@ public void setGroupName(String GroupName) { this.GroupName = GroupName; } - public void setAmmoGeneric( boolean action ) { + public void setAmmoGeneric(boolean action) { makeAmmoGeneric = action; AmmoList = GetAmmo(); } - public void setA4() - { + public void setA4() { UseA4Paper = true; } - public void setLetter() - { + public void setLetter() { UseA4Paper = false; } - - public void setChartImageOption( String Option ) { + + public void setChartImageOption(String Option) { ChartImageOption = Option; GetRecordSheet(imageTracker); } - + private class AmmoData { - public String ActualName, - ChatName, - GenericName, - CritName, - LookupName; + public String ActualName, GenericName, CritName, LookupName; //, ChatName; // Never used public int LotSize; public boolean makeGeneric = false; - public AmmoData( Ammunition ammo ) { + public AmmoData(Ammunition ammo) { this.ActualName = ammo.ActualName(); - this.ChatName = ammo.ChatName(); + // this.ChatName = ammo.ChatName(); // Assigned but not used. this.CritName = ammo.CritName().replace("@", "").trim(); this.LookupName = ammo.LookupName(); @@ -1006,14 +1108,14 @@ public AmmoData( Ammunition ammo ) { } public String Name() { - if ( !makeGeneric ) + if (!makeGeneric) return ActualName; else return GenericName; } public String Format() { - if ( !makeGeneric ) + if (!makeGeneric) return ("%P").replace("%P", CritName).replace("%F", LookupName).replace("%L", ""); else return ("%P").replace("%P", GenericName).replace("%F", GenericName).replace("%L", ""); From 77d8fd990bf689daf199a454444519ade5ff1350 Mon Sep 17 00:00:00 2001 From: Richard J Hancock Date: Fri, 29 Jan 2021 17:07:14 -0600 Subject: [PATCH 099/126] sswlib/src/main/java/Print/preview/PreviewDialog - Removed methods not used locally - VS Code Formatting --- .../java/Print/preview/PreviewDialog.java | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/sswlib/src/main/java/Print/preview/PreviewDialog.java b/sswlib/src/main/java/Print/preview/PreviewDialog.java index c113e5ee..909742e4 100644 --- a/sswlib/src/main/java/Print/preview/PreviewDialog.java +++ b/sswlib/src/main/java/Print/preview/PreviewDialog.java @@ -51,13 +51,13 @@ public PreviewDialog(String title, JFrame owner, Pageable pageable, double zoom) getContentPane().add(scrollPane, "Center"); JToolBar toolbar = new JToolBar(); - //toolbar.setRollover(true); + // toolbar.setRollover(true); getContentPane().add(toolbar, "North"); - toolbar.add(getButton( "Back", "Back24.gif", new BrowseAction(preview, -1))); - toolbar.add(getButton( "Forward", "Forward24.gif", new BrowseAction(preview, 1))); + toolbar.add(getButton("Back", "Back24.gif", new BrowseAction(preview, -1))); + toolbar.add(getButton("Forward", "Forward24.gif", new BrowseAction(preview, 1))); toolbar.add(new JToolBar.Separator()); - toolbar.add(getButton( "Zoom +", "ZoomIn24.gif", new ZoomAction(preview, DEFAULT_ZOOM_FACTOR_STEP))); - toolbar.add(getButton( "Zoom -", "ZoomOut24.gif", new ZoomAction(preview, -DEFAULT_ZOOM_FACTOR_STEP))); + toolbar.add(getButton("Zoom +", "ZoomIn24.gif", new ZoomAction(preview, DEFAULT_ZOOM_FACTOR_STEP))); + toolbar.add(getButton("Zoom -", "ZoomOut24.gif", new ZoomAction(preview, -DEFAULT_ZOOM_FACTOR_STEP))); toolbar.add(new JToolBar.Separator()); JPanel dialog = new JPanel(); dialog.setLayout(new FlowLayout(FlowLayout.RIGHT)); @@ -91,12 +91,14 @@ public int getNumberOfPages() { } public Printable getPrintable(int index) { - if (index >= pages) throw new IndexOutOfBoundsException(); + if (index >= pages) + throw new IndexOutOfBoundsException(); return printable; } public PageFormat getPageFormat(int index) { - if (index >= pages) throw new IndexOutOfBoundsException(); + if (index >= pages) + throw new IndexOutOfBoundsException(); return format; } @@ -105,13 +107,19 @@ public PageFormat getPageFormat(int index) { private int pages; } + /* + // Not used locally private JButton getButton(String iconName) { return getButton(null, iconName, null); } + */ + /* + // Not used locally private JButton getButton(String iconName, AbstractAction action) { return getButton(null, iconName, action); } + */ private JButton getButton(String name, String iconName, AbstractAction action) { JButton result = null; @@ -120,8 +128,10 @@ private JButton getButton(String name, String iconName, AbstractAction action) { icon = new ImageIcon(getClass().getResource("/ssw/BFB.Images/" + iconName)); if (action != null) { - if (icon != null) action.putValue(Action.SMALL_ICON, icon); - if (name != null) action.putValue(Action.NAME, name); + if (icon != null) + action.putValue(Action.SMALL_ICON, icon); + if (name != null) + action.putValue(Action.NAME, name); result = new JButton(action); } else result = new JButton(name, icon); @@ -129,9 +139,12 @@ private JButton getButton(String name, String iconName, AbstractAction action) { return result; } + /* + // Not used locally private void Refresh() { this.repaint(); } + */ public void actionPerformed(ActionEvent e) { dispose(); From bc345af3a3526fff21555fa75483c15e750640b0 Mon Sep 17 00:00:00 2001 From: George Blouin Date: Sat, 6 Mar 2021 12:39:57 -0700 Subject: [PATCH 100/126] Handle Issues with Paths That are stored in the file but do not exist on the current users system. --- sswlib/src/main/java/Print/PrintMech.java | 56 +++++++++++--------- sswlib/src/main/java/filehandlers/Media.java | 31 ++++++----- 2 files changed, 49 insertions(+), 38 deletions(-) diff --git a/sswlib/src/main/java/Print/PrintMech.java b/sswlib/src/main/java/Print/PrintMech.java index b40d5826..8eea5c96 100644 --- a/sswlib/src/main/java/Print/PrintMech.java +++ b/sswlib/src/main/java/Print/PrintMech.java @@ -79,7 +79,13 @@ public PrintMech( Mech m, Image i, boolean adv, boolean A4, ImageTracker images) imageTracker = images; RecordSheet = images.getImage( PrintConsts.RS_TW_BP ); ChartImage = images.getImage(PrintConsts.BP_ChartImage ); - if ( !m.GetSSWImage().equals("../BFB.Images/No_Image.png") ) MechImage = imageTracker.getImage(m.GetSSWImage()); + if ( !m.GetSSWImage().equals("../BFB.Images/No_Image.png") ) + MechImage = imageTracker.getImage(m.GetSSWImage()); + + //If we could not load the stored image, find it + if (MechImage == null) + MechImage = images.getImage(imageTracker.media.DetermineMatchingImage(m.GetName(), m.GetModel(), "")); + Advanced = adv; BV = CommonTools.GetAdjustedBV(CurMech.GetCurrentBV(), Gunnery, Piloting); UseA4Paper = A4; @@ -96,7 +102,7 @@ public PrintMech( Mech m, String Warrior, int Gun, int Pilot, ImageTracker image SetPilotData(Warrior, Gun, Pilot); } // - + // public void SetPilotData( String pname, int pgun, int ppilot ) { PilotName = pname; @@ -114,7 +120,7 @@ public void SetOptions( boolean charts, boolean PrintP, double UseBV ) { public void SetMiniConversion( int conv ) { useMiniConvRate = false; MiniConvRate = 1; - + if ( conv > 0 ) { MiniConvRate = conv; useMiniConvRate = true; @@ -195,11 +201,11 @@ public int getGunnery(){ public int getPiloting(){ return Piloting; } - + public Image getMechImage() { return MechImage; } - + public Image getLogoImage() { return LogoImage; } @@ -219,14 +225,14 @@ public int print( Graphics graphics, PageFormat pageFormat, int pageIndex ) thro return Printable.PAGE_EXISTS; } } - + private void PreparePrint( Graphics2D graphics ) { Items = PrintConsts.SortEquipmentByLocation( CurMech, MiniConvRate ); boolean mechHasShield = CurMech.HasRAShield() || CurMech.HasLAShield(); ap = new PIPPrinter(graphics, CurMech, Canon, mechHasShield, imageTracker); this.BV = CommonTools.GetAdjustedBV(CurMech.GetCurrentBV(), Gunnery, Piloting); GetRecordSheet(imageTracker); - + //DrawImages( graphics ); DrawSheet( graphics ); DrawPips( graphics ); @@ -252,7 +258,7 @@ private void DrawSheet( Graphics2D graphics ) { if( Charts ) { graphics.scale( 0.8d, 0.8d ); } - + graphics.drawImage( RecordSheet, 0, 0, 576, 756, null ); //graphics.drawImage( RecordSheet, 0, 0, 560, 757, null ); @@ -266,16 +272,16 @@ private void DrawSheet( Graphics2D graphics ) { graphics.drawString(item, 70, line); line += graphics.getFont().getSize(); } - + CheckShields( graphics ); - + Point start = points.GetMechImageLoc(); start.x -= 3; start.y -= 6; if ( printMech ) { if (MechImage == null) // fallback to fluff image if user didn't explicitly choose a TRO pic in the print dialog MechImage = imageTracker.media.GetImage(imageTracker.media.DetermineMatchingImage(CurMech.GetName(), CurMech.GetModel(), CurMech.GetSSWImage())); - if( MechImage != null ) { + if( MechImage != null) { //graphics.drawRect(start.x, start.y, 150, 210); Dimension d = imageTracker.media.reSize(getMechImage(), 150, 210); Point offset = imageTracker.media.offsetImageCenter( new Dimension(150, 210), d); @@ -426,7 +432,7 @@ private void DrawMechData( Graphics2D graphics ) { graphics.fillRect(p[6].x-5, p[6].y-28, 30, 10); graphics.setColor(Color.black); } - + for ( PlaceableInfo item : Items ) { xoffset = 0; graphics.drawString( item.Count + "", p[0].x+1, p[0].y + offset ); @@ -509,7 +515,7 @@ private void DrawMechData( Graphics2D graphics ) { //Jumping Movement! String JumpMP = ""; - if ( CurMech.GetJumpJets().GetNumJJ() > 0 ) + if ( CurMech.GetJumpJets().GetNumJJ() > 0 ) JumpMP += (CurMech.GetJumpJets().GetNumJJ() * MiniConvRate) + ""; if ( CurMech.GetAdjustedJumpingMP( false ) != CurMech.GetJumpJets().GetNumJJ() ) @@ -529,7 +535,7 @@ private void DrawMechData( Graphics2D graphics ) { if ( CurMech.GetJumpJets().IsUMU() ) JumpMP += " UMU"; graphics.drawString( JumpMP, p[PrintConsts.JUMPMP].x, p[PrintConsts.JUMPMP].y ); - + // end hacking of movement. //Tonnage @@ -551,13 +557,13 @@ private void DrawMechData( Graphics2D graphics ) { graphics.drawString( "Dissipation (" + CurMech.GetHeatSinks().TotalDissipation() + ")", p[PrintConsts.MAX_HEAT].x-1, p[PrintConsts.MAX_HEAT].y+1 ); //graphics.drawString( "Weapon Heat (" + CurMech.GetWeaponHeat(false, false, true, false) + ")", p[PrintConsts.MAX_HEAT].x-1, p[PrintConsts.MAX_HEAT].y ); graphics.setFont( PrintConsts.SmallFont ); - + // The Armor Pts text should be placed just a bit higher on the sheet if using a right arm shield if (CurMech.HasRAShield() == true) graphics.drawString( "Armor Pts: " + CurMech.GetArmor().GetArmorValue(), p[PrintConsts.TOTAL_ARMOR].x-8, p[PrintConsts.TOTAL_ARMOR].y+0 ); - else + else graphics.drawString( "Armor Pts: " + CurMech.GetArmor().GetArmorValue(), p[PrintConsts.TOTAL_ARMOR].x-8, p[PrintConsts.TOTAL_ARMOR].y+16 ); - + graphics.setFont( PrintConsts.BoldFont ); } else { graphics.drawString( String.format( "%1$,d", CurMech.GetCurrentBV() ), p[PrintConsts.BV2].x, p[PrintConsts.BV2].y ); @@ -676,7 +682,7 @@ private void DrawMechData( Graphics2D graphics ) { int extraDHS = 0; boolean isProto = CurMech.GetHeatSinks().IsProtoDHS(); ArrayList equipment = CurMech.GetLoadout().GetEquipment(); - + for (int i = 0; i < equipment.size(); i++){ if (equipment.get(i) instanceof EquipmentProtoSuccWarsDoubleHeatSink){ extraDHS += 1; @@ -684,7 +690,7 @@ private void DrawMechData( Graphics2D graphics ) { extraDHS += 1; } } - + if (!isProto && extraDHS == 0) { // Standard heat sink setup @@ -717,7 +723,7 @@ else if ( CurMech.GetHeatSinks().GetNumHS() > 20 ) int singles; int doubles; if (isProto) - { + { singles = numberOfHS < internalHS ? numberOfHS : internalHS; doubles = (numberOfHS - singles) + extraDHS; } else { @@ -941,14 +947,14 @@ private void GetRecordSheet( ImageTracker images ) { if ( ChartImageOption.equals("Minimal") ) ChartImage = images.getImage(PrintConsts.BP_ChartImage_Minimal); - + if ( CurMech.IsQuad() ) { RecordSheet = images.getImage( PrintConsts.RS_TW_QD ); if ( !ChartImageOption.equals("Minimal")) - ChartImage = images.getImage(PrintConsts.QD_ChartImage); + ChartImage = images.getImage(PrintConsts.QD_ChartImage); else ChartImage = images.getImage(PrintConsts.QD_ChartImage_Minimal); - + points = new TWQuadPoints(); } @@ -980,12 +986,12 @@ public void setLetter() { UseA4Paper = false; } - + public void setChartImageOption( String Option ) { ChartImageOption = Option; GetRecordSheet(imageTracker); } - + private class AmmoData { public String ActualName, ChatName, diff --git a/sswlib/src/main/java/filehandlers/Media.java b/sswlib/src/main/java/filehandlers/Media.java index 80ac1bad..c7e08b88 100644 --- a/sswlib/src/main/java/filehandlers/Media.java +++ b/sswlib/src/main/java/filehandlers/Media.java @@ -46,11 +46,14 @@ import java.util.prefs.Preferences; import javax.swing.JOptionPane; +import IO.Utils; + public class Media { MediaTracker Tracker = new MediaTracker(new JLabel()); Toolkit toolkit = Toolkit.getDefaultToolkit(); JFileChooser fileChooser = new JFileChooser(); ArrayList imageFiles = new ArrayList(); + Integer trackerIndex = 0; public static final int OK = JOptionPane.OK_OPTION, CANCEL = JOptionPane.CANCEL_OPTION; @@ -101,16 +104,22 @@ public File SelectImage(String defaultDirectory, String commandName) { } return fileChooser.getSelectedFile(); } + public Image GetImage(String filename) { - //System.out.println("Loading " + filename); if ( filename.isEmpty() ) return null; Image retval = toolkit.getImage( filename ); - Tracker.addImage( retval, 0 ); + trackerIndex++; + Tracker.addImage( retval, trackerIndex); try { - Tracker.waitForID( 0 ); + Tracker.waitForID( trackerIndex ); + + //Check to see if the image loaded or not + if (Tracker.isErrorID(trackerIndex)) + return null; } catch (InterruptedException ie) { - System.out.println(ie.getMessage()); + return null; } + return retval; } @@ -213,7 +222,6 @@ public Dimension reSize(Image image, double MaxWidth, double MaxHeight ) { public Point offsetImageBottom( Dimension spaceDimensions, Dimension currentDimensions ) { Point offset = new Point(0, 0); - //offset.x = originalDimensions.width - currentDimensions.width; offset.y = spaceDimensions.height - currentDimensions.height; return offset; } @@ -257,7 +265,6 @@ public String GetDirectorySelection( Component Parent, String defaultPath, Strin public String FindMatchingImage( String Name, String Model, String DirectoryPath ) { Preferences Prefs = Preferences.userRoot().node( Constants.SSWPrefs ); - //System.out.println("Checking BFB.Images @" + Prefs.get("DefaultImagePath", "")); if ( DirectoryPath.isEmpty() ) DirectoryPath = Prefs.get("DefaultImagePath", ""); if ( DirectoryPath.isEmpty() ) return ""; @@ -286,19 +293,17 @@ public String FindMatchingImage( String Name, String Model, String DirectoryPath PossibleNames.add(Second.replace(" ", "")); } - if ( DirectoryPath.endsWith(".jpg") || - DirectoryPath.endsWith(".png") || + if ( DirectoryPath.endsWith(".jpg") || + DirectoryPath.endsWith(".png") || DirectoryPath.endsWith(".gif") || DirectoryPath.endsWith(".ssw") || DirectoryPath.endsWith(".saw") ) DirectoryPath = DirectoryPath.substring(0, DirectoryPath.lastIndexOf("\\")+1); if ( !DirectoryPath.endsWith("\\") ) DirectoryPath += "\\"; - + String path; if ( imageFiles.isEmpty() ) { imageFiles = LoadDirectories(DirectoryPath); } for ( String nameToCheck : PossibleNames ) { - //System.out.println("Checking " + nameToCheck); - //path = CheckDirectories( nameToCheck, DirectoryPath ); path = CheckDirectories( nameToCheck, imageFiles ); if ( !path.isEmpty() ) return path; } @@ -310,7 +315,7 @@ private ArrayList LoadDirectories( String DirectoryPath ) { ArrayList fileList = new ArrayList(); try { - File d = new File(DirectoryPath); + File d = new File(Utils.convertFilePathSeparator(DirectoryPath)); if ( d.isDirectory() ) { for ( File f : d.listFiles() ) { if ( f.isDirectory() ) { @@ -365,7 +370,7 @@ public static void Messager(Component component, String message) { public static int Options(Component component, String Message, String Title) { return javax.swing.JOptionPane.showOptionDialog(component, Message, Title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null); } - + private class ExtensionFilter extends javax.swing.filechooser.FileFilter { String Extension = ""; From 0d7e865f83aa04ee03c07a19e1bfe334a86c3ac5 Mon Sep 17 00:00:00 2001 From: George Blouin Date: Sat, 6 Mar 2021 17:34:47 -0700 Subject: [PATCH 101/126] Set BV of Capacitor for CL ER PPC Since we have a specific reference for this total value. --- sswlib/src/main/java/components/PPCCapacitor.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sswlib/src/main/java/components/PPCCapacitor.java b/sswlib/src/main/java/components/PPCCapacitor.java index 41148aff..897c8110 100644 --- a/sswlib/src/main/java/components/PPCCapacitor.java +++ b/sswlib/src/main/java/components/PPCCapacitor.java @@ -180,5 +180,10 @@ private void BuildOffensiveBV() { if( Owner.LookupName().equals( "(IS) ER PPC" ) ) { OffBV -= 0.49; } + + if (Owner.LookupName().equals("(CL) ER PPC")) { + //Interstellar Ops pg 194 sets Clan ER PPC + Capacitor at 548. So only add 136 here as the PPC is 412. + OffBV = 136; + } } } From 8e59e27b6a03121051e074f5d147a8e9988c55c6 Mon Sep 17 00:00:00 2001 From: George Blouin Date: Sat, 6 Mar 2021 18:37:59 -0700 Subject: [PATCH 102/126] BV Updates Calculate the offset for known values from rulebooks but keep the original multiplier code for those that don't have set values yet. --- .../main/java/components/PPCCapacitor.java | 79 +++++++++++-------- 1 file changed, 47 insertions(+), 32 deletions(-) diff --git a/sswlib/src/main/java/components/PPCCapacitor.java b/sswlib/src/main/java/components/PPCCapacitor.java index 897c8110..867059a3 100644 --- a/sswlib/src/main/java/components/PPCCapacitor.java +++ b/sswlib/src/main/java/components/PPCCapacitor.java @@ -151,39 +151,54 @@ public void ArmorComponent( boolean armor ) { } private void BuildOffensiveBV() { - // the calculations here ARE NOT canon, but they should work for the - // normal, canon PPCs, including the Enhanced ER PPC (we hope). We add - // 2.5 to the damage because the PPC Cap fires only every other round. - double basemult = 0.0; - if( Owner.GetDamageShort() != Owner.GetDamageMedium() || Owner.GetDamageShort() != Owner.GetDamageMedium() ) { - double mult1 = ( ((double) Owner.GetDamageShort()) + 2.5 ) / ((double) Owner.GetDamageShort()); - if( Owner.GetDamageShort() < 12 && ( Owner.GetDamageShort() + 5 ) >= 12 ) { - mult1 *= 1.2; - } - double mult2 = ( ((double) Owner.GetDamageMedium()) + 2.5 ) / ((double) Owner.GetDamageMedium()); - if( Owner.GetDamageMedium() < 12 && ( Owner.GetDamageMedium() + 5 ) >= 12 ) { - mult2 *= 1.2; - } - double mult3 = ( ((double) Owner.GetDamageLong()) + 2.5 ) / ((double) Owner.GetDamageLong()); - if( Owner.GetDamageLong() < 12 && ( Owner.GetDamageLong() + 5 ) >= 12 ) { - mult3 *= 1.2; - } - basemult = ( mult1 + mult2 + mult3 ) * 0.33333; - } else { - basemult = ( ((double) Owner.GetDamageShort()) + 2.5 ) / ((double) Owner.GetDamageShort()); - if( Owner.GetDamageShort() < 12 && ( Owner.GetDamageShort() + 5 ) >= 12 ) { - basemult *= 1.2; - } - } - OffBV = Owner.GetOffensiveBV() * ( basemult - 1.0 ); - // minor modification since the math doesn't work (damn you, TPTB!!!) - if( Owner.LookupName().equals( "(IS) ER PPC" ) ) { - OffBV -= 0.49; - } - if (Owner.LookupName().equals("(CL) ER PPC")) { - //Interstellar Ops pg 194 sets Clan ER PPC + Capacitor at 548. So only add 136 here as the PPC is 412. - OffBV = 136; + switch(Owner.LookupName()) { + case "(CL) ER PPC": + OffBV = 548 - Owner.GetOffensiveBV(); //Interstellar Ops pg 194 + break; + case "(IS) Heavy PPC": + OffBV = 370 - Owner.GetOffensiveBV(); //Tactical Ops pg 382 + break; + case "(IS) PPC": + OffBV = 264 - Owner.GetOffensiveBV(); //Tactical Ops pg 382 + break; + case "(IS) Light PPC": + OffBV = 132 - Owner.GetOffensiveBV(); //Tactical Ops pg 382 + break; + case "(IS) Snub-Nose PPC": + OffBV = 252 - Owner.GetOffensiveBV(); //Tactical Ops pg 382 + break; + case "(IS) ER PPC": + // minor modification since the math doesn't work (damn you, TPTB!!!) + OffBV = 343 - Owner.GetOffensiveBV(); //Tactical Ops pg 382 + break; + default: + // the calculations here ARE NOT canon, but they should work for the + // normal, canon PPCs, including the Enhanced ER PPC (we hope). We add + // 2.5 to the damage because the PPC Cap fires only every other round. + double basemult = 0.0; + if( Owner.GetDamageShort() != Owner.GetDamageMedium() || Owner.GetDamageShort() != Owner.GetDamageMedium() ) { + double mult1 = ( ((double) Owner.GetDamageShort()) + 2.5 ) / ((double) Owner.GetDamageShort()); + if( Owner.GetDamageShort() < 12 && ( Owner.GetDamageShort() + 5 ) >= 12 ) { + mult1 *= 1.2; + } + double mult2 = ( ((double) Owner.GetDamageMedium()) + 2.5 ) / ((double) Owner.GetDamageMedium()); + if( Owner.GetDamageMedium() < 12 && ( Owner.GetDamageMedium() + 5 ) >= 12 ) { + mult2 *= 1.2; + } + double mult3 = ( ((double) Owner.GetDamageLong()) + 2.5 ) / ((double) Owner.GetDamageLong()); + if( Owner.GetDamageLong() < 12 && ( Owner.GetDamageLong() + 5 ) >= 12 ) { + mult3 *= 1.2; + } + basemult = ( mult1 + mult2 + mult3 ) * 0.33333; + } else { + basemult = ( ((double) Owner.GetDamageShort()) + 2.5 ) / ((double) Owner.GetDamageShort()); + if( Owner.GetDamageShort() < 12 && ( Owner.GetDamageShort() + 5 ) >= 12 ) { + basemult *= 1.2; + } + } + OffBV = Owner.GetOffensiveBV() * ( basemult - 1.0 ); + break; } } } From d272c5f13cf5941f34cb3bf8c0cf7189a3a0a067 Mon Sep 17 00:00:00 2001 From: George Blouin Date: Sat, 6 Mar 2021 19:12:52 -0700 Subject: [PATCH 103/126] Use EncodeFluff for MUL This section was missed when the EncodeFluff method was added. This will now convert " into " along with other conversions necessary for XML. --- sswlib/src/main/java/Force/Unit.java | 30 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/sswlib/src/main/java/Force/Unit.java b/sswlib/src/main/java/Force/Unit.java index f644a2e4..32a31715 100644 --- a/sswlib/src/main/java/Force/Unit.java +++ b/sswlib/src/main/java/Force/Unit.java @@ -137,7 +137,7 @@ public Unit( Mech m ) { setOmni(true); Configuration = m.GetLoadout().GetName(); } - + if ( !m.GetSSWImage().isEmpty()) { UnitImage = m.GetSSWImage(); } @@ -196,7 +196,7 @@ public Unit( CombatVehicle vee ) { setOmni(true); Configuration = vee.GetLoadout().GetName(); } - + if ( !vee.GetSSWImage().isEmpty() ) { UnitImage = vee.GetSSWImage(); } @@ -233,7 +233,7 @@ public Unit( CombatVehicle vee ) { this.v = vee; Refresh(); } - + public Unit( BattleForceStats stat ) { this(); Name = stat.getName(); @@ -384,7 +384,7 @@ public void UpdateByUnit() { break; } } - + public void UpdateByVehicle() { LoadUnit(); if ( v != null ) { @@ -441,7 +441,7 @@ public void UpdateByVehicle() { StatsCalced = true; } } - + public void UpdateByMech() { LoadUnit(); if ( m != null ) { @@ -539,7 +539,7 @@ public void SerializeMUL(BufferedWriter file) throws IOException { this.Model.replace("Alt", ""); this.Model.trim(); - file.write(CommonTools.tab + ""); + file.write(CommonTools.tab + ""); file.newLine(); file.write(CommonTools.tab + CommonTools.tab + ""); file.newLine(); @@ -688,7 +688,7 @@ private void LoadMech() throws Exception { StatsCalced = true; } } - + private void LoadVehicle() throws Exception { CVReader reader = new CVReader(); String baseDirectory = sswPrefs.get("ListPath", ""); @@ -702,7 +702,7 @@ private void LoadVehicle() throws Exception { } if ( !v.GetSSWImage().isEmpty() ) this.UnitImage = v.GetSSWImage(); - + if ( BFStats.getPointValue() == 0 ) { BFStats = new BattleForceStats(v); } @@ -750,7 +750,7 @@ private void LoadVehicle() throws Exception { StatsCalced = true; } } - + public BattleForceStats getBFStats() { if ( BFStats != null ) { BFStats.setName(this.Name); @@ -833,7 +833,7 @@ public boolean IsOmni() { public final void setOmni(boolean isOmni) { this.isOmni = isOmni; } - + public String getInfo() { return Info; } @@ -863,7 +863,7 @@ public String isUsingC3() { } return val; } - + public boolean HasC3() { return C3Available; } @@ -880,11 +880,11 @@ public void setForceC3BV(float ForceC3BV) { public String getFullName() { return (Name + " " + Model + " " + Configuration).replace(" ", " ").trim(); } - + public String getImage() { return UnitImage; } - + public void SetCurLoadout( String loadout) { switch(UnitType) { case CommonTools.BattleMech: @@ -894,7 +894,7 @@ public void SetCurLoadout( String loadout) { v.SetCurLoadout(loadout); } } - + public void SetUnitImage( String image ) { UnitImage = image; switch(UnitType) { @@ -906,7 +906,7 @@ public void SetUnitImage( String image ) { break; } } - + public void SaveUnit() { try { From ce0f02d87de37365dbfe970964586cdc46f1ce76 Mon Sep 17 00:00:00 2001 From: George Blouin Date: Sat, 6 Mar 2021 19:16:50 -0700 Subject: [PATCH 104/126] Convert Double Quotes to Single So that they will match up with what Megamek is doing. --- sswlib/src/main/java/filehandlers/FileCommon.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sswlib/src/main/java/filehandlers/FileCommon.java b/sswlib/src/main/java/filehandlers/FileCommon.java index 40cec2a3..465dbb27 100644 --- a/sswlib/src/main/java/filehandlers/FileCommon.java +++ b/sswlib/src/main/java/filehandlers/FileCommon.java @@ -649,7 +649,7 @@ public static String GetCaseIILocations( Mech m ) { return retval; } } - + public static String EncodeLocation( int loc, boolean quad, ifUnit u ) { if ( u instanceof Mech ) { @@ -793,11 +793,11 @@ public static String EncodeLocation( int loc, boolean quad, int UnitType ) { return "??"; } } - + public static String EncodeLocations( int[] check, boolean quad ) { return EncodeLocations( check, quad, common.CommonTools.BattleMech ); } - + public static String EncodeLocations( int[] check, boolean quad, int UnitType ) { // this will work initializing to 0 since you cannot split into the head // and no contiguous item can be split into more than two locations. @@ -826,7 +826,7 @@ public static String EncodeLocations( int[] check, boolean quad, int UnitType ) return retval; } - + public static String DecodeCrits( int[] check ) { String retval = ""; @@ -867,7 +867,7 @@ public static ArrayList SortEquipmentForStats( CombatVehicle m, Arr return SortEquipmentForStats((ifLoadout)m.GetLoadout(), v, ExportOut, AmmoEnd); } - + public static ArrayList SortEquipmentForStats( Mech m, ArrayList v, boolean ExportOut, boolean AmmoEnd ) { // this routine takes the given ArrayList of equipment and sorts it by // location, starting with the head and working down to legs. @@ -1004,7 +1004,7 @@ public static String EncodeFluff( String s ) { retval = retval.replaceAll( "<", "<" ); retval = retval.replaceAll( ">", ">" ); retval = retval.replaceAll( "\'", "'" ); - retval = retval.replaceAll( "\"", """ ); + retval = retval.replaceAll( "\"", "'" ); retval = retval.replaceAll( "\n\r", ":br:" ); retval = retval.replaceAll( "\n", ":br:" ); retval = retval.replaceAll( "\r", ":br:" ); From ff308e8d542acc80c9eea3be790884926044ef5d Mon Sep 17 00:00:00 2001 From: George Blouin Date: Mon, 8 Mar 2021 20:24:34 -0700 Subject: [PATCH 105/126] Instantiate each view once and then just choose the one to use and fill it with units. Hoping that this clears up Maelwys's issues with the rendering being slow. --- sswlib/src/main/java/list/view/abView.java | 7 ++++++- .../src/main/java/list/view/tbBattleForceView.java | 7 ++++--- .../src/main/java/list/view/tbChatInformation.java | 7 ++++--- .../main/java/list/view/tbTotalWarfareCompact.java | 9 +++++---- .../src/main/java/list/view/tbTotalWarfareView.java | 13 +++++++------ 5 files changed, 26 insertions(+), 17 deletions(-) diff --git a/sswlib/src/main/java/list/view/abView.java b/sswlib/src/main/java/list/view/abView.java index d8ce6a09..72ab3ca3 100644 --- a/sswlib/src/main/java/list/view/abView.java +++ b/sswlib/src/main/java/list/view/abView.java @@ -70,7 +70,12 @@ public void setupTable( JTable tbl ) { } } } - + + public abView setList(UnitList list) { + this.list = list; + return this; + } + public Object Get( int index ) { return list.Get(index); } diff --git a/sswlib/src/main/java/list/view/tbBattleForceView.java b/sswlib/src/main/java/list/view/tbBattleForceView.java index 14443ec5..7db26517 100644 --- a/sswlib/src/main/java/list/view/tbBattleForceView.java +++ b/sswlib/src/main/java/list/view/tbBattleForceView.java @@ -47,7 +47,7 @@ public tbBattleForceView( UnitList list ) { Columns.add(new Column( 9, "Str", "Structure", 20, Integer.class )); Columns.add(new Column( 10, "Base PV", "BaseBV", 30, Integer.class )); Columns.add(new Column( 11, "Adj PV", "TotalBV", false, 40, Integer.class, true, SortOrder.ASCENDING )); - + Columns.get(0).sortOrder = SortOrder.ASCENDING; Columns.get(6).sortOrder = SortOrder.ASCENDING; @@ -56,7 +56,7 @@ public tbBattleForceView( UnitList list ) { } public Object getValueAt( int row, int col ) { - UnitListData m = (UnitListData) list.Get( row ); + UnitListData m = list.Get( row ); switch( col ) { case 0: return m.getBattleForceStats().getElement(); @@ -82,7 +82,8 @@ public Object getValueAt( int row, int col ) { return m.getBattleForceStats().getBasePV(); case 11: return m.getBattleForceStats().getPointValue(); + default: + return null; } - return null; } } diff --git a/sswlib/src/main/java/list/view/tbChatInformation.java b/sswlib/src/main/java/list/view/tbChatInformation.java index 2ecb4908..31b89f18 100644 --- a/sswlib/src/main/java/list/view/tbChatInformation.java +++ b/sswlib/src/main/java/list/view/tbChatInformation.java @@ -51,14 +51,14 @@ public tbChatInformation( UnitList list ) { } public Object getValueAt( int row, int col ) { - UnitListData m = (UnitListData) list.Get( row ); + UnitListData m = list.Get( row ); switch( col ) { case 0: return m.getFullName(); case 1: return m.getInfo(); case 2: - return (int) m.getBV(); + return m.getBV(); case 3: return String.format("%10.0f", m.getCost()); case 4: @@ -67,7 +67,8 @@ public Object getValueAt( int row, int col ) { return m.getEra(); case 6: return m.getTech(); + default: + return null; } - return null; } } diff --git a/sswlib/src/main/java/list/view/tbTotalWarfareCompact.java b/sswlib/src/main/java/list/view/tbTotalWarfareCompact.java index b1ea56a4..97a88cb5 100644 --- a/sswlib/src/main/java/list/view/tbTotalWarfareCompact.java +++ b/sswlib/src/main/java/list/view/tbTotalWarfareCompact.java @@ -48,21 +48,22 @@ public tbTotalWarfareCompact( UnitList list ) { } public Object getValueAt( int row, int col ) { - UnitListData m = (UnitListData) list.Get( row ); + UnitListData m = list.Get( row ); switch( col ) { case 0: - return (int) m.getTonnage(); + return m.getTonnage(); case 1: return m.getFullName(); case 2: - return (int) m.getBV(); + return m.getBV(); case 3: return m.getLevel(); case 4: return m.getEra(); case 5: return m.getTech(); + default: + return null; } - return null; } } diff --git a/sswlib/src/main/java/list/view/tbTotalWarfareView.java b/sswlib/src/main/java/list/view/tbTotalWarfareView.java index 89cacc32..0851cd17 100644 --- a/sswlib/src/main/java/list/view/tbTotalWarfareView.java +++ b/sswlib/src/main/java/list/view/tbTotalWarfareView.java @@ -27,13 +27,13 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT package list.view; -import java.text.NumberFormat; import javax.swing.SortOrder; -import javax.swing.text.NumberFormatter; import list.UnitList; import list.UnitListData; public class tbTotalWarfareView extends abView { + private static final long serialVersionUID = 3746192148272629301L; + public tbTotalWarfareView( UnitList list ) { this.list = list; @@ -55,14 +55,14 @@ public tbTotalWarfareView( UnitList list ) { } public Object getValueAt( int row, int col ) { - UnitListData m = (UnitListData) list.Get( row ); + UnitListData m = list.Get( row ); switch( col ) { case 0: - return (int) m.getTonnage(); + return m.getTonnage(); case 1: return m.getFullName(); case 2: - return (int) m.getBV(); + return m.getBV(); case 3: return String.format("%10.0f", m.getCost()); case 4: @@ -75,7 +75,8 @@ public Object getValueAt( int row, int col ) { return m.getYear(); case 8: return m.getSource(); + default: + return null; } - return null; } } From 4b9789d2d0e0c8e2e9e0987d4807110ebdb66bbc Mon Sep 17 00:00:00 2001 From: George Blouin Date: Mon, 8 Mar 2021 20:25:06 -0700 Subject: [PATCH 106/126] Encode to UTF-8 as I was getting build errors for smart quotes in the advantages file. --- sswlib/build.gradle | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sswlib/build.gradle b/sswlib/build.gradle index 245f92b9..a9e462c6 100644 --- a/sswlib/build.gradle +++ b/sswlib/build.gradle @@ -6,12 +6,14 @@ plugins { java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 + compileJava.options.encoding = "UTF-8" + compileTestJava.options.encoding = "UTF-8" } dependencies { implementation 'com.google.code.gson:gson:2.8.6' implementation 'org.apache.commons:commons-csv:1.8' - + testCompile group: 'junit', name: 'junit', version: '4.12' } From 11782448cea52be8809276a40580ded67e45412b Mon Sep 17 00:00:00 2001 From: George Blouin Date: Mon, 8 Mar 2021 20:50:01 -0700 Subject: [PATCH 107/126] Update Usages From other areas too --- BFB/src/main/java/BFB/GUI/dlgQuickAdd.java | 6 ++-- saw/src/main/java/saw/gui/dlgOpen.java | 30 +++++++++++-------- ssw/src/main/java/ssw/gui/dlgOpen.java | 30 +++++++++++-------- sswlib/src/main/java/list/UnitList.java | 16 +++++----- .../java/list/view/tbBattleForceView.java | 4 +-- .../java/list/view/tbChatInformation.java | 4 +-- .../java/list/view/tbTotalWarfareCompact.java | 4 +-- .../java/list/view/tbTotalWarfareView.java | 4 +-- 8 files changed, 49 insertions(+), 49 deletions(-) diff --git a/BFB/src/main/java/BFB/GUI/dlgQuickAdd.java b/BFB/src/main/java/BFB/GUI/dlgQuickAdd.java index 934dde6a..39fa251d 100644 --- a/BFB/src/main/java/BFB/GUI/dlgQuickAdd.java +++ b/BFB/src/main/java/BFB/GUI/dlgQuickAdd.java @@ -9,7 +9,7 @@ import list.view.*; public class dlgQuickAdd extends javax.swing.JDialog { - + private frmBase parent; private Force force; private UnitList list, filtered = new UnitList(); @@ -39,7 +39,7 @@ public dlgQuickAdd(java.awt.Frame parent, boolean modal, Force force) { cmbPiloting.setSelectedIndex(5); list = new UnitList(this.parent.Prefs.get("ListPath", ""), true); - viewModel = new tbTotalWarfareCompact(list); + viewModel = new tbTotalWarfareCompact(); tblList.setModel(new DefaultTableModel()); //setupList(list); } @@ -56,7 +56,7 @@ private void Filter(java.awt.event.ActionEvent evt) { } private void setupList(UnitList mechList) { - viewModel.list = mechList; + viewModel.setList(mechList); viewModel.setupTable(tblList); } diff --git a/saw/src/main/java/saw/gui/dlgOpen.java b/saw/src/main/java/saw/gui/dlgOpen.java index f390614f..b801078e 100644 --- a/saw/src/main/java/saw/gui/dlgOpen.java +++ b/saw/src/main/java/saw/gui/dlgOpen.java @@ -53,7 +53,11 @@ public class dlgOpen extends javax.swing.JFrame implements PropertyChangeListene private String dirPath = ""; private String NL = ""; private String msg = ""; - private abView currentView = new tbTotalWarfareView(list); + private abView twView = new tbTotalWarfareView(); + private abView bfView = new tbBattleForceView(); + private abView compView = new tbTotalWarfareCompact(); + private abView chatView = new tbChatInformation(); + private abView currentView = twView; private boolean cancelledListDirSelection = false; public int Requestor = SSW; @@ -66,7 +70,7 @@ public dlgOpen(java.awt.Frame parent, boolean modal) { //ImageIcon icon = new ImageIcon(super.getClass().getResource("/ssw/Images/appicon.png")); //super.setIconImage(icon.getImage()); this.parent = (common.DesignForm) parent; - + prgResaving.setVisible(false); cmbTech.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Tech", "Clan", "Inner Sphere", "Mixed" })); cmbEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Era", "Age of War/Star League", "Succession Wars", "Clan Invasion", "Dark Ages", "All Eras (non-canon)" })); @@ -74,7 +78,7 @@ public dlgOpen(java.awt.Frame parent, boolean modal) { cmbMotive.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Motive", "Hovercraft", "Naval (Displacement)", "Naval (Hydrofoil)", "Naval (Submarine)", "Tracked", "VTOL", "Wheeled", "WiGE" })); NL = System.getProperty( "line.separator" ); } - + private void LoadMech() { switch ( Requestor ) { case SSW: @@ -141,7 +145,7 @@ public void LoadList(boolean useIndex) { this.lblStatus.setText("Loading Units..."); this.txtSelected.setText("0 Units Selected for 0 BV and 0 C-Bills"); this.tblMechData.setModel(new UnitList()); - + if (dirPath.isEmpty()) { dirPath = parent.GetPrefs().get("ListPath", parent.GetPrefs().get( "LastOpenCVDirectory", "" ) ); @@ -165,7 +169,7 @@ public void LoadList(boolean useIndex) { } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - + list = new UnitList(dirPath, useIndex); if (list.Size() > 0) { @@ -242,7 +246,7 @@ private void setTooltip( UnitListData data ) { //do nothing } } - + public void propertyChange( PropertyChangeEvent e ) { prgResaving.setValue( ((Resaver) e.getSource()).getProgress() ); } @@ -1226,7 +1230,7 @@ private void txtMaxCostFilter(java.awt.event.ActionEvent evt) {//GEN-FIRST:event private void btnClearFilterFilter(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearFilterFilter setupList(list, false); - + //clear the dropdowns cmbEra.setSelectedIndex(0); cmbMotive.setSelectedIndex(0); @@ -1350,7 +1354,7 @@ private void tblMechDataKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:ev private void btnViewForceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnViewForceActionPerformed lblForce.setText(""); - + //if ( tblMechData.getSelectedRowCount() > 0 ) { // btnAdd2ForceActionPerformed(evt); //} @@ -1369,19 +1373,19 @@ private void formWindowGainedFocus(java.awt.event.WindowEvent evt) {//GEN-FIRST: private void cmbViewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbViewActionPerformed switch ( cmbView.getSelectedIndex() ) { case 0: - currentView = new tbTotalWarfareView(list); + currentView = twView.setList(list); break; case 1: - currentView = new tbTotalWarfareCompact(list); + currentView = compView.setList(list); break; case 2: - currentView = new tbBattleForceView(list); + currentView = bfView.setList(list); break; case 3: - currentView = new tbChatInformation(list); + currentView = chatView.setList(list); break; default: - currentView = new tbTotalWarfareView(list); + currentView = twView.setList(list); } tblMechData.setModel(currentView); currentView.setupTable(tblMechData); diff --git a/ssw/src/main/java/ssw/gui/dlgOpen.java b/ssw/src/main/java/ssw/gui/dlgOpen.java index 0a9eee6c..a1344d5c 100644 --- a/ssw/src/main/java/ssw/gui/dlgOpen.java +++ b/ssw/src/main/java/ssw/gui/dlgOpen.java @@ -50,7 +50,11 @@ public class dlgOpen extends javax.swing.JFrame implements PropertyChangeListene private String dirPath = ""; private String NL = ""; private String msg = ""; - private abView currentView = new tbTotalWarfareView(list); + private abView twView = new tbTotalWarfareView(); + private abView bfView = new tbBattleForceView(); + private abView compView = new tbTotalWarfareCompact(); + private abView chatView = new tbChatInformation(); + private abView currentView = twView; private boolean cancelledListDirSelection = false; public int Requestor = SSW; @@ -63,7 +67,7 @@ public dlgOpen(java.awt.Frame parent, boolean modal) { ImageIcon icon = new ImageIcon(super.getClass().getResource("/ssw/Images/appicon.png")); super.setIconImage(icon.getImage()); this.parent = (ifMechForm) parent; - + prgResaving.setVisible(false); cmbTech.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Tech", "Clan", "Inner Sphere", "Mixed" })); cmbEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Era", "Age of War/Star League", "Succession Wars", "Clan Invasion", "Dark Ages", "All Eras (non-canon)" })); @@ -72,7 +76,7 @@ public dlgOpen(java.awt.Frame parent, boolean modal) { cmbMotive.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any Motive", "Biped", "Quad" })); NL = System.getProperty( "line.separator" ); } - + private void LoadMech() { switch ( Requestor ) { case SSW: @@ -139,7 +143,7 @@ public void LoadList(boolean useIndex) { this.lblStatus.setText("Loading Mechs..."); this.txtSelected.setText("0 Units Selected for 0 BV and 0 C-Bills"); this.tblMechData.setModel(new UnitList()); - + if (dirPath.isEmpty()) { dirPath = parent.GetPrefs().get("ListPath", parent.GetPrefs().get( "LastOpenDirectory", "" ) ); @@ -163,7 +167,7 @@ public void LoadList(boolean useIndex) { } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - + list = new UnitList(dirPath, useIndex); if (list.Size() > 0) { @@ -239,7 +243,7 @@ private void setTooltip( UnitListData data ) { //do nothing } } - + public void propertyChange( PropertyChangeEvent e ) { prgResaving.setValue( ((Resaver) e.getSource()).getProgress() ); } @@ -1254,7 +1258,7 @@ private void txtMaxCostFilter(java.awt.event.ActionEvent evt) {//GEN-FIRST:event private void btnClearFilterFilter(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearFilterFilter setupList(list, false); - + //clear the dropdowns cmbEra.setSelectedIndex(0); cmbMotive.setSelectedIndex(0); @@ -1383,7 +1387,7 @@ private void tblMechDataKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:ev private void btnViewForceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnViewForceActionPerformed lblForce.setText(""); - + //if ( tblMechData.getSelectedRowCount() > 0 ) { // btnAdd2ForceActionPerformed(evt); //} @@ -1402,19 +1406,19 @@ private void formWindowGainedFocus(java.awt.event.WindowEvent evt) {//GEN-FIRST: private void cmbViewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbViewActionPerformed switch ( cmbView.getSelectedIndex() ) { case 0: - currentView = new tbTotalWarfareView(list); + currentView = twView.setList(list); break; case 1: - currentView = new tbTotalWarfareCompact(list); + currentView = compView.setList(list); break; case 2: - currentView = new tbBattleForceView(list); + currentView = bfView.setList(list); break; case 3: - currentView = new tbChatInformation(list); + currentView = chatView.setList(list); break; default: - currentView = new tbTotalWarfareView(list); + currentView = twView.setList(list); } tblMechData.setModel(currentView); currentView.setupTable(tblMechData); diff --git a/sswlib/src/main/java/list/UnitList.java b/sswlib/src/main/java/list/UnitList.java index 5bd22d5f..9d5ed265 100644 --- a/sswlib/src/main/java/list/UnitList.java +++ b/sswlib/src/main/java/list/UnitList.java @@ -41,13 +41,13 @@ public class UnitList extends AbstractTableModel { private ArrayList List = new ArrayList(); private String Directory = ""; private int IndexVersion = 10; - private abView currentModel = new tbTotalWarfareView(this); + private abView currentModel = new tbTotalWarfareView(); String[] Extensions = { ".ssw", ".saw" }; public UnitList() { } - + public UnitList(String directory) { this(directory, true); } @@ -78,7 +78,7 @@ public UnitList( String directory, boolean useIndex ) { } } } - + final void Load( String Directory ) { File d = new File(Directory); if ( d.isDirectory() && !d.isHidden() ) { @@ -93,7 +93,7 @@ final void Load( String Directory ) { } } } - + boolean EditorFile(File f) { for ( String ext : Extensions ) { if ( f.getPath().endsWith(ext) ) return true; @@ -220,13 +220,13 @@ public UnitList Filter(ListFilter filter) { if ( ! filter.getSource().isEmpty() ) { if (! mData.getSource().toUpperCase().contains( filter.getSource().toUpperCase() ) ) remove = true; } - + if (remove) m.List.remove(mData); } return m; } - + public final void Write() throws IOException { if (List.size() > 0) { BufferedWriter bw = new BufferedWriter(new FileWriter(getDirectory() + File.separator + "index.ssi") ); @@ -320,7 +320,7 @@ public Object getClassOf( int c ) { public void fireTableDataChanged() { super.fireTableDataChanged(); } - + public Object getValueAt( int row, int col ) { UnitListData m = (UnitListData) List.get( row ); switch( col ) { @@ -357,7 +357,7 @@ public void setValueAt( Object value, int row, int col ) { * @return the currentModel */ public abView getCurrentModel() { - return currentModel; + return currentModel.setList(this); } /** diff --git a/sswlib/src/main/java/list/view/tbBattleForceView.java b/sswlib/src/main/java/list/view/tbBattleForceView.java index 7db26517..1477bcb2 100644 --- a/sswlib/src/main/java/list/view/tbBattleForceView.java +++ b/sswlib/src/main/java/list/view/tbBattleForceView.java @@ -32,9 +32,7 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import list.UnitListData; public class tbBattleForceView extends abView { - public tbBattleForceView( UnitList list ) { - this.list = list; - + public tbBattleForceView() { Columns.add(new Column( 0, "Unit", "TypeModel", 200 )); Columns.add(new Column( 1, "MV", "MV", 20, Integer.class )); Columns.add(new Column( 2, "S", "S", 20, Integer.class )); diff --git a/sswlib/src/main/java/list/view/tbChatInformation.java b/sswlib/src/main/java/list/view/tbChatInformation.java index 31b89f18..9c592d02 100644 --- a/sswlib/src/main/java/list/view/tbChatInformation.java +++ b/sswlib/src/main/java/list/view/tbChatInformation.java @@ -32,9 +32,7 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import list.UnitListData; public class tbChatInformation extends abView { - public tbChatInformation( UnitList list ) { - this.list = list; - + public tbChatInformation() { Columns.add(new Column( 0, "Type/Model", "Name", false, 125, String.class, true, SortOrder.ASCENDING )); Columns.add(new Column( 1, "Information", "ChatInfo", false, 325, String.class, true, SortOrder.ASCENDING )); Columns.add(new Column( 2, "BV", "BV", false, 20, Integer.class, true, SortOrder.ASCENDING )); diff --git a/sswlib/src/main/java/list/view/tbTotalWarfareCompact.java b/sswlib/src/main/java/list/view/tbTotalWarfareCompact.java index 97a88cb5..7a990df1 100644 --- a/sswlib/src/main/java/list/view/tbTotalWarfareCompact.java +++ b/sswlib/src/main/java/list/view/tbTotalWarfareCompact.java @@ -32,9 +32,7 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT import list.UnitListData; public class tbTotalWarfareCompact extends abView { - public tbTotalWarfareCompact( UnitList list ) { - this.list = list; - + public tbTotalWarfareCompact() { Columns.add(new Column( 0, "Tons", "Tonnage", false, 20, Integer.class, true, SortOrder.ASCENDING )); Columns.add(new Column( 1, "Type/Model", "Name", false, 180, String.class, true, SortOrder.ASCENDING )); Columns.add(new Column( 2, "BV", "BV", false, 20, Integer.class, true, SortOrder.ASCENDING )); diff --git a/sswlib/src/main/java/list/view/tbTotalWarfareView.java b/sswlib/src/main/java/list/view/tbTotalWarfareView.java index 0851cd17..ed991a71 100644 --- a/sswlib/src/main/java/list/view/tbTotalWarfareView.java +++ b/sswlib/src/main/java/list/view/tbTotalWarfareView.java @@ -34,9 +34,7 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT public class tbTotalWarfareView extends abView { private static final long serialVersionUID = 3746192148272629301L; - public tbTotalWarfareView( UnitList list ) { - this.list = list; - + public tbTotalWarfareView() { Columns.add(new Column( 0, "Tons", "Tonnage", false, 20, Integer.class, true, SortOrder.ASCENDING )); Columns.add(new Column( 1, "Type/Model", "Name", false, 150, String.class, true, SortOrder.ASCENDING )); Columns.add(new Column( 2, "BV", "BV", false, 20, Integer.class, true, SortOrder.ASCENDING )); From cc66aa29bc22d6ccedb0ba3bf6fba0a62c8d3afd Mon Sep 17 00:00:00 2001 From: George Blouin Date: Mon, 8 Mar 2021 20:54:39 -0700 Subject: [PATCH 108/126] Missed file Updated to new constructor --- BFB/src/main/java/BFB/GUI/frmBase.java | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/BFB/src/main/java/BFB/GUI/frmBase.java b/BFB/src/main/java/BFB/GUI/frmBase.java index 5d70b20c..0cdd814a 100644 --- a/BFB/src/main/java/BFB/GUI/frmBase.java +++ b/BFB/src/main/java/BFB/GUI/frmBase.java @@ -82,9 +82,9 @@ public class frmBase extends javax.swing.JFrame implements java.awt.datatransfer private Media media = new Media(); private ImageTracker images = new ImageTracker(); private Force addToForce = new Force(); - + private UnitList list = new UnitList(), filtered, chosen = new UnitList(); - private abView currentView = new tbTotalWarfareView(list); + private abView currentView = new tbTotalWarfareView(); private String MechListPath = "", BaseRUSPath = "./Data/Tables/", RUSDirectory = "", RUSPath = BaseRUSPath, CurrentFile = ""; private RUS rus = new RUS(); @@ -124,7 +124,7 @@ public frmBase() { initComponents(); Prefs = Preferences.userRoot().node( Constants.BFBPrefs ); MechListPath = Prefs.get("ListPath", ""); - + popUtilities.add(popGroup); popUtilities.add(popSkill); popUtilities.add(popName); @@ -149,7 +149,7 @@ public frmBase() { edtSpecialRules.addKeyListener(KeyTyped); edtVictoryConditions.addKeyListener(KeyTyped); edtAftermath.addKeyListener(KeyTyped); - + Refresh(); lblStatusUpdate.setText(""); LoadRUSOptions(); @@ -174,7 +174,7 @@ public void Refresh() { } else { btnISTop.setSelected(true); } - + if ( scenario.getDefenderForce().getType().equals(BattleForce.Comstar) ) { btnCSBottom.setSelected(true); } else if ( scenario.getDefenderForce().getType().equals(BattleForce.Clan) ) { @@ -184,7 +184,7 @@ public void Refresh() { } lblForceMod.setText( String.format( "%1$,.2f", CommonTools.GetForceSizeMultiplier( scenario.getAttackerForce().getUnits().size(), scenario.getDefenderForce().getUnits().size() )) ); - + updateFields(); } @@ -317,7 +317,7 @@ private void updateFields() { private void loadScenario( String filename ) { if ( filename.isEmpty() ) { return; } - + BFBReader reader = new BFBReader(); //Force[] forces; try { @@ -3429,7 +3429,7 @@ private void mnuLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST System.out.println(e.getMessage()); return; } - + DefaultCursor(); } }//GEN-LAST:event_mnuLoadActionPerformed @@ -3537,7 +3537,7 @@ private void mnuSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST XMLWriter writer = new XMLWriter(); writer.WriteScenario(scenario, filename); - + Prefs.put("LastOpenBFBFile", filename); //Prefs.put("CurrentBFBFile", filename); CurrentFile = filename; @@ -3626,7 +3626,7 @@ private void btnMULExportActionPerformed(java.awt.event.ActionEvent evt) {//GEN- MULWriter mw = new MULWriter(); String dir = ""; dir = media.GetDirectorySelection(this, Prefs.get("MULDirectory", "")); - if ( dir.isEmpty() ) { + if ( dir.isEmpty() ) { DefaultCursor(); return; } @@ -3941,11 +3941,11 @@ private void mnuBVListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR //Media.Messager("This will output a csv list of mechs and also a list of EVERY SINGLE Mech's cost and BV2 calculation!"); WaitCursor(); if ( list == null ) { LoadList(true); } - + TXTWriter out = new TXTWriter(); String dir = ""; dir = media.GetDirectorySelection(this, Prefs.get("ListDirectory", "")); - if ( dir.isEmpty() ) { + if ( dir.isEmpty() ) { DefaultCursor(); return; } @@ -4197,7 +4197,7 @@ private void btnAddGeneric1ActionPerformed(java.awt.event.ActionEvent evt) {//GE dlgGen.setLocationRelativeTo(this); dlgGen.setVisible(true); }//GEN-LAST:event_btnAddGeneric1ActionPerformed - + private void setTooltip(UnitListData data) { spnMechTable.setToolTipText(data.getInfo()); txtInfo.setText(data.getInfo()); @@ -4272,7 +4272,7 @@ private void btnFilterFilter(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ }//GEN-LAST:event_btnFilterFilter private void setupList(UnitList mechList, boolean forceSort) { - currentView.list = mechList; + currentView.setList(mechList); tblMechData.setModel(currentView); currentView.setupTable(tblMechData); From 028545ade58ff832be063a6e7ef7174fbf18e3e0 Mon Sep 17 00:00:00 2001 From: George Blouin Date: Fri, 12 Mar 2021 13:29:33 -0700 Subject: [PATCH 109/126] VSCode Space Changes My editor seems to remove extra spaces from the ends of lines --- saw/src/main/java/saw/gui/frmVee.java | 170 +++++++++++++------------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/saw/src/main/java/saw/gui/frmVee.java b/saw/src/main/java/saw/gui/frmVee.java index 4ab98b78..d5ee88ea 100644 --- a/saw/src/main/java/saw/gui/frmVee.java +++ b/saw/src/main/java/saw/gui/frmVee.java @@ -89,7 +89,7 @@ public final class frmVee extends javax.swing.JFrame implements java.awt.datatra private ImageTracker imageTracker = new ImageTracker(); public dlgOpen dOpen = new dlgOpen(this, true); public frmForce dForce = new frmForce(this, imageTracker); - + TextPane Overview = new TextPane(); TextPane Capabilities = new TextPane(); TextPane Deployment = new TextPane(); @@ -142,7 +142,7 @@ public void run() { } } }; - + /** Creates new form frmMain2 */ public frmVee() { CurVee = new CombatVehicle( ); @@ -197,7 +197,7 @@ public frmVee() { System.err.println( e.getMessage() ); e.printStackTrace(); } - + Overview.SetEditorSize( 310, 380 ); Capabilities.SetEditorSize( 310, 380 ); Deployment.SetEditorSize( 310, 380 ); @@ -214,7 +214,7 @@ public frmVee() { pnlNotables.add( Notables ); pack(); - + mnuDetails.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { GetInfoOn(); @@ -245,7 +245,7 @@ public void actionPerformed(ActionEvent e) { LaserInsulator(); } }); - + mnuAddPulseModule.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { PulseModule(); @@ -353,7 +353,7 @@ public void actionPerformed(ActionEvent e) { mnuCaseless.setVisible( false ); mnuVGLArc.setVisible( false ); mnuVGLAmmo.setVisible( false ); - + // set the program options cmbRulesLevel.setSelectedItem( Prefs.get( "NewCV_RulesLevel", "Tournament Legal" ) ); cmbEra.setSelectedItem( Prefs.get( "NewCV_Era", "Age of War/Star League" ) ); @@ -403,8 +403,8 @@ public void actionPerformed(ActionEvent e) { mnuFluff.add( mnuFluffCut ); mnuFluff.add( mnuFluffCopy ); mnuFluff.add( mnuFluffPaste ); - - + + tblWeaponManufacturers.setModel( new javax.swing.table.AbstractTableModel() { @Override public String getColumnName( int col ) { @@ -451,7 +451,7 @@ public void setValueAt( Object value, int row, int col ) { } } } ); - + tblWeaponManufacturers.getInputMap( javax.swing.JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_TAB, 0, false ), "selectNextRow" ); //if( Prefs.getBoolean( "LoadLastMech", false ) ) { LoadVehicleFromFile(Prefs.get("LastOpenCVDirectory", "") + Prefs.get("LastOpenCVFile", "") ); } @@ -471,7 +471,7 @@ private void GetInfoOn() { ItemInfo.setVisible( true ); } } - + private void SetAmmoLotSize() { if( CurItem instanceof Ammunition ) { dlgAmmoLotSize ammo = new dlgAmmoLotSize( this, true, (Ammunition) CurItem ); @@ -481,7 +481,7 @@ private void SetAmmoLotSize() { RefreshSummary(); RefreshInfoPane(); } - + private void PPCCapacitor() { // if the current item can support a capacitor, adds one on if( CurItem instanceof RangedWeapon ) { @@ -553,7 +553,7 @@ private void LaserInsulator() { RefreshInfoPane(); RefreshSelectedEquipment(); } - + private void PulseModule() { // if the current item can support a Pulse Module, adds one on if( CurItem instanceof RangedWeapon ) { @@ -592,7 +592,7 @@ private void PulseModule() { private void DumperMount() { if ( CurItem instanceof Equipment ) { - + } } @@ -721,7 +721,7 @@ public void SetVariableSize() { } } } - + private void RefreshSelectedEquipment() { Equipment[SELECTED] = CurVee.GetLoadout().GetNonCore().toArray(); lstSelectedEquipment.setListData( Equipment[SELECTED] ); @@ -883,7 +883,7 @@ public void RefreshInfoPane() { txtInfoTonnage.setForeground( Color.BLACK ); txtInfoFreeTons.setForeground( Color.BLACK ); } - + if ( CurVee.GetAvailableSlots() < 0 ) { txtInfoFreeCrits.setForeground(Color.red); } else { @@ -900,7 +900,7 @@ public void RefreshInfoPane() { } txtInfoBattleValue.setText( "BV: " + String.format( "%1$,d", CurVee.GetCurrentBV() ) ); txtInfoCost.setText( "Cost: " + String.format( "%1$,.0f", Math.floor( CurVee.GetTotalCost() + 0.5f ) ) ); - + javax.swing.table.AbstractTableModel m = (javax.swing.table.AbstractTableModel) tblWeaponManufacturers.getModel(); m.fireTableDataChanged(); } @@ -5259,7 +5259,7 @@ private void RefreshSummary() { private void RecalcArmorPlacement() { if ( Load ) return; - + double tonnage = CurVee.GetArmor().GetTonnage(); ArmorTons.SetArmorTonnage( tonnage ); try { @@ -5276,10 +5276,10 @@ private void RecalcArmorPlacement() { RefreshSummary(); RefreshInfoPane(); } - + private void RecalcArmorLocations() { pnlRotorArmor.setVisible(false); - + if ( cmbTurret.getSelectedItem().toString().equals("No Turret") ) { spnTurretArmor.setValue(0); spnRearTurretArmor.setValue(0); @@ -5293,7 +5293,7 @@ private void RecalcArmorLocations() { pnlTurretArmor.setVisible(true); pnlRearTurretArmor.setVisible(true); } - if ( CurVee.IsVTOL() ) + if ( CurVee.IsVTOL() ) pnlRotorArmor.setVisible(true); else spnRotorArmor.setValue(0); @@ -5353,7 +5353,7 @@ private void SolidifyVehicle() { private void BuildLocationSelector() { int curSelection = Math.max(cmbLocation.getSelectedIndex(), 0); - + ArrayList locs = new ArrayList(); locs.add("Front"); locs.add("Left"); @@ -5366,13 +5366,13 @@ private void BuildLocationSelector() { locs.add("Body"); if ( CurVee.isHasTurret1() ) locs.add("Turret"); - if ( CurVee.isHasTurret2() ) + if ( CurVee.isHasTurret2() ) locs.add("Rear Turret"); - + cmbLocation.setModel(new DefaultComboBoxModel(locs.toArray())); cmbLocation.setSelectedIndex(curSelection); } - + private void BuildArmorSelector() { // builds the armor selection box ArrayList list = new ArrayList(); @@ -5394,7 +5394,7 @@ private void BuildArmorSelector() { // now set the armor chooser cmbArmorType.setModel( new javax.swing.DefaultComboBoxModel( temp ) ); - + cmbArmorType.setSelectedItem(CurVee.GetArmor().ActualName()); } @@ -5452,7 +5452,7 @@ private void FixArmorSpinners() { // fixes the armor spinners to match the new tonnage / motive type CVArmor a = CurVee.GetArmor(); a.SetMaxArmor(CurVee.GetArmorableLocationCount()); - + spnFrontArmor.setModel( new javax.swing.SpinnerNumberModel( a.GetLocationArmor( LocationIndex.CV_LOC_FRONT ), 0, a.GetLocationMax(LocationIndex.CV_LOC_FRONT), 1) ); spnLeftArmor.setModel( new javax.swing.SpinnerNumberModel( a.GetLocationArmor( LocationIndex.CV_LOC_LEFT ), 0, a.GetLocationMax(LocationIndex.CV_LOC_LEFT), 1) ); spnRightArmor.setModel( new javax.swing.SpinnerNumberModel( a.GetLocationArmor( LocationIndex.CV_LOC_RIGHT ), 0, a.GetLocationMax(LocationIndex.CV_LOC_RIGHT), 1) ); @@ -5466,7 +5466,7 @@ private void FixArmorSpinners() { ((JSpinner.DefaultEditor)spnCruiseMP.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnJumpMP.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnHeatSinks.getEditor()).getTextField().addFocusListener(spinners); - + //Setup Spinner focus ((JSpinner.DefaultEditor)spnFrontArmor.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnLeftArmor.getEditor()).getTextField().addFocusListener(spinners); @@ -5498,10 +5498,10 @@ public void FixTonnageSpinner( int MinTonnage, int MaxTonnage ) { int CurVal = Integer.parseInt(spnTonnage.getValue().toString()); if ( CurVal < MinTonnage ) CurVal = MinTonnage; - + if ( CurVal > MaxTonnage ) CurVal = MaxTonnage; - + spnTonnage.setModel( new javax.swing.SpinnerNumberModel(CurVal, MinTonnage, MaxTonnage, 1) ); spnTonnageStateChanged(null); } @@ -5540,7 +5540,7 @@ private void cmbRulesLevelActionPerformed(java.awt.event.ActionEvent evt) {//GEN CurVee.SetRulesLevel( NewLevel ); CheckTonnage( true ); CurVee.SetChanged(true); - + // get the currently chosen selections SaveSelections(); BuildTechBaseSelector(); @@ -5595,7 +5595,7 @@ public void CheckTonnage( boolean RulesChange ) { if( CurVee.GetTonnage() < 1 ) { spnTonnage.setValue(1); } - + if ( CurVee.GetTonnage() > CurVee.GetMaxTonnage() ) { spnTonnage.setValue(CurVee.GetMaxTonnage()); } @@ -5697,7 +5697,7 @@ private void BuildChassisSelector() chkEnviroSealing.setEnabled(false); } } - + private void BuildExpEquipmentSelector() { JCheckBox[] ExpEquipmentCheckboxes = { chkArmoredMotive, chkSupercharger, @@ -5719,7 +5719,7 @@ private void BuildExpEquipmentSelector() { private void cmbMotiveTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbMotiveTypeActionPerformed if ( Load ) return; boolean wasVtol = CurVee.IsVTOL(); - + switch ( cmbMotiveType.getSelectedIndex() ) { case 0: //Hovercraft CurVee.SetHover(); @@ -5761,7 +5761,7 @@ private void cmbMotiveTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN } else { chkTrailer.setEnabled(true); } - + BuildTurretSelector(); cmbTurretActionPerformed(null); BuildChassisSelector(); @@ -6019,7 +6019,7 @@ private void ShowInfoOn( abPlaceable p ) { } private void chkSuperchargerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkSuperchargerActionPerformed - + }//GEN-LAST:event_chkSuperchargerActionPerformed private void chkUseTCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkUseTCActionPerformed @@ -6128,7 +6128,7 @@ private void chkClanCASEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F RefreshInfoPane(); return; } - + try { switch ( CurVee.GetTechBase() ) { case AvailableCode.TECH_INNER_SPHERE: @@ -6409,13 +6409,13 @@ private void spnCruiseMPStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-F try { // the commitedit worked, so set the engine rating and report the running mp int walkMP = Math.min(n.getNumber().intValue(), CurVee.getMaxCruiseMP()); - + if ( !CurVee.GetEngine().RequiresControls() && walkMP > 0 ) { spnCruiseMP.setValue(0); //Media.Messager("Please select an engine first"); return; } - + CurVee.setCruiseMP( walkMP ); } catch( Exception e ) { Media.Messager( e.getMessage() ); @@ -6447,7 +6447,7 @@ private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST setCursor( NormalCursor ); return; } - + //Since we are saving to a new file update the stored prefs try { Prefs.put("LastOpenCVDirectory", savevee.getCanonicalPath().replace(savevee.getName(), "")); @@ -6705,7 +6705,7 @@ private boolean VerifyVehicle( ActionEvent evt ) { private void spnTonnageStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnTonnageStateChanged if( Load ) { return; } - + // We have to decode the selected index to set values. A bit safer, I // think, because we can directly set the values ourselves. int Tons = 0; @@ -6718,7 +6718,7 @@ private void spnTonnageStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI } if ( Tons == 0 ) Tons = 1; - + if ( Tons >= 0 && Tons <= 39) lblVeeClass.setText("Light Vee"); if ( Tons >= 40 && Tons <= 59 ) @@ -6807,12 +6807,12 @@ private void RecalcEngine() { private void GetNewVee() { boolean Omni = CurVee.IsOmni(); - + CurVee = new CombatVehicle(); spnTonnage.setModel(new SpinnerNumberModel(CurVee.GetTonnage(), 1, CurVee.GetMaxTonnage(), 1)); spnCruiseMP.setModel(new SpinnerNumberModel(CurVee.getCruiseMP(), 1, CurVee.getMaxCruiseMP(), 1)); spnHeatSinks.setModel(new SpinnerNumberModel(CurVee.GetHeatSinks().GetNumHS(), 0, 50, 1)); - + cmbMotiveType.setSelectedIndex( 0 ); chkYearRestrict.setSelected( false ); txtProdYear.setText( "" ); @@ -6859,7 +6859,7 @@ private void GetNewVee() { CurVee.SetYear( 0, false ); break; } - + cmbTechBase.setSelectedItem( Prefs.get( "NewVee_Techbase", "Inner Sphere" ) ); switch( cmbTechBase.getSelectedIndex() ) { case AvailableCode.TECH_INNER_SPHERE: @@ -7008,7 +7008,7 @@ private void RefreshEquipment() { chkClanCASE.setSelected(false); chkClanCASE.setEnabled(false); } - + // fix Artemis IV controls ifMissileGuidance ArtCheck = new ArtemisIVFCS( null ); if( CommonTools.IsAllowed( ArtCheck.GetAvailability(), CurVee ) ) { @@ -7160,7 +7160,7 @@ private void SetWeaponChoosers() { // get the equipment lists for the choices. if ( data == null ) return; - + Equipment[ENERGY] = data.GetEquipment().GetEnergyWeapons( CurVee ); Equipment[MISSILE] = data.GetEquipment().GetMissileWeapons( CurVee ); Equipment[BALLISTIC] = data.GetEquipment().GetBallisticWeapons( CurVee ); @@ -7190,7 +7190,7 @@ private void SetWeaponChoosers() { lstSelectedEquipment.setListData( Equipment[SELECTED] ); lstChooseArtillery.setListData( Equipment[ARTILLERY] ); lstSelectedEquipment.repaint(); - + ResetAmmo(); } @@ -7198,7 +7198,7 @@ private void UnlockGUIFromOmni() { // this should be used anytime a new mech is made or when unlocking // an Omni. isLocked = false; - + chkOmniVee.setSelected( false ); chkOmniVee.setEnabled( true ); mnuUnlock.setEnabled( false ); @@ -7422,7 +7422,7 @@ private void cmbEngineTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN if( BuildLookupName( CurVee.GetEngine().GetCurrentState() ).equals( (String) cmbEngineType.getSelectedItem() ) ) { // only nuclear-powered mechs may use jump jets /*if( CurVee.GetEngine().IsNuclear() ) { - + if( cmbJumpJetType.getSelectedItem() == null ) { EnableJumpJets( false ); } else { @@ -7440,7 +7440,7 @@ private void cmbEngineTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN //When the engine changes we need to re-check the Heat Sinks CurVee.ResetHeatSinks(); - + // only nuclear-powered mechs may use jump jets /*if( CurVee.GetEngine().IsNuclear() ) { /* @@ -7449,7 +7449,7 @@ private void cmbEngineTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN } else { EnableJumpJets( true ); } - + } else { EnableJumpJets( false ); }*/ @@ -7622,7 +7622,7 @@ private void btnMaximizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F // this simply maximizes the mech's armor CVArmor a = CurVee.GetArmor(); a.Maximize(); - + // if we fix the spinner models, they should refresh the screen FixArmorSpinners(); @@ -7939,7 +7939,7 @@ private void spnHeatSinksStateChanged(javax.swing.event.ChangeEvent evt) {//GEN- RefreshSummary(); RefreshInfoPane(); }//GEN-LAST:event_spnHeatSinksStateChanged - + private void FixHeatSinkSpinnerModel() { // mainly provided for Omnis. if( CurVee.IsOmni() ) { @@ -7995,18 +7995,18 @@ private void spnFrontArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN locArmor = a.GetLocationArmor( LocationIndex.CV_LOC_FRONT ); } } - + // now we need to set the rear armor spinner correctly and update n = (SpinnerNumberModel) spnFrontArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_FRONT ) ); - + if( chkBalanceFRArmor.isSelected() ) { n = (SpinnerNumberModel) spnFrontArmor.getModel(); a.SetArmor( LocationIndex.CV_LOC_REAR, n.getNumber().intValue() ); n = (SpinnerNumberModel) spnRearArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_FRONT ) ); } - + // now refresh the information panes RefreshSummary(); RefreshInfoPane(); @@ -8046,11 +8046,11 @@ private void spnLeftArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN- locArmor = a.GetLocationArmor( LocationIndex.CV_LOC_LEFT ); } } - + // now we need to set the rear armor spinner correctly and update n = (SpinnerNumberModel) spnLeftArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_LEFT ) ); - + if( chkBalanceLRArmor.isSelected() ) { n = (SpinnerNumberModel) spnLeftArmor.getModel(); a.SetArmor( LocationIndex.CV_LOC_RIGHT, n.getNumber().intValue() ); @@ -8097,18 +8097,18 @@ private void spnRightArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN locArmor = a.GetLocationArmor( LocationIndex.CV_LOC_RIGHT ); } } - + // now we need to set the rear armor spinner correctly and update n = (SpinnerNumberModel) spnRightArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_RIGHT ) ); - + if( chkBalanceLRArmor.isSelected() ) { n = (SpinnerNumberModel) spnRightArmor.getModel(); a.SetArmor( LocationIndex.CV_LOC_LEFT, n.getNumber().intValue() ); n = (SpinnerNumberModel) spnLeftArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_RIGHT ) ); } - + // now refresh the information panes RefreshSummary(); RefreshInfoPane(); @@ -8148,18 +8148,18 @@ private void spnRearArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN- locArmor = a.GetLocationArmor( LocationIndex.CV_LOC_REAR ); } } - + // now we need to set the rear armor spinner correctly and update n = (SpinnerNumberModel) spnRearArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_REAR ) ); - + if( chkBalanceFRArmor.isSelected() ) { n = (SpinnerNumberModel) spnRearArmor.getModel(); a.SetArmor( LocationIndex.CV_LOC_FRONT, n.getNumber().intValue() ); n = (SpinnerNumberModel) spnFrontArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_REAR ) ); } - + // now refresh the information panes RefreshSummary(); RefreshInfoPane(); @@ -8203,7 +8203,7 @@ private void spnTurretArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GE // now we need to set the rear armor spinner correctly and update n = (SpinnerNumberModel) spnTurretArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_TURRET1 ) ); - + // now refresh the information panes RefreshSummary(); RefreshInfoPane(); @@ -8369,7 +8369,7 @@ private void spnRotorArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN // now we need to set the rear armor spinner correctly and update n = (SpinnerNumberModel) spnRotorArmor.getModel(); n.setValue( (Object) a.GetLocationArmor( LocationIndex.CV_LOC_ROTOR ) ); - + // now refresh the information panes RefreshSummary(); RefreshInfoPane(); @@ -8396,7 +8396,7 @@ private void btnLockChassisActionPerformed(java.awt.event.ActionEvent evt) {//GE Media.Messager( this, "Omnivees are not allowed to have " + CurVee.GetArmor().ActualName()); return; } - + int choice = javax.swing.JOptionPane.showConfirmDialog(this, "Are you sure you want to lock the chassis?\nAll items in the base " + "loadout will be locked in location\nand most chassis specifications " @@ -8460,7 +8460,7 @@ private void RefreshOmniChoices() { // equipment it has loaded. CheckEquipment(); } - + private void CheckEquipment() { // consolidating some code here. if( CurVee.UsingArtemisIV() ) { @@ -8497,11 +8497,11 @@ private void CheckEquipment() { chkClanCASE.setSelected( false ); } } - + private void LockGUIForOmni() { // this locks most of the GUI controls. Used mainly by Omnimechs. isLocked = true; - + chkOmniVee.setSelected( true ); chkOmniVee.setEnabled( false ); mnuUnlock.setEnabled( true ); @@ -8815,7 +8815,7 @@ public void LoadVehicleIntoGUI() { // Put it in the gui. UnlockGUIFromOmni(); - + chkYearRestrict.setSelected( CurVee.IsYearRestricted() ); txtProdYear.setText( "" + CurVee.GetYear() ); cmbEra.setEnabled( true ); @@ -8851,21 +8851,21 @@ public void LoadVehicleIntoGUI() { cmbTechBase.setEnabled( false ); txtProdYear.setEnabled( false ); } - + //Set all the inputs txtVehicleName.setText( CurVee.GetName() ); txtModel.setText( CurVee.GetModel() ); cmbTechBase.setSelectedIndex( CurVee.GetLoadout().GetTechBase() ); cmbMotiveType.setSelectedItem( CurVee.GetMotiveLookupName() ); spnTonnage.setModel( new javax.swing.SpinnerNumberModel(CurVee.GetTonnage(), 1, CurVee.GetMaxTonnage(), 1) ); - spnCruiseMP.setModel( new javax.swing.SpinnerNumberModel(CurVee.getCruiseMP(), CurVee.getMinCruiseMP(), CurVee.getMaxCruiseMP(), 1) ); + spnCruiseMP.setModel( new javax.swing.SpinnerNumberModel(CurVee.getCruiseMP(), CurVee.getMinCruiseMP(), CurVee.getMaxCruiseMP(), 1) ); if ( CurVee.isHasTurret1() ) cmbTurret.setSelectedItem("Single Turret"); if ( CurVee.isHasTurret2() ) cmbTurret.setSelectedItem("Dual Turret"); FixArmorSpinners(); // now that we're done with the special stuff... Load = false; - + if( CurVee.IsOmni() ) { if ( CurVee.isHasTurret1() ) spnTurretTonnage.setModel( new SpinnerNumberModel(CurVee.GetBaseLoadout().GetTurret().GetMaxTonnage(), 0, 99.0, 0.5) ); @@ -8933,8 +8933,8 @@ public void LoadVehicleIntoGUI() { CurVee.SetChanged(false); } - - + + private void mnuImportHMPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuImportHMPActionPerformed if (CurVee.HasChanged()) { int choice = javax.swing.JOptionPane.showConfirmDialog(this, @@ -9222,7 +9222,7 @@ public void QuickSave() { mnuSaveActionPerformed(null); } } - + private void mnuExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExitActionPerformed if (CurVee.HasChanged()) { int choice = javax.swing.JOptionPane.showConfirmDialog(this, @@ -9249,7 +9249,7 @@ private void CloseProgram() { System.exit(0); } - + private void mnuSummaryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSummaryActionPerformed SolidifyVehicle(); dlgSummaryInfo Summary = new dlgSummaryInfo(this, true, CurVee); @@ -9619,7 +9619,7 @@ private void spnTurretTonnageStateChanged(javax.swing.event.ChangeEvent evt) {// Media.Messager(e.getMessage()); return; } - + RefreshSummary(); RefreshInfoPane(); }//GEN-LAST:event_spnTurretTonnageStateChanged @@ -9646,7 +9646,7 @@ private void chkTrailerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI } catch (Exception ex) { Media.Messager(ex.getMessage()); } - if ( curEngine == "No Engine" ) + if ( curEngine == "No Engine" ) cmbEngineType.setSelectedIndex(0); else cmbEngineType.setSelectedItem(curEngine); @@ -9759,7 +9759,7 @@ private void chkFullAmphActionPerformed(java.awt.event.ActionEvent evt) { RefreshSummary(); RefreshInfoPane(); } - + private PagePrinter SetupPrinter() { PagePrinter printer = new PagePrinter(); Media media = new Media(); @@ -9770,10 +9770,10 @@ private PagePrinter SetupPrinter() { sheet.setPrintMech(true); sheet.setUnitImage(media.GetImage(CurVee.GetSSWImage())); printer.Append(BFBPrinter.Letter.toPage(), sheet); - + return printer; } - + private void FixMPSpinner() { // This fixes the walking MP spinner if the mech's tonnage changes. int MaxWalk = CurVee.getMaxCruiseMP(); @@ -10261,12 +10261,12 @@ public void lostOwnership(Clipboard clipboard, Transferable contents) { public void setUnit(ArrayList v) { this.setVee( (CombatVehicle) v.get(0) ); } - + public void setVee( CombatVehicle v ) { CurVee = v; LoadVehicleIntoGUI(); } - + public void loadUnitIntoGUI() { this.LoadVehicleIntoGUI(); } From cceeb05759a7bcb174f10d816deda60d7c838426 Mon Sep 17 00:00:00 2001 From: George Blouin Date: Fri, 12 Mar 2021 14:10:49 -0700 Subject: [PATCH 110/126] Make the Prefs use Vee Instead of Mech since this is for SAW --- saw/src/main/java/saw/gui/dlgPrefs.form | 2 +- saw/src/main/java/saw/gui/dlgPrefs.java | 28 ++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/saw/src/main/java/saw/gui/dlgPrefs.form b/saw/src/main/java/saw/gui/dlgPrefs.form index 6c676694..fa547927 100644 --- a/saw/src/main/java/saw/gui/dlgPrefs.form +++ b/saw/src/main/java/saw/gui/dlgPrefs.form @@ -61,7 +61,7 @@ - + diff --git a/saw/src/main/java/saw/gui/dlgPrefs.java b/saw/src/main/java/saw/gui/dlgPrefs.java index d2ad7bdb..3f8ed6b4 100644 --- a/saw/src/main/java/saw/gui/dlgPrefs.java +++ b/saw/src/main/java/saw/gui/dlgPrefs.java @@ -58,12 +58,12 @@ public dlgPrefs( java.awt.Frame parent, boolean modal ) { } private void SetState() { - cmbRulesLevel.setSelectedItem( Prefs.get( "NewMech_RulesLevel", "Tournament Legal" ) ); - cmbEra.setSelectedItem( Prefs.get( "NewMech_Era", "Age of War/Star League" ) ); + cmbRulesLevel.setSelectedItem( Prefs.get( "NewVee_RulesLevel", "Tournament Legal" ) ); + cmbEra.setSelectedItem( Prefs.get( "NewVee_Era", "Age of War/Star League" ) ); cmbEraActionPerformed( null ); - cmbTechbase.setSelectedItem( Prefs.get( "NewMech_Techbase", "Inner Sphere" ) ); + cmbTechbase.setSelectedItem( Prefs.get( "NewVee_Techbase", "Inner Sphere" ) ); cmbTechbaseActionPerformed( null ); - cmbHeatSinks.setSelectedItem( Prefs.get( "NewMech_Heatsinks", "Single Heat Sink" ) ); + cmbHeatSinks.setSelectedItem( Prefs.get( "NewVee_Heatsinks", "Single Heat Sink" ) ); txtHTMLPath.setText( Prefs.get( "HTMLExportPath", "none" ) ); txtTXTPath.setText( Prefs.get( "TXTExportPath", "none" ) ); @@ -134,10 +134,10 @@ private void SetState() { } private void SaveState() { - Prefs.put( "NewMech_RulesLevel", (String) cmbRulesLevel.getSelectedItem() ); - Prefs.put( "NewMech_Era", (String) cmbEra.getSelectedItem() ); - Prefs.put( "NewMech_Techbase", (String) cmbTechbase.getSelectedItem() ); - Prefs.put( "NewMech_Heatsinks", (String) cmbHeatSinks.getSelectedItem() ); + Prefs.put( "NewVee_RulesLevel", (String) cmbRulesLevel.getSelectedItem() ); + Prefs.put( "NewVee_Era", (String) cmbEra.getSelectedItem() ); + Prefs.put( "NewVee_Techbase", (String) cmbTechbase.getSelectedItem() ); + Prefs.put( "NewVee_Heatsinks", (String) cmbHeatSinks.getSelectedItem() ); Prefs.put( "HTMLExportPath", txtHTMLPath.getText() ); Prefs.put( "TXTExportPath", txtTXTPath.getText() ); Prefs.put( "MTFExportPath", txtMTFPath.getText() ); @@ -197,10 +197,10 @@ private void SaveState() { } private void SetDefaults() { - Prefs.put( "NewMech_RulesLevel", "Tournament Legal" ); - Prefs.put( "NewMech_Era", "Age of War/Star League" ); - Prefs.put( "NewMech_Techbase", "Inner Sphere" ); - Prefs.put( "NewMech_Heatsinks", "Single Heat Sink" ); + Prefs.put( "NewVee_RulesLevel", "Tournament Legal" ); + Prefs.put( "NewVee_Era", "Age of War/Star League" ); + Prefs.put( "NewVee_Techbase", "Inner Sphere" ); + Prefs.put( "NewVee_Heatsinks", "Single Heat Sink" ); Prefs.put( "HTMLExportPath", "none" ); Prefs.put( "TXTExportPath", "none" ); Prefs.put( "MTFExportPath", "none" ); @@ -365,7 +365,7 @@ private void initComponents() { pnlConstruction.setLayout(new java.awt.GridBagLayout()); - jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "New 'Mech Defaults")); + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "New Vee Defaults")); jPanel1.setLayout(new java.awt.GridBagLayout()); cmbRulesLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Introductory", "Tournament Legal", "Advanced Rules", "Experimental Tech", "Era Specific" })); @@ -1098,7 +1098,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { gridBagConstraints.gridy = 6; jPanel10.add(btnMTFPath, gridBagConstraints); - chkLoadLastMech.setText("Load last 'Mech on startup"); + chkLoadLastMech.setText("Load last Vee on startup"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; From 39f36c67396f3820c5f1dab1ad509218a25a37b5 Mon Sep 17 00:00:00 2001 From: George Blouin Date: Fri, 12 Mar 2021 15:32:27 -0700 Subject: [PATCH 111/126] GUI Corrections Use SAW Prefs and make the options match. Clear the "Selected Variant" dropdown. Manage the Lock Chassis button correctly. --- saw/src/main/java/saw/gui/frmVee.java | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/saw/src/main/java/saw/gui/frmVee.java b/saw/src/main/java/saw/gui/frmVee.java index d5ee88ea..88eb9c93 100644 --- a/saw/src/main/java/saw/gui/frmVee.java +++ b/saw/src/main/java/saw/gui/frmVee.java @@ -148,7 +148,7 @@ public frmVee() { CurVee = new CombatVehicle( ); initComponents(); - Prefs = Preferences.userRoot().node( Constants.SSWPrefs ); + Prefs = Preferences.userRoot().node( Constants.SAWPrefs ); ArmorTons = new VSetArmorTonnage( Prefs ); cmbMotiveTypeActionPerformed(null); spnTonnageStateChanged(null); @@ -355,10 +355,10 @@ public void actionPerformed(ActionEvent e) { mnuVGLAmmo.setVisible( false ); // set the program options - cmbRulesLevel.setSelectedItem( Prefs.get( "NewCV_RulesLevel", "Tournament Legal" ) ); - cmbEra.setSelectedItem( Prefs.get( "NewCV_Era", "Age of War/Star League" ) ); + cmbRulesLevel.setSelectedItem( Prefs.get( "NewVee_RulesLevel", "Tournament Legal" ) ); + cmbEra.setSelectedItem( Prefs.get( "NewVee_Era", "Age of War/Star League" ) ); BuildTechBaseSelector(); - cmbTechBase.setSelectedItem( Prefs.get( "NewCV_Techbase", "Inner Sphere" ) ); + cmbTechBase.setSelectedItem( Prefs.get( "NewVee_Techbase", "Inner Sphere" ) ); BuildEngineSelector(); BuildArmorSelector(); BuildTurretSelector(); @@ -1685,7 +1685,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel2.setText("Rules Level:"); - cmbRulesLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Introductory", "Tournament Legal", "Advanced", "Experimental" })); + cmbRulesLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Introductory", "Tournament Legal", "Advanced Rules", "Experimental Tech", "Era Specific" })); cmbRulesLevel.setSelectedIndex(1); cmbRulesLevel.setMinimumSize(new java.awt.Dimension(150, 20)); cmbRulesLevel.setPreferredSize(new java.awt.Dimension(150, 20)); @@ -1709,7 +1709,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel3.setText("Tech Base:"); - cmbTechBase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan", "Mixed Tech" })); + cmbTechBase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan", "Mixed" })); cmbTechBase.setMinimumSize(new java.awt.Dimension(150, 20)); cmbTechBase.setPreferredSize(new java.awt.Dimension(150, 20)); cmbTechBase.addActionListener(new java.awt.event.ActionListener() { @@ -6816,12 +6816,15 @@ private void GetNewVee() { cmbMotiveType.setSelectedIndex( 0 ); chkYearRestrict.setSelected( false ); txtProdYear.setText( "" ); + txtProdYear.setEnabled( true ); cmbEra.setEnabled( true ); cmbProductionEra.setEnabled( true ); cmbTechBase.setEnabled( true ); cmbTurret.setSelectedIndex(0); spnTurretTonnage.setModel(new SpinnerNumberModel(0.0, 0.0, 50.0, 0.5)); - txtProdYear.setEnabled( true ); + + if (cmbOmniVariant.getItemCount() > 0) + cmbOmniVariant.setSelectedIndex(0); cmbRulesLevel.setSelectedItem( Prefs.get( "NewVee_RulesLevel", "Tournament Legal" ) ); cmbEra.setSelectedItem( Prefs.get( "NewVee_Era", "Age of War/Star League" ) ); @@ -6990,12 +6993,12 @@ private void CheckOmni() { // as appropriate if( chkOmniVee.isEnabled() ) { if( chkOmniVee.isSelected() ) { - //btnLockChassis.setEnabled( true ); + btnLockChassis.setEnabled( true ); } else { - //btnLockChassis.setEnabled( false ); + btnLockChassis.setEnabled( false ); } } else { - //btnLockChassis.setEnabled( false ); + btnLockChassis.setEnabled( false ); } } private void RefreshEquipment() { From b4e1dcae03cf17a799be88e21957f1a7d1ad8090 Mon Sep 17 00:00:00 2001 From: George Blouin Date: Fri, 12 Mar 2021 16:46:32 -0700 Subject: [PATCH 112/126] Handle Long Unit/Model Names For the Roster sheet, this will break up a long name into two lines. Also pushed the tonnage away from the unit type a bit more so that "Combat Vehicle" wouldn't overlap. --- sswlib/src/main/java/Force/Force.java | 10 +++++----- sswlib/src/main/java/Force/Unit.java | 12 ++++++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/sswlib/src/main/java/Force/Force.java b/sswlib/src/main/java/Force/Force.java index 98857e4b..53b7f6dc 100644 --- a/sswlib/src/main/java/Force/Force.java +++ b/sswlib/src/main/java/Force/Force.java @@ -213,7 +213,7 @@ public void RefreshBV() { for ( Unit u : getUnits() ) { if ( u.UsingC3 ) u.setForceC3BV(TotalC3BV); - + TotalBaseBV += u.BaseBV; TotalModifier += u.MiscMod; TotalTonnage += u.Tonnage; @@ -321,7 +321,7 @@ public void clearEmptyGroups() { for ( Group g : Groups ) { if ( g.getUnits().size() == 0 ) { remove.add(g); } } - + for ( Group d : remove ) { Groups.remove(d); } @@ -434,7 +434,7 @@ public void RenderPrint(ForceListPrinter p, ImageTracker imageTracker, boolean P String colName = "Mechwarrior"; if( curGroup.length() >= 25) colName = ""; p.WriteStr(colName, 140); - p.WriteStr("Type", 60); + p.WriteStr("Type", 70); p.WriteStr("Tonnage", 50); p.WriteStr("Base BV", 40); p.WriteStr("G/P", 30); @@ -453,7 +453,7 @@ public void RenderPrint(ForceListPrinter p, ImageTracker imageTracker, boolean P p.setFont(PrintConsts.SmallItalicFont); p.WriteStr(g.getUnits().size() + " Units", 120); p.WriteStr("", 140); - p.WriteStr("", 60); + p.WriteStr("", 70); p.WriteStr(String.format("%1$,.2f", g.getTotalTonnage()), 50); p.WriteStr(String.format("%1$,.0f", g.getTotalBaseBV()), 40); p.WriteStr("", 30); @@ -472,7 +472,7 @@ public void RenderPrint(ForceListPrinter p, ImageTracker imageTracker, boolean P p.setFont(PrintConsts.ItalicFont); p.WriteStr(TotalUnits + " Units", 120); p.WriteStr("", 140); - p.WriteStr("", 60); + p.WriteStr("", 70); p.WriteStr(String.format("%1$,.2f", TotalTonnage), 50); p.WriteStr(String.format("%1$,.0f", TotalBaseBV), 40); p.WriteStr("", 30); diff --git a/sswlib/src/main/java/Force/Unit.java b/sswlib/src/main/java/Force/Unit.java index 32a31715..aa736f9e 100644 --- a/sswlib/src/main/java/Force/Unit.java +++ b/sswlib/src/main/java/Force/Unit.java @@ -497,9 +497,10 @@ public String GetSkills(){ public void RenderPrint(ForceListPrinter p) { p.setFont(PrintConsts.PlainFont); - p.WriteStr(TypeModel, 120); + String[] typeParts = PrintConsts.wrapText(TypeModel, 22, true); + p.WriteStr(typeParts[0], 120); p.WriteStr(getMechwarrior(), 140); - p.WriteStr(CommonTools.UnitTypes[UnitType], 60); + p.WriteStr(CommonTools.UnitTypes[UnitType], 70); p.WriteStr(String.format("%1$,.2f", Tonnage), 50); p.WriteStr(String.format("%1$,.0f", BaseBV), 40); p.WriteStr(GetSkills(), 30); @@ -507,6 +508,13 @@ public void RenderPrint(ForceListPrinter p) { p.WriteStr(Boolean.valueOf(UsingC3).toString(), 30); p.WriteStr(String.format("%1$,.0f", TotalBV), 0); p.NewLine(); + + //Intentionally only doing 1 extra for now until we can see if there is any data that requires more + if (typeParts.length > 1) { + p.WriteStr(typeParts[1], 120); + p.NewLine(); + } + } public void SerializeXML(BufferedWriter file) throws IOException { From 5323b45ac3a36c65e4932b94a02a5eb863be1fdd Mon Sep 17 00:00:00 2001 From: George Blouin Date: Fri, 12 Mar 2021 17:24:49 -0700 Subject: [PATCH 113/126] Handle Mechwarrior Names Too And now can handle multiple lines for each and then adds just a bit more space under the line so it doesn't feel quite so squished. --- sswlib/src/main/java/Force/Force.java | 1 + sswlib/src/main/java/Force/Unit.java | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sswlib/src/main/java/Force/Force.java b/sswlib/src/main/java/Force/Force.java index 53b7f6dc..6d620e2b 100644 --- a/sswlib/src/main/java/Force/Force.java +++ b/sswlib/src/main/java/Force/Force.java @@ -445,6 +445,7 @@ public void RenderPrint(ForceListPrinter p, ImageTracker imageTracker, boolean P for ( Unit u : g.getUnits() ) { u.RenderPrint(p); + p.currentY += 2; } if ( Groups.size() > 1 ) { diff --git a/sswlib/src/main/java/Force/Unit.java b/sswlib/src/main/java/Force/Unit.java index aa736f9e..8a1b3238 100644 --- a/sswlib/src/main/java/Force/Unit.java +++ b/sswlib/src/main/java/Force/Unit.java @@ -498,8 +498,9 @@ public String GetSkills(){ public void RenderPrint(ForceListPrinter p) { p.setFont(PrintConsts.PlainFont); String[] typeParts = PrintConsts.wrapText(TypeModel, 22, true); + String[] mechwarriorParts = PrintConsts.wrapText(getMechwarrior(), 25, true); p.WriteStr(typeParts[0], 120); - p.WriteStr(getMechwarrior(), 140); + p.WriteStr(mechwarriorParts[0], 140); p.WriteStr(CommonTools.UnitTypes[UnitType], 70); p.WriteStr(String.format("%1$,.2f", Tonnage), 50); p.WriteStr(String.format("%1$,.0f", BaseBV), 40); @@ -509,12 +510,12 @@ public void RenderPrint(ForceListPrinter p) { p.WriteStr(String.format("%1$,.0f", TotalBV), 0); p.NewLine(); - //Intentionally only doing 1 extra for now until we can see if there is any data that requires more - if (typeParts.length > 1) { - p.WriteStr(typeParts[1], 120); + //Handles all the lines for whichever part is the longest + for (Integer idx = 1; idx < Math.max(typeParts.length, mechwarriorParts.length); idx++) { + p.WriteStr((typeParts.length > idx) ? typeParts[idx] : "", 120); + p.WriteStr((mechwarriorParts.length > idx) ? mechwarriorParts[idx] : "", 140); p.NewLine(); } - } public void SerializeXML(BufferedWriter file) throws IOException { From c86d0c26853ea48c473576effcbfa289c9514b2c Mon Sep 17 00:00:00 2001 From: George Blouin Date: Fri, 12 Mar 2021 18:14:16 -0700 Subject: [PATCH 114/126] Open Vehicle work So that it sets the buttons and comboboxes correctly. --- saw/src/main/java/saw/gui/frmVee.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/saw/src/main/java/saw/gui/frmVee.java b/saw/src/main/java/saw/gui/frmVee.java index 88eb9c93..12f6519c 100644 --- a/saw/src/main/java/saw/gui/frmVee.java +++ b/saw/src/main/java/saw/gui/frmVee.java @@ -6823,8 +6823,7 @@ private void GetNewVee() { cmbTurret.setSelectedIndex(0); spnTurretTonnage.setModel(new SpinnerNumberModel(0.0, 0.0, 50.0, 0.5)); - if (cmbOmniVariant.getItemCount() > 0) - cmbOmniVariant.setSelectedIndex(0); + cmbOmniVariant.setSelectedItem(""); cmbRulesLevel.setSelectedItem( Prefs.get( "NewVee_RulesLevel", "Tournament Legal" ) ); cmbEra.setSelectedItem( Prefs.get( "NewVee_Era", "Age of War/Star League" ) ); @@ -7224,7 +7223,7 @@ private void UnlockGUIFromOmni() { chkTrailer.setEnabled( true ); //btnEfficientArmor.setEnabled( true ); //btnBalanceArmor.setEnabled( true ); - //btnLockChassis.setEnabled( true ); + btnLockChassis.setEnabled( false ); chkFCSAIV.setEnabled( true ); chkFCSAV.setEnabled( true ); chkFCSApollo.setEnabled( true ); @@ -7238,6 +7237,7 @@ private void UnlockGUIFromOmni() { chkSupercharger.setEnabled( true ); chkEnviroSealing.setEnabled( false ); // now enable the Omni controls + cmbOmniVariant.setSelectedItem(""); cmbOmniVariant.setEnabled( false ); btnAddVariant.setEnabled( false ); btnDeleteVariant.setEnabled( false ); @@ -8869,6 +8869,7 @@ public void LoadVehicleIntoGUI() { // now that we're done with the special stuff... Load = false; + cmbOmniVariant.setModel( new javax.swing.DefaultComboBoxModel( new String[0] ) ); if( CurVee.IsOmni() ) { if ( CurVee.isHasTurret1() ) spnTurretTonnage.setModel( new SpinnerNumberModel(CurVee.GetBaseLoadout().GetTurret().GetMaxTonnage(), 0, 99.0, 0.5) ); From 8e40ae2ce76692baf01b1ffcf661c62166dec76a Mon Sep 17 00:00:00 2001 From: George Blouin Date: Fri, 12 Mar 2021 18:27:26 -0700 Subject: [PATCH 115/126] Stop Enabling When it shouldn't be enabled. --- saw/src/main/java/saw/gui/frmVee.java | 1 - 1 file changed, 1 deletion(-) diff --git a/saw/src/main/java/saw/gui/frmVee.java b/saw/src/main/java/saw/gui/frmVee.java index 12f6519c..2ea6ff74 100644 --- a/saw/src/main/java/saw/gui/frmVee.java +++ b/saw/src/main/java/saw/gui/frmVee.java @@ -7230,7 +7230,6 @@ private void UnlockGUIFromOmni() { chkClanCASE.setEnabled( true ); chkOmniVee.setSelected( false ); chkOmniVee.setEnabled( true ); - btnLockChassis.setEnabled( true ); spnCruiseMP.setEnabled( true ); chkYearRestrict.setEnabled( true ); //chkBSPFD.setEnabled( true ); From 6a097a46feb7bbf9e2176b59af64270410a7348b Mon Sep 17 00:00:00 2001 From: George Blouin Date: Fri, 12 Mar 2021 19:00:21 -0700 Subject: [PATCH 116/126] Hitting New wasn't clearing Variant I had slightly different code, now matching what the other code is doing. --- saw/src/main/java/saw/gui/frmVee.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/saw/src/main/java/saw/gui/frmVee.java b/saw/src/main/java/saw/gui/frmVee.java index 2ea6ff74..f0fa4f10 100644 --- a/saw/src/main/java/saw/gui/frmVee.java +++ b/saw/src/main/java/saw/gui/frmVee.java @@ -6823,7 +6823,7 @@ private void GetNewVee() { cmbTurret.setSelectedIndex(0); spnTurretTonnage.setModel(new SpinnerNumberModel(0.0, 0.0, 50.0, 0.5)); - cmbOmniVariant.setSelectedItem(""); + cmbOmniVariant.setModel( new javax.swing.DefaultComboBoxModel( new String[0] ) ); cmbRulesLevel.setSelectedItem( Prefs.get( "NewVee_RulesLevel", "Tournament Legal" ) ); cmbEra.setSelectedItem( Prefs.get( "NewVee_Era", "Age of War/Star League" ) ); From 8adb109d593b5f6da9f2428e73c1bfc0b067a6d7 Mon Sep 17 00:00:00 2001 From: George Blouin Date: Sun, 14 Mar 2021 14:20:05 -0600 Subject: [PATCH 117/126] Add button to convert to MTF Will load and process all files in the directory (and any subdirectory) --- ssw/src/main/java/ssw/gui/dlgOpen.form | 14 +++ ssw/src/main/java/ssw/gui/dlgOpen.java | 135 ++++++++++++++++++++++++- 2 files changed, 148 insertions(+), 1 deletion(-) diff --git a/ssw/src/main/java/ssw/gui/dlgOpen.form b/ssw/src/main/java/ssw/gui/dlgOpen.form index 0cace9f2..d0c6ebe9 100644 --- a/ssw/src/main/java/ssw/gui/dlgOpen.form +++ b/ssw/src/main/java/ssw/gui/dlgOpen.form @@ -224,6 +224,20 @@ + + + + + + + + + + + + + + diff --git a/ssw/src/main/java/ssw/gui/dlgOpen.java b/ssw/src/main/java/ssw/gui/dlgOpen.java index a1344d5c..145b7c99 100644 --- a/ssw/src/main/java/ssw/gui/dlgOpen.java +++ b/ssw/src/main/java/ssw/gui/dlgOpen.java @@ -29,6 +29,8 @@ package ssw.gui; import Force.Unit; +import IO.MTFWriter; + import java.awt.Cursor; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; @@ -41,6 +43,7 @@ import javax.swing.ImageIcon; import list.*; import list.view.*; +import ssw.filehandlers.MTFReader; import ssw.print.Printer; public class dlgOpen extends javax.swing.JFrame implements PropertyChangeListener { @@ -228,6 +231,27 @@ private void batchUpdateMechs() { } } + private void batchUpdateMTFs() { + prgResaving.setValue(0); + prgResaving.setVisible(true); + int Response = javax.swing.JOptionPane.showConfirmDialog(this, "This will open every file in the current directory and all subdirectories and create an MTF file.\nThis process could take a few minutes, are you ready?", "Batch Mech Processing", javax.swing.JOptionPane.YES_NO_OPTION); + if (Response == javax.swing.JOptionPane.YES_OPTION) { + msg = ""; + setCursor( Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR ) ); + try { + MTFSaver Saving = new MTFSaver( this ); + Saving.addPropertyChangeListener( this ); + Saving.execute(); + } catch( Exception e ) { + // fatal error. let the user know + Media.Messager( this, "A fatal error occured while processing the 'Mechs:\n" + e.getMessage() ); + e.printStackTrace(); + } + } else { + prgResaving.setVisible(false); + } + } + private void setTooltip( UnitListData data ) { //spnMechTable.setToolTipText( data.getInfo() ); try { @@ -245,7 +269,7 @@ private void setTooltip( UnitListData data ) { } public void propertyChange( PropertyChangeEvent e ) { - prgResaving.setValue( ((Resaver) e.getSource()).getProgress() ); + prgResaving.setValue( ((SwingWorker) e.getSource()).getProgress() ); } private class Resaver extends SwingWorker { @@ -333,6 +357,91 @@ private void processFile( File file, MechReader read, MechWriter writer ) throws } } + private class MTFSaver extends SwingWorker { + dlgOpen Owner; + int filesUpdated = 0, + totalFileCount = 0; + + public MTFSaver( dlgOpen owner ) { + Owner = owner; + } + + @Override + public void done() { + setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) ); + if( msg.length() > 0 ) { + dlgTextExport Message = new dlgTextExport( Owner, true, msg ); + Message.setLocationRelativeTo( Owner ); + Message.setVisible( true ); + } else { + Media.Messager( Owner, filesUpdated + " Files Updated. Reloading list next." ); + } + prgResaving.setVisible(false); + prgResaving.setValue( 0 ); + LoadList(false); + } + + @Override + protected Void doInBackground() throws Exception { + MechReader read = new MechReader(); + MTFWriter writer = new MTFWriter(); + + File FileList = new File(dirPath); + try { + processDir( FileList, read, writer ); + } catch ( IOException ie ) { + System.out.println(ie.getMessage()); + throw new Exception(msg); + } catch ( Exception e ) { + throw e; + } + + return null; + } + + private void processDir( File directory, MechReader read, MTFWriter writer ) throws IOException { + File[] files = directory.listFiles(); + totalFileCount += files.length; + for ( int i=0; i < files.length; i++ ) { + if ( files[i].isFile() && files[i].getCanonicalPath().endsWith(".ssw") ) { + processFile( files[i], read, writer ); + int progress = ((int) (( ((double) filesUpdated + 1) / (double) totalFileCount ) * 100.0 ) ); + setProgress( progress ); + } else if ( files[i].isDirectory() ) { + processDir( files[i], read, writer ); + } + } + } + + private void processFile( File file, MechReader read, MTFWriter writer ) throws IOException { + try { + Mech m = read.ReadMech( file.getCanonicalPath(), parent.GetData() ); + + // save the mech to XML in the current location + writer.setMech(m); + try { + writer.WriteMTF( file.getCanonicalPath().replace(".ssw", ".mtf") ); + filesUpdated += 1; + } catch( IOException e ) { + msg += "Could not load the following file(s):" + NL; + msg += file.getCanonicalPath() + NL + NL; + } + } catch ( Exception e ) { + // log the error + msg += file.getCanonicalPath() + NL; + if( e.getMessage() == null ) { + StackTraceElement[] trace = e.getStackTrace(); + for( int j = 0; j < trace.length; j++ ) { + msg += trace[j].toString() + NL; + } + msg += NL; + } else { + msg += e.getMessage() + NL + NL; + } + } + } + } + /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is @@ -357,6 +466,8 @@ private void initComponents() { jSeparator2 = new javax.swing.JToolBar.Separator(); btnMagic = new javax.swing.JButton(); jSeparator3 = new javax.swing.JToolBar.Separator(); + btnMTF = new javax.swing.JButton(); + jSeparator6 = new javax.swing.JToolBar.Separator(); lblForce = new javax.swing.JLabel(); jSeparator5 = new javax.swing.JToolBar.Separator(); cmbView = new javax.swing.JComboBox(); @@ -551,6 +662,20 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); tlbActions.add(btnMagic); tlbActions.add(jSeparator3); + + btnMTF.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ssw/Images/wand.png"))); // NOI18N + btnMTF.setToolTipText("Export ALL to MTF (Long Process!)"); + btnMTF.setFocusable(false); + btnMTF.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + btnMTF.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + btnMTF.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnMTFActionPerformed(evt); + } + }); + tlbActions.add(btnMTF); + tlbActions.add(jSeparator6); + tlbActions.add(lblForce); tlbActions.add(jSeparator5); @@ -1202,6 +1327,12 @@ private void btnMagicActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS //setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) ); }//GEN-LAST:event_btnMagicActionPerformed + private void btnMTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMagicActionPerformed + //setCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) ); + batchUpdateMTFs(); + //setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) ); + }//GEN-LAST:event_btnMagicActionPerformed + private void Filter(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Filter ListFilter filters = new ListFilter(); filters.setExtension(".ssw"); @@ -1503,6 +1634,7 @@ public void setVisible( boolean b ) { private javax.swing.JButton btnExport; private javax.swing.JButton btnFilter; private javax.swing.JButton btnMagic; + private javax.swing.JButton btnMTF; private javax.swing.JButton btnOpen; private javax.swing.JButton btnOptions; private javax.swing.JButton btnPrint; @@ -1536,6 +1668,7 @@ public void setVisible( boolean b ) { private javax.swing.JToolBar.Separator jSeparator3; private javax.swing.JToolBar.Separator jSeparator4; private javax.swing.JToolBar.Separator jSeparator5; + private javax.swing.JToolBar.Separator jSeparator6; private javax.swing.JLabel lblBV; private javax.swing.JLabel lblCost; private javax.swing.JLabel lblEra; From b35c318db6cd3352780a14d24099bf3cc506cd4e Mon Sep 17 00:00:00 2001 From: George Blouin Date: Sun, 14 Mar 2021 14:57:23 -0600 Subject: [PATCH 118/126] Make the file count for Progress consistent So that it doesn't jump around everywhere. --- ssw/src/main/java/ssw/gui/dlgOpen.java | 11 +++++++---- sswlib/src/main/java/IO/Utils.java | 13 +++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ssw/src/main/java/ssw/gui/dlgOpen.java b/ssw/src/main/java/ssw/gui/dlgOpen.java index 145b7c99..cc6f1dfb 100644 --- a/ssw/src/main/java/ssw/gui/dlgOpen.java +++ b/ssw/src/main/java/ssw/gui/dlgOpen.java @@ -30,6 +30,7 @@ import Force.Unit; import IO.MTFWriter; +import IO.Utils; import java.awt.Cursor; import java.beans.PropertyChangeEvent; @@ -300,8 +301,9 @@ public void done() { protected Void doInBackground() throws Exception { MechReader read = new MechReader(); MechWriter writer = new MechWriter(); - File FileList = new File(dirPath); + totalFileCount = Utils.countFilesInDirectory(FileList, ".ssw"); + try { processDir( FileList, read, writer ); } catch ( IOException ie ) { @@ -316,7 +318,7 @@ protected Void doInBackground() throws Exception { private void processDir( File directory, MechReader read, MechWriter writer ) throws IOException { File[] files = directory.listFiles(); - totalFileCount += files.length; + for ( int i=0; i < files.length; i++ ) { if ( files[i].isFile() && files[i].getCanonicalPath().endsWith(".ssw") ) { processFile( files[i], read, writer ); @@ -385,8 +387,9 @@ public void done() { protected Void doInBackground() throws Exception { MechReader read = new MechReader(); MTFWriter writer = new MTFWriter(); - File FileList = new File(dirPath); + totalFileCount = Utils.countFilesInDirectory(FileList, ".ssw"); + try { processDir( FileList, read, writer ); } catch ( IOException ie ) { @@ -401,7 +404,7 @@ protected Void doInBackground() throws Exception { private void processDir( File directory, MechReader read, MTFWriter writer ) throws IOException { File[] files = directory.listFiles(); - totalFileCount += files.length; + for ( int i=0; i < files.length; i++ ) { if ( files[i].isFile() && files[i].getCanonicalPath().endsWith(".ssw") ) { processFile( files[i], read, writer ); diff --git a/sswlib/src/main/java/IO/Utils.java b/sswlib/src/main/java/IO/Utils.java index 7edf634f..6f322f62 100644 --- a/sswlib/src/main/java/IO/Utils.java +++ b/sswlib/src/main/java/IO/Utils.java @@ -10,4 +10,17 @@ public static String convertFilePathSeparator(String path) { return path.replace("\\", File.separator); } } + + public static Integer countFilesInDirectory(File directory, String extension) { + int count = 0; + for (File file : directory.listFiles()) { + if (file.isFile() && file.getName().endsWith(extension)) { + count++; + } + if (file.isDirectory()) { + count += countFilesInDirectory(file, extension); + } + } + return count; + } } From 796db62fbb61e49f6c830f3fbe93d992c2075459 Mon Sep 17 00:00:00 2001 From: George Blouin Date: Sun, 14 Mar 2021 17:36:39 -0600 Subject: [PATCH 119/126] Changing Icon to Crown --- ssw/src/main/java/ssw/gui/dlgOpen.form | 2 +- ssw/src/main/java/ssw/gui/dlgOpen.java | 2 +- ssw/src/main/resources/ssw/Images/crown.png | Bin 0 -> 1393 bytes 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 ssw/src/main/resources/ssw/Images/crown.png diff --git a/ssw/src/main/java/ssw/gui/dlgOpen.form b/ssw/src/main/java/ssw/gui/dlgOpen.form index d0c6ebe9..537656dc 100644 --- a/ssw/src/main/java/ssw/gui/dlgOpen.form +++ b/ssw/src/main/java/ssw/gui/dlgOpen.form @@ -227,7 +227,7 @@ - + diff --git a/ssw/src/main/java/ssw/gui/dlgOpen.java b/ssw/src/main/java/ssw/gui/dlgOpen.java index cc6f1dfb..bf5cd9dc 100644 --- a/ssw/src/main/java/ssw/gui/dlgOpen.java +++ b/ssw/src/main/java/ssw/gui/dlgOpen.java @@ -666,7 +666,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { tlbActions.add(btnMagic); tlbActions.add(jSeparator3); - btnMTF.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ssw/Images/wand.png"))); // NOI18N + btnMTF.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ssw/Images/crown.png"))); // NOI18N btnMTF.setToolTipText("Export ALL to MTF (Long Process!)"); btnMTF.setFocusable(false); btnMTF.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); diff --git a/ssw/src/main/resources/ssw/Images/crown.png b/ssw/src/main/resources/ssw/Images/crown.png new file mode 100644 index 0000000000000000000000000000000000000000..ef3eb59dc99d064e79cd4ed9f0bfca75adf441b6 GIT binary patch literal 1393 zcmb_bTTCNW7#>qh){RIbPwGBQX2BFnJ2NdU?S$@HIxUnk726UBk)%WCKqqWx#+j)d zFtE!mm`Hp91NyQdUSJ<28aIN1!8NXl8nR)@W)s~QGzPQW;)aXiwgk_xl=VS;@+33o zKPTV!{ojAif8MGMSLU96{xpIhxxp$r0%xQCoif0`$&wd^({rl7L5+$nYKD~o;^o9< zfCf`+D~JG=Yk%!WP>vu5l#ey24NMJ{5K~rG$5^$L1lb5ueqNKo}iX3)wD9_+za zH!zgvJXpPhAsERAl6+N%45A(3SfZmX;pVXO=g@MEf&wX^vZ$82ASjgP!47pP80*_O zh8{xHHV^j5R0C6s`a~I^4l7|v5KaPhl2+1QT2@w8g4zg@zzG{p+AL%lWw%iTfgTME zW|O%VDnbX2a>11cORB0w;dmyKv1aU6QEtUax7)32*lZSvuqf?<%4!xtIh$3Wfs&AU zN##WW)fL%hF|B$q==4zuDd|{NP>zlX9vH5%5>8qPy`(IVVg4JMN*$vWH3A;{{a0Zn z)-C}&0u(VVC*Z}koYhlFlurh%D#|fYypTP`+N7w8N>Y?iU(|ut^8zPkltVPbP(eXa zSs?*}vF87%0 zJCUn5LP~;}X(02j11=zoDfF;lia*(l`$WAXE_bpQ?}=O-n!)vJ{l_(Dw_xw+;c?T# z#c|sM0rt8KoBF<6)?eCuZB5KySXk(AI5bV$-`_Wz&BevV3kwT2o2|FEHy)2yS69!? z&2@HmE-o%MHa70=?xxe}y1Kf-!NJMN$>HH)pU*coHbzm@z`%gXWSW|q8W|ZWEiKK@ z&)?hI<2Y_>Yinj^CL9hgEiH9-cdx9h7z_rIBtxN4AQ0Ht*jQd(4hDmHd3odGYHwxFP3b#>L{at#d)t*xz%j*f0`Zzq$GLZs9KGLqj35E45ZO~;{~XCEl7J~+Pzn2 z?>}?-C1cKS2HNN~KJmtb>8*Kj{-F1}cP>#EojccmzGZyatKF&D|JMEM#qHalF^eDm zbjA*5yxRB0n^o;USgyvs zcY3auy!`pYbGsjPb*#?3c*%T)MhtlccjYsoTXRKM>fY}8l9QjsZvJ^Kl>WZ*_q9{Q fcfY>3+x`@RI0I!a_T$N1Xc-Cm!}KQ=@ymY$cv>bS literal 0 HcmV?d00001 From c2cfbdc2178cb02b2904c28bcffea7ef3a3a5080 Mon Sep 17 00:00:00 2001 From: George Blouin Date: Sat, 20 Mar 2021 16:33:17 -0600 Subject: [PATCH 120/126] Check Message for Empty and if it is...do not show the message pop-up. --- sswlib/src/main/java/filehandlers/Media.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sswlib/src/main/java/filehandlers/Media.java b/sswlib/src/main/java/filehandlers/Media.java index c7e08b88..a5df29c6 100644 --- a/sswlib/src/main/java/filehandlers/Media.java +++ b/sswlib/src/main/java/filehandlers/Media.java @@ -360,11 +360,15 @@ public String DetermineMatchingImage( String Name, String Model, String CurrentI } public static void Messager(String message) { - javax.swing.JOptionPane.showMessageDialog(null, message); + if (message != null && !message.isBlank()) { + javax.swing.JOptionPane.showMessageDialog(null, message); + } } public static void Messager(Component component, String message) { - javax.swing.JOptionPane.showMessageDialog(component, message); + if (message != null && !message.isBlank()) { + javax.swing.JOptionPane.showMessageDialog(component, message); + } } public static int Options(Component component, String Message, String Title) { From b3b7f3f5dc809e6c509f9a9d2d5ef71691fd309e Mon Sep 17 00:00:00 2001 From: George Blouin Date: Sat, 20 Mar 2021 16:46:28 -0600 Subject: [PATCH 121/126] Take this Gradle! Convert from isBlank to a length check after trim. --- sswlib/src/main/java/filehandlers/Media.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sswlib/src/main/java/filehandlers/Media.java b/sswlib/src/main/java/filehandlers/Media.java index a5df29c6..743cf44f 100644 --- a/sswlib/src/main/java/filehandlers/Media.java +++ b/sswlib/src/main/java/filehandlers/Media.java @@ -360,13 +360,13 @@ public String DetermineMatchingImage( String Name, String Model, String CurrentI } public static void Messager(String message) { - if (message != null && !message.isBlank()) { + if (message != null && message.trim().length() > 0) { javax.swing.JOptionPane.showMessageDialog(null, message); } } public static void Messager(Component component, String message) { - if (message != null && !message.isBlank()) { + if (message != null && message.trim().length() > 0) { javax.swing.JOptionPane.showMessageDialog(component, message); } } From 6649a7baf9fc64e47acafb9badaddcc08506e4c0 Mon Sep 17 00:00:00 2001 From: George Blouin Date: Sat, 20 Mar 2021 17:13:08 -0600 Subject: [PATCH 122/126] Null check before trying to access the height property. --- sswlib/src/main/java/filehandlers/Media.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sswlib/src/main/java/filehandlers/Media.java b/sswlib/src/main/java/filehandlers/Media.java index 743cf44f..4b3ac598 100644 --- a/sswlib/src/main/java/filehandlers/Media.java +++ b/sswlib/src/main/java/filehandlers/Media.java @@ -353,7 +353,7 @@ public String DetermineMatchingImage( String Name, String Model, String CurrentI if ( !CurrentImage.isEmpty() ) { Image img = GetImage(CurrentImage); - if ( img.getHeight(null) > 0 ) + if (img != null && img.getHeight(null) > 0 ) return CurrentImage; } return FindMatchingImage(Name, Model, ""); From 31d0e06a3f1a22d98009f6f50bdde542412cd859 Mon Sep 17 00:00:00 2001 From: George Blouin Date: Sat, 27 Mar 2021 17:59:02 -0600 Subject: [PATCH 123/126] drafting release notes --- Docs/0.7.6 Changes.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Docs/0.7.6 Changes.txt diff --git a/Docs/0.7.6 Changes.txt b/Docs/0.7.6 Changes.txt new file mode 100644 index 00000000..a5075d29 --- /dev/null +++ b/Docs/0.7.6 Changes.txt @@ -0,0 +1,14 @@ +It is our pleasure to release Solaris Skunk Werks 0.7.6! Below the link we have a brief listing of the updates to SSW. + +You can download the newest version, and join our development discord through our Github page here. We welcome all who want to help make SSW even better: https://github.com/Solaris-Skunk-Werks/solarisskunkwerks#solaris-skunk-werks + +# Fixes and Features: +* Fix issue causing images to not be found for units. +* Update PPC Capacitor BV calculation to match Interstellar Operations. +* Fix exporting of BFB forces to MUL format. +* Fix SAW Preference saving and loading, NOTE: You will need to set the preferences for SAW on first load as it has its own store now. +* Fix Selected Variant and Lock Chassis so that they clear and load correctly. +* Fix Roster sheet so that long Unit or Mechwarrior names now wrap to new lines. +* New Feature - New button added to Open dialog that will convert ALL units to MTF format. +* 'Set Armor Tonnage' is now pre-filled with current armor tonnage. + From 6d0dc21efded5e8fb608a51c2ded38eb03bcaf6e Mon Sep 17 00:00:00 2001 From: WEKarnesky99 Date: Tue, 13 Apr 2021 11:38:22 -0700 Subject: [PATCH 124/126] forgot to commit Version number before release --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e1291e75..ee16b91f 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { allprojects { version '0.7.6' ext { - release='SNAPSHOT' + release='Stable' rev=versionDetails().gitHash } jar { From 81cd56f17bf6214c0a25109c422ff2ac0e4cc7c0 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mason" Date: Sun, 6 Jun 2021 01:55:49 -0400 Subject: [PATCH 125/126] fix file loading issue --- sswlib/src/main/java/list/abUnitData.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sswlib/src/main/java/list/abUnitData.java b/sswlib/src/main/java/list/abUnitData.java index a2b485d4..0df5740f 100644 --- a/sswlib/src/main/java/list/abUnitData.java +++ b/sswlib/src/main/java/list/abUnitData.java @@ -28,7 +28,9 @@ package list; +import java.io.File; import java.util.ArrayList; + import battleforce.BattleForceStats; /** @@ -202,7 +204,10 @@ public void setModel(String Model) { } public String getFilename() { - return filename; + if (filename == null) { + return null; + } + return filename.replace("\\", File.separator); } public void setFilename(String filename) { From 8ffc28de0f4198724d5add67bd6f3fb16ddb4042 Mon Sep 17 00:00:00 2001 From: WEKarnesky99 Date: Mon, 7 Jun 2021 16:56:59 -0700 Subject: [PATCH 126/126] Changed Clan SRM-2 Improved Oneshot weight to 0.25tons --- Data/Equipment/weapons.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Equipment/weapons.json b/Data/Equipment/weapons.json index ba8316bb..ee41d027 100644 --- a/Data/Equipment/weapons.json +++ b/Data/Equipment/weapons.json @@ -41081,7 +41081,7 @@ "FCSType": 2, "WeaponClass": 2, "RackSize": 2, - "Tonnage": 0.5, + "Tonnage": 0.25, "Cost": 8000.0, "OffBV": 4.0, "DefBV": 0.0,