Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Sat Dec 15, 2018 10:00 pm

All times are UTC




Post new topic  Reply to topic  [ 122 posts ]  Go to page 1 2 3 4 57 Next
Author Message
PostPosted: Thu Dec 11, 2008 8:38 pm 
Offline
Tycoon
Tycoon

Joined: Thu Dec 20, 2007 12:49 pm
Posts: 3653
The attached patch removes the need for the map edges to be water. You can raise the land / build on it what you want.

No known issues

If you have any suggestions / comments, please let me know.

Latest patch can be downloaded from http://bugs.openttd.org/task/2541

Edit: Fixed a lot of asserts that could happen when you let a train run towards a map edge. Also the map generator is updated so it generates landscapes with land at the borders now. Attached is a screenshot that show how it works and a windows binary.

Changes in r14668_v2:
- Incorporated SmatZ changes to fix the graphical glitch at the southern borders
- Fixed a bug where terragenesis could generate tiles with a height difference of 2 between two neighbouring corners.
- Added a gui option in the map generation window to choose what borders should be water and what borders should be land.
The binary is now v2, the zip still has the same name though.

Changes in r14675_v3:
- When loading a heightmap the border now depends on the heightmap instead of always water.
- Lighthouses are only build near water
- Stations can now be built at tile 0 without errors.
- Loading old (TTD) savegames was broken, now fixed again (thanks SmatZ)

Changes in r14677_v4:
- It was impossible to terraform south-border tiles in the scenario editor
- The white dot drawn when terraforming is now drawn at the correct height for the south-border tiles.

Changes in r14677_v5:
- Lots of bugfixes of bugs reported by Progman, see viewtopic.php?p=751289#p751289 for a complete list.
- Flat tiles at the map edge with height = 0 will get flooded (to prevent maps without any water at all).

Changes in r14577_v6:
- Removed a lot of IsValidTile checks and make GetTileType return MP_VOID for tiles > MapSize()

Changes in r14685_v7:
- Fixed segfault with fences on nw border.

Changes in r14772_v8:
- Tiles at the north edges will be MP_VOID when the patch is enabled.
- Removed lots of IsValidTile calls due to the previous change.
- New patch setting (under construction) to enable/disable terraforming the map edges.
- Known issue: small graphical glitch at the north edges.
- Removed the GetTileType hack introduced in v6.

Changes in r14840_v9:
- Enabling the setting in a running game would fail most of the time.

Changes in r14840_v10:
- Fix the graphical glitch at the north edges (SmatZ)
- A bit of cleanup (removing some unneeded IsValidTile checks)

See viewtopic.php?p=754862#p754862 for the latest patch (some fixes by SmatZ) and a windows/linux binary.
Changes:
- Fix an issue were you couldn't select tiles at the north border if they were raised more than a few height levels.
- Fix a crash if rails tiles went towards an edge of the map (introduced in v10).

Changes in v12:
- MP_VOID tiles could be seen as land for newgrf files (see r14415). (thanks SmatZ)

Changes in v13:
Update to r14905
minor cleanup


Last edited by Yexo on Wed Jan 21, 2009 3:20 am, edited 24 times in total.

Top
   
 Post subject: Re: Freeform map edges
PostPosted: Thu Dec 11, 2008 9:15 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Apr 07, 2008 6:29 pm
Posts: 1872
Location: Czech Republic
Oh, this is great! Going to try it once I have some time. Did you modify the map generator too?


Top
   
 Post subject: Re: Freeform map edges
PostPosted: Thu Dec 11, 2008 9:24 pm 
Offline
Tycoon
Tycoon

Joined: Thu Dec 20, 2007 12:49 pm
Posts: 3653
I've not yet modified the map generator, but I'll definitely do that (if you don't do so first :p)


Top
   
 Post subject: Re: Freeform map edges
PostPosted: Fri Dec 12, 2008 11:57 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Apr 07, 2008 6:29 pm
Posts: 1872
Location: Czech Republic
Yexo wrote:
I've not yet modified the map generator, but I'll definitely do that (if you don't do so first :p)


If you want me to... :P

For TGen it is a little change in tgp.cpp...if I recall it well, all you have to do is commenting one or two function calls in terrain normalization function (it is called normalizeHeightmap or something like that).


Top
   
 Post subject: Re: Freeform map edges
PostPosted: Sat Dec 13, 2008 12:59 am 
Offline
Tycoon
Tycoon

Joined: Thu Dec 20, 2007 12:49 pm
Posts: 3653
Patch updated. I've modified to the map generator, see download/file.php?id=102995

I've attached a windows binary to the first post.


Top
   
 Post subject: Re: Freeform map edges
PostPosted: Sat Dec 13, 2008 11:15 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Apr 07, 2008 6:29 pm
Posts: 1872
Location: Czech Republic
Beautiful. OTTD terrain posibilities are now really leaping forward.

What about adding a select box into the map generator taht would activate this?


Top
   
 Post subject: Re: Freeform map edges
PostPosted: Sat Dec 13, 2008 11:18 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Tue Dec 03, 2002 10:36 am
Posts: 13179
Location: The Netherlands
Very nice, someone finally did it :).

_________________
Image
Dutch Trainset for OpenTTD | Dutch Trainset Topic | Combined Roadset v0.10


Top
   
 Post subject: Re: Freeform map edges
PostPosted: Sat Dec 13, 2008 11:38 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed May 16, 2007 4:59 pm
Posts: 2825
How well bug tested is this? I thought some algorithms required a sea level edge square to prevent wraparound, or is there a special invisible square for this?

_________________
GRVTS/eGRVTS --- Generic Tram Set --- UK Town Set --- zBase ---RichardWheeler.net


Top
   
 Post subject: Re: Freeform map edges
PostPosted: Sat Dec 13, 2008 12:03 pm 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
IIRC on the bottom left and bottom right edges, there's a row of invisible tiles, but not on the top left and top right edge.

_________________
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage


Top
   
 Post subject: Re: Freeform map edges
PostPosted: Sat Dec 13, 2008 12:12 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed May 16, 2007 4:59 pm
Posts: 2825
Ah cool, should be ok then...

_________________
GRVTS/eGRVTS --- Generic Tram Set --- UK Town Set --- zBase ---RichardWheeler.net


Top
   
 Post subject: Re: Freeform map edges
PostPosted: Sat Dec 13, 2008 12:22 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Thu Sep 11, 2008 7:32 am
Posts: 1034
Location: Spain
Yexo wrote:
- You'll get graphical glitches if you raise any tiles at the south-east or south-west edge of the map. If there is anyone with an idea of how to solve this, be my guest. I don't know where to start :(


I have tried the patch with the water edges grf, and it seems that there's a not drawn slope between the map tiles and the usually invisible edge tiles. Here's a screenshot:


Attachments:
Sin nombre, 1 Ene 1960.png [167.75 KiB]
Downloaded 546 times

_________________
Spanish translation of OpenTTD
Extended heightmaps

Have fun, don't quarrel too much and add as many advanced settings as you can.
Top
   
 Post subject: Re: Freeform map edges
PostPosted: Sat Dec 13, 2008 12:29 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Apr 07, 2008 6:29 pm
Posts: 1872
Location: Czech Republic
I'm not really sure what the patch is supposed to do with the grf :)


Top
   
 Post subject: Re: Freeform map edges
PostPosted: Sat Dec 13, 2008 12:30 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Tue Oct 03, 2006 6:26 pm
Posts: 351
Location: Prague, Czech Republic
Hello,

I like this patch :) Though it doesn't compile for me: (gcc 4.3.2, amd64)

Warnings:
Code:
src/ai/default/default.cpp: In function 'void AiStateRemoveStation(Company*)':
src/ai/default/default.cpp:3677: warning: 'tile' may be used uninitialized in this function

src/terraform_cmd.cpp: In function 'CommandCost TerraformTileHeight(TerraformerState*, TileIndex, int)':
src/terraform_cmd.cpp:192: warning: comparison between signed and unsigned integer expressions
src/terraform_cmd.cpp:193: warning: comparison between signed and unsigned integer expressions


Errors:
Code:
src/roadveh_cmd.cpp: In function 'Trackdir RoadFindPathToDest(Vehicle*, TileIndex, DiagDirection)':
src/roadveh_cmd.cpp:1196: error: jump to label 'found_best_track'
src/roadveh_cmd.cpp:1042: error:   from here
src/roadveh_cmd.cpp:1047: error:   crosses initialization of 'TrackdirBits trackdirs'
src/roadveh_cmd.cpp:1046: error:   crosses initialization of 'TrackdirBits red_signals'
src/roadveh_cmd.cpp:1045: error:   crosses initialization of 'TrackStatus ts'


edit: fixing that error is quite easy :)

_________________
Image


Top
   
 Post subject: Re: Freeform map edges
