Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/tools/entity/checkrefs.pl
Show First 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | sub add_entities | ||||
s~^simulation/templates/(.*)\.xml$~$1~ for @entfiles; | s~^simulation/templates/(.*)\.xml$~$1~ for @entfiles; | ||||
for my $f (sort @entfiles) | for my $f (sort @entfiles) | ||||
{ | { | ||||
my $path = "simulation/templates/$f.xml"; | my $path = "simulation/templates/$f.xml"; | ||||
push @files, $path; | push @files, $path; | ||||
my $ent = Entity::load_inherited($f, "$mod_list_string"); | my $ent = Entity::load_inherited($f, "$mod_list_string"); | ||||
push @deps, [ $path, "simulation/templates/" . $ent->{Entity}{'@parent'}{' content'} . ".xml" ] if $ent->{Entity}{'@parent'}; | if ($ent->{Entity}{'@parent'}) | ||||
{ | |||||
my @parents = split(/\|/, $ent->{Entity}{'@parent'}{' content'}); | |||||
for my $parentPath (@parents) | |||||
{ | |||||
push @deps, [ $path, "simulation/templates/" . $parentPath . ".xml" ]; | |||||
} | |||||
} | |||||
if ($f !~ /^template_/) | if ($f !~ /^template_/) | ||||
{ | { | ||||
push @roots, $path; | push @roots, $path; | ||||
if ($ent->{Entity}{VisualActor} and $ent->{Entity}{VisualActor}{Actor}) | if ($ent->{Entity}{VisualActor} and $ent->{Entity}{VisualActor}{Actor}) | ||||
{ | { | ||||
my $phenotypes = $ent->{Entity}{Identity}{Phenotype}{' content'} || "default"; | my $phenotypes = $ent->{Entity}{Identity}{Phenotype}{' content'} || "default"; | ||||
my @phenotypes = split /\s/,$phenotypes; | my @phenotypes = split /\s/,$phenotypes; | ||||
▲ Show 20 Lines • Show All 491 Lines • ▼ Show 20 Lines | sub check_deps | ||||
my %revdeps; | my %revdeps; | ||||
for my $d (@deps) | for my $d (@deps) | ||||
{ | { | ||||
push @{$revdeps{$d->[1]}}, $d->[0]; | push @{$revdeps{$d->[1]}}, $d->[0]; | ||||
} | } | ||||
for my $f (sort keys %revdeps) | for my $f (sort keys %revdeps) | ||||
{ | { | ||||
if ($f =~ /simulation\/templates\//) | |||||
{ | |||||
next if exists $files{$f =~ s/templates\//templates\/special\/filter\//r}; | |||||
next if exists $files{$f =~ s/templates\//templates\/mixins\//r}; | |||||
} | |||||
next if exists $files{$f}; | next if exists $files{$f}; | ||||
warn "Missing file '$f' referenced by: " . (join ', ', map "'$_'", map vfs_to_relative_to_mods($_), sort @{$revdeps{$f}}) . "\n"; | warn "Missing file '$f' referenced by: " . (join ', ', map "'$_'", map vfs_to_relative_to_mods($_), sort @{$revdeps{$f}}) . "\n"; | ||||
if (exists $lcfiles{lc $f}) | if (exists $lcfiles{lc $f}) | ||||
{ | { | ||||
warn "### Case-insensitive match (found '$lcfiles{lc $f}')\n"; | warn "### Case-insensitive match (found '$lcfiles{lc $f}')\n"; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator