-
Notifications
You must be signed in to change notification settings - Fork 738
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
Linking belt refactoring #5206
Linking belt refactoring #5206
Conversation
startLinking belt now uses canLinkBelt so if condition needs to be changed then you can do it on one position.
|
||
// Exit if the belt is full or empty | ||
if ((_ammoCount == 0) || (getNumber (_magazineCfg >> "count") - _ammoCount) == 0) exitWith {false}; | ||
if(!_canLink) exitWith{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space before (
and {
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed thanks for input :)
Fixed requested change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, apparently I didn't press "submit" on this review. 😟
|
||
// Exit if the belt is full or empty | ||
if ((_ammoCount == 0) || (getNumber (_magazineCfg >> "count") - _ammoCount) == 0) exitWith {false}; | ||
if ( !_canLink ) exitWith {} ; | ||
|
||
// Check if the player has any of the same same magazines | ||
// Calculate max ammo it can link |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section below is already included in FUNC(canLinkBelt)
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okey but I wanted to keep that FUNC(canLinkBelt) returned a bool and not a number.
So thats why i kept the lower part in both cases. But I could redo both of the files to keep them 100% unique?
Just say the word nad ill do it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be a good idea to cut down on duplicate code if nothing else. As long as it doesn't make it more complicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
// Exit if the belt is full or empty | ||
if ((_ammoCount == 0) || (getNumber (_magazineCfg >> "count") - _ammoCount) == 0) exitWith {false}; | ||
if ( !_canLink ) exitWith {} ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!_canLink) exitWith {};
would be per our coding guidelines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okey!
startLinkingbelt now uses canLinkBelt so if condition needs to be changed then you can do it on one position.
Nothing will change with this, only easier to edit condition in the future.
First time edit so please point out malpractice.
When merged this pull request will: