Unverified Commit cbe7bc25 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Wagon: add group_index accessor

parent 74bec419
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -694,11 +694,12 @@ sub wagons {
		} @{ $self->{wagons} };
	}

	for my $group (@wagon_groups) {
	for my $i ( 0 .. $#wagon_groups ) {
		my $group = $wagon_groups[$i];
		my $tt    = $self->wagongroup_subtype( @{$group} );
		if ($tt) {
			for my $wagon ( @{$group} ) {
				$wagon->set_traintype($tt);
				$wagon->set_traintype( $i, $tt );
			}
		}
	}
+21 −20
Original line number Diff line number Diff line
@@ -10,11 +10,11 @@ use Carp qw(cluck);

our $VERSION = '0.10';
Travel::Status::DE::DBWagenreihung::Wagon->mk_ro_accessors(
	qw(attributes class_type has_ac has_accessibility has_bahn_comfort
	  has_bike_storage has_bistro has_compartments has_family_area
	  has_phone_area has_quiet_area is_dosto is_interregio is_locomotive
	  is_powercar number model multipurpose section train_no train_subtype type
	  uic_id)
	qw(attributes class_type group_index has_ac has_accessibility
	  has_bahn_comfort has_bike_storage has_bistro has_compartments
	  has_family_area has_phone_area has_quiet_area is_dosto is_interregio
	  is_locomotive is_powercar number model multipurpose section train_no
	  train_subtype type uic_id)
);

our %type_attributes = (
@@ -196,8 +196,9 @@ sub parse_type {
}

sub set_traintype {
	my ( $self, $tt ) = @_;
	my ( $self, $group_index, $tt ) = @_;

	$self->{group_index}   = $group_index;
	$self->{train_subtype} = $tt;

	if ( not $self->{number} or not exists( $type_attributes{$tt} ) ) {