PostPosted: Sat Dec 13, 2008 12:43 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Tue Oct 03, 2006 6:26 pm
Posts: 351
Location: Prague, Czech Republic
Attached patch fixes compilation for me and probably makes those glitches disappear ;)

(maybe a hack, maybe not working. further issue may be not marking border tiles dirty, if this patch doesn't fix all cases )

edit: fixed one case
It doesn't look good when non-black void tiles are used... maybe SPR_SHADOW_CELL could be replaced by different sprite.


Attachments:
edges_r14668_clean.diff [57.08 KiB]
Downloaded 123 times

_________________
Image


Last edited by SmatZ on Sat Dec 13, 2008 2:39 pm, edited 1 time in total.
Top
   
 Post subject: Re: Freeform map edges
PostPosted: Sat Dec 13, 2008 1:48 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Thu Sep 11, 2008 7:32 am
Posts: 1034
Location: Spain
CommanderZ wrote:
I'm not really sure what the patch is supposed to do with the grf :)


I meant that the invisible edge tiles are still at height 0. There's a "cliff" between real map tiles and invisible edge tiles. The space between tiles isn't drawn (even if it was meant to be black) and that's what creates the glitches. I used the grf just to see the height of the invisible tiles.

_________________
Spanish translation of OpenTTD
Extended heightmaps

Have fun, don't quarrel too much and add as many advanced settings as you can.


Top
   
 Post subject: Re: Freeform map edges
PostPosted: Sat Dec 13, 2008 11:15 pm 
Offline
Tycoon
Tycoon

Joined: Thu Dec 20, 2007 12:49 pm
Posts: 3653
Updated the patch, see first post for new diff and changelog. Big thanks to SmatZ for fixing the graphical glitches.

Zephyris wrote:
How well bug tested is this? I thought some algorithms required a sea level edge square to prevent wraparound, or is there a special invisible square for this?

As much as possible :) Only currently known bug is that building a station at tile 0 gives strange results.

Roujin wrote:
IIRC on the bottom left and bottom right edges, there's a row of invisible tiles, but not on the top left and top right edge.

Correct.

Terkhen wrote:
I have tried the patch with the water edges grf, and it seems that there's a not drawn slope between the map tiles and the usually invisible edge tiles. Here's a screenshot:

Where can I find said grf?


Top
   
 Post subject: Re: Freeform map edges
PostPosted: Sat Dec 13, 2008 11:26 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Thu Sep 11, 2008 7:32 am
Posts: 1034
Location: Spain
Here.

I'm going to try the new version right now :D

Edit: I can't compile it with MinGW in windows vista.

Code:
[SRC] Compiling ai/ai.cpp
make[1]: execvp: g++: Invalid argument
make[1]: *** [ai/ai.o] Error 127


I've never seen this error, and I can't find a solution. What can be causing it? :?

_________________
Spanish translation of OpenTTD
Extended heightmaps

Have fun, don't quarrel too much and add as many advanced settings as you can.


Top
   
 Post subject: Re: Freeform map edges
PostPosted: Sun Dec 14, 2008 1:47 pm 
Offline
Chairman
Chairman

Joined: Sat Jan 20, 2007 12:08 pm
Posts: 776
Location: Germany
Terkhen wrote:
Code:
[SRC] Compiling ai/ai.cpp
make[1]: execvp: g++: Invalid argument
make[1]: *** [ai/ai.o] Error 127


I've never seen this error, and I can't find a solution. What can be causing it? :?

That looks as if there is something wrong with your gcc installation rather than with the patch (did you try compiling clean trunk? Probably the same happens). execvp is a function replacing the currently running executable by another one (I'd guess in this case the gcc frontend calling the g++ backend).

_________________
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008


Top
   
 Post subject: Re: Freeform map edges
PostPosted: Sun Dec 14, 2008 3:31 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Thu Sep 11, 2008 7:32 am
Posts: 1034
Location: Spain
Clean trunk compilation runs with no problems at all. The same is true for every other patch I use. I think the error happens with the first file that isn't at the src folder.

_________________
Spanish translation of OpenTTD
Extended heightmaps

Have fun, don't quarrel too much and add as many advanced settings as you can.


Top
   
 Post subject: Re: Freeform map edges
PostPosted: Sun Dec 14, 2008 3:43 pm 
Offline
Tycoon
Tycoon

Joined: Thu Dec 20, 2007 12:49 pm
Posts: 3653
I have no idea what can be causing that error, but my patch doesn't change ai.cpp at all.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 122 posts ]  Go to page 1 2 3 4 57 Next

All times are UTC


Who is online

Users browsing this forum: Diesel Power and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.