ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/deliantra
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/deliantra (file contents):
Revision 1.37 by root, Mon May 5 16:19:19 2008 UTC vs.
Revision 1.44 by root, Mon May 26 03:34:02 2008 UTC

99use Deliantra; 99use Deliantra;
100use Deliantra::Protocol::Constants; 100use Deliantra::Protocol::Constants;
101 101
102use Compress::LZF; 102use Compress::LZF;
103 103
104use DC;
104use DC; BEGIN { $SIG{__DIE__} = sub { DC::fatal Carp::longmess "$@" unless $^S } } 105#d# BEGIN { $SIG{__DIE__} = sub { DC::fatal Carp::longmess "$@" unless $^S } }
105use DC::OpenGL (); 106use DC::OpenGL ();
106use DC::Protocol; 107use DC::Protocol;
107use DC::DB; 108use DC::DB;
108use DC::UI; 109use DC::UI;
109use DC::UI::Canvas; 110use DC::UI::Canvas;
664 # right: accept 665 # right: accept
665 $table->add_at (4, 0, new DC::UI::Button 666 $table->add_at (4, 0, new DC::UI::Button
666 text => "Accept", 667 text => "Accept",
667 on_activate => sub { 668 on_activate => sub {
668 $conn->send ("reply n"); 669 $conn->send ("reply n");
669 $STATS_PAGE->hide;
670 destroy_query_dialog $conn; 670 destroy_query_dialog $conn;
671 0 671 0
672 }, 672 },
673 ); 673 );
674 674
738 738
739 my ($host, $port) = split /:/, $PROFILE->{host}; 739 my ($host, $port) = split /:/, $PROFILE->{host};
740 740
741 $MAP = new DC::Map; 741 $MAP = new DC::Map;
742 742
743 $CONN = eval { 743 $CONN =
744 new DC::Protocol 744 new DC::Protocol
745 host => $host, 745 host => $host,
746 port => $port || 13327, 746 port => $port || 13327,
747 user => $PROFILE->{user}, 747 user => $PROFILE->{user},
748 pass => $PROFILE->{password}, 748 pass => $PROFILE->{password},
758 query => \&server_query, 758 query => \&server_query,
759 759
760 setup_req => { 760 setup_req => {
761 smoothing => $CFG->{map_smoothing}*1, 761 smoothing => $CFG->{map_smoothing}*1,
762 }, 762 },
763 };
764 763
765 if ($CONN) { 764 on_connect => sub {
765 if ($_[0]) {
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 undef $CONN;
771 status "unable to connect"; 771 status "unable to connect: $!";
772 stop_game(); 772 stop_game();
773 }
774 },
773 } 775 ;
774} 776}
775 777
776sub stop_game { 778sub stop_game {
777 $LOGIN_BUTTON->set_text ("Login / Register"); 779 $LOGIN_BUTTON->set_text ("Login / Register");
778 $SETUP_NOTEBOOK->set_current_page ($SETUP_LOGIN); 780 $SETUP_NOTEBOOK->set_current_page ($SETUP_LOGIN);
1743 1745
1744 $r 1746 $r
1745} 1747}
1746 1748
1747my %SORT_ORDER = ( 1749my %SORT_ORDER = (
1748 type => undef, 1750 type => sub {
1751 sort { $a->{type} <=> $b->{type} or $a->{name} cmp $b->{name} } @_
1752 },
1749 mtime => sub { 1753 mtime => sub {
1750 my $NOW = time; 1754 my $NOW = time;
1751 sort { 1755 sort {
1752 my $atime = $a->{mtime} - $NOW; $atime = $atime < 5 * 60 ? int $atime / 60 : 6; 1756 my $atime = $a->{mtime} - $NOW; $atime = $atime < 5 * 60 ? int $atime / 60 : 6;
1753 my $btime = $b->{mtime} - $NOW; $btime = $btime < 5 * 60 ? int $btime / 60 : 6; 1757 my $btime = $b->{mtime} - $NOW; $btime = $btime < 5 * 60 ? int $btime / 60 : 6;
2242 force_h => $::HEIGHT * 0.6, 2246 force_h => $::HEIGHT * 0.6,
2243 has_close_button => 1, 2247 has_close_button => 1,
2244 ; 2248 ;
2245 2249
2246 $METASERVER = metaserver_dialog; 2250 $METASERVER = metaserver_dialog;
2251 # the name is changed to not conflict with the older name as users could have hidden it
2247 $MESSAGE_WINDOW = new DC::UI::Dockbar (title => 'Messages'); 2252 $MESSAGE_WINDOW = new DC::UI::Dockbar
2253 name => "message_window2",
2254 title => 'Messages',
2255 force_w => $::WIDTH * 0.6,
2256 force_h => $::HEIGHT * 0.25,
2257 ;
2258
2248 $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW; 2259 $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW;
2249 2260
2250 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1, debug => 1, 2261 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1,
2251 filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); 2262 filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1);
2252 2263
2253 $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup, 2264 $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup,
2254 "Configure the server to play on, your username and password."); 2265 "Configure the server to play on, your username and password.");
2255 $SETUP_NOTEBOOK->add_tab (Server => $SETUP_SERVER = server_setup, 2266 $SETUP_NOTEBOOK->add_tab (Server => $SETUP_SERVER = server_setup,
2294 }, 2305 },
2295 ); 2306 );
2296 2307
2297 $BUTTONBAR->add (new DC::UI::Flopper text => "Help!", other => $HELP_WINDOW = help_window, 2308 $BUTTONBAR->add (new DC::UI::Flopper text => "Help!", other => $HELP_WINDOW = help_window,
2298 tooltip => "View Documentation"); 2309 tooltip => "View Documentation");
2299
2300 2310
2301 $BUTTONBAR->add (new DC::UI::Button 2311 $BUTTONBAR->add (new DC::UI::Button
2302 text => "Quit", 2312 text => "Quit",
2303 tooltip => "Terminates the program", 2313 tooltip => "Terminates the program",
2304 on_activate => sub { 2314 on_activate => sub {
2475 pickup => 0, 2485 pickup => 0,
2476 inv_sort => "mtime", 2486 inv_sort => "mtime",
2477 default => "profile", # default profile 2487 default => "profile", # default profile
2478 show_tips => 1, 2488 show_tips => 1,
2479 logview_max_par => 1000, 2489 logview_max_par => 1000,
2490 shift_fire_stop => 0,
2480 ); 2491 );
2481 2492
2482 while (my ($k, $v) = each %DEF_CFG) { 2493 while (my ($k, $v) = each %DEF_CFG) {
2483 $CFG->{$k} = $v unless exists $CFG->{$k}; 2494 $CFG->{$k} = $v unless exists $CFG->{$k};
2484 } 2495 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines