FS#1029 - Fix : Autorenew old vehicules

Attached to Project: OpenTTD
Opened by Sylvain Devidal (MagicBuzz) - Thursday, 12 July 2007, 19:59 GMT
Type Patch
Category Vehicles → Autoreplace
Status New
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Currently, if you set "service interval" to 0, and don't schedule depots in your orders, you don't have any chance of getting you vehicule renewed when it gets old. Thus, the autoreplace feature won't work as well.
To get it working, you must manually send your vehicules to depot.
Worst of all, if the autorenew patch is enabled, you aren't even warned about your vehicule gets old.

With this patch, when the vehicule reachs the age it has to be renewed, if not any service is scheduled (nor in the orders nor at intervals) it should automatically head to a depot to get renewed. This will also enable the autoreplace feature as well : all concerned vehicules will head to a depot.

Patch runs on rev10532
This task depends upon

Comment by Sylvain Devidal (MagicBuzz) - Thursday, 12 July 2007, 23:50 GMT
Changed the way the autoreplacement works.
Now all concerned vehicles won't go to depot immediately, but wait until you use the "send to service" button in vehicle list window.
This button now only impacts the vehicle concerned by an autoreplace.

I still have to check this won't impact the game when playing with servicing.
Comment by Alberth (Alberth) - Sunday, 03 February 2008, 15:18 GMT
In r12030, this problem seems still to exist.

With Vehicle-breakdown set to None, and the 'no-service-if-breakdown-disabled' configure patch, none of the vehicles go to a depot if they are beyond their life-time and autorenew is switched on.

In addition, trains and airplanes warn about obsolete vehicles, ships and road vehicles do not. Attached a saved game to experiment with, containing obsolete vehicles of all types.
Comment by Sylvain Devidal (MagicBuzz) - Monday, 04 February 2008, 19:50 GMT
There were a lot of code changes since this patch was released.
After a quick try, I wasn't able to fix it. I'll try to investigate more in the next days.
Comment by Sylvain Devidal (MagicBuzz) - Monday, 04 February 2008, 23:46 GMT
In fact, I found what was wrong with the patch after the small changes I did: most of your vehicles were not available anymore in shop, so it was impossible to replace them.

I tested this new version with your saved game with those results :
- Trucks and ships are immediately replaced, as they are still available
- If you use the "autoreplace" feature and set up a replacement model for your trains/planes, they are replacing correctly


PS: This need to be tested, I did only a few tests, but I'm unsure the patch works as expected with "normal" settings (breakdowns and servicing). I'll try to do some tests soon.