-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
game: refactor handle_liquids() #24684
game: refactor handle_liquids() #24684
Conversation
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.
Compiled and tested successfully. Tried milking cows, siphoning gas from vehicle and messing around with standing tanks/kegs. Did not review code.
The only issue I observed is this:
The filling a keg
and creating a an activity
aren't present in current experimentals. I'm assuming this is temporarily intended?
src/game.cpp
Outdated
break; | ||
case LD_KEG: | ||
case LD_GROUND: | ||
add_msg( "filling a %s", target.dest_opt == LD_KEG ? "keg" : "ground" ); |
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 intended to remain, filling
would need capitalization.
src/game.cpp
Outdated
case LD_GROUND: | ||
add_msg( "filling a %s", target.dest_opt == LD_KEG ? "keg" : "ground" ); | ||
if( create_activity() ) { | ||
add_msg( "created a an activity" ); |
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 this is intended to remain, will need a new context as it is a bit abrupt and strange.
0a63e92
to
0c9a884
Compare
split the logic of handle_liquids() into two functions: * get_liquid_target() handles the menu items to get the target of the liquid transfer and populated a liquid_dest_opt structure * perform_liquid_transfer() handles transfering liquids from the source to the target, according to the liquid_dest_opt structure handle_liquids() is now a wrapper for the new functions. in the future, this will make it easier to write activity handlers that need special cases for handling liquid transfers, because they can call get_liquid_target() without commiting to perform_liquid_transfer(). I intend to use this functionality in a future PR that will turn milking into a player_activity.
0c9a884
to
2161474
Compare
Cleaned up the merge issue. |
split the logic of handle_liquids() into two functions:
the liquid transfer and populated a liquid_dest_opt structure
source to the target, according to the liquid_dest_opt structure
handle_liquids() is now a wrapper for the new functions.
in the future, this will make it easier to write activity handlers
that need special cases for handling liquid transfers, because
they can call get_liquid_target() without commiting to
perform_liquid_transfer(). I intend to use this functionality in
a future PR that will turn milking into a player_activity.
Fixes #24679