ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC.pm (file contents):
Revision 1.140 by root, Fri Apr 6 07:45:33 2007 UTC vs.
Revision 1.165 by root, Tue Dec 25 19:23:11 2007 UTC

15package CFPlus; 15package CFPlus;
16 16
17use Carp (); 17use Carp ();
18 18
19BEGIN { 19BEGIN {
20 $VERSION = '0.97'; 20 $VERSION = '0.9961';
21 21
22 use XSLoader; 22 use XSLoader;
23 XSLoader::load "CFPlus", $VERSION; 23 XSLoader::load "CFPlus", $VERSION;
24} 24}
25 25
27 27
28use AnyEvent (); 28use AnyEvent ();
29use Pod::POM (); 29use Pod::POM ();
30use File::Path (); 30use File::Path ();
31use Storable (); # finally 31use Storable (); # finally
32 32use Fcntl ();
33BEGIN { 33use JSON::XS qw(encode_json decode_json);
34 use Crossfire::Protocol::Base ();
35 *to_json = \&Crossfire::Protocol::Base::to_json;
36 *from_json = \&Crossfire::Protocol::Base::from_json;
37}
38 34
39=item guard { BLOCK } 35=item guard { BLOCK }
40 36
41Returns an object that executes the given block as soon as it is destroyed. 37Returns an object that executes the given block as soon as it is destroyed.
42 38
169 if ($CFG =~ /^---/) { ## TODO compatibility cruft, remove 165 if ($CFG =~ /^---/) { ## TODO compatibility cruft, remove
170 require YAML; 166 require YAML;
171 utf8::decode $CFG; 167 utf8::decode $CFG;
172 $::CFG = YAML::Load ($CFG); 168 $::CFG = YAML::Load ($CFG);
173 } elsif ($CFG =~ /^\{/) { 169 } elsif ($CFG =~ /^\{/) {
174 $::CFG = from_json $CFG; 170 $::CFG = decode_json $CFG;
175 } else { 171 } else {
176 $::CFG = eval $CFG; ## todo comaptibility cruft 172 $::CFG = eval $CFG; ## todo comaptibility cruft
177 } 173 }
178} 174}
179 175
182 178
183 $::CFG->{VERSION} = $::VERSION; 179 $::CFG->{VERSION} = $::VERSION;
184 180
185 open my $fh, ">:utf8", $file 181 open my $fh, ">:utf8", $file
186 or return; 182 or return;
187 print $fh to_json $::CFG; 183 print $fh encode_json $::CFG;
188} 184}
189 185
190sub http_proxy { 186sub http_proxy {
191 my @proxy = win32_proxy_info; 187 my @proxy = win32_proxy_info;
192 188
226 and die $res->status_line; 222 and die $res->status_line;
227 223
228 $res 224 $res
229} 225}
230 226
227sub fh_nonblocking($$) {
228 my ($fh, $nb) = @_;
229
230 if ($^O eq "MSWin32") {
231 $nb = (! ! $nb) + 0;
232 ioctl $fh, 0x8004667e, \$nb; # FIONBIO
233 } else {
234 fcntl $fh, &Fcntl::F_SETFL, $nb ? &Fcntl::O_NONBLOCK : 0;
235 }
236
237}
238
231package CFPlus::Layout; 239package CFPlus::Layout;
232 240
241$CFPlus::OpenGL::INIT_HOOK{"CFPlus::Layout"} = sub {
242 glyph_cache_restore;
243};
244
233$CFPlus::OpenGL::SHUTDOWN_HOOK{"CFPlus::Layout"} = sub { 245$CFPlus::OpenGL::SHUTDOWN_HOOK{"CFPlus::Layout"} = sub {
234 reset_glyph_cache; 246 glyph_cache_backup;
235}; 247};
236 248
2371; 2491;
238 250
239=back 251=back

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines