Skip to content

Conversation

@entrez
Copy link
Contributor

@entrez entrez commented Jan 19, 2022

Sometimes the hero will find a plastic baby inside a piece of king cake,
just like in real life.

In order to make this apply to 'real' king cake created during Mardi
Gras, and not to user-defined fruit with an identical name, change
holiday fruits to use a negative fruit ID as their spe. To enable this,
add a new macro, fruit_id() -- which provides the absolute value of
fruit->spe -- and use it in most cases the fruit ID needs to be
accessed.

Negative fruit IDs are already used when saving bones, to mark fruits
which don't exist on the current level and therefore don't need to be
included in the bones file, but those are negative fids in the g.ffruit
linked list, not negative spe on individual items. These changes
shouldn't interfere with that process as long as the possible negative
spe is taken into consideration when saving and loading bones, which it
now should be.

Copy link
Owner

@copperwater copperwater left a comment

Choose a reason for hiding this comment

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

I think this should probably add a function/macro or two to specifically account for holiday fruits rather than encoding a bunch of assumptions about the sign of fid and spe. Such as is_holiday_fruit(otmp) meaning otmp->otyp == SLIME_MOLD && otmp->spe < 0.

@entrez entrez force-pushed the king-cake-feve branch 2 times, most recently from a8228c8 to 2943859 Compare February 4, 2022 21:39
@entrez entrez force-pushed the king-cake-feve branch 3 times, most recently from 5352e03 to 0abcae9 Compare May 12, 2022 02:39
Sometimes the hero will find a plastic baby inside a piece of king cake,
just like in real life.

In order to make this apply to 'real' king cake created during Mardi
Gras, and not to user-defined fruit with an identical name, change
holiday fruits to use a negative fruit ID as their spe. To enable this,
add a new macro, fruit_id() -- which provides the absolute value of
fruit->spe -- and use it in most cases the fruit ID needs to be
accessed.

Negative fruit IDs are already used when saving bones, to mark fruits
which don't exist on the current level and therefore don't need to be
included in the bones file, but those are negative fids in the g.ffruit
linked list, not negative spe on individual items.  These changes
shouldn't interfere with that process as long as the possible negative
spe is taken into consideration when saving and loading bones, which it
now should be.
@entrez entrez marked this pull request as draft June 9, 2023 19:32
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.

2 participants