Loading...   


#include "main.h"
#include "pathing.h"

int main(int argc, char* argv[])
{
#ifdef ECHO_OUTPUT
	if (FILE *file = fopen("debug.txt", "r"))
	{
		fclose(file);
		remove("debug.txt");
	}
#endif
	std::string firstarg = "";
	std::string secondarg = "";
	if (argv[1]) { firstarg = argv[1]; }
	if (argv[2]) { secondarg = argv[2]; console_out("\nDumping " + secondarg + "s....\n\n"); }
	if (firstarg == "all" && argv[2])
	{
		DIR *dir;
		struct dirent *entries;
		dir = opendir(MAP_DIR);
		if (dir != NULL)
		{
			while ((entries = readdir(dir)) != NULL)
			{
				std::string fullname = entries->d_name;
				size_t dotindex = fullname.find_last_of(".");
				size_t lastindex = fullname.length();
				std::string extension = fullname.substr(dotindex + 1, lastindex);
				if (secondarg == "path" && extension == secondarg)
				{
					std::string rawname = fullname.substr(0, dotindex);
					PathManager::LoadPathFile(rawname.c_str());
				}
				if (secondarg == "map" && extension == secondarg)
				{
				}
				if (secondarg == "wtr" && extension == secondarg)
				{
				}
			}
			closedir(dir);
		}
	}
	else if (firstarg != "all" && argv[1] && secondarg == "path") { PathManager::LoadPathFile(argv[1]); }
	else if (firstarg != "all" && argv[1] && secondarg == "map") { }
	else if (firstarg != "all" && argv[1] && secondarg == "wtr") { }
	else if (argv[1] == NULL) { badfile(); }
	else { badfile(); }
}
void badfile() { console_out("\nUsage: EQDump <zone name>\n"); }
void console_out(std::string sender)
{
	std::cout << sender;
#ifdef ECHO_OUTPUT
	PathManager* dumpme = new PathManager;
	dumpme->DumpTextFile(sender, "debug.txt");
#endif
}

Raw Paste Data