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 <iostream>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
std::vector<std::string> args{argv + 1, argv + argc};
|
||||
for (auto it = args.begin(); it != args.end(); it++) {
|
||||
if (it->compare("--no-gui") == 0) {
|
||||
int main(int argc, char* argv[]) {
|
||||
std::vector<std::string> args(argv, argv + argc);
|
||||
g_pEngine = std::make_unique<GameEngine>();
|
||||
for (int i = 1; i < args.size(); ++i) {
|
||||
if (args[i].compare("--no-gui") == 0) {
|
||||
g_pEngine->state.m_bNoDisplay = true;
|
||||
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;
|
||||
std::cout << "[LOG - Main] Bot control enabled" << std::endl;
|
||||
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
g_pEngine = std::make_unique<GameEngine>();
|
||||
g_pEngine->Start();
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user