small optimizations

typeName ... isEqualTo >> isEqualType
This commit is contained in:
vbawol 2018-04-30 22:01:31 -05:00
parent 71db77f44b
commit 6c13f3d5ae
8 changed files with 18 additions and 18 deletions

View File

@ -13,7 +13,7 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/functions/EPOCH_fn_returnConfigEntryV2.sqf
Example:
_sapperRndChance = ["CfgEpochClient", "sapperRngChance", 100] call EPOCH_fnc_returnConfigEntryV2;
_config = ["CfgEpochClient", "sapperRngChance", 100] call EPOCH_fnc_returnConfigEntryV2;
Parameter(s):
_this select 0: STRING - Config Class
@ -24,7 +24,7 @@
MIXED
*/
//[[[cog import generate_private_arrays ]]]
private ["_config","_finalconfig","_missionconfig","_sapperRndChance","_varData"];
private ["_config","_finalconfig","_missionconfig","_varData"];
//[[[end]]]
params ["_configClass","_variableName","_defaultData"];
_varData = _defaultData;

View File

@ -20,7 +20,7 @@ private ["_arr","_ctrl","_ctrlCurrent","_ctrlDefault","_ctrlEdit","_data","_defa
//[[[end]]]
params ["_ctrl"];
_display = if (typeName _ctrl isEqualTo "CONTROL") then {ctrlParent _ctrl} else {displayNull};
_display = if (_ctrl isEqualType controlNull) then {ctrlParent _ctrl} else {displayNull};
_input = if (_ctrl isEqualType "STRING") then {_ctrl} else {str _ctrl};
switch (_input) do {

View File

@ -21,7 +21,7 @@ _arrIn = _this;
_cfg = 'CfgEpochClient' call EPOCH_returnConfig;
_Suppressed = getarray (_cfg >> "SuppressedCraftingItems");
if !(typeName (_arrIn select 0) isEqualTo "CONFIG") exitWith {[]};
if !((_arrIn select 0) isEqualType configNull) exitWith {[]};
_type0 = []; _type1 = []; _type2 = []; _type3 = []; _out = [];
{

View File

@ -32,7 +32,7 @@ if(_customCol isEqualTo [])then{
_txtCol = if((_customCol select 1)isEqualTypeAll 0) then [{_customCol select 1},{_txtCol = [1,1,1,0.95]}];
};
if !(typeName _msg isEqualTo "STRING") then { //Needed to remove quotations from strings
if !(_msg isEqualType "STRING") then { //Needed to remove quotations from strings
_msg = str (parseText str _msg); //Parses and converts text back to small string
};

View File

@ -12,7 +12,7 @@
Usage:
"TEST" call Epoch_message_stack
["===================================",5,[[0,0,0,0.2],[1,0.5,0,1]]] call Epoch_message_stack;
["World!",5,[[0,0,0,0.2],[1,1,1,1]]] call Epoch_message_stack;
["Hello",5,[[0,0,0,0.2],[1,1,1,1]]] call Epoch_message_stack;
@ -34,7 +34,7 @@ if(_customCol isEqualTo [])then{
_bgCol = if((_customCol select 0)isEqualTypeAll 0) then [{_customCol select 0},{_bgCol = [0,0,0,0.2]}];
_txtCol = if((_customCol select 1)isEqualTypeAll 0) then [{_customCol select 1},{_txtCol = [1,1,1,0.95]}];
};
if !(typeName _msg isEqualTo "STRING") then { //Needed to remove quotations from strings
if !(_msg isEqualType "STRING") then { //Needed to remove quotations from strings
_msg = str (parseText str _msg); //Parses and converts text back to small string
};
@ -53,7 +53,7 @@ rmx_var_msgStackQueue = [[_msg, _time, [_bgCol,_txtCol]] ];
_cStartPos = [safeZoneX,((_yPos - _ySize) * GUI_GRID_H + GUI_GRID_Y),safeZoneW, _ySize * GUI_GRID_H];
_ctrlArr = [1];
_fnc_reorganizeCtrls = {
if !(_ctrlArr isEqualTo []) then {
{
@ -64,7 +64,7 @@ rmx_var_msgStackQueue = [[_msg, _time, [_bgCol,_txtCol]] ];
} forEach _ctrlArr;
};
};
while {(count _ctrlArr) > 0} do {
if ((_ctrlArr select 0) isEqualTo 1) then {_ctrlArr = [];};
if !(rmx_var_msgStackQueue isEqualTo []) then {
@ -72,19 +72,19 @@ rmx_var_msgStackQueue = [[_msg, _time, [_bgCol,_txtCol]] ];
_time = diag_tickTime + (rmx_var_msgStackQueue select 0 select 1);
_col = (rmx_var_msgStackQueue select 0)select 2;
rmx_var_msgStackQueue deleteAt 0;
_c = _dsp ctrlCreate ["rmx_t1", call epoch_getIDC];
_c ctrlSetBackgroundColor (_col select 0);
_c ctrlSetText _msg;
_c ctrlSetTextColor (_col select 1);
_c ctrlSetPosition _cStartPos;
_c ctrlSetFade 1;
_c ctrlCommit 0;
_c ctrlSetFade 0;
_c ctrlCommit 0.5;
_ctrlArr pushBack [_c,_time];
call _fnc_reorganizeCtrls;
};

View File

@ -58,7 +58,7 @@ if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
if (_selectedPlayerName == "Dead Player") then {
_memberrange = ["PlayerData", _selectedPlayerUID] call EPOCH_fnc_server_hiveGETRANGE;
if (count (_memberrange select 1) > 0) then {
if (typename (_memberrange select 1 select 0) == "STRING") then {
if ((_memberrange select 1 select 0) isEqualType "STRING") then {
_selectedPlayerName = _memberrange select 1 select 0;
};
};

View File

@ -31,7 +31,7 @@ _contentArray = [];
} forEach (allPlayers select {getPlayerUID _x == _groupID});
if !(_contentArray isEqualTo []) then {
_contentArray params ["_groupName","_leaderName","_groupSize","_modArray","_memberArray"];
_allPlayers = allPlayers select {alive _x};
@ -54,13 +54,13 @@ if !(_contentArray isEqualTo []) then {
[_x] joinSilent _group;
};
} forEach (_allPlayers select {getPlayerUID _x == _selectedPlayerUID});
// find player name from DB
if (_selectedPlayerName == "Dead Player") then {
_memberrange = ["PlayerData", _selectedPlayerUID] call EPOCH_fnc_server_hiveGETRANGE;
if (count (_memberrange select 1) > 0) then {
if (typename (_memberrange select 1 select 0) == "STRING") then {
if ((_memberrange select 1 select 0) isEqualType "STRING") then {
_selectedPlayerName = _memberrange select 1 select 0;
};
};

View File

@ -18,7 +18,7 @@ private ["_allowedVehicleListName","_allowedVehiclesList","_backpacks","_cfgPric
params ["_player",["_token","",[""]],["_objArr",[]],["_pos",[]],["_wepHolder",objNull],["_clearCargo",true],["_objSpc","CAN_COLLIDE"],["_driverType",""],["_gunnerType",""],["_commanderType",""],["_crewType",""],["_doDamage",false]];
if !([_player,_token]call EPOCH_server_getPToken) exitWith {};
if (typeName _objArr != "ARRAY")then{_objArr = [_objArr];};
if !(_objArr isEqualType [])then{_objArr = [_objArr];};
if (count _objArr < 1) exitWith {};
diag_log format["Epoch: Attempt Create Object: %1 for %2",_objArr, name _player];