Page 1 of 1

Vehicle.dat Support?

Posted: 12 Jan 2005 21:43
by Pipian
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(?))

Posted: 12 Jan 2005 22:27
by Darkvater
What is vehicle.dat for? OpenTTD does not use vehicle.dat

Posted: 12 Jan 2005 22:51
by Patchman
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...

Posted: 12 Jan 2005 23:09
by Pipian
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.

Posted: 13 Jan 2005 18:24
by orudge
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.

Posted: 30 Jan 2005 14:07
by wedesdo
If someone gets around to making an accurate vehicles list, could they share it? More importantly, can the real vehicle names be included with the official distribution of OpenTTD? :D

Posted: 30 Jan 2005 15:35
by orudge
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.

Posted: 30 Jan 2005 16:29
by Born Acorn
There is no need whatsoever for a vehicles.dat

look.

Posted: 30 Jan 2005 17:01
by Pipian
The downside of that however, is that Original Vehicle Names only works with English. Other languages may not participate. This still adds some urgency to getting vehicles.dat working, if not at least made separate from language specific items.

Posted: 30 Jan 2005 20:50
by Moriarty
The other downside of that is that if someone did make proper names for every language, you'd have double the languages listed.
There's a nice little menu on that same game-options screen titled: "vehicle design names". I'm pretty certain that's where you're supposed to be able to select the names.

Posted: 31 Jan 2005 08:46
by ThorRune
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 :P