| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
### $Id: MapHash.pm 424 2008-08-19 16:27:43Z duncan $ |
|
2
|
|
|
|
|
|
|
####------------------------------------------ |
|
3
|
|
|
|
|
|
|
## @file |
|
4
|
|
|
|
|
|
|
# Define MapHash Class |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
## @class MapHash |
|
8
|
|
|
|
|
|
|
# Hashtable to hold the map information efficiently |
|
9
|
|
|
|
|
|
|
# |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package OpenGL::QEng::MapHash; |
|
12
|
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
9
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
108
|
|
|
14
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
|
2
|
|
|
|
|
968
|
|
|
|
2
|
|
|
|
|
62
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
9
|
use base qw/OpenGL::QEng::Thing/; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
1110
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#-------------------------------------------------------- |
|
19
|
|
|
|
|
|
|
sub new { |
|
20
|
|
|
|
|
|
|
my ($class,@props) = @_; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $props = (scalar(@props) == 1) ? $props[0] : {@props}; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $self = OpenGL::QEng::Thing->new; |
|
25
|
|
|
|
|
|
|
bless($self,$class); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$self->passedArgs($props); # from OUtil |
|
28
|
|
|
|
|
|
|
$self->register_events; # from Thing |
|
29
|
|
|
|
|
|
|
$self->create_accessors; # from OUtil |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
return $self; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#-------------------------- |
|
35
|
|
|
|
|
|
|
## @method assimilate($thing) |
|
36
|
|
|
|
|
|
|
# make $thing a part of $self |
|
37
|
|
|
|
|
|
|
# |
|
38
|
|
|
|
|
|
|
sub assimilate { |
|
39
|
|
|
|
|
|
|
my ($self,$thing) = @_; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return unless defined($thing); |
|
42
|
|
|
|
|
|
|
$self->SUPER::assimilate($thing); |
|
43
|
|
|
|
|
|
|
if ($thing->isa('OpenGL::QEng::Map')) { |
|
44
|
|
|
|
|
|
|
$self->{$thing->{textMap}} = $thing; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
#------------------------------------------ |
|
49
|
|
|
|
|
|
|
sub printMe { #XXX merge into Thing |
|
50
|
|
|
|
|
|
|
my ($self,$depth) = @_; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
$depth ||= 0; |
|
53
|
|
|
|
|
|
|
my %boring = (x => 1, z => 1, |
|
54
|
|
|
|
|
|
|
yaw => 1,GLid => 1, |
|
55
|
|
|
|
|
|
|
event => 1, chunk => 1, |
|
56
|
|
|
|
|
|
|
holds => 1, parts => 1, |
|
57
|
|
|
|
|
|
|
is_at => 1, tlines => 1, |
|
58
|
|
|
|
|
|
|
gaplist => 1, goggles => 1, |
|
59
|
|
|
|
|
|
|
map_view => 1, range_2 => 1, |
|
60
|
|
|
|
|
|
|
near_code => 1, event_code=> 1, |
|
61
|
|
|
|
|
|
|
maps => 1, team => 1, |
|
62
|
|
|
|
|
|
|
cover => 1, fixed => 1, |
|
63
|
|
|
|
|
|
|
wrap_class=> 1, objects => 1, |
|
64
|
|
|
|
|
|
|
); |
|
65
|
|
|
|
|
|
|
(my $map_ref = ref $self) =~ s/OpenGL::QEng:://; |
|
66
|
|
|
|
|
|
|
print STDOUT ' 'x$depth,"$map_ref $self->{x} $self->{z} $self->{yaw};\n"; |
|
67
|
|
|
|
|
|
|
my $spec = $self->not_default; |
|
68
|
|
|
|
|
|
|
my $started = 0; |
|
69
|
|
|
|
|
|
|
for my $key (keys %{$spec}) { |
|
70
|
|
|
|
|
|
|
next unless defined $spec->{$key}; |
|
71
|
|
|
|
|
|
|
next if defined $boring{$key}; |
|
72
|
|
|
|
|
|
|
unless ($started) { |
|
73
|
|
|
|
|
|
|
print STDOUT ' 'x$depth,"partof_last;\n"; |
|
74
|
|
|
|
|
|
|
$started = 1; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
$self->{$key}->printMe($depth+1); |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
print STDOUT ' 'x$depth,"done;\n" if $started; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
#================================================================== |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 NAME |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
MapHash -- storage for the Maps in a game, keyed by filename |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 AUTHORS |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
John D. Overmars EFE, |
|
92
|
|
|
|
|
|
|
and Rob Duncan EFE |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Copyright 2008 John D. Overmars and Rob Duncan, All rights reserved. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 LICENSE |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify |
|
101
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
|
104
|
|
|
|
|
|
|
|