Mercurial > hg > openttd
annotate src/station_func.h @ 20307:93d7e37bd666 draft
(svn r25259) -Codechange: track capacities and usage of links
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sun, 19 May 2013 14:22:04 +0000 |
parents | e66469894c9c |
children | 947af5871167 |
rev | line source |
---|---|
8785
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
2 |
12778
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12391
diff
changeset
|
3 /* |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12391
diff
changeset
|
4 * This file is part of OpenTTD. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12391
diff
changeset
|
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12391
diff
changeset
|
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12391
diff
changeset
|
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12391
diff
changeset
|
8 */ |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12391
diff
changeset
|
9 |
8785
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
10 /** @file station_func.h Functions related to stations. */ |
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
11 |
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
12 #ifndef STATION_FUNC_H |
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
13 #define STATION_FUNC_H |
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
14 |
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
15 #include "sprite.h" |
8787
ff327b646d49
(svn r12495) -Codechange: reduce the dependency on newgrf_station.h (especially because newgrf_station.h includes a lot of stuff).
rubidium <rubidium@openttd.org>
parents:
8785
diff
changeset
|
16 #include "rail_type.h" |
8785
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
17 #include "road_type.h" |
20307
93d7e37bd666
(svn r25259) -Codechange: track capacities and usage of links
rubidium <rubidium@openttd.org>
parents:
19907
diff
changeset
|
18 #include "vehicle_type.h" |
18570
bbdb2c13eb92
(svn r23415) -Feature: Infrastructure maintenance costs.
michi_cc <michi_cc@openttd.org>
parents:
15986
diff
changeset
|
19 #include "economy_func.h" |
19907
e66469894c9c
(svn r24840) -Fix: Draw NewGRF railtypes in NewGRF station previews.
peter1138 <peter1138@openttd.org>
parents:
19499
diff
changeset
|
20 #include "rail.h" |
8785
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
21 |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
9334
diff
changeset
|
22 void ModifyStationRatingAround(TileIndex tile, Owner owner, int amount, uint radius); |
8785
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
23 |
14168
02d093d13773
(svn r18716) -Codechange: pass a TileArea to FindStationsAroundTiles
rubidium <rubidium@openttd.org>
parents:
13856
diff
changeset
|
24 void FindStationsAroundTiles(const TileArea &location, StationList *stations); |
8785
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
25 |
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
26 void ShowStationViewWindow(StationID station); |
12391
b7b1110f6c24
(svn r16821) -Codechange: unify the naming of type::UpdateVirtCoord and UpdateAll[Type]VirtCoords.
rubidium <rubidium@openttd.org>
parents:
12263
diff
changeset
|
27 void UpdateAllStationVirtCoords(); |
8785
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
28 |
12263
2af84c928595
(svn r16678) -Codechange: Turn CargoArray into a class, so one does not have to deal with sizeof() wrt. typedef-ed arrays.
frosch <frosch@openttd.org>
parents:
12261
diff
changeset
|
29 CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad); |
13089
559dafab3ecb
(svn r17589) -Codechange: rename town_acc to always_accepted
smatz <smatz@openttd.org>
parents:
12946
diff
changeset
|
30 CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, uint32 *always_accepted = NULL); |
12946
560c26f15688
(svn r17439) -Fix (r17436): you weren't paid for cargo delivered to houses and headquarters anymore
smatz <smatz@openttd.org>
parents:
12778
diff
changeset
|
31 |
560c26f15688
(svn r17439) -Fix (r17436): you weren't paid for cargo delivered to houses and headquarters anymore
smatz <smatz@openttd.org>
parents:
12778
diff
changeset
|
32 void UpdateStationAcceptance(Station *st, bool show_msg); |
8785
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
33 |
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
34 const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx); |
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
35 void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image); |
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
36 |
15896
2338e84ca812
(svn r20579) -Change (r1579): Allow removing of buoys if they are only used by own vehicles.
frosch <frosch@openttd.org>
parents:
14285
diff
changeset
|
37 bool HasStationInUse(StationID station, bool include_company, CompanyID company); |
8785
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
38 |
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
39 void DeleteOilRig(TileIndex t); |
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
40 |
8787
ff327b646d49
(svn r12495) -Codechange: reduce the dependency on newgrf_station.h (especially because newgrf_station.h includes a lot of stuff).
rubidium <rubidium@openttd.org>
parents:
8785
diff
changeset
|
41 /* Check if a rail station tile is traversable. */ |
ff327b646d49
(svn r12495) -Codechange: reduce the dependency on newgrf_station.h (especially because newgrf_station.h includes a lot of stuff).
rubidium <rubidium@openttd.org>
parents:
8785
diff
changeset
|
42 bool IsStationTileBlocked(TileIndex tile); |
ff327b646d49
(svn r12495) -Codechange: reduce the dependency on newgrf_station.h (especially because newgrf_station.h includes a lot of stuff).
rubidium <rubidium@openttd.org>
parents:
8785
diff
changeset
|
43 |
19499
6d89676c61f3
(svn r24402) -Fix [FS#5243]: Station properties 11 and 14 were combined incorrectly.
frosch <frosch@openttd.org>
parents:
18886
diff
changeset
|
44 bool CanStationTileHavePylons(TileIndex tile); |
6d89676c61f3
(svn r24402) -Fix [FS#5243]: Station properties 11 and 14 were combined incorrectly.
frosch <frosch@openttd.org>
parents:
18886
diff
changeset
|
45 bool CanStationTileHaveWires(TileIndex tile); |
8787
ff327b646d49
(svn r12495) -Codechange: reduce the dependency on newgrf_station.h (especially because newgrf_station.h includes a lot of stuff).
rubidium <rubidium@openttd.org>
parents:
8785
diff
changeset
|
46 |
9334
3945a8340531
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas <belugas@openttd.org>
parents:
8787
diff
changeset
|
47 void UpdateAirportsNoise(); |
8787
ff327b646d49
(svn r12495) -Codechange: reduce the dependency on newgrf_station.h (especially because newgrf_station.h includes a lot of stuff).
rubidium <rubidium@openttd.org>
parents:
8785
diff
changeset
|
48 |
19907
e66469894c9c
(svn r24840) -Fix: Draw NewGRF railtypes in NewGRF station previews.
peter1138 <peter1138@openttd.org>
parents:
19499
diff
changeset
|
49 bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset); |
e66469894c9c
(svn r24840) -Fix: Draw NewGRF railtypes in NewGRF station previews.
peter1138 <peter1138@openttd.org>
parents:
19499
diff
changeset
|
50 |
20307
93d7e37bd666
(svn r25259) -Codechange: track capacities and usage of links
rubidium <rubidium@openttd.org>
parents:
19907
diff
changeset
|
51 void IncreaseStats(Station *st, const Vehicle *v, StationID next_station_id); |
93d7e37bd666
(svn r25259) -Codechange: track capacities and usage of links
rubidium <rubidium@openttd.org>
parents:
19907
diff
changeset
|
52 void IncreaseStats(Station *st, CargoID cargo, StationID next_station_id, uint capacity, uint usage); |
93d7e37bd666
(svn r25259) -Codechange: track capacities and usage of links
rubidium <rubidium@openttd.org>
parents:
19907
diff
changeset
|
53 |
18570
bbdb2c13eb92
(svn r23415) -Feature: Infrastructure maintenance costs.
michi_cc <michi_cc@openttd.org>
parents:
15986
diff
changeset
|
54 /** |
bbdb2c13eb92
(svn r23415) -Feature: Infrastructure maintenance costs.
michi_cc <michi_cc@openttd.org>
parents:
15986
diff
changeset
|
55 * Calculates the maintenance cost of a number of station tiles. |
bbdb2c13eb92
(svn r23415) -Feature: Infrastructure maintenance costs.
michi_cc <michi_cc@openttd.org>
parents:
15986
diff
changeset
|
56 * @param num Number of station tiles. |
bbdb2c13eb92
(svn r23415) -Feature: Infrastructure maintenance costs.
michi_cc <michi_cc@openttd.org>
parents:
15986
diff
changeset
|
57 * @return Total cost. |
bbdb2c13eb92
(svn r23415) -Feature: Infrastructure maintenance costs.
michi_cc <michi_cc@openttd.org>
parents:
15986
diff
changeset
|
58 */ |
bbdb2c13eb92
(svn r23415) -Feature: Infrastructure maintenance costs.
michi_cc <michi_cc@openttd.org>
parents:
15986
diff
changeset
|
59 static inline Money StationMaintenanceCost(uint32 num) |
bbdb2c13eb92
(svn r23415) -Feature: Infrastructure maintenance costs.
michi_cc <michi_cc@openttd.org>
parents:
15986
diff
changeset
|
60 { |
bbdb2c13eb92
(svn r23415) -Feature: Infrastructure maintenance costs.
michi_cc <michi_cc@openttd.org>
parents:
15986
diff
changeset
|
61 return (_price[PR_INFRASTRUCTURE_STATION] * num * (1 + IntSqrt(num))) >> 7; // 7 bits scaling. |
bbdb2c13eb92
(svn r23415) -Feature: Infrastructure maintenance costs.
michi_cc <michi_cc@openttd.org>
parents:
15986
diff
changeset
|
62 } |
bbdb2c13eb92
(svn r23415) -Feature: Infrastructure maintenance costs.
michi_cc <michi_cc@openttd.org>
parents:
15986
diff
changeset
|
63 |
bbdb2c13eb92
(svn r23415) -Feature: Infrastructure maintenance costs.
michi_cc <michi_cc@openttd.org>
parents:
15986
diff
changeset
|
64 Money AirportMaintenanceCost(Owner owner); |
bbdb2c13eb92
(svn r23415) -Feature: Infrastructure maintenance costs.
michi_cc <michi_cc@openttd.org>
parents:
15986
diff
changeset
|
65 |
8785
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
66 #endif /* STATION_FUNC_H */ |