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.38 by root, Mon May 5 16:26:11 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;
737 738
738 my ($host, $port) = split /:/, $PROFILE->{host}; 739 my ($host, $port) = split /:/, $PROFILE->{host};
739 740
740 $MAP = new DC::Map; 741 $MAP = new DC::Map;
741 742
742 $CONN = eval { 743 $CONN =
743 new DC::Protocol 744 new DC::Protocol
744 host => $host, 745 host => $host,
745 port => $port || 13327, 746 port => $port || 13327,
746 user => $PROFILE->{user}, 747 user => $PROFILE->{user},
747 pass => $PROFILE->{password}, 748 pass => $PROFILE->{password},
757 query => \&server_query, 758 query => \&server_query,
758 759
759 setup_req => { 760 setup_req => {
760 smoothing => $CFG->{map_smoothing}*1, 761 smoothing => $CFG->{map_smoothing}*1,
761 }, 762 },
762 };
763 763
764 if ($CONN) { 764 on_connect => sub {
765 if ($_[0]) {
765 DC::lowdelay fileno $CONN->{fh}; 766 DC::lowdelay fileno $CONN->{fh};
766 767
767 status "login successful"; 768 status "login successful";
768 } else { 769 } else {
769 warn $@; 770 undef $CONN;
770 status "unable to connect"; 771 status "unable to connect: $!";
771 stop_game(); 772 stop_game();
773 }
774 },
772 } 775 ;
773} 776}
774 777
775sub stop_game { 778sub stop_game {
776 $LOGIN_BUTTON->set_text ("Login / Register"); 779 $LOGIN_BUTTON->set_text ("Login / Register");
777 $SETUP_NOTEBOOK->set_current_page ($SETUP_LOGIN); 780 $SETUP_NOTEBOOK->set_current_page ($SETUP_LOGIN);
1742 1745
1743 $r 1746 $r
1744} 1747}
1745 1748
1746my %SORT_ORDER = ( 1749my %SORT_ORDER = (
1747 type => undef, 1750 type => sub {
1751 sort { $a->{type} <=> $b->{type} or $a->{name} cmp $b->{name} } @_
1752 },
1748 mtime => sub { 1753 mtime => sub {
1749 my $NOW = time; 1754 my $NOW = time;
1750 sort { 1755 sort {
1751 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;
1752 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;
2241 force_h => $::HEIGHT * 0.6, 2246 force_h => $::HEIGHT * 0.6,
2242 has_close_button => 1, 2247 has_close_button => 1,
2243 ; 2248 ;
2244 2249
2245 $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
2246 $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
2247 $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW; 2259 $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW;
2248 2260
2249 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1, 2261 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1,
2250 filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); 2262 filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1);
2251 2263
2473 pickup => 0, 2485 pickup => 0,
2474 inv_sort => "mtime", 2486 inv_sort => "mtime",
2475 default => "profile", # default profile 2487 default => "profile", # default profile
2476 show_tips => 1, 2488 show_tips => 1,
2477 logview_max_par => 1000, 2489 logview_max_par => 1000,
2490 shift_fire_stop => 0,
2478 ); 2491 );
2479 2492
2480 while (my ($k, $v) = each %DEF_CFG) { 2493 while (my ($k, $v) = each %DEF_CFG) {
2481 $CFG->{$k} = $v unless exists $CFG->{$k}; 2494 $CFG->{$k} = $v unless exists $CFG->{$k};
2482 } 2495 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines