Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change toLower to toLowerANSI #410

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/main/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GVAR(CalloutCacheNamespace) = call CBA_fnc_createNamespace;
if !(".p3d" in _string) then {
_string = _string + ".p3d";
};
GVAR(blockSuppressionModelCache) setVariable [toLower _string, true];
GVAR(blockSuppressionModelCache) setVariable [toLowerANSI _string, true];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we probably should not do that, in case there is someone using none standard ANSI characters for the file path.

Copy link
Collaborator Author

@jokoho48 jokoho48 Aug 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I remember, setVariable only supports ASCII characters as Variable names. So that should not be an issue

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private _yeet = false call CBA_fnc_createNamespace; 
private _string = "\правда\model.p3d"; 
if ((_string select [0,1]) isEqualTo "\") then { 
 _string = [_string, 1] call CBA_fnc_substr; 
}; 
if !(".p3d" in _string) then { 
 _string = _string + ".p3d"; 
}; 
_yeet setVariable [toLowerANSI _string, true]; 
allVariables _yeet

returns ["������������\model.p3d"]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that means obfuscated pbos will not work well here.

};
} forEach ("private _name = configName _x; _name isKindof 'building' || {_name isKindOf 'Rocks_base_F'}" configClasses (configFile >> "CfgVehicles"));

Expand Down
4 changes: 2 additions & 2 deletions addons/main/functions/VehicleAction/fnc_doSelectWarhead.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if (_switchMuzzle) then {
private _muzzles = getArray (configFile >> "CfgWeapons" >> _turret >> "muzzles");

// first pass, try to find a muzzle that has the same name
private _index = _muzzles findIf {(toUpper _x) in _warheadTypes};
private _index = _muzzles findIf {(toUpperANSI _x) in _warheadTypes};
if (_index > -1 && { // found muzzle with same name
// one of the mags that can be loaded into that muzzle is in available mags
((getArray (configFile >> "CfgWeapons" >> _turret >> (_muzzles select _index) >> "magazines")) arrayIntersect _availableMags) isNotEqualTo []
Expand All @@ -74,7 +74,7 @@ if (_muzzle isEqualTo "") then {
{
private _ammo = getText (configFile >> "CfgMagazines" >> _x >> "ammo");
if (_ammo isEqualTo "") then {continue};
if ((toUpper (getText (configFile >> "CfgAmmo" >> _ammo >> "warheadName"))) in _warheadTypes) then {
if ((toUpperANSI (getText (configFile >> "CfgAmmo" >> _ammo >> "warheadName"))) in _warheadTypes) then {
_foundMag = _x;
break;
};
Expand Down
2 changes: 1 addition & 1 deletion addons/main/functions/fnc_doAnimation.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ params [

// switchMove "" no longer works in dev 1.37
if (_animation == "") then {
_animation = toLower (animationState _unit);
_animation = toLowerANSI (animationState _unit);

// stances are broken for some Animations
private _stance = switch (_animation select [4, 4]) do {
Expand Down
4 changes: 2 additions & 2 deletions addons/main/functions/fnc_doCallout.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ if (_time >= time) exitWith {
};

private _speaker = speaker _unit;
if (toUpper(_speaker) in ["", "ACE_NOVOICE"]) exitWith {}; // Early Exit if Unit is "Mute"
if (toUpperANSI(_speaker) in ["", "ACE_NOVOICE"]) exitWith {}; // Early Exit if Unit is "Mute"

switch (toLower(_callout)) do {
switch (toLowerANSI(_callout)) do {
case ("contact"): {
_callout = selectRandom ["ContactE_1", "ContactE_2", "ContactE_3", "Danger"];
};
Expand Down
2 changes: 1 addition & 1 deletion addons/main/functions/fnc_getShareInformationParams.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private _units = units _unit select {
private _index = _units findIf {
_x getVariable [QEGVAR(danger,dangerRadio), false]
//|| {(!isNull objectParent _x && {_x distance2D _unit < 70})}
|| {"b_radiobag_01_" in (toLower backpack _x)}
|| {"b_radiobag_01_" in (toLowerANSI backpack _x)}
|| {(getNumber (configFile >> "CfgVehicles" >> (backpack _x) >> "tf_hasLRradio")) isEqualTo 1}
};
_radio = _index isNotEqualTo -1;
Expand Down
2 changes: 1 addition & 1 deletion addons/main/functions/fnc_showDialog.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ private _fnc_AddSideSelector = {

private _controls = [];
{
private _type = toUpper (_x select 1);
private _type = toUpperANSI (_x select 1);
switch (_type) do {
case ("BOOLEAN");
case ("BOOL"): {
Expand Down
Loading