(svn r3135) Use symbolic names in the tables, which hold the information about accepted goods of industry tiles, instead of magic numbers

This commit is contained in:
tron 2005-11-04 16:12:48 +00:00
parent a21762980d
commit d42b7649a4
2 changed files with 135 additions and 73 deletions

View File

@ -411,16 +411,16 @@ static uint GetSlopeTileh_Industry(const TileInfo* ti)
static void GetAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac) static void GetAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac)
{ {
int m5 = _m[tile].m5; int m5 = _m[tile].m5;
int a; CargoID a;
a = _industry_map5_accepts_1[m5]; a = _industry_map5_accepts_1[m5];
if (a >= 0) ac[a] = (a == 0) ? 1 : 8; if (a != CT_INVALID) ac[a] = (a == 0) ? 1 : 8;
a = _industry_map5_accepts_2[m5]; a = _industry_map5_accepts_2[m5];
if (a >= 0) ac[a] = 8; if (a != CT_INVALID) ac[a] = 8;
a = _industry_map5_accepts_3[m5]; a = _industry_map5_accepts_3[m5];
if (a >= 0) ac[a] = 8; if (a != CT_INVALID) ac[a] = 8;
} }
static void GetTileDesc_Industry(TileIndex tile, TileDesc *td) static void GetTileDesc_Industry(TileIndex tile, TileDesc *td)

View File

