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.3 by root, Tue Sep 11 15:33:34 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
154sub find($) { 154sub find($) {
155 my ($tag) = @_; 155 my ($tag) = @_;
156 156
157 my @res; 157 my @res;
158 158
159 utf8::encode $tag; 159 utf8::encode (my $key = $tag);
160 BDB::db_get $db_target, undef, $tag, my $data; 160 BDB::db_get $db_target, undef, $key, my $data;
161 utf8::decode $data; 161 utf8::decode $data;
162 162
163 for my $map ( 163 for my $map (
164 grep $_, 164 grep $_,
165 map { cf::map::find $_ } 165 map { cf::map::find $_ }
166 grep s/^s//, 166 grep s/^s//,
167 split /\x00/, $data 167 split /\x00/, $data
168 ) { 168 ) {
169 warn "map $map,$tag\n";#d#
169 $map->load; 170 $map->load;
170 171
172 push @res, $map->find_tagged_objects ($tag);
173
171 warn "tag<$tag>map<$map>\n";#d# 174 warn "tag<$tag>map<$map>res<@res>\n";#d#
172 } 175 }
173 176
174 @res 177 @res
175} 178}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines