| 1 | package Games::Rezrov::ZStatus; | ||||||||||
| 2 | # all info required to refresh the status line; see spec 8.2 | ||||||||||
| 3 | |||||||||||
| 4 | 1 | ▶ | use Games::Rezrov::MethodMaker ([], | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | qw( | ||||||||||
| 6 | score | ||||||||||
| 7 | moves | ||||||||||
| 8 | hours | ||||||||||
| 9 | minutes | ||||||||||
| 10 | time_game | ||||||||||
| 11 | score_game | ||||||||||
| 12 | location | ||||||||||
| 13 | 1 | )); | |||||||||
| 14 | |||||||||||
| 15 | 1 | ▶ | use Games::Rezrov::Inliner; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | 1 | 1; | |||||||||
| 18 | |||||||||||
| 19 | 1 | my $INLINE_CODE = ' | |||||||||
| 20 | sub update () { | ||||||||||
| 21 | # refresh information required for status line. | ||||||||||
| 22 | my $self = shift; | ||||||||||
| 23 | |||||||||||
| 24 | # get the current location: | ||||||||||
| 25 | my $object_id = get_global(0); | ||||||||||
| 26 | # 8.2.2.1 | ||||||||||
| 27 | |||||||||||
| 28 | my $zobj = new Games::Rezrov::ZObject($object_id); | ||||||||||
| 29 | # FIX ME: use cache | ||||||||||
| 30 | $self->location(${$zobj->print(Games::Rezrov::StoryFile::ztext())}); | ||||||||||
| 31 | # die "loc = $location"; | ||||||||||
| 32 | |||||||||||
| 33 | my $g1 = get_global(1); | ||||||||||
| 34 | my $g2 = get_global(2); | ||||||||||
| 35 | if ($self->time_game()) { | ||||||||||
| 36 | $self->hours($g1); | ||||||||||
| 37 | $self->minutes($g2); | ||||||||||
| 38 | } else { | ||||||||||
| 39 | $self->score(SIGNED_WORD($g1)); | ||||||||||
| 40 | $self->moves($g2); | ||||||||||
| 41 | } | ||||||||||
| 42 | } | ||||||||||
| 43 | '; | ||||||||||
| 44 | |||||||||||
| 45 | 1 | Games::Rezrov::Inliner::inline(\$INLINE_CODE); | |||||||||
| 46 | #print $INLINE_CODE; | ||||||||||
| 47 | #die; | ||||||||||
| 48 | 0 | ▶ | eval $INLINE_CODE; | ||||||||
|
Subroutine
update: not called CC=2 SCAR=16.6
Pod
undocumented
Branch: 1 branch
| |||||||||||
| 49 | 1 | undef $INLINE_CODE; | |||||||||
| 50 | |||||||||||
| 51 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 52 | 1 | my $self = []; | |||||||||
| 53 | 1 | bless $self, shift; | |||||||||
| 54 | |||||||||||
| 55 | 1 | $self->hours(0); | |||||||||
| 56 | 1 | $self->minutes(0); | |||||||||
| 57 | 1 | $self->moves(0); | |||||||||
| 58 | 1 | $self->score(0); | |||||||||
| 59 | 1 | $self->time_game(0); | |||||||||
| 60 | 1 | $self->score_game(0); | |||||||||
| 61 | |||||||||||
| 62 | 1 | ▶ | if (Games::Rezrov::StoryFile::header()->is_time_game()) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 63 | 0 | $self->time_game(1); | |||||||||
| 64 | } else { | ||||||||||
| 65 | 1 | $self->score_game(1); | |||||||||
| 66 | } | ||||||||||
| 67 | 1 | return $self; | |||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | 0 | ▶ | sub get_global { | ||||||||
|
Subroutine
get_global: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 71 | 0 | return Games::Rezrov::StoryFile::get_global_var($_[0]); | |||||||||
| 72 | } | ||||||||||
| 73 | |||||||||||
| 74 | |||||||||||
| 75 | 1 | 1; | |||||||||