diff options
author | Neil Moore <neil@s-z.org> | 2014-07-30 14:34:02 -0400 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2014-07-30 14:41:44 -0400 |
commit | 42e5fc84e54cc074be470bf8fc49aafae689d268 (patch) | |
tree | 9275b91b6e28ae14bc4dd678c78bd35b029ac682 /crawl-ref/source/util | |
parent | dfe5d2a04b5146e22cdb36d0e4bd5add76b7122a (diff) | |
download | crawl-ref-42e5fc84e54cc074be470bf8fc49aafae689d268.tar.gz crawl-ref-42e5fc84e54cc074be470bf8fc49aafae689d268.zip |
Don't hard-code gourmand in gather_items.
Diffstat (limited to 'crawl-ref/source/util')
-rwxr-xr-x | crawl-ref/source/util/gather_items | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/crawl-ref/source/util/gather_items b/crawl-ref/source/util/gather_items index 04a00d1f81..6d4cb70671 100755 --- a/crawl-ref/source/util/gather_items +++ b/crawl-ref/source/util/gather_items @@ -1,22 +1,32 @@ #!/usr/bin/perl -w my $db = grep /^-d$/, @ARGV; +my %jewellery_prefixes; -sub amulet_name($) +sub jewellery_name($$) { - my $amu = shift; - return "amulet of " . ($amu eq "gourmand" ? "the $amu" : "$amu"); + my ($enum, $name) = @_; + my $prefix = $jewellery_prefixes{$enum} || ""; + my $type = $enum =~ /^AMU_/ ? "amulet" : "ring"; + return "$type of $prefix$name"; } open IN, "util/cpp_version itemname.cc|" or die "Can't read itemname.cc\n"; { undef local $/; $_ = <IN>; } close IN; +# Remove this from the input so the main jewellery pattern doesn't match. +s/^static [^\n]*_jewellery_effect_prefix\([^\n]*\)\n(.*?)^}//ms; +my $prefixes = $1; +$jewellery_prefixes{$1} = $2 + while $prefixes =~ /((?:RING|AMU)_[A-Z_]+): *return "([^"]+)";/g; + $items{"wand of $_"} = 1 for /WAND_[A-Z_]+: *return "([^"]+)";/g; $items{"potion of $_"} = 1 for /POT_[A-Z_]+: *return "([^"]+)";/g; $items{"scroll of $_"} = 1 for /SCR_[A-Z_]+: *return "([^"]+)";/g; -$items{"ring of $_"} = 1 for /RING_[A-Z_]+: *return "([^"]+)";/g; -$items{amulet_name($_) } = 1 for /AMU_[A-Z_]+: *return "([^"]+)";/g; +$items{jewellery_name($1, $2)} = 1 + while /((?:RING|AMU)_[A-Z_]+): *return "([^"]+)";/g; + unless ($db) { $items{"$_ rune of Zot"} = 1 for /RUNE_[A-Z_]+: *return "([^"]+)";/g; |