summaryrefslogblamecommitdiffstats
path: root/AnvilStats/AnvilStats.cpp
blob: c0b456b968050d592cf3815fb74132a6db37d640 (plain) (tree)
1
2
3
4
5
6
7
8
9





                                      
                       

                        









                                                                            


                                           

















                                                                 
                                                               








                                                                          

                                    







                        

// AnvilStats.cpp

// Implements the main app entrypoint

#include "Globals.h"
#include "Processor.h"
#include "Statistics.h"
#include "BiomeMap.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("\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;
		default:
		{
			LOG("Unknown method \"%s\", aborting.", argv[1]);
			return -2;
		}
	}
	cProcessor Processor;
	Processor.ProcessWorld(WorldFolder, *Factory);
	
	LOG("Processing finished");
	
	delete Factory;
	
	LOG("Done");
}