iw4x-client/src/Components/Modules/Flags.cpp

46 lines
741 B
C++
Raw Normal View History

#include "STDInclude.hpp"
2016-01-03 18:00:07 -05:00
namespace Components
{
std::vector<std::string> Flags::EnabledFlags;
bool Flags::HasFlag(std::string flag)
{
for (auto entry : Flags::EnabledFlags)
{
if (Utils::StrToLower(entry) == Utils::StrToLower(flag))
{
return true;
}
}
return false;
}
void Flags::ParseFlags()
{
int numArgs;
LPCWSTR commandLine = GetCommandLineW();
LPWSTR* argv = CommandLineToArgvW(commandLine, &numArgs);
2016-01-24 13:58:13 -05:00
for (int i = 0; i < numArgs; ++i)
2016-01-03 18:00:07 -05:00
{
std::wstring wFlag = argv[i];
if (wFlag[0] == L'-')
{
Flags::EnabledFlags.push_back(std::string(++wFlag.begin(), wFlag.end()));
}
}
}
Flags::Flags()
{
Flags::ParseFlags();
}
Flags::~Flags()
{
Flags::EnabledFlags.clear();
}
}