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

Fix: Stopped ships shouldn't block depots #8578

Merged
merged 1 commit into from Feb 14, 2021

Conversation

@2TallTyler
Copy link
Member

@2TallTyler 2TallTyler commented Jan 15, 2021

Motivation / Problem

Ships are only allowed to leave a depot when there are no visible ships on the depot tile. This prevents every ship in the depot from leaving simultaneously if the player clicks the green flag to start all ships inside the depot.

Previously, if a ship was stopped immediately after leaving the depot while still on the depot tile, it would block any other ships from leaving the depot.

Description

This changes the depot start check to only consider visible ships which are not stopped. Any stopped vehicles will be ignored, the same as hidden ships.

Limitations

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')
src/ship_cmd.cpp Outdated Show resolved Hide resolved
@2TallTyler 2TallTyler force-pushed the 2TallTyler:blocked_ship_depot branch from 7df2592 to 4cbb9b3 Jan 15, 2021
@LC-Zorg
Copy link

@LC-Zorg LC-Zorg commented Jan 15, 2021

I don't know if this is really a problem. Either way, maybe there might be a better solution for providing spacing. I also don't know if my reasoning is correct, but if you replace the limitation of the simultaneous departure of ships by blocking the position (?) with a time block, if possible, it would be good to make the time of the blockade dependent on the speed of the ship that set out and possibly the value that would be defined by newGRF (it is about the length of the ship). As a result, such a solution would provide better spacing between ships. :)

@LordAro
Copy link
Member

@LordAro LordAro commented Jan 16, 2021

You know, I'm inclined to agree. A train, road vehicle or aircraft stopped in front of a depot effectively blocks everything else from exiting, why be inconsistent here?

@2TallTyler
Copy link
Member Author

@2TallTyler 2TallTyler commented Jan 16, 2021

Players expect ships to clip through each other, inconsistent with other vehicles. This is the only situation in which they're blocked, with no explanation to the player.

src/ship_cmd.cpp Outdated Show resolved Hide resolved
Copy link
Member

@michicc michicc left a comment

Ships don't block each other everywhere else. The code comment suggests this is more of a performance optimisation than anything else. As such, not blocking the depot is consistent for other ship behaviour.

@TrueBrain TrueBrain merged commit ce06b03 into OpenTTD:master Feb 14, 2021
10 checks passed
10 checks passed
Check for preview label
Details
Check for preview label
Details
Emscripten
Details
Commit checker
Details
Check preview needs update Check preview needs update
Details
Linux (clang, clang++)
Details
Linux (gcc, g++)
Details
Mac OS (x64, x86_64)
Details
Windows (x86)
Details
Windows (x64)
Details
@2TallTyler 2TallTyler deleted the 2TallTyler:blocked_ship_depot branch Feb 14, 2021
@2TallTyler 2TallTyler restored the 2TallTyler:blocked_ship_depot branch Feb 24, 2021
@2TallTyler 2TallTyler deleted the 2TallTyler:blocked_ship_depot branch Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants