Skip to content

Commit 98af9ee

Browse files
author
Oliver Krüppel
committed
fixes #4 workaround for racecondition
1 parent 3f88e6b commit 98af9ee

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

addons/main/script_version.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#define MAJOR 0
22
#define MINOR 3
3-
#define PATCH 2
3+
#define PATCH 3
44
#define BUILD 0

addons/whitelist/functions/fn_checkRole.sqf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
params [
44
["_unit", objNull, [objNull]],
5-
["_vehicle", objNull, [objNull]]
5+
["_vehicle", objNull, [objNull]],
6+
["_role", "driver", [""]]
67
];
78

89
scopeName "_main";
@@ -23,13 +24,13 @@ switch (_vehicleType) do {
2324
};
2425
case "Plane": {
2526
if ((typeOf _vehicle) in GVAR(attackAircraft)) then {
26-
if (driver _vehicle isEqualTo _unit) then {
27+
if (_role isEqualTo "driver") then {
2728
if (ROLE_PLANE_ATTACK_PILOT in _roles) then { true breakOut "_main"; };
2829
} else {
2930
if (ROLE_PLANE_ATTACK_CREW in _roles) then { true breakOut "_main"; };
3031
};
3132
} else {
32-
if (driver _vehicle isEqualTo _unit) then {
33+
if (_role isEqualTo "driver") then {
3334
if (ROLE_PLANE_TRANSPORT_PILOT in _roles) then { true breakOut "_main"; };
3435
} else {
3536
if (ROLE_PLANE_TRANSPORT_CREW in _roles) then { true breakOut "_main"; };
@@ -38,13 +39,13 @@ switch (_vehicleType) do {
3839
};
3940
case "Helicopter": {
4041
if ((typeOf _vehicle) in GVAR(attackAircraft)) then {
41-
if (driver _vehicle isEqualTo _unit) then {
42+
if (_role isEqualTo "driver") then {
4243
if (ROLE_ROTARY_ATTACK_PILOT in _roles) then { true breakOut "_main"; };
4344
} else {
4445
if (ROLE_ROTARY_ATTACK_CREW in _roles) then { true breakOut "_main"; };
4546
};
4647
} else {
47-
if (driver _vehicle isEqualTo _unit) then {
48+
if (_role isEqualTo "driver") then {
4849
if (ROLE_ROTARY_TRANSPORT_PILOT in _roles) then { true breakOut "_main"; };
4950
} else {
5051
if (ROLE_ROTARY_TRANSPORT_CREW in _roles) then { true breakOut "_main"; };

addons/whitelist/functions/fn_handleRoleCheck.sqf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
params [
44
["_unit", objNull, [objNull]],
5-
["_vehicle", objNull, [objNull]]
5+
["_vehicle", objNull, [objNull]],
6+
["_role", "cargo", [""]]
67
];
78

89
if (isNull _unit) exitWith {};
910
if (isNull _vehicle) exitWith {};
1011
//make sure we dont kick a player from a parachute or flying something
1112
if (! ([_vehicle] call FUNC(isValidVehicle))) exitWith {};
1213

13-
if ([_unit, _vehicle] call FUNC(checkRole)) exitWith {};
14+
if ([_unit, _vehicle, _role] call FUNC(checkRole)) exitWith {};
1415

1516
[_unit, "You are not on the correct slot to use this vehicle"] call FUNC(kickFromVehicle);
1617

addons/whitelist/functions/fn_initPlayer.sqf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ GVAR(uavList) = [];
77
player addEventHandler ["SeatSwitchedMan", {
88
params ["_unit1", "_unit2", "_vehicle"];
99
if (!GVAR(enableWhitelist)) exitWith {};
10-
if (([_unit2] call CBA_fnc_vehicleRole) isEqualTo "cargo") exitWith {};
11-
[_unit2, _vehicle] remoteExecCall [QFUNC(handleRoleCheck), 2];
10+
private _role = [_unit2] call CBA_fnc_vehicleRole;
11+
if (_role isEqualTo "cargo") exitWith {};
12+
[_unit2, _vehicle, _role] remoteExecCall [QFUNC(handleRoleCheck), 2];
1213
}];
1314

1415
player addEventHandler ["GetInMan", {
1516
params ["_unit", "_role", "_vehicle", "_turret"];
1617
if (!GVAR(enableWhitelist)) exitWith {};
1718
if (_role isEqualTo "cargo") exitWith {};
18-
[_unit, _vehicle] remoteExecCall [QFUNC(handleRoleCheck), 2];
19+
[_unit, _vehicle, _role] remoteExecCall [QFUNC(handleRoleCheck), 2];
1920
}];
2021

2122
[

0 commit comments

Comments
 (0)