diff options
author | rubidium <rubidium@openttd.org> | 2008-01-09 21:27:39 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-01-09 21:27:39 +0000 |
commit | 6c954cad5f73f20fad3804d16f1852c7b52d3ad7 (patch) | |
tree | 03527c71c555a5972cd91f9807d88fc1d057bc65 /src | |
parent | 998d7644f6a1b58de0b06d539c0436808b1f1e95 (diff) | |
download | openttd-6c954cad5f73f20fad3804d16f1852c7b52d3ad7.tar.xz |
(svn r11801) -Codechange: remove some unneeded includes from some header files.
Diffstat (limited to 'src')
-rw-r--r-- | src/airport_gui.cpp | 1 | ||||
-rw-r--r-- | src/autoslope.h | 1 | ||||
-rw-r--r-- | src/cargopacket.h | 1 | ||||
-rw-r--r-- | src/depot_gui.cpp | 1 | ||||
-rw-r--r-- | src/dock_gui.cpp | 1 | ||||
-rw-r--r-- | src/elrail.cpp | 1 | ||||
-rw-r--r-- | src/engine.h | 2 | ||||
-rw-r--r-- | src/group.h | 16 | ||||
-rw-r--r-- | src/group_cmd.cpp | 17 | ||||
-rw-r--r-- | src/group_gui.cpp | 1 | ||||
-rw-r--r-- | src/industry_gui.cpp | 1 | ||||
-rw-r--r-- | src/newgrf.cpp | 1 | ||||
-rw-r--r-- | src/newgrf_house.cpp | 1 | ||||
-rw-r--r-- | src/newgrf_industries.cpp | 1 | ||||
-rw-r--r-- | src/newgrf_station.cpp | 1 | ||||
-rw-r--r-- | src/newgrf_station.h | 1 | ||||
-rw-r--r-- | src/order_gui.cpp | 1 | ||||
-rw-r--r-- | src/player.h | 2 | ||||
-rw-r--r-- | src/players.cpp | 2 | ||||
-rw-r--r-- | src/rail.cpp | 1 | ||||
-rw-r--r-- | src/rail_gui.cpp | 1 | ||||
-rw-r--r-- | src/road_gui.cpp | 1 | ||||
-rw-r--r-- | src/station.h | 1 | ||||
-rw-r--r-- | src/strings.cpp | 1 | ||||
-rw-r--r-- | src/timetable_gui.cpp | 1 | ||||
-rw-r--r-- | src/viewport.cpp | 1 | ||||
-rw-r--r-- | src/water_cmd.cpp | 1 | ||||
-rw-r--r-- | src/waypoint.cpp | 1 | ||||
-rw-r--r-- | src/waypoint.h | 1 |
29 files changed, 43 insertions, 20 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index fd258aa77..d83053ce3 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -19,6 +19,7 @@ #include "variables.h" #include "viewport_func.h" #include "gfx_func.h" +#include "player.h" static byte _selected_airport_type; diff --git a/src/autoslope.h b/src/autoslope.h index 0b55b161d..73f5392b1 100644 --- a/src/autoslope.h +++ b/src/autoslope.h @@ -7,6 +7,7 @@ #include "depot.h" #include "settings_type.h" +#include "player.h" /** * Autoslope check for tiles with an entrance on an edge. diff --git a/src/cargopacket.h b/src/cargopacket.h index fe978667a..b8c8b9360 100644 --- a/src/cargopacket.h +++ b/src/cargopacket.h @@ -6,6 +6,7 @@ #define CARGOPACKET_H #include "economy_type.h" +#include "tile_type.h" #include <list> typedef uint32 CargoPacketID; diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 00c10be34..d9de5b594 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -23,6 +23,7 @@ #include "strings_func.h" #include "window_func.h" #include "vehicle_func.h" +#include "player.h" /* * Since all depot window sizes aren't the same, we need to modify sizes a little. diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index f7115232b..6add0c47a 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -20,6 +20,7 @@ #include "sound_func.h" #include "viewport_func.h" #include "gfx_func.h" +#include "player.h" static void ShowBuildDockStationPicker(); static void ShowBuildDocksDepotPicker(); diff --git a/src/elrail.cpp b/src/elrail.cpp index c074b9b02..827ab2cd0 100644 --- a/src/elrail.cpp +++ b/src/elrail.cpp @@ -65,6 +65,7 @@ #include "transparency.h" #include "tunnelbridge_map.h" #include "vehicle_func.h" +#include "player.h" static inline TLG GetTLG(TileIndex t) diff --git a/src/engine.h b/src/engine.h index 2f82e7472..d4d004007 100644 --- a/src/engine.h +++ b/src/engine.h @@ -5,11 +5,9 @@ #ifndef ENGINE_H #define ENGINE_H -#include "oldpool.h" #include "rail_type.h" #include "cargo_type.h" #include "vehicle_type.h" -#include "command_type.h" #include "gfx_type.h" #include "date_type.h" #include "sound_type.h" diff --git a/src/group.h b/src/group.h index 7c0e1c9ac..297b02b4d 100644 --- a/src/group.h +++ b/src/group.h @@ -76,19 +76,7 @@ static inline uint GetGroupArraySize(void) * @param id_e The EngineID of the engine to count * @return The number of engines with EngineID id_e in the group */ -static inline uint GetGroupNumEngines(PlayerID p, GroupID id_g, EngineID id_e) -{ - if (IsValidGroupID(id_g)) return GetGroup(id_g)->num_engines[id_e]; - - uint num = GetPlayer(p)->num_engines[id_e]; - if (!IsDefaultGroupID(id_g)) return num; - - const Group *g; - FOR_ALL_GROUPS(g) { - if (g->owner == p) num -= g->num_engines[id_e]; - } - return num; -} +uint GetGroupNumEngines(PlayerID p, GroupID id_g, EngineID id_e); static inline void IncreaseGroupNumVehicle(GroupID id_g) { @@ -105,6 +93,6 @@ void InitializeGroup(); void SetTrainGroupID(Vehicle *v, GroupID grp); void UpdateTrainGroupID(Vehicle *v); void RemoveVehicleFromGroup(const Vehicle *v); -void RemoveAllGroupsForPlayer(const Player *p); +void RemoveAllGroupsForPlayer(const PlayerID p); #endif /* GROUP_H */ diff --git a/src/group_cmd.cpp b/src/group_cmd.cpp index 3df9d0694..42ac7b58b 100644 --- a/src/group_cmd.cpp +++ b/src/group_cmd.cpp @@ -409,13 +409,26 @@ void UpdateTrainGroupID(Vehicle *v) InvalidateWindow(WC_REPLACE_VEHICLE, VEH_TRAIN); } +uint GetGroupNumEngines(PlayerID p, GroupID id_g, EngineID id_e) +{ + if (IsValidGroupID(id_g)) return GetGroup(id_g)->num_engines[id_e]; + + uint num = GetPlayer(p)->num_engines[id_e]; + if (!IsDefaultGroupID(id_g)) return num; + + const Group *g; + FOR_ALL_GROUPS(g) { + if (g->owner == p) num -= g->num_engines[id_e]; + } + return num; +} -void RemoveAllGroupsForPlayer(const Player *p) +void RemoveAllGroupsForPlayer(const PlayerID p) { Group *g; FOR_ALL_GROUPS(g) { - if (p->index == g->owner) delete g; + if (p == g->owner) delete g; } } diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 975841028..bb5b25e2c 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -24,6 +24,7 @@ #include "string_func.h" #include "viewport_func.h" #include "gfx_func.h" +#include "player.h" struct Sorting { diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 9dd623d93..bd873ffbd 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -23,6 +23,7 @@ #include "newgrf_text.h" #include "strings_func.h" #include "map_func.h" +#include "player.h" bool _ignore_restrictions; diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 3d3973cd2..7c5eac1f6 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -47,6 +47,7 @@ #include "sound_func.h" #include "string_func.h" #include "road_func.h" +#include "player.h" /* TTDPatch extended GRF format codec * (c) Petr Baudis 2004 (GPL'd) diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp index d54ed925f..191f918bf 100644 --- a/src/newgrf_house.cpp +++ b/src/newgrf_house.cpp @@ -23,6 +23,7 @@ #include "newgrf_commons.h" #include "transparency.h" #include "functions.h" +#include "player.h" static BuildingCounts _building_counts; static HouseClassMapping _class_mapping[HOUSE_CLASS_MAX]; diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index 46b3650e9..be941f75f 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -20,6 +20,7 @@ #include "newgrf_town.h" #include "window_func.h" #include "town.h" +#include "player.h" /* Since the industry IDs defined by the GRF file don't necessarily correlate * to those used by the game, the IDs used for overriding old industries must be diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 7a0135501..e4b5cb02a 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -23,6 +23,7 @@ #include "newgrf_town.h" #include "gfx_func.h" #include "date_func.h" +#include "player.h" static StationClass station_classes[STAT_CLASS_MAX]; diff --git a/src/newgrf_station.h b/src/newgrf_station.h index b9a671804..ee9050b5e 100644 --- a/src/newgrf_station.h +++ b/src/newgrf_station.h @@ -8,6 +8,7 @@ #include "engine.h" #include "newgrf_callbacks.h" #include "newgrf_cargo.h" +#include "tile_type.h" enum StationClassID { STAT_CLASS_BEGIN = 0, ///< the lowest valid value diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 208aa48e2..f7a0b32e6 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -27,6 +27,7 @@ #include "window_func.h" #include "vehicle_func.h" #include "settings_type.h" +#include "player.h" enum OrderWindowWidgets { ORDER_WIDGET_CLOSEBOX = 0, diff --git a/src/player.h b/src/player.h index 5ebe5d37d..cc6133d72 100644 --- a/src/player.h +++ b/src/player.h @@ -11,6 +11,8 @@ #include "engine.h" #include "livery.h" #include "autoreplace_type.h" +#include "economy_type.h" +#include "tile_type.h" struct PlayerEconomyEntry { Money income; diff --git a/src/players.cpp b/src/players.cpp index 9c0ee2e67..493a9877a 100644 --- a/src/players.cpp +++ b/src/players.cpp @@ -889,7 +889,7 @@ CommandCost CmdPlayerCtrl(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) p->is_active = false; } RemoveAllEngineReplacementForPlayer(p); - RemoveAllGroupsForPlayer(p); + RemoveAllGroupsForPlayer(p->index); } break; diff --git a/src/rail.cpp b/src/rail.cpp index b722fd5d8..f903098ce 100644 --- a/src/rail.cpp +++ b/src/rail.cpp @@ -11,6 +11,7 @@ #include "tunnelbridge_map.h" #include "settings_type.h" #include "date_func.h" +#include "player.h" /* XXX: Below 3 tables store duplicate data. Maybe remove some? */ diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index b83a4efe6..efe86595a 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -27,6 +27,7 @@ #include "window_func.h" #include "date_func.h" #include "sound_func.h" +#include "player.h" #include "bridge_map.h" #include "rail_map.h" diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 276b05281..f5194c367 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -23,6 +23,7 @@ #include "window_func.h" #include "vehicle_func.h" #include "sound_func.h" +#include "player.h" static void ShowRVStationPicker(RoadStop::Type rs); diff --git a/src/station.h b/src/station.h index c80a43fa7..eb9046781 100644 --- a/src/station.h +++ b/src/station.h @@ -6,7 +6,6 @@ #define STATION_H #include "airport.h" -#include "player.h" #include "oldpool.h" #include "sprite.h" #include "road_type.h" diff --git a/src/strings.cpp b/src/strings.cpp index e92c2fce4..f5d063603 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -34,6 +34,7 @@ #include "date_func.h" #include "vehicle_base.h" #include "string_func.h" +#include "player.h" /* for opendir/readdir/closedir */ # include "fios.h" diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 2c666033f..ca21d0102 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -17,6 +17,7 @@ #include "vehicle_base.h" #include "string_func.h" #include "gfx_func.h" +#include "player.h" static int GetOrderFromTimetableWndPt(Window *w, int y, const Vehicle *v) { diff --git a/src/viewport.cpp b/src/viewport.cpp index c07b2b36a..03fe84a09 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -25,6 +25,7 @@ #include "strings_func.h" #include "zoom_func.h" #include "vehicle_func.h" +#include "player.h" #define VIEWPORT_DRAW_MEM (65536 * 2) diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index afba2fa22..2d31c7038 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -33,6 +33,7 @@ #include "vehicle_func.h" #include "sound_func.h" #include "variables.h" +#include "player.h" static Vehicle *FindFloodableVehicleOnTile(TileIndex tile); diff --git a/src/waypoint.cpp b/src/waypoint.cpp index d7b243f3e..39d44981a 100644 --- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -29,6 +29,7 @@ #include "vehicle_func.h" #include "vehicle_base.h" #include "string_func.h" +#include "player.h" enum { MAX_WAYPOINTS_PER_TOWN = 64, diff --git a/src/waypoint.h b/src/waypoint.h index 46ffbc89e..ea908145f 100644 --- a/src/waypoint.h +++ b/src/waypoint.h @@ -7,6 +7,7 @@ #include "oldpool.h" #include "rail_map.h" +#include "command_type.h" struct Waypoint; DECLARE_OLD_POOL(Waypoint, Waypoint, 3, 8000) |