fixed crash with crafting load since 1.66

This commit is contained in:
vbawol 2016-12-02 09:59:01 -06:00
parent a4f0ab80ec
commit 84eb6fc8a8

View File

@ -13,68 +13,73 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/scripts/craftingv2/EPOCH_crafting_load.sqf
*/
if (rmx_var_craftingENABLED) exitWith {false};
disableSerialization;
private ["_in","_cfg","_3DCTRL","_recipeCTRL","_recipeConfigs"];
_in = param [0,""];
createDialog "rmx_craftingUI";
call EPOCH_crafting_ctrl_collector;
_this spawn {
private ["_in","_cfg","_3DCTRL","_recipeCTRL","_recipeConfigs"];
//Var defs
rmx_var_craftQTY = 0;
rmx_var_craftQTYOut = 0;
rmx_var_craftInProgress = false;
disableSerialization;
//Defines
_cfg = 'CfgCrafting' call EPOCH_returnConfig;
_in = param [0,""];
_cfg call EPOCH_crafting_colorScheme;
waitUntil {!isNull findDisplay 77700};
call EPOCH_crafting_ctrl_collector;
_3DCTRL = rmx_var_crafting_ctrl_DEVMisc select 0;
_recipeCTRL = rmx_var_crafting_ctrl_main select 0;
//Var defs
rmx_var_craftQTY = 0;
rmx_var_craftQTYOut = 0;
rmx_var_craftInProgress = false;
//First Launch
_recipeConfigs = "true" configClasses _cfg;
_recipeConfigs deleteRange [0,6]; //delete main templates as they are not real items
//Defines
_cfg = 'CfgCrafting' call EPOCH_returnConfig;
rmx_var_crafting_FullConfigData = _recipeConfigs call EPOCH_crafting_getConfig;
rmx_var_crafting_SearchConfigData = rmx_var_crafting_FullConfigData;
_cfg call EPOCH_crafting_colorScheme;
[_3DCTRL] call Epoch_3DctrlSpin;
_3DCTRL ctrlEnable false;
_3DCTRL = rmx_var_crafting_ctrl_DEVMisc select 0;
_recipeCTRL = rmx_var_crafting_ctrl_main select 0;
call EPOCH_crafting_LB_defaults; //Default state
//First Launch
_recipeConfigs = "true" configClasses _cfg;
_recipeConfigs deleteRange [0,6]; //delete main templates as they are not real items
//Basic EH setup
if (getNumber (_cfg >> "DeveloperMode") > 0) then {
rmx_var_crafting_FullConfigData = _recipeConfigs call EPOCH_crafting_getConfig;
rmx_var_crafting_SearchConfigData = rmx_var_crafting_FullConfigData;
[_3DCTRL] call Epoch_3DctrlSpin;
_3DCTRL ctrlEnable false;
call EPOCH_crafting_LB_defaults; //Default state
//Basic EH setup
if (getNumber (_cfg >> "DeveloperMode") > 0) then {
private "_ctrlDevMain";
_ctrlDevMain = rmx_var_crafting_ctrl_DEVMisc select 1;
_ctrlDevMain ctrlEnable true;
_ctrlDevMain ctrlShow true;
};
rmx_var_crafting_progressClicked = false;
};
rmx_var_crafting_progressClicked = false;
ctrlSetFocus _recipeCTRL;
ctrlSetFocus _recipeCTRL;
//puts arguments into search field
if (_in isEqualType "STRING") then {
//puts arguments into search field
if (_in isEqualType "STRING") then {
if (count _in > 0) then { //required, empty string crashes game for some reason
(rmx_var_crafting_ctrl_Interact select 4) ctrlSetText _in;
};
};
};
//Post Processing
rmx_var_crafting_PP_CC = ["colorCorrections",11] call epoch_postProcessCreate;
rmx_var_crafting_PP_DB = ["dynamicBlur",11] call epoch_postProcessCreate;
//Post Processing
rmx_var_crafting_PP_CC = ["colorCorrections",11] call epoch_postProcessCreate;
rmx_var_crafting_PP_DB = ["dynamicBlur",11] call epoch_postProcessCreate;
[rmx_var_crafting_PP_CC, 0, [1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,1,1,0,0,0,0.296494,1]] call epoch_postprocessAdjust;
[rmx_var_crafting_PP_DB, 1, [1]] call epoch_postprocessAdjust;
[rmx_var_crafting_PP_CC, 0, [1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,1,1,0,0,0,0.296494,1]] call epoch_postprocessAdjust;
[rmx_var_crafting_PP_DB, 1, [1]] call epoch_postprocessAdjust;
//Custom textures
//Custom textures
//Manages quantity slider
[] spawn {
//Manages quantity slider
[] spawn {
private ["_pos","_txt"];
while {rmx_var_craftingLOOPS} do {
_pos = progressPosition (rmx_var_crafting_ctrl_Interact select 2);
@ -82,10 +87,10 @@ rmx_var_crafting_PP_DB = ["dynamicBlur",11] call epoch_postProcessCreate;
_txt = format ["[%1/%2]",rmx_var_craftQTYOut,rmx_var_craftQTY];
(rmx_var_crafting_ctrl_Interact select 3) ctrlSetText _txt;
};
};
};
//Search box
[] spawn {
//Search box
[] spawn {
disableSerialization;
private ["_searchCTRL","_searchTextTEMP"];
_searchCTRL = rmx_var_crafting_ctrl_Interact select 4;
@ -111,10 +116,10 @@ rmx_var_crafting_PP_DB = ["dynamicBlur",11] call epoch_postProcessCreate;
ctrlSetFocus _searchCTRL;
};
};
};
};
//Craft button states
[] spawn {
//Craft button states
[] spawn {
private ["_btn","_btn_cancel","_btn_craft","_btn_close"];
disableSerialization;
_btn = rmx_var_crafting_ctrl_Interact select 0;
@ -137,13 +142,14 @@ rmx_var_crafting_PP_DB = ["dynamicBlur",11] call epoch_postProcessCreate;
};
}
};
};
};
[] spawn {
[] spawn {
private "_pos";
_pos = position player;
while {rmx_var_craftingLOOPS} do {
if ((_pos distance (position player)) > 1) exitWith {closeDialog 0;};
};
};
};
true