39 static int exec_time_seed = 0;
44 : ship(0), ship_ai(0), carrier_ai(0), navpt(0), orders(0),
45 action(0), threat_level(0), support_level(1),
76 const int exec_period = 1000;
143 bool processed =
false;
294 if (controller && controller->
GetHangar() &&
299 if (self_rgn == rtb_rgn) {
444 double safe_zone = 50e3;
464 if (target->
Life()) {
503 if (target && potential_target && target != potential_target) {
519 Ship* potential_target = tgt;
535 obj_tgt = (
Ship*) obj_sim_obj;
539 while (++contact && !potential_target) {
542 if (obj_tgt == test) {
543 potential_target = test;
552 potential_target = 0;
597 Ship* current_ship_target = 0;
598 Shot* current_shot_target = 0;
610 current_ship_target = (
Ship*) obj;
621 if (!c_ship && !c_shot)
625 bool rogue = c_ship && c_ship->
IsRogue();
626 bool tgt_ok = c_iff > 0 &&
630 if (rogue || tgt_ok) {
637 if (dist < 0.75 * target_dist &&
638 (!current_ship_target || c_ship->
Class() <= current_ship_target->
Class())) {
639 current_ship_target = c_ship;
653 if (!current_shot_target) {
654 current_shot_target = c_shot;
665 current_shot_target = c_shot;
668 else if (dist < target_dist) {
669 current_shot_target = c_shot;
677 if (current_shot_target)
678 potential_target = current_shot_target;
680 potential_target = current_ship_target;
697 bool rogue = c_ship->
IsRogue();
698 bool tgt_ok = c_ship !=
ship &&
703 if (rogue || tgt_ok) {
708 if (dist < 0.75 * target_dist) {
709 potential_target = c_ship;
714 ward_threats.
append(c_ship);
722 if (potential_target && ward_threats.
size() && !ward_threats.
contains((
Ship*)potential_target)) {
731 if (dist < target_dist) {
732 potential_target = threat;
792 double drop_range = 3 * wep_dsn->
max_range;
797 if (range < drop_range)
804 if (delta.
length() < range)
826 Shot* threat_missile = 0;
828 double threat_dist = 1e9;
829 const DWORD THREAT_REACTION_TIME = 1000;
840 threat_missile = contact->
GetShot();
852 if (!threat || c_ship->
Class() > threat->
Class()) {
857 else if (rng < threat_dist) {
870 if (iter->
GetShip() == rumor) {
899 double support_dist = 1e9;
908 if (!support || c_ship->
Class() > support->
Class())
924 Point delta(10*s, 0, 10*s);
929 case 2: delta =
Point( 10, 0, -12);
break;
930 case 3: delta =
Point(-10, 0, -12);
break;
931 case 4: delta =
Point( 0, 0, -24);
break;
938 case 2: delta =
Point( 15, 0, 0);
break;
939 case 3: delta =
Point(-15, 0, 0);
break;
940 case 4: delta =
Point(-30, 0, 0);
break;
947 case 2: delta =
Point(15, 0, 0);
break;
948 case 3: delta =
Point( 0, -1, -15);
break;
949 case 4: delta =
Point(15, -1, -15);
break;
955 delta =
Point(0, 0, -15*s);