summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/util/gen-mst.pl
blob: 87dd25062aa481809434d1c138dec38bc5608bc7 (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
#!/usr/bin/env perl
use strict;
use warnings;

my @mons=();
open IN, "<mon-spll.h" or die "Can't open mon-spll.h\n";
while (<IN>)
{
    push @mons, $1 if /^\s*{\s*(MST_[A-Z_0-9]+),\s*$/;
}
die "Didn't find any MST enums.\n" unless @mons;

open OUT, ">mon-mst.h" or die;
print OUT <<END;
// Autogenerated by util/gen-mst.pl, do not edit.

enum mon_spellbook_type
{
END
print OUT "    $_,\n" for @mons;
print OUT <<END;
    MST_GHOST,
    NUM_MSTYPES,
    MST_NO_SPELLS
};
END