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

Hunger display is broken again #75162

Open
KHeket opened this issue Jul 22, 2024 · 6 comments
Open

Hunger display is broken again #75162

KHeket opened this issue Jul 22, 2024 · 6 comments
Labels
(S1 - Need confirmation) Report waiting on confirmation of reproducibility

Comments

@KHeket
Copy link
Contributor

KHeket commented Jul 22, 2024

Describe the bug

@RenechCDDA in #74318 fixed food warning, but this cause the display of your hunger to be broken
Before this update, when you are full, you will have the next display
image
So you understand, that your character is full
But after #74318 was merged we have next display
image
And you go from "satisfied" to "engorged"
image

Attach save file

N/A

Steps to reproduce

Download https://github.com/CleverRaven/Cataclysm-DDA/releases/tag/cdda-experimental-2024-06-15-1417
Start game
Spawn apples
Eat and see hunger display working good

Download https://github.com/CleverRaven/Cataclysm-DDA/releases/tag/cdda-experimental-2024-06-15-1717 or the latest experimental https://github.com/CleverRaven/Cataclysm-DDA/releases/tag/cdda-experimental-2024-07-22-0629 (I tested both)
Start game
Spawn apples
Eat and see hunger display does not working good

Expected behavior

Hunger display working right

Screenshots

No response

Versions and configuration

  • OS: Windows
    • OS Version: 10.0.19045.4651 (22H2)
  • Game Version: cdda-experimental-2024-07-22-0629 ee4058b [64-bit]
  • Graphics Version: Tiles
  • Game Language: English [en]
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    Portal Storms Ignore NPCs [personal_portal_storms],
    Slowdown Fungal Growth [no_fungal_growth]
    ]

Additional context

No response

@KHeket KHeket added the (S1 - Need confirmation) Report waiting on confirmation of reproducibility label Jul 22, 2024
@qtquazar
Copy link

Can confirm same behaviour, traceable to same change/experimental.

@KHeket
Copy link
Contributor Author

KHeket commented Oct 6, 2024

@RenechCDDA can you check pls? I pinged you a several times, but dont have any respond

@KHeket
Copy link
Contributor Author

KHeket commented Dec 26, 2024

@RenechCDDA can you answer something? Because the thing was worked fine before changes in your pr, and I pinged you several times in this pr, but have no answer

@IdleSol
Copy link
Contributor

IdleSol commented Dec 26, 2024

I assume the error is in this line:

return ( calorie_deficit && fullness_ratio >= 11.0 / 20.0 ) || ( fullness_ratio >= 3.0 / 4.0 );

It should be:

--  return ( calorie_deficit && fullness_ratio >= 11.0 / 20.0 ) || ( fullness_ratio >= 3.0 / 4.0 );
++  return ( calorie_deficit && fullness_ratio >= 3.0 / 4.0 ) || ( fullness_ratio >= 11.0 / 20.0 );

The second possible candidate:

The second argument of these functions must have a value:

If I understand correctly, this is the volume of what you want to eat. Because then it is added to what you have already eaten and compared to the capacity. And with us, it's always 0ml.

P.S. I don't understand the point of replacing if-then with functions that do the same thing.

@IdleSol
Copy link
Contributor

IdleSol commented Dec 27, 2024

And here's a third candidate for the problem.

Let's take a closer look at what these functions calculate:

return ( calorie_deficit && fullness_ratio >= 1.0 ) || ( fullness_ratio >= 5.0 / 6.0 );

If I understand it correctly, it is written like this:

( calorie_deficit AND fullness_ratio >= 1.0 ) OR ( fullness_ratio >= 5.0 / 6.0 )

But if fullness_ratio >= 5.0 / 6.0 is true, we no longer care what value it takes (calorie_deficit AND fullness_ratio >= 1.0).

But if it is false, then fullness_ratio < 5.0 / 6.0. And therefore less than 1. And the first condition will also be false.

And that brings us to the error in this part:

if( stomach.would_be_engorged_with( *this, 0_ml, calorie_deficit ) ) {
hunger_effect = effect_hunger_engorged;

The effect_hunger_engorged should occur if calorie_deficit = true and fullness_ratio >= 1.0 (in the old version contains >= cap).

We get this effect when fullness_ratio >= 5.0 / 6.0

@IdleSol
Copy link
Contributor

IdleSol commented Dec 27, 2024

I would suggest checking out a fix like this:

return ( calorie_deficit && fullness_ratio >= 1.0 ) || ( fullness_ratio >= 5.0 / 6.0 );

--  return ( calorie_deficit && fullness_ratio >= 1.0 ) || ( fullness_ratio >= 5.0 / 6.0 );
++  return ( !calorie_deficit && fullness_ratio >= 5.0 / 6.0 ) || ( calorie_deficit && fullness_ratio >= 1.0 );

return ( calorie_deficit && fullness_ratio >= 11.0 / 20.0 ) || ( fullness_ratio >= 3.0 / 4.0 );

--  return ( calorie_deficit && fullness_ratio >= 11.0 / 20.0 ) || ( fullness_ratio >= 3.0 / 4.0 );
++  return ( !calorie_deficit && fullness_ratio >= 11.0 / 20.0 ) || ( calorie_deficit && fullness_ratio >= 3.0 / 4.0 ) ;

And it seems like it could be simplified to:

  return ( !calorie_deficit && fullness_ratio >= 5.0 / 6.0 ) || ( fullness_ratio >= 1.0 );
  return ( !calorie_deficit && fullness_ratio >= 11.0 / 20.0 ) || ( fullness_ratio >= 3.0 / 4.0 ) ;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
(S1 - Need confirmation) Report waiting on confirmation of reproducibility
Projects
None yet
Development

No branches or pull requests

3 participants