Vehicle.dat Support?

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
Pipian
Engineer
Engineer
Posts: 122
Joined: 10 Jul 2004 02:25
Contact:

Vehicle.dat Support?

Post 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(?))
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

What is vehicle.dat for? OpenTTD does not use vehicle.dat
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post 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...
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
Pipian
Engineer
Engineer
Posts: 122
Joined: 10 Jul 2004 02:25
Contact:

Post 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.
User avatar
orudge
Administrator
Administrator
Posts: 25218
Joined: 26 Jan 2001 20:18
Skype: orudge
Location: Banchory, UK
Contact:

Post 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.
wedesdo
Engineer
Engineer
Posts: 5
Joined: 11 May 2004 05:53

Post 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
User avatar
orudge
Administrator
Administrator
Posts: 25218
Joined: 26 Jan 2001 20:18
Skype: orudge
Location: Banchory, UK
Contact:

Post 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.
User avatar
Born Acorn
Tycoon
Tycoon
Posts: 7596
Joined: 10 Dec 2002 20:36
Skype: bornacorn
Location: Wrexham, Wales
Contact:

Post by Born Acorn »

There is no need whatsoever for a vehicles.dat

look.
Attachments
orignames.PNG
orignames.PNG (285.42 KiB) Viewed 1072 times
Image
Pipian
Engineer
Engineer
Posts: 122
Joined: 10 Jul 2004 02:25
Contact:

Post 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.
Moriarty
Tycoon
Tycoon
Posts: 1395
Joined: 12 Jun 2004 00:37
Location: United Kingdom of Great Britain and Northern Ireland
Contact:

Post 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.
User avatar
ThorRune
Tycoon
Tycoon
Posts: 5762
Joined: 09 Oct 2003 14:00
Location: Nordland, Norway
Contact:

Post 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
Alcohol is not the answer, it just makes you forget the question.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 21 guests