37 :
System(SENSOR, 1,
"Dual Sensor Pkg", 1, 10, 10, 10),
39 nsettings(0), range_index(0)
53 :
System(s), mode(STD), target(0),
54 nsettings(s.nsettings), range_index(0)
200 while (++ship_iter) {
201 Ship* c_ship = ship_iter.value();
203 if (c_ship !=
ship) {
210 c =
new(__FILE__,__LINE__)
Contact(c_ship, 0.0f, 0.0f);
226 while (++threat_iter) {
231 while (++drone_iter) {
245 c_life = c_ship->
Life();
253 c_life = c_shot->
Life();
260 if (contact->
Age() < 0 || c_life == 0) {
270 Contact* track =
new(__FILE__,__LINE__)
Contact(c_ship, contact->d_pas, contact->d_act);
284 Contact* track =
new(__FILE__,__LINE__)
Contact(c_shot, contact->d_pas, contact->d_act);
323 double tx = targ_pt * cam->
vrt();
324 double ty = targ_pt * cam->
vup();
325 double tz = targ_pt * cam->
vpn();
328 double rng = targ_pt.
length();
329 double az = asin(fabs(tx) / rng);
330 double el = asin(fabs(ty) / rng);
331 if (tx < 0) az = -az;
332 if (ty < 0) el = -el;
334 double min_range = rng;
336 bool probescan =
false;
344 double prng = probe_pt.
length();
346 if (prng < probe->Design()->lethal_radius && prng < rng) {
352 bool vis = tz > 1 && (c_ship->
Radius()/rng > 0.001);
353 bool threat = (c_ship->
Life() != 0 &&
366 if (min_range > sensor_range || min_range > c_ship->
Design()->
detet) {
378 if (threat || vis ||
mode >=
PST || tz > 1) {
382 if (az < 0) az = -
PI - az;
392 if (az >= az1 && az <= az2 && (
mode >=
PST || fabs(el) < 45*
DEGREES)) {
393 double passive_range_limit = 500e3;
397 d_pas = c_ship->
PCS() * effectivity * (1 - min_range/passive_range_limit);
404 d_act = c_ship->
ACS() * (1 - min_range/max_range);
408 double max_range = sensor_range;
409 d_act = c_ship->
ACS() * effectivity * (1 - min_range/max_range);
438 c =
new(__FILE__,__LINE__)
Contact(c_ship, 0.0f, 0.0f);
445 c->d_pas = (float) d_pas;
446 c->d_act = (float) d_act;
447 c->probe = probescan;
470 double tx = targ_pt * cam->
vrt();
471 double ty = targ_pt * cam->
vup();
472 double tz = targ_pt * cam->
vpn();
475 double rng = targ_pt.
length();
476 double az = asin(fabs(tx) / rng);
477 double el = asin(fabs(ty) / rng);
478 if (tx < 0) az = -az;
479 if (ty < 0) el = -el;
481 bool vis = tz > 1 && (c_shot->
Radius()/rng > 0.001);
485 if (threat || vis || ((
mode >=
PST || tz > 1) && rng <= sensor_range)) {
489 if (az < 0) az = -
PI - az;
499 if (az >= az1 && az <= az2 && (
mode >=
PST || fabs(el) < 45*
DEGREES)) {
500 if (rng < sensor_range/2)
506 d_act = effectivity * (1 - rng/sensor_range);
518 c =
new(__FILE__,__LINE__)
Contact(c_shot, 0.0f, 0.0f);
525 c->d_pas = (float) d_pas;
526 c->d_act = (float) d_act;
589 static const char*
TYPENAME() {
return "TargetOffset"; }
617 test = contact->GetShip();
619 test = contact->GetShot();
625 if (contact->GetShot() && contact->GetShot()->Owner() ==
ship)
628 double tgt_range = contact->Range(
ship);
631 if (contact->GetShip() && contact->GetShip()->Design()->detet < tgt_range)
634 double d_pas = contact->PasReturn();
635 double d_act = contact->ActReturn();
636 bool vis = contact->Visible(
ship) || contact->Threat(
ship);
642 if (hostile && (contact->GetIFF(
ship) == 0 || contact->GetIFF(
ship) ==
ship->
GetIFF()))
645 targets.append(
new(__FILE__,__LINE__)
TargetOffset(test, tgt_range));
649 else if (contact->InFront(
ship)) {
656 if (az <= 0.2 && el <= 0.2)
657 targets.append(
new(__FILE__,__LINE__)
TargetOffset(test, az+el));
667 if (targets.
size() > 0) {
678 if (index < targets.
size()-1)
683 target = targets[index]->target;
687 else if (targets.
size() > 0) {
688 target = targets[0]->target;
723 test = contact->GetShip();
725 test = contact->GetShot();
727 if (test == candidate) {
728 double d_pas = contact->PasReturn();
729 double d_act = contact->ActReturn();
730 bool vis = contact->Visible(
ship) || contact->Threat(
ship);
759 double d = contact->PasReturn();
764 if (contact->InFront(
ship)) {
767 contact->GetBearing(
ship, az, el, rng);
771 if (az + el < min_off) {
793 double d = contact->ActReturn();
797 if (contact->InFront(
ship)) {
800 contact->GetBearing(
ship, az, el, rng);
804 if (az + el < min_off) {
825 else if (
emcon != index) {
840 if (m < PST && m >
PAS)