--- deliantra/Deliantra-Client/bin/deliantra 2010/03/20 00:50:06 1.102 +++ deliantra/Deliantra-Client/bin/deliantra 2010/03/20 01:01:16 1.103 @@ -1675,17 +1675,17 @@ $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username"); $table->add_at (1, 4, new DC::UI::Entry - text => $CFG->{profile}{default}{user}, + text => $PROFILE->{user}, tooltip => "The name of your character on the server. The name is case-sensitive!", - on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 } + on_changed => sub { my ($self, $value) = @_; $PROFILE->{user} = $value; 1 } ); $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password"); $table->add_at (1, 5, new DC::UI::Entry - text => $CFG->{profile}{default}{password}, + text => $PROFILE->{password}, hidden => 1, tooltip => "The password for your character.", - on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 } + on_changed => sub { my ($self, $value) = @_; $PROFILE->{password} = $value; 1 } ); $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button @@ -1731,11 +1731,11 @@ $vbox->add ( $HOST_ENTRY = new DC::UI::Entry expand => 1, - text => $CFG->{profile}{default}{host}, + text => $PROFILE->{host}, tooltip => "The hostname or ip address of the Deliantra server to connect to (e.g. gameserver.deliantra.net)", on_changed => sub { my ($self, $value) = @_; - $CFG->{profile}{default}{host} = $value; + $PROFILE->{host} = $value; 1 } ); @@ -2783,12 +2783,25 @@ $CFG->{$k} = $v unless exists $CFG->{$k}; } - $CFG->{profile}{default}{host} ||= "gameserver.deliantra.net"; - $PROFILE = $CFG->{profile}{default}; + my @args = @ARGV; - $PROFILE->{host} = $ARGV[0] if @ARGV > 0; - $PROFILE->{user} = $ARGV[1] if @ARGV > 1; - $PROFILE->{password} = $ARGV[2] if @ARGV > 2; + my $profile = 'default'; + + for (my $i = 0; $i < @args; $i++) { + if ($args[$i] eq '-profile') { + $profile = $args[$i + 1]; + splice @args, $i, 2, (); + $i = 0; + } + } + + $CFG->{profile}{$profile} ||= {}; + $PROFILE = $CFG->{profile}{$profile}; + $PROFILE->{host} ||= "gameserver.deliantra.net"; + + $PROFILE->{host} = $args[0] if @args > 0; + $PROFILE->{user} = $args[1] if @args > 1; + $PROFILE->{password} = $args[2] if @args > 2; # convert old bindings (only default profile matters) if (my $bindings = delete $PROFILE->{bindings}) {