src/airport_movement.h
author rubidium
Tue, 07 Aug 2007 15:11:52 +0000
branchNewGRF_ports
changeset 6769 32594799d0bc
parent 6737 2b971fcc9a08
child 6818 8c977ca780fe
permissions -rw-r--r--
(svn r10819) [NewGRF_ports] -Codechange: remove a large amount of state machinery of the airports.
[NewGRF_ports] -Fix: compilation on gcc.
[NewGRF_ports] -Fix: AIs building "old" airports.
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     2
6443
b8f06d8eb7be (svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents: 6381
diff changeset
     3
/** @file airport_movement.h Heart of the airports and their finite state machines */
b8f06d8eb7be (svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents: 6381
diff changeset
     4
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#ifndef AIRPORT_MOVEMENT_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     6
#define AIRPORT_MOVEMENT_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
6715
ce1614834bc3 (svn r9507) [NewGRF_ports] -Codechange: Moved airport state definitions into their own separate file to permit better logical grouping of state machine related data & code.
richk
parents: 6574
diff changeset
     8
#include "airport_states.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     9
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
// state machine input struct (from external file, etc.)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    11
// Finite sTate mAchine --> FTA
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6551
diff changeset
    12
struct AirportFTAbuildup {
4842
0757e12896c5 (svn r6768) -Cleanup: For airports change *Airport to *apc (variable naming coding style
Darkvater
parents: 4344
diff changeset
    13
	byte position; // the position that an airplane is at
0757e12896c5 (svn r6768) -Cleanup: For airports change *Airport to *apc (variable naming coding style
Darkvater
parents: 4344
diff changeset
    14
	byte heading;  // the current orders (eg. TAKEOFF, HANGAR, ENDLANDING, etc.)
6321
62564548351b (svn r8705) -Codechange: Increased the number of airport blocks to 64. This involves changing the enum of airport blocks to a static const uint64 as SOME platforms do not support 64-bit enums
celestar
parents: 6175
diff changeset
    15
	uint64 block;  // the block this position is on on the airport (st->airport_flags)
4842
0757e12896c5 (svn r6768) -Cleanup: For airports change *Airport to *apc (variable naming coding style
Darkvater
parents: 4344
diff changeset
    16
	byte next;     // next position from this position
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6551
diff changeset
    17
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    18
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
///////////////////////////////////////////////////////////////////////
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
/////*********Movement Positions on Airports********************///////
6719
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6715
diff changeset
    21
6737
2b971fcc9a08 (svn r10682) [NewGRF_ports] -Feature: Added code to import FSM from within the newgrf, and allocate to compatible structures within Airport. Eventually, it will load to its own dedicated structures.
richk
parents: 6734
diff changeset
    22
static AirportMovingData _airport_moving_data_dummy[] = {
6769
32594799d0bc (svn r10819) [NewGRF_ports] -Codechange: remove a large amount of state machinery of the airports.
rubidium
parents: 6737
diff changeset
    23
	{    0,    0, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN,     {DIR_N}, 0, 0 },
32594799d0bc (svn r10819) [NewGRF_ports] -Codechange: remove a large amount of state machinery of the airports.
rubidium
parents: 6737
diff changeset
    24
	{    0,   96, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN,     {DIR_N}, 0, 0 },
32594799d0bc (svn r10819) [NewGRF_ports] -Codechange: remove a large amount of state machinery of the airports.
rubidium
parents: 6737
diff changeset
    25
	{   96,   96, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN,     {DIR_N}, 0, 0 },
32594799d0bc (svn r10819) [NewGRF_ports] -Codechange: remove a large amount of state machinery of the airports.
rubidium
parents: 6737
diff changeset
    26
	{   96,    0, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN,     {DIR_N}, 0, 0 },
4059
f1442dfe1c8a (svn r5346) - Feature: Add 4 new airports. 2 for aircraft, 2 for helicopters.
richk
parents: 3701
diff changeset
    27
};
f1442dfe1c8a (svn r5346) - Feature: Add 4 new airports. 2 for aircraft, 2 for helicopters.
richk
parents: 3701
diff changeset
    28
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    29
// Oilrig
6737
2b971fcc9a08 (svn r10682) [NewGRF_ports] -Feature: Added code to import FSM from within the newgrf, and allocate to compatible structures within Airport. Eventually, it will load to its own dedicated structures.
richk
parents: 6734
diff changeset
    30
static AirportMovingData _airport_moving_data_oilrig[9] = {
6769
32594799d0bc (svn r10819) [NewGRF_ports] -Codechange: remove a large amount of state machinery of the airports.
rubidium
parents: 6737
diff changeset
    31
	{   31,    9, 0, AMED_EXACTPOS,                   {DIR_NE}, 0, 0 }, // 0 - At oilrig terminal
32594799d0bc (svn r10819) [NewGRF_ports] -Codechange: remove a large amount of state machinery of the airports.
rubidium
parents: 6737
diff changeset
    32
	{   28,    9, 0, AMED_HELI_RAISE,                 {DIR_N}, 0, 0 }, // 1 - Take off (play sound)
32594799d0bc (svn r10819) [NewGRF_ports] -Codechange: remove a large amount of state machinery of the airports.
rubidium
parents: 6737
diff changeset
    33
	{   23,    9, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N}, 0, 0 }, // 2 - In position above landing spot helicopter
32594799d0bc (svn r10819) [NewGRF_ports] -Codechange: remove a large amount of state machinery of the airports.
rubidium
parents: 6737
diff changeset
    34
	{   23,    9, 0, AMED_HELI_LOWER,                 {DIR_N}, 0, 0 }, // 3 - Land
32594799d0bc (svn r10819) [NewGRF_ports] -Codechange: remove a large amount of state machinery of the airports.
rubidium
parents: 6737
diff changeset
    35
	{   28,    9, 0, 0,                               {DIR_N}, 0, 0 }, // 4 - Goto terminal on ground
32594799d0bc (svn r10819) [NewGRF_ports] -Codechange: remove a large amount of state machinery of the airports.
rubidium
parents: 6737
diff changeset
    36
	{  -31,   69, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N}, 0, 0 }, // 5 - circle #1 (north-east)
32594799d0bc (svn r10819) [NewGRF_ports] -Codechange: remove a large amount of state machinery of the airports.
rubidium
parents: 6737
diff changeset
    37
	{  -31,  -49, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N}, 0, 0 }, // 6 - circle #2 (north-west)
32594799d0bc (svn r10819) [NewGRF_ports] -Codechange: remove a large amount of state machinery of the airports.
rubidium
parents: 6737
diff changeset
    38
	{   69,  -49, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N}, 0, 0 }, // 7 - circle #3 (south-west)
32594799d0bc (svn r10819) [NewGRF_ports] -Codechange: remove a large amount of state machinery of the airports.
rubidium
parents: 6737
diff changeset
    39
	{   69,    9, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N}, 0, 0 }, // 8 - circle #4 (south)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    40
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    41
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    42
///////////////////////////////////////////////////////////////////////
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    43
/////**********Movement Machine on Airports*********************///////
6737
2b971fcc9a08 (svn r10682) [NewGRF_ports] -Feature: Added code to import FSM from within the newgrf, and allocate to compatible structures within Airport. Eventually, it will load to its own dedicated structures.
richk
parents: 6734
diff changeset
    44
static byte _airport_entries_dummy[] = {0, 1, 2, 3};
2b971fcc9a08 (svn r10682) [NewGRF_ports] -Feature: Added code to import FSM from within the newgrf, and allocate to compatible structures within Airport. Eventually, it will load to its own dedicated structures.
richk
parents: 6734
diff changeset
    45
static AirportFTAbuildup _airport_fta_dummy[] = {
6719
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6715
diff changeset
    46
	{ 0, 0, 0, 3},
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6715
diff changeset
    47
	{ 1, 0, 0, 0},
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6715
diff changeset
    48
	{ 2, 0, 0, 1},
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6715
diff changeset
    49
	{ 3, 0, 0, 2},
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6715
diff changeset
    50
	{ MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6715
diff changeset
    51
};
4cc327ad39d5 (svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents: 6715
diff changeset
    52
699
02b8b9c9194f (svn r1149) Fix hack which abuses first TileIndex of airport depot array as number of depots (similar change as in map branch)
tron
parents: 179
diff changeset
    53
// heliports, oilrigs don't have depots
6737
2b971fcc9a08 (svn r10682) [NewGRF_ports] -Feature: Added code to import FSM from within the newgrf, and allocate to compatible structures within Airport. Eventually, it will load to its own dedicated structures.
richk
parents: 6734
diff changeset
    54
static byte _airport_helipad_heliport_oilrig[] = { 1, 1 };
2b971fcc9a08 (svn r10682) [NewGRF_ports] -Feature: Added code to import FSM from within the newgrf, and allocate to compatible structures within Airport. Eventually, it will load to its own dedicated structures.
richk
parents: 6734
diff changeset
    55
static byte _airport_entries_heliport_oilrig[] = { 7, 7, 7, 7 };
2b971fcc9a08 (svn r10682) [NewGRF_ports] -Feature: Added code to import FSM from within the newgrf, and allocate to compatible structures within Airport. Eventually, it will load to its own dedicated structures.
richk
parents: 6734
diff changeset
    56
static AirportFTAbuildup _airport_fta_heliport_oilrig[] = {
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4059
diff changeset
    57
	{ 0, HELIPAD1, HELIPAD1_block, 1 },
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4059
diff changeset
    58
	{ 1, HELITAKEOFF, NOTHING_block, 0 }, // takeoff
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4059
diff changeset
    59
	{ 2, 255, AIRPORT_BUSY_block, 0 }, { 2, HELILANDING, 0, 3 }, { 2, HELITAKEOFF, 0, 1 },
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4059
diff changeset
    60
	{ 3, HELILANDING, AIRPORT_BUSY_block, 4 },
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4059
diff changeset
    61
	{ 4, HELIENDLANDING, AIRPORT_BUSY_block, 4 }, { 4, HELIPAD1, HELIPAD1_block, 0 }, { 4, HELITAKEOFF, 0, 2 },
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    62
	// In Air
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4059
diff changeset
    63
	{ 5, 0, NOTHING_block, 6 },
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4059
diff changeset
    64
	{ 6, 0, NOTHING_block, 7 },
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4059
diff changeset
    65
	{ 7, 0, NOTHING_block, 8 },
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4059
diff changeset
    66
	{ 8, FLYING, NOTHING_block, 5 }, { 8, HELILANDING, HELIPAD1_block, 2 }, // landing
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4059
diff changeset
    67
	{ MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    68
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    69
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    70
#endif /* AIRPORT_MOVEMENT_H */