diff options
author | Adam Borowski <kilobyte@angband.pl> | 2013-12-14 12:29:07 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2013-12-14 12:29:07 +0100 |
commit | 695696114f0d997f973aac55c90b1b9cce7cd168 (patch) | |
tree | 8135d003e687ffef10b3dac379f20a39b6023abb /crawl-ref/source/util/tiledef_lint | |
parent | 1105da3b3ad5af17f9c515b788f672426a91b66f (diff) | |
download | crawl-ref-695696114f0d997f973aac55c90b1b9cce7cd168.tar.gz crawl-ref-695696114f0d997f973aac55c90b1b9cce7cd168.zip |
Teach tiledef_lint about TILEG_ defs.
Diffstat (limited to 'crawl-ref/source/util/tiledef_lint')
-rwxr-xr-x | crawl-ref/source/util/tiledef_lint | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/crawl-ref/source/util/tiledef_lint b/crawl-ref/source/util/tiledef_lint index 892906f1aa..6410b7b85a 100755 --- a/crawl-ref/source/util/tiledef_lint +++ b/crawl-ref/source/util/tiledef_lint @@ -1,17 +1,28 @@ #!/usr/bin/perl -w my %defs; -open IN, "<rltiles/tiledef-player.h" or die "tiledefs must be generated\n"; -while (<IN>) + +sub check_defs($$$@) { - next unless /TILEP_(MONS_[A-Z0-9_]+)/; - # multi-tile enums receive _1 _2 _3 automatically. Could cause problems - # if we get such a name written manually. - next if $1 =~ /[0-9]$/; - $defs{$1} = 1; -} -close IN; + my ($file, $symbol, $prefix, @ok) = @_; + undef %defs; + open IN, "<rltiles/tiledef-$file.h" or die "tiledefs must be generated\n"; + while (<IN>) + { + next unless /TILE${symbol}_($prefix[A-Z0-9_]+)/; + # multi-tile enums receive _1 _2 _3 automatically. Could cause problems + # if we get such a name written manually. + next if $1 =~ /[0-9]$/; + $defs{$1} = 1; + } + close IN; -delete $defs{$_} for (map {chomp;$_}`util/gather_tiles_mons`); + delete $defs{$_} for @ok; + + return unless %defs; + print "Unused $prefix$file tiles (TILE${symbol}_):\n"; + print "$_\n" for sort keys %defs; +} -print "$_\n" for sort keys %defs; +check_defs 'player', 'P', 'MONS_', map {chomp;$_}`util/gather_tiles_mons`; +check_defs 'gui', 'G', '', map {chomp;$_}`util/gather_tiles_gui`; |