Improved performance and speed

This commit is contained in:
IT07 2016-04-16 13:11:18 +02:00
parent 5c53f35ab6
commit fcc7f91f00
6 changed files with 279 additions and 286 deletions

View File

@ -16,36 +16,33 @@ if (_this isEqualType "") then
_cfg = configFile >> "CfgVehicles" >> _this >> "faction";
if not isNull _cfg then
{
scopeName "isNull";
private ["_faction"];
_faction = getText _cfg;
switch _faction do
{
case "BLU_G_F":
if (_faction isEqualTo "BLU_G_F") then
{
_return = WEST;
breakOut "isNull";
};
case "CIV_F":
if (_faction isEqualTo "CIV_F") then
{
_return = civilian;
breakOut "isNull";
};
case "IND_F":
if (_faction isEqualTo "IND_F") then
{
_return = independent;
breakOut "isNull";
};
case "IND_G_F":
if (_faction isEqualTo "IND_G_F") then
{
_return = resistance;
breakOut "isNull";
};
case "OPF_F":
if (_faction isEqualTo "OPF_F") then
{
_return = EAST;
};
default
{
["fn_checkSide", 0, format["Fatal error; Unknown faction '%1'", _faction]] spawn VEMFr_fnc_log;
};
};
};
_return
};
_return

View File

@ -9,8 +9,10 @@
uiNamespace setVariable ["VEMFrUsedLocs", []];
uiNamespace setVariable ["VEMFrHcLoad", []];
if ("overridesToRPT" call VEMFr_fnc_getSetting isEqualTo 1) then
[] spawn
{
if ("overridesToRPT" call VEMFr_fnc_getSetting isEqualTo 1) then
{
_root = configProperties [configFile >> "CfgVemfReloaded" >> "CfgSettingsOverride", "true", false];
if (count _root > 0) then
{
@ -49,14 +51,15 @@ if ("overridesToRPT" call VEMFr_fnc_getSetting isEqualTo 1) then
};
} forEach _root;
};
};
};
_scripts = ["checkLoot","missionTimer","REMOTEguard","spawnStaticAI"];
{
_scripts = ["checkLoot","missionTimer","REMOTEguard","spawnStaticAI"];
{
private ["_script"];
_script = [] ExecVM format["exile_vemf_reloaded\sqf\%1.sqf", _x];
waitUntil { uiSleep 0.5; scriptDone _script };
} forEach _scripts;
} forEach _scripts;
west setFriend [independent, 0];
independent setFriend [west, 0];
west setFriend [independent, 0];
independent setFriend [west, 0];
};

View File

@ -27,11 +27,10 @@ if (_this isEqualType []) then
_missionName = param [1, "", [""]];
if (_missionName in ("missionList" call VEMFr_fnc_getSetting) OR _missionName isEqualTo "Static") then
{
scopeName "this";
private ["_aiMode"];
_aiMode = param [2, 0, [0]];
switch _aiMode do
{
case 0:
if (_aiMode isEqualTo 0) then
{
private ["_aiGear","_uniforms","_headGear","_vests","_backpacks","_rifles","_pistols","_aiLaunchers","_launchers","_launcherChance"];
// Define settings
@ -117,8 +116,9 @@ if (_this isEqualType []) then
} forEach _units;
_ok = true;
breakOut "this";
};
case 1:
if (_aiMode isEqualTo 1) then
{
private ["_policeGear","_headGear","_vests","_uniforms","_rifles","_pistols","_backpacks"];
_policeGear = [["policeConfig"],["headGear","vests","uniforms","rifles","pistols","backpacks"]] call VEMFr_fnc_getSetting;
@ -172,8 +172,9 @@ if (_this isEqualType []) then
};
} forEach _units;
_ok = true;
breakOut "this";
};
case 2:
if (_aiMode isEqualTo 2) then
{
private ["_policeGear","_rifles","_pistols"];
_policeGear = [["policeConfig"],["rifles","pistols"]] call VEMFr_fnc_getSetting;
@ -219,11 +220,6 @@ if (_this isEqualType []) then
} forEach _units;
_ok = true;
};
default
{
["fn_loadInv", 0, format["Incorrect _aiMode (%1) given!", _aiMode]] spawn VEMFr_fnc_log;
};
};
};
};
};

View File

@ -14,38 +14,35 @@
nothing (use spawn, not call)
*/
private ["_loggingEnabled"];
_loggingEnabled = "debugMode" call VEMFr_fnc_getSetting;
if not(_loggingEnabled isEqualTo 0) then
if ("debugMode" call VEMFr_fnc_getSetting > 0) then
{
scopeName "outer";
private ["_prefix","_type","_line","_doLog"];
_prefix = param [0, "", [""]];
_type = param [1, 3, [0]];
_line = param [2, "", [""]];
_doLog =
{
diag_log text format["IT07: [exile_vemf_reloaded] %1 -- %2", _prefix, _line];
};
switch _type do
_doLog = { diag_log text format["IT07: [exile_vemf_reloaded] %1 -- %2", _prefix, _line] };
_debugMode = "debugMode" call VEMFr_fnc_getSetting;
if (_type isEqualTo 0) then
{
case 0:
{
if (_loggingEnabled isEqualTo 1 OR _loggingEnabled isEqualTo 3) then
if (_debugMode isEqualTo 1 OR _debugMode isEqualTo 3) then
{
call _doLog;
breakOut "outer";
};
};
case 1:
if (_type isEqualTo 1) then
{
if (_loggingEnabled isEqualTo 2 OR _loggingEnabled isEqualTo 3) then
if (_debugMode isEqualTo 2 OR _debugMode isEqualTo 3) then
{
call _doLog;
breakOut "outer";
};
};
case 2:
if (_type isEqualTo 2) then // This bypasses _debugMode setting. Always logs given params even if debugMode is set to 0
{
call _doLog;
};
breakOut "outer";
};
};

View File

@ -6,6 +6,7 @@ if isNil"VEMFrInvasionCount" then { VEMFrInvasionCount = 0; };
_missionName = param [0, "", [""]];
if (VEMFrInvasionCount < (([[_missionName],["maxInvasions"]] call VEMFr_fnc_getSetting) select 0)) then
{
scopeName "outer";
VEMFrInvasionCount = VEMFrInvasionCount + 1;
private ["_settings","_grpCount","_groupUnits","_skipDistance","_loc","_hasPlayers","_spawned","_grpArr","_unitArr","_done","_boxes","_box","_chute","_colors","_lightType","_light","_smoke"];
// Define _settings
@ -63,22 +64,26 @@ if (VEMFrInvasionCount < (([[_missionName],["maxInvasions"]] call VEMFr_fnc_getS
_marker = createMarker [format["VEMFr_DynaLocInva_ID%1", random 9000], _locPos];
_marker setMarkerShape "ICON";
_marker setMarkerType "o_unknown";
switch true do
if (_mode < 0 OR _mode > 2) then
{
case (_mode isEqualTo 0):
["DynamicLocationInvasion", 0, format["Invalid aiMode (%1) detected, failed to setMarkerColor!", _aiMode]] spawn VEMFr_fnc_log;
VEMFrInvasionCount = VEMFrInvasionCount - 1;
VEMFrMissionCount = VEMFrMissionCount - 1;
breakOut "outer";
};
if (_mode isEqualTo 0) then
{
_marker setMarkerColor "ColorEAST";
};
case (_mode isEqualTo 1):
if (_mode isEqualTo 1) then
{
_marker setMarkerColor "ColorWEST";
};
case (_mode isEqualTo 2):
if (_mode isEqualTo 2) then
{
_marker setMarkerColor "ColorBlack";
};
};
};
// If enabled, kill all the lights
if (_streetLights isEqualTo 0) then

View File

@ -54,17 +54,12 @@ if ("validateLoot" call VEMFr_fnc_getSetting isEqualTo 1) then
} forEach _x;
} forEach _loot;
_invalid = if (count _invalidClasses isEqualTo 0) then { false } else { true };
switch true do
if (count _invalidClasses isEqualTo 0) then
{
case _invalid:
["CheckLoot", 1, "Loot tables are all valid :)"] spawn VEMFr_fnc_log;
} else
{
["CheckLoot", 0, format["Invalid classes found in loot! | %1", _invalidClasses]] spawn VEMFr_fnc_log;
};
case (not _invalid):
{
["CheckLoot", 1, "Loot tables are all valid :)"] spawn VEMFr_fnc_log;
};
};
};
};