Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.

Fortify - Improve deploy handlers check#131

Merged
PabstMirror merged 3 commits intoacemod:masterfrom
mharis001:fortify-deploy-handlers
Aug 1, 2018
Merged

Fortify - Improve deploy handlers check#131
PabstMirror merged 3 commits intoacemod:masterfrom
mharis001:fortify-deploy-handlers

Conversation

@mharis001
Copy link
Member

When merged this pull request will:

  • Improve deploy handlers checking
  • Add check for empty code block or useless code block {true} in addDeployHandler function

GVAR(isPlacing) = PLACE_WAITING;
};
{
if !([_unit, _object, _cost] call _x) exitWith {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could use findIf instead.
if findIf {code} != -1 -> GVAR(isPlacing....

@PabstMirror PabstMirror added this to the 3.4.0 milestone Jul 12, 2018
GVAR(isPlacing) = PLACE_WAITING;
};
// If place approved, verify deploy handlers
if (GVAR(isPlacing) == PLACE_APPROVE && {GVAR(deployHandlers) findIf {!([_unit, _object, _cost] call _x)} > -1}) then {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly more robust way might be to use isEqualTo, but it's probably not needed

x0 = [{true}, {nil}, {5}, {false}]; 
x1 = x0 findIf {!(call _x)};             // nil
x2 = x0 findIf {false isEqualTo call _x} // 3

@PabstMirror PabstMirror merged commit 48cf5ce into acemod:master Aug 1, 2018
@mharis001 mharis001 deleted the fortify-deploy-handlers branch August 6, 2018 23:39
@PabstMirror PabstMirror modified the milestones: 3.4.0, 3.3.1 Aug 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants