… | |
… | |
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; |
… | |
… | |
664 | # right: accept |
664 | # right: accept |
665 | $table->add_at (4, 0, new DC::UI::Button |
665 | $table->add_at (4, 0, new DC::UI::Button |
666 | text => "Accept", |
666 | text => "Accept", |
667 | on_activate => sub { |
667 | on_activate => sub { |
668 | $conn->send ("reply n"); |
668 | $conn->send ("reply n"); |
669 | $STATS_PAGE->hide; |
|
|
670 | destroy_query_dialog $conn; |
669 | destroy_query_dialog $conn; |
671 | 0 |
670 | 0 |
672 | }, |
671 | }, |
673 | ); |
672 | ); |
674 | |
673 | |
… | |
… | |
1621 | $CFG->{show_tips} = $value; |
1620 | $CFG->{show_tips} = $value; |
1622 | 0 |
1621 | 0 |
1623 | } |
1622 | } |
1624 | ); |
1623 | ); |
1625 | |
1624 | |
1626 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Messages Window Size"); |
1625 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Window Size"); |
1627 | $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry |
1626 | $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry |
1628 | text => $CFG->{logview_max_par}, |
1627 | text => $CFG->{logview_max_par}, |
1629 | tooltip => "This is maximum number of messages remembered in the <b>Messages</b> window. If the server " |
1628 | tooltip => "This is maximum number of messages remembered in the <b>Message</b> window. If the server " |
1630 | . "sends more messages than this number, older messages get removed to save memory and " |
1629 | . "sends more messages than this number, older messages get removed to save memory and " |
1631 | . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", |
1630 | . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", |
1632 | on_changed => sub { |
1631 | on_changed => sub { |
1633 | my ($self, $value) = @_; |
1632 | my ($self, $value) = @_; |
1634 | $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1); |
1633 | $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1); |
… | |
… | |
2242 | force_h => $::HEIGHT * 0.6, |
2241 | force_h => $::HEIGHT * 0.6, |
2243 | has_close_button => 1, |
2242 | has_close_button => 1, |
2244 | ; |
2243 | ; |
2245 | |
2244 | |
2246 | $METASERVER = metaserver_dialog; |
2245 | $METASERVER = metaserver_dialog; |
2247 | $MESSAGE_WINDOW = new DC::UI::Dockbar (name => 'message_window', title => 'Messages'); |
2246 | $MESSAGE_WINDOW = new DC::UI::Dockbar (title => 'Messages'); |
2248 | $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW; |
2247 | $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW; |
2249 | |
2248 | |
2250 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1, debug => 1, |
2249 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1, |
2251 | filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); |
2250 | filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); |
2252 | |
2251 | |
2253 | $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup, |
2252 | $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup, |
2254 | "Configure the server to play on, your username and password."); |
2253 | "Configure the server to play on, your username and password."); |
2255 | $SETUP_NOTEBOOK->add_tab (Server => $SETUP_SERVER = server_setup, |
2254 | $SETUP_NOTEBOOK->add_tab (Server => $SETUP_SERVER = server_setup, |
… | |
… | |
2273 | $BUTTONBAR = new DC::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
2272 | $BUTTONBAR = new DC::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
2274 | |
2273 | |
2275 | $BUTTONBAR->add (new DC::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
2274 | $BUTTONBAR->add (new DC::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
2276 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
2275 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
2277 | |
2276 | |
2278 | $BUTTONBAR->add (new DC::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW, |
2277 | # $BUTTONBAR->add (new DC::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW, |
2279 | tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
2278 | # tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
2280 | |
2279 | |
2281 | make_gauge_window->show; # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D |
2280 | make_gauge_window->show; # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D |
2282 | |
2281 | |
2283 | $BUTTONBAR->add (new DC::UI::Flopper text => "Playerbook", other => player_window, |
2282 | $BUTTONBAR->add (new DC::UI::Flopper text => "Playerbook", other => player_window, |
2284 | tooltip => "Toggles the player view, where you can manage Inventory, Spells, Skills and see your Stats."); |
2283 | tooltip => "Toggles the player view, where you can manage Inventory, Spells, Skills and see your Stats."); |
… | |
… | |
2286 | $BUTTONBAR->add (new DC::UI::Button |
2285 | $BUTTONBAR->add (new DC::UI::Button |
2287 | text => "Save Config", |
2286 | text => "Save Config", |
2288 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
2287 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
2289 | on_activate => sub { |
2288 | on_activate => sub { |
2290 | $::CFG->{layout} = DC::UI::get_layout; |
2289 | $::CFG->{layout} = DC::UI::get_layout; |
2291 | DC::write_cfg "$Deliantra::VARDIR/client.cf"; |
2290 | DC::write_cfg; |
2292 | status "Configuration Saved"; |
2291 | status "Configuration Saved"; |
2293 | 0 |
2292 | 0 |
2294 | }, |
2293 | }, |
2295 | ); |
2294 | ); |
2296 | |
2295 | |
2297 | $BUTTONBAR->add (new DC::UI::Flopper text => "Help!", other => $HELP_WINDOW = help_window, |
2296 | $BUTTONBAR->add (new DC::UI::Flopper text => "Help!", other => $HELP_WINDOW = help_window, |
2298 | tooltip => "View Documentation"); |
2297 | tooltip => "View Documentation"); |
2299 | |
|
|
2300 | |
2298 | |
2301 | $BUTTONBAR->add (new DC::UI::Button |
2299 | $BUTTONBAR->add (new DC::UI::Button |
2302 | text => "Quit", |
2300 | text => "Quit", |
2303 | tooltip => "Terminates the program", |
2301 | tooltip => "Terminates the program", |
2304 | on_activate => sub { |
2302 | on_activate => sub { |
… | |
… | |
2421 | EV::unloop; |
2419 | EV::unloop; |
2422 | #d# TODO calling exit here hangs the process in some futex |
2420 | #d# TODO calling exit here hangs the process in some futex |
2423 | }; |
2421 | }; |
2424 | |
2422 | |
2425 | { |
2423 | { |
|
|
2424 | DC::Pod::load_docwiki DC::find_rcfile "docwiki.pst"; |
|
|
2425 | |
2426 | if (-e "$Deliantra::VARDIR/client.cf") { |
2426 | if (-e "$Deliantra::VARDIR/client.cf") { |
2427 | DC::read_cfg "$Deliantra::VARDIR/client.cf"; |
2427 | DC::read_cfg "$Deliantra::VARDIR/client.cf"; |
2428 | } else { |
2428 | } else { |
2429 | #TODO: compatibility cruft |
2429 | #TODO: compatibility cruft |
2430 | DC::read_cfg "$Deliantra::OLDDIR/cfplusrc"; |
2430 | DC::read_cfg "$Deliantra::OLDDIR/cfplusrc"; |
2431 | print STDERR "INFO: used old configuration file\n"; |
2431 | print STDERR "INFO: used old configuration file\n"; |
2432 | } |
2432 | } |
2433 | |
2433 | |
2434 | DC::DB::Server::run; |
2434 | DC::DB::Server::run; |
|
|
2435 | |
|
|
2436 | if ($CFG->{db_schema} < 1) { |
|
|
2437 | warn "INFO: upgrading database schema from 0 to 1, mapcache and tilecache will be lost\n"; |
|
|
2438 | DC::DB::nuke_db; |
|
|
2439 | $CFG->{db_schema} = 1; |
|
|
2440 | DC::write_cfg; |
|
|
2441 | } |
|
|
2442 | |
|
|
2443 | DC::DB::open_db; |
2435 | |
2444 | |
2436 | DC::UI::set_layout ($::CFG->{layout}); |
2445 | DC::UI::set_layout ($::CFG->{layout}); |
2437 | |
2446 | |
2438 | my %DEF_CFG = ( |
2447 | my %DEF_CFG = ( |
2439 | sdl_mode => 0, |
2448 | sdl_mode => 0, |
… | |
… | |
2541 | our $STARTUP_CANCEL = EV::idle sub { |
2550 | our $STARTUP_CANCEL = EV::idle sub { |
2542 | undef $::STARTUP_CANCEL; |
2551 | undef $::STARTUP_CANCEL; |
2543 | $startup_done->(); |
2552 | $startup_done->(); |
2544 | }; |
2553 | }; |
2545 | |
2554 | |
|
|
2555 | delete $SIG{__DIE__}; |
2546 | EV::loop; |
2556 | EV::loop; |
2547 | |
2557 | |
2548 | #video_shutdown; |
2558 | #video_shutdown; |
2549 | #audio_shutdown; |
2559 | #audio_shutdown; |
2550 | DC::OpenGL::quit; |
2560 | DC::OpenGL::quit; |