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

Multitile autoremovable objects and terraforming #4133

Closed
DorpsGek opened this issue Sep 20, 2010 · 5 comments
Closed

Multitile autoremovable objects and terraforming #4133

DorpsGek opened this issue Sep 20, 2010 · 5 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

frosch opened the ticket and wrote:

Dealing with multitile objects in commands which affect multiple tiles causes trouble if the object is DC_AUTO removed while processing one of the tiles.

Currently known problems:

  1. Terraforming uses TileTypeProcs to determine the cost for autosloping. So when terraforming under an object multiple tiles add autoslope cost. However if terraforming one of the tiles causes object removal, testrun and execrun will differ, as some tiles will act as grass/water during execrun.
    Note: Ingame terraforming always uses the no-test-levelland. So it is only triggered in scenario editor, or by AIs and such.

  2. Excavating tunnel have a similar issue. Trunk relies on the terraforming command to actually clear the tile, and does only a cleartest during testrun (without cost). That causes autoremovable objects to not get removed, if they survive the autosloping.

Attached diff is a start at 2), but the cost is doubled in some cases. While the doubled cost and doubled town rating can be fixed by adding yet another DC_ flag, it also triggers 1)

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/4133
@DorpsGek
Copy link
Member Author

frosch wrote:

This should work:

  1. Use _cleared_object_areas also during the terraforming command, and then do not call the autoslope tileproc for those tiles.

  2. In CmdTerraformLand(): Run the loop calling terraform_tile_proc twice. Only the results from the second run are used, while the first run only determines the objects which are going to be removed.

  3. When excavating land, clear the tile without masking the DC_EXEC bit before terraforming. The terraforming will notice the removed object via _cleared_object_areas.

  4. When excavating land _cleared_object_areas also needs to mark trees as already removed.


This comment was imported from FlySpray: https://bugs.openttd.org/task/4133#comment8813

@DorpsGek
Copy link
Member Author

Rubidium wrote:

Seems okay, though quite incredibly complex. Maybe lobbying for removal of multi-tile autoremovable objects is easier.


This comment was imported from FlySpray: https://bugs.openttd.org/task/4133#comment8901

@DorpsGek
Copy link
Member Author

DorpsGek commented Nov 3, 2010

Rubidium wrote:

This also seems to cause "broken" savegames, e.g. #4202


This comment was imported from FlySpray: https://bugs.openttd.org/task/4133#comment9019

@DorpsGek
Copy link
Member Author

frosch wrote:

Other interesting corner cases:
- Tunnel start and endtile belong to same object.
- "Watery" objects at tunnelends.


This comment was imported from FlySpray: https://bugs.openttd.org/task/4133#comment9136

@DorpsGek
Copy link
Member Author

frosch closed the ticket.

Reason for closing: Fixed

in r21289


This comment was imported from FlySpray: https://bugs.openttd.org/task/4133

@DorpsGek DorpsGek added Core flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) labels Apr 7, 2018
@DorpsGek DorpsGek mentioned this issue Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant