core: fix arguments check crash
This commit is contained in:
parent
6e7ae19e8b
commit
64c5c5d20e
16
src/main.cpp
16
src/main.cpp
@ -4,23 +4,21 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[]) {
|
||||||
{
|
std::vector<std::string> args(argv, argv + argc);
|
||||||
std::vector<std::string> args{argv + 1, argv + argc};
|
g_pEngine = std::make_unique<GameEngine>();
|
||||||
for (auto it = args.begin(); it != args.end(); it++) {
|
for (int i = 1; i < args.size(); ++i) {
|
||||||
if (it->compare("--no-gui") == 0) {
|
if (args[i].compare("--no-gui") == 0) {
|
||||||
g_pEngine->state.m_bNoDisplay = true;
|
g_pEngine->state.m_bNoDisplay = true;
|
||||||
std::cout << "[LOG - Main] Disabling display" << std::endl;
|
std::cout << "[LOG - Main] Disabling display" << std::endl;
|
||||||
} else if (it->compare("--bot") == 0) {
|
} else if (args[i].compare("--bot") == 0) {
|
||||||
g_pEngine->state.m_bIsBotControlled = true;
|
g_pEngine->state.m_bIsBotControlled = true;
|
||||||
std::cout << "[LOG - Main] Bot control enabled" << std::endl;
|
std::cout << "[LOG - Main] Bot control enabled" << std::endl;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "[ERROR] Argument option not found, exiting..." << std::endl;
|
std::cerr << "[ERROR] Argument " << args[i].c_str() << "not found, exiting..." << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_pEngine = std::make_unique<GameEngine>();
|
|
||||||
g_pEngine->Start();
|
g_pEngine->Start();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user