ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra/res2pm
(Generate patch)

Comparing deliantra/Deliantra/res2pm (file contents):
Revision 1.6 by root, Wed Feb 22 22:41:22 2006 UTC vs.
Revision 1.9 by root, Mon Mar 27 17:38:18 2006 UTC

99 99
100 if ($arch->{type} =~ s/^(bitmask)_(.*)/$1/) { 100 if ($arch->{type} =~ s/^(bitmask)_(.*)/$1/) {
101 $arch->{value} = $bitmask{$2} ||= {}; 101 $arch->{value} = $bitmask{$2} ||= {};
102 } elsif ($arch->{type} =~ s/^(list)_(.*)/$1/) { 102 } elsif ($arch->{type} =~ s/^(list)_(.*)/$1/) {
103 $arch->{value} = $list{$2} ||= {}; 103 $arch->{value} = $list{$2} ||= {};
104 } elsif ($arch->{type} eq "fixed") {
105 $arch->{value} = $e->attr ("value");
104 } elsif ($arch->{type} =~ s/^bool_special$/bool/) { 106 } elsif ($arch->{type} =~ s/^bool_special$/bool/) {
105 $arch->{value} = [$e->attr ("false"), $e->attr ("true")]; 107 $arch->{value} = [$e->attr ("false"), $e->attr ("true")];
106 } 108 }
107 109
108 $sect->{$e->attr ("arch") || $e->attr("arch_begin")} = $arch; 110 push @$sect, [$e->attr ("arch") || $e->attr("arch_begin"), $arch];
109} 111}
110 112
111sub parse_type { 113sub parse_type {
112 my ($e, $type) = @_; 114 my ($e, $type) = @_;
113 115
114 my %main; 116 my %main;
115 117
116 for my $e (grep ref, @{$e->contents}) { 118 for my $e (grep ref, @{$e->contents}) {
117 if ($e->name eq "required") { 119 if ($e->name eq "required") {
120 # not used
118 for my $i (grep ref, @{$e->contents}) { 121 #for my $i (grep ref, @{$e->contents}) {
119 $type->{required}{$i->attr ("arch")} = $i->attr ("value"); 122 # $type->{required}{$i->attr ("arch")} = $i->attr ("value");
120 } 123 #}
121 } elsif ($e->name eq "attribute") { 124 } elsif ($e->name eq "attribute") {
122 parse_attr $e, $type->{attr} ||= {}; 125 parse_attr $e, $type->{attr} ||= [];
123 } elsif ($e->name eq "ignore") { 126 } elsif ($e->name eq "ignore") {
124 for my $i (grep ref, @{$e->contents}) { 127 for my $i (grep ref, @{$e->contents}) {
125 if ($i->name eq "ignore_list") { 128 if ($i->name eq "ignore_list") {
126 push @{$type->{ignore}}, $ignore_list{$i->attr ("name")} ||= []; 129 push @{$type->{ignore}}, $ignore_list{$i->attr ("name")} ||= [];
127 } elsif ($i->name eq "attribute") { 130 } elsif ($i->name eq "attribute") {
133 } elsif ($e->name eq "use") { 136 } elsif ($e->name eq "use") {
134 $type->{use} = string $e; 137 $type->{use} = string $e;
135 } elsif ($e->name eq "description") { 138 } elsif ($e->name eq "description") {
136 $type->{desc} = string $e; 139 $type->{desc} = string $e;
137 } elsif ($e->name eq "section") { 140 } elsif ($e->name eq "section") {
138 my %attr; 141 my @attr;
139 for my $i (grep ref, @{$e->contents}) { 142 for my $i (grep ref, @{$e->contents}) {
140 parse_attr $i, \%attr; 143 parse_attr $i, \@attr;
141 } 144 }
142 push @{ $type->{section} }, [$e->attr ("name") => \%attr]; 145 push @{ $type->{section} }, [$e->attr ("name") => \@attr];
143 } else { 146 } else {
144 warn "unknown types subelement ", $e->name; 147 warn "unknown types subelement ", $e->name;
145 } 148 }
146 } 149 }
147 150
170 my $type = $type{$e->attr ("name")} ||= {}; 173 my $type = $type{$e->attr ("name")} ||= {};
171 174
172 $type->{name} = $e->attr ("name"); 175 $type->{name} = $e->attr ("name");
173 176
174 parse_type $e, $type; 177 parse_type $e, $type;
175 #unshift @{$type->{import}}, \%default_attr;
176 178
177 if ($e->attr ("number") > 0) { 179 if ($e->attr ("number") > 0) {
178 $attr{$e->attr ("number")} = $type; 180 $attr{$e->attr ("number")} = $type;
179 } elsif ($e->attr ("name") eq "Misc") { 181 } elsif ($e->attr ("name") eq "Misc") {
180 delete $type->{required}; 182 delete $type->{required};
198 200
199for (grep ref, @{$spell->root->contents}) { 201for (grep ref, @{$spell->root->contents}) {
200 $spell{$_->attr ("id")} = $_->attr ("name"); 202 $spell{$_->attr ("id")} = $_->attr ("name");
201} 203}
202 204
203dump_hash ["BITMASK", "LIST", "IGNORE_LIST", "DEFAULT_ATTR", "TYPE", "ATTR0", "ATTR", "TYPENAME", "SPELL"], 205dump_hash ["BITMASK", "LIST", "IGNORE_LIST", "DEFAULT_ATTR", "TYPE", "ATTR", "TYPENAME", "SPELL"],
204 [\%bitmask, \%list, \%ignore_list, \%default_attr, \%type, \@attr0, \%attr, \%typename, \%spell]; 206 [\%bitmask, \%list, \%ignore_list, \%default_attr, \%type, \%attr, \%typename, \%spell];
205 207
206print <<EOF; 208print <<EOF;
207 209
208=head1 AUTHOR 210=head1 AUTHOR
209 211

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines