Files
@ r11406:d38afaf3cfac
Branch filter:
Location: cpp/openttd-patchpack/source/src/roadveh.h - annotation
r11406:d38afaf3cfac
3.3 KiB
text/x-c
(svn r15768) -Change: remove an "experimental" marker for something that has been working fine for a long time and remove the ununderstandable part of the description.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r6417:89329fa8ac80 r6393:f9322fdf4c2c r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r8144:1432edd15267 r8786:f24a6d1fba34 r9070:e059c65164f3 r8116:df67d3c5e4fd r5475:3f5cd13d1b63 r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r11034:b133414fb70f r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r7492:75510449064b r6857:1e07df806ef1 r6857:1e07df806ef1 r6857:1e07df806ef1 r5786:21dd6ba13f91 r5475:3f5cd13d1b63 r8890:02179c54681e r8890:02179c54681e r8890:02179c54681e r8890:02179c54681e r6552:7cade7798fcb r6552:7cade7798fcb r6552:7cade7798fcb r6552:7cade7798fcb r6552:7cade7798fcb r6552:7cade7798fcb r6552:7cade7798fcb r6552:7cade7798fcb r6552:7cade7798fcb r6552:7cade7798fcb r6552:7cade7798fcb r6552:7cade7798fcb r6552:7cade7798fcb r6552:7cade7798fcb r7412:e5f07529a093 r6552:7cade7798fcb r6563:67c636a8e3d4 r6553:04028e73a0f7 r6558:469828caa298 r6563:67c636a8e3d4 r6857:1e07df806ef1 r9022:5be8b7703ae9 r10969:8b8a9653d684 r10969:8b8a9653d684 r8626:f6fe0bba0fc2 r7490:4e86e893fa7f r9935:d6cda74ab287 r7135:3964060426dc r8467:0ea88f22d4aa r8827:6ee5217ef94b r8890:02179c54681e r6552:7cade7798fcb r6552:7cade7798fcb r5475:3f5cd13d1b63 | /* $Id$ */
/** @file src/roadveh.h Road vehicle states */
#ifndef ROADVEH_H
#define ROADVEH_H
#include "vehicle_base.h"
#include "engine_func.h"
#include "engine_base.h"
#include "economy_func.h"
/** State information about the Road Vehicle controller */
enum {
RDE_NEXT_TILE = 0x80, ///< We should enter the next tile
RDE_TURNED = 0x40, ///< We just finished turning
/* Start frames for when a vehicle enters a tile/changes its state.
* The start frame is different for vehicles that turned around or
* are leaving the depot as the do not start at the edge of the tile.
* For trams there are a few different start frames as there are two
* places where trams can turn. */
RVC_DEFAULT_START_FRAME = 0,
RVC_TURN_AROUND_START_FRAME = 1,
RVC_DEPOT_START_FRAME = 6,
RVC_START_FRAME_AFTER_LONG_TRAM = 21,
RVC_TURN_AROUND_START_FRAME_SHORT_TRAM = 16,
/* Stop frame for a vehicle in a drive-through stop */
RVC_DRIVE_THROUGH_STOP_FRAME = 7,
RVC_DEPOT_STOP_FRAME = 11,
};
enum RoadVehicleSubType {
RVST_FRONT,
RVST_ARTIC_PART,
};
static inline bool IsRoadVehFront(const Vehicle *v)
{
assert(v->type == VEH_ROAD);
return v->subtype == RVST_FRONT;
}
static inline void SetRoadVehFront(Vehicle *v)
{
assert(v->type == VEH_ROAD);
v->subtype = RVST_FRONT;
}
static inline bool IsRoadVehArticPart(const Vehicle *v)
{
assert(v->type == VEH_ROAD);
return v->subtype == RVST_ARTIC_PART;
}
static inline void SetRoadVehArticPart(Vehicle *v)
{
assert(v->type == VEH_ROAD);
v->subtype = RVST_ARTIC_PART;
}
static inline bool RoadVehHasArticPart(const Vehicle *v)
{
assert(v->type == VEH_ROAD);
return v->Next() != NULL && IsRoadVehArticPart(v->Next());
}
void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2);
byte GetRoadVehLength(const Vehicle *v);
void RoadVehUpdateCache(Vehicle *v);
/**
* This class 'wraps' Vehicle; you do not actually instantiate this class.
* You create a Vehicle using AllocateVehicle, so it is added to the pool
* and you reinitialize that to a Train using:
* v = new (v) RoadVehicle();
*
* As side-effect the vehicle type is set correctly.
*/
struct RoadVehicle : public Vehicle {
/** Initializes the Vehicle to a road vehicle */
RoadVehicle() { this->type = VEH_ROAD; }
/** We want to 'destruct' the right class. */
virtual ~RoadVehicle() { this->PreDestructor(); }
const char *GetTypeString() const { return "road vehicle"; }
void MarkDirty();
void UpdateDeltaXY(Direction direction);
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_ROADVEH_INC : EXPENSES_ROADVEH_RUN; }
bool IsPrimaryVehicle() const { return IsRoadVehFront(this); }
SpriteID GetImage(Direction direction) const;
int GetDisplaySpeed() const { return this->cur_speed / 2; }
int GetDisplayMaxSpeed() const { return this->max_speed / 2; }
Money GetRunningCost() const { return RoadVehInfo(this->engine_type)->running_cost * GetPriceByIndex(RoadVehInfo(this->engine_type)->running_cost_class); }
bool IsInDepot() const { return this->u.road.state == RVSB_IN_DEPOT; }
bool IsStoppedInDepot() const;
void Tick();
void OnNewDay();
TileIndex GetOrderStationLocation(StationID station);
bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse);
};
#endif /* ROADVEH_H */
|