… | |
… | |
68 | use CFPlus::Macro; |
68 | use CFPlus::Macro; |
69 | |
69 | |
70 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
70 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
71 | $SIG{PIPE} = 'IGNORE'; |
71 | $SIG{PIPE} = 'IGNORE'; |
72 | |
72 | |
73 | $Event::Eval = 0; |
73 | $Event::Eval = 1; |
74 | $Event::DIED = sub { |
74 | $Event::DIED = sub { |
75 | CFPlus::fatal Carp::longmess $_[1] |
75 | CFPlus::fatal Carp::longmess $_[1] |
76 | }; |
76 | }; |
77 | |
77 | |
78 | my $MAX_FPS = 60; |
78 | my $MAX_FPS = 60; |
… | |
… | |
176 | sub destroy_query_dialog { |
176 | sub destroy_query_dialog { |
177 | (delete $_[0]{query_dialog})->destroy |
177 | (delete $_[0]{query_dialog})->destroy |
178 | if $_[0]{query_dialog}; |
178 | if $_[0]{query_dialog}; |
179 | } |
179 | } |
180 | |
180 | |
|
|
181 | # FIXME: a very ugly hack to wait for stat update look below! #d# |
|
|
182 | our $QUERY_TIMER; #d# |
|
|
183 | |
181 | # server query dialog |
184 | # server query dialog |
182 | sub server_query { |
185 | sub server_query { |
183 | my ($conn, $flags, $prompt) = @_; |
186 | my ($conn, $flags, $prompt) = @_; |
|
|
187 | |
|
|
188 | # FIXME: a very ugly hack to wait for stat update #d# |
|
|
189 | if ($prompt =~ /roll new stats/ and not $conn->{stat_change_with}) { |
|
|
190 | unless ($QUERY_TIMER) { |
|
|
191 | $QUERY_TIMER = |
|
|
192 | Event->timer ( |
|
|
193 | after => 1, |
|
|
194 | cb => sub { |
|
|
195 | server_query ($conn, $flags, $prompt, 1); |
|
|
196 | $QUERY_TIMER = undef |
|
|
197 | } |
|
|
198 | ); |
|
|
199 | return; |
|
|
200 | } |
|
|
201 | } |
184 | |
202 | |
185 | $conn->{query_dialog} = my $dialog = new CFPlus::UI::Toplevel |
203 | $conn->{query_dialog} = my $dialog = new CFPlus::UI::Toplevel |
186 | x => "center", |
204 | x => "center", |
187 | y => "center", |
205 | y => "center", |
188 | title => "Server Query", |
206 | title => "Server Query", |
… | |
… | |
1770 | } |
1788 | } |
1771 | |
1789 | |
1772 | sub setup_build_button { |
1790 | sub setup_build_button { |
1773 | my ($enabled) = @_; |
1791 | my ($enabled) = @_; |
1774 | if ($enabled) { |
1792 | if ($enabled) { |
|
|
1793 | $BUILD_BUTTON->hide if $BUILD_BUTTON; |
1775 | $BUILD_BUTTON ||= new CFPlus::UI::Button |
1794 | $BUILD_BUTTON ||= new CFPlus::UI::Button |
1776 | text => "Build", |
1795 | text => "Build", |
1777 | tooltip => "Opens the ingame builder", |
1796 | tooltip => "Opens the ingame builder", |
1778 | on_activate => sub { |
1797 | on_activate => sub { |
1779 | if ($CONN) { |
1798 | if ($CONN) { |