public void using(Gun gun) { if (guns == null) { guns = new HashMap<GunType, Gun>(); } if (guns.get(gun.type()) != null) { guns.get(gun.type()).updateFrequency(); } else { gun.updateFrequency(); guns.put(gun.type(), gun); } }
public void maybe_fire_guns() { Enumeration gs; Gun gun; TwoWheeledVehicle v; gs = this.guns.elements(); while (gs.hasMoreElements()) { gun = (Gun) gs.nextElement(); if (gun.firing()) { gun.fired_flag = true; v = gun.vehicle_hit_by(world); if (!(v == null)) { gun.apply_to_vehicle(v); } } } }