Define constants for vehicle type

This commit is contained in:
Ted John 2019-02-26 16:49:29 +00:00
parent a3af56f285
commit aa7d181070
3 changed files with 9 additions and 3 deletions

View File

@ -39,7 +39,7 @@ rct_vehicle* cable_lift_segment_create(
move_sprite_to_list((rct_sprite*)current, SPRITE_LIST_TRAIN * 2);
ride->cable_lift = current->sprite_index;
}
current->type = head ? 0 : 1;
current->type = head ? VEHICLE_TYPE_HEAD : VEHICLE_TYPE_TAIL;
current->var_44 = var_44;
current->remaining_distance = remaining_distance;
current->sprite_width = 10;

View File

@ -4840,7 +4840,7 @@ static rct_vehicle* vehicle_create_car(
vehicle->ride_subtype = ride->subtype;
vehicle->vehicle_type = vehicleEntryIndex;
vehicle->type = carIndex == 0 ? 0 : 1;
vehicle->type = carIndex == 0 ? VEHICLE_TYPE_HEAD : VEHICLE_TYPE_TAIL;
vehicle->var_44 = ror32(vehicleEntry->spacing, 10) & 0xFFFF;
edx = vehicleEntry->spacing >> 1;
*remainingDistance -= edx;

View File

@ -105,6 +105,12 @@ static_assert(sizeof(rct_ride_entry_vehicle) % 4 == 0, "Invalid struct size");
static_assert(sizeof(rct_ride_entry_vehicle) % 8 == 0, "Invalid struct size");
#endif
enum VEHICLE_TYPE : uint8_t
{
VEHICLE_TYPE_HEAD = 0,
VEHICLE_TYPE_TAIL = 1,
};
struct rct_vehicle : rct_sprite_common
{
uint8_t vehicle_sprite_type; // 0x1F
@ -223,7 +229,7 @@ struct rct_vehicle : rct_sprite_common
constexpr bool IsHead() const
{
return type == 0;
return type == VEHICLE_TYPE_HEAD;
}
rct_vehicle* GetHead();
const rct_vehicle* GetHead() const;