1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Allow directly supplying world as a parameter, including world.mt

This commit is contained in:
Perttu Ahola 2012-03-13 01:32:21 +02:00
parent 4ff36696ea
commit 71a3c2fcd1
2 changed files with 31 additions and 4 deletions

View file

@ -330,6 +330,7 @@ public:
bool parseCommandLine(int argc, char *argv[],
core::map<std::string, ValueSpec> &allowed_options)
{
int nonopt_index = 0;
int i=1;
for(;;)
{
@ -338,6 +339,15 @@ public:
std::string argname = argv[i];
if(argname.substr(0, 2) != "--")
{
// If option doesn't start with -, read it in as nonoptX
if(argname[0] != '-'){
std::string name = "nonopt";
name += itos(nonopt_index);
set(name, argname);
nonopt_index++;
i++;
continue;
}
errorstream<<"Invalid command-line parameter \""
<<argname<<"\": --<option> expected."<<std::endl;
return false;