

0x00000 - 0x00001: Date in days since 1920

0x00264 - 0x01c18: City array, each with a size of 0x5e.

00h: City location, x
01h: City location, y
02h: Population
04h: ?
1eh: Company ratings, one 2-byte value for each of the eight companies
2eh: Companies that have a rating, with each company representing a bit,
     i.e. bit 0=first company, bit 1=2nd etc.
32h: ?
42h: Max. passengers last month
44h: Max. mail last month
46h: Actual passengers last month
48h: Actual mail last month

0x01C18 - ...: schedule-array
0x0452C-0x04B25: depot-array; 6 bytes per depot
0x04CBA-0x14CB9: landscape-array I; usually the owner
0x14CBA-0x24CB9: landscape-array II
0x24CBA-0x44CB9: landscape-array III; 2 bytes per field
0x48CBA-0x51766: station-array; 0x8E Bytes per station; max. 250 stations
0x52A72-0x52A73: money of human player in pounds
0x547F2-0x6F0F1: vehicle-array; 128 Bytes per vehicle

0x77179-0x87178: landscape-array IV;
upper four bits is the type of the field; lower four bits the height of the
north corner of the field
0x87179-0x97178: landscape-array V

The X-axis (the first coordinate of a point/field) goes from NE to SW; the
y-axis from NW to SE.

The type of the field in the LIV can be:

00h: nothing special built on the field
01h: railway
02h: street, or street/railway crossing
03h: house
04h: trees
05h: station or depot
06h: water
07h: seems to be nothing
08h: industry
09h: tunnel, bridge
0Ah: unremovable "objects"
0Bh-0Fh: seem to be unused


Unused fields:

LI = 10h
LII and LIII = 00h
LV: cleared = 00h
a bit grass: 01h
a bit more grass: 02h
full grass: 03h

rough land: 07h
rocks: 0Bh

owned field (with a shield of the owner):
L I: owner
L II and L III: 00h
type in the L IV: Ah
L V: 01h

-------
For LIV type=01 (railroad)
	LV is bitcoded. Bits are (in hex):
	__4__
       |\   /|         /     \
    10 |  X  | 20     / 1     \ 2
       |/___\|       /         \
	  8

	40: Track has signals
	Signals are in LIII
		For diagonal track:
		80^ /   40^ \
		   /	       \
		  / v40      \ v80

		For horizontal track:
	    <40
		_________
		      80>

		 <10
		_________
		      20>

		For vertical track:

		80^ |    20^ |
		    |        |
		    |        |
		    |        |
		    | v40    | v10




Neu:
00h    : Vehicle type; 10h=Train, 11h=Road, 12h=Ship, 13h=Aircraft
01h    : Vehicle subtype; 0=Engine, 2=Train car or 2nd engine, 4=Aircraft
	   2nd compartment (mail)
02h-03h: ? something like previous car in a train
04h-05h: number of the vehicle
06h-09h: pointer to the schedule of the vehicle in the schedule-array
0ah: Next station number
0bh: Next station commands, bit-coded (20h=unload, 40h=load, 80h=non-stop)
0ch: number of destinations
0dh: number of the next destionation (index into schedule array)
0eh-0fh: ?
10h-11h: load/unload time remaining
12h-13h: date of the last service
14h-15h: service interval
16h:    Last station visited
17h: ?
18h-19h: maximal speed in km/h
1ah-1bh: x position
1ch-1dh: y position
1eh:     z position (height)
1fh:  direction of the vehicle; from N over E to NW 00h-07h
20h:    delta x - how much x changes in one time step
21h:    delta y
22-24: ?
25:     owner
26h-27h: coordinate of the current field
28-33: ?
34h-35h: current speed in km/h
36: ?
37: acceleration (depends on power and weight)
38: ?
39h: kind of the load pieces
3ah-3bh: capacity
3ch-3dh: number of load pieces of something
3eh: source of the pieces (number of the station)
3f: ?
40h-41h: age in days
42h-43h: maximal age in days (365.24-day-years)
44h: year when it was built in years since 1920
45h: number of the train/road vehicle/ship/aircraft
46h: engine type
47-48: ?
49:  day counter. If modulo 8 is zero, vehicle's value is depreciated
4ah: number of breakdowns since last service
4bh: 01h if the vehicle has got a breakdown
4c-4d: ?
4eh-4fh: reliability; 4fh: percent * 2.58; 4eh says, when 4fh will turn to a
lower value the next time

