ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/lib/cf.pm
(Generate patch)

Comparing deliantra/server/lib/cf.pm (file contents):
Revision 1.187 by root, Sat Jan 20 21:06:52 2007 UTC vs.
Revision 1.188 by root, Sat Jan 20 23:30:16 2007 UTC

1297 $self->{load_path} = $path; 1297 $self->{load_path} = $path;
1298 1298
1299 1 1299 1
1300} 1300}
1301 1301
1302sub load_orig { 1302sub load_header_orig {
1303 my ($self) = @_; 1303 my ($self) = @_;
1304 1304
1305 $self->load_header_from ($self->load_path) 1305 $self->load_header_from ($self->load_path)
1306} 1306}
1307 1307
1308sub load_temp { 1308sub load_header_temp {
1309 my ($self) = @_; 1309 my ($self) = @_;
1310 1310
1311 $self->load_header_from ($self->save_path) 1311 $self->load_header_from ($self->save_path)
1312}
1313
1314sub prepare_temp {
1315 my ($self) = @_;
1316
1317 $self->last_access ((delete $self->{last_access})
1318 || $cf::RUNTIME); #d#
1319 # safety
1320 $self->{instantiate_time} = $cf::RUNTIME
1321 if $self->{instantiate_time} > $cf::RUNTIME;
1322}
1323
1324sub prepare_orig {
1325 my ($self) = @_;
1326
1327 $self->{load_original} = 1;
1328 $self->{instantiate_time} = $cf::RUNTIME;
1329 $self->last_access ($cf::RUNTIME);
1330 $self->instantiate;
1312} 1331}
1313 1332
1314sub load_header { 1333sub load_header {
1315 my ($self) = @_; 1334 my ($self) = @_;
1316 1335
1317 if ($self->load_temp) { 1336 if ($self->load_header_temp) {
1318 $self->last_access ((delete $self->{last_access}) 1337 $self->prepare_temp;
1319 || $cf::RUNTIME); #d#
1320 # safety
1321 $self->{instantiate_time} = $cf::RUNTIME
1322 if $self->{instantiate_time} > $cf::RUNTIME;
1323 } else { 1338 } else {
1324 $self->load_orig 1339 $self->load_header_orig
1325 or return; 1340 or return;
1326 1341 $self->prepare_orig;
1327 $self->{load_original} = 1;
1328 $self->{instantiate_time} = $cf::RUNTIME;
1329 $self->last_access ($cf::RUNTIME);
1330 $self->instantiate;
1331 } 1342 }
1332 1343
1333 1 1344 1
1334} 1345}
1335 1346
1362 1373
1363 $cf::MAP{$path} = $map 1374 $cf::MAP{$path} = $map
1364 } 1375 }
1365} 1376}
1366 1377
1378sub pre_load { }
1379sub post_load { }
1380
1367sub load { 1381sub load {
1368 my ($self) = @_; 1382 my ($self) = @_;
1369 1383
1370 my $path = $self->{path}; 1384 my $path = $self->{path};
1371 my $guard = cf::lock_acquire "map_load:$path"; 1385 my $guard = cf::lock_acquire "map_load:$path";
1373 return if $self->in_memory != cf::MAP_SWAPPED; 1387 return if $self->in_memory != cf::MAP_SWAPPED;
1374 1388
1375 $self->in_memory (cf::MAP_LOADING); 1389 $self->in_memory (cf::MAP_LOADING);
1376 1390
1377 $self->alloc; 1391 $self->alloc;
1392
1393 $self->pre_load;
1394
1378 $self->_load_objects ($self->{load_path}, 1) 1395 $self->_load_objects ($self->{load_path}, 1)
1379 or return; 1396 or return;
1380 1397
1381 $self->set_object_flag (cf::FLAG_OBJ_ORIGINAL, 1) 1398 $self->set_object_flag (cf::FLAG_OBJ_ORIGINAL, 1)
1382 if delete $self->{load_original}; 1399 if delete $self->{load_original};
1403 $self->difficulty ($self->estimate_difficulty) 1420 $self->difficulty ($self->estimate_difficulty)
1404 unless $self->difficulty; 1421 unless $self->difficulty;
1405 Coro::cede; 1422 Coro::cede;
1406 $self->activate; 1423 $self->activate;
1407 } 1424 }
1425
1426 $self->post_load;
1408 1427
1409 $self->in_memory (cf::MAP_IN_MEMORY); 1428 $self->in_memory (cf::MAP_IN_MEMORY);
1410} 1429}
1411 1430
1412sub customise_for { 1431sub customise_for {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines