--- deliantra/Deliantra-Client/bin/cfplus 2006/06/18 17:13:12 1.74 +++ deliantra/Deliantra-Client/bin/cfplus 2006/06/18 17:23:36 1.75 @@ -326,7 +326,7 @@ my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; - my ($host, $port) = split /:/, $CFG->{host}; + my ($host, $port) = split /:/, $CFG->{profile}{default}{host}; $MAP = new CFClient::Map $mapsize, $mapsize; @@ -334,8 +334,8 @@ new CFClient::Protocol host => $host, port => $port || 13327, - user => $CFG->{user}, - pass => $CFG->{password}, + user => $CFG->{profile}{default}{user}, + pass => $CFG->{profile}{default}{password}, mapw => $mapsize, maph => $mapsize, @@ -914,7 +914,7 @@ text => "Use", tooltip => "Put this server into the Host:Port field", on_activate => sub { - $HOST_ENTRY->set_text ($CFG->{host} = $host); + $HOST_ENTRY->set_text ($CFG->{profile}{default}{host} = $host); $METASERVER->hide; 0 }, @@ -970,11 +970,11 @@ $vbox->add ( $HOST_ENTRY = new CFClient::UI::Entry expand => 1, - text => $CFG->{host}, + text => $CFG->{profile}{default}{host}, tooltip => "The hostname or ip address of the Crossfire(+) server to connect to", on_changed => sub { my ($self, $value) = @_; - $CFG->{host} = $value; + $CFG->{profile}{default}{host} = $value; 0 } ); @@ -993,17 +993,17 @@ $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); $table->add (1, 4, new CFClient::UI::Entry - text => $CFG->{user}, + text => $CFG->{profile}{default}{user}, tooltip => "The name of your character on the server", - on_changed => sub { my ($self, $value) = @_; $CFG->{user} = $value; 0 } + on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value } ); $table->add (0, 5, new CFClient::UI::Label valign => 0, align => 1, text => "Password"); $table->add (1, 5, new CFClient::UI::Entry - text => $CFG->{password}, + text => $CFG->{profile}{default}{password}, hidden => 1, tooltip => "The password for your character", - on_changed => sub { my ($self, $value) = @_; $CFG->{password} = $value; 0 } + on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value } ); $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); @@ -1308,9 +1308,9 @@ $refresh = sub { $binding_list->clear (); - for my $mod (keys %{$::CFG->{bindings}}) { - for my $sym (keys %{$::CFG->{bindings}->{$mod}}) { - my $cmds = $::CFG->{bindings}->{$mod}->{$sym}; + for my $mod (keys %{$::CFG->{profile}{default}{bindings}}) { + for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { + my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; next unless ref $cmds eq 'ARRAY' and @$cmds > 0; my $lbl = join "; ", @$cmds; @@ -1321,7 +1321,7 @@ tooltip => "Deletes the binding", on_activate => sub { $binding_list->remove ($hb); - delete $::CFG->{bindings}->{$mod}->{$sym}; + delete $::CFG->{profile}{default}{bindings}{$mod}{$sym}; 0 }); @@ -1330,11 +1330,11 @@ tooltip => "Edits the binding", on_activate => sub { $::BIND_EDITOR->set_binding ( - $mod, $sym, $::CFG->{bindings}->{$mod}->{$sym}, + $mod, $sym, $::CFG->{profile}{default}{bindings}{$mod}{$sym}, sub { my ($nmod, $nsym, $ncmds) = @_; - delete $::CFG->{bindings}->{$mod}->{$sym}; - $::CFG->{bindings}->{$nmod}->{$nsym} = $ncmds; + delete $::CFG->{profile}{default}{bindings}{$mod}{$sym}; + $::CFG->{profile}{default}{bindings}{$nmod}{$nsym} = $ncmds; $refresh->(); $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); $SETUP_DIALOG->show; @@ -1378,7 +1378,7 @@ $::BIND_EDITOR->set_binding (undef, undef, [], sub { my ($mod, $sym, $cmds) = @_; - $::CFG->{bindings}->{$mod}->{$sym} = $cmds; + $::CFG->{profile}{default}{bindings}{$mod}{$sym} = $cmds; $refresh->(); $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); $SETUP_DIALOG->show; @@ -1577,8 +1577,8 @@ $SETUP_NOTEBOOK->add (Audio => audio_setup, "Configure the use of audio, sound effects and background music."); $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, - "Lets you define, edit and delete bindings." - . "There is a shortcut for making bindings: Left Control + Insert opens the binding editor " + "Lets you define, edit and delete key bindings." + . "There is a shortcut for making bindings: Control-Insert opens the binding editor " . "with nothing set and the recording started. After doing the actions you " . "want to record press Insert and you will be asked to press a key-combo. " . "After pressing the combo the binding will be saved automatically and the " @@ -1586,7 +1586,7 @@ $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, "Displays all spells you have and lets you edit keyboard shortcuts for them."); $SETUP_NOTEBOOK->add (Debug => debug_setup, - "Some debuggign options. Do not ask."); + "Some debuggin' options. Do not ask."); $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top @@ -1866,36 +1866,38 @@ CFClient::UI::set_layout ($::CFG->{layout}); my %DEF_CFG = ( - sdl_mode => 0, - width => 640, - height => 480, - fullscreen => 0, - fast => 0, - map_scale => 1, - fow_enable => 1, - fow_intensity => 0.45, - fow_smooth => 0, - gui_fontsize => 1, - log_fontsize => 0.7, - gauge_fontsize=> 1, - gauge_size => 0.35, - stat_fontsize => 0.7, - mapsize => 100, - host => "crossfire.schmorp.de", - say_command => 'say', - audio_enable => 1, - bgm_enable => 1, - bgm_volume => 0.25, - face_prefetch => 0, - output_sync => 1, - output_count => 1, - pickup => 0, + sdl_mode => 0, + width => 640, + height => 480, + fullscreen => 0, + fast => 0, + map_scale => 1, + fow_enable => 1, + fow_intensity => 0.45, + fow_smooth => 0, + gui_fontsize => 1, + log_fontsize => 0.7, + gauge_fontsize => 1, + gauge_size => 0.35, + stat_fontsize => 0.7, + mapsize => 100, + say_command => 'say', + audio_enable => 1, + bgm_enable => 1, + bgm_volume => 0.25, + face_prefetch => 0, + output_sync => 1, + output_count => 1, + pickup => 0, + default => "profile", # default profile ); - + while (my ($k, $v) = each %DEF_CFG) { $CFG->{$k} = $v unless exists $CFG->{$k}; } + $CFG->{profile}{default}{host} ||= "crossfire.schmorp.de"; + sdl_init; @SDL_MODES = reverse