mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Repair - Fix bug in detection for ignoring hitpoints (#9261)
* Fix bug in detection for ignoring repair hitpoints * Use define for array any * Add warning if hitpoint group would be ignored * Apply suggestions from code review Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Change ANY to ANY_OF --------- Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
This commit is contained in:
@ -38,6 +38,7 @@
|
|||||||
#define GETEGVAR(var1,var2,var3) GETMVAR(EGVAR(var1,var2),var3)
|
#define GETEGVAR(var1,var2,var3) GETMVAR(EGVAR(var1,var2),var3)
|
||||||
|
|
||||||
#define ARR_SELECT(ARRAY,INDEX,DEFAULT) (if (count ARRAY > INDEX) then {ARRAY select INDEX} else {DEFAULT})
|
#define ARR_SELECT(ARRAY,INDEX,DEFAULT) (if (count ARRAY > INDEX) then {ARRAY select INDEX} else {DEFAULT})
|
||||||
|
#define ANY_OF(ARRAY,CONDITION) (ARRAY findIf {CONDITION} != -1)
|
||||||
|
|
||||||
// ACEX Merge
|
// ACEX Merge
|
||||||
#define ACEX_PREFIX acex
|
#define ACEX_PREFIX acex
|
||||||
|
@ -437,10 +437,7 @@ class CfgVehicles {
|
|||||||
transportRepair = 0;
|
transportRepair = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Helicopter_Base_H;
|
class Heli_Transport_04_base_F;
|
||||||
class Heli_Transport_04_base_F: Helicopter_Base_H {
|
|
||||||
GVAR(hitpointGroups)[] = { {"HitEngine", {"HitEngine1", "HitEngine2"}} };
|
|
||||||
};
|
|
||||||
class O_Heli_Transport_04_repair_F: Heli_Transport_04_base_F {
|
class O_Heli_Transport_04_repair_F: Heli_Transport_04_base_F {
|
||||||
GVAR(canRepair) = 1;
|
GVAR(canRepair) = 1;
|
||||||
transportRepair = 0;
|
transportRepair = 0;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
params ["_vehicle"];
|
params ["_vehicle"];
|
||||||
|
|
||||||
private _type = typeOf _vehicle;
|
private _type = typeOf _vehicle;
|
||||||
TRACE_2("getHitPointsToIgnore", _vehicle,_type);
|
TRACE_2("getHitPointsToIgnore",_vehicle,_type);
|
||||||
private _initializedClasses = missionNamespace getVariable [QGVAR(hitPointsToIgnoreInitializedClasses), createHashMap];
|
private _initializedClasses = missionNamespace getVariable [QGVAR(hitPointsToIgnoreInitializedClasses), createHashMap];
|
||||||
if (_type in _initializedClasses) exitWith {_initializedClasses get _type};
|
if (_type in _initializedClasses) exitWith {_initializedClasses get _type};
|
||||||
|
|
||||||
@ -118,12 +118,19 @@ private _processedSelections = [];
|
|||||||
/*#ifdef DEBUG_MODE_FULL
|
/*#ifdef DEBUG_MODE_FULL
|
||||||
systemChat format ["Skipping depends hitpoint, hitpoint %1, index %2, selection %3", _hitpoint, _forEachIndex, _selection];
|
systemChat format ["Skipping depends hitpoint, hitpoint %1, index %2, selection %3", _hitpoint, _forEachIndex, _selection];
|
||||||
#endif*/
|
#endif*/
|
||||||
|
|
||||||
|
private _groupIndex = _hitpointGroups findIf {_x # 0 == _hitpoint};
|
||||||
|
if (_groupIndex != -1) then {
|
||||||
|
ERROR_2("[%1] hitpoint [%2] is both a group-parent and a depends and will be unrepairable",_type,_hitpoint);
|
||||||
|
ERROR_1("group: %1",_hitpointGroups # _groupIndex);
|
||||||
|
};
|
||||||
|
|
||||||
_hitPointsToIgnore pushBackUnique _hitpoint;
|
_hitPointsToIgnore pushBackUnique _hitpoint;
|
||||||
_processedSelections pushBack _selection;
|
_processedSelections pushBack _selection;
|
||||||
continue
|
continue
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((_hitpointGroups findIf {(_x select 1) == _hitpoint}) != -1) then { // skip child hitpoints
|
if (ANY_OF(_hitpointGroups, ANY_OF(_x select 1, _x == _hitpoint))) then { // skip child hitpoints
|
||||||
TRACE_3("Skipping child hitpoint",_hitpoint,_forEachIndex,_selection);
|
TRACE_3("Skipping child hitpoint",_hitpoint,_forEachIndex,_selection);
|
||||||
/*#ifdef DEBUG_MODE_FULL
|
/*#ifdef DEBUG_MODE_FULL
|
||||||
systemChat format ["Skipping child hitpoint, hitpoint %1, index %2, selection %3", _hitpoint, _forEachIndex, _selection];
|
systemChat format ["Skipping child hitpoint, hitpoint %1, index %2, selection %3", _hitpoint, _forEachIndex, _selection];
|
||||||
|
Reference in New Issue
Block a user