Skip to content

Commit

Permalink
fixed segfault bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ir0n1e committed May 27, 2015
1 parent f0ac5f4 commit e08756c
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 45 deletions.
7 changes: 4 additions & 3 deletions bwplus_toolsandstructures/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class CfgPatches {
requiredAddons[] = {
BWplus_core,
};
version = "1.4";
versionStr = "1.4";
versionAr[] = {1,4,0};
version = "1.4.1";
versionStr = "1.4.1";
versionAr[] = {1,4,1};
author[] = {"EduardLaser", "Ir0n1E"};
authorUrl = "http://ntalpha.de";
};
Expand Down Expand Up @@ -239,6 +239,7 @@ class CfgVehicles {
class eventHandlers {
Init = "_this call BWplus_toolsandstructures_fnc_initCrater";
};

class AGM_Actions {
class BWplus_DismantleCrater {
displayName = "$STR_BWplus_toolsandstructures_DismantleCrate";
Expand Down
73 changes: 37 additions & 36 deletions bwplus_toolsandstructures/fnc/fn_buildCrater.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#define MAXCRATER_NONPIO 1
#define CRATER "BWplus_crater"
#define NET "BWplus_CamoNet"
#define ITEMNET "BWplus_Item_CamoNet"

private ["_buildwithNet","_buildtime","_maxcrater","_crater","_net","_items","_crater_count"];

Expand All @@ -31,50 +30,52 @@ AGM_player setVariable ["BWplus_building",true,true];
AGM_player setVariable ["BWplus_crater_abort",false];

BWplus_buildCrater = {
private ["_time","_items","_buildwithNet","_dir_crater","_pos_rel_crater","_net","_crater","_end_pos_rel","_end_pos_relnet","_start_pos_relnet","_start_pos_rel","_dir","_pos_rel"];
_this spawn {
private ["_time","_items","_buildwithNet","_dir_crater","_pos_rel_crater","_net","_crater","_end_pos_rel","_end_pos_relnet","_start_pos_relnet","_start_pos_rel","_dir","_pos_rel"];

_time = _this select 0;
_items = _this select 1;
_buildwithNet = _this select 2;
_dir_crater = getdir AGM_player;
_pos_rel_crater = [AGM_player, 5, _dir_crater] call BIS_fnc_relPos;
_net = _items select 1;
_crater = _items select 0;
_time = _this select 0;
_items = _this select 1;
_buildwithNet = _this select 2;
_dir_crater = getdir AGM_player;
_pos_rel_crater = [AGM_player, 5, _dir_crater] call BIS_fnc_relPos;
_net = _items select 1;
_crater = _items select 0;

_end_pos_rel = (_pos_rel_crater select 2) - 0.2;
_end_pos_relnet = _end_pos_rel - 0.62;
_start_pos_relnet = _end_pos_rel - 2;
_start_pos_rel = _end_pos_rel - 0.5;

for "_i" from 0 to (_time -1) do {
scopeName "loop";
_end_pos_rel = (_pos_rel_crater select 2) - 0.2;
_end_pos_relnet = _end_pos_rel - 0.62;
_start_pos_relnet = _end_pos_rel - 2;
_start_pos_rel = _end_pos_rel - 0.5;
[AGM_player, "AinvPknlMstpSnonWnonDr_medic5", 1] call AGM_Core_fnc_doAnimation;
_crater setpos [_pos_rel_crater select 0,_pos_rel_crater select 1,_start_pos_rel - (_start_pos_rel/_time) ];

_crater setdir _dir_crater+270;
if (_buildwithNet) then {
_dir = getdir _crater;
_pos_rel = [_crater, 0.5, _dir+260] call BIS_fnc_relPos;
_net setpos [_pos_rel select 0,_pos_rel select 1,_start_pos_relnet-(_start_pos_relnet/_time)];
_net setdir _dir+260;
};
_time = _time -1;
for "_i" from 0 to (_time -1) do {
scopeName "loop";

sleep 1;
if (AGM_player getVariable ["BWplus_crater_abort",false]) then {
breakOut "loop";
};
};
_crater setpos [_pos_rel_crater select 0,_pos_rel_crater select 1,_start_pos_rel - (_start_pos_rel/_time) ];

if (not (AGM_player getVariable "BWplus_crater_abort")) then {
_crater setpos [_pos_rel_crater select 0,_pos_rel_crater select 1,_end_pos_rel];
_crater setdir _dir_crater+270;
_crater setdir _dir_crater+270;
if (_buildwithNet) then {
_dir = getdir _crater;
_pos_rel = [_crater, 0.5, _dir+260] call BIS_fnc_relPos;
_net setpos [_pos_rel select 0,_pos_rel select 1,_end_pos_relnet];
_net setpos [_pos_rel select 0,_pos_rel select 1,_start_pos_relnet-(_start_pos_relnet/_time)];
_net setdir _dir+260;
};
_time = _time -1;

sleep 1;
if (AGM_player getVariable ["BWplus_crater_abort",false]) then {
breakOut "loop";
};
};

if (not (AGM_player getVariable "BWplus_crater_abort")) then {
_crater setpos [_pos_rel_crater select 0,_pos_rel_crater select 1,_end_pos_rel];
_crater setdir _dir_crater+270;
if (_buildwithNet) then {
_dir = getdir _crater;
_pos_rel = [_crater, 0.5, _dir+260] call BIS_fnc_relPos;
_net setpos [_pos_rel select 0,_pos_rel select 1,_end_pos_relnet];
_net setdir _dir+260;
};
};
};
};
/*
Expand All @@ -83,4 +84,4 @@ if ((AGM_player getvariable "BWplus_crater_count") >= _maxcrater) exitwith {
};
*/
[_buildtime, [_items, _crater_count, AGM_player, _buildwithNet], "BWplus_toolsandstructures_fnc_buildCraterCallback", localize "STR_BWplus_toolsandstructures_BuildingCrater","BWplus_toolsandstructures_fnc_buildCraterAbort"] call AGM_Core_fnc_progressBar;
[_buildtime,_items, _buildwithNet] spawn BWplus_buildCrater;
[_buildtime,_items, _buildwithNet] call BWplus_buildCrater;
10 changes: 7 additions & 3 deletions bwplus_toolsandstructures/fnc/fn_initCamoNet.sqf
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
private ["_net","_pos"];
_net = _this select 0;
_pos = position _net;
_net setpos [_pos select 0, _pos select 1, (_pos select 2) -0.62];
_this spawn {
_net = _this select 0;

waitUntil {alive _net};
_pos = position _net;
_net setpos [_pos select 0, _pos select 1, (_pos select 2) -0.62];
};
10 changes: 7 additions & 3 deletions bwplus_toolsandstructures/fnc/fn_initCrater.sqf
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
private ["_crater","_pos"];
_crater = _this select 0;
_pos = position _crater;
_crater setpos [_pos select 0, _pos select 1, (_pos select 2) -0.2];
_this spawn {

_crater = _this select 0;
waitUntil {alive _crater};
_pos = getpos _crater;
_crater setpos [_pos select 0, _pos select 1, (_pos select 2) -0.2];
};

0 comments on commit e08756c

Please sign in to comment.