summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-04-20 17:29:11 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-04-20 17:29:11 +0000
commit7abe3450b3500bc1f1cc55ccea28d91f12dad178 (patch)
tree5f082e793ff77c6ecba892e2f3237ff8adb526fa
parent843cfe68a7dc43f14522f80725627599c949b70d (diff)
downloadmana-7abe3450b3500bc1f1cc55ccea28d91f12dad178.tar.gz
mana-7abe3450b3500bc1f1cc55ccea28d91f12dad178.tar.bz2
mana-7abe3450b3500bc1f1cc55ccea28d91f12dad178.tar.xz
mana-7abe3450b3500bc1f1cc55ccea28d91f12dad178.zip
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.cpp20
2 files changed, 19 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 4e672369..9d0c7b19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+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-19 Yohann Ferreira <bertram@cegetel.net>
* src/gui/char_select.cpp: Made the client clean characters
diff --git a/src/main.cpp b/src/main.cpp
index cc137752..4aadbb74 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -140,6 +140,7 @@ struct Options
std::string playername;
std::string password;
std::string configPath;
+ std::string dataPath;
std::string serverName;
short serverPort;
@@ -220,7 +221,7 @@ void initConfiguration(const Options &options)
/**
* Do all initialization stuff.
*/
-void initEngine()
+void initEngine(const Options &options)
{
// Initialize SDL
logger->log("Initializing SDL...");
@@ -273,7 +274,10 @@ void initEngine()
}
}
- // Add the main data directory to our PhysicsFS search path
+ // Add the main data directories to our PhysicsFS search path
+ if (!options.dataPath.empty()) {
+ resman->addToSearchPath(options.dataPath, true);
+ }
resman->addToSearchPath("data", true);
#if defined __APPLE__
CFBundleRef mainBundle = CFBundleGetMainBundle();
@@ -381,6 +385,7 @@ void printHelp()
" -h --help : Display this help\n"
" -v --version : Display the version\n"
" -u --skipupdate : Skip the update process\n"
+ " -d --data : Directory to load game data from\n"
" -U --username : Login with this username\n"
" -P --password : Login with this password\n"
" -D --default : Bypass the login process with default settings\n"
@@ -402,12 +407,13 @@ void printVersion()
void parseOptions(int argc, char *argv[], Options &options)
{
- const char *optstring = "hvuU:P:Dp:s:o:C:";
+ const char *optstring = "hvud:U:P:Dp:s:o:C:";
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' },
@@ -421,9 +427,8 @@ void parseOptions(int argc, char *argv[], Options &options)
while (optind < argc) {
int result = getopt_long(argc, argv, optstring, long_options, NULL);
- if (result == -1) {
+ if (result == -1)
break;
- }
switch (result) {
default: // Unknown option
@@ -436,6 +441,9 @@ void parseOptions(int argc, char *argv[], Options &options)
case 'u':
options.skipUpdate = true;
break;
+ case 'd':
+ options.dataPath = optarg;
+ break;
case 'U':
options.playername = optarg;
break;
@@ -728,7 +736,7 @@ int main(int argc, char *argv[])
initXML();
initConfiguration(options);
- initEngine();
+ initEngine(options);
Game *game = NULL;
Window *currentDialog = NULL;