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

Comparing deliantra/Deliantra-Client/DC/Main.pm (file contents):
Revision 1.18 by root, Wed Jan 18 15:31:51 2012 UTC vs.
Revision 1.31 by root, Mon Nov 19 00:56:08 2018 UTC

25BEGIN { *time = \&EV::time } 25BEGIN { *time = \&EV::time }
26 26
27use List::Util qw(max min); 27use List::Util qw(max min);
28 28
29use Deliantra; 29use Deliantra;
30use Deliantra::Util;
30use Deliantra::Protocol::Constants; 31use Deliantra::Protocol::Constants;
31 32
32use AnyEvent::Util (); 33use AnyEvent::Util ();
33use AnyEvent::Socket (); 34use AnyEvent::Socket ();
34use AnyEvent::DNS (); 35use AnyEvent::DNS ();
35 36
36use Compress::LZF; 37use Compress::LZF;
37use JSON::XS; 38use JSON::XS;
39use Urlader;
38 40
39use DC; 41use DC;
40 42
41sub crash($;$) { 43sub crash($;$) {
42 # nop at compiletime 44 # nop at compiletime
44 46
45BEGIN { 47BEGIN {
46 $SIG{__DIE__} = sub { 48 $SIG{__DIE__} = sub {
47 return if $^S; # quick reject 49 return if $^S; # quick reject
48 50
49 # return if there are any eval contexts in the csall stack 51 # return if there are any eval contexts in the call stack
50 for my $i (0..999) { 52 for my $i (0..999) {
51 my ($sub, $is_require) = (caller $i)[3, 7] 53 my ($sub, $is_require) = (caller $i)[3, 7]
52 or last; 54 or last;
53 return if $sub eq "(eval)" && !$is_require; 55 return if $sub eq "(eval)" && !$is_require;
54 } 56 }
72use DC::MessageDistributor; 74use DC::MessageDistributor;
73use DC::Pod; 75use DC::Pod;
74use DC::MapWidget; 76use DC::MapWidget;
75use DC::Macro; 77use DC::Macro;
76 78
79# printf "%5d %5d %5d %5d\n", $_, DC::minpot $_, DC::ld32 $_, 2 << ((DC::ld32 $_ - 1));
80
77$SIG{QUIT} = sub { Carp::cluck "QUIT" }; 81$SIG{QUIT} = sub { Carp::cluck "QUIT" };
78$SIG{PIPE} = 'IGNORE'; 82$SIG{PIPE} = 'IGNORE';
79 83
80$EV::DIED = sub { 84$EV::DIED = sub {
81 crash "CRASH/EV::DIED: $@" => 0; 85 crash "CRASH/EV::DIED: $@" => 0;
127our $MENUBAR; # the hbox at the top 131our $MENUBAR; # the hbox at the top
128our $MENUPOPUP; 132our $MENUPOPUP;
129our $BUTTONBAR; # the menu buttons 133our $BUTTONBAR; # the menu buttons
130our $METASERVER; 134our $METASERVER;
131our $LOGIN_BUTTON; 135our $LOGIN_BUTTON;
136our $LOGIN_ERROR;
132our $QUIT_DIALOG; 137our $QUIT_DIALOG;
133our $HOST_ENTRY; 138our $HOST_ENTRY;
134our $FULLSCREEN_ENABLE; 139our $FULLSCREEN_ENABLE;
135our $PICKUP_ENABLE; 140our $PICKUP_ENABLE;
136our $SERVER_INFO; 141our $SERVER_INFO;
250 : "[<span foreground='#888'>num</span>]"; 255 : "[<span foreground='#888'>num</span>]";
251 256
252 # <tt> around next statement works around some bug that keeps the 257 # <tt> around next statement works around some bug that keeps the
253 # "font =>" from being used on windows 258 # "font =>" from being used on windows
254 $MODBOX->set_markup ("<tt>$markup</tt>"); 259 $MODBOX->set_markup ("<tt>$markup</tt>");
260}
261
262sub errorbox {
263 my ($msg) = @_;
264
265 status $msg;
266
267 my $dialog = new DC::UI::Toplevel
268 x => "center",
269 y => "center",
270 z => 200,
271 title => "Error",
272 child => my $vbox = new DC::UI::VBox,
273 has_close_button => 1,
274 on_delete => sub {
275 $_[0]->destroy;
276 },
277 ;
278
279 add $vbox new DC::UI::Label
280 align => 0.5,
281 ellipsise => 0,
282 text => $msg;
283
284 add $vbox new DC::UI::Button
285 expand => 1,
286 text => "OK",
287 on_activate => sub {
288 $dialog->destroy;
289 0
290 }
291 ;
292
293 $dialog->show;
255} 294}
256 295
257############################################################################# 296#############################################################################
258#TODO: maybe move into own audio module... 297#TODO: maybe move into own audio module...
259 298
474 audio_music_push; 513 audio_music_push;
475} 514}
476 515
477sub audio_init { 516sub audio_init {
478 if ($CFG->{audio_enable}) { 517 if ($CFG->{audio_enable}) {
479 DC::Audio::init $CFG->{audio_driver}; 518 DC::Audio::init;
480 519
481 if ($SDL_MIXER) { 520 if ($SDL_MIXER) {
482 audio_music_finished; 521 audio_music_finished;
483 } else { 522 } else {
484 status "Unable to open sound device: there will be no sound"; 523 status "Unable to open sound device: there will be no sound";
688 ::message { markup => "Server has no newer version." }; 727 ::message { markup => "Server has no newer version." };
689 } 728 }
690 } else { 729 } else {
691 ::message { markup => "Server does not support software update." }; 730 ::message { markup => "Server does not support software update." };
692 } 731 }
693
694# $self->register_face_handler ($exp_table, sub {
695# my ($face) = @_;
696
697# $self->{exp_table} = $self->{json_coder}->decode (delete $face->{data});
698# $_->() for values %{ $self->{on_exp_update} || {} };
699# });
700 732
701 () 733 ()
702 }); 734 });
703} 735}
704 736
934 $vbox->add (@dialog); 966 $vbox->add (@dialog);
935 $dialog->show; 967 $dialog->show;
936} 968}
937 969
938sub dc_connect { 970sub dc_connect {
939 my ($host, $port) = @_; 971 my ($host, $port, $create) = @_;
940 972
941 my $mapw = List::Util::min 48, List::Util::max 11, int 1.5 + $WIDTH * $CFG->{mapsize} * 0.01 / 32; 973 my $mapw = List::Util::min 48, List::Util::max 11, int 1.5 + $WIDTH * $CFG->{mapsize} * 0.01 / 32;
942 my $maph = List::Util::min 48, List::Util::max 11, int 1.5 + $HEIGHT * $CFG->{mapsize} * 0.01 / 32; 974 my $maph = List::Util::min 48, List::Util::max 11, int 1.5 + $HEIGHT * $CFG->{mapsize} * 0.01 / 32;
943 975
944 $CONN = 976 $CONN =
945 new DC::Protocol 977 new DC::Protocol
946 host => $host, 978 host => $host,
947 port => $port, 979 port => $port,
980 create_login => $create,
948 user => $PROFILE->{user}, 981 user => $PROFILE->{user},
949 pass => $PROFILE->{password}, 982 pass => (pack "H*", $PROFILE->{password}),
950 mapw => $mapw, 983 mapw => $mapw,
951 maph => $maph, 984 maph => $maph,
952 985
953 c_version => { 986 c_version => {
954 client => "deliantra", 987 client => "deliantra",
974 ota_update_check; 1007 ota_update_check;
975 1008
976 status "successfully connected to the server"; 1009 status "successfully connected to the server";
977 } else { 1010 } else {
978 undef $CONN; 1011 undef $CONN;
979 status "unable to connect: $!"; 1012 $LOGIN_ERROR->{fg} = [1, 0, 0];
1013 $LOGIN_ERROR->set_text ("Unable to connect to server: $!");
980 stop_game(); 1014 stop_game();
981 } 1015 }
982 }, 1016 },
1017
1018 on_addme => sub {
1019 my ($ok, $msg) = @_;
1020
1021 $LOGIN_ERROR->{fg} = $ok ? [0, 1, 0] : [1, 0, 0];
1022 $LOGIN_ERROR->set_text ($msg);
1023 },
983 ; 1024 ;
984} 1025}
985 1026
986sub start_game { 1027sub start_game($) {
1028 my ($create) = @_;
1029
987 status "logging in..."; 1030 status "logging in...";
988 1031
989 my $server = $PROFILE->{host} || $DEFAULT_SERVER; 1032 my $server = $PROFILE->{host} || $DEFAULT_SERVER;
990 my ($host, $port) = AnyEvent::Socket::parse_hostport $server, "deliantra=13327" 1033 my ($host, $port) = AnyEvent::Socket::parse_hostport $server, "deliantra=13327"
991 or return status "$server: unable to parse server address, try an empty field."; 1034 or return status "$server: unable to parse server address, try an empty field.";
1006 status "dns failure, using hardcoded address"; 1049 status "dns failure, using hardcoded address";
1007 $host = "194.126.175.154"; 1050 $host = "194.126.175.154";
1008 } 1051 }
1009 } 1052 }
1010 1053
1011 dc_connect $host, $port; 1054 dc_connect $host, $port, $create;
1012 }; 1055 };
1013 } else { 1056 } else {
1014 dc_connect $host, $port; 1057 dc_connect $host, $port, $create;
1015 } 1058 }
1016} 1059}
1017 1060
1018sub stop_game { 1061sub stop_game {
1019 crash "stop_game"; 1062 crash "stop_game";
1137 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Compress Textures"); 1180 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Compress Textures");
1138 $table->add_at (1, $row++, new DC::UI::CheckBox 1181 $table->add_at (1, $row++, new DC::UI::CheckBox
1139 state => $CFG->{texture_compression}, 1182 state => $CFG->{texture_compression},
1140 tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but " 1183 tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but "
1141 . "will save a lot of memory and increase performance (and also fall prey to the ever-buggy Mac OS X software renderer). " 1184 . "will save a lot of memory and increase performance (and also fall prey to the ever-buggy Mac OS X software renderer). "
1142 . "The compression algorithm can differ form card to card, so your mileage may vary. This setting is ignored in " 1185 . "The compression algorithm can differ from card to card, so your mileage may vary. This setting is ignored in "
1143 . "forced OpenGL 1.1 mode and when using the Apple renderer.", 1186 . "forced OpenGL 1.1 mode and when using the Apple renderer.",
1144 on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 } 1187 on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 }
1145 ); 1188 );
1146 1189
1147 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fast & Ugly"); 1190 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fast & Ugly");
1499 $DELIANTRA_DEBUG ^= $_[0]; 1542 $DELIANTRA_DEBUG ^= $_[0];
1500 1543
1501 if ($DELIANTRA_DEBUG & 16) { 1544 if ($DELIANTRA_DEBUG & 16) {
1502 $BW_WATCHER = EV::periodic 0, 1, 0, sub { 1545 $BW_WATCHER = EV::periodic 0, 1, 0, sub {
1503 return unless $CONN; 1546 return unless $CONN;
1504 debug sprintf "%8.2gKB/s", $CONN->{octets_in} / 1e3; 1547 debug sprintf "%8.2gkB/s", $CONN->{octets_in} / 1e3;
1505 $CONN->{octets_in} = 0; 1548 $CONN->{octets_in} = 0;
1506 }; 1549 };
1507 } else { 1550 } else {
1508 undef $BW_WATCHER; 1551 undef $BW_WATCHER;
1509 } 1552 }
1852 $vbox->add (new DC::UI::FancyFrame 1895 $vbox->add (new DC::UI::FancyFrame
1853 label => "Login Settings", 1896 label => "Login Settings",
1854 child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), 1897 child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]),
1855 ); 1898 );
1856 1899
1900 my $nullpw = "\x00" x 16;
1901
1857 $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username"); 1902 $table->add_at (0, 0, new DC::UI::Label align => 1, text => "Username");
1858 $table->add_at (1, 4, new DC::UI::Entry 1903 $table->add_at (1, 0, new DC::UI::Entry
1859 text => $PROFILE->{user}, 1904 text => $PROFILE->{user},
1860 tooltip => "The name of your character on the server. The name is case-sensitive!", 1905 tooltip => "The name of your character on the server. The name is case-sensitive!",
1861 on_changed => sub { my ($self, $value) = @_; $PROFILE->{user} = $value; 1 } 1906 on_changed => sub { my ($self, $value) = @_; $PROFILE->{user} = $value; 1 }
1862 ); 1907 );
1863 1908
1864 $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password"); 1909 $table->add_at (0, 1, new DC::UI::Label align => 1, text => "Password");
1865 $table->add_at (1, 5, new DC::UI::Entry 1910 $table->add_at (1, 1, my $pw1 = new DC::UI::Entry
1866 text => $PROFILE->{password}, 1911 text => $PROFILE->{password} ? $nullpw : "",
1867 hidden => 1, 1912 hidden => 1,
1868 tooltip => "The password for your character.", 1913 tooltip => "The password for your character.",
1869 on_changed => sub { my ($self, $value) = @_; $PROFILE->{password} = $value; 1 } 1914 on_focus_in => sub {
1915 my ($self) = @_;
1916 $self->set_text ("")
1917 if $self->{text} eq $nullpw;
1918 0
1919 },
1920 on_changed => sub {
1921 my ($self, $value) = @_;
1922 $PROFILE->{password} = unpack "H*", Deliantra::Util::hash_pw $value
1923 if length $value && $value ne $nullpw;
1924 1
1925 },
1870 ); 1926 );
1871 1927
1872 $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button 1928 $table->add_at (1, 2, $LOGIN_BUTTON = new DC::UI::Button
1873 expand => 1, 1929 expand => 1,
1874 text => "Login / Register", 1930 text => "Login to Existing Account",
1875 tooltip => "This button will either login to the account configured above or register a new account.", 1931 tooltip => "This button will login to the account given by the <b>Username</b> and <b>Password</b> fields above.",
1876 on_activate => sub { 1932 on_activate => sub {
1877 $CONN ? stop_game 1933 $CONN ? stop_game
1878 : start_game; 1934 : start_game 0;
1879 1 1935 1
1880 }, 1936 },
1881 ); 1937 );
1882 1938
1939 $table->add_at (0, 3, new DC::UI::Label align => 1, text => "Password");
1940 $table->add_at (1, 3, my $pw2 = new DC::UI::Entry
1941 hidden => 1,
1942 tooltip => "The new password for your character",
1943 );
1944
1945 $table->add_at (1, 4, new DC::UI::Button
1946 expand => 1,
1947 text => "Create New Account",
1948 tooltip => "This button will try to create a new account - you need to fill out the <b>Username</b> and the two <b>Password</b> fields above, using the same password for both <b>Password</b> fields.",
1949 on_activate => sub {
1950 if ($pw1->{text} ne $pw2->{text}) {
1951 $LOGIN_ERROR->{fg} = [1, 0, 0];
1952 $LOGIN_ERROR->set_text ("The passwords do not match - try to enter them again.");
1953 } else {
1954 $CONN or start_game 1;
1955 }
1956 1
1957 },
1958 );
1959
1960 $vbox->add (new DC::UI::FancyFrame
1961 label => "Server Message",
1962 tooltip => "The last message, or error, from the server.",
1963 child => ($LOGIN_ERROR = new DC::UI::Label valign => 0, ellipsise => 0),
1964 );
1965
1883 $vbox->add (new DC::UI::FancyFrame 1966 $vbox->add (new DC::UI::FancyFrame
1884 label => "How to Play", 1967 label => "How to Play",
1885 min_h => 240, 1968 min_h => 240,#d# should not be necessary - widget bug
1886 child => (new DC::UI::Label valign => 0, ellipsise => 0, 1969 child => (new DC::UI::Label valign => 0, ellipsise => 0,
1887 markup => 1970 markup =>
1888 "First select a suitable video resolution in the <b>Graphics</b> tab, above.\n\n" 1971 "First select a suitable video resolution in the <b>Graphics</b> tab, above.\n\n"
1889 . "Then register a new account (or use an existing one if you have one). " 1972 . "Then create a new account (or use an existing one if you have one).\n\n"
1890 . "To register an account, choose a username that hasn't been taken yet (just guess) and " 1973 . "To create an account, choose a username that hasn't been taken yet (just guess) and "
1891 . "try to log-in. Follow the instructions in the Log tab in the message window.", 1974 . "fill out the top two <b>Password</b> fields using the same password, then press <b>Create New Account</b>.",
1892 ), 1975 ),
1893 ); 1976 );
1894 1977
1895 $vbox 1978 $vbox
1896} 1979}
1947 $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Output-Rate"); 2030 $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Output-Rate");
1948 $table->add_at (1, $row, new DC::UI::Entry 2031 $table->add_at (1, $row, new DC::UI::Entry
1949 text => $CFG->{output_rate}, 2032 text => $CFG->{output_rate},
1950 tooltip => "The maximum bandwidth in bytes per second that the server should not exceed " 2033 tooltip => "The maximum bandwidth in bytes per second that the server should not exceed "
1951 . "when sending data. When 0 or unset, the server " 2034 . "when sending data. When 0 or unset, the server "
1952 . "default will be used, which is usually around 100kb/s. Most servers will " 2035 . "default will be used, which is usually around 100kB/s. Most servers will "
1953 . "dynamically find an optimal rate, so adjust this only when necessary.", 2036 . "dynamically find an optimal rate, so adjust this only when necessary.",
1954 on_changed => sub { $CFG->{output_rate} = $_[1]; 1 }, 2037 on_changed => sub { $CFG->{output_rate} = $_[1]; 1 },
1955 ); 2038 );
1956 2039
1957 $vbox->add (new DC::UI::FancyFrame 2040 $vbox->add (new DC::UI::FancyFrame
2514 make_playerbook; 2597 make_playerbook;
2515 2598
2516 $MENUPOPUP = DC::UI::Menu->new (items => [ 2599 $MENUPOPUP = DC::UI::Menu->new (items => [
2517 ["Setup…\tF9" , sub { $SETUP_DIALOG->toggle_visibility }], 2600 ["Setup…\tF9" , sub { $SETUP_DIALOG->toggle_visibility }],
2518 ["Playerbook…\tTab" , sub { $PL_WINDOW ->toggle_visibility }], 2601 ["Playerbook…\tTab" , sub { $PL_WINDOW ->toggle_visibility }],
2519 ["…Statistics\tF2" , sub { toggle_player_page ($::STATS_PAGE) }], 2602 ["…Statistics\tF2" , sub { toggle_player_page ($::STATS_PAGE) }],
2520 ["…Skills\tF3" , sub { toggle_player_page ($::SKILL_PAGE) }], 2603 ["…Skills\tF3" , sub { toggle_player_page ($::SKILL_PAGE) }],
2521 ["…Spells\tF4" , sub { toggle_player_page ($::SPELL_PAGE) }], 2604 ["…Spells\tF4" , sub { toggle_player_page ($::SPELL_PAGE) }],
2522 ["…Inventory\tF5" , sub { toggle_player_page ($::INVENTORY_PAGE) }], 2605 ["…Inventory\tF5" , sub { toggle_player_page ($::INVENTORY_PAGE) }],
2523 ["Help Browser…\tF1" , sub { $HELP_WINDOW ->toggle_visibility }], 2606 ["Help Browser…\tF1" , sub { $HELP_WINDOW ->toggle_visibility }],
2524 ["Quit…" , sub { 2607 ["Quit…" , sub {
2525 if ($CONN) { 2608 if ($CONN) {
2526 open_quit_dialog; 2609 open_quit_dialog;
2527 } else { 2610 } else {
2528 EV::unloop EV::UNLOOP_ALL; 2611 EV::break EV::BREAK_ALL;
2529 } 2612 }
2530 }], 2613 }],
2531 ]); 2614 ]);
2532 2615
2533 $BUTTONBAR->add (new DC::UI::Button text => "Menu…", 2616 $BUTTONBAR->add (new DC::UI::Button text => "Menu…",
2660 DC::set_theme $CFG->{uitheme}; 2743 DC::set_theme $CFG->{uitheme};
2661 2744
2662 DC::SDL_InitSubSystem DC::SDL_INIT_VIDEO if $SDL_REINIT; 2745 DC::SDL_InitSubSystem DC::SDL_INIT_VIDEO if $SDL_REINIT;
2663 $SDL_REINIT = 0; 2746 $SDL_REINIT = 0;
2664 2747
2665 @SDL_MODES = DC::SDL_ListModes 8, $CFG->{disable_alpha} ? 0 : 8; 2748 @SDL_MODES = DC::SDL_ListModes 8, $CFG->{disable_alpha} ? 0 : 2;
2666 @SDL_MODES = DC::SDL_ListModes 8, 8 unless @SDL_MODES; 2749 @SDL_MODES = DC::SDL_ListModes 8, 8 unless @SDL_MODES;
2667 @SDL_MODES = DC::SDL_ListModes 5, 0 unless @SDL_MODES; 2750 @SDL_MODES = DC::SDL_ListModes 5, 0 unless @SDL_MODES;
2668 @SDL_MODES or DC::fatal "Unable to find a usable video mode\n(hardware accelerated opengl fullscreen)"; 2751 @SDL_MODES or DC::fatal "Unable to find a usable video mode\n(hardware accelerated opengl fullscreen)";
2669 2752
2670 @SDL_MODES = sort { $a->[0] * $a->[1] <=> $b->[0] * $b->[1] } @SDL_MODES; 2753 @SDL_MODES = sort { $a->[0] * $a->[1] <=> $b->[0] * $b->[1] } @SDL_MODES;
2904 delete $animate_object{$widget}; 2987 delete $animate_object{$widget};
2905} 2988}
2906 2989
2907$SDL_CB[DC::SDL_QUIT] = sub { 2990$SDL_CB[DC::SDL_QUIT] = sub {
2908 crash "SDL_QUIT"; 2991 crash "SDL_QUIT";
2909 EV::unloop EV::UNLOOP_ALL; 2992 EV::break EV::BREAK_ALL;
2910}; 2993};
2911$SDL_CB[DC::SDL_VIDEORESIZE] = sub { }; 2994$SDL_CB[DC::SDL_VIDEORESIZE] = sub { };
2912$SDL_CB[DC::SDL_VIDEOEXPOSE] = sub { 2995$SDL_CB[DC::SDL_VIDEOEXPOSE] = sub {
2913 DC::UI::full_refresh; 2996 DC::UI::full_refresh;
2914}; 2997};
2947}; 3030};
2948 3031
2949############################################################################# 3032#############################################################################
2950 3033
2951$SIG{INT} = $SIG{TERM} = sub { 3034$SIG{INT} = $SIG{TERM} = sub {
2952 EV::unloop; 3035 EV::break;
2953 #d# TODO calling exit here hangs the process in some futex 3036 #d# TODO calling exit here hangs the process in some futex
2954}; 3037};
2955 3038
2956# due to mac os x + sdl combined braindamage, we need this contortion 3039# due to mac os x + sdl combined braindamage, we need this contortion
2957sub DC::Main::run { 3040sub DC::Main::run {
2999 3082
3000 $CFG->{profile}{$profile} ||= {}; 3083 $CFG->{profile}{$profile} ||= {};
3001 $PROFILE = $CFG->{profile}{$profile}; 3084 $PROFILE = $CFG->{profile}{$profile};
3002 $PROFILE->{host} ||= "gameserver.deliantra.net"; 3085 $PROFILE->{host} ||= "gameserver.deliantra.net";
3003 3086
3004 $PROFILE->{host} = $args[0] if @args > 0; 3087 $PROFILE->{host} = $args[0] if @args > 0;
3005 $PROFILE->{user} = $args[1] if @args > 1; 3088 $PROFILE->{user} = $args[1] if @args > 1;
3006 $PROFILE->{password} = $args[2] if @args > 2; 3089 $PROFILE->{password} = unpack "H*", Deliantra::Util::hash_pw $args[2] if @args > 2;
3007 3090
3008 # convert old bindings (only default profile matters) 3091 # convert old bindings (only default profile matters)
3009 if (my $bindings = delete $PROFILE->{bindings}) { 3092 if (my $bindings = delete $PROFILE->{bindings}) {
3010 while (my ($mod, $syms) = each %$bindings) { 3093 while (my ($mod, $syms) = each %$bindings) {
3011 while (my ($sym, $cmds) = each %$syms) { 3094 while (my ($sym, $cmds) = each %$syms) {
3074 }; 3157 };
3075 3158
3076 debug_toggle 0; 3159 debug_toggle 0;
3077 3160
3078 delete $SIG{__DIE__}; 3161 delete $SIG{__DIE__};
3079 EV::loop; 3162 EV::run;
3080 3163
3081 DC::save_cfg if $CFG->{config_autosave}; 3164 DC::save_cfg if $CFG->{config_autosave};
3082 3165
3083 #video_shutdown; 3166 #video_shutdown;
3084 #audio_shutdown; 3167 #audio_shutdown;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines