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

Fuel cell bionic weird consumption behavior [Can be solved quickly] #34270

Closed
VoidForge opened this issue Sep 27, 2019 · 3 comments · Fixed by #34280
Closed

Fuel cell bionic weird consumption behavior [Can be solved quickly] #34270

VoidForge opened this issue Sep 27, 2019 · 3 comments · Fixed by #34280

Comments

@VoidForge
Copy link

Describe the bug

All bionics that use fuel (e.g. gasoline fuel cell CBM, blood power generator CBM of Magiclysm) have strange behavior when consuming fuel. After consumption, the amount of fuel stored in CBM equals the available amount of fuel (Character::get_fuel_capacity), which causes indefinite consumption.

Steps To Reproduce

  1. Make a player with gasoline fuel cell CBM and some gasoline, eat the gasoline
  2. Turn on the fuel cell and wait for a few seconds, then switch off it
  3. Eat more gasoline and see all of your precious gasoline lost into the void

Expected behavior

Fuel cell bionics are correctly refueled

Versions and configuration

Build: 9671

Additional context

probably caused by bool player::fuel_bionic_with( item &it ) in consumption.cpp

const bionic_id bio = get_most_efficient_bionic( get_bionic_fueled_with( it ) );
const int loadable = std::min( it.charges, get_fuel_capacity( it.typeId() ) );
const std::string loaded_charge = std::to_string( loadable );
it.charges -= loadable;
set_value( it.typeId(), loaded_charge );// type and amount of fuel
update_fuel_storage( it.typeId() );

Apology

I do not know how to contribute on github, therefore I can't solve this bug on my own. I am not a native speaker and please forgive my poor English.

@VoidForge
Copy link
Author

Save file can be provided on demand

@Fris0uman
Copy link
Contributor

I got it:

    set_value( it.typeId(), loaded_charge );// type and amount of fuel

This overwrite the amount of stored fuel instead of adding to it. I'll push a fix soon.

@VoidForge
Copy link
Author

I got it:

    set_value( it.typeId(), loaded_charge );// type and amount of fuel

This overwrite the amount of stored fuel instead of adding to it. I'll push a fix soon.

Thanks a lot!

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 a pull request may close this issue.

2 participants