Besser:
4eh: reliability counter; determines when reliability will decrease
4fh: current reliability; 255=100%

50h-51h: the speed in which the reliability goes down
52h-55h: profit this year
56h-59h: profit last year
5ah-5bh: number of the next vehicle (trains) or the other part (aircrafts);
if it's the last part, this is FFFFh
5ch-5fh: value (in pounds)
60h-61h: name of the vehicle; constant (6488h seems to mean train,
	genauer: index into "name" table, or default name
2B90h road vehicle, 3098h ship, 2FA0 aircraft); otherwise a pointer to the
name
62-65: ?
66: train type; 0=railroad, 1=monorail, 2=maglev
This was the last entry used. TTDPatch uses in addition:
7d: Train type repeated (used for train refitting)
7e: Real capacity (used for train refitting)

Depot-array:

00h-01h: coordinates of the depot-field
02h-03h: I don't know exactly what it means; a new built depot had CC06h
here; I include that value in my program and it runs; but in older/other
games, there are other values
04h-05h: 00 00h



schedule-array:

every destination has two bytes; after the last destination of a vehicle,
there is 00 00h

first bit: number of destination station

second byte:

upper four bits: = 01h => destination exists; 00h when only a number but no
name is display (I'm not quite sure about these bits any more)

bit 3 = 1 => non-stop
bit 2 = 1 => full load
bit 1 = 1 => unload
bit 0 = 0 => no further destinations



The station-array:

0h-01h: coordinates of the field with the station-name
06h-07h: coordinates of the bus-station
08h-09h: coordinates of the lorry-station
0Ah-0Bh: coordinates of the train-station
0Ch-0Dh: coordinates of the airport
0Eh-OFh: coordinates of the dock

06h-0Fh: if not there, 0000h; coordinates of the N-corner of the station

1Ch-7Bh: 12 * 8 Bytes goods:
in this 8 Bytes:
00h and lower 4 bits of 01h: number of waiting pieces
01h: if bit 7 set, then the good is accepted
03h: rating * 2.53 or 2.54
04h: if not FFh: has got a rating if not 00h: enroute from
sequence at the beginning: 00 00 00 AF FF 00 00 FFh

the order of the goods in temperate climate is:

passengers, coal, mail, oil, lifestock, goods, grain, wood, iron ore, steel,
valuables, unused

7Fh: owner of the station
82h: truck stop status. Bits 0,1 set=slot occupied. Bit 7=station busy
83h: bus stop status





Stations in the landscape-array:

L II: number of the station (=> station-array)
L III: railways: the type of the railway is in the upper byte
LV: typ of the field:

- bus-stations: exit NE: 47h; exit SE: 48h, exit SW: 49h, exit NW: 4Ah
- lorry-stations: exit NE: 43h; exit SE: 44h; exit SW: 45h; exit NW: 46h
- docks: land-part SW: 4Ch; land-part NW: 4Dh; land-part NE: 4Eh; land-part
SE: 4Fh
	       sea-part NE=>SW: 50h; sea-part NW=>SE: 51h
-airports: heliport: 42h

big airport:
   W 20 09 09 21 09 1Fh N
     0A 08 22 1D 24 1B
     15 14 0D 23 0B 1E
     1C 13 11 0E 0C 33
     2C 12 10 0F 0D 26
S   1A 19 18 17 16 1A E

small airport:

W 41 34 35 36 N
     37 38 39 3C
S   3E 3F 3F 40 E






Streets:

L II: 0 if field is plain, otherwise 1
L V: lower 4 bits: type of streets
bit 0: SE-part
bit 1: NE-part
bit 2: NW-part
bit 3: SW-part

if bit 4 is set, then the field is a road-railway-crossing:
then: if bit 3 is set, the railway goes from NE to SW, otherwise from NW to
SE
the type of the railway is in the LIII; upper byte
the owner of the NE=>SW-part is in the L I, the owner of the other part is
in the LIII; lower byte

if bit 5 is set, then on the field is a depot:

bit 0-1 = 00h => exit NE; 01h => exit SE; 02h=> exit SW; 03h=> exit NW


LV: upper 2 bits = 00h

=>

track, saved in the lower 6 bits:
bit 1=SW=>NE
bit 2=SE=>NW
bit 3=W=>E in the N corner
bit 4=W=>E in the S corner
bit 5=N=>S in the W corner
bit 6=N=>S in the E corner

LII: lower 4 bits = 00h => track on a cleared field
= 01h=> on grass
=02h=> in direction NE a fence is on the left side of the track
=03h=> in dir. NE a fence is on the right side of the track
=04h=> in dir. NE on both sides of the track is a fence
=05h=> in dir. NW a fence is on the left side of the track
=06h=> in dir.NW a fence is on the right side of the track
=07h=> in dir. NW on both sides of the track is a fence
= 08h,09h=> in dir. N=>S is a fence
=0Ah=>in dir. W=>E is a fence


in the LV, upper 2 bits = 01h: there is a signal

LIII: lower byte, upper four bits:with signal is set?
setting of the signal is saved in the L II; upper four bits

in the LV, upper 2 bits = 11h:  there is a depot

direction in the lower 2 bits: 00h=>exit NE; 01h=>exit SE; 02h=>exit  SW;
03h=>exit NW

L III; upper byte: type of the track (0 = standard railway; 1 =
one-track-railway; 2 = maglev)


bridges:

L I: owner of the bridge, if it's the north-ending; if it's a middle-part,
then this is the owner of the crossing road or railway
LII: upper 4 bits=type of the bridge; in the order of the
bridge-building-window in the game
LII: lower 4 bits= tpye of the piece of the bridge that is on the field
LIII: upper byte: if it's a railway-bridge: the type of the railway-tracks
is in the upper (if it's a middle-part) or in the lower (if it's a ending) 4
bits; if a railway is under the bridge; the lower 4 bits of that byte is the
type of this track
LV: Bit 0=1, if the bridge goes from NW to SE, otherwise 0
Bit 1 = 1 => road-bridge, otherwise railway-bridge
Bit 2: perhaps unused
Bit 3=0 => a railway is under the bridge
Bit 3=1 => a street is under the bridge, if bit 5 and 6 are set, if bit 5=0
and bit 6=1,then water is under the bridge
Bit 4: perhaps unused
Bit 5=1=> if bit 6 is set, then something is under the bridge, otherwise
it's the S-ending of a bridge
Bit 6=1=> it's a middle-part of a bridge, otherwise a ending
Bit 7=1 always!!!!




Tunnels:

L II: 00h
L III: if railway-tunnel, then type in the upper byte, otherwise 00 00h
LV: Bit 2 = 0 => railway-tunnel; otherwise road-tunnel
Bit 0-1: 00h => entrance in dir. NE
 01h=>entrance in dir. SE
02h => entrance in dir. SW
03h=> entrance in dir. NW

trees:

L I: always 10h
L II: 	If sand is under the tree:
		bits 7-5 set
	If snow is under the tree:
		bit 5 is set
		bits 7-6: amount of snow (0 - little snow, 3- tatally snowy)
	bit 4 is set if there is rough land under the tree
	bits 3-0: seem to be some kind of counter; it changes with time
L III: type of tree is in lower byte
		Tree types:
		00h-0Bh temperate trees
		0Ch-13h sub-arctic trees
		14h-1Fh tropical trees
		20h-28h toyland trees
L IV: the upper nibble (type) is 4 as stated above
L V:	bits 7-6: number of trees -1 (0..3)
	bits 3-0: growing state of one of the trees (only one can have non-default state)
		(0-smallest..3-normal..6-about to die)
