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 helicopters silently failing to ascend #1538

Merged
merged 2 commits into from
May 24, 2022

Conversation

chaosvolt
Copy link
Member

Summary

SUMMARY: Bugfixes "Helicopters now print a message on failing to ascend due to lack of engine power, instead of silent failure"

Purpose of change

I'd been wanting to figure out how to fix the annoyance where helicopters would fail silently, with no message, if you tried to ascend but couldn't due to lack of power. It took a lot of rooting through a fairly complex chain of functions, giving up, then working through the opposite direction by figuring out what actually happens internally when you press <, before I finally found how to fix that.

Describe the solution

Updated game::handle_action so that triggering the ACTION_MOVE_UP will check for if you're in the circumstance of a helicopter trying and failing to ascend, and if so print a message to hint at the problem.

Describe alternatives you've considered

Continue going in circles looking at how the vehicle move functions seem to go back and forth until I go insane.

Testing

  1. Compiled and load-tested.
  2. Spawned in a small helicoper, modified it to have enough cargo space to load the back with a bunch of anvils.
  3. Start it up and tried to ascend, observed it failed with an actual message instead of silently.
  4. Ditched the anvil collection, observed it ascended as normal.
  5. Ran affected file through astyle.

Additional context

image

@Coolthulhu Coolthulhu self-assigned this May 14, 2022
@chaosvolt chaosvolt mentioned this pull request May 17, 2022
} else if( veh_ctrl && vp->vehicle().has_part( "ROTOR" ) &&
!vp->vehicle().has_sufficient_rotorlift() ) {
add_msg( m_bad, _( "The rotors struggle to generate enough lift!" ) );
break;
Copy link
Member

Choose a reason for hiding this comment

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

There's a break right after the block, no need for extra one.

@Coolthulhu Coolthulhu merged commit be95e81 into cataclysmbnteam:upload May 24, 2022
@chaosvolt chaosvolt deleted the fix-heli-message branch May 24, 2022 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants