… | |
… | |
156 | $y = $arch->{virtual_y}; |
156 | $y = $arch->{virtual_y}; |
157 | $arch = $arch->{_virtual}; |
157 | $arch = $arch->{_virtual}; |
158 | $cstack = $map->get ($x, $y); |
158 | $cstack = $map->get ($x, $y); |
159 | } |
159 | } |
160 | |
160 | |
161 | unless ($self->{only_attr}->get_active) { |
161 | # unless ($self->{only_attr}->get_active) { |
162 | $::MAINWIN->set_pick ($arch) |
162 | # $::MAINWIN->set_pick ($arch) |
163 | if @$cstack; |
163 | # if @$cstack; |
164 | } |
164 | # } |
165 | |
165 | |
166 | $::MAINWIN->update_attr_editor ($arch, sub { |
166 | $::MAINWIN->update_attr_editor ($arch, sub { |
167 | $map->change_begin (ref $self); |
167 | $map->change_begin (ref $self); |
168 | $map->change_stack ($x, $y, $cstack); |
168 | $map->change_stack ($x, $y, $cstack); |
169 | # XXX: Put this into a generic function!!! See also EditTools.pm |
169 | # XXX: Put this into a generic function!!! See also EditTools.pm |
… | |
… | |
288 | if (arch_is_exit ($arch)) { |
288 | if (arch_is_exit ($arch)) { |
289 | $exit = $arch; |
289 | $exit = $arch; |
290 | } |
290 | } |
291 | } |
291 | } |
292 | |
292 | |
293 | if ($exit) { |
293 | if ($exit and $exit->{slaying} !~ /^!/) { |
294 | my $dest = map2abs ($exit->{slaying}, $mape); |
294 | my $dest = map2abs ($exit->{slaying}, $mape); |
|
|
295 | # XXX: Replace with statusbar message |
|
|
296 | unless (-e $dest) { |
|
|
297 | warn "Couldn't find '$dest'"; |
|
|
298 | return |
|
|
299 | } |
295 | $::MAINWIN->open_map_editor ($dest); |
300 | $::MAINWIN->open_map_editor ($dest); |
296 | } |
301 | } |
297 | } |
302 | } |
298 | |
303 | |
299 | sub end { |
304 | sub end { |
… | |
… | |
435 | $y = $arch->{virtual_y}; |
440 | $y = $arch->{virtual_y}; |
436 | $arch = $arch->{_virtual}; |
441 | $arch = $arch->{_virtual}; |
437 | $cstack = $map->get ($x, $y); |
442 | $cstack = $map->get ($x, $y); |
438 | } |
443 | } |
439 | |
444 | |
440 | |
|
|
441 | $::MAINWIN->update_attr_editor ($arch, sub { |
|
|
442 | $map->change_begin (ref $self); |
|
|
443 | $map->change_stack ($x, $y, $cstack); |
|
|
444 | # XXX: Put this into a generic function!!! See also EditTools.pm |
|
|
445 | # FIXME: Fix the automatic update on undo here! |
|
|
446 | if (my $changeset = $map->change_end) { |
|
|
447 | splice @{ $map->{undo_stack} ||= [] }, |
|
|
448 | $map->{undo_stack_pos}++, 1e6, |
|
|
449 | $changeset; |
|
|
450 | } |
|
|
451 | }); |
|
|
452 | |
|
|
453 | |
|
|
454 | $self->SUPER::end ($map, $x, $y, $mape); |
445 | $self->SUPER::end ($map, $x, $y, $mape); |
455 | } |
446 | } |
456 | |
447 | |
457 | sub stack_action { |
448 | sub stack_action { |
458 | my ($self, $stack, $arch) = @_; |
449 | my ($self, $stack, $arch) = @_; |