ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/lib/cf/match.pm
(Generate patch)

Comparing deliantra/server/lib/cf/match.pm (file contents):
Revision 1.15 by root, Mon Oct 12 17:37:43 2009 UTC vs.
Revision 1.18 by root, Mon Oct 12 21:27:55 2009 UTC

140 140
141Example: check if the context object I<is> a spell, or I<contains> a spell. 141Example: check if the context object I<is> a spell, or I<contains> a spell.
142 142
143 type=SPELL also in inv 143 type=SPELL also in inv
144 144
145=item deep in ... 145=item also deep in ...
146 146
147Repeats the operation as many times as possible. This can be used to 147Repeats the operation as many times as possible. This can be used to
148recursively look into objects. 148recursively look into objects.
149 149
150=item also deep in ... 150So for example, C<also deep in inv> means to take the inventory of all
151objects, taking their inventories, and so on, and adding all these objects
152to the context set.
151 153
152C<also> and C<deep> can be combined. 154Similarly, C<also deep in env> means to take the environment object, their
155environemnt object and so on.
153 156
154Example: check if there are any unpaid items in an inventory, 157Example: check if there are any unpaid items in an inventory,
155or in the inventories of the inventory objects, and so on. 158or in the inventories of the inventory objects, and so on.
156 159
157 unpaid also deep in inv 160 unpaid also deep in inv
569 $expand = "map \$_->inv,"; 572 $expand = "map \$_->inv,";
570 } elsif ($1 eq "env") { 573 } elsif ($1 eq "env") {
571 $expand = "map \$_->env // (),"; 574 $expand = "map \$_->env // (),";
572 } elsif ($1 eq "arch") { 575 } elsif ($1 eq "arch") {
573 $expand = "map \$_->arch,"; 576 $expand = "map \$_->arch,";
577 $deep = 0; # infinite loop otherwise
574 } elsif ($1 eq "map") { 578 } elsif ($1 eq "map") {
575 $expand = "map \$_->map->at (\$_->x, \$_->y),"; 579 $expand = "map \$_->map->at (\$_->x, \$_->y),";
580 $deep = 0; # infinite loop otherwise
576 } 581 }
577 } else { 582 } else {
578 $expand = "map \$_->inv, grep { " . condition . " }"; 583 $expand = "map \$_->inv, grep { " . condition . " }";
579 } 584 }
580 585
678 &{ 683 &{
679 $CACHE{"$all$match"} ||= compile $match, $all 684 $CACHE{"$all$match"} ||= compile $match, $all
680 } 685 }
681} 686}
682 687
688our $CACHE_CLEARER = AE::timer 3600, 3600, sub {
689 %CACHE = ();
690};
691
683#d# $::schmorp=cf::player::find "schmorp"& 692#d# $::schmorp=cf::player::find "schmorp"&
684#d# cf::match::match '', $::schmorp->ob 693#d# cf::match::match '', $::schmorp->ob
685 694
686 695
687=back 696=back

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines