--- deliantra/server/ext/map-tags.ext 2007/12/05 11:08:34 1.13 +++ deliantra/server/ext/map-tags.ext 2009/10/23 03:08:34 1.17 @@ -4,8 +4,8 @@ use JSON::XS; -my $db_mapinfo = cf::sync_job { cf::db_table "tag-mapinfo" }; # info/cache for maps -my $db_target = cf::sync_job { cf::db_table "tag-target" }; # tag => maps +our $db_mapinfo = cf::sync_job { cf::db_table "tag-mapinfo" }; # info/cache for maps +our $db_target = cf::sync_job { cf::db_table "tag-target" }; # tag => maps sub remove_tag_target { my ($txn, $tag, $target) = @_; @@ -86,21 +86,10 @@ } sub scan_static { - my ($dir, $map) = @_; + my $maps = cf::map::static_maps; - my ($dirs, $files) = Coro::AIO::aio_scandir $dir, 2 - or return; - - for my $file (@$files) { - my $name = $file; - next unless $name =~ s/\.map$//; - utf8::decode $name; - - scan_map "s$map$name", "$dir/$file"; - } - - &scan_static ("$dir/$_", "$map$_/") - for @$dirs; + scan_map "s$_", "$cf::MAPDIR$_.map"; + for @$maps; } sub reload { @@ -180,7 +169,9 @@ reload; }; -cf::async { reload }; # force at startup +cf::post_init { + $RELOAD_SCHEDULER->invoke (0); # force at startup +}; # find all objects with the given tag, or at least try to sub find($) {