summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2008-10-25 20:52:41 +0000
committerIra Rice <irarice@gmail.com>2008-10-25 20:52:41 +0000
commitf6ddb12a5c6eb85830a1f2d8188addfd14b5e1f1 (patch)
treec20e8e63b3fc64f4dbe64c09fd9f023ec1ba9f14 /src/main.cpp
parentbea2e395de77924e9bf88e4629249a1882e41963 (diff)
downloadmana-f6ddb12a5c6eb85830a1f2d8188addfd14b5e1f1.tar.gz
mana-f6ddb12a5c6eb85830a1f2d8188addfd14b5e1f1.tar.bz2
mana-f6ddb12a5c6eb85830a1f2d8188addfd14b5e1f1.tar.xz
mana-f6ddb12a5c6eb85830a1f2d8188addfd14b5e1f1.zip
Imported --data parameter from TMW.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp66
1 files changed, 37 insertions, 29 deletions
diff --git a/src/main.cpp b/src/main.cpp
index b92a4b2d..b57027d6 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -265,6 +265,9 @@ void init_engine(const Options &options)
resman->addToSearchPath(homeDir, false);
// Add the main data directory to our PhysicsFS search path
+ if (!options.dataPath.empty()) {
+ resman->addToSearchPath(options.dataPath, true);
+ }
resman->addToSearchPath("data", true);
#if defined __APPLE__
CFBundleRef mainBundle = CFBundleGetMainBundle();
@@ -436,16 +439,17 @@ void printHelp()
std::cout
<< "aethyra" << std::endl << std::endl
<< "Options: " << std::endl
- << " -h --help : Display this help" << std::endl
- << " -v --version : Display the version" << std::endl
- << " -u --skipupdate : Skip the update downloads" << std::endl
- << " -U --username : Login with this username" << std::endl
- << " -P --password : Login with this password" << std::endl
+ << " -C --configfile : Configuration file to use" << std::endl
+ << " -d --data : Directory to load game data from" << std::endl
<< " -D --default : Bypass the login process with default "
"settings" << std::endl
- << " -p --playername : Login with this player" << std::endl
- << " -C --configfile : Configuration file to use" << std::endl
+ << " -h --help : Display this help" << std::endl
<< " -H --updatehost : Use this update host" << std::endl;
+ << " -p --playername : Login with this player" << std::endl
+ << " -P --password : Login with this password" << std::endl
+ << " -u --skipupdate : Skip the update downloads" << std::endl
+ << " -U --username : Login with this username" << std::endl
+ << " -v --version : Display the version" << std::endl
}
void printVersion()
@@ -464,15 +468,16 @@ void parseOptions(int argc, char *argv[], Options &options)
const char *optstring = "hvuU:P:Dp:C:H:";
const struct option long_options[] = {
- { "help", no_argument, 0, 'h' },
- { "version", no_argument, 0, 'v' },
- { "skipupdate", no_argument, 0, 'u' },
- { "username", required_argument, 0, 'U' },
- { "password", required_argument, 0, 'P' },
+ { "configfile", required_argument, 0, 'C' },
+ { "data", required_argument, 0, 'd' },
{ "default", no_argument, 0, 'D' },
{ "playername", required_argument, 0, 'p' },
- { "configfile", required_argument, 0, 'C' },
+ { "password", required_argument, 0, 'P' },
+ { "help", no_argument, 0, 'h' },
{ "updatehost", required_argument, 0, 'H' },
+ { "skipupdate", no_argument, 0, 'u' },
+ { "username", required_argument, 0, 'U' },
+ { "version", no_argument, 0, 'v' },
{ 0 }
};
@@ -485,33 +490,36 @@ void parseOptions(int argc, char *argv[], Options &options)
}
switch (result) {
+ case 'C':
+ options.configPath = optarg;
+ break;
+ case 'd':
+ options.dataPath = optarg;
+ break;
+ case 'D':
+ options.chooseDefault = true;
+ break;
default: // Unknown option
case 'h':
options.printHelp = true;
break;
- case 'v':
- options.printVersion = true;
- break;
- case 'u':
- options.skipUpdate = true;
+ case 'H':
+ options.updateHost = optarg;
break;
- case 'U':
- options.username = optarg;
+ case 'p':
+ options.playername = optarg;
break;
case 'P':
options.password = optarg;
break;
- case 'D':
- options.chooseDefault = true;
- break;
- case 'p':
- options.playername = optarg;
+ case 'u':
+ options.skipUpdate = true;
break;
- case 'C':
- options.configPath = optarg;
+ case 'U':
+ options.username = optarg;
break;
- case 'H':
- options.updateHost = optarg;
+ case 'v':
+ options.printVersion = true;
break;
}
}