diff --git a/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf b/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf index 582fe750a8..6abcebf47e 100644 --- a/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf +++ b/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf @@ -22,6 +22,13 @@ private ["_target","_player","_fullPath","_activeChildren","_dynamicChildren","_ _target = _object; _player = ACE_player; +// Check if the function should be modified first +if !((_origActionData select 10) isEqualTo {}) then { + // It should, so make a copy and pass it to the modifierFunction + _origActionData = +_origActionData; + [_target, ACE_player, _origActionData select 6, _origActionData] call (_origActionData select 10); +}; + // Return nothing if the action itself is not active if !([_target, ACE_player, _origActionData select 6] call (_origActionData select 4)) exitWith { [] diff --git a/addons/interact_menu/functions/fnc_compileMenu.sqf b/addons/interact_menu/functions/fnc_compileMenu.sqf index baf8e1c272..7983c493e1 100644 --- a/addons/interact_menu/functions/fnc_compileMenu.sqf +++ b/addons/interact_menu/functions/fnc_compileMenu.sqf @@ -27,7 +27,7 @@ if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {}; private "_recurseFnc"; _recurseFnc = { private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_selection", "_condition", "_showDisabled", - "_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren"]; + "_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren", "_modifierFunction"]; EXPLODE_1_PVT(_this,_actionsCfg); _actions = []; @@ -56,6 +56,7 @@ _recurseFnc = { _condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, _target, %1)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")]; _insertChildren = compile (getText (_entryCfg >> "insertChildren")); + _modifierFunction = compile (getText (_entryCfg >> "modifierFunction")); _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; @@ -76,7 +77,8 @@ _recurseFnc = { [], _selection, _distance, - [_showDisabled,_enableInside,_canCollapse,_runOnHover] + [_showDisabled,_enableInside,_canCollapse,_runOnHover], + _modifierFunction ], _children ]; diff --git a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf index 968b143701..0258b3dc8a 100644 --- a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf +++ b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf @@ -27,7 +27,7 @@ if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {}; private "_recurseFnc"; _recurseFnc = { private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_selection", "_condition", "_showDisabled", - "_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren"]; + "_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren", "_modifierFunction"]; EXPLODE_1_PVT(_this,_actionsCfg); _actions = []; @@ -46,6 +46,7 @@ _recurseFnc = { _condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, _target, %1)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")]; _insertChildren = compile (getText (_entryCfg >> "insertChildren")); + _modifierFunction = compile (getText (_entryCfg >> "modifierFunction")); _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; @@ -66,7 +67,8 @@ _recurseFnc = { [], [0,0,0], 10, //distace - [_showDisabled,_enableInside,_canCollapse,_runOnHover] + [_showDisabled,_enableInside,_canCollapse,_runOnHover], + _modifierFunction ], _children ]; diff --git a/addons/interact_menu/functions/fnc_createAction.sqf b/addons/interact_menu/functions/fnc_createAction.sqf index 0b0030a1b4..fb3f05b7b5 100644 --- a/addons/interact_menu/functions/fnc_createAction.sqf +++ b/addons/interact_menu/functions/fnc_createAction.sqf @@ -14,6 +14,7 @@ * 7: Position (Position or Selection Name) or (Optional) * 8: Distance (Optional) * 9: Other parameters (Optional) + * 10: Modifier function (Optional) * * Return value: * Action @@ -27,7 +28,7 @@ EXPLODE_5_PVT(_this,_actionName,_displayName,_icon,_statement,_condition); -private ["_insertChildren","_customParams","_position","_distance","_params"]; +private ["_insertChildren","_customParams","_position","_distance","_params", "_modifierFunction"]; _insertChildren = if (count _this > 5) then { _this select 5 @@ -59,6 +60,12 @@ _params = if (count _this > 9) then { [false,false,false,false] }; +_modifierFunction = if (count _this > 10) then { + _this select 10 +} else { + {} +}; + [ _actionName, _displayName, @@ -70,5 +77,6 @@ _params = if (count _this > 9) then { _customParams, _position, _distance, - _params + _params, + _modifierFunction ] diff --git a/addons/vehicles/functions/fnc_speedLimiter.sqf b/addons/vehicles/functions/fnc_speedLimiter.sqf index 2332336e0a..053d96d470 100644 --- a/addons/vehicles/functions/fnc_speedLimiter.sqf +++ b/addons/vehicles/functions/fnc_speedLimiter.sqf @@ -35,7 +35,7 @@ _maxSpeed = speed _vehicle max 10; _speed = speed _vehicle; if (_speed > _maxSpeed) then { - _vehicle setVelocity ((velocity _vehicle) vectorMultiply (_maxSpeed / _speed)); + _vehicle setVelocity ((velocity _vehicle) vectorMultiply ((_maxSpeed / _speed) - 0.00001)); // fix 1.42-hotfix PhysX libraries applying force in previous direction when turning }; } , 0, [_driver, _vehicle, _maxSpeed]] call CBA_fnc_addPerFrameHandler; diff --git a/extensions/breakLine/ace_breakLine.cpp b/extensions/breakLine/ace_breakLine.cpp index 74a32cc66d..fb5775b861 100644 --- a/extensions/breakLine/ace_breakLine.cpp +++ b/extensions/breakLine/ace_breakLine.cpp @@ -19,13 +19,13 @@ #define MAXCHARACTERS 14 -static char version[] = "1.0"; +static char VERSION[] = "1.0"; extern "C" { __declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function); }; -std::vector splitString(std::string input) { +std::vector splitString(const std::string & input) { std::istringstream ss(input); std::string token; @@ -38,10 +38,10 @@ std::vector splitString(std::string input) { } std::string addLineBreaks(const std::vector &words) { - std::stringstream sstream; int numChar = 0; int i = 0; + while (i < words.size()) { if (numChar == 0) { sstream << words[i]; @@ -58,6 +58,7 @@ std::string addLineBreaks(const std::vector &words) { } } } + return sstream.str(); } @@ -66,12 +67,10 @@ std::string addLineBreaks(const std::vector &words) { #pragma warning( disable : 4996 ) void __stdcall RVExtension(char *output, int outputSize, const char *function) { - //strncpy(output, function, outputSize); - if (!strcmp(function, "version")) { - strncpy(output, version, outputSize); + strncpy(output, VERSION, outputSize); } else { - strcpy(output, addLineBreaks(splitString(function)).c_str()); + strncpy(output, addLineBreaks(splitString(function)).c_str(), outputSize); output[outputSize - 1] = '\0'; } }