… | |
… | |
10 | use Gtk2::Gdk::Keysyms; |
10 | use Gtk2::Gdk::Keysyms; |
11 | use Gtk2::SimpleMenu; |
11 | use Gtk2::SimpleMenu; |
12 | |
12 | |
13 | use Crossfire; |
13 | use Crossfire; |
14 | use Crossfire::MapWidget; |
14 | use Crossfire::MapWidget; |
|
|
15 | |
|
|
16 | use GCE::StackRef; |
15 | |
17 | |
16 | use strict; |
18 | use strict; |
17 | |
19 | |
18 | sub new { |
20 | sub new { |
19 | my $class = shift; |
21 | my $class = shift; |
… | |
… | |
318 | $self->add_mode_button ($vb, "top", "top"); |
320 | $self->add_mode_button ($vb, "top", "top"); |
319 | $self->add_mode_button ($vb, "above floor", "above"); |
321 | $self->add_mode_button ($vb, "above floor", "above"); |
320 | $self->add_mode_button ($vb, "below floor", "below"); |
322 | $self->add_mode_button ($vb, "below floor", "below"); |
321 | $self->add_mode_button ($vb, "bottom", "bottom"); |
323 | $self->add_mode_button ($vb, "bottom", "bottom"); |
322 | |
324 | |
323 | $vb->pack_start ($self->{place_clean} = Gtk2::CheckButton->new ('place clean'), 0, 1, 0); |
|
|
324 | |
|
|
325 | $self->tool_widget ($vb); |
325 | $self->tool_widget ($vb); |
326 | } |
326 | } |
327 | |
327 | |
328 | sub want_cursor { 0 } |
328 | sub want_cursor { 0 } |
329 | |
329 | |
… | |
… | |
337 | sub edit { |
337 | sub edit { |
338 | my ($self, $map, $x, $y) = @_; |
338 | my ($self, $map, $x, $y) = @_; |
339 | |
339 | |
340 | my $pick = $::MAINWIN->get_pick; |
340 | my $pick = $::MAINWIN->get_pick; |
341 | my $as = $map->get ($x, $y); |
341 | my $as = $map->get ($x, $y); |
342 | |
|
|
343 | if ($self->{place_clean}->get_active) { |
|
|
344 | $pick = { _name => $pick->{_name} }; |
|
|
345 | } |
|
|
346 | |
342 | |
347 | $self->stack_action ($as, dclone ($pick)); |
343 | $self->stack_action ($as, dclone ($pick)); |
348 | $map->change_stack ($x, $y, $as); # insert_arch_stack_layer ($as, $arch)); |
344 | $map->change_stack ($x, $y, $as); # insert_arch_stack_layer ($as, $arch)); |
349 | } |
345 | } |
350 | |
346 | |
… | |
… | |
793 | if (arch_is_exit ($_)) { |
789 | if (arch_is_exit ($_)) { |
794 | $exit = $_; |
790 | $exit = $_; |
795 | } |
791 | } |
796 | } |
792 | } |
797 | |
793 | |
798 | my $ent = $self->{sel_edt}->get_text; |
794 | my $mappath = $::CFG->{MAPDIR}; |
|
|
795 | |
799 | if ($exit) { |
796 | if ($exit) { |
800 | if ($self->{sel_exit}) { |
797 | if ($self->{sel_exit}) { |
801 | |
798 | |
802 | $exit->{hp} = $self->{sel_exit}->[3]; |
799 | $exit->{hp} = $self->{sel_exit}->[3]; |
803 | $exit->{sp} = $self->{sel_exit}->[4]; |
800 | $exit->{sp} = $self->{sel_exit}->[4]; |
804 | $exit->{slaying} = File::Spec->abs2rel ($self->{sel_exit}->[5], $ent); |
801 | #$exit->{slaying} = File::Spec->abs2rel ($self->{sel_exit}->[5], $ent); |
805 | |
802 | |
806 | my $exit2 = $self->{sel_exit}->[0]; |
803 | my $exit2 = $self->{sel_exit}->[0]; |
807 | |
804 | |
808 | $exit2->{hp} = $x; |
805 | $exit2->{hp} = $x; |
809 | $exit2->{sp} = $y; |
806 | $exit2->{sp} = $y; |
810 | $exit2->{slaying} = File::Spec->abs2rel ($mapedit->{path}, $ent); |
|
|
811 | |
807 | |
812 | unless ($exit2->{slaying} =~ m/^\.\./) { |
808 | my ($m1, $m2) = exit_paths ($mappath, $self->{sel_exit}->[5], $mapedit->{path}); |
813 | $exit2->{slaying} = '/' . $exit2->{slaying}; |
809 | |
814 | } |
810 | $exit2->{slaying} = $m2; |
815 | unless ($exit->{slaying} =~ m/^\.\./) { |
811 | $exit->{slaying} = $m1; |
816 | $exit->{slaying} = '/' . $exit->{slaying}; |
|
|
817 | } |
|
|
818 | |
812 | |
819 | $self->SUPER::begin ($map, $x, $y, $mapedit); |
813 | $self->SUPER::begin ($map, $x, $y, $mapedit); |
820 | $map->change_stack ($x, $y, $as); |
814 | $map->change_stack ($x, $y, $as); |
821 | $self->SUPER::end ($map); |
815 | $self->SUPER::end ($map); |
822 | $self->SUPER::begin ($self->{sel_exit}->[1], $exit->{hp}, $exit->{sp}); |
816 | $self->SUPER::begin ($self->{sel_exit}->[1], $exit->{hp}, $exit->{sp}); |
823 | $self->{sel_exit}->[1]->change_stack ($exit->{hp}, $exit->{sp}, $self->{sel_exit}->[2]); |
817 | $self->{sel_exit}->[1]->change_stack ($exit->{hp}, $exit->{sp}, $self->{sel_exit}->[2]); |
824 | $self->SUPER::end ($self->{sel_exit}->[1]); |
818 | $self->SUPER::end ($self->{sel_exit}->[1]); |
825 | |
819 | |
826 | quick_msg ($mapedit, "$exit->{slaying} ($x:$y) $exit->{_name} <=> $exit2->{slaying} ($exit2->{hp}:$exit2->{sp}) $exit2->{_name}", 0); |
820 | quick_msg ($mapedit, "$exit->{slaying} ($exit->{hp}:$exit->{sp}) $exit->{_name} <=> $exit2->{slaying} ($exit2->{hp}:$exit2->{sp}) $exit2->{_name}", 0); |
827 | |
821 | |
828 | $::MAINWIN->{edit_collection}{pick}->edit ($map, $x, $y); |
822 | $::MAINWIN->{edit_collection}{pick}->edit ($map, $x, $y); |
829 | |
823 | |
830 | $self->{sel_exit} = undef; |
824 | $self->{sel_exit} = undef; |
831 | $self->{sel_lbl}->set_text (''); |
825 | $self->{sel_lbl}->set_text (''); |
… | |
… | |
838 | |
832 | |
839 | my $exit2 = $self->{sel_exit}->[0]; |
833 | my $exit2 = $self->{sel_exit}->[0]; |
840 | |
834 | |
841 | $exit2->{hp} = $x; |
835 | $exit2->{hp} = $x; |
842 | $exit2->{sp} = $y; |
836 | $exit2->{sp} = $y; |
843 | $exit2->{slaying} = File::Spec->abs2rel ($mapedit->{path}, $ent); |
837 | $exit2->{slaying} = undef; |
844 | |
838 | |
845 | unless ($exit2->{slaying} =~ m/^\.\./) { |
839 | unless ($exit2->{slaying} =~ m/^\.\./) { |
846 | $exit2->{slaying} = '/' . $exit2->{slaying}; |
840 | $exit2->{slaying} = '/' . $exit2->{slaying}; |
847 | } |
841 | } |
848 | |
842 | |
849 | $self->SUPER::begin ($self->{sel_exit}->[1], $exit->{hp}, $exit->{sp}); |
843 | $self->SUPER::begin ($self->{sel_exit}->[1], $exit->{hp}, $exit->{sp}); |
850 | $self->{sel_exit}->[1]->change_stack ($self->{sel_exit}->[3], $self->{sel_exit}->[4], $self->{sel_exit}->[2]); |
844 | $self->{sel_exit}->[1]->change_stack ($self->{sel_exit}->[3], $self->{sel_exit}->[4], $self->{sel_exit}->[2]); |
851 | $self->SUPER::end ($self->{sel_exit}->[1]); |
845 | $self->SUPER::end ($self->{sel_exit}->[1]); |
852 | |
846 | |
853 | quick_msg ($mapedit, "$self->{sel_exit}->[5] ($self->{sel_exit}->[3]:$self->{sel_exit}->[4]) $self->{sel_exit}->[0]->{_name} => $exit2->{slaying} ($x:$y) $exit2->{_name}", 0); |
847 | quick_msg ($mapedit, "($self->{sel_exit}->[3]:$self->{sel_exit}->[4]) $self->{sel_exit}->[0]->{_name} => ($x:$y) $exit2->{_name}", 0); |
854 | |
848 | |
855 | $::MAINWIN->{edit_collection}{pick}->edit ($map, $x, $y); |
849 | $::MAINWIN->{edit_collection}{pick}->edit ($map, $x, $y); |
856 | |
850 | |
857 | $self->{sel_exit} = undef; |
851 | $self->{sel_exit} = undef; |
858 | $self->{sel_lbl}->set_text (''); |
852 | $self->{sel_lbl}->set_text (''); |