… | |
… | |
12 | |
12 | |
13 | use Gtk2; |
13 | use Gtk2; |
14 | |
14 | |
15 | use Crossfire; |
15 | use Crossfire; |
16 | |
16 | |
17 | our $TILECACHE; |
|
|
18 | our %TILECACHE; |
|
|
19 | |
|
|
20 | sub init_tilecache($) { |
17 | sub init_tilecache($) { |
21 | my ($cacheprefix) = @_; |
18 | my ($cacheprefix) = @_; |
22 | |
19 | |
23 | eval { |
20 | eval { |
24 | -M "$cacheprefix.pst" < -M "$Crossfire::LIB/crossfire.0" |
21 | -M "$cacheprefix.pst" < -M "$Crossfire::LIB/crossfire.0" |
25 | && ($TILECACHE = new_from_file Gtk2::Gdk::Pixbuf "$cacheprefix.png") |
22 | && ($Crossfire::TILE = new_from_file Gtk2::Gdk::Pixbuf "$cacheprefix.png") |
26 | && (*TILECACHE = Storable::retrieve "$cacheprefix.pst") |
23 | && (*Crossfire::FACE = Storable::retrieve "$cacheprefix.pst") |
27 | } or do { |
24 | } or do { |
28 | my $tile = read_pak "$Crossfire::LIB/crossfire.0"; |
25 | my $tile = read_pak "$Crossfire::LIB/crossfire.0"; |
29 | |
26 | |
30 | my %cache; |
27 | my %cache; |
31 | |
28 | |
… | |
… | |
69 | } |
66 | } |
70 | |
67 | |
71 | $pb->save ("$cacheprefix.png", "png"); |
68 | $pb->save ("$cacheprefix.png", "png"); |
72 | Storable::nstore \%cache, "$cacheprefix.pst"; |
69 | Storable::nstore \%cache, "$cacheprefix.pst"; |
73 | |
70 | |
74 | $TILECACHE = $pb; |
71 | $Crossfire::TILE = $pb; |
75 | *TILECACHE = \%cache; |
72 | *Crossfire::FACE = \%cache; |
76 | } |
73 | } |
77 | } |
74 | } |
|
|
75 | |
|
|
76 | init_tilecache "$Crossfire::CACHEDIR/tilecache"; |
78 | |
77 | |
79 | =head1 AUTHOR |
78 | =head1 AUTHOR |
80 | |
79 | |
81 | Marc Lehmann <schmorp@schmorp.de> |
80 | Marc Lehmann <schmorp@schmorp.de> |
82 | http://home.schmorp.de/ |
81 | http://home.schmorp.de/ |