Page 1 of 1

Patch: Long format model life for vehicles

Posted: 30 Jul 2009 08:26
by Terkhen
After starting my work with the Millenium conversion set, I realized that, to give full support to long format introduction dates, the model life value could not be limited to 254 years. I have written a patch that adds a new word sized Action 0 property for all vehicle types called long format model life. This property allows to set model life values between 0 and 5000 (88 13 in little endian byte order). This limit is set to prevent overflows calculating duration phases, and there's no interest for bigger values anyways. Any number greater than 5000 will be treated as 5000. A value of 0xFFFF means that the model never expires. This new property is compatible with all existing sets that use the standard model life property.

The long format model life property has the following property numbers:

Trains: 0x2B
Road vehicles: 0x21
Airplanes: 0x1C
Ships: 0x1C

I am providing a win32 binary in this post. The source code of the patch and two simple GRFs for testing purposes can be found on its Flyspray task [#3044]. In the next posts there are some GRFs that are more interesting to test this patch.

Re: Patch: Long format model life for vehicles

Posted: 30 Jul 2009 08:26
by Terkhen
To test this patch, I am posting a complete version of the Millenium conversion set. Since it needs this patch to work properly, these GRF files are posted here instead of in their thread to prevent confusions.

In this post is a rar file that includes all parts of the MCS (standard trains, road vehicles, ships, planes, bridges and houses) each on its separate file. This is to allow anyone to select what parts of the game they want to be affected by the conversion. A single, complete GRF can be found at the next post. These GRFs accept a parameter that allows to set how many centuries you want to play.

Code: Select all

Starting
Date		Parameter
1950			1
1850			2
1750			3
1650			4
1550			5
1450			6
1350			7
1250			8
1150			9
1050			10
950 			11
850 			12
750 			13
650 			14
550 			15
450 			16
If there's no parameter, a starting date of 1050 will be used. The GRFs scales the introduction dates and model life values to fit in the new time scale. The GRFs and their sources can be found below:

Re: Patch: Long format model life for vehicles

Posted: 25 Aug 2009 07:32
by Terkhen
Finally, here is a single GRF file that implements the complete MCS. This file makes life easier to anyone that wants to use the complete conversion without having to set 6 different GRF files with the same parameter.

As you may know, my aim with this patch and the MCS is to achieve the same goal as the different daylength patches (really long games) but changing OpenTTD source code as little as possible. With the current implementation this is already possible (only for standard vehicles), having the following issues (there may be more):
  • Euro introduction date can be changed by GRF, but it is not implemented.
  • New objects introduction dates can be changed by GRF, but they are not implemented.
  • Oil wells can only be built before 1950, and oil rigs can only be built after 1960. These flags can't be changed by GRF, but variable limits could be coded with a callback. This is not implemented.
  • Inflation still maxes out 170 years after game starts.
  • Airport introduction dates can't be changed by GRF. Planes are still converted in the MCS.

Re: Patch: Long format model life for vehicles

Posted: 28 Aug 2009 20:20
by FooBar
Terkhen wrote:Oil wells can only be built before 1950, and oil rigs can only be built after 1960. These values can't be changed by GRF...
You can use a callback to set a custom date instead of using the industry flags.

Re: Patch: Long format model life for vehicles

Posted: 29 Aug 2009 07:39
by Terkhen
Thanks, I have edited the issue.

Re: Patch: Long format model life for vehicles

Posted: 30 Aug 2009 18:08
by frosch
FooBar wrote:
Terkhen wrote:Oil wells can only be built before 1950, and oil rigs can only be built after 1960. These values can't be changed by GRF...
You can use a callback to set a custom date instead of using the industry flags.
Good idea. I suggest to use 0x22 for the callback ID. :p