@ -1190,78 +1190,140 @@ static const byte * const _industry_create_table[4] = {
}; };
static const int8 _industry_map5_accepts_1[] = { #define PAS CT_PASSENGERS
-1, -1, -1, 0, -1, -1, -1, -1,
0, -1, -1, 0, 0, 0, -1, -1, #define COL CT_COAL
-1, -1, -1, -1, -1, -1, -1, 0, #define RUB CT_RUBBER
-1, -1, -1, -1, -1, -1, -1, -1, #define SUG CT_SUGAR
-1, 0, 0, -1, -1, -1, -1, 6,
6, 6, 6, -1, -1, -1, -1, -1, #define MAL CT_MAIL
-1, -1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 6, 6, 6, 6, #define OIL CT_OIL
-1, -1, -1, -1, -1, -1, -1, -1, #define TOY CT_TOYS
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, #define LIV CT_LIVESTOCK // Fruit too
-1, -1, -1, -1, -1, -1, -1, -1, #define BAT CT_BATTERIES
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, #define GRA CT_GRAIN
-1, -1, -1, -1, -1, -1, -1, -1, #define WHT CT_WHEAT // Maize too
-1, 8, 8, 8, 8, -1, -1, -1, #define TOF CT_TOFFEE
-1, -1, -1, 8, 8, 8, 8, -1,
-1, -1, -1, -1, -1, -1, 4, 4, #define WOD CT_WOOD
4, 4, 4, 4, -1, -1, -1, -1, #define CLA CT_COLA
-1, -1, -1, -1, 9, 9, 9, 9,
-1, -1, -1, -1, -1, -1, -1, -1, #define IRN CT_IRON_ORE
-1, -1, -1, -1, -1, -1, -1, #define COP CT_COPPER_ORE
#define CCY CT_COTTON_CANDY
#define STL CT_STEEL
#define PAP CT_PAPER
#define WAT CT_WATER
#define BBL CT_BUBBLES
#define VAL CT_VALUABLES
#define GLD CT_GOLD // Diamonds too
#define PLC CT_PLASTIC
#define INV CT_INVALID
static const CargoID _industry_map5_accepts_1[] = {
INV, INV, INV, PAS, INV, INV, INV, INV,
PAS, INV, INV, PAS, PAS, PAS, INV, INV,
INV, INV, INV, INV, INV, INV, INV, PAS,
INV, INV, INV, INV, INV, INV, INV, INV,
INV, PAS, PAS, INV, INV, INV, INV, GRA,
GRA, GRA, GRA, INV, INV, INV, INV, INV,
INV, INV, PAS, PAS, PAS, PAS, PAS, PAS,
PAS, PAS, PAS, PAS, WHT, WHT, WHT, WHT,
INV, INV, INV, INV, INV, INV, INV, INV,
INV, INV, INV, INV, INV, INV, INV, INV,
INV, INV, INV, INV, INV, INV, INV, INV,
INV, INV, INV, INV, INV, INV, INV, INV,
INV, INV, INV, INV, INV, INV, INV, INV,
INV, INV, INV, INV, INV, INV, INV, INV,
INV, INV, INV, INV, INV, INV, INV, INV,
INV, COP, COP, COP, COP, INV, INV, INV,
INV, INV, INV, CCY, CCY, CCY, CCY, INV,
INV, INV, INV, INV, INV, INV, BAT, BAT,
BAT, BAT, BAT, BAT, INV, INV, INV, INV,
INV, INV, INV, INV, BBL, BBL, BBL, BBL,
INV, INV, INV, INV, INV, INV, INV, INV,
INV, INV, INV, INV, INV, INV, INV
}; };
static const int8 _industry_map5_accepts_2[] = { static const CargoID _industry_map5_accepts_2[] = {
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, 9, INV, INV, INV, INV, INV, INV, INV, STL,
9, 9, 9, -1, -1, -1, -1, -1, STL, STL, STL, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, 7, 7, 7, 7, -1, -1, -1, INV, WOD, WOD, WOD, WOD, INV, INV, INV,
-1, -1, -1, 6, 6, 6, 6, -1, INV, INV, INV, TOF, TOF, TOF, TOF, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV
}; };
static const int8 _industry_map5_accepts_3[] = { static const CargoID _industry_map5_accepts_3[] = {
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
1, -1, -1, -1, -1, 7, -1, -1, COL, INV, INV, INV, INV, WOD, INV, INV,
-1, -1, -1, -1, 3, -1, -1, -1, INV, INV, INV, INV, OIL, INV, INV, INV,
0, 2, -1, -1, -1, -1, -1, -1, PAS, MAL, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, 4, INV, INV, INV, INV, INV, INV, INV, LIV,
4, 4, 4, 9, 9, 9, 9, -1, LIV, LIV, LIV, PAP, PAP, PAP, PAP, INV,
-1, -1, -1, -1, 8, 8, 8, 8, INV, INV, INV, INV, IRN, IRN, IRN, IRN,
8, 8, 10, 10, 4, 4, 4, 4, IRN, IRN, VAL, VAL, LIV, LIV, LIV, LIV,
7, 7, 7, 7, 7, 7, 7, 7, WOD, WOD, WOD, WOD, WOD, WOD, WOD, WOD,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, 10, 10, -1, -1, -1, -1, -1, INV, GLD, GLD, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
9, 1, 1, 1, 1, -1, -1, -1, WAT, RUB, RUB, RUB, RUB, INV, INV, INV,
-1, -1, -1, 1, 1, 1, 1, -1, INV, INV, INV, SUG, SUG, SUG, SUG, INV,
-1, -1, 3, 3, 3, 3, 10, 10, INV, INV, TOY, TOY, TOY, TOY, PLC, PLC,
10, 10, 10, 10, -1, -1, -1, -1, PLC, PLC, PLC, PLC, INV, INV, INV, INV,
-1, -1, -1, -1, 7, 7, 7, 7, INV, INV, INV, INV, CLA, CLA, CLA, CLA,
-1, -1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV, INV,
-1, -1, -1, -1, -1, -1, -1, INV, INV, INV, INV, INV, INV, INV
}; };
#undef PAS
#undef COL
#undef RUB
#undef SUG
#undef MAL
#undef OIL
#undef TOY
#undef LIV
#undef BAT
#undef GRA
#undef WHT
#undef TOF
#undef WOD
#undef CLA
#undef IRN
#undef COP
#undef CCY
#undef STL
#undef PAP
#undef WAT
#undef BBL
#undef VAL
#undef GLD
#undef PLC
#undef INV