annotate src/industrytype.h @ 18746:6f51fce90722 draft

(svn r23594) -Codechange: follow coding style with multi line comments
author rubidium <rubidium@openttd.org>
date Mon, 19 Dec 2011 17:40:54 +0000
parents 5604c42fa1ce
children 9e25a152f92d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
1 /* $Id$ */
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
2
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
3 /*
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
4 * This file is part of OpenTTD.
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
8 */
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
9
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
10 /** @file industrytype.h Industry type specs. */
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
11
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
12 #ifndef INDUSTRYTYPE_H
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
13 #define INDUSTRYTYPE_H
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
14
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
15 #include "economy_type.h"
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
16 #include "map_type.h"
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
17 #include "slope_type.h"
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
18 #include "industry_type.h"
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
19 #include "landscape_type.h"
14258
a899d4e5ee1a (svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header
rubidium <rubidium@openttd.org>
parents: 14021
diff changeset
20 #include "strings_type.h"
a899d4e5ee1a (svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header
rubidium <rubidium@openttd.org>
parents: 14021
diff changeset
21 #include "cargo_type.h"
15935
a4fa352275f4 (svn r20623) -Codechange: unify the storing of animation related information
rubidium <rubidium@openttd.org>
parents: 15731
diff changeset
22 #include "newgrf_animation_type.h"
14616
3b8f660a561d (svn r19193) -Codechange: increase the maximum number of airport tiles to 256 and introduce AirportTileOverrideManager
yexo <yexo@openttd.org>
parents: 14565
diff changeset
23 #include "newgrf_commons.h"
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
24
15183
43a5d37b45c4 (svn r19812) -Codechange: give some unnamed enums a name or, in case they consisted of unrelated values use static const (u)int
rubidium <rubidium@openttd.org>
parents: 14923
diff changeset
25 enum IndustryCleanupType {
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
26 CLEAN_RANDOMSOUNDS, ///< Free the dynamically allocated sounds table
14492
aaf7de90045e (svn r19063) -Codechange: type in constant name (andythenorth)
yexo <yexo@openttd.org>
parents: 14484
diff changeset
27 CLEAN_TILELAYOUT, ///< Free the dynamically allocated tile layout structure
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
28 };
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
29
14565
14cb34302cfe (svn r19136) -Doc: Added Doxygen comments for industry checking procedures.
alberth <alberth@openttd.org>
parents: 14492
diff changeset
30 /** Available types of industry lifetimes. */
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
31 enum IndustryLifeType {
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
32 INDUSTRYLIFE_BLACK_HOLE = 0, ///< Like power plants and banks
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
33 INDUSTRYLIFE_EXTRACTIVE = 1 << 0, ///< Like mines
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
34 INDUSTRYLIFE_ORGANIC = 1 << 1, ///< Like forests
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
35 INDUSTRYLIFE_PROCESSING = 1 << 2, ///< Like factories
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
36 };
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
37
15620
f8e9a3f0c140 (svn r20283) -Codechange: Unify start of doygen comments.
frosch <frosch@openttd.org>
parents: 15183
diff changeset
38 /**
f8e9a3f0c140 (svn r20283) -Codechange: Unify start of doygen comments.
frosch <frosch@openttd.org>
parents: 15183
diff changeset
39 * Available procedures to check whether an industry may build at a given location.
14565
14cb34302cfe (svn r19136) -Doc: Added Doxygen comments for industry checking procedures.
alberth <alberth@openttd.org>
parents: 14492
diff changeset
40 * @see CheckNewIndustryProc, _check_new_industry_procs[]
14cb34302cfe (svn r19136) -Doc: Added Doxygen comments for industry checking procedures.
alberth <alberth@openttd.org>
parents: 14492
diff changeset
41 */
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
42 enum CheckProc {
14565
14cb34302cfe (svn r19136) -Doc: Added Doxygen comments for industry checking procedures.
alberth <alberth@openttd.org>
parents: 14492
diff changeset
43 CHECK_NOTHING, ///< Always succeeds.
14cb34302cfe (svn r19136) -Doc: Added Doxygen comments for industry checking procedures.
alberth <alberth@openttd.org>
parents: 14492
diff changeset
44 CHECK_FOREST, ///< %Industry should be build above snow-line in arctic climate.
14cb34302cfe (svn r19136) -Doc: Added Doxygen comments for industry checking procedures.
alberth <alberth@openttd.org>
parents: 14492
diff changeset
45 CHECK_REFINERY, ///< %Industry should be positioned near edge of the map.
14cb34302cfe (svn r19136) -Doc: Added Doxygen comments for industry checking procedures.
alberth <alberth@openttd.org>
parents: 14492
diff changeset
46 CHECK_FARM, ///< %Industry should be below snow-line in arctic.
14cb34302cfe (svn r19136) -Doc: Added Doxygen comments for industry checking procedures.
alberth <alberth@openttd.org>
parents: 14492
diff changeset
47 CHECK_PLANTATION, ///< %Industry should NOT be in the desert.
14cb34302cfe (svn r19136) -Doc: Added Doxygen comments for industry checking procedures.
alberth <alberth@openttd.org>
parents: 14492
diff changeset
48 CHECK_WATER, ///< %Industry should be in the desert.
14cb34302cfe (svn r19136) -Doc: Added Doxygen comments for industry checking procedures.
alberth <alberth@openttd.org>
parents: 14492
diff changeset
49 CHECK_LUMBERMILL, ///< %Industry should be in the rain forest.
14cb34302cfe (svn r19136) -Doc: Added Doxygen comments for industry checking procedures.
alberth <alberth@openttd.org>
parents: 14492
diff changeset
50 CHECK_BUBBLEGEN, ///< %Industry should be in low land.
14cb34302cfe (svn r19136) -Doc: Added Doxygen comments for industry checking procedures.
alberth <alberth@openttd.org>
parents: 14492
diff changeset
51 CHECK_OIL_RIG, ///< Industries at sea should be positioned near edge of the map.
14cb34302cfe (svn r19136) -Doc: Added Doxygen comments for industry checking procedures.
alberth <alberth@openttd.org>
parents: 14492
diff changeset
52 CHECK_END, ///< End marker of the industry check procedures.
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
53 };
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
54
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
55 /** How was the industry created */
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
56 enum IndustryConstructionType {
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
57 ICT_UNKNOWN, ///< in previous game version or without newindustries activated
16541
9da0e640ebb8 (svn r21267) -Doc: Typo fixes.
alberth <alberth@openttd.org>
parents: 16154
diff changeset
58 ICT_NORMAL_GAMEPLAY, ///< either by user or random creation process
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
59 ICT_MAP_GENERATION, ///< during random map creation
16541
9da0e640ebb8 (svn r21267) -Doc: Typo fixes.
alberth <alberth@openttd.org>
parents: 16154
diff changeset
60 ICT_SCENARIO_EDITOR ///< while editing a scenario
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
61 };
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
62
14484
24501a41ea9a (svn r19053) -Codechange: Add an enum for the special flags of industry tiles. (based on andythenorth' work)
frosch <frosch@openttd.org>
parents: 14258
diff changeset
63 /** Various industry behaviours mostly to represent original TTD specialities */
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
64 enum IndustryBehaviour {
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
65 INDUSTRYBEH_NONE = 0,
16541
9da0e640ebb8 (svn r21267) -Doc: Typo fixes.
alberth <alberth@openttd.org>
parents: 16154
diff changeset
66 INDUSTRYBEH_PLANT_FIELDS = 1 << 0, ///< periodically plants fields around itself (temp and arctic farms)
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
67 INDUSTRYBEH_CUT_TREES = 1 << 1, ///< cuts trees and produce first output cargo from them (lumber mill)
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
68 INDUSTRYBEH_BUILT_ONWATER = 1 << 2, ///< is built on water (oil rig)
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
69 INDUSTRYBEH_TOWN1200_MORE = 1 << 3, ///< can only be built in towns larger than 1200 inhabitants (temperate bank)
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
70 INDUSTRYBEH_ONLY_INTOWN = 1 << 4, ///< can only be built in towns (arctic/tropic banks, water tower)
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
71 INDUSTRYBEH_ONLY_NEARTOWN = 1 << 5, ///< is always built near towns (toy shop)
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
72 INDUSTRYBEH_PLANT_ON_BUILT = 1 << 6, ///< Fields are planted around when built (all farms)
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
73 INDUSTRYBEH_DONT_INCR_PROD = 1 << 7, ///< do not increase production (oil wells) in the temperate climate
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
74 INDUSTRYBEH_BEFORE_1950 = 1 << 8, ///< can only be built before 1950 (oil wells)
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
75 INDUSTRYBEH_AFTER_1960 = 1 << 9, ///< can only be built after 1960 (oil rigs)
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
76 INDUSTRYBEH_AI_AIRSHIP_ROUTES = 1 << 10, ///< ai will attempt to establish air/ship routes to this industry (oil rig)
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
77 INDUSTRYBEH_AIRPLANE_ATTACKS = 1 << 11, ///< can be exploded by a military airplane (oil refinery)
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
78 INDUSTRYBEH_CHOPPER_ATTACKS = 1 << 12, ///< can be exploded by a military helicopter (factory)
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
79 INDUSTRYBEH_CAN_SUBSIDENCE = 1 << 13, ///< can cause a subsidence (coal mine, shaft that collapses)
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
80 /* The following flags are only used for newindustries and do no represent any normal behaviour */
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
81 INDUSTRYBEH_PROD_MULTI_HNDLING = 1 << 14, ///< Automatic production multiplier handling
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
82 INDUSTRYBEH_PRODCALLBACK_RANDOM = 1 << 15, ///< Production callback needs random bits in var 10
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
83 INDUSTRYBEH_NOBUILT_MAPCREATION = 1 << 16, ///< Do not force one instance of this type to appear on map generation
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
84 INDUSTRYBEH_CANCLOSE_LASTINSTANCE = 1 << 17, ///< Allow closing down the last instance of this type
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
85 };
14910
bd99e52e5aa2 (svn r19507) -Codechange: remove semicolon after DECLARE_POSTFIX_INCREMENT and DECLARE_ENUM_AS_BIT_SET
smatz <smatz@openttd.org>
parents: 14885
diff changeset
86 DECLARE_ENUM_AS_BIT_SET(IndustryBehaviour)
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
87
14484
24501a41ea9a (svn r19053) -Codechange: Add an enum for the special flags of industry tiles. (based on andythenorth' work)
frosch <frosch@openttd.org>
parents: 14258
diff changeset
88 /** Flags for miscellaneous industry tile specialities */
24501a41ea9a (svn r19053) -Codechange: Add an enum for the special flags of industry tiles. (based on andythenorth' work)
frosch <frosch@openttd.org>
parents: 14258
diff changeset
89 enum IndustryTileSpecialFlags {
24501a41ea9a (svn r19053) -Codechange: Add an enum for the special flags of industry tiles. (based on andythenorth' work)
frosch <frosch@openttd.org>
parents: 14258
diff changeset
90 INDTILE_SPECIAL_NONE = 0,
24501a41ea9a (svn r19053) -Codechange: Add an enum for the special flags of industry tiles. (based on andythenorth' work)
frosch <frosch@openttd.org>
parents: 14258
diff changeset
91 INDTILE_SPECIAL_NEXTFRAME_RANDOMBITS = 1 << 0, ///< Callback 0x26 needs random bits
24501a41ea9a (svn r19053) -Codechange: Add an enum for the special flags of industry tiles. (based on andythenorth' work)
frosch <frosch@openttd.org>
parents: 14258
diff changeset
92 };
14910
bd99e52e5aa2 (svn r19507) -Codechange: remove semicolon after DECLARE_POSTFIX_INCREMENT and DECLARE_ENUM_AS_BIT_SET
smatz <smatz@openttd.org>
parents: 14885
diff changeset
93 DECLARE_ENUM_AS_BIT_SET(IndustryTileSpecialFlags)
14484
24501a41ea9a (svn r19053) -Codechange: Add an enum for the special flags of industry tiles. (based on andythenorth' work)
frosch <frosch@openttd.org>
parents: 14258
diff changeset
94
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
95 struct IndustryTileTable {
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
96 TileIndexDiffC ti;
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
97 IndustryGfx gfx;
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
98 };
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
99
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
100 /**
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
101 * Defines the data structure for constructing industry.
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
102 */
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
103 struct IndustrySpec {
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
104 const IndustryTileTable * const *table;///< List of the tiles composing the industry
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
105 byte num_table; ///< Number of elements in the table
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
106 uint8 cost_multiplier; ///< Base construction cost multiplier.
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
107 uint32 removal_cost_multiplier; ///< Base removal cost multiplier.
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
108 uint32 prospecting_chance; ///< Chance prospecting succeeds
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
109 IndustryType conflicting[3]; ///< Industries this industry cannot be close to
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
110 byte check_proc; ///< Index to a procedure to check for conflicting circumstances
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
111 CargoID produced_cargo[2];
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
112 byte production_rate[2];
18746
6f51fce90722 (svn r23594) -Codechange: follow coding style with multi line comments
rubidium <rubidium@openttd.org>
parents: 18678
diff changeset
113 /**
6f51fce90722 (svn r23594) -Codechange: follow coding style with multi line comments
rubidium <rubidium@openttd.org>
parents: 18678
diff changeset
114 * minimum amount of cargo transported to the stations.
6f51fce90722 (svn r23594) -Codechange: follow coding style with multi line comments
rubidium <rubidium@openttd.org>
parents: 18678
diff changeset
115 * If the waiting cargo is less than this number, no cargo is moved to it.
6f51fce90722 (svn r23594) -Codechange: follow coding style with multi line comments
rubidium <rubidium@openttd.org>
parents: 18678
diff changeset
116 */
6f51fce90722 (svn r23594) -Codechange: follow coding style with multi line comments
rubidium <rubidium@openttd.org>
parents: 18678
diff changeset
117 byte minimal_cargo;
6f51fce90722 (svn r23594) -Codechange: follow coding style with multi line comments
rubidium <rubidium@openttd.org>
parents: 18678
diff changeset
118 CargoID accepts_cargo[3]; ///< 3 accepted cargoes.
18678
5604c42fa1ce (svn r23526) -Codechange: unify cargos vs cargoes
rubidium <rubidium@openttd.org>
parents: 17108
diff changeset
119 uint16 input_cargo_multiplier[3][2]; ///< Input cargo multipliers (multiply amount of incoming cargo for the produced cargoes)
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
120 IndustryLifeType life_type; ///< This is also known as Industry production flag, in newgrf specs
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
121 byte climate_availability; ///< Bitmask, giving landscape enums as bit position
18678
5604c42fa1ce (svn r23526) -Codechange: unify cargos vs cargoes
rubidium <rubidium@openttd.org>
parents: 17108
diff changeset
122 IndustryBehaviour behaviour; ///< How this industry will behave, and how others entities can use it
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
123 byte map_colour; ///< colour used for the small map
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
124 StringID name; ///< Displayed name of the industry
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
125 StringID new_industry_text; ///< Message appearing when the industry is built
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
126 StringID closure_text; ///< Message appearing when the industry closes
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
127 StringID production_up_text; ///< Message appearing when the industry's production is increasing
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
128 StringID production_down_text; ///< Message appearing when the industry's production is decreasing
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
129 StringID station_name; ///< Default name for nearby station
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
130 byte appear_ingame[NUM_LANDSCAPE]; ///< Probability of appearance in game
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
131 byte appear_creation[NUM_LANDSCAPE]; ///< Probability of appearance during map creation
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
132 uint8 number_of_sounds; ///< Number of sounds available in the sounds array
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
133 const uint8 *random_sounds; ///< array of random sounds.
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
134 /* Newgrf data */
13036
8e2a0e8fa275 (svn r17534) -Codechange: unify the naming of callback masks/flags
rubidium <rubidium@openttd.org>
parents: 12825
diff changeset
135 uint16 callback_mask; ///< Bitmask of industry callbacks that have to be called
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
136 uint8 cleanup_flag; ///< flags indicating which data should be freed upon cleaning up
16541
9da0e640ebb8 (svn r21267) -Doc: Typo fixes.
alberth <alberth@openttd.org>
parents: 16154
diff changeset
137 bool enabled; ///< entity still available (by default true).newgrf can disable it, though
9da0e640ebb8 (svn r21267) -Doc: Typo fixes.
alberth <alberth@openttd.org>
parents: 16154
diff changeset
138 GRFFileProps grf_prop; ///< properties related to the grf file
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
139
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
140 bool IsRawIndustry() const;
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
141 Money GetConstructionCost() const;
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
142 Money GetRemovalCost() const;
16154
29354dbd86d4 (svn r20850) -Codechange: Add IndustrySpec::UsesSmoothEconomy() to deduplicate code.
frosch <frosch@openttd.org>
parents: 15935
diff changeset
143 bool UsesSmoothEconomy() const;
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
144 };
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
145
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
146 /**
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
147 * Defines the data structure of each indivudual tile of an industry.
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
148 */
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
149 struct IndustryTileSpec {
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
150 CargoID accepts_cargo[3]; ///< Cargo accepted by this tile
16541
9da0e640ebb8 (svn r21267) -Doc: Typo fixes.
alberth <alberth@openttd.org>
parents: 16154
diff changeset
151 uint8 acceptance[3]; ///< Level of acceptance per cargo type
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
152 Slope slopes_refused; ///< slope pattern on which this tile cannot be built
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
153 byte anim_production; ///< Animation frame to start when goods are produced
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
154 byte anim_next; ///< Next frame in an animation
18746
6f51fce90722 (svn r23594) -Codechange: follow coding style with multi line comments
rubidium <rubidium@openttd.org>
parents: 18678
diff changeset
155 /**
6f51fce90722 (svn r23594) -Codechange: follow coding style with multi line comments
rubidium <rubidium@openttd.org>
parents: 18678
diff changeset
156 * When true, the tile has to be drawn using the animation
6f51fce90722 (svn r23594) -Codechange: follow coding style with multi line comments
rubidium <rubidium@openttd.org>
parents: 18678
diff changeset
157 * state instead of the construction state
6f51fce90722 (svn r23594) -Codechange: follow coding style with multi line comments
rubidium <rubidium@openttd.org>
parents: 18678
diff changeset
158 */
6f51fce90722 (svn r23594) -Codechange: follow coding style with multi line comments
rubidium <rubidium@openttd.org>
parents: 18678
diff changeset
159 bool anim_state;
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
160 /* Newgrf data */
13036
8e2a0e8fa275 (svn r17534) -Codechange: unify the naming of callback masks/flags
rubidium <rubidium@openttd.org>
parents: 12825
diff changeset
161 uint8 callback_mask; ///< Bitmask of industry tile callbacks that have to be called
15935
a4fa352275f4 (svn r20623) -Codechange: unify the storing of animation related information
rubidium <rubidium@openttd.org>
parents: 15731
diff changeset
162 AnimationInfo animation; ///< Information about the animation (is it looping, how many loops etc)
14484
24501a41ea9a (svn r19053) -Codechange: Add an enum for the special flags of industry tiles. (based on andythenorth' work)
frosch <frosch@openttd.org>
parents: 14258
diff changeset
163 IndustryTileSpecialFlags special_flags; ///< Bitmask of extra flags used by the tile
16541
9da0e640ebb8 (svn r21267) -Doc: Typo fixes.
alberth <alberth@openttd.org>
parents: 16154
diff changeset
164 bool enabled; ///< entity still available (by default true).newgrf can disable it, though
9da0e640ebb8 (svn r21267) -Doc: Typo fixes.
alberth <alberth@openttd.org>
parents: 16154
diff changeset
165 GRFFileProps grf_prop; ///< properties related to the grf file
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
166 };
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
167
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
168 /* industry_cmd.cpp*/
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
169 const IndustrySpec *GetIndustrySpec(IndustryType thistype); ///< Array of industries data
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
170 const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx); ///< Array of industry tiles data
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
171 void ResetIndustries();
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
172
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
173 /* writable arrays of specs */
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
174 extern IndustrySpec _industry_specs[NUM_INDUSTRYTYPES];
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
175 extern IndustryTileSpec _industry_tile_specs[NUM_INDUSTRYTILES];
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
176
14923
c9d12cddf23f (svn r19521) -Codechange: Use a IndustryType array to sort industries by name instead of a LegendAndColour array.
terkhen <terkhen@openttd.org>
parents: 14910
diff changeset
177 /* industry_gui.cpp */
c9d12cddf23f (svn r19521) -Codechange: Use a IndustryType array to sort industries by name instead of a LegendAndColour array.
terkhen <terkhen@openttd.org>
parents: 14910
diff changeset
178 void SortIndustryTypes();
c9d12cddf23f (svn r19521) -Codechange: Use a IndustryType array to sort industries by name instead of a LegendAndColour array.
terkhen <terkhen@openttd.org>
parents: 14910
diff changeset
179 /* Industry types sorted alphabetically by name. */
c9d12cddf23f (svn r19521) -Codechange: Use a IndustryType array to sort industries by name instead of a LegendAndColour array.
terkhen <terkhen@openttd.org>
parents: 14910
diff changeset
180 extern IndustryType _sorted_industry_types[NUM_INDUSTRYTYPES];
c9d12cddf23f (svn r19521) -Codechange: Use a IndustryType array to sort industries by name instead of a LegendAndColour array.
terkhen <terkhen@openttd.org>
parents: 14910
diff changeset
181
14021
53eee9df97d5 (svn r18563) -Document: some industry related functions
rubidium <rubidium@openttd.org>
parents: 13757
diff changeset
182 /**
53eee9df97d5 (svn r18563) -Document: some industry related functions
rubidium <rubidium@openttd.org>
parents: 13757
diff changeset
183 * Do industry gfx ID translation for NewGRFs.
53eee9df97d5 (svn r18563) -Document: some industry related functions
rubidium <rubidium@openttd.org>
parents: 13757
diff changeset
184 * @param gfx the type to get the override for.
53eee9df97d5 (svn r18563) -Document: some industry related functions
rubidium <rubidium@openttd.org>
parents: 13757
diff changeset
185 * @return the gfx to actually work with.
53eee9df97d5 (svn r18563) -Document: some industry related functions
rubidium <rubidium@openttd.org>
parents: 13757
diff changeset
186 */
12825
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
187 static inline IndustryGfx GetTranslatedIndustryTileID(IndustryGfx gfx)
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
188 {
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
189 /* the 0xFF should be GFX_WATERTILE_SPECIALCHECK but for reasons of include mess,
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
190 * we'll simplify the writing.
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
191 * Basically, the first test is required since the GFX_WATERTILE_SPECIALCHECK value
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
192 * will never be assigned as a tile index and is only required in order to do some
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
193 * tests while building the industry (as in WATER REQUIRED */
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
194 if (gfx != 0xFF) {
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
195 assert(gfx < INVALID_INDUSTRYTILE);
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
196 const IndustryTileSpec *it = &_industry_tile_specs[gfx];
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
197 return it->grf_prop.override == INVALID_INDUSTRYTILE ? gfx : it->grf_prop.override;
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
198 } else {
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
199 return gfx;
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
200 }
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
201 }
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
202
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
203 static const uint8 IT_INVALID = 255;
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
204
1bd6b38694ac (svn r17315) -Codechange: move code related to industry types to separate file
smatz <smatz@openttd.org>
parents:
diff changeset
205 #endif /* INDUSTRYTYPE_H */