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.37 by elmex, Thu Jun 1 14:00:04 2006 UTC vs.
Revision 1.38 by elmex, Thu Jun 1 14:33:14 2006 UTC

779 $idx = stack_find ($stack, 'from_top', sub { $_[0]->{_name} eq $pick_name }); 779 $idx = stack_find ($stack, 'from_top', sub { $_[0]->{_name} eq $pick_name });
780 } 780 }
781 } 781 }
782} 782}
783 783
784package GCE::EditAction::ConnectExit; 784package GCE::EditAction::Connect;
785use Storable qw/dclone/; 785use Storable qw/dclone/;
786use GCE::Util; 786use GCE::Util;
787use Gtk2; 787use Gtk2;
788use File::Spec::Functions; 788use File::Spec::Functions;
789use strict; 789use strict;
790 790
791our @ISA = qw/GCE::EditAction::RadioModed/; 791our @ISA = qw/GCE::EditAction::RadioModed/;
792 792
793sub name { 'connectexit' } 793sub name { 'connect' }
794 794
795sub init { 795sub init {
796 my ($self) = @_; 796 my ($self) = @_;
797 797
798 my $vb = new Gtk2::VBox; 798 my $vb = new Gtk2::VBox;
799 $self->add_mode_button ($vb, "exit", "exit"); 799 $self->add_mode_button ($vb, "exit", "exit");
800 800
801 $vb->pack_start ($self->{sel_edt} = Gtk2::Entry->new, 0, 1, 0); 801 $vb->pack_start (my $l = Gtk2::Label->new, 0, 0, 0);
802 $self->{sel_edt}->set_text (catfile ($::CFG->{MAPDIR})); 802 $l->set_text ("connection:");
803 803 $vb->pack_start ($self->{pcon} = Gtk2::SpinButton->new_with_range (1, 10000, 1), 0, 1, 0);
804 $vb->pack_start ($self->{sel_lbl} = Gtk2::Label->new, 0, 0, 0); 804 $vb->pack_start ($self->{sel_lbl} = Gtk2::Label->new, 0, 0, 0);
805 $self->tool_widget ($vb); 805 $self->tool_widget ($vb);
806} 806}
807 807
808sub want_cursor { 0 } 808sub want_cursor { 0 }
816 816
817 my $pick = $::MAINWIN->get_pick; 817 my $pick = $::MAINWIN->get_pick;
818 my $as = $map->get ($x, $y); 818 my $as = $map->get ($x, $y);
819 819
820 my $exit; 820 my $exit;
821 my $conns = [];
821 for (@$as) { 822 for (@$as) {
823 if (arch_is_connector ($_)) {
824 push @$conns, $_;
822 if (arch_is_exit ($_)) { 825 } elsif (arch_is_exit ($_)) {
823 $exit = $_; 826 $exit = $_;
824 } 827 }
825 } 828 }
826 829
827 my $mappath = $::CFG->{MAPDIR}; 830 my $mappath = $::CFG->{MAPDIR};
858 $self->{sel_lbl}->set_text (''); 861 $self->{sel_lbl}->set_text ('');
859 } else { 862 } else {
860 $self->{sel_lbl}->set_text ("src: ($x:$y) $exit->{_name}"); 863 $self->{sel_lbl}->set_text ("src: ($x:$y) $exit->{_name}");
861 $self->{sel_exit} = [$exit, $map, $as, $x, $y, $mapedit->{path}]; 864 $self->{sel_exit} = [$exit, $map, $as, $x, $y, $mapedit->{path}];
862 } 865 }
866 } elsif (@{$conns}) {
867 for (@{$conns}) {
868 $_->{connected} = $self->{pcon}->get_value;
869 }
870 $self->SUPER::begin ($map, $x, $y, $mapedit);
871 $map->change_stack ($x, $y, $as);
872 $self->SUPER::end ($map);
863 } else { 873 } else {
864 if ($self->{sel_exit}) { 874 if ($self->{sel_exit}) {
865 875
866 my $exit2 = $self->{sel_exit}->[0]; 876 my $exit2 = $self->{sel_exit}->[0];
867 877
882 $::MAINWIN->{edit_collection}{pick}->edit ($map, $x, $y); 892 $::MAINWIN->{edit_collection}{pick}->edit ($map, $x, $y);
883 893
884 $self->{sel_exit} = undef; 894 $self->{sel_exit} = undef;
885 $self->{sel_lbl}->set_text (''); 895 $self->{sel_lbl}->set_text ('');
886 } else { 896 } else {
887 quick_msg ($mapedit, "no exit object found"); 897 quick_msg ($mapedit, "no exit or connection object found");
888 } 898 }
889 } 899 }
890} 900}
891 901
892 902

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines