Mercurial > hg > openttd
annotate src/industry.h @ 6675:b9b7055a4d2f draft
(svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
author | belugas <belugas@openttd.org> |
---|---|
date | Thu, 24 May 2007 01:12:00 +0000 |
parents | 02c37d001ece |
children | 81ff03f9f54d |
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 |
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
|
3 /** @file industry.h */ |
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 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
8 #include "oldpool.h" |
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
|
9 #include "helpers.hpp" |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
10 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
11 typedef byte IndustryGfx; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
12 typedef uint8 IndustryType; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
13 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
14 enum { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
15 INVALID_INDUSTRY = 0xFFFF, |
6493
6f91052de580
(svn r9676) -Codechange: introduce NUM_INDUSTRYTYPES instead of IT_END.
belugas <belugas@openttd.org>
parents:
6440
diff
changeset
|
16 NUM_INDUSTRYTYPES = 37, |
6675
b9b7055a4d2f
(svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents:
6655
diff
changeset
|
17 INDUTILE_NOANIM = 0xFF, ///< flag to mark industry tiles as having no animation |
b9b7055a4d2f
(svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents:
6655
diff
changeset
|
18 INVALID_INDUSTRYTYPE = NUM_INDUSTRYTYPES, ///< one above amount is considered invalid |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
19 }; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
20 |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6247
diff
changeset
|
21 enum IndustryLifeType { |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
22 INDUSTRYLIFE_NOT_CLOSABLE, ///< Industry can never close |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
23 INDUSTRYLIFE_PRODUCTION, ///< Industry can close and change of production |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
24 INDUSTRYLIFE_CLOSABLE, ///< Industry can only close (no production change) |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6247
diff
changeset
|
25 }; |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
26 |
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
|
27 /* 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
|
28 * 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
|
29 enum CheckProc { |
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
|
30 CHECK_NOTHING = 0, |
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
|
31 CHECK_FOREST = 1, |
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
|
32 CHECK_REFINERY = 2, |
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
|
33 CHECK_FARM = 3, |
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
|
34 CHECK_PLANTATION = 4, |
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
|
35 CHECK_WATER = 5, |
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
|
36 CHECK_LUMBERMILL = 6, |
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
|
37 CHECK_BUBBLEGEN = 7, |
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
|
38 CHECK_OIL_RIG = 8, |
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
|
39 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
|
40 }; |
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
|
41 |
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
|
42 enum IndustyBehaviour { |
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
|
43 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
|
44 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
|
45 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
|
46 INDUSTRYBEH_BUILT_ONWATER = 1 << 2, ///< is built on water (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
|
47 INDUSTRYBEH_TOWN1200_MORE = 1 << 3, ///< can only be built in towns larger then 1200 inhabitants (temperate bank) |
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
|
48 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
|
49 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
|
50 INDUSTRYBEH_PLANT_ON_BUILT = 1 << 6, ///< Fields are planted around when built (all 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
|
51 INDUSTRYBEH_DONT_INCR_PROD = 1 << 7, ///< do not increase production (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
|
52 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 INDUSTRYBEH_CAN_SUBSIDENCE = 1 << 13, ///< can cause a subsidence (coal mine, shaft that collapses) |
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
|
58 }; |
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
|
59 |
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
|
60 |
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
|
61 DECLARE_ENUM_AS_BIT_SET(IndustyBehaviour); |
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
|
62 |
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
|
63 /** |
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
|
64 * 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
|
65 */ |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
66 struct 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
|
67 TileIndex xy; ///< coordinates of the primary tile the industry is built one |
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
|
68 byte width; |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
69 byte height; |
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
|
70 const Town* town; ///< Nearest town |
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
|
71 uint16 cargo_waiting[2]; ///< amount of cargo produced per cargo |
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
|
72 byte production_rate[2]; ///< production rate for each cargo |
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
|
73 byte prod_level; ///< general production level |
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
|
74 uint16 last_mo_production[2]; ///< stats of last month production per cargo |
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
|
75 uint16 last_mo_transported[2]; ///< stats of last month transport per cargo |
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
|
76 byte pct_transported[2]; ///< percentage transported per cargo |
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
|
77 uint16 total_production[2]; ///< total units produced per cargo |
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
|
78 uint16 total_transported[2]; ///< total units transported per cargo |
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
|
79 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
|
80 |
6639
0333109c382d
(svn r9870) -Codechange: Silence two compiler warnings and give proper type to the "type" member of industry struct
belugas <belugas@openttd.org>
parents:
6637
diff
changeset
|
81 IndustryType type; ///< type of industry. see IT_COAL_MINE and others |
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
|
82 OwnerByte owner; ///< owner of the industry. Which SHOULD always be (imho) OWNER_NONE |
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
|
83 byte random_color; ///< randomized colour of the industry, for display purpose |
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
|
84 Year last_prod_year; ///< last year of production |
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
|
85 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
|
86 |
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
|
87 IndustryID index; ///< index of the industry in the pool of industries |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
88 }; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
89 |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6247
diff
changeset
|
90 struct IndustryTileTable { |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
91 TileIndexDiffC ti; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
92 IndustryGfx gfx; |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6247
diff
changeset
|
93 }; |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
94 |
6675
b9b7055a4d2f
(svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents:
6655
diff
changeset
|
95 /** 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
|
96 struct GRFFileProps { |
b9b7055a4d2f
(svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents:
6655
diff
changeset
|
97 uint8 subst_id; |
b9b7055a4d2f
(svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents:
6655
diff
changeset
|
98 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
|
99 struct SpriteGroup *spritegroup; ///< pointer to the different sprites of the industry |
b9b7055a4d2f
(svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents:
6655
diff
changeset
|
100 const struct GRFFile *grffile; ///< grf file that introduced this house |
b9b7055a4d2f
(svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents:
6655
diff
changeset
|
101 uint8 override; ///< id of the entity been replaced by |
b9b7055a4d2f
(svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents:
6655
diff
changeset
|
102 bool enabled; ///< entity still avaible (by default true).newgrf can disable it, though |
b9b7055a4d2f
(svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents:
6655
diff
changeset
|
103 }; |
b9b7055a4d2f
(svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents:
6655
diff
changeset
|
104 |
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
|
105 /** |
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 * 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
|
107 */ |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6247
diff
changeset
|
108 struct IndustrySpec { |
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
|
109 const IndustryTileTable *const *table;///< List of the tiles composing the 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
|
110 byte num_table; ///< Number of elements in the table |
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
|
111 byte cost_multiplier; ///< Base cost multiplier. Watch out for this one, << 5 VS << 8 |
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
|
112 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
|
113 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
|
114 CargoID produced_cargo[2]; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
115 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
|
116 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
|
117 ///< 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
|
118 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
|
119 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
|
120 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
|
121 byte climate_availability; ///< Bitmask, giving landscape enums as bit position |
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
|
122 IndustyBehaviour 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
|
123 byte map_colour; ///< colour used for the small map |
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
|
124 StringID name; ///< Displayed name of the industry |
6266
5ff75337492b
(svn r9075) -Codechange: Cleanup of industry_cmd (Step-7). Small step that is. The new industry messages do not need a series of tests. Only one property to use.
belugas <belugas@openttd.org>
parents:
6248
diff
changeset
|
125 StringID new_industry_text; ///< Message appearing when the industry is built |
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
|
126 StringID closure_text; ///< Message appearing when the industry closes |
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
|
127 StringID production_up_text; ///< Message appearing when the industry's production is increasing |
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
|
128 StringID production_down_text; ///< Message appearing when the industry's production is decreasing |
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
|
129 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
|
130 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
|
131 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
|
132 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
|
133 /* 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
|
134 uint16 callback_flags; ///< Flags telling which grf callback is set |
6675
b9b7055a4d2f
(svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents:
6655
diff
changeset
|
135 struct GRFFileProps grf_prop; ///< properties related the the grf file |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6247
diff
changeset
|
136 }; |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
137 |
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
|
138 /** |
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
|
139 * 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
|
140 */ |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6247
diff
changeset
|
141 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
|
142 CargoID accepts_cargo[3]; ///< Cargo accepted by this tile |
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
|
143 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
|
144 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
|
145 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
|
146 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
|
147 ///< 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
|
148 /* Newgrf data */ |
b9b7055a4d2f
(svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents:
6655
diff
changeset
|
149 uint8 callback_flags; ///< Flags telling which grf callback is set |
b9b7055a4d2f
(svn r9906) -Codechange: Add common properties for both industry and industry tiles specs
belugas <belugas@openttd.org>
parents:
6655
diff
changeset
|
150 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
|
151 }; |
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
|
152 |
6637
7d0d7bde3390
(svn r9868) -Codechange: bring external declaration of functions togueter and adjust a comment
belugas <belugas@openttd.org>
parents:
6636
diff
changeset
|
153 /* industry_cmd.cpp*/ |
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
|
154 const IndustrySpec *GetIndustrySpec(IndustryType thistype); ///< Array of industries default data |
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
|
155 const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx); ///< Array of industry tiles default data |
6637
7d0d7bde3390
(svn r9868) -Codechange: bring external declaration of functions togueter and adjust a comment
belugas <belugas@openttd.org>
parents:
6636
diff
changeset
|
156 void ResetIndustries(); |
7d0d7bde3390
(svn r9868) -Codechange: bring external declaration of functions togueter and adjust a comment
belugas <belugas@openttd.org>
parents:
6636
diff
changeset
|
157 void PlantRandomFarmField(const Industry *i); |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
158 |
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
|
159 /* 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
|
160 void BuildIndustriesLegend(); |
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
|
161 |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
162 DECLARE_OLD_POOL(Industry, Industry, 3, 8000) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
163 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
164 /** |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
165 * Check if an Industry really exists. |
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
|
166 * @param industry to check |
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
|
167 * @return true if position is a valid one |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
168 */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
169 static inline bool IsValidIndustry(const Industry *industry) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
170 { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
171 return industry->xy != 0; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
172 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
173 |
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
|
174 /** |
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 * Check if an Industry exists whithin the pool of industries |
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
|
176 * @param index of the desired 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
|
177 * @return true if it is inside the pool |
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 */ |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
179 static inline bool IsValidIndustryID(IndustryID index) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
180 { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
181 return index < GetIndustryPoolSize() && IsValidIndustry(GetIndustry(index)); |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
182 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
183 |
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
|
184 VARDEF int _total_industries; //general counter |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
185 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6201
diff
changeset
|
186 static inline IndustryID GetMaxIndustryIndex() |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
187 { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
188 /* TODO - This isn't the real content of the function, but |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
189 * with the new pool-system this will be replaced with one that |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
190 * _really_ returns the highest index. Now it just returns |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
191 * the next safe value we are sure about everything is below. |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
192 */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
193 return GetIndustryPoolSize() - 1; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
194 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
195 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6201
diff
changeset
|
196 static inline uint GetNumIndustries() |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
197 { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
198 return _total_industries; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
199 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
200 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
201 /** |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
202 * Return a random valid industry. |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
203 */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6201
diff
changeset
|
204 static inline Industry *GetRandomIndustry() |
5475
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
205 { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
206 int num = RandomRange(GetNumIndustries()); |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
207 IndustryID index = INVALID_INDUSTRY; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
208 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
209 if (GetNumIndustries() == 0) return NULL; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
210 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
211 while (num >= 0) { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
212 num--; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
213 index++; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
214 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
215 /* Make sure we have a valid industry */ |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
216 while (!IsValidIndustryID(index)) { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
217 index++; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
218 assert(index <= GetMaxIndustryIndex()); |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
219 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
220 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
221 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
222 return GetIndustry(index); |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
223 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
224 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
225 void DestroyIndustry(Industry *i); |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
226 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
227 static inline void DeleteIndustry(Industry *i) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
228 { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
229 DestroyIndustry(i); |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
230 i->xy = 0; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
231 } |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
232 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
233 #define FOR_ALL_INDUSTRIES_FROM(i, start) for (i = GetIndustry(start); i != NULL; i = (i->index + 1U < GetIndustryPoolSize()) ? GetIndustry(i->index + 1U) : NULL) if (IsValidIndustry(i)) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
234 #define FOR_ALL_INDUSTRIES(i) FOR_ALL_INDUSTRIES_FROM(i, 0) |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
235 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
236 VARDEF const Industry** _industry_sort; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
237 VARDEF bool _industry_sort_dirty; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
238 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
239 enum { |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
240 IT_COAL_MINE = 0, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
241 IT_POWER_STATION = 1, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
242 IT_SAWMILL = 2, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
243 IT_FOREST = 3, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
244 IT_OIL_REFINERY = 4, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
245 IT_OIL_RIG = 5, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
246 IT_FACTORY = 6, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
247 IT_PRINTING_WORKS = 7, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
248 IT_STEEL_MILL = 8, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
249 IT_FARM = 9, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
250 IT_COPPER_MINE = 10, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
251 IT_OIL_WELL = 11, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
252 IT_BANK_TEMP = 12, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
253 IT_FOOD_PROCESS = 13, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
254 IT_PAPER_MILL = 14, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
255 IT_GOLD_MINE = 15, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
256 IT_BANK_TROPIC_ARCTIC = 16, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
257 IT_DIAMOND_MINE = 17, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
258 IT_IRON_MINE = 18, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
259 IT_FRUIT_PLANTATION = 19, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
260 IT_RUBBER_PLANTATION = 20, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
261 IT_WATER_SUPPLY = 21, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
262 IT_WATER_TOWER = 22, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
263 IT_FACTORY_2 = 23, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
264 IT_FARM_2 = 24, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
265 IT_LUMBER_MILL = 25, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
266 IT_COTTON_CANDY = 26, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
267 IT_CANDY_FACTORY = 27, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
268 IT_BATTERY_FARM = 28, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
269 IT_COLA_WELLS = 29, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
270 IT_TOY_SHOP = 30, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
271 IT_TOY_FACTORY = 31, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
272 IT_PLASTIC_FOUNTAINS = 32, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
273 IT_FIZZY_DRINK_FACTORY = 33, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
274 IT_BUBBLE_GENERATOR = 34, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
275 IT_TOFFEE_QUARRY = 35, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
276 IT_SUGAR_MINE = 36, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
277 IT_END, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
278 IT_INVALID = 255, |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
279 }; |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
280 |
eabf4b86aed6
(svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
281 #endif /* INDUSTRY_H */ |