… | |
… | |
277 | $exit = $_; |
277 | $exit = $_; |
278 | } |
278 | } |
279 | } |
279 | } |
280 | |
280 | |
281 | if ($exit) { |
281 | if ($exit) { |
282 | my $dest = $exit->{slaying}; |
282 | my $dest = map2abs ($exit->{slaying}, $mape); |
283 | my $dir; |
|
|
284 | if (File::Spec->file_name_is_absolute($dest)) { |
|
|
285 | $dir = catdir ($Crossfire::LIB, 'maps', $dest); |
|
|
286 | } else { |
|
|
287 | my ($v, $p, $f) = File::Spec->splitpath ($mape->{path}); |
|
|
288 | $dir = File::Spec->rel2abs ($dest, File::Spec->catpath ($v, $p)); |
|
|
289 | } |
|
|
290 | $::MAINWIN->open_map_editor ($dir); |
283 | $::MAINWIN->open_map_editor ($dest); |
291 | } |
284 | } |
292 | } |
285 | } |
293 | |
286 | |
294 | sub end { |
287 | sub end { |
295 | my ($self, $map, $x, $y, $mape) = @_; |
288 | my ($self, $map, $x, $y, $mape) = @_; |
… | |
… | |
345 | $map->change_stack ($x, $y, $as); # insert_arch_stack_layer ($as, $arch)); |
338 | $map->change_stack ($x, $y, $as); # insert_arch_stack_layer ($as, $arch)); |
346 | } |
339 | } |
347 | |
340 | |
348 | sub end { |
341 | sub end { |
349 | my ($self, $map, $x, $y, $mape) = @_; |
342 | my ($self, $map, $x, $y, $mape) = @_; |
350 | $::MAINWIN->{edit_collection}{pick}->edit ($map, $x, $y); |
343 | # $::MAINWIN->{edit_collection}{pick}->edit ($map, $x, $y); |
|
|
344 | # now actualize stack and attr editor |
|
|
345 | $::MAINWIN->update_stack_view ($map, $x, $y); |
|
|
346 | |
|
|
347 | my $cstack = $map->get ($x, $y); |
|
|
348 | |
|
|
349 | my $arch = $cstack->[-1]; |
|
|
350 | |
|
|
351 | # virtual... grmbl.... |
|
|
352 | # FIXME: I have to patch the stack of the real arch??? argl.. how?? |
|
|
353 | if ($arch->{_virtual}) { |
|
|
354 | $x = $arch->{virtual_x}; |
|
|
355 | $y = $arch->{virtual_y}; |
|
|
356 | $arch = $arch->{_virtual}; |
|
|
357 | $cstack = $map->get ($x, $y); |
|
|
358 | } |
|
|
359 | |
|
|
360 | |
|
|
361 | $::MAINWIN->update_attr_editor ($arch, sub { |
|
|
362 | $map->change_begin (ref $self); |
|
|
363 | $map->change_stack ($x, $y, $cstack); |
|
|
364 | # XXX: Put this into a generic function!!! See also EditTools.pm |
|
|
365 | # FIXME: Fix the automatic update on undo here! |
|
|
366 | if (my $changeset = $map->change_end) { |
|
|
367 | splice @{ $map->{undo_stack} ||= [] }, |
|
|
368 | $map->{undo_stack_pos}++, 1e6, |
|
|
369 | $changeset; |
|
|
370 | } |
|
|
371 | }); |
|
|
372 | |
|
|
373 | |
351 | $self->SUPER::end ($map, $x, $y, $mape); |
374 | $self->SUPER::end ($map, $x, $y, $mape); |
352 | } |
375 | } |
353 | |
376 | |
354 | sub stack_action { |
377 | sub stack_action { |
355 | my ($self, $stack, $arch) = @_; |
378 | my ($self, $stack, $arch) = @_; |