mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
fix possible random var collisions
This commit is contained in:
parent
e14a730eda
commit
ae581880a4
@ -24,7 +24,7 @@
|
|||||||
BOOL
|
BOOL
|
||||||
*/
|
*/
|
||||||
//[[[cog import generate_private_arrays ]]]
|
//[[[cog import generate_private_arrays ]]]
|
||||||
private ["_code","_config","_config_name","_customVarNames","_customVarsInit","_file","_file_raw","_file_tag","_fnc_path","_header","_missionConfig","_tag","_test","_var_name","_version"];
|
private ["_code","_config","_config_name","_customVarNames","_customVarsInit","_file","_file_raw","_file_tag","_fnc_path","_header","_missionConfig","_randomValues","_rng","_tag","_var_name","_version"];
|
||||||
//[[[end]]]
|
//[[[end]]]
|
||||||
params [["_configName","",[""] ] ];
|
params [["_configName","",[""] ] ];
|
||||||
|
|
||||||
@ -37,9 +37,17 @@ if (isClass _missionConfig) then{
|
|||||||
// custom header for interscript communications
|
// custom header for interscript communications
|
||||||
_customVarsInit = getArray(getMissionConfig "CfgEpochClient" >> "customVarsDefaults");
|
_customVarsInit = getArray(getMissionConfig "CfgEpochClient" >> "customVarsDefaults");
|
||||||
_customVarNames = _customVarsInit apply {_x param [0,""]};
|
_customVarNames = _customVarsInit apply {_x param [0,""]};
|
||||||
|
|
||||||
|
_randomValues = [];
|
||||||
_header = "";
|
_header = "";
|
||||||
{
|
{
|
||||||
_header = _header + format["_player%1Key = 'EPOCH_%2';",_x, round(diag_tickTime + random 99999)];
|
while {true} do {
|
||||||
|
_rng = round(diag_tickTime + random 99999);
|
||||||
|
if !(_rng in _randomValues) exitWith {
|
||||||
|
_randomValues pushBack _rng;
|
||||||
|
_header = _header + format["_player%1Key = 'EPOCH_%2';",_x, _rng];
|
||||||
|
};
|
||||||
|
};
|
||||||
} forEach _customVarNames;
|
} forEach _customVarNames;
|
||||||
|
|
||||||
_version = getNumber(_config >> "version");
|
_version = getNumber(_config >> "version");
|
||||||
|
Loading…
Reference in New Issue
Block a user