
Replacing to different types of trains - almost done
Moderator: OpenTTD Developers
Great Patch! I was finally able to get OTTD compiled and add this patch 
Has anyone made latest nightly compatible of it?
edit: fixed a small bug, trains wouldnt leave depot after track conversion for some reason... Don't know if I messed up with applying the patch first time , but at least now it's working ok with 0.4.0.1

Has anyone made latest nightly compatible of it?
edit: fixed a small bug, trains wouldnt leave depot after track conversion for some reason... Don't know if I messed up with applying the patch first time , but at least now it's working ok with 0.4.0.1

Could someone post some info on using diff (creating .diff patches)?
And are there newer patches tackling the issue of transition from rail to monorail to maglev? I'm interested in making a patch to convert easily all tracks & trains, quite like the one they've made for TTDPatch.
To all the developers of OTTD, I'd like to say big thanks, this is one of my all time favourite games
And are there newer patches tackling the issue of transition from rail to monorail to maglev? I'm interested in making a patch to convert easily all tracks & trains, quite like the one they've made for TTDPatch.
To all the developers of OTTD, I'd like to say big thanks, this is one of my all time favourite games

-
- Engineer
- Posts: 4
- Joined: 11 Sep 2005 14:30
Here's the .diff for (almost) latest nightly. Seems to work ok, at least for me 

- Attachments
-
- Trainreplace_v2890.diff
- (13.16 KiB) Downloaded 314 times
- bobingabout
- Tycoon
- Posts: 1850
- Joined: 21 May 2005 15:10
- Location: Hull, England
well, more than likely, you've have to write a patch, then submit it, and maybe if you are lucky, it will get intergrated into the trunk.
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 don't know about dirty-function. I was planning to check all values for wagons and trains, but I've had a lot of stuff going on at work, so haven't had time
...
Do you know has anyone done the 'all trains to depot'-button or anything like it? I thought I'd try to make a one button solution to converting to other track types. It could order all trains to depots, change them and convert track... Or just convert trains whereever they are

Do you know has anyone done the 'all trains to depot'-button or anything like it? I thought I'd try to make a one button solution to converting to other track types. It could order all trains to depots, change them and convert track... Or just convert trains whereever they are

Can someone please make this patch work with the latest nightly? Or give a hint how to make it work? I've tried to fix it, but there seems to be something that prevents it from working. Maybe the game has just changed too much. I've tried changing CmdReplaceVehicle in player.c, so that it doesn't check for engine types etc. but it just doesn't work
I just can't play OTTD without autoreplacing my trains to monorail/maglev

I just can't play OTTD without autoreplacing my trains to monorail/maglev

MaybeReplaceVehicle() and ReplaceVehicle() have been completely redesigned to solve some major issues, so a patch like this one will need some work to apply. Also another reason why you fail is that this patch exploited a bug in the build command and needless to say we fixed that bug. We decided long ago that this patch is not the solution to this problem.MadFrog wrote:Can someone please make this patch work with the latest nightly? Or give a hint how to make it work? I've tried to fix it, but there seems to be something that prevents it from working. Maybe the game has just changed too much. I've tried changing CmdReplaceVehicle in player.c, so that it doesn't check for engine types etc. but it just doesn't work![]()
tough luck. Try to find a solution that will work without exploiting bugsMadFrog wrote:I just can't play OTTD without autoreplacing my trains to monorail/maglev
we don't use dirty hacks. It will be easier to actually make a real solution for this and get it added to the trunk so it just works in the future.MadFrog wrote:Yeah, I was just hoping for a quick and dirty hack solution to do this while there is no other patch yet. Of course with a little effort one could probably come up with a good way of doing the replacement...
I know that would be the right way to do it. I was just looking for a quick solution for my self. And tinkering with this patch is a good way for me to get to know how the game works
So Im not trying to get this patch into trunk as we've discussed before. Obviously, it'd have to be done right, if it's to be added to game permanently.

So Im not trying to get this patch into trunk as we've discussed before. Obviously, it'd have to be done right, if it's to be added to game permanently.
- Born Acorn
- Tycoon
- Posts: 7596
- Joined: 10 Dec 2002 20:36
- Skype: bornacorn
- Location: Wrexham, Wales
- Contact:
I think the easiest (not the easiest, but the simplest logically) way to do it would be "multistop" style train depots, so two depots next to each other are treated as one, even if different types, allowing replacing of trains into monorail/maglev. The train goes into its depot, is sold, and the maglev train next door comes out.
Well... The thing is, we want to:
1) Save the train info (route, cargo etc.)
2) Sell the train
3) Buy a mono/maglev
So the problem now is, we cannot build the train in the same depot. And also the train info would have to be saved somewhere. This patch just changes one bit of info in the train, and voila, its maglev. This is not good because its hacky and ugly.
Building multistop depots might be the answer, but I'm not sure it would be feasible codewise. And it might not be very usable, either, maybe. Consider making all your depots multistop just for a quick change of all vehicles to the next type.
I think a nice solution might be one, where you could change depots into other types and trains inside would be sold (maybe confirmed first) and then new vehicles of the converted type (selected from a list or whatever) would be bought automatically. This would allow all the rail to be converted at one time (tell trains to go to depots, convert all rail, including depots and automatically sell/buy trains). I have a hunch this has been suggested before, but just my opinion...
1) Save the train info (route, cargo etc.)
2) Sell the train
3) Buy a mono/maglev
So the problem now is, we cannot build the train in the same depot. And also the train info would have to be saved somewhere. This patch just changes one bit of info in the train, and voila, its maglev. This is not good because its hacky and ugly.
Building multistop depots might be the answer, but I'm not sure it would be feasible codewise. And it might not be very usable, either, maybe. Consider making all your depots multistop just for a quick change of all vehicles to the next type.
I think a nice solution might be one, where you could change depots into other types and trains inside would be sold (maybe confirmed first) and then new vehicles of the converted type (selected from a list or whatever) would be bought automatically. This would allow all the rail to be converted at one time (tell trains to go to depots, convert all rail, including depots and automatically sell/buy trains). I have a hunch this has been suggested before, but just my opinion...

Who is online
Users browsing this forum: No registered users and 5 guests