forked from mirror/openmw-tes3mp
Switch indentation to spaces to remain consistent with the rest of the project
This commit is contained in:
parent
08df463c94
commit
e6f78ae5b7
4 changed files with 139 additions and 139 deletions
|
@ -69,8 +69,8 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
|||
{
|
||||
// Create a local alias for brevity
|
||||
namespace bpo = boost::program_options;
|
||||
typedef std::vector<Files::EscapeHashString> EscapeStringsVector;
|
||||
typedef std::vector<std::string> StringsVector;
|
||||
typedef std::vector<Files::EscapeHashString> EscapeStringsVector;
|
||||
typedef std::vector<std::string> StringsVector;
|
||||
|
||||
bpo::options_description desc("Syntax: openmw <options>\nAllowed options");
|
||||
|
||||
|
@ -80,16 +80,16 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
|||
("data", bpo::value<Files::PathContainer>()->default_value(Files::PathContainer(), "data")
|
||||
->multitoken()->composing(), "set data directories (later directories have higher priority)")
|
||||
|
||||
("data-local", bpo::value<Files::EscapeHashString>()->default_value(""),
|
||||
("data-local", bpo::value<Files::EscapeHashString>()->default_value(""),
|
||||
"set local data directory (highest priority)")
|
||||
|
||||
("fallback-archive", bpo::value<EscapeStringsVector>()->default_value(EscapeStringsVector(), "fallback-archive")
|
||||
->multitoken(), "set fallback BSA archives (later archives have higher priority)")
|
||||
|
||||
("resources", bpo::value<Files::EscapeHashString>()->default_value("resources"),
|
||||
("resources", bpo::value<Files::EscapeHashString>()->default_value("resources"),
|
||||
"set resources directory")
|
||||
|
||||
("start", bpo::value<Files::EscapeHashString>()->default_value(""),
|
||||
("start", bpo::value<Files::EscapeHashString>()->default_value(""),
|
||||
"set initial cell")
|
||||
|
||||
("content", bpo::value<EscapeStringsVector>()->default_value(EscapeStringsVector(), "")
|
||||
|
@ -110,7 +110,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
|||
("script-console", bpo::value<bool>()->implicit_value(true)
|
||||
->default_value(false), "enable console-only script functionality")
|
||||
|
||||
("script-run", bpo::value<Files::EscapeHashString>()->default_value(""),
|
||||
("script-run", bpo::value<Files::EscapeHashString>()->default_value(""),
|
||||
"select a file containing a list of console commands that is executed on startup")
|
||||
|
||||
("script-warn", bpo::value<int>()->implicit_value (1)
|
||||
|
@ -126,7 +126,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
|||
("script-blacklist-use", bpo::value<bool>()->implicit_value(true)
|
||||
->default_value(true), "enable script blacklisting")
|
||||
|
||||
("load-savegame", bpo::value<Files::EscapeHashString>()->default_value(""),
|
||||
("load-savegame", bpo::value<Files::EscapeHashString>()->default_value(""),
|
||||
"load a save game file on game startup (specify an absolute filename or a filename relative to the current working directory)")
|
||||
|
||||
("skip-menu", bpo::value<bool>()->implicit_value(true)
|
||||
|
@ -138,14 +138,14 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
|||
("fs-strict", bpo::value<bool>()->implicit_value(true)
|
||||
->default_value(false), "strict file system handling (no case folding)")
|
||||
|
||||
("encoding", bpo::value<Files::EscapeHashString>()->
|
||||
("encoding", bpo::value<Files::EscapeHashString>()->
|
||||
default_value("win1252"),
|
||||
"Character encoding used in OpenMW game messages:\n"
|
||||
"\n\twin1250 - Central and Eastern European such as Polish, Czech, Slovak, Hungarian, Slovene, Bosnian, Croatian, Serbian (Latin script), Romanian and Albanian languages\n"
|
||||
"\n\twin1251 - Cyrillic alphabet such as Russian, Bulgarian, Serbian Cyrillic and other languages\n"
|
||||
"\n\twin1252 - Western European (Latin) alphabet, used by default")
|
||||
|
||||
("fallback", bpo::value<FallbackMap>()->default_value(FallbackMap(), "")
|
||||
("fallback", bpo::value<FallbackMap>()->default_value(FallbackMap(), "")
|
||||
->multitoken()->composing(), "fallback values")
|
||||
|
||||
("no-grab", "Don't grab mouse cursor")
|
||||
|
@ -215,7 +215,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
|||
|
||||
engine.setResourceDir(variables["resources"].as<Files::EscapeHashString>().toStdString());
|
||||
|
||||
StringsVector content = Files::EscapeHashString::toStdStringVector(variables["content"].as<EscapeStringsVector>());
|
||||
StringsVector content = Files::EscapeHashString::toStdStringVector(variables["content"].as<EscapeStringsVector>());
|
||||
if (content.empty())
|
||||
{
|
||||
std::cout << "No content file given (esm/esp, nor omwgame/omwaddon). Aborting..." << std::endl;
|
||||
|
@ -248,7 +248,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
|||
|
||||
// other settings
|
||||
engine.setSoundUsage(!variables["no-sound"].as<bool>());
|
||||
engine.setFallbackValues(variables["fallback"].as<FallbackMap>().mMap);
|
||||
engine.setFallbackValues(variables["fallback"].as<FallbackMap>().mMap);
|
||||
engine.setActivationDistanceOverride (variables["activate-dist"].as<int>());
|
||||
engine.enableFontExport(variables["export-fonts"].as<bool>());
|
||||
|
||||
|
|
|
@ -12,49 +12,49 @@
|
|||
namespace Fallback
|
||||
{
|
||||
|
||||
struct FallbackMap {
|
||||
std::map<std::string, std::string> mMap;
|
||||
};
|
||||
struct FallbackMap {
|
||||
std::map<std::string, std::string> mMap;
|
||||
};
|
||||
|
||||
void validate(boost::any &v, std::vector<std::string> const &tokens, FallbackMap*, int)
|
||||
{
|
||||
if (v.empty())
|
||||
{
|
||||
v = boost::any(FallbackMap());
|
||||
}
|
||||
void validate(boost::any &v, std::vector<std::string> const &tokens, FallbackMap*, int)
|
||||
{
|
||||
if (v.empty())
|
||||
{
|
||||
v = boost::any(FallbackMap());
|
||||
}
|
||||
|
||||
FallbackMap *map = boost::any_cast<FallbackMap>(&v);
|
||||
FallbackMap *map = boost::any_cast<FallbackMap>(&v);
|
||||
|
||||
for (std::vector<std::string>::const_iterator it = tokens.begin(); it != tokens.end(); ++it)
|
||||
{
|
||||
std::string temp = Files::EscapeHashString::processString(*it);
|
||||
int sep = temp.find(",");
|
||||
if (sep < 1 || sep == (int)temp.length() - 1)
|
||||
for (std::vector<std::string>::const_iterator it = tokens.begin(); it != tokens.end(); ++it)
|
||||
{
|
||||
std::string temp = Files::EscapeHashString::processString(*it);
|
||||
int sep = temp.find(",");
|
||||
if (sep < 1 || sep == (int)temp.length() - 1)
|
||||
#if (BOOST_VERSION < 104200)
|
||||
throw boost::program_options::validation_error("invalid value");
|
||||
throw boost::program_options::validation_error("invalid value");
|
||||
#else
|
||||
throw boost::program_options::validation_error(boost::program_options::validation_error::invalid_option_value);
|
||||
throw boost::program_options::validation_error(boost::program_options::validation_error::invalid_option_value);
|
||||
#endif
|
||||
|
||||
std::string key(temp.substr(0, sep));
|
||||
std::string value(temp.substr(sep + 1));
|
||||
std::string key(temp.substr(0, sep));
|
||||
std::string value(temp.substr(sep + 1));
|
||||
|
||||
if (map->mMap.find(key) == map->mMap.end())
|
||||
{
|
||||
map->mMap.insert(std::make_pair(key, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (map->mMap.find(key) == map->mMap.end())
|
||||
{
|
||||
map->mMap.insert(std::make_pair(key, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Files {
|
||||
void validate(boost::any &v, const std::vector<std::string> &tokens, Files::EscapeHashString * eHS, int a)
|
||||
{
|
||||
boost::program_options::validators::check_first_occurrence(v);
|
||||
|
||||
if (v.empty())
|
||||
v = boost::any(EscapeHashString(boost::program_options::validators::get_single_string(tokens)));
|
||||
}
|
||||
void validate(boost::any &v, const std::vector<std::string> &tokens, Files::EscapeHashString * eHS, int a)
|
||||
{
|
||||
boost::program_options::validators::check_first_occurrence(v);
|
||||
|
||||
if (v.empty())
|
||||
v = boost::any(EscapeHashString(boost::program_options::validators::get_single_string(tokens)));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -142,9 +142,9 @@ bool ConfigurationManager::loadConfig(const boost::filesystem::path& path,
|
|||
std::cout << "Loading config file: " << cfgFile.string() << "... ";
|
||||
|
||||
boost::filesystem::ifstream configFileStreamUnfiltered(cfgFile);
|
||||
boost::iostreams::filtering_istream configFileStream;
|
||||
configFileStream.push(escape_hash_filter());
|
||||
configFileStream.push(configFileStreamUnfiltered);
|
||||
boost::iostreams::filtering_istream configFileStream;
|
||||
configFileStream.push(escape_hash_filter());
|
||||
configFileStream.push(configFileStreamUnfiltered);
|
||||
if (configFileStreamUnfiltered.is_open())
|
||||
{
|
||||
boost::program_options::store(boost::program_options::parse_config_file(
|
||||
|
@ -179,80 +179,80 @@ escape_hash_filter::~escape_hash_filter()
|
|||
template <typename Source>
|
||||
int escape_hash_filter::get(Source & src)
|
||||
{
|
||||
if (mNext.empty())
|
||||
{
|
||||
int character = boost::iostreams::get(src);
|
||||
bool record = true;
|
||||
if (character == boost::iostreams::WOULD_BLOCK)
|
||||
{
|
||||
mNext.push(character);
|
||||
record = false;
|
||||
}
|
||||
else if (character == EOF)
|
||||
{
|
||||
mSeenNonWhitespace = false;
|
||||
mFinishLine = false;
|
||||
mNext.push(character);
|
||||
}
|
||||
else if (character == '\n')
|
||||
{
|
||||
mSeenNonWhitespace = false;
|
||||
mFinishLine = false;
|
||||
mNext.push(character);
|
||||
}
|
||||
else if (mFinishLine)
|
||||
{
|
||||
mNext.push(character);
|
||||
}
|
||||
else if (character == '#')
|
||||
{
|
||||
if (mSeenNonWhitespace)
|
||||
{
|
||||
mNext.push(sEscape);
|
||||
mNext.push(sHashIdentifier);
|
||||
}
|
||||
else
|
||||
{
|
||||
//it's fine being interpreted by Boost as a comment, and so is anything afterwards
|
||||
mNext.push(character);
|
||||
mFinishLine = true;
|
||||
}
|
||||
}
|
||||
else if (mPrevious == sEscape)
|
||||
{
|
||||
mNext.push(sEscape);
|
||||
mNext.push(sEscapeIdentifier);
|
||||
}
|
||||
else
|
||||
{
|
||||
mNext.push(character);
|
||||
}
|
||||
if (!mSeenNonWhitespace && !isspace(character))
|
||||
mSeenNonWhitespace = true;
|
||||
if (record)
|
||||
mPrevious = character;
|
||||
}
|
||||
int retval = mNext.front();
|
||||
mNext.pop();
|
||||
return retval;
|
||||
if (mNext.empty())
|
||||
{
|
||||
int character = boost::iostreams::get(src);
|
||||
bool record = true;
|
||||
if (character == boost::iostreams::WOULD_BLOCK)
|
||||
{
|
||||
mNext.push(character);
|
||||
record = false;
|
||||
}
|
||||
else if (character == EOF)
|
||||
{
|
||||
mSeenNonWhitespace = false;
|
||||
mFinishLine = false;
|
||||
mNext.push(character);
|
||||
}
|
||||
else if (character == '\n')
|
||||
{
|
||||
mSeenNonWhitespace = false;
|
||||
mFinishLine = false;
|
||||
mNext.push(character);
|
||||
}
|
||||
else if (mFinishLine)
|
||||
{
|
||||
mNext.push(character);
|
||||
}
|
||||
else if (character == '#')
|
||||
{
|
||||
if (mSeenNonWhitespace)
|
||||
{
|
||||
mNext.push(sEscape);
|
||||
mNext.push(sHashIdentifier);
|
||||
}
|
||||
else
|
||||
{
|
||||
//it's fine being interpreted by Boost as a comment, and so is anything afterwards
|
||||
mNext.push(character);
|
||||
mFinishLine = true;
|
||||
}
|
||||
}
|
||||
else if (mPrevious == sEscape)
|
||||
{
|
||||
mNext.push(sEscape);
|
||||
mNext.push(sEscapeIdentifier);
|
||||
}
|
||||
else
|
||||
{
|
||||
mNext.push(character);
|
||||
}
|
||||
if (!mSeenNonWhitespace && !isspace(character))
|
||||
mSeenNonWhitespace = true;
|
||||
if (record)
|
||||
mPrevious = character;
|
||||
}
|
||||
int retval = mNext.front();
|
||||
mNext.pop();
|
||||
return retval;
|
||||
}
|
||||
|
||||
std::string EscapeHashString::processString(const std::string & str)
|
||||
{
|
||||
std::string temp = boost::replace_all_copy<std::string>(str, std::string() + (char)escape_hash_filter::sEscape + (char)escape_hash_filter::sHashIdentifier, "#");
|
||||
boost::replace_all(temp, std::string() + (char)escape_hash_filter::sEscape + (char)escape_hash_filter::sEscapeIdentifier, std::string((char) escape_hash_filter::sEscape, 1));
|
||||
return temp;
|
||||
std::string temp = boost::replace_all_copy<std::string>(str, std::string() + (char)escape_hash_filter::sEscape + (char)escape_hash_filter::sHashIdentifier, "#");
|
||||
boost::replace_all(temp, std::string() + (char)escape_hash_filter::sEscape + (char)escape_hash_filter::sEscapeIdentifier, std::string((char) escape_hash_filter::sEscape, 1));
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> EscapeHashString::toStdStringVector(const std::vector<EscapeHashString> & vec)
|
||||
{
|
||||
std::vector<std::string> temp = std::vector<std::string>();
|
||||
for (std::vector<EscapeHashString>::const_iterator it = vec.begin(); it != vec.end(); ++it)
|
||||
{
|
||||
temp.push_back(it->toStdString());
|
||||
}
|
||||
return temp;
|
||||
std::vector<std::string> temp = std::vector<std::string>();
|
||||
for (std::vector<EscapeHashString>::const_iterator it = vec.begin(); it != vec.end(); ++it)
|
||||
{
|
||||
temp.push_back(it->toStdString());
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
EscapeHashString::EscapeHashString() : mData()
|
||||
|
@ -286,12 +286,12 @@ EscapeHashString::EscapeHashString(InputIterator first, InputIterator last) : mD
|
|||
|
||||
std::string EscapeHashString::toStdString() const
|
||||
{
|
||||
return std::string(mData);
|
||||
return std::string(mData);
|
||||
}
|
||||
|
||||
std::string * EscapeHashString::toStdStringPtr() const
|
||||
{
|
||||
return new std::string(mData);
|
||||
return new std::string(mData);
|
||||
}
|
||||
|
||||
const boost::filesystem::path& ConfigurationManager::getGlobalPath() const
|
||||
|
|
|
@ -71,21 +71,21 @@ struct ConfigurationManager
|
|||
*/
|
||||
struct escape_hash_filter : public boost::iostreams::input_filter
|
||||
{
|
||||
static const int sEscape;
|
||||
static const int sHashIdentifier;
|
||||
static const int sEscapeIdentifier;
|
||||
static const int sEscape;
|
||||
static const int sHashIdentifier;
|
||||
static const int sEscapeIdentifier;
|
||||
|
||||
escape_hash_filter();
|
||||
virtual ~escape_hash_filter();
|
||||
escape_hash_filter();
|
||||
virtual ~escape_hash_filter();
|
||||
|
||||
template <typename Source> int get(Source & src);
|
||||
template <typename Source> int get(Source & src);
|
||||
|
||||
private:
|
||||
std::queue<int> mNext;
|
||||
int mPrevious;
|
||||
private:
|
||||
std::queue<int> mNext;
|
||||
int mPrevious;
|
||||
|
||||
bool mSeenNonWhitespace;
|
||||
bool mFinishLine;
|
||||
bool mSeenNonWhitespace;
|
||||
bool mFinishLine;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -93,23 +93,23 @@ struct escape_hash_filter : public boost::iostreams::input_filter
|
|||
*/
|
||||
class EscapeHashString : public std::string
|
||||
{
|
||||
private:
|
||||
std::string mData;
|
||||
public:
|
||||
static std::string processString(const std::string & str);
|
||||
static std::vector<std::string> toStdStringVector(const std::vector<EscapeHashString> & vec);
|
||||
private:
|
||||
std::string mData;
|
||||
public:
|
||||
static std::string processString(const std::string & str);
|
||||
static std::vector<std::string> toStdStringVector(const std::vector<EscapeHashString> & vec);
|
||||
|
||||
EscapeHashString();
|
||||
EscapeHashString(const std::string & str);
|
||||
EscapeHashString(const std::string & str, size_t pos, size_t len = std::string::npos);
|
||||
EscapeHashString(const char * s);
|
||||
EscapeHashString(const char * s, size_t n);
|
||||
EscapeHashString(size_t n, char c);
|
||||
template <class InputIterator>
|
||||
EscapeHashString(InputIterator first, InputIterator last);
|
||||
EscapeHashString();
|
||||
EscapeHashString(const std::string & str);
|
||||
EscapeHashString(const std::string & str, size_t pos, size_t len = std::string::npos);
|
||||
EscapeHashString(const char * s);
|
||||
EscapeHashString(const char * s, size_t n);
|
||||
EscapeHashString(size_t n, char c);
|
||||
template <class InputIterator>
|
||||
EscapeHashString(InputIterator first, InputIterator last);
|
||||
|
||||
std::string toStdString() const;
|
||||
std::string * toStdStringPtr() const;
|
||||
std::string toStdString() const;
|
||||
std::string * toStdStringPtr() const;
|
||||
};
|
||||
|
||||
} /* namespace Cfg */
|
||||
|
|
Loading…
Reference in a new issue