@@ 41,6 41,27 @@ LOGENTRY();
] call INEPT_fnc_correlateContact;
LOGVAR(_correlation);
+
+ if (LOGGING_ENABLED()) then
+ {
+ LOGVAR(count _current_contacts);
+ {
+ diag_log (format [
+ "Contact: %1 (%2)",
+ (_x select CONTACT_INFO) select UNIT_INFO_CLASS,
+ (_x select CONTACT_POS)
+ ]);
+ diag_log (
+ [
+ (_x select CONTACT_INFO) select UNIT_INFO_CARGO,
+ {_x select UNIT_INFO_CLASS}
+ ]
+ call INEPT_fnc_applyToAll
+ );
+ }
+ forEach _current_contacts;
+ };
+
VAR(_contact_idx) = _correlation select PAIR_FIRST;
if (_contact_idx == -1) then
{
@@ 83,7 104,7 @@ LOGENTRY();
NEW_CONTACT(_new_contact select CONTACT_POS,
_x,
_correlated_contact select CONTACT_LASTSEEN,
- [_x select UNIT_INFO_CLASS] call INEPT_fnc_getMobility);
+ (_correlated_contact select CONTACT_MOBILITY) max ([_x select UNIT_INFO_CLASS] call INEPT_fnc_getMobility));
}
forEach _old_cargo;
@@ 111,16 132,10 @@ LOGENTRY();
else
{
VAR(_correlated_contact) = _current_contacts select _contact_idx;
+ LOGVAR(_correlated_contact);
((_correlated_contact select CONTACT_INFO) select UNIT_INFO_CARGO) deleteAt _cargo_idx
};
- // This is done to avoid suddenly changing the equipment (and therefore
- // firepower) of vehicles for which we are guessing the contents of
- // (which happens) to be all of our contacts I guess. (TODO, this is a
- // bad assumption!)
- // It would really be a lot better if our arguments did not contain
- // full unit info, and instead we could ask a thing to produce that
- // info if we so desired.
(_new_contact select CONTACT_INFO) set
[ UNIT_INFO_EQUIPMENT
, _correlated_info select UNIT_INFO_EQUIPMENT ];
@@ 18,7 18,7 @@ VAR(__assert_equal) =
VAR(_lhv) = call _lh;
VAR(_rhv) = call _rh;
if (_lhv isEqualTo _rhv) then
- {
+ {
diag_log format ["PASS:%1 - %2 == %3", _line + 1, _lh, _rh];
}
else
@@ 33,7 33,7 @@ VAR(__assert_equal) =
VAR(__assert) =
{
if (call _this) then
- {
+ {
diag_log format ["PASS:%1 - %2", __LINE__ + 1, _this];
}
else
@@ 84,7 84,7 @@ VAR(__test) =
, [ (_x select CONTACT_INFO) select UNIT_INFO_CARGO
, {_x select UNIT_INFO_CLASS} ] call INEPT_fnc_applyToAll
];
- }
+ }
forEach (_ao select AO_CONTACTS);
_results
};
@@ 153,27 153,29 @@ try
//deleteVehicle _crewman;
//deleteVehicle _apc;
-#define HUMMINGBIRD "B_Heli_Light_01_armed_F"
-#define DUDEMAN "B_soldier_AR_F"
+#define PAWNEE "B_Heli_Light_01_armed_F"
+#define DUDEMAN "B_soldier_AR_F"
-VAR(_pilot) = (createGroup west) createUnit [DUDEMAN, [0, 0, 0], [], 0, "CAN_COLLIDE"];
-VAR(_helo) = createVehicle [HUMMINGBIRD, [0, 0, 0], [], 0, "CAN_COLLIDE"];
+VAR(_pilot) = (createGroup west) createUnit [DUDEMAN, [0, 0, 0], [], 0, "CAN_COLLIDE"];
+VAR(_copilot) = (createGroup west) createUnit [DUDEMAN, [0, 0, 0], [], 0, "CAN_COLLIDE"];
+VAR(_helo) = createVehicle [PAWNEE, [0, 0, 0], [], 0, "CAN_COLLIDE"];
-// Pilot is flying helicopter at 0, 0, 0
+// Pilot is flying helicopter with copilot at 0, 0, 0
_pilot moveInAny _helo;
+_copilot moveInAny _helo;
[ __LINE__
-, {[[HUMMINGBIRD, [DUDEMAN]]]}
+, {[[PAWNEE, [DUDEMAN, DUDEMAN]]]}
, {[[_helo], _start_time + 0] call __test}
] call __assert_equal;
// In 6 seconds, pilot can walk only about 25 metres, but he flew 40 meters and
// then got out.
[_helo, [40, 0, 0]] call __translate;
-moveOut _pilot;
+moveOut _pilot;
[ __LINE__
-, {[[HUMMINGBIRD, []], [DUDEMAN, []]]}
+, {[[PAWNEE, [DUDEMAN]], [DUDEMAN, []]]}
, {[[_helo, _pilot], _start_time + 6] call __test}
] call __assert_equal;
@@ 183,10 185,42 @@ moveOut _pilot;
[_helo, [40, 0, 0]] call __translate;
[ __LINE__
-, {[[HUMMINGBIRD, [DUDEMAN]]]}
+, {[[PAWNEE, [DUDEMAN, DUDEMAN]]]}
, {[[_helo], _start_time + 12] call __test}
] call __assert_equal;
+// Everybody gets out
+moveOut _pilot;
+moveOut _copilot;
+
+[ __LINE__
+, {[[DUDEMAN, []], [DUDEMAN, []], [PAWNEE, []]]}
+, {[[_helo], _start_time + 18] call __test}
+] call __assert_equal;
+
+// He moves again and blows up I guess?
+_pilot moveInAny _helo;
+_copilot moveInAny _helo;
+
+[ __LINE__
+, {[[PAWNEE, [DUDEMAN, DUDEMAN]]]}
+, {[[_helo], _start_time + 24] call __test}
+] call __assert_equal;
+
+[_helo, [40, 0, 0]] call __translate;
+_helo setDamage 1;
+
+sleep 0.1;
+
+{not alive _helo} call __assert;
+{not alive _pilot} call __assert;
+{not alive _copilot} call __assert;
+
+[ __LINE__
+, {[]}
+, {[[_helo], _start_time + 30] call __test}
+] call __assert_equal;
+
deleteVehicle _pilot;
deleteVehicle _helo;