… | |
… | |
227 | |
227 | |
228 | $w->show_all; |
228 | $w->show_all; |
229 | } |
229 | } |
230 | |
230 | |
231 | sub update_attr_editor { |
231 | sub update_attr_editor { |
232 | my ($self, $map, $x, $y, $z) = @_; |
232 | my ($self, $ar) = @_; |
233 | |
|
|
234 | # if (ref ($ar) ne 'GCE::ArchRef') { require Carp; Carp::confess ("$ar no ARCHREF!") } |
|
|
235 | |
233 | |
236 | $self->{attr_edit} |
234 | $self->{attr_edit} |
237 | or return; |
235 | or return; |
238 | |
236 | |
239 | my $ar = $self->{attr_edit}->set_from_map ($map, $x, $y, $z); |
237 | $self->{attr_edit}->update_view ($ar); |
240 | $self->{attr_edit_win}->set_title ("deliantra editor - edit " . $ar->longname); |
238 | $self->{attr_edit_win}->set_title ("deliantra editor - edit " . $ar->longname); |
241 | } |
239 | } |
242 | |
240 | |
243 | #sub update_map_pos { |
241 | #sub update_map_pos { |
244 | # my ($self, $mapedit, $x, $y) = @_; |
242 | # my ($self, $mapedit, $x, $y) = @_; |
245 | # $self->{sv}->maybe_update_stack_for ($mapedit, $x, $y) |
243 | # $self->{sv}->maybe_update_stack_for ($mapedit, $x, $y) |
246 | # if $self->{sv}; |
244 | # if $self->{sv}; |
247 | #} |
245 | #} |
248 | |
246 | |
249 | sub update_stack_view { |
247 | sub update_stack_view { |
250 | my ($self, $mapedit, $x, $y) = @_; |
248 | my ($self, $sr) = @_; |
251 | |
249 | |
252 | return unless $self->{sv}; |
250 | return unless $self->{sv}; |
253 | |
251 | |
254 | $self->{sv}->set_stack ($mapedit, $x, $y); |
252 | $self->{sv}->set_stack ($sr); |
255 | } |
253 | } |
256 | |
254 | |
257 | sub open_pick_window { |
255 | sub open_pick_window { |
258 | my ($self, $layout) = @_; |
256 | my ($self, $layout) = @_; |
259 | |
257 | |
… | |
… | |
666 | my ($self) = @_; |
664 | my ($self) = @_; |
667 | |
665 | |
668 | my $fc = $self->new_filechooser; |
666 | my $fc = $self->new_filechooser; |
669 | |
667 | |
670 | if ('ok' eq $fc->run) { |
668 | if ('ok' eq $fc->run) { |
671 | |
|
|
672 | $self->{fc_last_folder} = $fc->get_current_folder; |
669 | $self->{fc_last_folder} = $fc->get_current_folder; |
673 | $self->{fc_last_folders}->{$self->{fc_last_folder}}++; |
670 | $self->{fc_last_folders}->{$self->{fc_last_folder}}++; |
674 | |
671 | |
675 | $self->open_map_editor ($fc->get_filename); |
672 | $self->open_map_editor ($fc->get_filename); |
676 | } |
673 | } |
… | |
… | |
685 | or die "Couldn't find attribute editor! SERIOUS BUG!"; |
682 | or die "Couldn't find attribute editor! SERIOUS BUG!"; |
686 | |
683 | |
687 | # XXX: This is just to make sure that this function always returns something |
684 | # XXX: This is just to make sure that this function always returns something |
688 | |
685 | |
689 | my $ar = $self->{attr_edit}->get_arch; |
686 | my $ar = $self->{attr_edit}->get_arch; |
690 | return { _name => 'platinacoin' } unless defined $ar; |
687 | return { _name => 'empty_archetype' } unless defined $ar; |
691 | return $ar->getarch || { _name => 'platinacoin' }; |
688 | return $ar->get; |
692 | } |
689 | } |
693 | |
690 | |
694 | # |
691 | # |
695 | # Map/Cursor interface |
692 | # Map/Cursor interface |
696 | # |
693 | # |
… | |
… | |
699 | my ($self, $map, @a) = @_; |
696 | my ($self, $map, @a) = @_; |
700 | $map->cursor (@a) |
697 | $map->cursor (@a) |
701 | } |
698 | } |
702 | |
699 | |
703 | sub broadcast_cursor_changes { |
700 | sub broadcast_cursor_changes { |
704 | my ($self, $map, $x, $y) = @_; |
701 | my ($self, $map, $x, $y, $action, $invalid) = @_; |
705 | my $cursors = $map->cursors_at ($x, $y); |
702 | my $cursor = $map->cursor_at ($x, $y); |
706 | warn "CURSOR UPDTEAD! " |
703 | warn "CURSOR UPDTEAD($action, $invalid) $cursor!\n"; |
707 | . join (',', map { "$_: $_->{owner}" } @$cursors) |
704 | $cursor->changed ($action, $invalid) if defined $cursor; |
708 | . "\n"; |
|
|
709 | $self->Object::Event::event (cursor_updates => $cursors); |
|
|
710 | } |
705 | } |
711 | |
706 | |
712 | =head1 AUTHOR |
707 | =head1 AUTHOR |
713 | |
708 | |
714 | Marc Lehmann <schmorp@schmorp.de> |
709 | Marc Lehmann <schmorp@schmorp.de> |