ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/gde/GCE/EditAction.pm
(Generate patch)

Comparing deliantra/gde/GCE/EditAction.pm (file contents):
Revision 1.15 by elmex, Thu Mar 16 02:56:30 2006 UTC vs.
Revision 1.16 by elmex, Thu Mar 16 11:59:34 2006 UTC

624 $idx = stack_find ($stack, 'from_top', sub { $_[0]->{_name} eq $pick_name }); 624 $idx = stack_find ($stack, 'from_top', sub { $_[0]->{_name} eq $pick_name });
625 } 625 }
626 } 626 }
627} 627}
628 628
629package GCE::EditAction::Connect;
630use Storable qw/dclone/;
631use GCE::Util;
632use Gtk2;
633use File::Spec::Functions;
634use strict;
635
636our @ISA = qw/GCE::EditAction::RadioModed/;
637
638sub name { 'connect' }
639
640sub init {
641 my ($self) = @_;
642
643 my $vb = new Gtk2::VBox;
644 $self->add_mode_button ($vb, "exit", "exit");
645# $self->add_mode_button ($vb, "triggers", "trig");
646 $vb->pack_start ($self->{sel_lbl} = Gtk2::Label->new, 0, 0, 0);
647 $self->tool_widget ($vb);
648}
649
650sub want_cursor { 0 }
651
652sub begin {
653 my ($self, $map, $x, $y, $mapedit) = @_;
654
655 $self->edit ($map, $x, $y, $mapedit);
656}
657
658sub edit {
659 my ($self, $map, $x, $y, $mapedit) = @_;
660
661 my $pick = $::MAINWIN->get_pick;
662 my $as = $map->get ($x, $y);
663
664 my $exit;
665 for (@$as) {
666 my $a = $Crossfire::ARCH{$_->{_name}};
667 if ($a->{type} eq '66') {
668 $exit = $_;
669 }
670 }
671
672 if ($exit) {
673 if ($self->{sel_exit}) {
674 my $ent = catfile ($Crossfire::LIB, 'maps');
675
676 $exit->{hp} = $self->{sel_exit}->[3];
677 $exit->{sp} = $self->{sel_exit}->[4];
678 $exit->{slaying} = File::Spec->abs2rel ($self->{sel_exit}->[5], $ent);
679
680 my $exit2 = $self->{sel_exit}->[0];
681
682 $exit2->{hp} = $x;
683 $exit2->{sp} = $y;
684 $exit2->{slaying} = File::Spec->abs2rel ($mapedit->{path}, $ent);
685
686 unless ($exit2->{slaying} =~ m/^\.\./) {
687 $exit2->{slaying} = '/' . $exit2->{slaying};
688 }
689 unless ($exit->{slaying} =~ m/^\.\./) {
690 $exit->{slaying} = '/' . $exit->{slaying};
691 }
692
693 $self->SUPER::begin ($map, $x, $y, $mapedit);
694 $map->change_stack ($x, $y, $as);
695 $self->SUPER::end ($map);
696 $self->SUPER::begin ($self->{sel_exit}->[1], $exit->{hp}, $exit->{sp});
697 $self->{sel_exit}->[1]->change_stack ($exit->{hp}, $exit->{sp}, $self->{sel_exit}->[2]);
698 $self->SUPER::end ($self->{sel_exit}->[1]);
699
700 quick_msg ($mapedit, "$exit->{slaying} ($x:$y) $exit->{_name} <=> $exit2->{slaying} ($exit2->{hp}:$exit2->{sp}) $exit2->{_name}", 0);
701
702 $::MAINWIN->{edit_collection}{pick}->edit ($map, $x, $y);
703
704 $self->{sel_exit} = undef;
705 $self->{sel_lbl}->set_text ('');
706 } else {
707 $self->{sel_lbl}->set_text ("src: ($x:$y) $exit->{_name}");
708 $self->{sel_exit} = [$exit, $map, $as, $x, $y, $mapedit->{path}];
709 }
710 } else {
711 quick_msg ($mapedit, "no exit object found");
712 }
713
714# $self->stack_action ($as, dclone ($pick));
715#$map->change_stack ($x, $y, $as); # insert_arch_stack_layer ($as, $arch));
716}
717
718sub end {}
629 719
630 720
631=head1 AUTHOR 721=head1 AUTHOR
632 722
633 Marc Lehmann <schmorp@schmorp.de> 723 Marc Lehmann <schmorp@schmorp.de>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines