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

View File

@ -9,6 +9,8 @@
uiNamespace setVariable ["VEMFrUsedLocs", []]; uiNamespace setVariable ["VEMFrUsedLocs", []];
uiNamespace setVariable ["VEMFrHcLoad", []]; uiNamespace setVariable ["VEMFrHcLoad", []];
[] spawn
{
if ("overridesToRPT" call VEMFr_fnc_getSetting isEqualTo 1) then if ("overridesToRPT" call VEMFr_fnc_getSetting isEqualTo 1) then
{ {
_root = configProperties [configFile >> "CfgVemfReloaded" >> "CfgSettingsOverride", "true", false]; _root = configProperties [configFile >> "CfgVemfReloaded" >> "CfgSettingsOverride", "true", false];
@ -60,3 +62,4 @@ _scripts = ["checkLoot","missionTimer","REMOTEguard","spawnStaticAI"];
west setFriend [independent, 0]; west setFriend [independent, 0];
independent setFriend [west, 0]; independent setFriend [west, 0];
};

View File

@ -27,11 +27,10 @@ if (_this isEqualType []) then
_missionName = param [1, "", [""]]; _missionName = param [1, "", [""]];
if (_missionName in ("missionList" call VEMFr_fnc_getSetting) OR _missionName isEqualTo "Static") then if (_missionName in ("missionList" call VEMFr_fnc_getSetting) OR _missionName isEqualTo "Static") then
{ {
scopeName "this";
private ["_aiMode"]; private ["_aiMode"];
_aiMode = param [2, 0, [0]]; _aiMode = param [2, 0, [0]];
switch _aiMode do if (_aiMode isEqualTo 0) then
{
case 0:
{ {
private ["_aiGear","_uniforms","_headGear","_vests","_backpacks","_rifles","_pistols","_aiLaunchers","_launchers","_launcherChance"]; private ["_aiGear","_uniforms","_headGear","_vests","_backpacks","_rifles","_pistols","_aiLaunchers","_launchers","_launcherChance"];
// Define settings // Define settings
@ -117,8 +116,9 @@ if (_this isEqualType []) then
} forEach _units; } forEach _units;
_ok = true; _ok = true;
breakOut "this";
}; };
case 1: if (_aiMode isEqualTo 1) then
{ {
private ["_policeGear","_headGear","_vests","_uniforms","_rifles","_pistols","_backpacks"]; private ["_policeGear","_headGear","_vests","_uniforms","_rifles","_pistols","_backpacks"];
_policeGear = [["policeConfig"],["headGear","vests","uniforms","rifles","pistols","backpacks"]] call VEMFr_fnc_getSetting; _policeGear = [["policeConfig"],["headGear","vests","uniforms","rifles","pistols","backpacks"]] call VEMFr_fnc_getSetting;
@ -172,8 +172,9 @@ if (_this isEqualType []) then
}; };
} forEach _units; } forEach _units;
_ok = true; _ok = true;
breakOut "this";
}; };
case 2: if (_aiMode isEqualTo 2) then
{ {
private ["_policeGear","_rifles","_pistols"]; private ["_policeGear","_rifles","_pistols"];
_policeGear = [["policeConfig"],["rifles","pistols"]] call VEMFr_fnc_getSetting; _policeGear = [["policeConfig"],["rifles","pistols"]] call VEMFr_fnc_getSetting;
@ -219,11 +220,6 @@ if (_this isEqualType []) then
} forEach _units; } forEach _units;
_ok = true; _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) nothing (use spawn, not call)
*/ */
private ["_loggingEnabled"]; if ("debugMode" call VEMFr_fnc_getSetting > 0) then
_loggingEnabled = "debugMode" call VEMFr_fnc_getSetting;
if not(_loggingEnabled isEqualTo 0) then
{ {
scopeName "outer";
private ["_prefix","_type","_line","_doLog"]; private ["_prefix","_type","_line","_doLog"];
_prefix = param [0, "", [""]]; _prefix = param [0, "", [""]];
_type = param [1, 3, [0]]; _type = param [1, 3, [0]];
_line = param [2, "", [""]]; _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 (_debugMode isEqualTo 1 OR _debugMode isEqualTo 3) then
{
if (_loggingEnabled isEqualTo 1 OR _loggingEnabled isEqualTo 3) then
{ {
call _doLog; 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; 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; call _doLog;
}; breakOut "outer";
}; };
}; };

View File

@ -6,6 +6,7 @@ if isNil"VEMFrInvasionCount" then { VEMFrInvasionCount = 0; };
_missionName = param [0, "", [""]]; _missionName = param [0, "", [""]];
if (VEMFrInvasionCount < (([[_missionName],["maxInvasions"]] call VEMFr_fnc_getSetting) select 0)) then if (VEMFrInvasionCount < (([[_missionName],["maxInvasions"]] call VEMFr_fnc_getSetting) select 0)) then
{ {
scopeName "outer";
VEMFrInvasionCount = VEMFrInvasionCount + 1; VEMFrInvasionCount = VEMFrInvasionCount + 1;
private ["_settings","_grpCount","_groupUnits","_skipDistance","_loc","_hasPlayers","_spawned","_grpArr","_unitArr","_done","_boxes","_box","_chute","_colors","_lightType","_light","_smoke"]; private ["_settings","_grpCount","_groupUnits","_skipDistance","_loc","_hasPlayers","_spawned","_grpArr","_unitArr","_done","_boxes","_box","_chute","_colors","_lightType","_light","_smoke"];
// Define _settings // 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 = createMarker [format["VEMFr_DynaLocInva_ID%1", random 9000], _locPos];
_marker setMarkerShape "ICON"; _marker setMarkerShape "ICON";
_marker setMarkerType "o_unknown"; _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"; _marker setMarkerColor "ColorEAST";
}; };
case (_mode isEqualTo 1): if (_mode isEqualTo 1) then
{ {
_marker setMarkerColor "ColorWEST"; _marker setMarkerColor "ColorWEST";
}; };
case (_mode isEqualTo 2): if (_mode isEqualTo 2) then
{ {
_marker setMarkerColor "ColorBlack"; _marker setMarkerColor "ColorBlack";
}; };
}; };
};
// If enabled, kill all the lights // If enabled, kill all the lights
if (_streetLights isEqualTo 0) then if (_streetLights isEqualTo 0) then

View File

@ -54,17 +54,12 @@ if ("validateLoot" call VEMFr_fnc_getSetting isEqualTo 1) then
} forEach _x; } forEach _x;
} forEach _loot; } forEach _loot;
_invalid = if (count _invalidClasses isEqualTo 0) then { false } else { true }; if (count _invalidClasses isEqualTo 0) then
switch true do
{ {
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; ["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;
};
};
}; };
}; };