mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
This commit is contained in:
parent
4a1035ab95
commit
2edd403656
|
@ -15,7 +15,6 @@
|
|||
#include "../../command_func.h"
|
||||
#include "../../town.h"
|
||||
#include "../../industry.h"
|
||||
#include "../../station.h"
|
||||
#include "../../pathfind.h"
|
||||
#include "../../airport.h"
|
||||
#include "../../depot.h"
|
||||
|
@ -2690,10 +2689,10 @@ static CommandCost AiDoBuildDefaultRoadBlock(TileIndex tile, const AiDefaultBloc
|
|||
} else if (p->mode == 1) {
|
||||
if (_want_road_truck_station) {
|
||||
// Truck station
|
||||
ret = DoCommand(c, p->attr, ROADTYPES_ROAD << 2 | RoadStop::TRUCK, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_ROAD_STOP);
|
||||
ret = DoCommand(c, p->attr, ROADTYPES_ROAD << 2 | ROADSTOP_TRUCK, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_ROAD_STOP);
|
||||
} else {
|
||||
// Bus station
|
||||
ret = DoCommand(c, p->attr, ROADTYPES_ROAD << 2 | RoadStop::BUS, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_ROAD_STOP);
|
||||
ret = DoCommand(c, p->attr, ROADTYPES_ROAD << 2 | ROADSTOP_BUS, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_ROAD_STOP);
|
||||
}
|
||||
clear_town_stuff:;
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "../../command_func.h"
|
||||
#include "trolly.h"
|
||||
#include "../../engine.h"
|
||||
#include "../../station.h"
|
||||
#include "../../variables.h"
|
||||
#include "../../bridge.h"
|
||||
#include "../../vehicle_func.h"
|
||||
|
@ -44,9 +43,9 @@ CommandCost AiNew_Build_Station(Player *p, byte type, TileIndex tile, byte lengt
|
|||
return AI_DoCommand(tile, direction + (numtracks << 8) + (length << 16), 0, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_RAILROAD_STATION);
|
||||
|
||||
if (type == AI_BUS)
|
||||
return AI_DoCommand(tile, direction, ROADTYPES_ROAD << 2 | RoadStop::BUS, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD_STOP);
|
||||
return AI_DoCommand(tile, direction, ROADTYPES_ROAD << 2 | ROADSTOP_BUS, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD_STOP);
|
||||
|
||||
return AI_DoCommand(tile, direction, ROADTYPES_ROAD << 2 | RoadStop::TRUCK, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD_STOP);
|
||||
return AI_DoCommand(tile, direction, ROADTYPES_ROAD << 2 | ROADSTOP_TRUCK, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD_STOP);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "trolly.h"
|
||||
#include "../../town.h"
|
||||
#include "../../industry.h"
|
||||
#include "../../station.h"
|
||||
#include "../../station_base.h"
|
||||
#include "../../engine.h"
|
||||
#include "../../gui.h"
|
||||
#include "../../depot.h"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define AIRCRAFT_H
|
||||
|
||||
#include "station_map.h"
|
||||
#include "station_base.h"
|
||||
#include "vehicle_base.h"
|
||||
#include "engine.h"
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "timetable.h"
|
||||
#include "depot.h"
|
||||
#include "engine.h"
|
||||
#include "station.h"
|
||||
#include "news_func.h"
|
||||
#include "aircraft.h"
|
||||
#include "airport.h"
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "station_gui.h"
|
||||
#include "terraform_gui.h"
|
||||
#include "command_func.h"
|
||||
#include "station.h"
|
||||
#include "airport.h"
|
||||
#include "depot.h"
|
||||
#include "sound_func.h"
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "gui.h"
|
||||
#include "articulated_vehicles.h"
|
||||
#include "textbuf_gui.h"
|
||||
#include "station.h"
|
||||
#include "command_func.h"
|
||||
#include "engine.h"
|
||||
#include "player_func.h"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "cargopacket.h"
|
||||
#include "saveload.h"
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#ifndef CARGOPACKET_H
|
||||
#define CARGOPACKET_H
|
||||
|
||||
#include "oldpool.h"
|
||||
#include "economy_type.h"
|
||||
#include "tile_type.h"
|
||||
#include "station_type.h"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "command_func.h"
|
||||
#include "tile_cmd.h"
|
||||
#include "news_func.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "waypoint.h"
|
||||
#include "town.h"
|
||||
#include "industry.h"
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "landscape.h"
|
||||
#include "player_base.h"
|
||||
#include "player_func.h"
|
||||
#include "station.h"
|
||||
#include "command_func.h"
|
||||
#include "saveload.h"
|
||||
#include "industry.h"
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "date_func.h"
|
||||
#include "vehicle_func.h"
|
||||
#include "sound_func.h"
|
||||
#include "station_base.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
#include "table/sprites.h"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "textbuf_gui.h"
|
||||
#include "viewport_func.h"
|
||||
#include "gfx_func.h"
|
||||
#include "station.h"
|
||||
#include "station_func.h"
|
||||
#include "command_func.h"
|
||||
#include "player_func.h"
|
||||
#include "player_base.h"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "../console.h"
|
||||
#include "../command_func.h"
|
||||
#include "../saveload.h"
|
||||
#include "../station.h"
|
||||
#include "../station_base.h"
|
||||
#include "../variables.h"
|
||||
#include "../genworld.h"
|
||||
#include "../core/alloc_func.hpp"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "fileio.h"
|
||||
#include "engine.h"
|
||||
#include "spritecache.h"
|
||||
#include "station.h"
|
||||
#include "sprite.h"
|
||||
#include "newgrf.h"
|
||||
#include "variables.h"
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
#ifndef NEWGRF_H
|
||||
#define NEWGRF_H
|
||||
|
||||
#include "station.h"
|
||||
#include "town_type.h"
|
||||
#include "newgrf_config.h"
|
||||
#include "cargotype.h"
|
||||
#include "industry_type.h"
|
||||
#include "newgrf_station.h"
|
||||
|
||||
enum GrfLoadingStage {
|
||||
GLS_FILESCAN,
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "train.h"
|
||||
#include "player_func.h"
|
||||
#include "player_base.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "airport.h"
|
||||
#include "newgrf.h"
|
||||
#include "newgrf_callbacks.h"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "landscape.h"
|
||||
#include "debug.h"
|
||||
#include "sprite.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "station_map.h"
|
||||
#include "newgrf.h"
|
||||
#include "newgrf_callbacks.h"
|
||||
|
|
|
@ -9,7 +9,10 @@
|
|||
#include "newgrf_callbacks.h"
|
||||
#include "newgrf_cargo.h"
|
||||
#include "tile_type.h"
|
||||
#include "station_type.h"
|
||||
#include "strings_type.h"
|
||||
#include "sprite.h"
|
||||
#include "direction_type.h"
|
||||
|
||||
enum StationClassID {
|
||||
STAT_CLASS_BEGIN = 0, ///< the lowest valid value
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "landscape.h"
|
||||
#include "aystar.h"
|
||||
#include "pathfind.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "station_map.h"
|
||||
#include "depot.h"
|
||||
#include "tunnel_map.h"
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
#define NPF_H
|
||||
|
||||
#include "aystar.h"
|
||||
#include "station.h"
|
||||
#include "station_type.h"
|
||||
#include "rail_type.h"
|
||||
#include "player_type.h"
|
||||
#include "vehicle_type.h"
|
||||
#include "tile_type.h"
|
||||
#include "track_type.h"
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "station_map.h"
|
||||
#include "town.h"
|
||||
#include "industry.h"
|
||||
#include "station.h"
|
||||
#include "player_func.h"
|
||||
#include "player_base.h"
|
||||
#include "engine.h"
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "gfxinit.h"
|
||||
#include "gui.h"
|
||||
#include "landscape.h"
|
||||
#include "station.h"
|
||||
#include "station_map.h"
|
||||
#include "town_map.h"
|
||||
#include "tunnel_map.h"
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "depot.h"
|
||||
#include "waypoint.h"
|
||||
#include "command_func.h"
|
||||
#include "station.h"
|
||||
#include "player_func.h"
|
||||
#include "news_func.h"
|
||||
#include "saveload.h"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "station_map.h"
|
||||
#include "gui.h"
|
||||
#include "window_gui.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "town.h"
|
||||
#include "command_func.h"
|
||||
#include "viewport_func.h"
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "player_func.h"
|
||||
#include "player_gui.h"
|
||||
#include "town.h"
|
||||
#include "station.h"
|
||||
#include "news_func.h"
|
||||
#include "saveload.h"
|
||||
#include "command_func.h"
|
||||
|
@ -34,6 +33,7 @@
|
|||
#include "ai/trolly/trolly.h"
|
||||
#include "road_func.h"
|
||||
#include "rail.h"
|
||||
#include "sprite.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
#include "table/sprites.h"
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "pathfind.h"
|
||||
#include "engine.h"
|
||||
#include "town.h"
|
||||
#include "station.h"
|
||||
#include "sprite.h"
|
||||
#include "depot.h"
|
||||
#include "waypoint.h"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "viewport_func.h"
|
||||
#include "gfx_func.h"
|
||||
#include "command_func.h"
|
||||
#include "station.h"
|
||||
#include "town_type.h"
|
||||
#include "waypoint.h"
|
||||
#include "debug.h"
|
||||
#include "variables.h"
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "road_cmd.h"
|
||||
#include "road_map.h"
|
||||
#include "station_map.h"
|
||||
#include "station.h"
|
||||
#include "functions.h"
|
||||
#include "window_func.h"
|
||||
#include "vehicle_func.h"
|
||||
|
@ -27,7 +26,7 @@
|
|||
#include "table/sprites.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
static void ShowRVStationPicker(RoadStop::Type rs);
|
||||
static void ShowRVStationPicker(RoadStopType rs);
|
||||
static void ShowRoadDepotPicker();
|
||||
|
||||
static bool _remove_button_clicked;
|
||||
|
@ -215,18 +214,18 @@ static void PlaceRoadStop(TileIndex tile, uint32 p2, uint32 cmd)
|
|||
static void PlaceRoad_BusStation(TileIndex tile)
|
||||
{
|
||||
if (_remove_button_clicked) {
|
||||
DoCommandP(tile, 0, RoadStop::BUS, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[RoadStop::BUS]));
|
||||
DoCommandP(tile, 0, ROADSTOP_BUS, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[ROADSTOP_BUS]));
|
||||
} else {
|
||||
PlaceRoadStop(tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | RoadStop::BUS, CMD_BUILD_ROAD_STOP | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[RoadStop::BUS]));
|
||||
PlaceRoadStop(tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | ROADSTOP_BUS, CMD_BUILD_ROAD_STOP | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[ROADSTOP_BUS]));
|
||||
}
|
||||
}
|
||||
|
||||
static void PlaceRoad_TruckStation(TileIndex tile)
|
||||
{
|
||||
if (_remove_button_clicked) {
|
||||
DoCommandP(tile, 0, RoadStop::TRUCK, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[RoadStop::TRUCK]));
|
||||
DoCommandP(tile, 0, ROADSTOP_TRUCK, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[ROADSTOP_TRUCK]));
|
||||
} else {
|
||||
PlaceRoadStop(tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | RoadStop::TRUCK, CMD_BUILD_ROAD_STOP | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[RoadStop::TRUCK]));
|
||||
PlaceRoadStop(tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | ROADSTOP_TRUCK, CMD_BUILD_ROAD_STOP | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[ROADSTOP_TRUCK]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -334,13 +333,13 @@ static void BuildRoadClick_Depot(Window *w)
|
|||
static void BuildRoadClick_BusStation(Window *w)
|
||||
{
|
||||
if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
|
||||
if (HandlePlacePushButton(w, RTW_BUS_STATION, SPR_CURSOR_BUS_STATION, VHM_RECT, PlaceRoad_BusStation)) ShowRVStationPicker(RoadStop::BUS);
|
||||
if (HandlePlacePushButton(w, RTW_BUS_STATION, SPR_CURSOR_BUS_STATION, VHM_RECT, PlaceRoad_BusStation)) ShowRVStationPicker(ROADSTOP_BUS);
|
||||
}
|
||||
|
||||
static void BuildRoadClick_TruckStation(Window *w)
|
||||
{
|
||||
if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
|
||||
if (HandlePlacePushButton(w, RTW_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, VHM_RECT, PlaceRoad_TruckStation)) ShowRVStationPicker(RoadStop::TRUCK);
|
||||
if (HandlePlacePushButton(w, RTW_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, VHM_RECT, PlaceRoad_TruckStation)) ShowRVStationPicker(ROADSTOP_TRUCK);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -942,12 +941,12 @@ static const WindowDesc _rv_station_picker_desc = {
|
|||
RoadStationPickerWndProc
|
||||
};
|
||||
|
||||
static void ShowRVStationPicker(RoadStop::Type rs)
|
||||
static void ShowRVStationPicker(RoadStopType rs)
|
||||
{
|
||||
Window *w = AllocateWindowDesc(&_rv_station_picker_desc);
|
||||
if (w == NULL) return;
|
||||
|
||||
w->window_class = (rs == RoadStop::BUS) ? WC_BUS_STATION : WC_TRUCK_STATION;
|
||||
w->window_class = (rs == ROADSTOP_BUS) ? WC_BUS_STATION : WC_TRUCK_STATION;
|
||||
w->widget[BRSW_CAPTION].data = _road_type_infos[_cur_roadtype].picker_title[rs];
|
||||
for (uint i = BRSW_STATION_NE; i < BRSW_LT_OFF; i++) w->widget[i].tooltips = _road_type_infos[_cur_roadtype].picker_tooltip[rs];
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "bridge_map.h"
|
||||
#include "tile_cmd.h"
|
||||
#include "road_map.h"
|
||||
#include "station.h"
|
||||
#include "tunnel_map.h"
|
||||
#include "station_map.h"
|
||||
#include "depot.h"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "timetable.h"
|
||||
#include "engine.h"
|
||||
#include "command_func.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "news_func.h"
|
||||
#include "pathfind.h"
|
||||
#include "npf.h"
|
||||
|
@ -1171,7 +1171,7 @@ static Trackdir RoadFindPathToDest(Vehicle* v, TileIndex tile, DiagDirection ent
|
|||
trackdirs = TRACKDIR_BIT_NONE;
|
||||
} else {
|
||||
/* Our station */
|
||||
RoadStop::Type rstype = IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? RoadStop::BUS : RoadStop::TRUCK;
|
||||
RoadStopType rstype = IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? ROADSTOP_BUS : ROADSTOP_TRUCK;
|
||||
|
||||
if (GetRoadStopType(tile) != rstype) {
|
||||
/* Wrong station type */
|
||||
|
@ -1807,7 +1807,7 @@ again:
|
|||
_road_veh_data_1[v->u.road.state - RVSB_IN_ROAD_STOP + (_opt.road_side << RVS_DRIVE_SIDE)] == v->u.road.frame) ||
|
||||
(IsInsideMM(v->u.road.state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END) &&
|
||||
v->current_order.dest == GetStationIndex(v->tile) &&
|
||||
GetRoadStopType(v->tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? RoadStop::BUS : RoadStop::TRUCK) &&
|
||||
GetRoadStopType(v->tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? ROADSTOP_BUS : ROADSTOP_TRUCK) &&
|
||||
v->u.road.frame == RVC_DRIVE_THROUGH_STOP_FRAME))) {
|
||||
|
||||
RoadStop *rs = GetRoadStopByTile(v->tile, GetRoadStopType(v->tile));
|
||||
|
@ -1822,7 +1822,7 @@ again:
|
|||
|
||||
if (IsDriveThroughStopTile(v->tile)) {
|
||||
TileIndex next_tile = TILE_ADD(v->tile, TileOffsByDir(v->direction));
|
||||
RoadStop::Type type = IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? RoadStop::BUS : RoadStop::TRUCK;
|
||||
RoadStopType type = IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? ROADSTOP_BUS : ROADSTOP_TRUCK;
|
||||
|
||||
/* Check if next inline bay is free */
|
||||
if (IsDriveThroughStopTile(next_tile) && (GetRoadStopType(next_tile) == type)) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "debug.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "thread.h"
|
||||
#include "town.h"
|
||||
#include "saveload.h"
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "waypoint.h"
|
||||
#include "widgets/dropdown_type.h"
|
||||
#include "widgets/dropdown_func.h"
|
||||
#include "station_func.h"
|
||||
|
||||
#include "table/sprites.h"
|
||||
#include "table/strings.h"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "command_func.h"
|
||||
#include "pathfind.h"
|
||||
#include "station_map.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "news_func.h"
|
||||
#include "engine.h"
|
||||
#include "player_func.h"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "bridge_map.h"
|
||||
#include "debug.h"
|
||||
#include "station_map.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "town.h"
|
||||
#include "saveload.h"
|
||||
#include "player_func.h"
|
||||
|
@ -100,7 +100,7 @@ Station::~Station()
|
|||
*/
|
||||
RoadStop *Station::GetPrimaryRoadStop(const Vehicle *v) const
|
||||
{
|
||||
RoadStop *rs = this->GetPrimaryRoadStop(IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? RoadStop::BUS : RoadStop::TRUCK);
|
||||
RoadStop *rs = this->GetPrimaryRoadStop(IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? ROADSTOP_BUS : ROADSTOP_TRUCK);
|
||||
|
||||
for (; rs != NULL; rs = rs->next) {
|
||||
/* The vehicle cannot go to this roadstop (different roadtype) */
|
||||
|
|
|
@ -1,22 +1,18 @@
|
|||
/* $Id$ */
|
||||
|
||||
/** @file station.h */
|
||||
/** @file station_base.h Base classes/functions for stations. */
|
||||
|
||||
#ifndef STATION_H
|
||||
#define STATION_H
|
||||
#ifndef STATION_BASE_H
|
||||
#define STATION_BASE_H
|
||||
|
||||
#include "station_type.h"
|
||||
#include "airport.h"
|
||||
#include "oldpool.h"
|
||||
#include "sprite.h"
|
||||
#include "road_type.h"
|
||||
#include "newgrf_station.h"
|
||||
#include "cargopacket.h"
|
||||
#include "cargo_type.h"
|
||||
#include "town_type.h"
|
||||
#include "core/geometry_type.hpp"
|
||||
#include "newgrf_station.h"
|
||||
#include <list>
|
||||
#include <set>
|
||||
|
||||
DECLARE_OLD_POOL(Station, Station, 6, 1000)
|
||||
DECLARE_OLD_POOL(RoadStop, RoadStop, 5, 2000)
|
||||
|
@ -47,12 +43,6 @@ struct GoodsEntry {
|
|||
|
||||
/** A Stop for a Road Vehicle */
|
||||
struct RoadStop : PoolItem<RoadStop, RoadStopID, &_RoadStop_pool> {
|
||||
/** Types of RoadStops */
|
||||
enum Type {
|
||||
BUS, ///< A standard stop for buses
|
||||
TRUCK ///< A standard stop for trucks
|
||||
};
|
||||
|
||||
static const int cDebugCtorLevel = 5; ///< Debug level on which Contructor / Destructor messages are printed
|
||||
static const uint LIMIT = 16; ///< The maximum amount of roadstops that are allowed at a single station
|
||||
static const uint MAX_BAY_COUNT = 2; ///< The maximum number of loading bays
|
||||
|
@ -114,9 +104,9 @@ struct StationRect : public Rect {
|
|||
|
||||
struct Station : PoolItem<Station, StationID, &_Station_pool> {
|
||||
public:
|
||||
RoadStop *GetPrimaryRoadStop(RoadStop::Type type) const
|
||||
RoadStop *GetPrimaryRoadStop(RoadStopType type) const
|
||||
{
|
||||
return type == RoadStop::BUS ? bus_stops : truck_stops;
|
||||
return type == ROADSTOP_BUS ? bus_stops : truck_stops;
|
||||
}
|
||||
|
||||
RoadStop *GetPrimaryRoadStop(const Vehicle *v) const;
|
||||
|
@ -200,16 +190,6 @@ public:
|
|||
inline bool IsValid() const { return this->xy != 0; }
|
||||
};
|
||||
|
||||
void ModifyStationRatingAround(TileIndex tile, PlayerID owner, int amount, uint radius);
|
||||
|
||||
/** A set of stations (\c const \c Station* ) */
|
||||
typedef std::set<Station*> StationSet;
|
||||
|
||||
StationSet FindStationsAroundIndustryTile(TileIndex tile, int w, int h);
|
||||
|
||||
void ShowStationViewWindow(StationID station);
|
||||
void UpdateAllStationVirtCoord();
|
||||
|
||||
static inline StationID GetMaxStationIndex()
|
||||
{
|
||||
/* TODO - This isn't the real content of the function, but
|
||||
|
@ -241,22 +221,4 @@ static inline bool IsValidStationID(StationID index)
|
|||
|
||||
/* End of stuff for ROADSTOPS */
|
||||
|
||||
|
||||
void AfterLoadStations();
|
||||
void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile, int w, int h, int rad);
|
||||
void GetAcceptanceAroundTiles(AcceptedCargo accepts, TileIndex tile, int w, int h, int rad);
|
||||
|
||||
|
||||
const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx);
|
||||
void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image);
|
||||
|
||||
RoadStop * GetRoadStopByTile(TileIndex tile, RoadStop::Type type);
|
||||
uint GetNumRoadStops(const Station* st, RoadStop::Type type);
|
||||
RoadStop * AllocateRoadStop();
|
||||
void ClearSlot(Vehicle *v);
|
||||
|
||||
bool HasStationInUse(StationID station, PlayerID player);
|
||||
|
||||
void DeleteOilRig(TileIndex t);
|
||||
|
||||
#endif /* STATION_H */
|
||||
#endif /* STATION_BASE_H */
|
|
@ -11,7 +11,6 @@
|
|||
#include "tile_cmd.h"
|
||||
#include "landscape.h"
|
||||
#include "station_map.h"
|
||||
#include "station.h"
|
||||
#include "viewport_func.h"
|
||||
#include "command_func.h"
|
||||
#include "town.h"
|
||||
|
@ -71,7 +70,7 @@ bool IsHangar(TileIndex t)
|
|||
return false;
|
||||
}
|
||||
|
||||
RoadStop* GetRoadStopByTile(TileIndex tile, RoadStop::Type type)
|
||||
RoadStop* GetRoadStopByTile(TileIndex tile, RoadStopType type)
|
||||
{
|
||||
const Station* st = GetStationByTile(tile);
|
||||
|
||||
|
@ -82,7 +81,7 @@ RoadStop* GetRoadStopByTile(TileIndex tile, RoadStop::Type type)
|
|||
}
|
||||
|
||||
|
||||
static uint GetNumRoadStopsInStation(const Station* st, RoadStop::Type type)
|
||||
static uint GetNumRoadStopsInStation(const Station* st, RoadStopType type)
|
||||
{
|
||||
uint num = 0;
|
||||
|
||||
|
@ -1298,7 +1297,7 @@ static CommandCost RemoveRailroadStation(Station *st, TileIndex tile, uint32 fla
|
|||
}
|
||||
|
||||
/**
|
||||
* @param truck_station Determines whether a stop is RoadStop::BUS or RoadStop::TRUCK
|
||||
* @param truck_station Determines whether a stop is ROADSTOP_BUS or ROADSTOP_TRUCK
|
||||
* @param st The Station to do the whole procedure for
|
||||
* @return a pointer to where to link a new RoadStop*
|
||||
*/
|
||||
|
@ -1397,7 +1396,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
AutoPtrT<RoadStop> rs_auto_delete(road_stop);
|
||||
|
||||
if (st != NULL &&
|
||||
GetNumRoadStopsInStation(st, RoadStop::BUS) + GetNumRoadStopsInStation(st, RoadStop::TRUCK) >= RoadStop::LIMIT) {
|
||||
GetNumRoadStopsInStation(st, ROADSTOP_BUS) + GetNumRoadStopsInStation(st, ROADSTOP_TRUCK) >= RoadStop::LIMIT) {
|
||||
return_cmd_error(type ? STR_TOO_MANY_TRUCK_STOPS : STR_TOO_MANY_BUS_STOPS);
|
||||
}
|
||||
|
||||
|
@ -1442,7 +1441,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
|
||||
st->rect.BeforeAddTile(tile, StationRect::ADD_TRY);
|
||||
|
||||
RoadStop::Type rs_type = type ? RoadStop::TRUCK : RoadStop::BUS;
|
||||
RoadStopType rs_type = type ? ROADSTOP_TRUCK : ROADSTOP_BUS;
|
||||
if (is_drive_through) {
|
||||
MakeDriveThroughRoadStop(tile, st->owner, st->index, rs_type, rts, (Axis)p1, town_owned_road);
|
||||
} else {
|
||||
|
@ -1488,10 +1487,10 @@ static CommandCost RemoveRoadStop(Station *st, uint32 flags, TileIndex tile)
|
|||
RoadStop *cur_stop;
|
||||
if (is_truck) { // truck stop
|
||||
primary_stop = &st->truck_stops;
|
||||
cur_stop = GetRoadStopByTile(tile, RoadStop::TRUCK);
|
||||
cur_stop = GetRoadStopByTile(tile, ROADSTOP_TRUCK);
|
||||
} else {
|
||||
primary_stop = &st->bus_stops;
|
||||
cur_stop = GetRoadStopByTile(tile, RoadStop::BUS);
|
||||
cur_stop = GetRoadStopByTile(tile, ROADSTOP_BUS);
|
||||
}
|
||||
|
||||
assert(cur_stop != NULL);
|
||||
|
@ -2440,7 +2439,7 @@ static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, i
|
|||
if (!rs->IsFreeBay(side)) return VETSB_CANNOT_ENTER;
|
||||
|
||||
/* Check if the vehicle is stopping at this road stop */
|
||||
if (GetRoadStopType(tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? RoadStop::BUS : RoadStop::TRUCK) &&
|
||||
if (GetRoadStopType(tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? ROADSTOP_BUS : ROADSTOP_TRUCK) &&
|
||||
v->current_order.dest == GetStationIndex(tile)) {
|
||||
SetBit(v->u.road.state, RVS_IS_STOPPING);
|
||||
rs->AllocateDriveThroughBay(side);
|
||||
|
@ -2913,7 +2912,7 @@ static void ChangeTileOwner_Station(TileIndex tile, PlayerID old_player, PlayerI
|
|||
} else {
|
||||
if (IsDriveThroughStopTile(tile)) {
|
||||
/* Remove the drive-through road stop */
|
||||
DoCommand(tile, 0, (GetStationType(tile) == STATION_TRUCK) ? RoadStop::TRUCK : RoadStop::BUS, DC_EXEC | DC_BANKRUPT, CMD_REMOVE_ROAD_STOP);
|
||||
DoCommand(tile, 0, (GetStationType(tile) == STATION_TRUCK) ? ROADSTOP_TRUCK : ROADSTOP_BUS, DC_EXEC | DC_BANKRUPT, CMD_REMOVE_ROAD_STOP);
|
||||
assert(IsTileType(tile, MP_ROAD));
|
||||
/* Change owner of tile and all roadtypes */
|
||||
ChangeTileOwner(tile, old_player, new_player);
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/* $Id$ */
|
||||
|
||||
/** @file station_func.h Functions related to stations. */
|
||||
|
||||
#ifndef STATION_FUNC_H
|
||||
#define STATION_FUNC_H
|
||||
|
||||
#include "station_type.h"
|
||||
#include "sprite.h"
|
||||
#include "road_type.h"
|
||||
#include "tile_type.h"
|
||||
#include "cargo_type.h"
|
||||
#include "vehicle_type.h"
|
||||
#include <set>
|
||||
|
||||
void ModifyStationRatingAround(TileIndex tile, PlayerID owner, int amount, uint radius);
|
||||
|
||||
/** A set of stations (\c const \c Station* ) */
|
||||
typedef std::set<Station*> StationSet;
|
||||
|
||||
StationSet FindStationsAroundIndustryTile(TileIndex tile, int w, int h);
|
||||
|
||||
void ShowStationViewWindow(StationID station);
|
||||
void UpdateAllStationVirtCoord();
|
||||
|
||||
void AfterLoadStations();
|
||||
void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile, int w, int h, int rad);
|
||||
void GetAcceptanceAroundTiles(AcceptedCargo accepts, TileIndex tile, int w, int h, int rad);
|
||||
|
||||
const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx);
|
||||
void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image);
|
||||
|
||||
bool HasStationInUse(StationID station, PlayerID player);
|
||||
|
||||
RoadStop * GetRoadStopByTile(TileIndex tile, RoadStopType type);
|
||||
uint GetNumRoadStops(const Station* st, RoadStopType type);
|
||||
RoadStop * AllocateRoadStop();
|
||||
|
||||
void ClearSlot(Vehicle *v);
|
||||
|
||||
void DeleteOilRig(TileIndex t);
|
||||
|
||||
#endif /* STATION_FUNC_H */
|
|
@ -8,7 +8,7 @@
|
|||
#include "gui.h"
|
||||
#include "window_gui.h"
|
||||
#include "textbuf_gui.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "player_func.h"
|
||||
#include "economy_func.h"
|
||||
#include "town.h"
|
||||
|
@ -17,7 +17,7 @@
|
|||
#include "vehicle_gui.h"
|
||||
#include "cargotype.h"
|
||||
#include "station_gui.h"
|
||||
#include "station.h"
|
||||
#include "station_func.h"
|
||||
#include "strings_func.h"
|
||||
#include "core/alloc_func.hpp"
|
||||
#include "window_func.h"
|
||||
|
|
|
@ -8,8 +8,10 @@
|
|||
#include "rail_map.h"
|
||||
#include "road_map.h"
|
||||
#include "water_map.h"
|
||||
#include "station.h"
|
||||
#include "station_func.h"
|
||||
#include "station_base.h"
|
||||
#include "rail.h"
|
||||
#include "newgrf_station.h"
|
||||
|
||||
typedef byte StationGfx;
|
||||
|
||||
|
@ -49,10 +51,10 @@ static inline StationType GetStationType(TileIndex t)
|
|||
return (StationType)GB(_m[t].m6, 3, 3);
|
||||
}
|
||||
|
||||
static inline RoadStop::Type GetRoadStopType(TileIndex t)
|
||||
static inline RoadStopType GetRoadStopType(TileIndex t)
|
||||
{
|
||||
assert(GetStationType(t) == STATION_TRUCK || GetStationType(t) == STATION_BUS);
|
||||
return GetStationType(t) == STATION_TRUCK ? RoadStop::TRUCK : RoadStop::BUS;
|
||||
return GetStationType(t) == STATION_TRUCK ? ROADSTOP_TRUCK : ROADSTOP_BUS;
|
||||
}
|
||||
|
||||
static inline StationGfx GetStationGfx(TileIndex t)
|
||||
|
@ -260,15 +262,15 @@ static inline void MakeRailStation(TileIndex t, Owner o, StationID sid, Axis a,
|
|||
SetRailType(t, rt);
|
||||
}
|
||||
|
||||
static inline void MakeRoadStop(TileIndex t, Owner o, StationID sid, RoadStop::Type rst, RoadTypes rt, DiagDirection d)
|
||||
static inline void MakeRoadStop(TileIndex t, Owner o, StationID sid, RoadStopType rst, RoadTypes rt, DiagDirection d)
|
||||
{
|
||||
MakeStation(t, o, sid, (rst == RoadStop::BUS ? STATION_BUS : STATION_TRUCK), d);
|
||||
MakeStation(t, o, sid, (rst == ROADSTOP_BUS ? STATION_BUS : STATION_TRUCK), d);
|
||||
SetRoadTypes(t, rt);
|
||||
}
|
||||
|
||||
static inline void MakeDriveThroughRoadStop(TileIndex t, Owner o, StationID sid, RoadStop::Type rst, RoadTypes rt, Axis a, bool on_town_road)
|
||||
static inline void MakeDriveThroughRoadStop(TileIndex t, Owner o, StationID sid, RoadStopType rst, RoadTypes rt, Axis a, bool on_town_road)
|
||||
{
|
||||
MakeStation(t, o, sid, (rst == RoadStop::BUS ? STATION_BUS : STATION_TRUCK), GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET + a);
|
||||
MakeStation(t, o, sid, (rst == ROADSTOP_BUS ? STATION_BUS : STATION_TRUCK), GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET + a);
|
||||
SB(_m[t].m6, 2, 1, on_town_road);
|
||||
SetRoadTypes(t, rt);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,12 @@ enum StationType {
|
|||
STATION_BUOY
|
||||
};
|
||||
|
||||
/** Types of RoadStops */
|
||||
enum RoadStopType {
|
||||
ROADSTOP_BUS, ///< A standard stop for buses
|
||||
ROADSTOP_TRUCK ///< A standard stop for trucks
|
||||
};
|
||||
|
||||
enum {
|
||||
FACIL_TRAIN = 0x01,
|
||||
FACIL_TRUCK_STOP = 0x02,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "openttd.h"
|
||||
#include "currency.h"
|
||||
#include "namegen_func.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "town.h"
|
||||
#include "screenshot.h"
|
||||
#include "waypoint.h"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "industry.h"
|
||||
#include "town.h"
|
||||
#include "economy_func.h"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "town.h"
|
||||
#include "command_func.h"
|
||||
#include "industry.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "player_base.h"
|
||||
#include "news_func.h"
|
||||
#include "saveload.h"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "command_func.h"
|
||||
#include "pathfind.h"
|
||||
#include "npf.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "news_func.h"
|
||||
#include "engine.h"
|
||||
#include "player_func.h"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "player_func.h"
|
||||
#include "player_base.h"
|
||||
#include "gui.h"
|
||||
#include "station.h"
|
||||
#include "town.h"
|
||||
#include "sprite.h"
|
||||
#include "bridge_map.h"
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "debug.h"
|
||||
#include "vehicle_gui.h"
|
||||
#include "depot.h"
|
||||
#include "station.h"
|
||||
#include "rail_type.h"
|
||||
#include "train.h"
|
||||
#include "aircraft.h"
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "openttd.h"
|
||||
#include "debug.h"
|
||||
#include "player_func.h"
|
||||
#include "station.h"
|
||||
#include "engine.h"
|
||||
#include "gui.h"
|
||||
#include "window_gui.h"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "spritecache.h"
|
||||
#include "landscape.h"
|
||||
#include "viewport_func.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "town.h"
|
||||
#include "signs.h"
|
||||
#include "waypoint.h"
|
||||
|
@ -25,6 +25,7 @@
|
|||
#include "vehicle_func.h"
|
||||
#include "player_func.h"
|
||||
#include "settings_type.h"
|
||||
#include "station_func.h"
|
||||
|
||||
#include "table/sprites.h"
|
||||
#include "table/strings.h"
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#include "settings_type.h"
|
||||
#include "clear_map.h"
|
||||
#include "tree_map.h"
|
||||
#include "station_base.h"
|
||||
#include "airport.h"
|
||||
|
||||
#include "table/sprites.h"
|
||||
#include "table/strings.h"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "rail.h"
|
||||
#include "bridge_map.h"
|
||||
#include "saveload.h"
|
||||
#include "station.h"
|
||||
#include "station_base.h"
|
||||
#include "town.h"
|
||||
#include "waypoint.h"
|
||||
#include "variables.h"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "../debug.h"
|
||||
#include "../depot_type.h"
|
||||
#include "../direction_type.h"
|
||||
|
||||
/** Finds the best path for given ship.
|
||||
* @param v the ship that needs to find a path
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "../bridge_map.h"
|
||||
#include "../tunnelbridge_map.h"
|
||||
#include "../bridge.h"
|
||||
#include "../station.h"
|
||||
#include "../station_base.h"
|
||||
#include "../station_map.h"
|
||||
#include "../tile_cmd.h"
|
||||
#include "../landscape.h"
|
||||
|
|
Loading…
Reference in New Issue