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

Fix refuel PFH not exiting on nozzle disconnect #3018

Merged
merged 4 commits into from
Feb 4, 2016
Merged

Fix refuel PFH not exiting on nozzle disconnect #3018

merged 4 commits into from
Feb 4, 2016

Conversation

jonpas
Copy link
Member

@jonpas jonpas commented Dec 11, 2015

Fixes #3009

@jokoho48 jokoho48 added the kind/bug-fix Release Notes: **FIXED:** label Dec 11, 2015
@jokoho48 jokoho48 added this to the 3.4.2 milestone Dec 11, 2015
@jokoho48
Copy link
Member

👍 look good from my side
@GitHawk

@@ -29,6 +29,10 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f
params ["_args", "_pfID"];
_args params ["_source", "_sink", "_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel", "_connectFromPoint", "_connectToPoint"];

if (_nozzle getVariable [QGVAR(isConnected), false]) exitWith {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nozzle gets deleted by fnc_returnNozzle. So I'd rather check if _source is still connected.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it's necessary, this PFH only starts when you attach the nozzle to some vehicle, and with this line it will remove the PFH when you disconnect it from the vehicle. That is before returning the nozzle, PFH will not exist when returning it anymore.

Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this line need a ! ? If the nozzle is deleted the getVariable will always default to false.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, your code doesn't reflect what you are saying. This PFH has to run while the _nozzle is connected.

QGVAR(isConnected) is set to true for _nozzle in fnc_connectNozzleAction which is calling fnc_refuel. So you would add the PFH and remove it next time it executes.

So either negate your condition,
or query QGVAR(sink) on _nozzle which is also set here but gets cleared on disconnecting

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah yes, that is my bad, forgot a !, fixing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks better

@thojkooi thojkooi modified the milestones: 3.4.2, 3.5.0 Jan 6, 2016
thojkooi added a commit that referenced this pull request Feb 4, 2016
Fix refuel PFH not exiting on nozzle disconnect
@thojkooi thojkooi merged commit 3e5908f into acemod:release Feb 4, 2016
@jonpas jonpas deleted the fixFuelHoseExceededAfterDisconnect branch February 4, 2016 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug-fix Release Notes: **FIXED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants