Page 4 of 4
Re: Wolf01's hire point - Now working: User Configurable Hotkeys
Posted: 07 Aug 2008 12:06
by Wolf01
Ok, I'm working on a new patch, this time really simple as devs told me

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
Re: Wolf01's hire point - Last addition: drag&drop roadstations
Posted: 10 Jan 2009 19:53
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
Re: Wolf01's hire point - Last addition: sloped stations
Posted: 10 Jan 2009 21:10
by StopRightThere
That's really cool, does the track follow the slope?
Re: Wolf01's hire point - Last addition: sloped stations
Posted: 10 Jan 2009 21:17
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)
Re: Wolf01's hire point - Last addition: sloped stations
Posted: 10 Jan 2009 22:46
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..

)
Re: Wolf01's hire point - Last addition: sloped stations
Posted: 11 Jan 2009 04:26
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.
Re: Wolf01's hire point - Last addition: sloped stations
Posted: 11 Jan 2009 11:51
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.
Re: Wolf01's hire point - Last addition: sloped stations
Posted: 11 Jan 2009 12:12
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:
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.

)
regards
Michael
Re: Wolf01's hire point - Last addition: sloped stations
Posted: 11 Jan 2009 14:50
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)
Re: Wolf01's hire point - Last addition: sloped stations
Posted: 17 Dec 2009 12:11
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?
Re: Wolf01's hire point - Last addition: sloped stations
Posted: 18 Dec 2009 20:53
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 ->
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)
Re: Wolf01's hire point - Last addition: sloped stations
Posted: 02 Jan 2010 17:04
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
Re: Wolf01's hire point - Last addition: sloped stations
Posted: 04 Jan 2010 10:14
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

) so I was a bit confused
Re: Wolf01's hire point - Last addition: sloped stations
Posted: 04 Jan 2010 11:01
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.

Re: Wolf01's hire point - Last addition: sloped stations
Posted: 04 Jan 2010 21:34
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.
Re: Wolf01's hire point - Last addition: sloped stations
Posted: 07 Jan 2010 23:39
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.
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.