2010-02-28 13:51:17 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
2010-06-11 17:53:00 +00:00
|
|
|
#include <string>
|
|
|
|
#include <fstream>
|
|
|
|
|
2010-06-15 17:04:52 +00:00
|
|
|
#include <boost/program_options.hpp>
|
|
|
|
#include <boost/filesystem.hpp>
|
2010-06-10 08:31:50 +00:00
|
|
|
|
2010-06-16 10:13:21 +00:00
|
|
|
#include "engine.hpp"
|
2010-02-28 13:51:17 +00:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2010-06-15 17:04:52 +00:00
|
|
|
void maintest (boost::filesystem::path dataDir, const std::string& cellName,
|
|
|
|
std::string master)
|
2010-06-03 18:44:55 +00:00
|
|
|
{
|
2010-06-15 17:04:52 +00:00
|
|
|
assert (!dataDir.empty());
|
2010-06-11 17:53:00 +00:00
|
|
|
|
2010-06-16 10:13:21 +00:00
|
|
|
OMW::Engine engine;
|
2010-06-06 11:48:20 +00:00
|
|
|
|
2010-06-16 10:13:21 +00:00
|
|
|
engine.setDataDir (dataDir);
|
2010-06-06 11:48:20 +00:00
|
|
|
|
2010-06-16 10:13:21 +00:00
|
|
|
engine.setCell (cellName);
|
2010-06-05 18:37:01 +00:00
|
|
|
|
2010-06-16 10:13:21 +00:00
|
|
|
engine.addMaster (master);
|
2010-06-05 18:37:01 +00:00
|
|
|
|
2010-06-16 10:13:21 +00:00
|
|
|
engine.go();
|
2010-02-28 13:51:17 +00:00
|
|
|
}
|
|
|
|
|
2010-06-10 08:31:50 +00:00
|
|
|
int main(int argc, char**argv)
|
2010-02-28 13:51:17 +00:00
|
|
|
{
|
2010-06-10 08:31:50 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
boost::program_options::options_description desc (
|
|
|
|
"Syntax: openmw <options>\nAllowed options");
|
|
|
|
|
|
|
|
desc.add_options()
|
2010-06-11 17:53:00 +00:00
|
|
|
("help", "print help message")
|
|
|
|
("data", boost::program_options::value<std::string>()->default_value ("data"),
|
2010-06-12 09:49:37 +00:00
|
|
|
"set data directory")
|
|
|
|
("start", boost::program_options::value<std::string>()->default_value ("Beshara"),
|
|
|
|
"set initial cell (only interior cells supported at the moment")
|
2010-06-15 17:04:52 +00:00
|
|
|
("master", boost::program_options::value<std::string>()->default_value ("Morrowind"),
|
|
|
|
"master file")
|
2010-06-12 09:49:37 +00:00
|
|
|
;
|
2010-06-10 08:31:50 +00:00
|
|
|
|
|
|
|
boost::program_options::variables_map variables;
|
2010-06-11 17:53:00 +00:00
|
|
|
|
|
|
|
std::ifstream configFile ("openmw.cfg");
|
|
|
|
|
2010-06-10 08:31:50 +00:00
|
|
|
boost::program_options::store (
|
|
|
|
boost::program_options::parse_command_line (argc, argv, desc), variables);
|
|
|
|
boost::program_options::notify (variables);
|
|
|
|
|
2010-06-11 17:53:00 +00:00
|
|
|
if (configFile.is_open())
|
|
|
|
boost::program_options::store (
|
|
|
|
boost::program_options::parse_config_file (configFile, desc), variables);
|
|
|
|
|
2010-06-10 08:31:50 +00:00
|
|
|
if (variables.count ("help"))
|
|
|
|
{
|
|
|
|
std::cout << desc << std::endl;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-06-15 17:04:52 +00:00
|
|
|
maintest (variables["data"].as<std::string>(), variables["start"].as<std::string>(),
|
|
|
|
variables["master"].as<std::string>());
|
2010-06-10 08:31:50 +00:00
|
|
|
}
|
|
|
|
}
|
2010-02-28 13:51:17 +00:00
|
|
|
catch(exception &e)
|
|
|
|
{
|
|
|
|
cout << "\nERROR: " << e.what() << endl;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|