--- deliantra/server/ext/map-world.ext 2011/05/04 07:41:13 1.44 +++ deliantra/server/ext/map-world.ext 2011/05/08 21:51:26 1.46 @@ -2,7 +2,7 @@ # manages the worldmap by directing to other handlers -cf::map->register (qr{^/world/world_(-?\d+)_(-?\d+)(?:_(-?\d+))?$}, 100); +cf::map->register (qr{^/world/world_(-?\d+)_(-?\d+)(?:([+\-]\d+))?$}, 100); # universal our $TILE_W = 50; @@ -37,7 +37,7 @@ sub format_xyz($$;$) { sprintf "/world/world_%03d_%03d%s", $_[0], $_[1], - $_[2] ? sprintf "_%03d", $_[2] : ""; + $_[2] ? sprintf "%+04d", $_[2] : ""; } ############################################################################# @@ -61,11 +61,13 @@ $self->init_worldmap ($meta); - last; + goto done; } - } + bless $self, ext::map_world::empty::; + +done: $self->SUPER::init; } @@ -87,12 +89,12 @@ $self->default_region (cf::region::find "wilderness"); # all possible worldmap tiles also exist - $self->tile_path (0, format_xyz $x, $y - 1, $z); - $self->tile_path (1, format_xyz $x + 1, $y, $z); - $self->tile_path (2, format_xyz $x, $y + 1, $z); - $self->tile_path (3, format_xyz $x - 1, $y, $z); - $self->tile_path (4, format_xyz $x, $y, $z + 1); - $self->tile_path (5, format_xyz $x, $y, $z - 1); + $self->tile_path (cf::TILE_NORTH, format_xyz $x, $y - 1, $z); + $self->tile_path (cf::TILE_SOUTH, format_xyz $x, $y + 1, $z); + $self->tile_path (cf::TILE_EAST , format_xyz $x + 1, $y, $z); + $self->tile_path (cf::TILE_WEST , format_xyz $x - 1, $y, $z); + $self->tile_path (cf::TILE_UP , format_xyz $x, $y, $z + 1); + $self->tile_path (cf::TILE_DOWN , format_xyz $x, $y, $z - 1); # an overlay always wins my $overlay = sprintf "%s/%s.map", $cf::MAPDIR, format_xyz $x, $y, $z; @@ -146,3 +148,11 @@ if delete $self->{need_create_treasure}; } +package ext::map_world::empty; + +our @ISA = ext::map_world::; + +sub post_load_original { + $_[0]->fill; +} +