Skip to content

Commit

Permalink
Fix defect with clothes shop checking for empty string license
Browse files Browse the repository at this point in the history
  • Loading branch information
micovery committed Jan 18, 2013
1 parent cbc9b84 commit 6ff645b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
40 changes: 23 additions & 17 deletions anarchyinthetk.takistan/Awesome/Clothes/Clothes Dialogs.sqf
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
_group = group player;
_side = playerSide;
_fac = faction player;
private["_group", "_side", "_fac"];

_group = group player;
_side = playerSide;
_fac = faction player;

C_shopnum = ((_this select 3) select 0);
C_shoparray = Clothing_Shops select C_shopnum;
C_ShopList = [];
C_ShopList = C_shoparray select 1;

private["_shopaside", "_shopabool", "_shopalic"];
_shopaside = C_shoparray select 2;
_shopabool = C_shoparray select 3;
_shopalic = C_shoparray select 4;
Expand All @@ -18,26 +22,28 @@ if (iscop) then { C_tstorage = C_storage_west; };
if (isopf) then { C_tstorage = C_storage_east; };
if (isins) then { C_tstorage = C_storage_guer; };

private["_exit", "_haslic"];

_exit = false;
_haslic = true;

if (C_Side != _shopaside) then {
player groupchat format["This shop is not for your side: %1", C_Side];
_exit = true;
};

for [{_i = 0}, {_i < count _shopalic}, {_i = _i + 1}] do
{
_license = (_shopalic select _i);
_haslic_i = _license call INV_HasLicense;

if (!(_haslic_i)) then {
player groupchat format ['You require the license: %1',(_license call INV_GetLicenseName)];
_haslic = false;
};

player groupchat format["This shop is not for your side: %1", C_Side];
_exit = true;
};

private["_i"];
_i = 0;
while { _i < (count _shopalic) } do {
_license = (_shopalic select _i);
_haslic_i = _license call INV_HasLicense;

if (not(_haslic_i)) then {
player groupchat format ['You require the license: %1',(_license call INV_GetLicenseName)];
_haslic = false;
};
_i = _i + 1;
};

if (!(_haslic)) exitwith {};
if (_exit) exitwith {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ player_has_license = {
if (not([_player] call player_human)) exitWith {false};
if (isNil "_license") exitWith {false};
if (typeName _license != "STRING") exitWith {false};
if (_license == "") exitWith {true};

private["_licenses"];
_licenses = [_player, "INV_LicenseOwner"] call player_get_array;
Expand Down

0 comments on commit 6ff645b

Please sign in to comment.