public Town getTown2() { if (town2 == null) { town2 = God.findTown(getInt("tid2")); } return town2; }
public Town getTown1() { if (town1 == null) { town1 = God.findTown(getInt("tid1")); } return town1; }
public Raid(int raidID, GodGenerator God) { this.raidID = raidID; this.God = God; this.con = God.con; try { UberStatement rus = con.createStatement(); ResultSet rrs = rus.executeQuery("select * from raid where rid = " + raidID); // so we don't want it to load if raidOver is true and ticksToHit is 0. Assume 0 is not, 1 is // on, for ttH. !F = R!T // Then F = !(R!T) = !R + T; while (rrs.next()) { // First, to seek out town 2, use a query! Town town1 = God.findTown(rrs.getInt(1)); Town town2Obj = God.findTown(rrs.getInt(2)); // double distance = Math.sqrt((town2Obj.x-Town1.x)*(town2Obj.x-Town1.x) + // (town2Obj.y-Town1.y)*(town2Obj.y-Town1.y)); // // public Raid(int raidID, double distance, int ticksToHit, Town town1, Town town2, boolean // Genocide,boolean allClear, // int metal, int timber, int manmat, int food,boolean raidOver,ArrayList<AttackUnit> au, // boolean Bomb) { int y = 0; setRaidValues( rrs.getInt(3), rrs.getDouble(4), rrs.getInt(5), town1, town2Obj, rrs.getBoolean(6), rrs.getBoolean(8), rrs.getInt(9), rrs.getInt(10), rrs.getInt(11), rrs.getInt(12), rrs.getBoolean(7), rrs.getBoolean(19), rrs.getBoolean(23), rrs.getInt(25), rrs.getString(26), rrs.getInt(27), rrs.getBoolean(28), rrs.getInt(29)); // this one has no sql addition! getAu(); if (rrs.getBoolean(19)) bombTarget = rrs.getInt(20); if (rrs.getInt(21) == 1 && !rrs.getBoolean(7)) makeSupportRun(); else if (rrs.getInt(21) == 2 && !rrs.getBoolean(7)) makeOffSupportRun(); else if (rrs.getInt(22) == 1 && !rrs.getBoolean(7)) makeScoutRun(); else if (rrs.getInt(22) == 2 && !rrs.getBoolean(7)) makeDiscoveredScoutRun(); if (rrs.getInt(24) != -1 && !rrs.getBoolean(7)) setResupplyID(rrs.getInt(24)); } rrs.close(); rus.close(); } catch (SQLException exc) { exc.printStackTrace(); } /* this.distance=getMemDistance(); this.ticksToHit=getMemTicksToHit(); getTown1(); getTown1(); this.Genocide=isMemGenocide(); this.allClear=isMemAllClear(); this.metal=getMemMetal();this.timber=getMemTimber();this.manmat=getMemManmat();this.food=getMemFood(); this.raidOver=isMemRaidOver();getAu();this.Bomb=isMemBomb();this.invade=isMemInvade(); this.totalTicks=getMemTotalTicks();this.name=getMemName();this.genoRounds=getMemGenoRounds();*/ // we set nothing else! }