Vehicle.dat Support?
Moderator: OpenTTD Developers
Vehicle.dat Support?
I cannot be sure on the exact mapping of vehicles.dat, but I am nearly certain of how it is set up (someone using TTD to add some random letter to the end of each and every vehicle would help with determining exact mapping):
0x8C 0x11 0x03 0x00 - Magic Number (I believe. I do not see any variations on this in the variations of vehicles.dat)
Followed by a standard array of all vehicles in the game. I'm not exactly sure how many, but counting is rather easy. Starting with the Kirby Paul Tank, each vehicle in the game has an entry. If the entry is non-null (i.e. the character at the beginning of the entry is not 0x00), then the length of the name is 32 characters (regardless. Is this null-terminated? It's null-filled, but I don't know if the max text is 31-characters with a null, or 32 characters, with a 33'd character, a null, implied. A test by saving the max-length name in a TTD vehicles.dat would test this). If the entry is null, the length of the entry is 1, and the next character is the next entry.
From that information (and with a little more from people with a working TTD original to make vehicle.dat files for a little more information) it should be fairly easy to add a patch for vehicle.dat support.
Unicode support would of course require then testing the magic number and replacing it with one we find suitable (such as making that last character, 0x00 to 0x01?) to call for a vehicle.dat version update (to support unicode, variable-length names, keying to specific names to overlay (i.e. a sparse array format), and/or adding support for adding an unlimited number of vehicles (handy if we ever move beyond newgrf's limitations in the number of sprites(?))
0x8C 0x11 0x03 0x00 - Magic Number (I believe. I do not see any variations on this in the variations of vehicles.dat)
Followed by a standard array of all vehicles in the game. I'm not exactly sure how many, but counting is rather easy. Starting with the Kirby Paul Tank, each vehicle in the game has an entry. If the entry is non-null (i.e. the character at the beginning of the entry is not 0x00), then the length of the name is 32 characters (regardless. Is this null-terminated? It's null-filled, but I don't know if the max text is 31-characters with a null, or 32 characters, with a 33'd character, a null, implied. A test by saving the max-length name in a TTD vehicles.dat would test this). If the entry is null, the length of the entry is 1, and the next character is the next entry.
From that information (and with a little more from people with a working TTD original to make vehicle.dat files for a little more information) it should be fairly easy to add a patch for vehicle.dat support.
Unicode support would of course require then testing the magic number and replacing it with one we find suitable (such as making that last character, 0x00 to 0x01?) to call for a vehicle.dat version update (to support unicode, variable-length names, keying to specific names to overlay (i.e. a sparse array format), and/or adding support for adding an unlimited number of vehicles (handy if we ever move beyond newgrf's limitations in the number of sprites(?))
vehicle.dat is what holds "custom" vehicle names in TTD, a way to get back the real vehicle names without having them distributed with the game (apparently they thought Concordes crashing in game might make them liable).
Anyway, a better mechanism for this would probably be to use a newgrf file using action 4, which I believe OpenTTD supports already. I even remember seing a program that converts vehicle.dat into a .grf file for this purpose...
Anyway, a better mechanism for this would probably be to use a newgrf file using action 4, which I believe OpenTTD supports already. I even remember seing a program that converts vehicle.dat into a .grf file for this purpose...
One reason I brought it up is because the button for VEHICLE.DAT is still in Game Options (the unusable "Vehicle design names" section, which so far as I know, can't write, and may not read either)
And a GRF file is not as dynamic as support in game would be through the vehicle design names option.
Also, as I hint at in the first post, vehicle.dat files (or variants there-of) might help for internationalization purposes.
And a GRF file is not as dynamic as support in game would be through the vehicle design names option.
Also, as I hint at in the first post, vehicle.dat files (or variants there-of) might help for internationalization purposes.
- orudge
- Administrator
- Posts: 25218
- Joined: 26 Jan 2001 20:18
- Skype: orudge
- Location: Banchory, UK
- Contact:
TTDAlter has a vehicle.dat loader, and has had for eons. The format is quite simple really - it's just a list of 256 vehicle names, separated by null characters, with a maximum length of 32 characters for each name, IIRC. I might be wrong on the exact details, don't have my code to hand, but that's basically it. TTDAlter 4.3 will also have a plug-in available to convert VEHICLE.DAT (and also TDF) files to .GRF files.
- orudge
- Administrator
- Posts: 25218
- Joined: 26 Jan 2001 20:18
- Skype: orudge
- Location: Banchory, UK
- Contact:
You can get a VEHICLES.DAT file that uses the original TT vehicle names from http://www.transporttycoon.net/download - this'll only work with TTD though, of course. The "Original vehicles (ENG)" 'language' has the original vehicle names for OpenTTD.
- Born Acorn
- Tycoon
- Posts: 7596
- Joined: 10 Dec 2002 20:36
- Skype: bornacorn
- Location: Wrexham, Wales
- Contact:
Indeed. The language list is too long allready. I use norwegian city names and english everything else now because i want the real names, i want to be able to use norwegian everything but still have real names. I don't really have any trouble with using english, but as i think the norwegian town name generation is better then the english one (Stupid -on-sea names) i wanna use norwegian names, but they sound odd inbetween a lot of english words right, so i wanna put lang to norwegian, but i can't, because then i'll loose my vehicle names... Pah 

Alcohol is not the answer, it just makes you forget the question.
Who is online
Users browsing this forum: No registered users and 21 guests