mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Interaction Menu - fix a crash when loading savegames (#7115)
* fix a crash when loading savegames * fix a variable name * optimize * Put CAManBase actions into seperate bucket * Apply suggestions from code review Co-Authored-By: commy2 <commy-2@gmx.de> * Fast exit for All * CaManBase * can't skip mans
This commit is contained in:
parent
66f62bb1a2
commit
0fd442451f
@ -74,4 +74,38 @@ GVAR(lastTimeSearchedActions) = -1000;
|
|||||||
// Init zeus menu
|
// Init zeus menu
|
||||||
[] call FUNC(compileMenuZeus);
|
[] call FUNC(compileMenuZeus);
|
||||||
|
|
||||||
|
// Handle addActionToClass with Inheritance flag set (CAManBase actions are seperated for speed)
|
||||||
|
GVAR(inheritedActionsAll) = [];
|
||||||
|
GVAR(inheritedClassesAll) = [];
|
||||||
|
GVAR(inheritedActionsMan) = [];
|
||||||
|
GVAR(inheritedClassesMan) = [];
|
||||||
|
|
||||||
|
["All", "InitPost", {
|
||||||
|
BEGIN_COUNTER(InitPost);
|
||||||
|
params ["_object"];
|
||||||
|
private _type = typeOf _object;
|
||||||
|
|
||||||
|
if (GVAR(inheritedClassesAll) pushBackUnique _type == -1) exitWith { END_COUNTER(InitPost); };
|
||||||
|
|
||||||
|
{
|
||||||
|
_x params ["_objectType", "_typeNum", "_parentPath", "_action"];
|
||||||
|
if (_object isKindOf _objectType) then {
|
||||||
|
[_type, _typeNum, _parentPath, _action] call FUNC(addActionToClass);
|
||||||
|
};
|
||||||
|
} forEach GVAR(inheritedActionsAll);
|
||||||
|
END_COUNTER(InitPost);
|
||||||
|
}] call CBA_fnc_addClassEventHandler;
|
||||||
|
["CAManBase", "InitPost", {
|
||||||
|
BEGIN_COUNTER(InitPost);
|
||||||
|
params ["_object"];
|
||||||
|
private _type = typeOf _object;
|
||||||
|
|
||||||
|
if (GVAR(inheritedClassesMan) pushBackUnique _type == -1) exitWith { END_COUNTER(InitPost); };
|
||||||
|
{
|
||||||
|
_x params ["_typeNum", "_parentPath", "_action"];
|
||||||
|
[_type, _typeNum, _parentPath, _action] call FUNC(addActionToClass);
|
||||||
|
} forEach GVAR(inheritedActionsMan);
|
||||||
|
END_COUNTER(InitPost);
|
||||||
|
}] call CBA_fnc_addClassEventHandler;
|
||||||
|
|
||||||
ADDON = true;
|
ADDON = true;
|
||||||
|
@ -25,21 +25,24 @@ if (!params [["_objectType", "", [""]], ["_typeNum", 0, [0]], ["_parentPath", []
|
|||||||
ERROR("Bad Params");
|
ERROR("Bad Params");
|
||||||
[]
|
[]
|
||||||
};
|
};
|
||||||
TRACE_4("params",_objectType,_typeNum,_parentPath,_action);
|
TRACE_4("addActionToClass",_objectType,_typeNum,_parentPath,_action);
|
||||||
|
|
||||||
if (param [4, false, [false]]) exitwith {
|
if (param [4, false, [false]]) exitwith {
|
||||||
if (isNil QGVAR(inheritedActions)) then {GVAR(inheritedActions) = [];};
|
BEGIN_COUNTER(addAction);
|
||||||
private _index = GVAR(inheritedActions) pushBack [[], _typeNum, _parentPath, _action];
|
if (_objectType == "CAManBase") then {
|
||||||
private _initEH = compile format ['
|
GVAR(inheritedActionsMan) pushBack [_typeNum, _parentPath, _action];
|
||||||
params ["_object"];
|
{
|
||||||
private _typeOf = typeOf _object;
|
[_x, _typeNum, _parentPath, _action] call FUNC(addActionToClass);
|
||||||
(GVAR(inheritedActions) select %1) params ["_addedClasses", "_typeNum", "_parentPath", "_action"];
|
} forEach GVAR(inheritedClassesMan);
|
||||||
if (_typeOf in _addedClasses) exitWith {};
|
} else {
|
||||||
_addedClasses pushBack _typeOf;
|
GVAR(inheritedActionsAll) pushBack [_objectType, _typeNum, _parentPath, _action];
|
||||||
[_typeOf, _typeNum, _parentPath, _action] call FUNC(addActionToClass);
|
{
|
||||||
', _index];
|
if (_x isKindOf _objectType) then {
|
||||||
TRACE_2("Added inheritable action",_objectType,_index);
|
[_x, _typeNum, _parentPath, _action] call FUNC(addActionToClass);
|
||||||
[_objectType, "init", _initEH, true, [], true] call CBA_fnc_addClassEventHandler;
|
};
|
||||||
|
} forEach GVAR(inheritedClassesAll);
|
||||||
|
};
|
||||||
|
END_COUNTER(addAction);
|
||||||
|
|
||||||
// Return the full path
|
// Return the full path
|
||||||
(_parentPath + [_action select 0])
|
(_parentPath + [_action select 0])
|
||||||
|
@ -122,7 +122,7 @@ private _actions = [_actionsCfg, 0] call _recurseFnc;
|
|||||||
|
|
||||||
// ace_interaction_fnc_addPassengerAction expects ACE_MainActions to be first
|
// ace_interaction_fnc_addPassengerAction expects ACE_MainActions to be first
|
||||||
// Other mods can change the order that configs are added, so we should verify this now and resort if needed
|
// Other mods can change the order that configs are added, so we should verify this now and resort if needed
|
||||||
if (_objectType isKindOf "CaManBase") then {
|
if (_objectType isKindOf "CAManBase") then {
|
||||||
if ((((_actions select 0) select 0) select 0) != "ACE_MainActions") then {
|
if ((((_actions select 0) select 0) select 0) != "ACE_MainActions") then {
|
||||||
INFO_1("ACE_MainActions not first for man [%1]",_objectType);
|
INFO_1("ACE_MainActions not first for man [%1]",_objectType);
|
||||||
private _mainActions = [];
|
private _mainActions = [];
|
||||||
|
@ -31,7 +31,7 @@ _vehicle setVariable [QGVAR(targetObject), _targetObject, true];
|
|||||||
private _laserMethod = QFUNC(findLaserSource);
|
private _laserMethod = QFUNC(findLaserSource);
|
||||||
|
|
||||||
private _vehicleSourceSelection = "";
|
private _vehicleSourceSelection = "";
|
||||||
if (_vehicle isKindOf "CaManBase") then {
|
if (_vehicle isKindOf "CAManBase") then {
|
||||||
_vehicleSourceSelection = "pilot";
|
_vehicleSourceSelection = "pilot";
|
||||||
} else {
|
} else {
|
||||||
{ // Go through turrets on vehicle and find the laser
|
{ // Go through turrets on vehicle and find the laser
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "\z\ace\addons\medical\script_component.hpp"
|
#include "\z\ace\addons\medical\script_component.hpp"
|
||||||
|
|
||||||
// UAV-AI should get filtered by scope check
|
// UAV-AI should get filtered by scope check
|
||||||
private _mans = configProperties [configFile >> "CfgVehicles", "(isClass _x) && {(getNumber (_x >> 'scope')) == 2} && {configName _x isKindOf 'CaManBase'}", true];
|
private _mans = configProperties [configFile >> "CfgVehicles", "(isClass _x) && {(getNumber (_x >> 'scope')) == 2} && {configName _x isKindOf 'CAManBase'}", true];
|
||||||
INFO_1("Checking mans for medical hitpoints [%1 mans]",count _mans);
|
INFO_1("Checking mans for medical hitpoints [%1 mans]",count _mans);
|
||||||
|
|
||||||
private _testPass = true;
|
private _testPass = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user