summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/util/tiles_unused
blob: bf26f06530d324346d43fb85adad8c7021126efb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl -w

# This script lists tiles which are not even loaded by tiledefs.  This implies
# being unused, although the converse is not true: tiles not listed by this
# script have an enum and are included in textures, but that enum might be
# never referenced anywhere.
#
# The logic for the UNUSED/ dir is reversed.

for (qw(feat floor gui icons main player wall))
{
    open IN, "<", "rltiles/$_.d" or die "Tiledefs must be built.\n";
    for (<IN>)
    {
        next unless m{^  (.+\.png) \\$};
        $used{$1}++;
    }
    close IN;
}

open IN, "-|", 'cd rltiles && git ls-files' or die "Can't read ls-files.\n";
for (<IN>)
{
    chomp;
    next unless /\.png$/;
    print "$_\n" unless !$used{$_} != !/^UNUSED/;
}
close IN;