Skip to content

Commit

Permalink
FIX: btc_civ_veh_active is an array of traffic veh
Browse files Browse the repository at this point in the history
  • Loading branch information
Vdauphin committed Jan 12, 2016
1 parent 85385bd commit 1321efe
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion =BTC=co@22_Hearts_and_Minds.Altis/core/def/mission.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if (isServer) then {
btc_city_blacklist = [];//NAME FROM CFG

//Civ
btc_civ_veh_active = 0;
btc_civ_veh_active = [];

//Database
btc_db_is_saving = false;
Expand Down
8 changes: 5 additions & 3 deletions =BTC=co@22_Hearts_and_Minds.Altis/core/fnc/city/activate.sqf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

private ["_city","_is_init","_data_units","_type","_radius_x","_radius_y","_has_en","_has_ho","_ieds","_radius","_number_patrol_active"];
private ["_city","_is_init","_data_units","_type","_radius_x","_radius_y","_has_en","_has_ho","_ieds","_radius","_number_patrol_active","_number_civ_veh_active"];

hint ("Activate " + str(_this));

Expand Down Expand Up @@ -156,11 +156,13 @@ if (_number_patrol_active < btc_patrol_max) then {
};

//Traffic
if (btc_civ_veh_active < btc_civ_max_veh) then {
btc_civ_veh_active = btc_civ_veh_active - [grpNull];
_number_civ_veh_active = count btc_civ_veh_active;
if (_number_civ_veh_active < btc_civ_max_veh) then {
private ["_n","_av","_d","_r"];
_n = 0;_r = 0;
_n = round (random 3 + (3/2));
_av = btc_civ_max_veh - btc_civ_veh_active;
_av = btc_civ_max_veh - _number_civ_veh_active;
_d = _n - _av;
if (_d > 0) then {_r = _n - _d;} else {_r = _n;};
for "_i" from 1 to _r do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ if ({_x distance _city < (_area/2) || _x distance leader _group < (_area/2)} cou
diag_log text "DELETE TRAFFIC GROUP";
if (vehicle leader _group != leader _group) then {deleteVehicle (vehicle leader _group)};
{deleteVehicle _x;} foreach units _group;deleteGroup _group;
btc_civ_veh_active = btc_civ_veh_active - 1;
};

_cities = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ private ["_city","_area","_cities","_useful","_unit_type","_veh_type","_group","
_city = _this select 0;
_area = _this select 1;

btc_civ_veh_active = btc_civ_veh_active + 1;
if (isNil "btc_traffic_id") then {btc_traffic_id = 0;};

_cities = [];
Expand Down Expand Up @@ -61,6 +60,8 @@ _3 = _veh addEventHandler ["GetOut", {_this call btc_fnc_civ_traffic_eh}];
_veh setVariable ["eh", [_1,_2,_3/*,4,5*/]];
_veh setVariable ["driver", leader _group];

btc_civ_veh_active pushBack _group;

{_x call btc_fnc_civ_unit_create;_x setVariable ["traffic",_veh];} foreach units _group;

[_group,_area,_iswater] call btc_fnc_civ_traffic_add_WP;
2 changes: 0 additions & 2 deletions =BTC=co@22_Hearts_and_Minds.Altis/core/fnc/civ/traffic_eh.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ _veh call btc_fnc_civ_traffic_eh_remove;
[_veh,(_veh getVariable ["driver",_veh])] spawn {
waitUntil {sleep 5; ({_x distance (_this select 0) < 600} count playableUnits == 0)};
{deleteVehicle _x;} foreach _this;
if (isNull (_this select 0)) exitWith {};//Just to be sure
btc_civ_veh_active = btc_civ_veh_active - 1;
};
1 change: 0 additions & 1 deletion =BTC=co@22_Hearts_and_Minds.Altis/core/fnc/rep/killed.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ if !(isNil {_unit getVariable ["traffic",objNull]}) then {
[getPos _unit,(_unit getVariable ["traffic",objNull])] spawn {
waitUntil {sleep 5; ({_x distance (_this select 0) < 300} count playableUnits == 0)};
deleteVehicle (_this select 1);
btc_civ_veh_active = btc_civ_veh_active - 1;
};
};

0 comments on commit 1321efe

Please sign in to comment.