--- deliantra/Deliantra-Client/DC/Main.pm 2011/12/27 07:23:33 1.1 +++ deliantra/Deliantra-Client/DC/Main.pm 2011/12/30 04:15:32 1.4 @@ -19,6 +19,7 @@ use common::sense; use Carp 'verbose'; +use Cwd (); use EV; BEGIN { *time = \&EV::time } @@ -42,7 +43,15 @@ BEGIN { $SIG{__DIE__} = sub { - return if $^S; + return if $^S; # quick reject + + # return if there are any eval contexts in the csall stack + for my $i (0..999) { + my ($sub, $is_require) = (caller $i)[3, 7] + or last; + return if $sub eq "(eval)" && !$is_require; + } + crash "CRASH/DIE: $_[0]" => 1; DC::fatal Carp::longmess "$_[0]"; } @@ -1133,7 +1142,7 @@ tooltip => "You can override the audio driver to use here. Leaving it empty will result " . "in Deliantra picking one automatically. GNU/Linux users often prefer specific " . "drivers though, and can experiment with alsa, dsp, esd, pulse, arts, nas " - . "or other system-specific drivers. Selecting the wrong driver here will simply result" + . "or other system-specific drivers. Selecting the wrong driver here will simply result " . "in no sound.", on_changed => sub { my ($self, $value) = @_; $CFG->{audio_driver} = $value; 1 } ); @@ -1775,59 +1784,83 @@ } sub client_setup { - my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]; + my $vbox = new DC::UI::VBox; - my $row = 0; + $vbox->add (my $top = new DC::UI::FancyFrame expand => 1, label => "Client Settings"); + $vbox->add (my $bot = new DC::UI::FancyFrame expand => 1, label => "Client Info"); - $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Tip of the day"); - $table->add_at (1, $row++, new DC::UI::CheckBox - c_colspan => 2, - state => $CFG->{show_tips}, - tooltip => "Show the Tip of the day window at startup?", - on_changed => sub { - my ($self, $value) = @_; - $CFG->{show_tips} = $value; - 0 - } - ); + { + $top->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]); - $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Window Size"); - $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry - c_colspan => 2, - text => $CFG->{logview_max_par}, - tooltip => "This is maximum number of messages remembered in the Message window. If the server " - . "sends more messages than this number, older messages get removed to save memory and " - . "computing time. A value of 0 disables this feature, but that is not recommended.", - on_changed => sub { - my ($self, $value) = @_; - $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1); - 0 - }, - ); + my $row = 0; - $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Config Autosave"); - $table->add_at (1, $row, new DC::UI::CheckBox - state => $CFG->{config_autosave}, - tooltip => "Normally, configuration settings and the user interface layout " - . "are saved on client exit. You can disable this behaviour by " - . "unchecking this checkbox.", - on_changed => sub { - my ($self, $value) = @_; - $CFG->{config_autosave} = $value; - 0 - } - ); - $table->add_at (2, $row++, new DC::UI::Button - text => "Save Now", - tooltip => "Use this to manually save configuration and UI layout when " - . "autosave is disabled.", - on_activate => sub { - DC::write_cfg; - 0 - } - ); + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Tip of the day"); + $table->add_at (1, $row++, new DC::UI::CheckBox + c_colspan => 2, + state => $CFG->{show_tips}, + tooltip => "Show the Tip of the day window at startup?", + on_changed => sub { + my ($self, $value) = @_; + $CFG->{show_tips} = $value; + 0 + } + ); - $table + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Window Size"); + $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry + c_colspan => 2, + text => $CFG->{logview_max_par}, + tooltip => "This is maximum number of messages remembered in the Message window. If the server " + . "sends more messages than this number, older messages get removed to save memory and " + . "computing time. A value of 0 disables this feature, but that is not recommended.", + on_changed => sub { + my ($self, $value) = @_; + $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1); + 0 + }, + ); + + $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Config Autosave"); + $table->add_at (1, $row, new DC::UI::CheckBox + state => $CFG->{config_autosave}, + tooltip => "Normally, configuration settings and the user interface layout " + . "are saved on client exit. You can disable this behaviour by " + . "unchecking this checkbox.", + on_changed => sub { + my ($self, $value) = @_; + $CFG->{config_autosave} = $value; + 0 + } + ); + $table->add_at (2, $row++, new DC::UI::Button + text => "Save Now", + tooltip => "Use this to manually save configuration and UI layout when " + . "autosave is disabled.", + on_activate => sub { + DC::write_cfg; + 0 + } + ); + } + + { + $bot->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]); + + my $row = 0; + + $table->add_at (0, $row , new DC::UI::Label align => 1, text => "Data Directory"); + $table->add_at (1, $row++, new DC::UI::Label align => 0, text => $Deliantra::VARDIR, tooltip => ""); + $table->add_at (0, $row , new DC::UI::Label align => 1, text => "Database Directory"); + $table->add_at (1, $row++, new DC::UI::Label align => 0, text => $DC::DB::DBDIR, tooltip => ""); + $table->add_at (0, $row , new DC::UI::Label align => 1, text => "Branch (Prebuilt)"); + $table->add_at (1, $row++, new DC::UI::Label align => 0, text => $::EXE_ID, tooltip => ""); + $table->add_at (0, $row , new DC::UI::Label align => 1, text => "Version (Prebuilt)"); + $table->add_at (1, $row++, new DC::UI::Label align => 0, text => $::EXE_VER, tooltip => ""); + $table->add_at (0, $row , new DC::UI::Label align => 1, text => "Update (Prebuilt)"); + $table->add_at (1, $row++, new DC::UI::Label align => 0, text => $::UPDPAR, tooltip => ""); + } + + $vbox } sub autopickup_setup { @@ -2634,7 +2667,7 @@ $NOW = EV::now; ($SDL_CB[$_->{type}] || sub { warn "unhandled event $_->{type}" })->($_) - for DC::poll_events; + for DC::peep_events; if (%animate_object) { $_->animate ($LAST_REFRESH - $NOW) for values %animate_object; @@ -2816,8 +2849,11 @@ } } - $ENV{FONTCONFIG_FILE} = DC::find_rcfile "fonts/fonts.conf"; - $ENV{FONTCONFIG_DIR} = DC::find_rcfile "fonts"; + # fontconfig doesn't support relative paths anymore, so use abs_path and keep fingers crossed + # these are ignored under windows, for some reason, and thus set in the loader + $ENV{FONTCONFIG_FILE} = "fonts.conf"; + $ENV{FONTCONFIG_PATH} = Cwd::abs_path DC::find_rcfile "fonts"; + $ENV{FONTCONFIG_DIR} = $ENV{FONTCONFIG_PATH}; # helps with older versions { my @fonts = map DC::find_rcfile "fonts/$_", qw(