… | |
… | |
57 | |
57 | |
58 | %{$self->{completer}{command}} = (); |
58 | %{$self->{completer}{command}} = (); |
59 | |
59 | |
60 | $self->{completer}->hide |
60 | $self->{completer}->hide |
61 | if $self->{completer}; |
61 | if $self->{completer}; |
|
|
62 | } |
|
|
63 | |
|
|
64 | sub test_server_login { |
|
|
65 | return unless |
|
|
66 | $::CONN && length $::CONN->{test_server}; |
|
|
67 | |
|
|
68 | my $server = $::CONN->{test_server}; |
|
|
69 | ::stop_game (); |
|
|
70 | local $::PROFILE->{host} = $server; |
|
|
71 | ::start_game (); |
|
|
72 | } |
|
|
73 | |
|
|
74 | sub editor_invoke { |
|
|
75 | return unless $::CONN; |
|
|
76 | |
|
|
77 | # putting the password into the env is somewhat tasteless |
|
|
78 | local $ENV{CFPLUS_LOGIN} = $::PROFILE->{user}; |
|
|
79 | local $ENV{CFPLUS_PASSWORD} = $::PROFILE->{password}; |
|
|
80 | local $ENV{CFPLUS_UPLOAD} = $::CONN->{upload}; |
|
|
81 | local $ENV{CROSSFIRE_MAPDIR} = $::CONN->{cvs_root}; |
|
|
82 | |
|
|
83 | # CFPlus::set_proxy; |
|
|
84 | |
|
|
85 | # TODO: move into editor |
|
|
86 | require LWP::Simple; |
62 | } |
87 | } |
63 | |
88 | |
64 | sub invoke_button_down { |
89 | sub invoke_button_down { |
65 | my ($self, $ev, $x, $y) = @_; |
90 | my ($self, $ev, $x, $y) = @_; |
66 | |
91 | |
… | |
… | |
108 | $::PICKUP_ENABLE->{state} |
133 | $::PICKUP_ENABLE->{state} |
109 | ? "Disable automatic pickup" |
134 | ? "Disable automatic pickup" |
110 | : "Enable automatic pickup", |
135 | : "Enable automatic pickup", |
111 | sub { $::PICKUP_ENABLE->toggle } |
136 | sub { $::PICKUP_ENABLE->toggle } |
112 | ], |
137 | ], |
|
|
138 | $::CONN && length $::CONN->{cvs_root} |
|
|
139 | ? ["Edit this map <span size='xx-small'>(" . (CFPlus::asxml $::CONN->{map_info}[0]) . ")</span>", \&editor_invoke] |
|
|
140 | : (), |
|
|
141 | $::CONN && length $::CONN->{test_server} |
|
|
142 | ? ["Login on Test Server", \&test_server_login] |
|
|
143 | : (), |
113 | ["Quit", |
144 | ["Quit", |
114 | sub { |
145 | sub { |
115 | if ($::CONN) { |
146 | if ($::CONN) { |
116 | &::open_quit_dialog; |
147 | &::open_quit_dialog; |
117 | } else { |
148 | } else { |
… | |
… | |
224 | } elsif ($uni == 13) { |
255 | } elsif ($uni == 13) { |
225 | $::CONN->user_send ("examine"); |
256 | $::CONN->user_send ("examine"); |
226 | } elsif ($uni == ord ".") { |
257 | } elsif ($uni == ord ".") { |
227 | $::CONN->user_send ($self->{completer}{last_command}) |
258 | $::CONN->user_send ($self->{completer}{last_command}) |
228 | if exists $self->{completer}{last_command}; |
259 | if exists $self->{completer}{last_command}; |
229 | } elsif (my $bind_cmd = $::CFG->{profile}{default}{bindings}{$mod}{$sym}) { |
260 | } elsif (my $bind_cmd = $::PROFILE->{bindings}{$mod}{$sym}) { |
230 | $::CONN->user_send ($_) for @$bind_cmd; |
261 | $::CONN->user_send ($_) for @$bind_cmd; |
231 | } elsif (($sym == CFPlus::SDLK_KP_PLUS && !$mod) || $uni == ord "+") { |
262 | } elsif (($sym == CFPlus::SDLK_KP_PLUS && !$mod) || $uni == ord "+") { |
232 | $::CONN->user_send ("rotateshoottype +"); |
263 | $::CONN->user_send ("rotateshoottype +"); |
233 | } elsif (($sym == CFPlus::SDLK_KP_MINUS && !$mod) || $uni == ord "-") { |
264 | } elsif (($sym == CFPlus::SDLK_KP_MINUS && !$mod) || $uni == ord "-") { |
234 | $::CONN->user_send ("rotateshoottype -"); |
265 | $::CONN->user_send ("rotateshoottype -"); |