broken seed computer is the same as invisible one
[spelunky_yasmk8.git] / tools / checkids.d
blobb4114a7cec240099bb4bb4eb483e5d58afbe7bb0
1 import arsd.dom;
3 string[uint] idmap;
5 int main (string[] args) {
6 foreach (string fname; args[1..$]) {
7 import std.file : readText;
8 auto doc = new Document(readText(fname));
9 auto obj = doc.querySelector("object[id]");
10 if (obj) {
11 import std.conv : to;
12 auto id = to!uint(obj.getAttribute("id"));
13 if (auto pname = id in idmap) {
14 import std.stdio;
15 writeln("DUPLICATE ID ", id, " for object '", fname, "' (previous: '", *pname, "'");
16 //return -1;
17 } else {
18 idmap[id] = fname;
23 import std.algorithm : sort;
24 import std.stdio;
25 uint[] ids;
26 foreach (uint id; idmap.byKey) ids ~= id;
27 ids.sort;
28 //foreach (uint id; ids) writeln(id);
29 writeln("minimal: ", ids[0]);
30 writeln("maximal: ", ids[$-1]);
32 return 0;