annotate src/industry.h @ 12645:b9f1e5ce4831 draft

(svn r17097) -Fix [FS#3092] (r13256): make restart command work again and make the help show how it works and how it doesn't work
author rubidium <rubidium@openttd.org>
date Thu, 06 Aug 2009 22:00:32 +0000
parents 843a8d074a90
children b75d8c6681bd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
1 /* $Id$ */
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
2
9111
d48433370037 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium <rubidium@openttd.org>
parents: 8959
diff changeset
3 /** @file industry.h Base of all industries. */
6201
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
4
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
5 #ifndef INDUSTRY_H
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
6 #define INDUSTRY_H
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
7
11974
5328e400636a (svn r16380) -Codechange: rename pool.hpp to pool_type.hpp
smatz <smatz@openttd.org>
parents: 11973
diff changeset
8 #include "core/pool_type.hpp"
8119
b6ec923e9fa8 (svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium <rubidium@openttd.org>
parents: 7978
diff changeset
9 #include "core/random_func.hpp"
7610
b5bdd89a6aa2 (svn r11139) -Codechange: add support for persistent storage for NewGRFs.
rubidium <rubidium@openttd.org>
parents: 7608
diff changeset
10 #include "newgrf_storage.h"
8119
b6ec923e9fa8 (svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium <rubidium@openttd.org>
parents: 7978
diff changeset
11 #include "cargo_type.h"
b6ec923e9fa8 (svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium <rubidium@openttd.org>
parents: 7978
diff changeset
12 #include "economy_type.h"
8139
db99ba38abc0 (svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium <rubidium@openttd.org>
parents: 8138
diff changeset
13 #include "map_type.h"
8138
60ea0f95de91 (svn r11700) -Codechange: reduce the amount of unnecessary includes.
rubidium <rubidium@openttd.org>
parents: 8119
diff changeset
14 #include "slope_type.h"
8140
fb8a05d579da (svn r11702) -Codechange: move all date related stuff to date*.
rubidium <rubidium@openttd.org>
parents: 8139
diff changeset
15 #include "date_type.h"
8213
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents: 8140
diff changeset
16 #include "town_type.h"
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents: 8140
diff changeset
17 #include "industry_type.h"
9126
8c450e1754e2 (svn r12986) -Codechange: move the landscape and transport related types from openttd.h to their own headers.
rubidium <rubidium@openttd.org>
parents: 9111
diff changeset
18 #include "landscape_type.h"
12477
843a8d074a90 (svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents: 12308
diff changeset
19 #include "tile_type.h"
843a8d074a90 (svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents: 12308
diff changeset
20 #include "company_type.h"
843a8d074a90 (svn r16914) -Codechange: split Station and BaseStation into different files
rubidium <rubidium@openttd.org>
parents: 12308
diff changeset
21 #include "strings_type.h"
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
22
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
23 enum {
6743
d7b001e114c5 (svn r9976) -Codechange: Declare a writable array of specs for industry and industry tiles.
belugas <belugas@openttd.org>
parents: 6741
diff changeset
24 INVALID_INDUSTRY = 0xFFFF,
d7b001e114c5 (svn r9976) -Codechange: Declare a writable array of specs for industry and industry tiles.
belugas <belugas@openttd.org>
parents: 6741
diff changeset
25 NEW_INDUSTRYOFFSET = 37, ///< original number of industries
7654
78a4d400385d (svn r11185) -Codechange: prepare some more code for the introduction of NewIndustries. Patch by Belugas.
rubidium <rubidium@openttd.org>
parents: 7645
diff changeset
26 NUM_INDUSTRYTYPES = 64, ///< total number of industries, new and old
6743
d7b001e114c5 (svn r9976) -Codechange: Declare a writable array of specs for industry and industry tiles.
belugas <belugas@openttd.org>
parents: 6741
diff changeset
27 INDUSTRYTILE_NOANIM = 0xFF, ///< flag to mark industry tiles as having no animation
d7b001e114c5 (svn r9976) -Codechange: Declare a writable array of specs for industry and industry tiles.
belugas <belugas@openttd.org>
parents: 6741
diff changeset
28 NEW_INDUSTRYTILEOFFSET = 175, ///< original number of tiles
d7b001e114c5 (svn r9976) -Codechange: Declare a writable array of specs for industry and industry tiles.
belugas <belugas@openttd.org>
parents: 6741
diff changeset
29 INVALID_INDUSTRYTYPE = NUM_INDUSTRYTYPES, ///< one above amount is considered invalid
7654
78a4d400385d (svn r11185) -Codechange: prepare some more code for the introduction of NewIndustries. Patch by Belugas.
rubidium <rubidium@openttd.org>
parents: 7645
diff changeset
30 NUM_INDUSTRYTILES = 512, ///< total number of industry tiles, new and old
6743
d7b001e114c5 (svn r9976) -Codechange: Declare a writable array of specs for industry and industry tiles.
belugas <belugas@openttd.org>
parents: 6741
diff changeset
31 INVALID_INDUSTRYTILE = NUM_INDUSTRYTILES, ///< one above amount is considered invalid
7291
33e19e1c88ff (svn r10639) -Codechange: Give meaninfull name to a magic number
belugas <belugas@openttd.org>
parents: 7259
diff changeset
32 INDUSTRY_COMPLETED = 3, ///< final stage of industry construction.
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
33 };
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
34
6765
f13523575f5d (svn r10001) -Codechange: Add support for removing dynamically allocated newgrf data
belugas <belugas@openttd.org>
parents: 6743
diff changeset
35 enum {
f13523575f5d (svn r10001) -Codechange: Add support for removing dynamically allocated newgrf data
belugas <belugas@openttd.org>
parents: 6743
diff changeset
36 CLEAN_RANDOMSOUNDS, ///< Free the dynamically allocated sounds table
f13523575f5d (svn r10001) -Codechange: Add support for removing dynamically allocated newgrf data
belugas <belugas@openttd.org>
parents: 6743
diff changeset
37 CLEAN_TILELSAYOUT, ///< Free the dynamically allocated tile layout structure
f13523575f5d (svn r10001) -Codechange: Add support for removing dynamically allocated newgrf data
belugas <belugas@openttd.org>
parents: 6743
diff changeset
38 };
f13523575f5d (svn r10001) -Codechange: Add support for removing dynamically allocated newgrf data
belugas <belugas@openttd.org>
parents: 6743
diff changeset
39
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
40 enum IndustryLifeType {
7144
4a108dac9a2b (svn r10418) -Codechange: implement/resurrect the industry production flags.
rubidium <rubidium@openttd.org>
parents: 7132
diff changeset
41 INDUSTRYLIFE_BLACK_HOLE = 0, ///< Like power plants and banks
4a108dac9a2b (svn r10418) -Codechange: implement/resurrect the industry production flags.
rubidium <rubidium@openttd.org>
parents: 7132
diff changeset
42 INDUSTRYLIFE_EXTRACTIVE = 1 << 0, ///< Like mines
4a108dac9a2b (svn r10418) -Codechange: implement/resurrect the industry production flags.
rubidium <rubidium@openttd.org>
parents: 7132
diff changeset
43 INDUSTRYLIFE_ORGANIC = 1 << 1, ///< Like forests
4a108dac9a2b (svn r10418) -Codechange: implement/resurrect the industry production flags.
rubidium <rubidium@openttd.org>
parents: 7132
diff changeset
44 INDUSTRYLIFE_PROCESSING = 1 << 2, ///< Like factories
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
45 };
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
46
6440
baeebe9ce6e4 (svn r9577) -Codechange: Add notion and data for industry map colour, used in the smallmap_gui. Not used yet.
belugas <belugas@openttd.org>
parents: 6414
diff changeset
47 /* Procedures that can be run to check whether an industry may
baeebe9ce6e4 (svn r9577) -Codechange: Add notion and data for industry map colour, used in the smallmap_gui. Not used yet.
belugas <belugas@openttd.org>
parents: 6414
diff changeset
48 * build at location the given to the procedure */
baeebe9ce6e4 (svn r9577) -Codechange: Add notion and data for industry map colour, used in the smallmap_gui. Not used yet.
belugas <belugas@openttd.org>
parents: 6414
diff changeset
49 enum CheckProc {
7173
8b43391dc0c2 (svn r10447) -Codechange: Don't need to specify values on an enum when those values are contiguous
belugas <belugas@openttd.org>
parents: 7165
diff changeset
50 CHECK_NOTHING,
8b43391dc0c2 (svn r10447) -Codechange: Don't need to specify values on an enum when those values are contiguous
belugas <belugas@openttd.org>
parents: 7165
diff changeset
51 CHECK_FOREST,
8b43391dc0c2 (svn r10447) -Codechange: Don't need to specify values on an enum when those values are contiguous
belugas <belugas@openttd.org>
parents: 7165
diff changeset
52 CHECK_REFINERY,
8b43391dc0c2 (svn r10447) -Codechange: Don't need to specify values on an enum when those values are contiguous
belugas <belugas@openttd.org>
parents: 7165
diff changeset
53 CHECK_FARM,
8b43391dc0c2 (svn r10447) -Codechange: Don't need to specify values on an enum when those values are contiguous
belugas <belugas@openttd.org>
parents: 7165
diff changeset
54 CHECK_PLANTATION,
8b43391dc0c2 (svn r10447) -Codechange: Don't need to specify values on an enum when those values are contiguous
belugas <belugas@openttd.org>
parents: 7165
diff changeset
55 CHECK_WATER,
8b43391dc0c2 (svn r10447) -Codechange: Don't need to specify values on an enum when those values are contiguous
belugas <belugas@openttd.org>
parents: 7165
diff changeset
56 CHECK_LUMBERMILL,
8b43391dc0c2 (svn r10447) -Codechange: Don't need to specify values on an enum when those values are contiguous
belugas <belugas@openttd.org>
parents: 7165
diff changeset
57 CHECK_BUBBLEGEN,
8b43391dc0c2 (svn r10447) -Codechange: Don't need to specify values on an enum when those values are contiguous
belugas <belugas@openttd.org>
parents: 7165
diff changeset
58 CHECK_OIL_RIG,
6440
baeebe9ce6e4 (svn r9577) -Codechange: Add notion and data for industry map colour, used in the smallmap_gui. Not used yet.
belugas <belugas@openttd.org>
parents: 6414
diff changeset
59 CHECK_END,
baeebe9ce6e4 (svn r9577) -Codechange: Add notion and data for industry map colour, used in the smallmap_gui. Not used yet.
belugas <belugas@openttd.org>
parents: 6414
diff changeset
60 };
baeebe9ce6e4 (svn r9577) -Codechange: Add notion and data for industry map colour, used in the smallmap_gui. Not used yet.
belugas <belugas@openttd.org>
parents: 6414
diff changeset
61
7259
bb4daf4d3593 (svn r10570) -Codechange: Add enum required for Callback 0x22: CBID_INDUSTRY_AVAILABLE
belugas <belugas@openttd.org>
parents: 7229
diff changeset
62 /** How was the industry created */
7186
0a85b5cc61f4 (svn r10460) -Codechange: add some more variables needed for newindustries regarding to the creation of the industries.
rubidium <rubidium@openttd.org>
parents: 7185
diff changeset
63 enum IndustryConstructionType {
7259
bb4daf4d3593 (svn r10570) -Codechange: Add enum required for Callback 0x22: CBID_INDUSTRY_AVAILABLE
belugas <belugas@openttd.org>
parents: 7229
diff changeset
64 ICT_UNKNOWN, ///< in previous game version or without newindustries activated
bb4daf4d3593 (svn r10570) -Codechange: Add enum required for Callback 0x22: CBID_INDUSTRY_AVAILABLE
belugas <belugas@openttd.org>
parents: 7229
diff changeset
65 ICT_NORMAL_GAMEPLAY, ///< either by user or random creation proccess
bb4daf4d3593 (svn r10570) -Codechange: Add enum required for Callback 0x22: CBID_INDUSTRY_AVAILABLE
belugas <belugas@openttd.org>
parents: 7229
diff changeset
66 ICT_MAP_GENERATION, ///< during random map creation
bb4daf4d3593 (svn r10570) -Codechange: Add enum required for Callback 0x22: CBID_INDUSTRY_AVAILABLE
belugas <belugas@openttd.org>
parents: 7229
diff changeset
67 ICT_SCENARIO_EDITOR ///< while scenarion edition
bb4daf4d3593 (svn r10570) -Codechange: Add enum required for Callback 0x22: CBID_INDUSTRY_AVAILABLE
belugas <belugas@openttd.org>
parents: 7229
diff changeset
68 };
bb4daf4d3593 (svn r10570) -Codechange: Add enum required for Callback 0x22: CBID_INDUSTRY_AVAILABLE
belugas <belugas@openttd.org>
parents: 7229
diff changeset
69
7757
47c2afb5b9ff (svn r11302) -Fix (r9520): typo
glx <glx@openttd.org>
parents: 7654
diff changeset
70 enum IndustryBehaviour {
6390
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
71 INDUSTRYBEH_NONE = 0,
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
72 INDUSTRYBEH_PLANT_FIELDS = 1 << 0, ///< periodically plants fileds around itself (temp and artic farms)
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
73 INDUSTRYBEH_CUT_TREES = 1 << 1, ///< cuts trees and produce first output cargo from them (lumber mill)
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
74 INDUSTRYBEH_BUILT_ONWATER = 1 << 2, ///< is built on water (oil rig)
9950
dbf95da604b3 (svn r14105) -Fix: Some typos that are more grammatical errors, as it seems.
belugas <belugas@openttd.org>
parents: 9306
diff changeset
75 INDUSTRYBEH_TOWN1200_MORE = 1 << 3, ///< can only be built in towns larger than 1200 inhabitants (temperate bank)
6390
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
76 INDUSTRYBEH_ONLY_INTOWN = 1 << 4, ///< can only be built in towns (arctic/tropic banks, water tower)
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
77 INDUSTRYBEH_ONLY_NEARTOWN = 1 << 5, ///< is always built near towns (toy shop)
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
78 INDUSTRYBEH_PLANT_ON_BUILT = 1 << 6, ///< Fields are planted around when built (all farms)
7132
ef1d8019de68 (svn r10406) -Fix [FS#968]: only industries in the temperate climate should be affected by the "do not increase production" flag.
rubidium <rubidium@openttd.org>
parents: 7107
diff changeset
79 INDUSTRYBEH_DONT_INCR_PROD = 1 << 7, ///< do not increase production (oil wells) in the temperate climate
6390
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
80 INDUSTRYBEH_BEFORE_1950 = 1 << 8, ///< can only be built before 1950 (oil wells)
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
81 INDUSTRYBEH_AFTER_1960 = 1 << 9, ///< can only be built after 1960 (oil rigs)
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
82 INDUSTRYBEH_AI_AIRSHIP_ROUTES = 1 << 10, ///< ai will attempt to establish air/ship routes to this industry (oil rig)
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
83 INDUSTRYBEH_AIRPLANE_ATTACKS = 1 << 11, ///< can be exploded by a military airplane (oil refinery)
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
84 INDUSTRYBEH_CHOPPER_ATTACKS = 1 << 12, ///< can be exploded by a military helicopter (factory)
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
85 INDUSTRYBEH_CAN_SUBSIDENCE = 1 << 13, ///< can cause a subsidence (coal mine, shaft that collapses)
7614
804a2d831b36 (svn r11143) -Fix: the random bits were not set for the production callback when the NewGRF asked for it.
rubidium <rubidium@openttd.org>
parents: 7610
diff changeset
86 /* The following flags are only used for newindustries and do no represent any normal behaviour */
804a2d831b36 (svn r11143) -Fix: the random bits were not set for the production callback when the NewGRF asked for it.
rubidium <rubidium@openttd.org>
parents: 7610
diff changeset
87 INDUSTRYBEH_PROD_MULTI_HNDLING = 1 << 14, ///< Automatic production multiplier handling
804a2d831b36 (svn r11143) -Fix: the random bits were not set for the production callback when the NewGRF asked for it.
rubidium <rubidium@openttd.org>
parents: 7610
diff changeset
88 INDUSTRYBEH_PRODCALLBACK_RANDOM = 1 << 15, ///< Production callback needs random bits in var 10
804a2d831b36 (svn r11143) -Fix: the random bits were not set for the production callback when the NewGRF asked for it.
rubidium <rubidium@openttd.org>
parents: 7610
diff changeset
89 INDUSTRYBEH_NOBUILT_MAPCREATION = 1 << 16, ///< Do not force one instance of this type to appear on map generation
7608
d36c95230702 (svn r11137) -Feature: [NewGRF] Add support for bit 17 of property 1A for Industries. This bit enables the protection of the last instance of an industry type once raise.
belugas <belugas@openttd.org>
parents: 7496
diff changeset
90 INDUSTRYBEH_CANCLOSE_LASTINSTANCE = 1 << 17, ///< Allow closing down the last instance of this type
6390
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
91 };
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
92
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
93
7757
47c2afb5b9ff (svn r11302) -Fix (r9520): typo
glx <glx@openttd.org>
parents: 7654
diff changeset
94 DECLARE_ENUM_AS_BIT_SET(IndustryBehaviour);
6390
a6b14274ee2e (svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas <belugas@openttd.org>
parents: 6307
diff changeset
95
11972
fd10870d74d4 (svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents: 11971
diff changeset
96 typedef Pool<Industry, IndustryID, 64, 64000> IndustryPool;
fd10870d74d4 (svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents: 11971
diff changeset
97 extern IndustryPool _industry_pool;
7390
9ae410265dce (svn r10759) -Codechange: make the industry struct use the pool item class as super class.
rubidium <rubidium@openttd.org>
parents: 7337
diff changeset
98
6201
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
99 /**
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
100 * Defines the internal data of a functionnal industry
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
101 */
11972
fd10870d74d4 (svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents: 11971
diff changeset
102 struct Industry : IndustryPool::PoolItem<&_industry_pool> {
7610
b5bdd89a6aa2 (svn r11139) -Codechange: add support for persistent storage for NewGRFs.
rubidium <rubidium@openttd.org>
parents: 7608
diff changeset
103 typedef PersistentStorageArray<uint32, 16> PersistentStorage;
b5bdd89a6aa2 (svn r11139) -Codechange: add support for persistent storage for NewGRFs.
rubidium <rubidium@openttd.org>
parents: 7608
diff changeset
104
6819
ffc184231f4a (svn r10058) -Codechange: give some industry variable sensible names (like not telling "last_mo_production" when it is the production of the current month).
rubidium <rubidium@openttd.org>
parents: 6815
diff changeset
105 TileIndex xy; ///< coordinates of the primary tile the industry is built one
6201
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
106 byte width;
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
107 byte height;
6819
ffc184231f4a (svn r10058) -Codechange: give some industry variable sensible names (like not telling "last_mo_production" when it is the production of the current month).
rubidium <rubidium@openttd.org>
parents: 6815
diff changeset
108 const Town *town; ///< Nearest town
7645
5178857fa331 (svn r11176) -Revert (r9867): as it is needed for newgrf callbacks 14B and 14C
glx <glx@openttd.org>
parents: 7639
diff changeset
109 CargoID produced_cargo[2]; ///< 2 production cargo slots
7165
c3b231638b80 (svn r10439) -Codechange: initial steps for customized industry productions.
rubidium <rubidium@openttd.org>
parents: 7144
diff changeset
110 uint16 produced_cargo_waiting[2]; ///< amount of cargo produced per cargo
c3b231638b80 (svn r10439) -Codechange: initial steps for customized industry productions.
rubidium <rubidium@openttd.org>
parents: 7144
diff changeset
111 uint16 incoming_cargo_waiting[3]; ///< incoming cargo waiting to be processed
6819
ffc184231f4a (svn r10058) -Codechange: give some industry variable sensible names (like not telling "last_mo_production" when it is the production of the current month).
rubidium <rubidium@openttd.org>
parents: 6815
diff changeset
112 byte production_rate[2]; ///< production rate for each cargo
ffc184231f4a (svn r10058) -Codechange: give some industry variable sensible names (like not telling "last_mo_production" when it is the production of the current month).
rubidium <rubidium@openttd.org>
parents: 6815
diff changeset
113 byte prod_level; ///< general production level
7645
5178857fa331 (svn r11176) -Revert (r9867): as it is needed for newgrf callbacks 14B and 14C
glx <glx@openttd.org>
parents: 7639
diff changeset
114 CargoID accepts_cargo[3]; ///< 3 input cargo slots
6819
ffc184231f4a (svn r10058) -Codechange: give some industry variable sensible names (like not telling "last_mo_production" when it is the production of the current month).
rubidium <rubidium@openttd.org>
parents: 6815
diff changeset
115 uint16 this_month_production[2]; ///< stats of this month's production per cargo
ffc184231f4a (svn r10058) -Codechange: give some industry variable sensible names (like not telling "last_mo_production" when it is the production of the current month).
rubidium <rubidium@openttd.org>
parents: 6815
diff changeset
116 uint16 this_month_transported[2]; ///< stats of this month's transport per cargo
ffc184231f4a (svn r10058) -Codechange: give some industry variable sensible names (like not telling "last_mo_production" when it is the production of the current month).
rubidium <rubidium@openttd.org>
parents: 6815
diff changeset
117 byte last_month_pct_transported[2]; ///< percentage transported per cargo in the last full month
ffc184231f4a (svn r10058) -Codechange: give some industry variable sensible names (like not telling "last_mo_production" when it is the production of the current month).
rubidium <rubidium@openttd.org>
parents: 6815
diff changeset
118 uint16 last_month_production[2]; ///< total units produced per cargo in the last full month
ffc184231f4a (svn r10058) -Codechange: give some industry variable sensible names (like not telling "last_mo_production" when it is the production of the current month).
rubidium <rubidium@openttd.org>
parents: 6815
diff changeset
119 uint16 last_month_transported[2]; ///< total units transported per cargo in the last full month
ffc184231f4a (svn r10058) -Codechange: give some industry variable sensible names (like not telling "last_mo_production" when it is the production of the current month).
rubidium <rubidium@openttd.org>
parents: 6815
diff changeset
120 uint16 counter; ///< used for animation and/or production (if available cargo)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
121
7319
d2b2514b2a5f (svn r10675) -Codechange: unhardcode the industry types used in several locations of the source code.
rubidium <rubidium@openttd.org>
parents: 7291
diff changeset
122 IndustryType type; ///< type of industry.
6819
ffc184231f4a (svn r10058) -Codechange: give some industry variable sensible names (like not telling "last_mo_production" when it is the production of the current month).
rubidium <rubidium@openttd.org>
parents: 6815
diff changeset
123 OwnerByte owner; ///< owner of the industry. Which SHOULD always be (imho) OWNER_NONE
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 10550
diff changeset
124 byte random_colour; ///< randomized colour of the industry, for display purpose
6819
ffc184231f4a (svn r10058) -Codechange: give some industry variable sensible names (like not telling "last_mo_production" when it is the production of the current month).
rubidium <rubidium@openttd.org>
parents: 6815
diff changeset
125 Year last_prod_year; ///< last year of production
ffc184231f4a (svn r10058) -Codechange: give some industry variable sensible names (like not telling "last_mo_production" when it is the production of the current month).
rubidium <rubidium@openttd.org>
parents: 6815
diff changeset
126 byte was_cargo_delivered; ///< flag that indicate this has been the closest industry chosen for cargo delivery by a station. see DeliverGoodsToIndustry
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
127
7186
0a85b5cc61f4 (svn r10460) -Codechange: add some more variables needed for newindustries regarding to the creation of the industries.
rubidium <rubidium@openttd.org>
parents: 7185
diff changeset
128 OwnerByte founder; ///< Founder of the industry
0a85b5cc61f4 (svn r10460) -Codechange: add some more variables needed for newindustries regarding to the creation of the industries.
rubidium <rubidium@openttd.org>
parents: 7185
diff changeset
129 Date construction_date; ///< Date of the construction of the industry
0a85b5cc61f4 (svn r10460) -Codechange: add some more variables needed for newindustries regarding to the creation of the industries.
rubidium <rubidium@openttd.org>
parents: 7185
diff changeset
130 uint8 construction_type; ///< Way the industry was constructed (@see IndustryConstructionType)
0a85b5cc61f4 (svn r10460) -Codechange: add some more variables needed for newindustries regarding to the creation of the industries.
rubidium <rubidium@openttd.org>
parents: 7185
diff changeset
131 Date last_cargo_accepted_at; ///< Last day cargo was accepted by this industry
7445
3fbe065e867c (svn r10903) -Feature: [NewGRF] Add support for variable 44 of Variational Action 2 for Industries
belugas <belugas@openttd.org>
parents: 7390
diff changeset
132 byte selected_layout; ///< Which tile layout was used when creating the industry
7390
9ae410265dce (svn r10759) -Codechange: make the industry struct use the pool item class as super class.
rubidium <rubidium@openttd.org>
parents: 7337
diff changeset
133
7860
9676dc785085 (svn r11410) -Codechange: implement random triggers for industries.
rubidium <rubidium@openttd.org>
parents: 7757
diff changeset
134 byte random_triggers; ///< Triggers for the random
9676dc785085 (svn r11410) -Codechange: implement random triggers for industries.
rubidium <rubidium@openttd.org>
parents: 7757
diff changeset
135 uint16 random; ///< Random value used for randomisation of all kinds of things
9676dc785085 (svn r11410) -Codechange: implement random triggers for industries.
rubidium <rubidium@openttd.org>
parents: 7757
diff changeset
136
7610
b5bdd89a6aa2 (svn r11139) -Codechange: add support for persistent storage for NewGRFs.
rubidium <rubidium@openttd.org>
parents: 7608
diff changeset
137 PersistentStorage psa; ///< Persistent storage for NewGRF industries.
b5bdd89a6aa2 (svn r11139) -Codechange: add support for persistent storage for NewGRFs.
rubidium <rubidium@openttd.org>
parents: 7608
diff changeset
138
10550
98e8bc97ec6b (svn r14807) -Codechange: use INVALID_TILE instead of 0 to mark invalid depots, industries, towns and waypoints
smatz <smatz@openttd.org>
parents: 10491
diff changeset
139 Industry(TileIndex tile = INVALID_TILE) : xy(tile) {}
7390
9ae410265dce (svn r10759) -Codechange: make the industry struct use the pool item class as super class.
rubidium <rubidium@openttd.org>
parents: 7337
diff changeset
140 ~Industry();
12252
f758517b6645 (svn r16667) -Codechange: replace GetRandomTown() and GetRandomIndustry() by Town::GetRandom() and Industry::GetRandom()
smatz <smatz@openttd.org>
parents: 11974
diff changeset
141
f758517b6645 (svn r16667) -Codechange: replace GetRandomTown() and GetRandomIndustry() by Town::GetRandom() and Industry::GetRandom()
smatz <smatz@openttd.org>
parents: 11974
diff changeset
142 static Industry *GetRandom();
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
143 };
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
144
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
145 struct IndustryTileTable {
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
146 TileIndexDiffC ti;
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
147 IndustryGfx gfx;
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
148 };
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
149
6675
b9b7055a4d2f (svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents: 6655
diff changeset
150 /** Data related to the handling of grf files. Common to both industry and industry tile */
b9b7055a4d2f (svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents: 6655
diff changeset
151 struct GRFFileProps {
7460
455c83114a78 (svn r10961) -Codechange: Flag default substitutes of industry/tiles with a value that cannot be legal.
belugas <belugas@openttd.org>
parents: 7445
diff changeset
152 uint16 subst_id;
6675
b9b7055a4d2f (svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents: 6655
diff changeset
153 uint16 local_id; ///< id defined by the grf file for this industry
b9b7055a4d2f (svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents: 6655
diff changeset
154 struct SpriteGroup *spritegroup; ///< pointer to the different sprites of the industry
6848
2dcc88253d83 (svn r10088) -Codechange: A typo and a code-style
belugas <belugas@openttd.org>
parents: 6839
diff changeset
155 const struct GRFFile *grffile; ///< grf file that introduced this industry
7107
c3f29220717a (svn r10379) -Codechange: silence a compiler warning (which was right) about a variable too little for what's been asked to do
belugas <belugas@openttd.org>
parents: 6848
diff changeset
156 uint16 override; ///< id of the entity been replaced by
6675
b9b7055a4d2f (svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents: 6655
diff changeset
157 };
b9b7055a4d2f (svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents: 6655
diff changeset
158
6201
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
159 /**
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
160 * Defines the data structure for constructing industry.
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
161 */
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
162 struct IndustrySpec {
11376
b9b2391afd1a (svn r15726) -Codechange: unify coding style for const pointers
smatz <smatz@openttd.org>
parents: 11085
diff changeset
163 const IndustryTileTable * const *table;///< List of the tiles composing the industry
6201
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
164 byte num_table; ///< Number of elements in the table
7978
a43897859e38 (svn r11534) -Feature(newgrf): Implement property 23h for Industries.
belugas <belugas@openttd.org>
parents: 7860
diff changeset
165 uint8 cost_multiplier; ///< Base construction cost multiplier.
a43897859e38 (svn r11534) -Feature(newgrf): Implement property 23h for Industries.
belugas <belugas@openttd.org>
parents: 7860
diff changeset
166 uint32 removal_cost_multiplier; ///< Base removal cost multiplier.
12308
efb6d0124bd8 (svn r16725) -Documentation: raw_industry_cost_multiplier
frosch <frosch@openttd.org>
parents: 12252
diff changeset
167 uint16 raw_industry_cost_multiplier; ///< Base construction cost multiplier when building raw industries like secondary. (not modifiable by NewGRFs)
7177
e096437e1120 (svn r10451) -Add: support for "prospecting" raw industries, i.e. you pay an amount of money and then it might (with a given chance) build a raw industry somewhere on the map.
rubidium <rubidium@openttd.org>
parents: 7173
diff changeset
168 uint32 prospecting_chance; ///< Chance prospecting succeeds
6201
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
169 IndustryType conflicting[3]; ///< Industries this industry cannot be close to
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
170 byte check_proc; ///< Index to a procedure to check for conflicting circumstances
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
171 CargoID produced_cargo[2];
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
172 byte production_rate[2];
6201
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
173 byte minimal_cargo; ///< minimum amount of cargo transported to the stations
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
174 ///< If the waiting cargo is less than this number, no cargo is moved to it
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
175 CargoID accepts_cargo[3]; ///< 3 accepted cargos
6635
5b5c06df5899 (svn r9866) -Codechange: remove the technical one-input-cargo-creates-one-output-cargo limit in the factories, sawmills, steelmills and the ones I'm forgetting to mention right now. Use of this functionality will come later.
rubidium <rubidium@openttd.org>
parents: 6533
diff changeset
176 uint16 input_cargo_multiplier[3][2]; ///< Input cargo multipliers (multiply amount of incoming cargo for the produced cargos)
6201
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
177 IndustryLifeType life_type; ///< This is also known as Industry production flag, in newgrf specs
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
178 byte climate_availability; ///< Bitmask, giving landscape enums as bit position
7757
47c2afb5b9ff (svn r11302) -Fix (r9520): typo
glx <glx@openttd.org>
parents: 7654
diff changeset
179 IndustryBehaviour behaviour; ///< How this industry will behave, and how others entities can use it
6440
baeebe9ce6e4 (svn r9577) -Codechange: Add notion and data for industry map colour, used in the smallmap_gui. Not used yet.
belugas <belugas@openttd.org>
parents: 6414
diff changeset
180 byte map_colour; ///< colour used for the small map
8959
7c497e5f652c (svn r12751) -Codechange: do what has been done in r11862 in a different way so it uses less memory.
rubidium <rubidium@openttd.org>
parents: 8470
diff changeset
181 StringID name; ///< Displayed name of the industry
7c497e5f652c (svn r12751) -Codechange: do what has been done in r11862 in a different way so it uses less memory.
rubidium <rubidium@openttd.org>
parents: 8470
diff changeset
182 StringID new_industry_text; ///< Message appearing when the industry is built
7c497e5f652c (svn r12751) -Codechange: do what has been done in r11862 in a different way so it uses less memory.
rubidium <rubidium@openttd.org>
parents: 8470
diff changeset
183 StringID closure_text; ///< Message appearing when the industry closes
7c497e5f652c (svn r12751) -Codechange: do what has been done in r11862 in a different way so it uses less memory.
rubidium <rubidium@openttd.org>
parents: 8470
diff changeset
184 StringID production_up_text; ///< Message appearing when the industry's production is increasing
7c497e5f652c (svn r12751) -Codechange: do what has been done in r11862 in a different way so it uses less memory.
rubidium <rubidium@openttd.org>
parents: 8470
diff changeset
185 StringID production_down_text; ///< Message appearing when the industry's production is decreasing
7c497e5f652c (svn r12751) -Codechange: do what has been done in r11862 in a different way so it uses less memory.
rubidium <rubidium@openttd.org>
parents: 8470
diff changeset
186 StringID station_name; ///< Default name for nearby station
6414
ec1486c86076 (svn r9550) -Codechange: Add notion and data of industry appearing chances, both in game and in creation mode.
belugas <belugas@openttd.org>
parents: 6390
diff changeset
187 byte appear_ingame[NUM_LANDSCAPE]; ///< Probability of appearance in game
ec1486c86076 (svn r9550) -Codechange: Add notion and data of industry appearing chances, both in game and in creation mode.
belugas <belugas@openttd.org>
parents: 6390
diff changeset
188 byte appear_creation[NUM_LANDSCAPE]; ///< Probability of appearance during map creation
6655
02c37d001ece (svn r9886) -Codechange: Cleanup of industries (Step-13). Include the sounds table into the industry's spec.
belugas <belugas@openttd.org>
parents: 6639
diff changeset
189 uint8 number_of_sounds; ///< Number of sounds available in the sounds array
02c37d001ece (svn r9886) -Codechange: Cleanup of industries (Step-13). Include the sounds table into the industry's spec.
belugas <belugas@openttd.org>
parents: 6639
diff changeset
190 const uint8 *random_sounds; ///< array of random sounds.
6675
b9b7055a4d2f (svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents: 6655
diff changeset
191 /* Newgrf data */
6440
baeebe9ce6e4 (svn r9577) -Codechange: Add notion and data for industry map colour, used in the smallmap_gui. Not used yet.
belugas <belugas@openttd.org>
parents: 6414
diff changeset
192 uint16 callback_flags; ///< Flags telling which grf callback is set
6765
f13523575f5d (svn r10001) -Codechange: Add support for removing dynamically allocated newgrf data
belugas <belugas@openttd.org>
parents: 6743
diff changeset
193 uint8 cleanup_flag; ///< flags indicating which data should be freed upon cleaning up
6741
07e4027e994c (svn r9974) -Codechange: Remove the enabled member of GRFFileProps, since it'snot really grf related
belugas <belugas@openttd.org>
parents: 6736
diff changeset
194 bool enabled; ///< entity still avaible (by default true).newgrf can disable it, though
6675
b9b7055a4d2f (svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents: 6655
diff changeset
195 struct GRFFileProps grf_prop; ///< properties related the the grf file
7185
0398071acc00 (svn r10459) -Codechange: add helper functions to determine whether an industry is a primary industry and how much it costs to build such an industry.
rubidium <rubidium@openttd.org>
parents: 7177
diff changeset
196
0398071acc00 (svn r10459) -Codechange: add helper functions to determine whether an industry is a primary industry and how much it costs to build such an industry.
rubidium <rubidium@openttd.org>
parents: 7177
diff changeset
197 /**
0398071acc00 (svn r10459) -Codechange: add helper functions to determine whether an industry is a primary industry and how much it costs to build such an industry.
rubidium <rubidium@openttd.org>
parents: 7177
diff changeset
198 * Is an industry with the spec a raw industry?
0398071acc00 (svn r10459) -Codechange: add helper functions to determine whether an industry is a primary industry and how much it costs to build such an industry.
rubidium <rubidium@openttd.org>
parents: 7177
diff changeset
199 * @return true if it should be handled as a raw industry
0398071acc00 (svn r10459) -Codechange: add helper functions to determine whether an industry is a primary industry and how much it costs to build such an industry.
rubidium <rubidium@openttd.org>
parents: 7177
diff changeset
200 */
0398071acc00 (svn r10459) -Codechange: add helper functions to determine whether an industry is a primary industry and how much it costs to build such an industry.
rubidium <rubidium@openttd.org>
parents: 7177
diff changeset
201 bool IsRawIndustry() const;
0398071acc00 (svn r10459) -Codechange: add helper functions to determine whether an industry is a primary industry and how much it costs to build such an industry.
rubidium <rubidium@openttd.org>
parents: 7177
diff changeset
202
0398071acc00 (svn r10459) -Codechange: add helper functions to determine whether an industry is a primary industry and how much it costs to build such an industry.
rubidium <rubidium@openttd.org>
parents: 7177
diff changeset
203 /**
0398071acc00 (svn r10459) -Codechange: add helper functions to determine whether an industry is a primary industry and how much it costs to build such an industry.
rubidium <rubidium@openttd.org>
parents: 7177
diff changeset
204 * Get the cost for constructing this industry
0398071acc00 (svn r10459) -Codechange: add helper functions to determine whether an industry is a primary industry and how much it costs to build such an industry.
rubidium <rubidium@openttd.org>
parents: 7177
diff changeset
205 * @return the cost (inflation corrected etc)
0398071acc00 (svn r10459) -Codechange: add helper functions to determine whether an industry is a primary industry and how much it costs to build such an industry.
rubidium <rubidium@openttd.org>
parents: 7177
diff changeset
206 */
0398071acc00 (svn r10459) -Codechange: add helper functions to determine whether an industry is a primary industry and how much it costs to build such an industry.
rubidium <rubidium@openttd.org>
parents: 7177
diff changeset
207 Money GetConstructionCost() const;
7978
a43897859e38 (svn r11534) -Feature(newgrf): Implement property 23h for Industries.
belugas <belugas@openttd.org>
parents: 7860
diff changeset
208
a43897859e38 (svn r11534) -Feature(newgrf): Implement property 23h for Industries.
belugas <belugas@openttd.org>
parents: 7860
diff changeset
209 /**
a43897859e38 (svn r11534) -Feature(newgrf): Implement property 23h for Industries.
belugas <belugas@openttd.org>
parents: 7860
diff changeset
210 * Get the cost for removing this industry
a43897859e38 (svn r11534) -Feature(newgrf): Implement property 23h for Industries.
belugas <belugas@openttd.org>
parents: 7860
diff changeset
211 * Take note that the cost will always be zero for non-grf industries.
a43897859e38 (svn r11534) -Feature(newgrf): Implement property 23h for Industries.
belugas <belugas@openttd.org>
parents: 7860
diff changeset
212 * Only if the grf author did specified a cost will it be applicable.
a43897859e38 (svn r11534) -Feature(newgrf): Implement property 23h for Industries.
belugas <belugas@openttd.org>
parents: 7860
diff changeset
213 * @return the cost (inflation corrected etc)
a43897859e38 (svn r11534) -Feature(newgrf): Implement property 23h for Industries.
belugas <belugas@openttd.org>
parents: 7860
diff changeset
214 */
a43897859e38 (svn r11534) -Feature(newgrf): Implement property 23h for Industries.
belugas <belugas@openttd.org>
parents: 7860
diff changeset
215 Money GetRemovalCost() const;
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
216 };
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
217
6201
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
218 /**
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
219 * Defines the data structure of each indivudual tile of an industry.
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
220 */
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
221 struct IndustryTileSpec {
6201
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
222 CargoID accepts_cargo[3]; ///< Cargo accepted by this tile
6736
81ff03f9f54d (svn r9969) -Codechange: Cleanup of industries (Step-14). Remove hardcoded-run-time tile acceptance and put in corresponding tile
belugas <belugas@openttd.org>
parents: 6675
diff changeset
223 uint8 acceptance[3]; ///< Level of aceptance per cargo type
6201
3b141366478a (svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas <belugas@openttd.org>
parents: 6092
diff changeset
224 Slope slopes_refused; ///< slope pattern on which this tile cannot be built
6305
13842c0ef6a9 (svn r9162) -Codechange: Cleanup of industry_cmd (Step-8). Gather tile animation data into IndustryTileSpec array
belugas <belugas@openttd.org>
parents: 6266
diff changeset
225 byte anim_production; ///< Animation frame to start when goods are produced
13842c0ef6a9 (svn r9162) -Codechange: Cleanup of industry_cmd (Step-8). Gather tile animation data into IndustryTileSpec array
belugas <belugas@openttd.org>
parents: 6266
diff changeset
226 byte anim_next; ///< Next frame in an animation
13842c0ef6a9 (svn r9162) -Codechange: Cleanup of industry_cmd (Step-8). Gather tile animation data into IndustryTileSpec array
belugas <belugas@openttd.org>
parents: 6266
diff changeset
227 bool anim_state; ///< When true, the tile has to be drawn using the animation
6637
7d0d7bde3390 (svn r9868) -Codechange: bring external declaration of functions togueter and adjust a comment
belugas <belugas@openttd.org>
parents: 6636
diff changeset
228 ///< state instead of the construction state
6675
b9b7055a4d2f (svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents: 6655
diff changeset
229 /* Newgrf data */
6743
d7b001e114c5 (svn r9976) -Codechange: Declare a writable array of specs for industry and industry tiles.
belugas <belugas@openttd.org>
parents: 6741
diff changeset
230 uint8 callback_flags; ///< Flags telling which grf callback is set
7229
39b4e2291424 (svn r10508) -Codechange: allow customizable animation schemes for industries.
rubidium <rubidium@openttd.org>
parents: 7186
diff changeset
231 uint16 animation_info; ///< Information about the animation (is it looping, how many loops etc)
39b4e2291424 (svn r10508) -Codechange: allow customizable animation schemes for industries.
rubidium <rubidium@openttd.org>
parents: 7186
diff changeset
232 uint8 animation_speed; ///< The speed of the animation
39b4e2291424 (svn r10508) -Codechange: allow customizable animation schemes for industries.
rubidium <rubidium@openttd.org>
parents: 7186
diff changeset
233 uint8 animation_triggers; ///< When to start the animation
39b4e2291424 (svn r10508) -Codechange: allow customizable animation schemes for industries.
rubidium <rubidium@openttd.org>
parents: 7186
diff changeset
234 uint8 animation_special_flags; ///< Extra flags to influence the animation
6741
07e4027e994c (svn r9974) -Codechange: Remove the enabled member of GRFFileProps, since it'snot really grf related
belugas <belugas@openttd.org>
parents: 6736
diff changeset
235 bool enabled; ///< entity still avaible (by default true).newgrf can disable it, though
6675
b9b7055a4d2f (svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents: 6655
diff changeset
236 struct GRFFileProps grf_prop;
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
237 };
6092
1921ab72b54d (svn r8827) -Codechange: Cleanup of industry_cmd (Step-6). Implementation of IndustryTileSPec, the alter ego of IndustrySpec.
belugas <belugas@openttd.org>
parents: 5587
diff changeset
238
6637
7d0d7bde3390 (svn r9868) -Codechange: bring external declaration of functions togueter and adjust a comment
belugas <belugas@openttd.org>
parents: 6636
diff changeset
239 /* industry_cmd.cpp*/
6743
d7b001e114c5 (svn r9976) -Codechange: Declare a writable array of specs for industry and industry tiles.
belugas <belugas@openttd.org>
parents: 6741
diff changeset
240 const IndustrySpec *GetIndustrySpec(IndustryType thistype); ///< Array of industries data
7462
2f8aef8e9451 (svn r10963) -Revert(10700): Although the idea was good, it was more prone of errors than usefull.
belugas <belugas@openttd.org>
parents: 7460
diff changeset
241 const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx); ///< Array of industry tiles data
6637
7d0d7bde3390 (svn r9868) -Codechange: bring external declaration of functions togueter and adjust a comment
belugas <belugas@openttd.org>
parents: 6636
diff changeset
242 void ResetIndustries();
7d0d7bde3390 (svn r9868) -Codechange: bring external declaration of functions togueter and adjust a comment
belugas <belugas@openttd.org>
parents: 6636
diff changeset
243 void PlantRandomFarmField(const Industry *i);
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
244
10491
357d932ba53d (svn r14746) -Fix: don't let any disaster vehicle (Helicopter or Airplane) target invalid industry
smatz <smatz@openttd.org>
parents: 10146
diff changeset
245 void ReleaseDisastersTargetingIndustry(IndustryID);
357d932ba53d (svn r14746) -Fix: don't let any disaster vehicle (Helicopter or Airplane) target invalid industry
smatz <smatz@openttd.org>
parents: 10146
diff changeset
246
6743
d7b001e114c5 (svn r9976) -Codechange: Declare a writable array of specs for industry and industry tiles.
belugas <belugas@openttd.org>
parents: 6741
diff changeset
247 /* writable arrays of specs */
d7b001e114c5 (svn r9976) -Codechange: Declare a writable array of specs for industry and industry tiles.
belugas <belugas@openttd.org>
parents: 6741
diff changeset
248 extern IndustrySpec _industry_specs[NUM_INDUSTRYTYPES];
d7b001e114c5 (svn r9976) -Codechange: Declare a writable array of specs for industry and industry tiles.
belugas <belugas@openttd.org>
parents: 6741
diff changeset
249 extern IndustryTileSpec _industry_tile_specs[NUM_INDUSTRYTILES];
d7b001e114c5 (svn r9976) -Codechange: Declare a writable array of specs for industry and industry tiles.
belugas <belugas@openttd.org>
parents: 6741
diff changeset
250
7467
cf5b1d377174 (svn r10972) -Codechange: Implement the counterpart(GetTranslatedIndustryTileID) of getindustileid of TTDPatch. This allows to ensure that the ID of a tile (taken out of the map or not) is still a valid one regarding the possible override it may have been flagged to.
belugas <belugas@openttd.org>
parents: 7462
diff changeset
251 static inline IndustryGfx GetTranslatedIndustryTileID(IndustryGfx gfx)
cf5b1d377174 (svn r10972) -Codechange: Implement the counterpart(GetTranslatedIndustryTileID) of getindustileid of TTDPatch. This allows to ensure that the ID of a tile (taken out of the map or not) is still a valid one regarding the possible override it may have been flagged to.
belugas <belugas@openttd.org>
parents: 7462
diff changeset
252 {
7473
bdd96fe0b993 (svn r10980) -Fix [FS#1158] : This will hopefully fix the case of an assert that happens when an industry uses a special gfx index (tile spec 0xFF). This 0xFF is the sentinel of a special check done for oil rigs, where water need to be around, but no tile will be constructed on it.
belugas <belugas@openttd.org>
parents: 7467
diff changeset
253 /* the 0xFF should be GFX_WATERTILE_SPECIALCHECK but for reasons of include mess,
bdd96fe0b993 (svn r10980) -Fix [FS#1158] : This will hopefully fix the case of an assert that happens when an industry uses a special gfx index (tile spec 0xFF). This 0xFF is the sentinel of a special check done for oil rigs, where water need to be around, but no tile will be constructed on it.
belugas <belugas@openttd.org>
parents: 7467
diff changeset
254 * we'll simplify the writing.
bdd96fe0b993 (svn r10980) -Fix [FS#1158] : This will hopefully fix the case of an assert that happens when an industry uses a special gfx index (tile spec 0xFF). This 0xFF is the sentinel of a special check done for oil rigs, where water need to be around, but no tile will be constructed on it.
belugas <belugas@openttd.org>
parents: 7467
diff changeset
255 * Basically, the first test is required since the GFX_WATERTILE_SPECIALCHECK value
bdd96fe0b993 (svn r10980) -Fix [FS#1158] : This will hopefully fix the case of an assert that happens when an industry uses a special gfx index (tile spec 0xFF). This 0xFF is the sentinel of a special check done for oil rigs, where water need to be around, but no tile will be constructed on it.
belugas <belugas@openttd.org>
parents: 7467
diff changeset
256 * will never be assigned as a tile index and is only required in order to do some
bdd96fe0b993 (svn r10980) -Fix [FS#1158] : This will hopefully fix the case of an assert that happens when an industry uses a special gfx index (tile spec 0xFF). This 0xFF is the sentinel of a special check done for oil rigs, where water need to be around, but no tile will be constructed on it.
belugas <belugas@openttd.org>
parents: 7467
diff changeset
257 * tests while building the industry (as in WATER REQUIRED */
bdd96fe0b993 (svn r10980) -Fix [FS#1158] : This will hopefully fix the case of an assert that happens when an industry uses a special gfx index (tile spec 0xFF). This 0xFF is the sentinel of a special check done for oil rigs, where water need to be around, but no tile will be constructed on it.
belugas <belugas@openttd.org>
parents: 7467
diff changeset
258 if (gfx != 0xFF) {
bdd96fe0b993 (svn r10980) -Fix [FS#1158] : This will hopefully fix the case of an assert that happens when an industry uses a special gfx index (tile spec 0xFF). This 0xFF is the sentinel of a special check done for oil rigs, where water need to be around, but no tile will be constructed on it.
belugas <belugas@openttd.org>
parents: 7467
diff changeset
259 assert(gfx < INVALID_INDUSTRYTILE);
bdd96fe0b993 (svn r10980) -Fix [FS#1158] : This will hopefully fix the case of an assert that happens when an industry uses a special gfx index (tile spec 0xFF). This 0xFF is the sentinel of a special check done for oil rigs, where water need to be around, but no tile will be constructed on it.
belugas <belugas@openttd.org>
parents: 7467
diff changeset
260 const IndustryTileSpec *it = &_industry_tile_specs[gfx];
bdd96fe0b993 (svn r10980) -Fix [FS#1158] : This will hopefully fix the case of an assert that happens when an industry uses a special gfx index (tile spec 0xFF). This 0xFF is the sentinel of a special check done for oil rigs, where water need to be around, but no tile will be constructed on it.
belugas <belugas@openttd.org>
parents: 7467
diff changeset
261 return it->grf_prop.override == INVALID_INDUSTRYTILE ? gfx : it->grf_prop.override;
bdd96fe0b993 (svn r10980) -Fix [FS#1158] : This will hopefully fix the case of an assert that happens when an industry uses a special gfx index (tile spec 0xFF). This 0xFF is the sentinel of a special check done for oil rigs, where water need to be around, but no tile will be constructed on it.
belugas <belugas@openttd.org>
parents: 7467
diff changeset
262 } else {
bdd96fe0b993 (svn r10980) -Fix [FS#1158] : This will hopefully fix the case of an assert that happens when an industry uses a special gfx index (tile spec 0xFF). This 0xFF is the sentinel of a special check done for oil rigs, where water need to be around, but no tile will be constructed on it.
belugas <belugas@openttd.org>
parents: 7467
diff changeset
263 return gfx;
bdd96fe0b993 (svn r10980) -Fix [FS#1158] : This will hopefully fix the case of an assert that happens when an industry uses a special gfx index (tile spec 0xFF). This 0xFF is the sentinel of a special check done for oil rigs, where water need to be around, but no tile will be constructed on it.
belugas <belugas@openttd.org>
parents: 7467
diff changeset
264 }
7467
cf5b1d377174 (svn r10972) -Codechange: Implement the counterpart(GetTranslatedIndustryTileID) of getindustileid of TTDPatch. This allows to ensure that the ID of a tile (taken out of the map or not) is still a valid one regarding the possible override it may have been flagged to.
belugas <belugas@openttd.org>
parents: 7462
diff changeset
265 }
cf5b1d377174 (svn r10972) -Codechange: Implement the counterpart(GetTranslatedIndustryTileID) of getindustileid of TTDPatch. This allows to ensure that the ID of a tile (taken out of the map or not) is still a valid one regarding the possible override it may have been flagged to.
belugas <belugas@openttd.org>
parents: 7462
diff changeset
266
6533
dfb2e6244177 (svn r9721) -Codechange: -Codechange: Cleanup of industry_cmd (Step-12). Dynamically build the legends (name and color) for industries in the smallmap_gui.
belugas <belugas@openttd.org>
parents: 6493
diff changeset
267 /* smallmap_gui.cpp */
dfb2e6244177 (svn r9721) -Codechange: -Codechange: Cleanup of industry_cmd (Step-12). Dynamically build the legends (name and color) for industries in the smallmap_gui.
belugas <belugas@openttd.org>
parents: 6493
diff changeset
268 void BuildIndustriesLegend();
10146
f5ef198f917d (svn r14332) -Fix[FS#1885]: Balance the monthly random industry changes, by introducing a daily random industry change.
belugas <belugas@openttd.org>
parents: 9950
diff changeset
269 /* industry_cmd.cpp */
f5ef198f917d (svn r14332) -Fix[FS#1885]: Balance the monthly random industry changes, by introducing a daily random industry change.
belugas <belugas@openttd.org>
parents: 9950
diff changeset
270 void SetIndustryDailyChanges();
6533
dfb2e6244177 (svn r9721) -Codechange: -Codechange: Cleanup of industry_cmd (Step-12). Dynamically build the legends (name and color) for industries in the smallmap_gui.
belugas <belugas@openttd.org>
parents: 6493
diff changeset
271
6839
785f81035a7b (svn r10078) -Codechange: Centralize all industry counts data and access
belugas <belugas@openttd.org>
parents: 6825
diff changeset
272 extern uint16 _industry_counts[NUM_INDUSTRYTYPES]; // Number of industries per type ingame
785f81035a7b (svn r10078) -Codechange: Centralize all industry counts data and access
belugas <belugas@openttd.org>
parents: 6825
diff changeset
273
6824
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
274 /** Increment the count of industries for this type
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
275 * @param type IndustryType to increment
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
276 * @pre type < INVALID_INDUSTRYTYPE */
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
277 static inline void IncIndustryTypeCount(IndustryType type)
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
278 {
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
279 assert(type < INVALID_INDUSTRYTYPE);
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
280 _industry_counts[type]++;
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
281 }
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
282
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
283 /** Decrement the count of industries for this type
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
284 * @param type IndustryType to decrement
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
285 * @pre type < INVALID_INDUSTRYTYPE */
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
286 static inline void DecIndustryTypeCount(IndustryType type)
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
287 {
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
288 assert(type < INVALID_INDUSTRYTYPE);
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
289 _industry_counts[type]--;
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
290 }
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
291
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
292 /** get the count of industries for this type
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
293 * @param type IndustryType to query
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
294 * @pre type < INVALID_INDUSTRYTYPE */
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
295 static inline uint8 GetIndustryTypeCount(IndustryType type)
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
296 {
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
297 assert(type < INVALID_INDUSTRYTYPE);
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
298 return min(_industry_counts[type], 0xFF); // callback expects only a byte, so cut it
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
299 }
4d68a57bc04b (svn r10063) -Codechange: Change VARDEF for extern
belugas <belugas@openttd.org>
parents: 6819
diff changeset
300
6839
785f81035a7b (svn r10078) -Codechange: Centralize all industry counts data and access
belugas <belugas@openttd.org>
parents: 6825
diff changeset
301 /** Resets both the total_industries and the _industry_counts
785f81035a7b (svn r10078) -Codechange: Centralize all industry counts data and access
belugas <belugas@openttd.org>
parents: 6825
diff changeset
302 * This way, we centralize all counts activities */
785f81035a7b (svn r10078) -Codechange: Centralize all industry counts data and access
belugas <belugas@openttd.org>
parents: 6825
diff changeset
303 static inline void ResetIndustryCounts()
785f81035a7b (svn r10078) -Codechange: Centralize all industry counts data and access
belugas <belugas@openttd.org>
parents: 6825
diff changeset
304 {
785f81035a7b (svn r10078) -Codechange: Centralize all industry counts data and access
belugas <belugas@openttd.org>
parents: 6825
diff changeset
305 memset(&_industry_counts, 0, sizeof(_industry_counts));
785f81035a7b (svn r10078) -Codechange: Centralize all industry counts data and access
belugas <belugas@openttd.org>
parents: 6825
diff changeset
306 }
785f81035a7b (svn r10078) -Codechange: Centralize all industry counts data and access
belugas <belugas@openttd.org>
parents: 6825
diff changeset
307
11971
9daf69237623 (svn r16377) -Codechange: unify FOR_ALL_* macros, use separate index variable instead of var->index
smatz <smatz@openttd.org>
parents: 11930
diff changeset
308 #define FOR_ALL_INDUSTRIES_FROM(var, start) FOR_ALL_ITEMS_FROM(Industry, industry_index, var, start)
9daf69237623 (svn r16377) -Codechange: unify FOR_ALL_* macros, use separate index variable instead of var->index
smatz <smatz@openttd.org>
parents: 11930
diff changeset
309 #define FOR_ALL_INDUSTRIES(var) FOR_ALL_INDUSTRIES_FROM(var, 0)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
310
7319
d2b2514b2a5f (svn r10675) -Codechange: unhardcode the industry types used in several locations of the source code.
rubidium <rubidium@openttd.org>
parents: 7291
diff changeset
311 static const uint8 IT_INVALID = 255;
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
312
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
313 #endif /* INDUSTRY_H */