--- deliantra/Deliantra-Client/DC/MapWidget.pm 2006/09/29 00:56:06 1.82 +++ deliantra/Deliantra-Client/DC/MapWidget.pm 2006/10/01 14:48:51 1.83 @@ -61,6 +61,31 @@ if $self->{completer}; } +sub test_server_login { + return unless + $::CONN && length $::CONN->{test_server}; + + my $server = $::CONN->{test_server}; + ::stop_game (); + local $::PROFILE->{host} = $server; + ::start_game (); +} + +sub editor_invoke { + return unless $::CONN; + + # putting the password into the env is somewhat tasteless + local $ENV{CFPLUS_LOGIN} = $::PROFILE->{user}; + local $ENV{CFPLUS_PASSWORD} = $::PROFILE->{password}; + local $ENV{CFPLUS_UPLOAD} = $::CONN->{upload}; + local $ENV{CROSSFIRE_MAPDIR} = $::CONN->{cvs_root}; + +# CFPlus::set_proxy; + + # TODO: move into editor + require LWP::Simple; +} + sub invoke_button_down { my ($self, $ev, $x, $y) = @_; @@ -110,6 +135,12 @@ : "Enable automatic pickup", sub { $::PICKUP_ENABLE->toggle } ], + $::CONN && length $::CONN->{cvs_root} + ? ["Edit this map (" . (CFPlus::asxml $::CONN->{map_info}[0]) . ")", \&editor_invoke] + : (), + $::CONN && length $::CONN->{test_server} + ? ["Login on Test Server", \&test_server_login] + : (), ["Quit", sub { if ($::CONN) { @@ -226,7 +257,7 @@ } elsif ($uni == ord ".") { $::CONN->user_send ($self->{completer}{last_command}) if exists $self->{completer}{last_command}; - } elsif (my $bind_cmd = $::CFG->{profile}{default}{bindings}{$mod}{$sym}) { + } elsif (my $bind_cmd = $::PROFILE->{bindings}{$mod}{$sym}) { $::CONN->user_send ($_) for @$bind_cmd; } elsif (($sym == CFPlus::SDLK_KP_PLUS && !$mod) || $uni == ord "+") { $::CONN->user_send ("rotateshoottype +");