summaryrefslogtreecommitdiffstats
path: root/Tools/AnvilStats/AnvilStats.cpp
blob: d98c2198593f4a4e47b3a42b4bc6847993cba810 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

// AnvilStats.cpp

// Implements the main app entrypoint

#include "Globals.h"
#include "Processor.h"
#include "Statistics.h"
#include "BiomeMap.h"
#include "HeightMap.h"
#include "HeightBiomeMap.h"
#include "ChunkExtract.h"
#include "SpringStats.h"





int main(int argc, char * argv[])
{
	if (argc < 2)
	{
		LOG("Usage: %s <method number> [<world folder>]", argv[0]);
		LOG("Available methods:");
		LOG("  0 - statistics");
		LOG("  1 - biome map");
		LOG("  2 - height map");
		LOG("  3 - extract chunks");
		LOG("  4 - count lava- and water- springs");
		LOG("  5 - biome and height map");
		LOG("\nNo method number present, aborting.");
		return -1;
	}
	
	AString WorldFolder;
	if (argc > 2)
	{
		WorldFolder = argv[2];
	}
	else
	{
		WorldFolder = "." + cFile::PathSeparator;
	}
	
	cCallbackFactory * Factory = NULL;
	switch (atol(argv[1]))
	{
		case 0: Factory = new cStatisticsFactory;                break;
		case 1: Factory = new cBiomeMapFactory;                  break;
		case 2: Factory = new cHeightMapFactory;                 break;
		case 3: Factory = new cChunkExtractFactory(WorldFolder); break;
		case 4: Factory = new cSpringStatsFactory;               break;
		case 5: Factory = new cHeightBiomeMapFactory;            break;
		default:
		{
			LOG("Unknown method \"%s\", aborting.", argv[1]);
			return -2;
		}
	}
	cProcessor Processor;
	Processor.ProcessWorld(WorldFolder, *Factory);
	
	LOG("Processing finished");
	
	delete Factory;
	
	LOG("Done");
}