Replacing to different types of trains - almost done
Moderator: OpenTTD Developers
Replacing to different types of trains - almost done
I've done this so I can save the hassle of manually upgrading all my trains.
You can convert from any type to any type of train. As soon as trains are of different type they will be stopped at the depot and you cannot use them until you convert the depot.
I'm not posting the patch yet as it's still not ready. The replace train window is buggy (can anyone help me out on this? - things keep getting changed there, as if I was pressing the left mouse button uncontrollably - works well when game is paused though) and I still need to implement a feature to start moving the trains as soon as the depots have been converted.
You can convert from any type to any type of train. As soon as trains are of different type they will be stopped at the depot and you cannot use them until you convert the depot.
I'm not posting the patch yet as it's still not ready. The replace train window is buggy (can anyone help me out on this? - things keep getting changed there, as if I was pressing the left mouse button uncontrollably - works well when game is paused though) and I still need to implement a feature to start moving the trains as soon as the depots have been converted.
- Attachments
-
- Linhill Transport, 21st Aug 2009.png (144.52 KiB) Viewed 3315 times
nice work even through that layout just broke my idea for the next layout, where you should be able to replace cars too (useful in newgrf where bigger better cars are invented)
The question is how we really want this and how it should look
as for the clicking issue, it would be nice if anybody gets an idea of why this could happen.
The question is how we really want this and how it should look
as for the clicking issue, it would be nice if anybody gets an idea of why this could happen.
I'm still not sure about the GUI, I feel that it is made less simple than mine, but this is a minor issue.
I just looked through your code (didn't compile it) and it's pretty nice for the internal stuff, but I found one thing, that would become an issue: rail cars.
You would have say 5 coal cars and when you convert, you would have a monorail engine with 5 coal cars, not 5 monorail cars.
It seems network stable since you do your stuff from a command called by DoCommand. I don't know if you planned it like this or that you might just be lucky. Either case is good
you used TS_Front_Engine, which deserves a great bonus
the last one is for trains only, so why not just write 89 instead of (w->resize.step_height == 24 ? 79 : 89 )?
another solution would be
this would show the same and keep the drawstring to just one line. Not that it's really important through. The line is long enough already so an if might be a good idea for readability
as for the feature..... hmmm ... it's not the best solution to have monorail train in a rail depot, but the only solution I can think of is to place two depots next to each other like a "bridge" between the railtypes and I don't know about that idea either
BTW try this on a laggy network. There might be a risk that the train actually leaves the depot and then gets converted
I just looked through your code (didn't compile it) and it's pretty nice for the internal stuff, but I found one thing, that would become an issue: rail cars.
You would have say 5 coal cars and when you convert, you would have a monorail engine with 5 coal cars, not 5 monorail cars.
It seems network stable since you do your stuff from a command called by DoCommand. I don't know if you planned it like this or that you might just be lucky. Either case is good

you used TS_Front_Engine, which deserves a great bonus

Code: Select all
if(WP(w,replaceveh_d).vehicletype != VEH_Train)
DrawString(145, (w->resize.step_height == 24 ? 67 : 77 ) + ( w->resize.step_height * w->vscroll.cap), STR_02BD, 0x10);
else
DrawString(145, (w->resize.step_height == 24 ? 79 : 89 ) + ( w->resize.step_height * w->vscroll.cap), STR_02BD, 0x10);
another solution would be
Code: Select all
DrawString(145, (w->resize.step_height == 24 ? 67 : 77 ) + (WP(w,replaceveh_d).vehicletype == VEH_Train ? 12 : 0) + ( w->resize.step_height * w->vscroll.cap), STR_02BD, 0x10);
as for the feature..... hmmm ... it's not the best solution to have monorail train in a rail depot, but the only solution I can think of is to place two depots next to each other like a "bridge" between the railtypes and I don't know about that idea either
BTW try this on a laggy network. There might be a risk that the train actually leaves the depot and then gets converted

I actually was expecting a segfault or something from railcars, but since they amazingly worked as expected, I didn't bother replacing them. Perhaps it shoud be done anyway.I just looked through your code (didn't compile it) and it's pretty nice for the internal stuff, but I found one thing, that would become an issue: rail cars.
You would have say 5 coal cars and when you convert, you would have a monorail engine with 5 coal cars, not 5 monorail cars.
It seems network stable since you do your stuff from a command called by DoCommand. I don't know if you planned it like this or that you might just be lucky. Either case is good![]()
Yes, before that there was a segfault or two. I'm still not too familiar with the code, and it is pretty lacking in comments, so most times I just have to guess...you used TS_Front_Engine, which deserves a great bonus![]()
I didn't know what it meant, so I simply left it.the last one is for trains only, so why not just write 89 instead of (w->resize.step_height == 24 ? 79 : 89 )
I only took a glance at the network code and from what I understood, it sends the DoCommands or something... Is it like that? I can only imagine the nasty effects of having a train over the wrong railtype...BTW try this on a laggy network. There might be a risk that the train actually leaves the depot and then gets converted
I have a suggestion but I'm not sure if it should be implemented. When someone chooses to convert a train to a different rail type, trains immediately go to the depots. Since you are probably only going to upgrade your trains like that when you're upgrading your rail network, waiting for each and every single one of them to be in the depots can take a while, especially if you don't allow automatic servicing, like me

This might not be desired all the time - you might want your trains to finish their current goods run before going to the depot. Maybe a separate button 'all of type go to depot' and/or 'all go to depot'?CruDeLioS wrote:I have a suggestion but I'm not sure if it should be implemented. When someone chooses to convert a train to a different rail type, trains immediately go to the depots. Since you are probably only going to upgrade your trains like that when you're upgrading your rail network, waiting for each and every single one of them to be in the depots can take a while, especially if you don't allow automatic servicing, like me
Also, with Large Maps, people might build three or four separate networks. Would it be too much hassle to add a option where the user clicks on the track to be upgraded, it then finds all attached track, stations and depots, then starts the cycle.
We would also need a visual confirmation displaying the cost before we begin. It would be some hassle if the network upgrades okay, then you find out half way through updating the trains that you don't have enough cash to replace them all. >.<
We would also need a visual confirmation displaying the cost before we begin. It would be some hassle if the network upgrades okay, then you find out half way through updating the trains that you don't have enough cash to replace them all. >.<
- bobingabout
- Tycoon
- Posts: 1850
- Joined: 21 May 2005 15:10
- Location: Hull, England
i've got to say, this is an awsome patch, would make converting railway-monorail-maglev worth it without spending several hours trying to replace several hundred trains.
only thing missing is a send all trains to depot button, you might not want to have to wait untill they all need sevicing.
only thing missing is a send all trains to depot button, you might not want to have to wait untill they all need sevicing.
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.
[/url]
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.
[/url]
I would like this as well as i have yet to advance to the level where i have an entire network thing going (i'm getting there thoughzg_01 wrote:Also, with Large Maps, people might build three or four separate networks. Would it be too much hassle to add a option where the user clicks on the track to be upgraded, it then finds all attached track, stations and depots, then starts the cycle.

(First post here
)
I've managed to have this patch working with the latest nightly (r2661). If noone is on this, maybe I could try to code the stuff to send all trains to depot.
However, this patch sould allow you to (re)test the feature with the latest nightly. Nothing changed since the last diff posted here though.

I've managed to have this patch working with the latest nightly (r2661). If noone is on this, maybe I could try to code the stuff to send all trains to depot.
However, this patch sould allow you to (re)test the feature with the latest nightly. Nothing changed since the last diff posted here though.
- Attachments
-
- trainreplace_v2661.diff
- train replace patch for r2661
- (12.51 KiB) Downloaded 355 times
Slight problem with adding this patch to newer revisions, the patch made use of a bug that let you build the wrong type of train in a depot (i.e. you could build a maglev in a noraml railway depot), this bug was fixed when they added the clone vehicle patch. It may be possible to rewrite the patch to work by putting the bug back in. Failing that would it be possible to join different depot types together similar to stations?
- bobingabout
- Tycoon
- Posts: 1850
- Joined: 21 May 2005 15:10
- Location: Hull, England
AFAIK, or inderstand, you'd have to be able to build the wrong type of train in the depot, even if it couldn't leave, if it couldn't leave it would need to be able to be converted with trains in it.
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.
[/url]
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.
[/url]
- bobingabout
- Tycoon
- Posts: 1850
- Joined: 21 May 2005 15:10
- Location: Hull, England
difference is that a station worked like that in the begining(you could place a bus stop next to a train station and it would still be all 1 station). all they did was allow a train station to be placed ajacent to another train station. depots would be more difficult because they don't do this normally.
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.
[/url]
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.
[/url]
Please iron out the bugs, so it can be included in the next integrated nightly. 

NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Who is online
Users browsing this forum: No registered users and 7 guests