Ejemplo n.º 1
0
bool validateParamsFull(const string& inputpath, const string& outputpath, const string& imgpath, const MapParams& mp, int threads, const string& chunklist, const string& regionlist, bool expand, const string& htmlpath)
{
	// -c and -x are not allowed for full renders
	if (!chunklist.empty() || !regionlist.empty() || expand)
	{
		cerr << "-c, -r, -x not allowed for full renders" << endl;
		return false;
	}

	// B and T must be within range (upper limits aren't really necessary and can be adjusted if
	//  someone really wants gigantic tile images for some reason)
	if (!mp.valid())
	{
		cerr << "-B must be in range 2-16; -T must be in range 1-16" << endl;
		return false;
	}

	// baseZoom must be within range, or -1 (omitted)
	if (!mp.validZoom() && mp.baseZoom != -1)
	{
		cerr << "-Z must be in range 0-30, or may be omitted to set automatically" << endl;
		return false;
	}

	// MINY/MAXY must describe a valid range
	if (!mp.validYRange())
	{
		cerr << "-y and -Y, if used, must be in range 0-255, and -y must be <= -Y" << endl;
		return false;
	}

	// must have a sensible number of threads (upper limit is arbitrary, but you'd need a truly
	//  insanely large map to see any benefit to having that many...)
	if (threads < 1 || threads > 64)
	{
		cerr << "-h must be in range 1-64" << endl;
		return false;
	}

	// the various paths must be non-empty
	if (inputpath.empty() || outputpath.empty())
	{
		cerr << "must provide both input (-i) and output (-o) paths" << endl;
		return false;
	}
	if (imgpath.empty())
	{
		cerr << "must provide non-empty image path, or omit -g to use \".\"" << endl;
		return false;
	}
	if (htmlpath.empty())
	{
		cerr << "must provide non-empty HTML path, or omit -m to use \".\"" << endl;
		return false;
	}

	return true;
}
Ejemplo n.º 2
0
bool validateParamsTest(const string& inputpath, const string& outputpath, const string& imgpath, const MapParams& mp, int threads, const string& chunklist, const string& regionlist, bool expand, const string& htmlpath, int testworldsize)
{
	// -i, -o, -c, -r, -x, -m are not allowed
	if (!inputpath.empty() || !outputpath.empty() || !chunklist.empty() || !regionlist.empty() || expand || htmlpath != ".")
	{
		cerr << "-i, -o, -c, -r, -x, -m not allowed for test worlds" << endl;
		return false;
	}

	// B and T must be within range (upper limits aren't really necessary and can be adjusted if
	//  someone really wants gigantic tile images for some reason)
	if (!mp.valid())
	{
		cerr << "-B must be in range 2-16; -T must be in range 1-16" << endl;
		return false;
	}

	// baseZoom must be within range, or -1 (omitted)
	if (!mp.validZoom() && mp.baseZoom != -1)
	{
		cerr << "-Z must be in range 0-30, or may be omitted to set automatically" << endl;
		return false;
	}
	
	// MINY/MAXY must describe a valid range
	if (!mp.validYRange())
	{
		cerr << "-y and -Y, if used, must be in range 0-255, and -y must be <= -Y" << endl;
		return false;
	}

	// must have a sensible number of threads (upper limit is arbitrary, but you'd need a truly
	//  insanely large map to see any benefit to having that many...)
	if (threads < 1 || threads > 64)
	{
		cerr << "-h must be in range 1-64" << endl;
		return false;
	}

	// image path must be non-empty
	if (imgpath.empty())
	{
		cerr << "must provide non-empty image path, or omit -g to use \".\"" << endl;
		return false;
	}

	// test world size must be positive
	if (testworldsize < 0)
	{
		cerr << "testworld size must be positive" << endl;
		return false;
	}

	return true;
}