convert magic numbers into macros, simplify a waitAndExecute

This commit is contained in:
commy2 2016-09-19 12:27:02 +02:00
parent d86ceef484
commit bc3260c8fc
2 changed files with 5 additions and 5 deletions

View File

@ -13,15 +13,12 @@ if (isServer) then {
[QGVAR(bloodDropCreated), {
params ["_bloodDrop"];
GVAR(bloodDrops) pushBack _bloodDrop;
if (count GVAR(bloodDrops) >= 500) then {
if (count GVAR(bloodDrops) >= MAX_BLOOD_OBJECTS) then {
private _deletedBloodDrop = GVAR(bloodDrops) deleteAt 0;
deleteVehicle _deletedBloodDrop;
};
[{
params ["_bloodDrop"];
deleteVehicle _bloodDrop;
}, [_bloodDrop], 900] call CBA_fnc_waitAndExecute;
[{deleteVehicle _this}, _bloodDrop, BLOOD_OBJECT_LIFETIME] call CBA_fnc_waitAndExecute;
}] call CBA_fnc_addEventHandler;
};

View File

@ -16,3 +16,6 @@
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#define MAX_BLOOD_OBJECTS 500
#define BLOOD_OBJECT_LIFETIME 900