Patch: Send all trains to depot
Moderator: OpenTTD Developers
Patch: Send all trains to depot
Just a small patch that adds a button to the train list that sends all trains to their nearest depot (usefull when upgrading to monorail/maglev).
Update: Thanks to Thief^ my Grapical problems have been fixed. The code has been changed to a server side function, as sugested by peter1138. Now to get other vehicle types done.
v.3 Update: Added the ability to start all trains in a depot. Moved the Buttons to the bottom of the window. The Depot All button should now force every train that can route to a depot at the time it is pressed, to goto a depot and stay there. Still no support of other transport types as of yet.
v.4 Update: Added Road Vehicles
v.5 Update: Added Ships and Aircraft
Update: Updated the patch to compile with new revisions, I havent tested this, just replaced the Function call (CheckStoppedInHangar has been replaced with a new function) in the patch file.
Update: Thanks to Thief^ my Grapical problems have been fixed. The code has been changed to a server side function, as sugested by peter1138. Now to get other vehicle types done.
v.3 Update: Added the ability to start all trains in a depot. Moved the Buttons to the bottom of the window. The Depot All button should now force every train that can route to a depot at the time it is pressed, to goto a depot and stay there. Still no support of other transport types as of yet.
v.4 Update: Added Road Vehicles
v.5 Update: Added Ships and Aircraft
Update: Updated the patch to compile with new revisions, I havent tested this, just replaced the Function call (CheckStoppedInHangar has been replaced with a new function) in the patch file.
- Attachments
-
- sendalltodepot.patch
- Patch file v.5 (Should compile with new revisions)
- (17.8 KiB) Downloaded 732 times
Last edited by Splatman on 08 Jun 2006 19:16, edited 5 times in total.
- Born Acorn
- Tycoon
- Posts: 7596
- Joined: 10 Dec 2002 20:36
- Skype: bornacorn
- Location: Wrexham, Wales
- Contact:
Good one, I'll try it.
OTTDCoop NewGRF Pack|Different sets of GRFs for TTDPatch (some of them work in OTTD) - 1|- 2|GRF sets for OTTD|OTTD nightly

I hooked up my accelerator to my brake lights. I hit the gas, people behind me stop, and I'm gone.
Understeer is when you hit the wall with the front of the car. Oversteer is when you hit the wall with the rear of the car. Horsepower is how fast you hit the wall. Torque is how far you take the wall with you. Spoilers and bodykits are how much of the wall you take with you. Rollcages and windownets are how much of a mess you leave on the wall.
I hooked up my accelerator to my brake lights. I hit the gas, people behind me stop, and I'm gone.
Understeer is when you hit the wall with the front of the car. Oversteer is when you hit the wall with the rear of the car. Horsepower is how fast you hit the wall. Torque is how far you take the wall with you. Spoilers and bodykits are how much of the wall you take with you. Rollcages and windownets are how much of a mess you leave on the wall.
Re: Patch: Send all trains to depot
If this works as advertised, its straight into the Mini INSplatman wrote:Just a small patch that adds a button to the train list that sends all trains to their nearest depot (usefull when upgrading to monorail/maglev).
Try as I might I couldn't get the button to not resize with the window, I tried adding another panel afterwards but just got wierd graphical errors.

OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
i hope that the "all vehicles to depot" order will make all vehicles go to depot and STAY at the depot
when you want to upgrade all the tracks (example from train to monorail) and you click on each of 500 trains on the list and send it to the depot, sometimes happen that trains enter one depot for service only and not to stop
when you want to upgrade all the tracks (example from train to monorail) and you click on each of 500 trains on the list and send it to the depot, sometimes happen that trains enter one depot for service only and not to stop
- Born Acorn
- Tycoon
- Posts: 7596
- Joined: 10 Dec 2002 20:36
- Skype: bornacorn
- Location: Wrexham, Wales
- Contact:
no, i meant to not make vehicles service at depots as happen offten when you send them manually at depotsBorn Acorn wrote:Of course it does that. Were you expecting the "all vehicles to depot" order to make vehicles never go to depots at all?Wolf01 wrote:i hope that the "all vehicles to depot" order will make all vehicles go to depot and STAY at the depot
I'll try it
.
Can you also make something like this that just services all trains at the same time so they can be replaced very quickly
.

Can you also make something like this that just services all trains at the same time so they can be replaced very quickly

Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)

OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone

OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone







