ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/map-world.ext
(Generate patch)

Comparing deliantra/server/ext/map-world.ext (file contents):
Revision 1.26 by root, Sat Apr 21 16:56:32 2007 UTC vs.
Revision 1.30 by root, Tue Sep 11 13:27:54 2007 UTC

1#! perl # OPTIONAL 1#! perl # optional
2 2
3# optional plug-in to speed up worldmap rendering by dynamically 3# optional plug-in to speed up worldmap rendering by dynamically
4# generating it out of an image 4# generating it out of an image
5# - saves loading time (less data to read) 5# - saves loading time (less data to read)
6# - saves temporary space (only overlay stuff needs to be saved) 6# - saves temporary space (only overlay stuff needs to be saved)
7# - might get reused as a generic tiled map 7# - might get reused as a generic tiled map
8
9cf::map->register (qr{^/world/world_(\d\d\d)_(\d\d\d)$}, 100);
8 10
9use Coro::Handle; 11use Coro::Handle;
10use Coro::AIO; 12use Coro::AIO;
11 13
12our $WORLD; 14our $WORLD;
91 reload; 93 reload;
92 undef $guard; 94 undef $guard;
93 }; 95 };
94}; 96};
95 97
96cf::map->register (qr{^/world/world_(\d\d\d)_(\d\d\d)$}, 100);
97
98sub wxwy { 98sub wxwy {
99 $_[0]->path =~ m{/world/world_(\d\d\d)_(\d\d\d)$} 99 $_[0]->path =~ m{/world/world_(\d\d\d)_(\d\d\d)$}
100 ? ($1, $2) 100 ? ($1, $2)
101 : (0, 0) 101 : (0, 0)
102} 102}
119 $self->tile_path (0, sprintf "/world/world_%03d_%03d", $x, $y - 1) if $y > 0; 119 $self->tile_path (0, sprintf "/world/world_%03d_%03d", $x, $y - 1) if $y > 0;
120 $self->tile_path (1, sprintf "/world/world_%03d_%03d", $x + 1, $y) if $x < 999; 120 $self->tile_path (1, sprintf "/world/world_%03d_%03d", $x + 1, $y) if $x < 999;
121 $self->tile_path (2, sprintf "/world/world_%03d_%03d", $x, $y + 1) if $y < 999; 121 $self->tile_path (2, sprintf "/world/world_%03d_%03d", $x, $y + 1) if $y < 999;
122 $self->tile_path (3, sprintf "/world/world_%03d_%03d", $x - 1, $y) if $x > 0; 122 $self->tile_path (3, sprintf "/world/world_%03d_%03d", $x - 1, $y) if $x > 0;
123 123
124 $self->{load_path} = sprintf "%s/world-overlay/world_%03d_%03d.map", $cf::MAPDIR, $x, $y 124 my $overlay = sprintf "%s/world/world_%03d_%03d.map", $cf::MAPDIR, $x, $y;
125 if $x >= 100 && $x <= 129 && $y >= 100 && $y <= 129; 125
126 $self->{load_path} = $overlay
127 unless Coro::AIO::aio_stat $overlay;
126 128
127 $self->{need_create_treasure} = 1; 129 $self->{need_create_treasure} = 1;
128 130
129 1 131 1
130} 132}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines