Revision: | 1.1.1.1 (vendor branch) |
Committed: | Fri Feb 3 07:14:15 2006 UTC (18 years, 5 months ago) by root |
Content type: | text/plain |
Branch: | UPSTREAM, MAIN |
CVS Tags: | LAST_C_VERSION, rel-2_82, rel-2_81, rel-2_80, UPSTREAM_2006_03_15, rel-3_1, rel-3_0, rel-2_6, rel-2_7, rel-2_4, rel-2_5, rel-2_2, rel-2_3, rel-2_0, rel-2_1, rel-2_72, rel-2_73, rel-2_71, rel-2_76, rel-2_77, rel-2_74, rel-2_75, rel-2_54, rel-2_55, rel-2_56, rel-2_79, rel-2_52, rel-2_53, rel-2_32, UPSTREAM_2006_02_22, rel-2_90, rel-2_92, rel-2_93, rel-2_78, rel-2_61, UPSTREAM_2006_02_03, difficulty_fix_merge_060810_2300, rel-2_43, rel-2_42, rel-2_41, HEAD |
Branch point for: | difficulty_fix |
Changes since 1.1: | +0 -0 lines |
Log Message: | initial import |
# | User | Rev | Content |
---|---|---|---|
1 | root | 1.1 | #!/usr/bin/perl |
2 | # | ||
3 | # Usage: archsearch.pl file | ||
4 | # | ||
5 | # This script searches a file (either archetypes or maps) for certain | ||
6 | # desired values. It is better than grep in that it keeps track of the | ||
7 | # the archetype it occurs in and does smarter searches (ie, certain | ||
8 | # bitmask values you can search for specific bit sets, which is not | ||
9 | # easy to do with grep) | ||
10 | # | ||
11 | # Originally written to find all the creatures that use ghosthit. | ||
12 | # Modified to find all object types that are being set invisible | ||
13 | # in pupland | ||
14 | # | ||
15 | |||
16 | |||
17 | die("Usage: archsearch.pl file\n") if ($#ARGV < 0); | ||
18 | |||
19 | for ($file=0; $file<=$#ARGV; $file++) { | ||
20 | # print "Proccessing $ARGV[$file]\n"; | ||
21 | if (!open(INFILE, "<$ARGV[$file]")) { | ||
22 | print "Can not open $ARGV[$file] - skipping\n"; | ||
23 | next; | ||
24 | } | ||
25 | while (<INFILE>) { | ||
26 | if (/^Object (\S+)/ || /^arch (\S+)/) { | ||
27 | $obname = $1; | ||
28 | $invisible=0; | ||
29 | $type=-1; | ||
30 | $x = -1; | ||
31 | $y = -1; | ||
32 | $title=""; | ||
33 | } | ||
34 | $object .= $_; | ||
35 | $type = $1 if (/^type (\S+)/); | ||
36 | $title = $1 if (/^title (\S+)/); | ||
37 | $invisible = $1 if (/^invisible (\S+)/); | ||
38 | $x = $1 if (/^x (\S+)/); | ||
39 | $y = $1 if (/^y (\S+)/); | ||
40 | if (/^end$/ ) { | ||
41 | if ($obname =~ /^altar/ && $title ne "") { | ||
42 | print "$ARGV[$file]\n$object"; | ||
43 | } | ||
44 | # print "Object $obname (type $type) @ $x, $y is invisible\n"; | ||
45 | $object=""; | ||
46 | } | ||
47 | # This is what we are searching for. value will be put in $1 | ||
48 | # Note that multile searches are certainly possible. | ||
49 | # elsif (/^attacktype (\S+)/) { | ||
50 | # if ($1 & 0x200) { | ||
51 | # print "Found match, object $obname, line $.\n"; | ||
52 | # } | ||
53 | # } | ||
54 | |||
55 | } # While loop | ||
56 | } | ||
57 | |||
58 | |||
59 |