if (movementType == HMVMovementType.TRACKED || movementType == HMVMovementType.WHEELED || movementType == HMVMovementType.HOVER) { Tank tank = new Tank(); entity = tank;
addEquipment(tank, HMVWeaponLocation.FRONT, Tank.LOC_FRONT); addEquipment(tank, HMVWeaponLocation.LEFT, Tank.LOC_LEFT); addEquipment(tank, HMVWeaponLocation.RIGHT, Tank.LOC_RIGHT); addEquipment(tank, HMVWeaponLocation.REAR, Tank.LOC_REAR); if (!tank.hasNoTurret()) { addEquipment(tank, HMVWeaponLocation.TURRET, Tank.LOC_TURRET); }
  public Entity getEntity() throws EntityLoadingException {      try  {      Entity entity = null;      if (movementType == HMVMovementType.TRACKED ||          movementType == HMVMovementType.WHEELED ||          movementType == HMVMovementType.HOVER)              {                  Tank tank = new Tank();                  entity = tank;                  tank.setChassis(name);                  tank.setModel(model);                  tank.setYear(year);                  tank.setOmni( isOmni );                  int techLevel = rulesLevel == 1 ? TechConstants.T_IS_LEVEL_1 :                      techType == HMVTechType.CLAN ? TechConstants.T_CLAN_LEVEL_2 :                      TechConstants.T_IS_LEVEL_2;                  tank.setTechLevel(techLevel);                  int suspensionFactor =                      getSuspensionFactor(roundedInternalStructure, movementType);                  tank.setWeight((engineRating + suspensionFactor) / cruiseMP);                  tank.setMovementMode(                                       movementType == HMVMovementType.HOVER ? IEntityMovementMode.HOVER :                                       movementType == HMVMovementType.WHEELED ? IEntityMovementMode.WHEELED :                                       IEntityMovementMode.TRACKED);                  tank.setOriginalWalkMP(cruiseMP);                  tank.setOriginalJumpMP(jumpMP);                  // hmmm...                  tank.setHasNoTurret(turretArmor == 0);                  tank.autoSetInternal();                  tank.initializeArmor(frontArmor, Tank.LOC_FRONT);                  tank.initializeArmor(leftArmor, Tank.LOC_LEFT);                  tank.initializeArmor(rightArmor, Tank.LOC_RIGHT);                  tank.initializeArmor(rearArmor, Tank.LOC_REAR);                  if (!tank.hasNoTurret())                      {                          tank.initializeArmor(turretArmor, Tank.LOC_TURRET);                      }                  addEquipment(tank, HMVWeaponLocation.FRONT, Tank.LOC_FRONT);                  addEquipment(tank, HMVWeaponLocation.LEFT, Tank.LOC_LEFT);                  addEquipment(tank, HMVWeaponLocation.RIGHT, Tank.LOC_RIGHT);                  addEquipment(tank, HMVWeaponLocation.REAR, Tank.LOC_REAR);                  if (!tank.hasNoTurret())                      {                          addEquipment(tank, HMVWeaponLocation.TURRET, Tank.LOC_TURRET);                      }                  addEquipment(tank, HMVWeaponLocation.BODY, Tank.LOC_BODY);                  // Do we have any infantry/cargo bays?                  if ( troopSpace > 0 ) {                      entity.addTransporter( new TroopSpace( troopSpace ) );                  }              }          else {              throw new EntityLoadingException                  ( "Unsupported vehicle movement type:" + movementType );          }          return entity;      }      catch (Exception e) {          e.printStackTrace();          throw new EntityLoadingException(e.getMessage());      }  }