Wolf01's hire point - Last addition: sloped stations

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: Wolf01's hire point - Now working: User Configurable Hotkeys

Post by Wolf01 »

Ok, I'm working on a new patch, this time really simple as devs told me :P
It's a WIP of Drag&Drop for buildings roadstops and roadstations
The planned features will be:
- limit the drag for the roadstations, so they will be build on a line, maybe in two lines with the entrances in opposite directions (eg. If I chose NE the entrance of the other line will be SW)
- allow to extend a station adjacent to 2 other stations (the one you can build with CTRL), like it works with trains
- allow the replacement of existent stations, you will be able to replace a bus roadstop/station with a truck roadstop/station if is in the same direction

See the first post for a preview diff
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: Wolf01's hire point - Last addition: drag&drop roadstations

Post by Wolf01 »

I'm here again with one of my weird ideas, sloped stations!!!
More infos, picture and patch on the first post: http://www.tt-forums.net/viewtopic.php?f=32&t=26105
User avatar
StopRightThere
Chief Executive
Chief Executive
Posts: 761
Joined: 18 Dec 2005 20:10
Location: United Kingdom

Re: Wolf01's hire point - Last addition: sloped stations

Post by StopRightThere »

That's really cool, does the track follow the slope?
Bye Bye OpenBVE :(
Official TT-Hot young ginger Doctor Who assistant FanClub
Formerly known as AdditionalData
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: Wolf01's hire point - Last addition: sloped stations

Post by Wolf01 »

If you mean the train, yes
The track currently not because I need to mess up with the drawing code (I think I'll try to do something tomorrow)

Future plans are: make the station leveled when there is nothing at the bottom of the slope, or maybe like roads so if you click near the top of the slope you'll make an horizontal station and if you click near the bottom of the slope you'll make a sloped station
Tomorrow I'll try to add this code for roadstops too and I'll try to fix the behavior on SLOPE_N/W/E/S (the ones with only one corner raised)
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Wolf01's hire point - Last addition: sloped stations

Post by Roujin »

The problem graphics-wise is that you cannot reuse existing graphics. It would need some new graphics drawn and put into openttd(w).grf, that look similar enough to fit with the existing graphics, but are no rip off (for copyright reasons).

A possible solution for this could be if you leave the station like it is (completely on the upper of the two levels), except the track in the middle of the tile, which goes down a ramp, like a normal piece of track going down a hill. Would not look nice nor be realistic, but station newgrfs could still provide nicer sloped platforms. (That's basically like rivers. Without any newgrf they just look like a piece of ocean, you need a newgrf to make them look nice)

Speaking of newgrfs, that's something you maybe didn't think of at all.. I think a proper implementation of sloped stations needs also some considerations regarding newgrfs. e.g. a callback for newgrfs to tell them if a piece of station is on a slope or not.. (well, it may exist already, I've only gotten into newgrf very briefly, so I don't know.. :roll: )
* @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
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Wolf01's hire point - Last addition: sloped stations

Post by DaleStan »

Roujin wrote:I think a proper implementation of sloped stations needs also some considerations regarding newgrfs. e.g. a callback for newgrfs to tell them if a piece of station is on a slope or not.
You've got the information direction backwards there. Callbacks allow the grf to provide information to the host.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Wolf01's hire point - Last addition: sloped stations

Post by Roujin »

Okay, I shoudn't start talking about stuff I don't fully understand. Still I think you have to consider newgrfs for your patch, wolf. A newgrf author should e.g. have control over whether it's allowed to place a station part on a slope or not, and if so, specify a special sprite layout to be drawn on sloped tiles.
* @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
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Wolf01's hire point - Last addition: sloped stations

Post by michael blunck »

Roujin wrote:[...]
I.e., what Dale meant was that TTDPatch already has a mechanism to allow a newgrf checking for land slopes when building stations: https://wiki.ttdpatch.net/tiki-index.php ... _check_149_

Thus, something like this is possible in TTDPatch:

Image

OTOH, having slopes in the same direction as track would require complete new station graphics, not only some "modified" foundation sprites. (If you want to do it in the right way. 8) )

regards
Michael
Image
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: Wolf01's hire point - Last addition: sloped stations

Post by Wolf01 »

Update:
r14988 - v0.2
- Trains and road vehicles now follow the slope
- Is not possible to build road bays facing slope (the vehicle movement code must be rewritten for that or it looks weird)
(download the win32 package from the same link on the first post, or the patch only from here)

I tried to don't draw the foundations under the stations, but doing this they are drawn at the lower level and leave void parts.
Those should be fixed with proper graphics, or at least drawing under the station the sloped track/road instead of the stations leveled tile
I didn't try it with newstations, and it still miss the grf checking for the slope (as MB said)
Attachments
sloped_stations_14988_v02.diff
(5.72 KiB) Downloaded 135 times
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Wolf01's hire point - Last addition: sloped stations

Post by Terkhen »

Now that there is no limit to the amount of road stops at the same station (besides the station spread), a feature for building road stops with drag&drop would be even more useful. Do you plan to update this patch?
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: Wolf01's hire point - Last addition: sloped stations

Post by Wolf01 »

Maybe, I don't have so much spare time to sit in front of my pc and write down code so I keep the idea of this patch for the next vacation time which isn't this Christmas holidays, maybe in the first half of next year... we waited long time for a roadstop improvement, we can wait for another improvement too... or if somebody would like to continue my work I'll feel happy too ;)

EDIT: I think I might give it a look today, to know why see the attached picture

EDIT 2: I updated the patch to r18533 ->
dragdrop_roadstops_18533.diff
(14.63 KiB) Downloaded 145 times
but is impossible to build a road stop.
The game compiles without errors/warnings, the drag&drop code works but there is something I can't understand, maybe in the new code changes and I can't debug right now (I tried with some checks and printing out values but I can't find the problem)
Attachments
DSCN0802.JPG
DSCN0802.JPG (217.08 KiB) Viewed 4222 times
DSCN0811.JPG
DSCN0811.JPG (141.75 KiB) Viewed 4222 times
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Wolf01's hire point - Last addition: sloped stations

Post by Terkhen »

I have been tinkering with the patch and I made the following changes:
  • CommandCost cost variable was redeclared inside the TILE_LOOP; this caused the command to return an error. After solving this, I noticed that only the cost of the last road stop was used. Both issues have been corrected.
  • The addition of CMD_NO_WATER to CMD_BUILD_ROAD_STOP at road_gui.cpp, which also caused an error. CMD_NO_WATER has been removed.
  • The code related to creating or finding a station, and setting related widgets / windows dirty has been taken out of the TILE_LOOP. This is faster and solves an issue where CmdBuildRoadStop did not check station spread properly, resulting in a crash.
  • When trying to join stations, the join station window was always empty.
  • Additionally, I have implemented a new feature; non drive-through stations can only be built as a line corresponding to their axis. I find this useful because building more than a single row of normal stations together is not useful at all.
This patch implements all of these corrections:

Edit: Patch removed
Last edited by Terkhen on 07 Jan 2010 23:39, edited 1 time in total.
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: Wolf01's hire point - Last addition: sloped stations

Post by Wolf01 »

Many thanks Terkhen
A lot of things were changed since last time i put my hands on OTTD code (think about I had problems iterating with the rectangle because I didn't notice that BEGIN/END_TILE_LOOP now become TILE_LOOP :P) so I was a bit confused
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Wolf01's hire point - Last addition: sloped stations

Post by Terkhen »

Do you think that there are any features or code corrections missing from the drag and drop patch? I'm really interested to see this completed and I'm willing to make further changes if they are needed. :)
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: Wolf01's hire point - Last addition: sloped stations

Post by Wolf01 »

I think this patch is complete, maybe the other one (the sloped stations one) might be updated to trunk, road stops on slopes for hilly cities should be a good improvement.
It should be split into two patches, sloped road stops and sloped rail stations, so the road stops one can be added without scrambling the things too much, but not that much, it's really simple as patch, it's just a check removed and some code for drawing slopes.
Drawing new graphics is not required for now, current graphics fit well enough the sloped layout, for train stations is different instead, they really need new graphics, that's why I want the patch split.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Wolf01's hire point - Last addition: sloped stations

Post by Terkhen »

I spotted a pair of bugs at the Drag and drop road stops patch.

- Drive-through stops could be built over any roads, no matter what directions they had.
- Only the first road stop was joined to existing roads, and not in the right directions.
drag_drop_road_stops_r18831.diff
(16.77 KiB) Downloaded 117 times
I will keep testing it: if there aren't any new bugs, I think the patch is ready for getting a flyspray task :)

EDIT: Update to trunk.
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 26 guests