… | |
… | |
12 | use base 'Crossfire::Protocol::Base'; |
12 | use base 'Crossfire::Protocol::Base'; |
13 | |
13 | |
14 | sub new { |
14 | sub new { |
15 | my $class = shift; |
15 | my $class = shift; |
16 | |
16 | |
17 | my $self = $class->SUPER::new (@_); |
17 | my $self = $class->SUPER::new (@_, setup_req => { extmap => 1 }); |
18 | |
18 | |
19 | $self->{map_widget}->clr_commands; |
19 | $self->{map_widget}->clr_commands; |
20 | |
20 | |
21 | my @cmd_help = map { |
21 | my @cmd_help = map { |
22 | $_->{kw}[0] =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x |
22 | $_->{kw}[0] =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x |
… | |
… | |
45 | CFPlus::find_rcfile "noface.png", minify => 1, mipmap => 1; |
45 | CFPlus::find_rcfile "noface.png", minify => 1, mipmap => 1; |
46 | |
46 | |
47 | $self->{open_container} = 0; |
47 | $self->{open_container} = 0; |
48 | |
48 | |
49 | # "global" |
49 | # "global" |
50 | $self->{tilecache} = CFPlus::db_table "tilecache"; |
50 | $self->{tilecache} = CFPlus::db_table "tilecache" |
|
|
51 | or die "tilecache: unable to open database table"; |
51 | $self->{facemap} = CFPlus::db_table "facemap"; |
52 | $self->{facemap} = CFPlus::db_table "facemap" |
|
|
53 | or die "facemap: unable to open database table"; |
52 | |
54 | |
53 | # per server |
55 | # per server |
54 | $self->{mapcache} = CFPlus::db_table "mapcache_$self->{host}_$self->{port}"; |
56 | $self->{mapcache} = CFPlus::db_table "mapcache_$self->{host}_$self->{port}" |
|
|
57 | or die "mapcache_$self->{host}_$self->{port}: unable to open database table"; |
55 | |
58 | |
56 | $self |
59 | $self |
57 | } |
60 | } |
58 | |
61 | |
59 | sub logprint { |
62 | sub logprint { |
60 | my ($self, @a) = @_; |
63 | my ($self, @a) = @_; |
61 | |
64 | |
62 | return; |
|
|
63 | $self->{log_fh} ||= do { |
65 | $self->{log_fh} ||= do { |
64 | my $path = "$Crossfire::VARDIR/log.$self->{host}"; |
66 | my $path = "$Crossfire::VARDIR/log.$self->{host}"; |
65 | |
67 | |
66 | open my $fh, ">>:utf8", $path |
68 | open my $fh, ">>:utf8", $path |
67 | or die "Couldn't open logfile $path: $!"; |
69 | or die "Couldn't open logfile $path: $!"; |
… | |
… | |
340 | } |
342 | } |
341 | |
343 | |
342 | sub feed_map1a { |
344 | sub feed_map1a { |
343 | my ($self, $data) = @_; |
345 | my ($self, $data) = @_; |
344 | |
346 | |
345 | $self->{map}->map1a_update ($data); |
347 | $self->{map}->map1a_update ($data, $self->{setup}{extmap}); |
346 | $self->{map_widget}->update; |
348 | $self->{map_widget}->update; |
347 | } |
349 | } |
348 | |
350 | |
349 | sub magicmap { |
351 | sub magicmap { |
350 | my ($self, $w, $h, $x, $y, $data) = @_; |
352 | my ($self, $w, $h, $x, $y, $data) = @_; |
… | |
… | |
923 | } |
925 | } |
924 | |
926 | |
925 | sub destroy { |
927 | sub destroy { |
926 | my ($self) = @_; |
928 | my ($self) = @_; |
927 | |
929 | |
928 | $self->{npc_dialog}->destroy |
930 | (delete $self->{npc_dialog})->destroy |
929 | if $self->{npc_dialog}; |
931 | if $self->{npc_dialog}; |
930 | |
932 | |
931 | $self->SUPER::destroy; |
933 | $self->SUPER::destroy; |
932 | } |
934 | } |
933 | |
935 | |