… | |
… | |
99 | use Deliantra; |
99 | use Deliantra; |
100 | use Deliantra::Protocol::Constants; |
100 | use Deliantra::Protocol::Constants; |
101 | |
101 | |
102 | use Compress::LZF; |
102 | use Compress::LZF; |
103 | |
103 | |
104 | use DC; |
104 | use DC; BEGIN { $SIG{__DIE__} = sub { DC::fatal Carp::longmess "$@" unless $^S } } |
105 | use DC::OpenGL (); |
105 | use DC::OpenGL (); |
106 | use DC::Protocol; |
106 | use DC::Protocol; |
107 | use DC::DB; |
107 | use DC::DB; |
108 | use DC::UI; |
108 | use DC::UI; |
109 | use DC::UI::Canvas; |
109 | use DC::UI::Canvas; |
… | |
… | |
765 | if ($CONN) { |
765 | if ($CONN) { |
766 | DC::lowdelay fileno $CONN->{fh}; |
766 | DC::lowdelay fileno $CONN->{fh}; |
767 | |
767 | |
768 | status "login successful"; |
768 | status "login successful"; |
769 | } else { |
769 | } else { |
|
|
770 | warn $@; |
770 | status "unable to connect"; |
771 | status "unable to connect"; |
771 | stop_game(); |
772 | stop_game(); |
772 | } |
773 | } |
773 | } |
774 | } |
774 | |
775 | |
… | |
… | |
2285 | $BUTTONBAR->add (new DC::UI::Button |
2286 | $BUTTONBAR->add (new DC::UI::Button |
2286 | text => "Save Config", |
2287 | text => "Save Config", |
2287 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
2288 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
2288 | on_activate => sub { |
2289 | on_activate => sub { |
2289 | $::CFG->{layout} = DC::UI::get_layout; |
2290 | $::CFG->{layout} = DC::UI::get_layout; |
2290 | DC::write_cfg "$Deliantra::VARDIR/client.cf"; |
2291 | DC::write_cfg; |
2291 | status "Configuration Saved"; |
2292 | status "Configuration Saved"; |
2292 | 0 |
2293 | 0 |
2293 | }, |
2294 | }, |
2294 | ); |
2295 | ); |
2295 | |
2296 | |
… | |
… | |
2420 | EV::unloop; |
2421 | EV::unloop; |
2421 | #d# TODO calling exit here hangs the process in some futex |
2422 | #d# TODO calling exit here hangs the process in some futex |
2422 | }; |
2423 | }; |
2423 | |
2424 | |
2424 | { |
2425 | { |
|
|
2426 | DC::Pod::load_docwiki DC::find_rcfile "docwiki.pst"; |
|
|
2427 | |
2425 | if (-e "$Deliantra::VARDIR/client.cf") { |
2428 | if (-e "$Deliantra::VARDIR/client.cf") { |
2426 | DC::read_cfg "$Deliantra::VARDIR/client.cf"; |
2429 | DC::read_cfg "$Deliantra::VARDIR/client.cf"; |
2427 | } else { |
2430 | } else { |
2428 | #TODO: compatibility cruft |
2431 | #TODO: compatibility cruft |
2429 | DC::read_cfg "$Deliantra::OLDDIR/cfplusrc"; |
2432 | DC::read_cfg "$Deliantra::OLDDIR/cfplusrc"; |
2430 | print STDERR "INFO: used old configuration file\n"; |
2433 | print STDERR "INFO: used old configuration file\n"; |
2431 | } |
2434 | } |
2432 | |
2435 | |
2433 | DC::DB::Server::run; |
2436 | DC::DB::Server::run; |
|
|
2437 | |
|
|
2438 | if ($CFG->{db_schema} < 1) { |
|
|
2439 | warn "INFO: upgrading database schema from 0 to 1, mapcache and tilecache will be lost\n"; |
|
|
2440 | DC::DB::nuke_db; |
|
|
2441 | $CFG->{db_schema} = 1; |
|
|
2442 | DC::write_cfg; |
|
|
2443 | } |
|
|
2444 | |
|
|
2445 | DC::DB::open_db; |
2434 | |
2446 | |
2435 | DC::UI::set_layout ($::CFG->{layout}); |
2447 | DC::UI::set_layout ($::CFG->{layout}); |
2436 | |
2448 | |
2437 | my %DEF_CFG = ( |
2449 | my %DEF_CFG = ( |
2438 | sdl_mode => 0, |
2450 | sdl_mode => 0, |
… | |
… | |
2540 | our $STARTUP_CANCEL = EV::idle sub { |
2552 | our $STARTUP_CANCEL = EV::idle sub { |
2541 | undef $::STARTUP_CANCEL; |
2553 | undef $::STARTUP_CANCEL; |
2542 | $startup_done->(); |
2554 | $startup_done->(); |
2543 | }; |
2555 | }; |
2544 | |
2556 | |
|
|
2557 | delete $SIG{__DIE__}; |
2545 | EV::loop; |
2558 | EV::loop; |
2546 | |
2559 | |
2547 | #video_shutdown; |
2560 | #video_shutdown; |
2548 | #audio_shutdown; |
2561 | #audio_shutdown; |
2549 | DC::OpenGL::quit; |
2562 | DC::OpenGL::quit; |