ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/map-tags.ext
(Generate patch)

Comparing deliantra/server/ext/map-tags.ext (file contents):
Revision 1.2 by root, Tue Sep 11 13:27:53 2007 UTC vs.
Revision 1.4 by root, Tue Sep 11 15:40:01 2007 UTC

1#! perl # mandatory 1#! perl # mandatory
2 2
3our $SCHEDULE_INTERVAL = $cf::CFG{extractor_schedule_interval} || 3600; 3our $SCHEDULE_INTERVAL = $cf::CFG{extractor_schedule_interval} || 3600;
4 4
5use JSON::XS; 5use JSON::XS;
6 6
7my $db_mapinfo = cf::sync_job { cf::db_table "tag-mapinfo" }; # info/cache for maps 7my $db_mapinfo = cf::sync_job { cf::db_table "tag-mapinfo" }; # info/cache for maps
8my $db_target = cf::sync_job { cf::db_table "tag-target" }; # tag => maps 8my $db_target = cf::sync_job { cf::db_table "tag-target" }; # tag => maps
152}; 152};
153 153
154sub find($) { 154sub find($) {
155 my ($tag) = @_; 155 my ($tag) = @_;
156 156
157 my @res;
158
159 utf8::encode $tag; 157 utf8::encode (my $key = $tag);
160 BDB::db_get $db_target, undef, $tag, my $data; 158 BDB::db_get $db_target, undef, $key, my $data;
161 utf8::decode $data; 159 utf8::decode $data;
162 160
163 for my $map ( 161 map { $_->load; $_->find_tagged_objects ($tag) }
164 grep $_, 162 grep $_,
165 map { cf::map::find $_ } 163 map { cf::map::find $_ }
166 grep s/^s//, 164 grep s/^s//,
167 split /\x00/, $data 165 split /\x00/, $data
168 ) {
169 $map->load;
170
171 warn "tag<$tag>map<$map>\n";#d#
172 }
173
174 @res
175} 166}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines