ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/map-link.ext
Revision: 1.3
Committed: Sat Apr 21 16:56:31 2007 UTC (17 years, 1 month ago) by root
Branch: MAIN
CVS Tags: rel-2_1
Changes since 1.2: +2 -0 lines
Log Message:
having a) monsters as treasures b) multipart monsters as treasures
and c) multipart monsters as terasures on tiled maps... hit a big
pile of bugs again.

this change:

- implements a per-map active flag. when items are being inserted
  they are activated or deactivated according to that flag.
  this could get rid of most or even all of the explicit
  activate/deactivate calls.
- implement some glue to make instantiating multipart objects easier
  (this is used inside fix_multipart_objects and might make it possible
  to put multipart objects at map borders - those were winged before)
- do finer-grained locking as to not lead to deadlocks when insert
  recurses e.g. when loading tiled maps.

File Contents

# Content
1 #! perl # MANDATORY
2
3 cf::map->register (qr{^\{link\}});
4
5 sub load_header {
6 my ($self) = @_;
7
8 # singleton :/
9 $self->width (21);
10 $self->height (21);
11 $self->nodrop (1);
12
13 $self->name ("special built-in map");
14
15 $self->alloc;
16 $self->in_memory (cf::MAP_IN_MEMORY);
17
18 # provide some exits "home"
19 my $exit = cf::object::new "exit";
20 my $guard = Coro::guard { $exit->destroy };
21
22 $exit->slaying ($cf::EMERGENCY_POSITION->[0]);
23 $exit->stats->hp ($cf::EMERGENCY_POSITION->[1]);
24 $exit->stats->sp ($cf::EMERGENCY_POSITION->[2]);
25
26 $self->insert ($exit->clone, 9, 9);
27 $self->insert ($exit->clone, 9, 10);
28 $self->insert ($exit->clone, 9, 11);
29 $self->insert ($exit->clone, 10, 9);
30 $self->insert ($exit->clone, 10, 11);
31 $self->insert ($exit->clone, 11, 9);
32 $self->insert ($exit->clone, 11, 10);
33 $self->insert ($exit->clone, 11, 11);
34
35 $self->{deny_save} = 1;
36 $self->{deny_reset} = 1;
37
38 $self->activate;
39
40 1
41 }
42
43 1
44