[Megameknet-cvs] MegaMekNET/src/client/gui HSMek.java,1.8,1.9
Status: Inactive
Brought to you by:
mcwizard
From: Immanuel S. <im...@us...> - 2005-02-22 20:38:37
|
Update of /cvsroot/megameknet/MegaMekNET/src/client/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12291/src/client/gui Modified Files: HSMek.java Log Message: beautified Index: HSMek.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/gui/HSMek.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** HSMek.java 22 Feb 2005 19:04:58 -0000 1.8 --- HSMek.java 22 Feb 2005 20:38:25 -0000 1.9 *************** *** 15,100 **** import java.util.StringTokenizer; - - import megamek.common.BattleArmor; import megamek.common.Entity; - import megamek.common.MechFileParser; - import megamek.common.Protomech; - import megamek.common.QuadMech; - - import java.io.File; - import common.Unit; ! public class HSMek ! { ! String MekFile; ! StringBuffer name = new StringBuffer(); ! int Gunnery; ! int Piloting; ! int bv; ! String type; ! String skills = ""; ! public HSMek(String s) ! { ! StringTokenizer ST = new StringTokenizer(s,"$"); ! this.MekFile = ST.nextToken(); ! Gunnery = Integer.parseInt(ST.nextToken()); ! Piloting = Integer.parseInt(ST.nextToken()); ! bv = Integer.parseInt(ST.nextToken()); ! if (ST.hasMoreTokens ()) { ! skills = ST.nextToken(); ! }; ! Entity m = getEntity(); ! if (m instanceof megamek.common.Tank) ! setType("Vehicle"); ! else if (m instanceof megamek.common.Infantry) ! setType("Infantry"); ! else ! setType("Mech"); ! // Vehicles and Inf prepend Chasis ! if (type.equalsIgnoreCase("Vehicle") || type.equalsIgnoreCase("Infantry")) { ! name.append(m.getChassis()).append(" "); ! }; ! name.append(m.getModel()).append(" "); ! } ! public Entity getEntity() ! { ! return Unit.loadMech(getMekFile()); ! } ! public int getGunnery() { ! return Gunnery; ! } ! public String getMekFile() { ! return MekFile; ! } ! public String getName() { ! return name.toString(); ! } ! public int getPiloting() { ! return Piloting; ! } ! public String getType() { ! return type; ! } ! public int getBV() { ! return bv; ! } ! /** ! * @return Returns the skills. ! */ ! public String getSkills() { ! return skills; ! } ! public void setType(String type) { ! this.type = type; ! } } --- 15,92 ---- import java.util.StringTokenizer; import megamek.common.Entity; import common.Unit; ! public class HSMek { ! String MekFile; ! StringBuffer name = new StringBuffer(); ! int Gunnery; ! int Piloting; ! int bv; ! String type; ! String skills = ""; + public HSMek(String s) { + StringTokenizer ST = new StringTokenizer(s, "$"); + this.MekFile = ST.nextToken(); + Gunnery = Integer.parseInt(ST.nextToken()); + Piloting = Integer.parseInt(ST.nextToken()); + bv = Integer.parseInt(ST.nextToken()); + if (ST.hasMoreTokens()) { + skills = ST.nextToken(); + } + ; + Entity m = getEntity(); + if (m instanceof megamek.common.Tank) + setType("Vehicle"); + else if (m instanceof megamek.common.Infantry) + setType("Infantry"); + else + setType("Mech"); + // Vehicles and Inf prepend Chasis + if (type.equalsIgnoreCase("Vehicle") || type.equalsIgnoreCase("Infantry")) { + name.append(m.getChassis()).append(" "); + } + ; + name.append(m.getModel()).append(" "); + } ! public Entity getEntity() { ! return Unit.loadMech(getMekFile()); ! } ! public int getGunnery() { ! return Gunnery; ! } ! public String getMekFile() { ! return MekFile; ! } + public String getName() { + return name.toString(); + } + public int getPiloting() { + return Piloting; + } ! public String getType() { ! return type; ! } + public int getBV() { + return bv; + } ! /** ! * @return Returns the skills. ! */ ! public String getSkills() { ! return skills; ! } ! ! public void setType(String type) { ! this.type = type; ! } } |