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

Transition nutrition to kcal for good #45720

Closed
Fris0uman opened this issue Nov 29, 2020 · 6 comments · Fixed by #56728
Closed

Transition nutrition to kcal for good #45720

Fris0uman opened this issue Nov 29, 2020 · 6 comments · Fixed by #56728
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style (P4 - Low) Low priority issues: things which are e.g exotic, minor and/or hard to encounter <Suggestion / Discussion> Talk it out before implementing

Comments

@Fris0uman
Copy link
Contributor

Is your feature request related to a problem? Please describe.

void Character::mod_stored_nutr( int nnutr )
{
// nutr is legacy type code, this function simply converts old nutrition to new kcal
mod_stored_kcal( -1 * std::round( nnutr * 2500.0f / ( 12 * 24 ) ) );
}

Internally mod_stored_nutr() converts nutrition number to kcal before apllying the modification, but it means that values used in json, like the cost entry of mutation are still in nutrition instead of kcal it also means that each time the code calls mod_stored_nutr() it has to use nutrition value to avoid conveting twice.

Describe the solution you'd like

Change all json value and internal value to kcal and remvoe the convertion from mod_stored_nutr()

Describe alternatives you've considered

Maybe introduced cal as a unit

Additional context

This is not high priority but I think it will make the code easier to maintain.

@anothersimulacrum anothersimulacrum added (P4 - Low) Low priority issues: things which are e.g exotic, minor and/or hard to encounter [C++] Changes (can be) made in C++. Previously named `Code` labels Nov 29, 2020
@Xaleth
Copy link
Contributor

Xaleth commented Nov 29, 2020

Or not convert to kcal at all and just display calories. Going through around a thousand different foods to change to kcal is imo a bit excessive for something so trivial.

@anothersimulacrum
Copy link
Member

We already use kcal for all our food??

@Fris0uman
Copy link
Contributor Author

Maybe food is in kcal, but from that snippet of code not everything is yet.

@Xaleth
Copy link
Contributor

Xaleth commented Nov 29, 2020

What if you just have kcal and cal as options in the world menu?

Why can't there be both?

@Leland Leland added <Suggestion / Discussion> Talk it out before implementing Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Nov 30, 2020
@KorGgenT
Copy link
Member

i believe there are only a very small number of things that use nutrition, so it should be fairly painless to transition. i don't believe there is a single example of json that's using "nutrition" instead of calories.

@Fris0uman
Copy link
Contributor Author

Any mutation that uses "hunger" as a cost is using nutrition, I don't know how many that is though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style (P4 - Low) Low priority issues: things which are e.g exotic, minor and/or hard to encounter <Suggestion / Discussion> Talk it out before implementing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants