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:
parent
4ff36696ea
commit
71a3c2fcd1
2 changed files with 31 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue