… | |
… | |
40 | use Coro::Timer; |
40 | use Coro::Timer; |
41 | use Coro::Signal; |
41 | use Coro::Signal; |
42 | use Coro::Semaphore; |
42 | use Coro::Semaphore; |
43 | use Coro::AnyEvent; |
43 | use Coro::AnyEvent; |
44 | use Coro::AIO; |
44 | use Coro::AIO; |
45 | use Coro::BDB; |
45 | use Coro::BDB 1.6; |
46 | use Coro::Storable; |
46 | use Coro::Storable; |
47 | use Coro::Util (); |
47 | use Coro::Util (); |
48 | |
48 | |
49 | use JSON::XS 2.01 (); |
49 | use JSON::XS 2.01 (); |
50 | use BDB (); |
50 | use BDB (); |
… | |
… | |
243 | for my $pkg (qw( |
243 | for my $pkg (qw( |
244 | cf::global cf::attachable |
244 | cf::global cf::attachable |
245 | cf::object cf::object::player |
245 | cf::object cf::object::player |
246 | cf::client cf::player |
246 | cf::client cf::player |
247 | cf::arch cf::living |
247 | cf::arch cf::living |
|
|
248 | cf::map cf::mapspace |
248 | cf::map cf::party cf::region |
249 | cf::party cf::region |
249 | )) { |
250 | )) { |
250 | no strict 'refs'; |
251 | no strict 'refs'; |
251 | @{"safe::$pkg\::wrap::ISA"} = @{"$pkg\::wrap::ISA"} = $pkg; |
252 | @{"safe::$pkg\::wrap::ISA"} = @{"$pkg\::wrap::ISA"} = $pkg; |
252 | } |
253 | } |
253 | |
254 | |
… | |
… | |
2086 | my $f = new_from_file cf::object::thawer $self->{load_path}; |
2087 | my $f = new_from_file cf::object::thawer $self->{load_path}; |
2087 | $f->skip_block; |
2088 | $f->skip_block; |
2088 | $self->_load_objects ($f) |
2089 | $self->_load_objects ($f) |
2089 | or return; |
2090 | or return; |
2090 | |
2091 | |
2091 | $self->set_object_flag (cf::FLAG_OBJ_ORIGINAL, 1) |
2092 | $self->post_load_original |
2092 | if delete $self->{load_original}; |
2093 | if delete $self->{load_original}; |
2093 | |
2094 | |
2094 | if (my $uniq = $self->uniq_path) { |
2095 | if (my $uniq = $self->uniq_path) { |
2095 | utf8::encode $uniq; |
2096 | utf8::encode $uniq; |
2096 | unless (aio_stat $uniq) { |
2097 | unless (aio_stat $uniq) { |
… | |
… | |
3128 | =cut |
3129 | =cut |
3129 | |
3130 | |
3130 | for ( |
3131 | for ( |
3131 | ["cf::object" => qw(contr pay_amount pay_player map force_find force_add x y |
3132 | ["cf::object" => qw(contr pay_amount pay_player map force_find force_add x y |
3132 | insert remove inv nrof name archname title slaying race |
3133 | insert remove inv nrof name archname title slaying race |
3133 | decrease split destroy)], |
3134 | decrease split destroy change_exp)], |
3134 | ["cf::object::player" => qw(player)], |
3135 | ["cf::object::player" => qw(player)], |
3135 | ["cf::player" => qw(peaceful)], |
3136 | ["cf::player" => qw(peaceful)], |
3136 | ["cf::map" => qw(trigger)], |
3137 | ["cf::map" => qw(trigger)], |
3137 | ) { |
3138 | ) { |
3138 | no strict 'refs'; |
3139 | no strict 'refs'; |
… | |
… | |
3796 | BDB::max_poll_reqs $TICK * 0.1; |
3797 | BDB::max_poll_reqs $TICK * 0.1; |
3797 | $AnyEvent::BDB::WATCHER->priority (1); |
3798 | $AnyEvent::BDB::WATCHER->priority (1); |
3798 | |
3799 | |
3799 | unless ($DB_ENV) { |
3800 | unless ($DB_ENV) { |
3800 | $DB_ENV = BDB::db_env_create; |
3801 | $DB_ENV = BDB::db_env_create; |
3801 | $DB_ENV->set_flags (BDB::AUTO_COMMIT | BDB::REGION_INIT | BDB::TXN_NOSYNC |
3802 | $DB_ENV->set_flags (BDB::AUTO_COMMIT | BDB::REGION_INIT); |
3802 | | BDB::LOG_AUTOREMOVE, 1); |
3803 | $DB_ENV->set_flags (&BDB::LOG_AUTOREMOVE ) if BDB::VERSION v0, v4.7; |
|
|
3804 | $DB_ENV->log_set_config (&BDB::LOG_AUTO_REMOVE) if BDB::VERSION v4.7; |
3803 | $DB_ENV->set_timeout (30, BDB::SET_TXN_TIMEOUT); |
3805 | $DB_ENV->set_timeout (30, BDB::SET_TXN_TIMEOUT); |
3804 | $DB_ENV->set_timeout (30, BDB::SET_LOCK_TIMEOUT); |
3806 | $DB_ENV->set_timeout (30, BDB::SET_LOCK_TIMEOUT); |
3805 | |
3807 | |
3806 | cf::sync_job { |
3808 | cf::sync_job { |
3807 | eval { |
3809 | eval { |