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
Feature: Add the ability to clone an area with structures #12657
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems well written, though maybe a bit repetitive (I guess that's the point :D)
…gestions from code review Co-authored-by: Peter Nelson <peter@fuzzle.org>
src/clone_area_cmd.cpp
Outdated
if (HasSignalOnTrack(iter_tile, track)) { | ||
SignalType sigtype = GetSignalType(iter_tile, track); | ||
SignalVariant sigvar = GetSignalVariant(iter_tile, track); | ||
CommandCost ret = Command<CMD_BUILD_SINGLE_SIGNAL>::Do(flags, dest_tile, track_dest, sigtype, sigvar, false, false, false, SIGTYPE_BLOCK, SIGTYPE_BLOCK, 0, 0); |
Check notice
Code scanning / CodeQL
Declaration hides variable Note
line 406
src/clone_area_cmd.cpp
Outdated
cost.AddCost(ret); | ||
if (flags & DC_EXEC) { | ||
if (dest_station_id == NEW_STATION) { | ||
StationID dest_station_id = GetStationIndex(dest_tile); |
Check notice
Code scanning / CodeQL
Declaration hides variable Note
line 498
* @param diagonal build diagonally or not. | ||
* @return the cost of this operation or an error | ||
*/ | ||
std::tuple<CommandCost, Money, TileIndex> CmdCloneAreaPasteProperty(DoCommandFlag flags, TileIndex tile, TileIndex area_start, [[maybe_unused]] bool diagonal) |
Check warning
Code scanning / CodeQL
Poorly documented large function Warning
The list of commits looks a bit messy, did you mean to squash it again? Additionally there are a lot of seemingly unrelated changes into table/sprites.h which might be better in a separate PR? |
Motivation / Problem
@StanislavShamrai wants to automate a process by creating a new object using existing logic.
Description
You can build larger paths by simply copying and pasting some of the existing intersections and paths.
You can rotate an area by inserting it at a different angle.
Limitations
This was created for railroad tracks, tunnels, and bridges, but the same behavior may be added for other types of tracks and structures in the future.
Checklist for review
example:
clone-area.webm