Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: change foreach for select{} #89

Merged
merged 9 commits into from
Feb 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions =BTC=co@22_Hearts_and_Minds.Altis/core/fnc/common/getHouses.sqf

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,36 @@
btc_version = 1.13; diag_log format ["=BTC= HEARTS AND MINDS VERSION %1",btc_version];

//Param
btc_p_time = (paramsArray select 0);
_p_en = (paramsArray select 1);
btc_p_ied = (paramsArray select 2);
_hideout_n = (paramsArray select 3);
_cache_info_def = (paramsArray select 4);
_cache_info_ratio = (paramsArray select 5);
_info_chance = (paramsArray select 6);
_p_rep = (paramsArray select 7);
btc_p_redeploy = if ((paramsArray select 8) isEqualTo 0) then {false} else {true};
btc_p_set_skill = if ((paramsArray select 9) isEqualTo 0) then {false} else {true};
btc_p_time = (paramsArray select 0);
btc_p_acctime = (paramsArray select 1);
_p_db = if ((paramsArray select 2) isEqualTo 0) then {false} else {true};
_p_en = (paramsArray select 3);
btc_p_ied = (paramsArray select 4);
btc_p_engineer = (paramsArray select 5);
_hideout_n = (paramsArray select 6);
_cache_info_def = (paramsArray select 7);
_cache_info_ratio = (paramsArray select 8);
_info_chance = (paramsArray select 9);
_p_rep = (paramsArray select 10);
btc_p_redeploy = if ((paramsArray select 11) isEqualTo 0) then {false} else {true};
ace_medical_level = paramsArray select 12;
ace_medical_enableAdvancedWounds = if ((paramsArray select 13) isEqualTo 0) then {false} else {true};
ace_medical_maxReviveTime = paramsArray select 14;
btc_p_set_skill = if ((paramsArray select 15) isEqualTo 0) then {false} else {true};
_p_skill = [
(paramsArray select 10)/10,//general
(paramsArray select 11)/10,//aimingAccuracy
(paramsArray select 12)/10,//aimingShake
(paramsArray select 13)/10,//aimingSpeed
(paramsArray select 14)/10,//endurance
(paramsArray select 15)/10,//spotDistance
(paramsArray select 16)/10,//spotTime
(paramsArray select 17)/10,//courage
(paramsArray select 18)/10,//reloadSpeed
(paramsArray select 19)/10//commanding
(paramsArray select 16)/10,//general
(paramsArray select 17)/10,//aimingAccuracy
(paramsArray select 18)/10,//aimingShake
(paramsArray select 19)/10,//aimingSpeed
(paramsArray select 20)/10,//endurance
(paramsArray select 21)/10,//spotDistance
(paramsArray select 22)/10,//spotTime
(paramsArray select 23)/10,//courage
(paramsArray select 24)/10,//reloadSpeed
(paramsArray select 25)/10//commanding
];
btc_p_debug = (paramsArray select 20);
btc_p_engineer = (paramsArray select 21);
_p_db = if ((paramsArray select 22) isEqualTo 0) then {false} else {true};
ace_medical_level = paramsArray select 23;
ace_medical_enableAdvancedWounds = if ((paramsArray select 24) isEqualTo 0) then {false} else {true};
ace_medical_maxReviveTime = paramsArray select 25;
btc_p_debug = (paramsArray select 26);
//MED
if (ace_medical_maxReviveTime > 0) then {ace_medical_enableRevive = 1;ace_medical_preventInstaDeath = true};
ace_medical_enableFor = 1;
//btc_acre_mod = isClass(configFile >> "cfgPatches" >> "acre_main");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,179 +6,186 @@ class Params {
texts[]={"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24"};
default = 12;
};
class btc_p_en {
class btc_p_acctime {
//paramsArray[1]
title = "Acceleration time multiplier:";
values[]={1,2,3,4,5,6,7,8,9,10,11,12};
texts[]={"1","2","3","4","5","6","7","8","9","10","11","12"};
default = 5;
};
class btc_p_load {
//paramsArray[2]
title = "Load the savegame (if available)";
values[]={0,1};
texts[]={"No","Yes"};
default = 1;
};
class btc_p_en {
//paramsArray[3]
title = "Enemy type:";
values[]={0,1,2,3};
texts[]={"Guerrilla (A3)","CAF","AAF (A3)","RHS Insurgents"};
default = 0;
};
class btc_p_ied {
//paramsArray[2]
//paramsArray[4]
title = "IEDs ratio:";
values[]={0, 0.5, 1, 1.5};
texts[]={"Off","Low","Normal","High"};
default = 1;
};
class btc_p_engineer {
//paramsArray[5]
title = "Everybody can disarm IED with the same chances:";
values[]={0,1};
texts[]={"No","Yes"};
default = 0;
};
class btc_p_hideout_n {
//paramsArray[3]
//paramsArray[6]
title = "Hideout numbers:";
values[]={99,1,2,3,4,5};
texts[]={"Random","1","2","3","4","5"};
default = 3;
default = 5;
};
class btc_p_cache_info_def {
//paramsArray[4]
//paramsArray[7]
title = "Info cache distance:";
values[]={500,1000,1500,2000,2500,3000,3500,4000,5000};
texts[]={"500 m","1000 m","1500 m","2000 m","2500 m","3000 m","3500 m","4000 m","5000 m"};
default = 1000;
};
class btc_p_cache_info_ratio {
//paramsArray[5]
//paramsArray[8]
title = "Cache info ratio:";
values[]={50,100};
texts[]={"50 m","100 m"};
default = 100;
};
class btc_p_info_chance {
//paramsArray[6]
//paramsArray[9]
title = "Intel from dead bodies chance:";
values[]={0,10,20,30,40,50,60,70,80,90,100};
texts[]={"100 %","90 %","80 %","70 %","60 %","50 %","40 %","30 %","20 %","10 %","0 %"};
default = 70;
};
class btc_p_rep {
//paramsArray[7]
//paramsArray[10]
title = "Reputation at start:";
values[]={0, 200, 500, 750};
texts[]={"Very Low","Low","Normal","High"};
default = 200;
};
class btc_p_redeploy {
//paramsArray[8]
//paramsArray[11]
title = "Allow re-deploy?";
values[]={0,1};
texts[]={"No","Yes"};
default = 1;
};
class btc_p_med_level {
//paramsArray[12]
title = "Medical Level";
values[] = {1,2};
texts[] = {"Basic","Advanced"};
default = 1;
};
class btc_p_adv_wounds {
//paramsArray[13]
title = "Advanced Wounds";
values[] = {0,1};
texts[] = {"Off","On"};
default = 1;
};
class btc_p_rev {
//paramsArray[14]
title = "Revive time:";
values[]={0,60,120,180,240,300,600,900,1200,999999};
texts[]={"0","60","120","180","240","300","600","900","1200","999999"};
default = 600;
};
class btc_p_set_skill {
//paramsArray[9]
//paramsArray[15]
title = "Set skill?";
values[]={0,1};
texts[]={"No","Yes"};
default = 1;
};
class btc_p_set_skill_general {
//paramsArray[10]
//paramsArray[16]
title = "Set skill, general";
values[]={0,1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100};
texts[]={"0","0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1","2","3","4","5","6","7","8","9","10"};
default = 0;
};
class btc_p_set_skill_aimingAccuracy {
//paramsArray[11]
//paramsArray[17]
title = "Set skill, aimingAccuracy";
values[]={0,1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100};
texts[]={"0","0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1","2","3","4","5","6","7","8","9","10"};
default = 1;
};
class btc_p_set_skill_aimingShake {
//paramsArray[12]
//paramsArray[18]
title = "Set skill, aimingShake";
values[]={0,1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100};
texts[]={"0","0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1","2","3","4","5","6","7","8","9","10"};
default = 7;
};
class btc_p_set_skill_aimingSpeed {
//paramsArray[13]
//paramsArray[19]
title = "Set skill, aimingSpeed";
values[]={0,1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100};
texts[]={"0","0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1","2","3","4","5","6","7","8","9","10"};
default = 2;
};
class btc_p_set_skill_endurance {
//paramsArray[14]
//paramsArray[20]
title = "Set skill, endurance";
values[]={0,1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100};
texts[]={"0","0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1","2","3","4","5","6","7","8","9","10"};
default = 7;
};
class btc_p_set_skill_spotDistance {
//paramsArray[15]
//paramsArray[21]
title = "Set skill, spotDistance";
values[]={0,1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100};
texts[]={"0","0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1","2","3","4","5","6","7","8","9","10"};
default = 100;
};
class btc_p_set_skill_spotTime {
//paramsArray[16]
//paramsArray[22]
title = "Set skill, spotTime";
values[]={0,1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100};
texts[]={"0","0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1","2","3","4","5","6","7","8","9","10"};
default = 100;
};
class btc_p_set_skill_courage {
//paramsArray[17]
//paramsArray[23]
title = "Set skill, courage";
values[]={0,1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100};
texts[]={"0","0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1","2","3","4","5","6","7","8","9","10"};
default = 1;
};
class btc_p_set_skill_reloadSpeed {
//paramsArray[18]
//paramsArray[24]
title = "Set skill, reloadSpeed";
values[]={0,1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100};
texts[]={"0","0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1","2","3","4","5","6","7","8","9","10"};
default = 20;
};
class btc_p_set_skill_commanding {
//paramsArray[19]
//paramsArray[25]
title = "Set skill, commanding";
values[]={0,1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100};
texts[]={"0","0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1","2","3","4","5","6","7","8","9","10"};
default = 80;
};
class btc_p_debug {
//paramsArray[20]
//paramsArray[26]
title = "Debug:";
values[]={0,1,2};
texts[]={"No","Yes", "Log only"};
default = 0;
};
class btc_p_engineer {
//paramsArray[21]
title = "Everybody can disarm IED with the same chances:";
values[]={0,1};
texts[]={"No","Yes"};
default = 0;
};
class btc_p_load {
//paramsArray[22]
title = "Load the savegame (if available)";
values[]={0,1};
texts[]={"No","Yes"};
default = 1;
};
class btc_p_med_level {
//paramsArray[23]
title = "Medical Level";
values[] = {1,2};
texts[] = {"Basic","Advanced"};
default = 1;
};
class btc_p_adv_wounds {
//paramsArray[24]
title = "Advanced Wounds";
values[] = {0,1};
texts[] = {"Off","On"};
default = 1;
};
class btc_p_rev {
//paramsArray[25]
title = "Revive time:";
values[]={0,60,120,180,240,300,600,900,1200,999999};
texts[]={"0","60","120","180","240","300","600","900","1200","999999"};
default = 600;
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ private ["_useful","_house","_id","_city","_xx","_y","_pos","_houses","_house"];

if (count btc_hideouts == 0) exitWith {};

_useful = [];
_house = objNull;
{if (_x getVariable ["occupied",false] && {_x getVariable ["type",""] != "NameLocal"} && {_x getVariable ["type",""] != "Hill"} && {_x getVariable ["type",""] != "NameMarine"}) then {_useful = _useful + [_x];};} foreach btc_city_all;
_useful = btc_city_all select {(_x getVariable ["occupied",false] && {_x getVariable ["type",""] != "NameLocal"} && {_x getVariable ["type",""] != "Hill"} && {_x getVariable ["type",""] != "NameMarine"})};

if (count _useful == 0) then {_useful = btc_city_all;};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ if ({_x distance _city < (_area/2) || _x distance leader _group < (_area/2)} cou
{deleteVehicle _x;} foreach units _group;deleteGroup _group;
};

_cities = [];
{if (((_x distance _city < _area) && !_iswater && {_x getVariable ["type",""] != "NameMarine"}) || ((_x distance _city < _area*2) && _iswater && {_x getVariable ["type",""] == "NameMarine"})) then {
_cities = _cities + [_x];
};} foreach btc_city_all;
_cities = btc_city_all select {(((_x distance _city < _area) && !_iswater && {_x getVariable ["type",""] != "NameMarine"}) || ((_x distance _city < _area*2) && _iswater && {_x getVariable ["type",""] == "NameMarine"}))};

_pos = [];
if (count _cities == 0) then {_pos = getPos _city;} else {
_pos = getPos (_cities select (floor random count _cities));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@

private ["_city","_area","_cities","_useful","_unit_type","_veh_type","_group","_veh","_iswater"];
private ["_city","_area","_cities","_useful","_unit_type","_veh_type","_group","_veh","_iswater","_pos"];

_city = _this select 0;
_area = _this select 1;

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

_cities = [];
{if (_x distance _city < _area) then {_cities = _cities + [_x];};} foreach btc_city_all;
_useful = [];
{
if !(_x getVariable ["active",false]) then {_useful = _useful + [getPos _x];};
} foreach _cities;

if (count _useful == 0) then {
while {count _useful == 0} do {
_cities = btc_city_all select {(_x distance _city < _area)};
_useful = _cities select {!(_x getVariable ["active",false])};
if (_useful isEqualTo []) then {
while {_useful isEqualTo []} do {
private "_pos";
_pos = [getPos _city, _area, true] call btc_fnc_randomize_pos;
if ({_x distance _pos < 500} count playableUnits == 0) then {_useful = _useful + [_pos];};
if ({_x distance _pos < 500} count playableUnits == 0) then {_useful pushBack _pos;};
};
_pos = selectRandom _useful;
} else {
_pos = getpos(_useful select (floor random count _useful));
};

_pos = _useful select (floor random count _useful);

_unit_type = btc_civ_type_units select (floor random count btc_civ_type_units);
_veh_type = btc_civ_type_veh select (floor (random (count btc_civ_type_veh)));

Expand All @@ -34,7 +30,7 @@ _group setVariable ["city",_city];

_Spos = [];
if (count (_pos nearRoads 100) > 0) then {
_Spos = getPos ((_pos nearRoads 500) select 0)
_Spos = getPos ((_pos nearRoads 500) select 0);
} else {
_Spos = [_pos, 0, 500, 13, 1, 60 * (pi / 180), 0] call BIS_fnc_findSafePos;
};
Expand Down
Loading