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.1 by root, Mon Sep 10 18:30:30 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
149 warn sprintf "map-tag scan (%fs)", Event::time - $start; 149 warn sprintf "map-tag scan (%fs)", Event::time - $start;
150 Coro::Timer::sleep $SCHEDULE_INTERVAL; 150 Coro::Timer::sleep $SCHEDULE_INTERVAL;
151 } 151 }
152}; 152};
153 153
154sub find($) {
155 my ($tag) = @_;
154 156
157 utf8::encode (my $key = $tag);
158 BDB::db_get $db_target, undef, $key, my $data;
159 utf8::decode $data;
160
161 map { $_->load; $_->find_tagged_objects ($tag) }
162 grep $_,
163 map { cf::map::find $_ }
164 grep s/^s//,
165 split /\x00/, $data
166}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines