… | |
… | |
2258 | } |
2258 | } |
2259 | |
2259 | |
2260 | ############################################################################# |
2260 | ############################################################################# |
2261 | # the server's init and main functions |
2261 | # the server's init and main functions |
2262 | |
2262 | |
2263 | sub load_faces { |
2263 | sub load_facedata { |
2264 | my $path = sprintf "%s/faces", cf::datadir; |
2264 | my $path = sprintf "%s/facedata", cf::datadir; |
2265 | |
2265 | |
2266 | warn "loading faces from $path\n"; |
2266 | warn "loading facedata from $path\n"; |
2267 | |
2267 | |
2268 | my $faces; |
2268 | my $faces; |
2269 | 0 < aio_load $path, $faces |
2269 | 0 < aio_load $path, $faces |
2270 | or die "$path: $!"; |
2270 | or die "$path: $!"; |
2271 | |
2271 | |
… | |
… | |
2279 | |
2279 | |
2280 | while (my ($face, $info) = each %$faces) { |
2280 | while (my ($face, $info) = each %$faces) { |
2281 | my $idx = (cf::face::find $face) || cf::face::alloc $face; |
2281 | my $idx = (cf::face::find $face) || cf::face::alloc $face; |
2282 | cf::face::set $idx, $info->{visibility}, $info->{magicmap}; |
2282 | cf::face::set $idx, $info->{visibility}, $info->{magicmap}; |
2283 | cf::face::set_data $idx, 0, $info->{data32}, $info->{chksum32}; |
2283 | cf::face::set_data $idx, 0, $info->{data32}, $info->{chksum32}; |
|
|
2284 | cf::face::set_data $idx, 1, $info->{data64}, $info->{chksum64}; |
2284 | Coro::cede; |
2285 | Coro::cede; |
2285 | } |
2286 | } |
2286 | |
2287 | |
2287 | while (my ($face, $info) = each %$faces) { |
2288 | while (my ($face, $info) = each %$faces) { |
2288 | next unless $info->{smooth}; |
2289 | next unless $info->{smooth}; |
… | |
… | |
2300 | } |
2301 | } |
2301 | |
2302 | |
2302 | sub reload_resources { |
2303 | sub reload_resources { |
2303 | load_resource_file sprintf "%s/%s/regions", cf::datadir, cf::mapdir |
2304 | load_resource_file sprintf "%s/%s/regions", cf::datadir, cf::mapdir |
2304 | or die "unable to load regions file\n";#d# |
2305 | or die "unable to load regions file\n";#d# |
2305 | load_faces |
2306 | load_facedata |
2306 | or die "unable to load faces\n";#d# |
2307 | or die "unable to load facedata\n";#d# |
2307 | } |
2308 | } |
2308 | |
2309 | |
2309 | sub init { |
2310 | sub init { |
2310 | reload_resources; |
2311 | reload_resources; |
2311 | } |
2312 | } |