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

Add: Road waypoints #12572

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

JGRennison
Copy link
Contributor

Motivation / Problem

Add road waypoints, and corresponding NewGRF support: action 5 and custom road stops via feature 0x14

Description

Add road waypoint functionality, road waypoint default graphics, custom road waypoint GRF support, road waypoint selection window. Adjust map bit allocations as required.

For testing, the existing GRF on bananas: Road Stops & No Waypoints has waypoints, despite the name. With this PR applied the road waypoint part of this GRF "just works" as expected.

Limitations

For lack of a better choice, road waypoints use the PR_BUILD_STATION_TRUCK and PR_CLEAR_STATION_TRUCK basecost categories. Adding more basecost categories seems unnecessarily disruptive to basecost GRFs/the spec.

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 touches english.txt or translations? Check the guidelines
  • 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, game_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

Copy link
Member

@2TallTyler 2TallTyler left a comment

Choose a reason for hiding this comment

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

I haven't dug deeply or tested this, but I found some things in my first read-through of the code.

src/saveload/afterload.cpp Outdated Show resolved Hide resolved
src/saveload/afterload.cpp Show resolved Hide resolved
src/lang/english.txt Outdated Show resolved Hide resolved
src/station_cmd.cpp Show resolved Hide resolved
src/station_cmd.cpp Outdated Show resolved Hide resolved
@JGRennison JGRennison force-pushed the road-waypoints branch 2 times, most recently from 9087751 to b3408bf Compare April 28, 2024 19:21
Copy link
Contributor

@rubidium42 rubidium42 left a comment

Choose a reason for hiding this comment

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

Looks like the last commit is going to conflict with #12595.

if (ret.Failed()) return ret;
}

/* don't do the check for drive-through road stops when company bankrupts */
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/* don't do the check for drive-through road stops when company bankrupts */
/* Ignore vehicles when the company bankrupts. The road will remain, any vehicles going to the waypoint will be removed. */

src/station_cmd.cpp Show resolved Hide resolved
Comment on lines 4661 to 4664
if (IsDriveThroughStopTile(tile)) {
CommandCost remove_road = CanRemoveRoadWithStop(tile, flags);
if (remove_road.Failed()) return remove_road;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is a copy-paste mistake. Why would road waypoints also be drive through stops?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the condition is redundant here as all road waypoints are drive-through. (Bay waypoints would be a bit useless).
I'll fix this later,

@JGRennison
Copy link
Contributor Author

Looks like the last commit is going to conflict with #12595.

If that is merged first then I'll redo the UI stuff accordingly at some point.

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.

None yet

4 participants