--- deliantra/Deliantra-Client/bin/cfplus 2006/12/09 02:21:25 1.137 +++ deliantra/Deliantra-Client/bin/cfplus 2007/03/16 02:33:50 1.143 @@ -70,7 +70,7 @@ $SIG{QUIT} = sub { Carp::cluck "QUIT" }; $SIG{PIPE} = 'IGNORE'; -$Event::Eval = 0; +$Event::Eval = 1; $Event::DIED = sub { CFPlus::fatal Carp::longmess $_[1] }; @@ -178,10 +178,28 @@ if $_[0]{query_dialog}; } +# FIXME: a very ugly hack to wait for stat update look below! #d# +our $QUERY_TIMER; #d# + # server query dialog sub server_query { my ($conn, $flags, $prompt) = @_; + # FIXME: a very ugly hack to wait for stat update #d# + if ($prompt =~ /roll new stats/ and not $conn->{stat_change_with}) { + unless ($QUERY_TIMER) { + $QUERY_TIMER = + Event->timer ( + after => 1, + cb => sub { + server_query ($conn, $flags, $prompt, 1); + $QUERY_TIMER = undef + } + ); + return; + } + } + $conn->{query_dialog} = my $dialog = new CFPlus::UI::Toplevel x => "center", y => "center", @@ -889,15 +907,9 @@ my @align = qw(1 0 1 1 -1); my $y = 0; - for my $m ( - sort { - $b->{version} <=> $a->{version} - or $b->{users} <=> $a->{users} - } - @{ $msg->{servers} } - ) { - my ($ip, $last, $host, $users, $version, $desc, $ibytes, $obytes, $uptime) = - @$m{qw(ip age hostname users version description ibytes obytes uptime)}; + for my $m (@{ $msg->{servers} }) { + my ($ip, $last, $host, $users, $version, $desc, $ibytes, $obytes, $uptime, $highlight) = + @$m{qw(ip age hostname users version description ibytes obytes uptime highlight)}; for ($desc) { s/
/\n/gi; @@ -937,7 +949,7 @@ align => $align[$_], text => $m->[$_], tooltip => $tip[$_], - fg => ($m->[3] =~ /\+$/ ? [1, 1, 1] : [.7, .7, .7]), + fg => ($highlight ? [1, 1, 1] : [.7, .7, .7]), can_hover => 1, can_events => 1, fontsize => 0.8) @@ -1048,21 +1060,30 @@ on_changed => sub { $CFG->{face_prefetch} = $_[1]; 0 }, ); - $table->add (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Count"); + $table->add (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Rate"); $table->add (1, 9, new CFPlus::UI::Entry + text => $CFG->{output_rate}, + tooltip => "The approximate bandwidth in bytes per second that the server should not exceed " + . "when sending images, to ensure interactiveness. When 0 or unset, the server " + . "default will be used, which is usually around 100kb/s.", + on_changed => sub { $CFG->{output_rate} = $_[1]; 0 }, + ); + + $table->add (0, 10, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Count"); + $table->add (1, 10, new CFPlus::UI::Entry text => $CFG->{output_count}, tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", on_changed => sub { $CFG->{output_count} = $_[1]; 0 }, ); - $table->add (0, 10, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Sync"); - $table->add (1, 10, new CFPlus::UI::Entry + $table->add (0, 11, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Sync"); + $table->add (1, 11, new CFPlus::UI::Entry text => $CFG->{output_sync}, tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", on_changed => sub { $CFG->{output_sync} = $_[1]; 0 }, ); - $table->add (1, 11, $LOGIN_BUTTON = new CFPlus::UI::Button + $table->add (1, 12, $LOGIN_BUTTON = new CFPlus::UI::Button expand => 1, align => 0, text => "Login", @@ -1073,8 +1094,8 @@ }, ); - $table->add (0, 12, new CFPlus::UI::Label valign => 0, align => 1, text => "Chat Command"); - $table->add (1, 12, my $saycmd = new CFPlus::UI::Entry + $table->add (0, 13, new CFPlus::UI::Label valign => 0, align => 1, text => "Chat Command"); + $table->add (1, 13, my $saycmd = new CFPlus::UI::Entry text => $CFG->{say_command}, tooltip => "This is the command that will be used if you write a line in the message window entry or press \" in the map window. " . "Usually you want to enter something like 'say' or 'shout' or 'gsay' here. " @@ -1086,8 +1107,8 @@ } ); - $table->add (0, 13, new CFPlus::UI::Label valign => 0, align => 1, text => "Tip of the day"); - $table->add (1, 13, my $saycmd = new CFPlus::UI::CheckBox + $table->add (0, 14, new CFPlus::UI::Label valign => 0, align => 1, text => "Tip of the day"); + $table->add (1, 14, my $saycmd = new CFPlus::UI::CheckBox state => $CFG->{show_tips}, tooltip => "Show the Tip of the day window at startup?", on_changed => sub { @@ -1772,6 +1793,7 @@ sub setup_build_button { my ($enabled) = @_; if ($enabled) { + $BUILD_BUTTON->hide if $BUILD_BUTTON; $BUILD_BUTTON ||= new CFPlus::UI::Button text => "Build", tooltip => "Opens the ingame builder", @@ -2082,6 +2104,7 @@ face_prefetch => 0, output_sync => 1, output_count => 1, + output_rate => "", pickup => 0, inv_sort => "mtime", default => "profile", # default profile @@ -2160,7 +2183,6 @@ show_tip_of_the_day if $CFG->{show_tips}; -#CFPlus::Macro::quick_macro ["test"];#d# Event::loop; #CFPlus::SDL_Quit; #CFPlus::_exit 0;