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

Linkingbelt refactoring #5213

Merged
merged 10 commits into from
May 29, 2017
Merged

Conversation

Phyma
Copy link
Contributor

@Phyma Phyma commented May 27, 2017

Removed redundant code fnc_canLinkBelt now returns a value over 0 if success and -1 if error.
This is so there is no equal code in canLinkBelt and startLinkBelt.

Changes to config so it works.

When merged this pull request will:

  • Describe what this pull request will do
  • Each change in a separate line
  • Include documentation if applicable
  • Respect the Development Guidelines

Phyma added 5 commits May 26, 2017 23:17
startLinking belt now uses canLinkBelt so if condition needs to be changed then you can do it on one position.
Fixed requested change
canLinkBelt now returns a value over 0 if success and -1 if something is not right.
Fixed bug where if error we would not exit
@Phyma Phyma mentioned this pull request May 27, 2017
Copy link
Member

@kymckay kymckay left a comment

Choose a reason for hiding this comment

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

I would probably be inclined to rename the canLinkBelt function since its purpose has changed to returning the max ammo

@@ -6,7 +6,7 @@ class CfgVehicles {
class GVAR(LinkBelt) {
displayName = CSTRING(LinkBelt);
distance = 2.0;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canLinkBelt));
condition = QUOTE(([ARR_2(_player, _target)] call FUNC(canLinkBelt) > 0));
Copy link
Member

Choose a reason for hiding this comment

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

Is this meant to be:
QUOTE(([ARR_2(_player, _target)] call FUNC(canLinkBelt)) > 0)

Otherwise the extra set of brackets aren't doing anything 😛

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Woops little to fast maybe.
Was thinking about it but it was to far of a leap 😛
Fnc_maxAmmiLinkBelt? Help me.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe getAmmoToLink?

Phyma added 2 commits May 28, 2017 08:56
Changed name to better reflect the function of the function.
@Phyma
Copy link
Contributor Author

Phyma commented May 28, 2017

Fixed!

jonpas
jonpas previously requested changes May 28, 2017
* Check if the target has an MG equiped with belt system that the player can link
*
* Arguments:
* 0: Player <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* Can link belt<BOOL>
* MaxAmmo magazine <INT>
Copy link
Member

Choose a reason for hiding this comment

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

Maximum ammo of magazine (-1 on error)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Thank you!

fixed return value info
Copy link
Contributor Author

@Phyma Phyma left a comment

Choose a reason for hiding this comment

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

Fixed jonpas comment

@PabstMirror PabstMirror added the kind/cleanup Release Notes: **CHANGED:** label May 29, 2017
@PabstMirror PabstMirror added this to the 3.10.0 milestone May 29, 2017
@PabstMirror PabstMirror changed the base branch from master to release May 29, 2017 18:36
@PabstMirror PabstMirror changed the base branch from release to master May 29, 2017 18:36
@PabstMirror PabstMirror merged commit 95ade30 into acemod:master May 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Release Notes: **CHANGED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants