FS#2541 - Freeform map edges

Attached to Project: OpenTTD
Opened by Thijs Marinussen (Yexo) - Wednesday, 14 January 2009, 23:49 GMT
Last edited by Thijs Marinussen (Yexo) - Wednesday, 21 January 2009, 02:33 GMT
Type Patch
Category Core
Status Closed
Assigned To Zdeněk Sojka (SmatZ)
Operating System All
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This patch removes the need for the map edges to be water. It introduces a new patch setting that when enabled allows users to terraform and build at the tiles at the edges just as with other tiles. I've also added a new drop down menu in the new game window where you can which edges are generated with water (only available with TerraGenesis).

It works by making the tiles at the north borders MP_VOID tiles, just like the tiles at the south border. The patch setting can be enabled/disabled during a game, but only if the tiles at the north border are empty and at sea level. As long as the patch setting is disabled, the behavior is unchanged from current behavior.

Patch is against r15086. Thanks to SmatZ for fixing several (mostly graphical) problems.
This task depends upon

Closed by  Thijs Marinussen (Yexo)
Wednesday, 21 January 2009, 02:33 GMT
Reason for closing:  Implemented
Additional comments about closing:  In 15190
Comment by Zdeněk Sojka (SmatZ) - Wednesday, 14 January 2009, 23:59 GMT
Hello, while r15080 changed the behaviour, so now it is not possible to terraform southern edges with your patch. (in fact, it can be reverted by your patch)

I get 4 warnings:
src/settings.cpp:1110: warning: unused variable ‘h’
src/settings.cpp:1118: warning: unused variable ‘h’
src/settings.cpp:1126: warning: unused variable ‘h’
src/settings.cpp:1134: warning: unused variable ‘h’

Is any part commitable on its own? So trunk works fine with that change and diff gets smaller :-)

- if (!IsValidTile(tile)) return CMD_ERROR;
+ if (tile != 0 && !IsValidTile(tile) && ((cmd != CMD_LEVEL_LAND && cmd != CMD_TERRAFORM_LAND) || tile >= MapSize())) return CMD_ERROR;
Maybe this is partly a hack, but... hard to say how other commands behave with IsTileType(tile, MP_VOID). But it would be nice to get rid of it...
Comment by Thijs Marinussen (Yexo) - Friday, 16 January 2009, 22:15 GMT
1) Fixed the warnigns in settings.cpp
2) Terraforming the southern edges is possible again
3) Fixed an assert when terraforming the south-east edge in the scenario editor.
4) Changed command.cpp: I've introduced DC_ALL_TILES and CMD_ALL_TILES to indicate a command can be executed on MP_VOID tiles.
5) Some minor changes in the AI api, in AIMap (to allow terraforming map edges by AIs).