summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-10-22 19:52:01 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-10-22 19:52:01 +0000
commita18daa91c8aa12307c5d73fdb2a83a3cce92d20f (patch)
tree8aa78b4532a1cfcc08666153f9c76f8ba76d6a3c
parentd242b7ebd7927e8eb447ee866777cf48db15ae0c (diff)
downloadmana-a18daa91c8aa12307c5d73fdb2a83a3cce92d20f.tar.gz
mana-a18daa91c8aa12307c5d73fdb2a83a3cce92d20f.tar.bz2
mana-a18daa91c8aa12307c5d73fdb2a83a3cce92d20f.tar.xz
mana-a18daa91c8aa12307c5d73fdb2a83a3cce92d20f.zip
Merged revisions 4145 via svnmerge from
https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/trunk With help from Kess (vargavind) ........ r4145 | b_lindeijer | 2008-04-20 19:29:11 +0200 (Sun, 20 Apr 2008) | 3 lines Added --data parameter to be used to specify where to get the data from when using --skipupdate. ........
-rw-r--r--ChangeLog5
-rw-r--r--src/main.cpp14
2 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 490bd5b6..a48ca311 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -365,6 +365,11 @@
* src/beingmanager.cpp: Fixed a bug, thanks GCC 4.3!
+2008-04-20 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * src/main.cpp: Added --data parameter to be used to specify where to
+ get the data from when using --skipupdate.
+
2008-04-18 David Athay <ko2fan@gmail.com>
* src/game.cpp, src/openglgraphics.cpp: Mac now uses Apple key for
diff --git a/src/main.cpp b/src/main.cpp
index 25dbe127..373dc100 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -148,6 +148,7 @@ struct Options
std::string playername;
std::string configPath;
std::string updateHost;
+ std::string dataPath;
};
/**
@@ -257,6 +258,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();
@@ -430,6 +434,7 @@ void printHelp()
<< " -h --help : Display this help" << std::endl
<< " -v --version : Display the version" << std::endl
<< " -u --skipupdate : Skip the update process" << std::endl
+ << " -d --data : Directory to load game data from" << std::endl
<< " -U --username : Login with this username" << std::endl
<< " -P --password : Login with this password" << std::endl
<< " -D --default : Bypass the login process with default settings" << std::endl
@@ -450,12 +455,13 @@ void printVersion()
void parseOptions(int argc, char *argv[], Options &options)
{
- const char *optstring = "hvuU:P:Dp:C:H:";
+ const char *optstring = "hvud:U:P:Dp:C:H:";
const struct option long_options[] = {
{ "help", no_argument, 0, 'h' },
{ "version", no_argument, 0, 'v' },
{ "skipupdate", no_argument, 0, 'u' },
+ { "data", required_argument, 0, 'd' },
{ "username", required_argument, 0, 'U' },
{ "password", required_argument, 0, 'P' },
{ "default", no_argument, 0, 'D' },
@@ -469,9 +475,8 @@ void parseOptions(int argc, char *argv[], Options &options)
int result = getopt_long(argc, argv, optstring, long_options, NULL);
- if (result == -1) {
+ if (result == -1)
break;
- }
switch (result) {
default: // Unknown option
@@ -484,6 +489,9 @@ void parseOptions(int argc, char *argv[], Options &options)
case 'u':
options.skipUpdate = true;
break;
+ case 'd':
+ options.dataPath = optarg;
+ break;
case 'U':
options.username = optarg;
break;