line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Game::TileMap::Role::Helpers; |
2
|
|
|
|
|
|
|
$Game::TileMap::Role::Helpers::VERSION = '1.000'; |
3
|
3
|
|
|
3
|
|
1638
|
use v5.10; |
|
3
|
|
|
|
|
10
|
|
4
|
3
|
|
|
3
|
|
16
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
82
|
|
5
|
3
|
|
|
3
|
|
26
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
76
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
14
|
use Moo::Role; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
17
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
requires qw( |
10
|
|
|
|
|
|
|
legend |
11
|
|
|
|
|
|
|
_guide |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub get_all_of_class |
15
|
|
|
|
|
|
|
{ |
16
|
8
|
|
|
8
|
0
|
4827
|
my ($self, $class) = @_; |
17
|
|
|
|
|
|
|
|
18
|
8
|
|
|
|
|
11
|
return @{$self->_guide->{$class}}; |
|
8
|
|
|
|
|
50
|
|
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub get_all_of_type |
22
|
|
|
|
|
|
|
{ |
23
|
3
|
|
|
3
|
0
|
12509
|
my ($self, $obj) = @_; |
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
17
|
my $class = $self->legend->get_class_of_object($obj); |
26
|
3
|
|
|
|
|
37
|
my @all_of_class = $self->get_all_of_class($class); |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
|
|
7
|
return grep { $_->type eq $obj } @all_of_class; |
|
12
|
|
|
|
|
40
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub get_class_of_object |
32
|
|
|
|
|
|
|
{ |
33
|
2
|
|
|
2
|
0
|
7
|
my ($self, $obj) = @_; |
34
|
|
|
|
|
|
|
|
35
|
2
|
50
|
|
|
|
15
|
return $self->legend->get_class_of_object(ref $obj ? $obj->type : $obj); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|