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

Wrong flag used in PeepProblemWarningsUpdate() to determine if hungry guest counts for warnings #21291

Closed
zzril opened this issue Jan 28, 2024 · 1 comment · Fixed by #21293
Closed
Labels
bug Something went wrong. original bug This was an issue in the original game already.

Comments

@zzril
Copy link
Contributor

zzril commented Jan 28, 2024

Operating System

Linux

OpenRCT2 build

8dd5014

Base game

RollerCoaster Tycoon 2

Area(s) with this issue?

This is a development issue

Describe the issue

PeepProblemWarningsUpdate() in src/openrct2/entity/Peep.cpp is responsible for counting guests with specific thoughts and creating in-game news messages / warnings accordingly.

Concerning the I'm thirsty thought, guests that are currently heading for a drinks stall are discarded for this purpose.
Similarly, guests that are currently heading for a toilet are not counted for the warning about guests not finding toilets.

However, for guests that have the I'm hungry thought, all those are discarded that are currently heading for any flat ride:

        switch (peep->Thoughts[0].type)
        {
// [...]
            case PeepThoughtType::Hungry: // 0x14
                if (peep->GuestHeadingToRideId.IsNull())
                {
                    hungerCounter++;
                    break;
                }
                ride = GetRide(peep->GuestHeadingToRideId);
                if (ride != nullptr && !ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE))
                    hungerCounter++;
                break;

            case PeepThoughtType::Thirsty:
                if (peep->GuestHeadingToRideId.IsNull())
                {
                    thirstCounter++;
                    break;
                }
                ride = GetRide(peep->GuestHeadingToRideId);
                if (ride != nullptr && !ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_SELLS_DRINKS))
                    thirstCounter++;
                break;

            case PeepThoughtType::Toilet:
                if (peep->GuestHeadingToRideId.IsNull())
                {
                    toiletCounter++;
                    break;
                }
                ride = GetRide(peep->GuestHeadingToRideId);
                if (ride != nullptr && !ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_TOILET))
                    toiletCounter++;
                break;

There exists a flag RIDE_TYPE_FLAG_SELLS_FOOD, so it seems that that one should be used instead.

Not sure if this was an original bug or a mistake during reverse engineering.
The last commit that changed the name of the flag used in the specific line was d5bf01e22cfa56c29cb2f07136dcb1765fc7ee41, labelled refactor ride type flags.

Steps to reproduce

Check out the above code.

Attachments

No response

@zzril zzril added the bug Something went wrong. label Jan 28, 2024
@ZehMatt ZehMatt added the original bug This was an issue in the original game already. label Jan 28, 2024
@ZehMatt
Copy link
Member

ZehMatt commented Jan 28, 2024

It is actually a bug/oversight in the original,
image

Gymnasiast pushed a commit that referenced this issue Jan 28, 2024
In `PeepProblemWarningsUpdate()`, when determining the number of hungry guests that need help (in order to check whether the threshold for showing the warning about hungry guests is reached), guests that are heading towards any flat ride (checked using the `RIDE_TYPE_FLAG_FLAT_RIDE` on the ride the guest is heading to (if any)) are discarded.  
For thirsty guests (and those needing to go to the toilet) on the other hand, the more specific `RIDE_TYPE_FLAG_SELLS_DRINKS` (or `RIDE_TYPE_FLAG_IS_TOILET`) is used. (So, a guest that becomes thirsty while on its way to the merry-go-round would count for the threshold here.)

This PR makes the function use the more specific `RIDE_TYPE_FLAG_SELLS_FOOD` for hungry guests, so it's consistent with the other cases.
janisozaur added a commit that referenced this issue Feb 4, 2024
- Feature: [#21062] [Plugin] Add API for managing a guest's items.
- Improved: [#18632, #21306] Land ownership and construction rights are now shown on top of the water.
- Improved: [#20951] Activate OpenRCT2 window after using native file dialog on macOS.
- Improved: [#21184] The construction marker for rides, paths and large scenery is now shown on top of the water.
- Improved: [#21192] Tooltips will now follow the cursor.
- Improved: [#21227] Entrance style dropdown is now sorted alphabetically everywhere.
- Change: [#21200] Raise maximum lift speeds of the Reverser Coaster, Side Friction Coaster, and Virginia Reel for RCT1 parity.
- Change: [#21225] Raise maximum allowed misc entities to 1600.
- Fix: [#19494] RCT1 fence gate walls not imported properly if they were placed on slopes.
- Fix: [#20196] New scenarios start with an incorrect temperature.
- Fix: [#20255] Images from the last hovered-over coaster in the object selection are not freed.
- Fix: [#20616] Confirmation button in the track designer’s quit prompt has the wrong text.
- Fix: [#20628] Moving caret using Ctrl+left can move too far when using a multibyte grapheme.
- Fix: [#20631] IME window not positioned correctly.
- Fix: [#20845] Trying to save under a folder with no write permissions causes a crash.
- Fix: [#21054] “No entrance” style is selected by default in the track designer.
- Fix: [#21145] [Plugin] setInterval/setTimeout handle conflict.
- Fix: [#21157] [Plugin] Widgets do not redraw correctly when updating disabled or visibility state.
- Fix: [#21158] [Plugin] Potential crash using setInterval/setTimeout within the callback.
- Fix: [#21171] [Plugin] Crash creating entities with no more entity slots available.
- Fix: [#21178] Inca Lost City’s scenario description incorrectly states there are height restrictions.
- Fix: [#21179] Additional missing land/construction rights tiles in Inca Lost City & Renovation.
- Fix: [#21198] [Plugin] Setting brake or booster speeds on a tile element doesn’t work.
- Fix: [#21290] Sound keeps playing when paused from fast-forward mode.
- Fix: [#21291] Hungry guests heading to any flat ride do not count for warning threshold (original bug).
- Fix: [#21309] Africa - Oasis & Blackpool Pleasure Beach’s monorails are built outside the park’s land rights.
- Fix: [#21316] Isolated land for sale tile on Extreme Hawaiian Island.
CorySanin added a commit to CorySanin/OpenRCT2 that referenced this issue Feb 4, 2024
Release v0.4.8

- Feature: [OpenRCT2#21062] [Plugin] Add API for managing a guest's items.
- Improved: [OpenRCT2#18632, OpenRCT2#21306] Land ownership and construction rights are now shown on top of the water.
- Improved: [OpenRCT2#20951] Activate OpenRCT2 window after using native file dialog on macOS.
- Improved: [OpenRCT2#21184] The construction marker for rides, paths and large scenery is now shown on top of the water.
- Improved: [OpenRCT2#21192] Tooltips will now follow the cursor.
- Improved: [OpenRCT2#21227] Entrance style dropdown is now sorted alphabetically everywhere.
- Change: [OpenRCT2#21200] Raise maximum lift speeds of the Reverser Coaster, Side Friction Coaster, and Virginia Reel for RCT1 parity.
- Change: [OpenRCT2#21225] Raise maximum allowed misc entities to 1600.
- Fix: [OpenRCT2#19494] RCT1 fence gate walls not imported properly if they were placed on slopes.
- Fix: [OpenRCT2#20196] New scenarios start with an incorrect temperature.
- Fix: [OpenRCT2#20255] Images from the last hovered-over coaster in the object selection are not freed.
- Fix: [OpenRCT2#20616] Confirmation button in the track designer’s quit prompt has the wrong text.
- Fix: [OpenRCT2#20628] Moving caret using Ctrl+left can move too far when using a multibyte grapheme.
- Fix: [OpenRCT2#20631] IME window not positioned correctly.
- Fix: [OpenRCT2#20845] Trying to save under a folder with no write permissions causes a crash.
- Fix: [OpenRCT2#21054] “No entrance" style is selected by default in the track designer.
- Fix: [OpenRCT2#21145] [Plugin] setInterval/setTimeout handle conflict.
- Fix: [OpenRCT2#21157] [Plugin] Widgets do not redraw correctly when updating disabled or visibility state.
- Fix: [OpenRCT2#21158] [Plugin] Potential crash using setInterval/setTimeout within the callback.
- Fix: [OpenRCT2#21171] [Plugin] Crash creating entities with no more entity slots available.
- Fix: [OpenRCT2#21178] Inca Lost City’s scenario description incorrectly states there are height restrictions.
- Fix: [OpenRCT2#21179] Additional missing land/construction rights tiles in Inca Lost City & Renovation.
- Fix: [OpenRCT2#21198] [Plugin] Setting brake or booster speeds on a tile element doesn’t work.
- Fix: [OpenRCT2#21290] Sound keeps playing when paused from fast-forward mode.
- Fix: [OpenRCT2#21291] Hungry guests heading to any flat ride do not count for warning threshold (original bug).
- Fix: [OpenRCT2#21309] Africa - Oasis & Blackpool Pleasure Beach’s monorails are built outside the park’s land rights.
- Fix: [OpenRCT2#21316] Isolated land for sale tile on Extreme Hawaiian Island.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something went wrong. original bug This was an issue in the original game already.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants