| 1 | package Game::TileMap::Role::Helpers; | ||||||||||
| 2 | 4 | $Game::TileMap::Role::Helpers::VERSION = '1.001'; | |||||||||
| 3 | 4 | ▶ | use v5.10; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 4 | ▶ | use Mooish::Base -stardard, -role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 4 | requires qw( | |||||||||
| 10 | legend | ||||||||||
| 11 | _guide | ||||||||||
| 12 | ); | ||||||||||
| 13 | |||||||||||
| 14 | sub get_all_of_class | ||||||||||
| 15 | 8 | ▶ | { | ||||||||
|
Subroutine
get_all_of_class: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 16 | 8 | my ($self, $class) = @_; | |||||||||
| 17 | |||||||||||
| 18 | 8 | return @{$self->_guide->{$class}}; | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | sub get_all_of_type | ||||||||||
| 22 | 3 | ▶ | { | ||||||||
|
Subroutine
get_all_of_type: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 23 | 3 | my ($self, $obj) = @_; | |||||||||
| 24 | |||||||||||
| 25 | 3 | my $class = $self->legend->get_class_of_object($obj); | |||||||||
| 26 | 3 | my @all_of_class = $self->get_all_of_class($class); | |||||||||
| 27 | |||||||||||
| 28 | 3 | return grep { $_->type eq $obj } @all_of_class; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | sub get_class_of_object | ||||||||||
| 32 | 2 | ▶ | { | ||||||||
|
Subroutine
get_class_of_object: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||
| 33 | 2 | my ($self, $obj) = @_; | |||||||||
| 34 | |||||||||||
| 35 | 2 | ▶ | return $self->legend->get_class_of_object(ref $obj ? $obj->type : $obj); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 4 | 1; | |||||||||
| 39 | |||||||||||