What actually happens when a train leaves depot again after you send it to it's depot, is that it was already heading there. When clicking go to depot when it is already going, it returns to it's normal orders, and then quickly flips back to depot again, because it was heading there for regular maintenance. That's why it will leave when it enters the depot: it went there for maintenance.
Maybe it is a good idea to add some code that checks if the train is already heading to depot for regular maintenance or not when you click the button. If it does, don't cancel the go to depot order, but keep it, just with the addition that it will stay there when it arrives. When a depot order is manually given, and clicked again, then the status should return to normal, as it does now. I think this is essential for this patch as well, because otherwise all the trains that were heading for maintenance on the moment the grand go to depot-order was given, will leave again when they get there, making this command fail for those vehicles.
Maybe it is a good idea to add some code that checks if the train is already heading to depot for regular maintenance or not when you click the button. If it does, don't cancel the go to depot order, but keep it, just with the addition that it will stay there when it arrives. When a depot order is manually given, and clicked again, then the status should return to normal, as it does now. I think this is essential for this patch as well, because otherwise all the trains that were heading for maintenance on the moment the grand go to depot-order was given, will leave again when they get there, making this command fail for those vehicles.
"I'm gonna rip his leg off and kick him with it!", Sanjuro, Shogo-MAD
-
- Engineer
- Posts: 116
- Joined: 20 May 2004 17:21
- Born Acorn
- Tycoon
- Posts: 7596
- Joined: 10 Dec 2002 20:36
- Skype: bornacorn
- Location: Wrexham, Wales
- Contact:
Maybe add another status color to the train numbers. Currently, normal vehicles are black, ones in depot blue, old ones red, and why not vehicles heading for depot by order yellow, and vehicles heading to depot for maintenance green? Or at least something like that. Then you'll see which trains go to depot and which ones do not. Then allow sorting based on these colors, and you're done! 
Of course, having a good network with enough depots is always usefull...

Of course, having a good network with enough depots is always usefull...

"I'm gonna rip his leg off and kick him with it!", Sanjuro, Shogo-MAD
- webfreakz.nl
- Director
- Posts: 627
- Joined: 11 Aug 2005 08:22
- Location: Localhost, 127.0.0.1, [The Netherlands: South Holland-> Westland]
- Contact:
What about catching these train numbers and put them in a small window where you can click on it to view it's information?Splatman wrote:New version, see first post.
As for trains that xcan't route to a depot at the time the button is pressed you may just have to sort them out manualy, but this should take care of most trains.
# Programming is like sex, one mistake and you have to support it for the rest of your life. (Michael Sinz)
New version.
Works (I think) with all transport types, I would like to get this tested a bit before I start thiking about adding other stuff (like finding trains that haven't been sent to the depot). Really needs multiplayer testing, with a lot of vehicles.
Also not sure if I am calling the functions in the right way, when the user clicks one othe the buttons a DoCommandP() is used to call one of my new functions, then my function directly calls one of the orginal functions (for example CmdSendTrainToDepot()), am I ment to be using DoCommandP() to call these as well or not?
Works (I think) with all transport types, I would like to get this tested a bit before I start thiking about adding other stuff (like finding trains that haven't been sent to the depot). Really needs multiplayer testing, with a lot of vehicles.
Also not sure if I am calling the functions in the right way, when the user clicks one othe the buttons a DoCommandP() is used to call one of my new functions, then my function directly calls one of the orginal functions (for example CmdSendTrainToDepot()), am I ment to be using DoCommandP() to call these as well or not?
I'm sorry I borked it!
I love this patch and I hate to break it to you that it doesnt appear to work completely 100% It has a nasty habit of giving a 'Disconnecting train' error if you hit the 'depot all' button whilst a train is in or partially in a depot. Have also had another strange error whilst using this. I am using a nightly from a few days ago, and this patch and terragenesis (so I doubt there is a conflict). I have been using it on a map with a friend we are playing multiplayer, I have posted a savegame a few seconds before I get this error, and you can see exactly what happens. Just load it up, its in pause mode, if you then hit the 'depot all' button and unpause you will see what happens. Sometimes it just crashes other times you actually see a 'disconnected train' by the depot. (Although its an MP save you can load it in SP and you will be my company).
Although I seem to get this error whatever I do now, it did work well initially, when I upgraded from Monorail to Maglev, however I wanted to go to the fastest maglev vehicle using this patch. My guess is that there is just too much fast traffic on the network and the chances of hitting the button at a point where there isnt already a train half in/out of a depot are negligible. Has anyone else had this problem with this patch where it causes a game crash when the button is pressed whilst a train is half in/out of a depot?
Although I seem to get this error whatever I do now, it did work well initially, when I upgraded from Monorail to Maglev, however I wanted to go to the fastest maglev vehicle using this patch. My guess is that there is just too much fast traffic on the network and the chances of hitting the button at a point where there isnt already a train half in/out of a depot are negligible. Has anyone else had this problem with this patch where it causes a game crash when the button is pressed whilst a train is half in/out of a depot?
- Attachments
-
- Disconnecting Train.sav
- (2.13 MiB) Downloaded 384 times
Interlink Konnexions INC
Who is online
Users browsing this forum: Bing [Bot] and 10 guests