Skip to content

Fix the player getting a free turn when automatically eating food when starving - #798

Merged
tmewett merged 1 commit into
tmewett:masterfrom
nstoddard:force-eat-food-bug
Jun 27, 2026
Merged

tmewett merged 1 commit into
tmewett:masterfrom
nstoddard:force-eat-food-bug

Conversation

@nstoddard

Copy link
Copy Markdown
Collaborator

Previously, automatically eating food when starving would not only eat the food without using a turn, it would give the player a free turn afterwards.

In addition, becoming hungry/weak/etc no longer consumes an extra turn of food. This simplifies the code and should have minimal effect on gameplay.

@brturn brturn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor comments. Looks good.

Comment thread src/brogue/Time.c Resolved
Comment thread src/brogue/Time.c
rogue.flareCount = 0;
}

if (player.status[STATUS_NUTRITION] <= 1) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I like this location better for the forced turn. Slightly concerned that the separation between food decrement and forced-eating could allow a non-local exit condition to skip the forced turn. Haven’t traced it but might be worth another look.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I will defer to nstoddard on this - just let me know when you want to merge

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

From reading the code, it looks like the only times this function returns early are when the player dies, and when the player falls down a chasm. Skipping this check in the first case is obviously fine, and in the second case, I think it's fine for the forced turn to be delayed by a turn (it'll be really rare anyway, and I don't see how it could be exploited).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Agreed, and the check will land the next turn anyway. (I can see the rogue getting a little preoccupied by falling through a chasm and not wanting to eat food at the same time)

…n starving

Previously, automatically eating food when starving would not only eat the food without using a turn, it would give the player a free turn afterwards.

In addition, becoming hungry/weak/etc no longer consumes an extra turn of food. This simplifies the code and should have minimal effect on gameplay.
@nstoddard
nstoddard force-pushed the force-eat-food-bug branch from 60ada82 to 43c4997 Compare March 8, 2026 23:14
@tmewett
tmewett merged commit 23b79fa into tmewett:master Jun 27, 2026
@nstoddard
nstoddard deleted the force-eat-food-bug branch August 29, 2026 06:03
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.

3 participants