#include "stdafx.h"
#include "ship.h"
#include "landscape.h"
#include "timetable.h"
#include "command_func.h"
#include "news_func.h"
#include "company_func.h"
#include "pathfinder/npf/npf_func.h"
#include "depot_base.h"
#include "station_base.h"
#include "vehicle_gui.h"
#include "newgrf_engine.h"
#include "pathfinder/yapf/yapf.h"
#include "newgrf_sound.h"
#include "spritecache.h"
#include "strings_func.h"
#include "functions.h"
#include "window_func.h"
#include "date_func.h"
#include "vehicle_func.h"
#include "sound_func.h"
#include "autoreplace_gui.h"
#include "effectvehicle_func.h"
#include "effectvehicle_base.h"
#include "ai/ai.hpp"
#include "pathfinder/opf/opf_ship.h"
#include "landscape_type.h"
#include "engine_base.h"
#include "engine_func.h"
#include "company_base.h"
#include "table/strings.h"
#include "table/sprites.h"
Go to the source code of this file.
Defines | |
#define | MKIT(a, b, c, d) ((a & 0xFF) << 24) | ((b & 0xFF) << 16) | ((c & 0xFF) << 8) | ((d & 0xFF) << 0) |
Functions | |
static TrackBits | GetTileShipTrackStatus (TileIndex tile) |
static SpriteID | GetShipIcon (EngineID engine) |
void | DrawShipEngine (int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal) |
void | GetShipSpriteSize (EngineID engine, uint &width, uint &height) |
Get the size of the sprite of a ship sprite heading west (used for lists). | |
static const Depot * | FindClosestShipDepot (const Vehicle *v, uint max_distance) |
static void | CheckIfShipNeedsService (Vehicle *v) |
static void | HandleBrokenShip (Vehicle *v) |
static void | PlayShipSound (const Vehicle *v) |
void | RecalcShipStuff (Vehicle *v) |
static void | CheckShipLeaveDepot (Ship *v) |
static bool | ShipAccelerate (Vehicle *v) |
static void | ShipArrivesAt (const Vehicle *v, Station *st) |
static Track | ChooseShipTrack (const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks) |
returns the track to choose on the next tile, or -1 when it's better to reverse. | |
static Direction | ShipGetNewDirectionFromTiles (TileIndex new_tile, TileIndex old_tile) |
static Direction | ShipGetNewDirection (Vehicle *v, int x, int y) |
static TrackBits | GetAvailShipTracks (TileIndex tile, DiagDirection dir) |
static void | ShipController (Ship *v) |
CommandCost | CmdBuildShip (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Build a ship. | |
CommandCost | CmdSellShip (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Sell a ship. | |
CommandCost | CmdSendShipToDepot (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Send a ship to the depot. | |
CommandCost | CmdRefitShip (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Refits a ship to the specified cargo type. | |
Variables | |
static const uint16 | _ship_sprites [] = {0x0E5D, 0x0E55, 0x0E65, 0x0E6D} |
static const TileIndexDiffC | _ship_leave_depot_offs [] |
static const Direction | _new_vehicle_direction_table [] |
static const byte | _ship_subcoord [4][6][3] |
Definition in file ship_cmd.cpp.
static Track ChooseShipTrack | ( | const Ship * | v, | |
TileIndex | tile, | |||
DiagDirection | enterdir, | |||
TrackBits | tracks | |||
) | [static] |
returns the track to choose on the next tile, or -1 when it's better to reverse.
The tile given is the tile we are about to enter, enterdir is the direction in which we are entering the tile
Definition at line 381 of file ship_cmd.cpp.
References _settings_game, IsValidDiagDirection(), NPFShipChooseTrack(), PathfinderSettings::pathfinder_for_ships, GameSettings::pf, VPF_NPF, VPF_OPF, VPF_YAPF, and YapfShipChooseTrack().
Referenced by YapfShipChooseTrack().
CommandCost CmdBuildShip | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Build a ship.
tile | tile of depot where ship is built | |
flags | type of operation | |
p1 | ship type being built (engine) | |
p2 | unused | |
text | unused |
Definition at line 612 of file ship_cmd.cpp.
References _cur_year, _date, _settings_game, CMD_ERROR, CT_INVALID, DC_AUTOREPLACE, DC_EXEC, DC_QUERY_COST, ENGINE_EXCLUSIVE_PREVIEW, GetVehicleCapacity(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, InvalidateAutoreplaceWindow(), InvalidateWindowClassesData(), InvalidateWindowData(), IsEngineBuildable(), IsTileOwner(), VehicleSettings::max_ships, return_cmd_error, SetBit(), SetWindowDirty(), Ship::Ship(), Ship::state, TILE_SIZE, TileX(), TileY(), TRACK_BIT_DEPOT, Ship::UpdateDeltaXY(), VEH_SHIP, GameSettings::vehicle, VehicleMove(), and VehicleRandomBits().
CommandCost CmdRefitShip | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Refits a ship to the specified cargo type.
tile | unused | |
flags | type of operation | |
p1 | vehicle ID of the ship to refit | |
p2 | various bitstuffed elements
| |
text | unused |
Definition at line 781 of file ship_cmd.cpp.
References CheckOwnership(), CMD_ERROR, DC_EXEC, GB(), SpecializedVehicle< Ship, VEH_SHIP >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, InvalidateWindowClassesData(), NUM_CARGO, RefitVehicle(), return_cmd_error, and SetWindowDirty().
CommandCost CmdSellShip | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Sell a ship.
tile | unused | |
flags | type of operation | |
p1 | vehicle ID to be sold | |
p2 | unused | |
text | unused |
Definition at line 713 of file ship_cmd.cpp.
References CheckOwnership(), CMD_ERROR, DC_EXEC, SpecializedVehicle< Ship, VEH_SHIP >::GetIfValid(), and return_cmd_error.
CommandCost CmdSendShipToDepot | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Send a ship to the depot.
tile | unused | |
flags | type of operation | |
p1 | vehicle ID to send to the depot | |
p2 | various bitmasked elements
| |
text | unused |
Definition at line 755 of file ship_cmd.cpp.
References CMD_ERROR, DEPOT_MASS_SEND, DEPOT_SERVICE, SpecializedVehicle< Ship, VEH_SHIP >::GetIfValid(), SendAllVehiclesToDepot(), and VEH_SHIP.
void GetShipSpriteSize | ( | EngineID | engine, | |
uint & | width, | |||
uint & | height | |||
) |
Get the size of the sprite of a ship sprite heading west (used for lists).
engine | The engine to get the sprite from | |
width | The width of the sprite | |
height | The height of the sprite |
Definition at line 81 of file ship_cmd.cpp.
References Sprite::height, ST_NORMAL, and Sprite::width.
const Direction _new_vehicle_direction_table[] [static] |
const TileIndexDiffC _ship_leave_depot_offs[] [static] |