Skip to content
Snippets Groups Projects
Commit aa0b9ed3 authored by David Bergström's avatar David Bergström
Browse files

Remove parsing of BotConfig.txt

This is a nice feature, but it took too long to force CMAKE into
outputting the binary into the correct directory.
parent 15912117
No related branches found
No related tags found
No related merge requests found
...@@ -15,38 +15,13 @@ int main(int argc, char* argv[]) ...@@ -15,38 +15,13 @@ int main(int argc, char* argv[])
return 1; return 1;
} }
std::string config = JSONTools::ReadFile("BotConfig.txt"); std::string botRaceString = "Terran";
if (config.length() == 0) std::string enemyRaceString = "Random";
{ std::string mapString = "InterloperTest.SC2MAP";
std::cerr << "Config file could not be found, and is required for starting the bot\n";
std::cerr << "Please read the instructions and try again\n";
exit(-1);
}
std::ifstream file("BotConfig.txt");
json j;
file >> j;
std::string botRaceString, enemyRaceString, mapString;
int stepSize = 1; int stepSize = 1;
sc2::Difficulty enemyDifficulty = sc2::Difficulty::Easy; sc2::Difficulty enemyDifficulty = sc2::Difficulty::Easy;
if (j.count("SC2API") && j["SC2API"].is_object())
{
const json & info = j["SC2API"];
JSONTools::ReadString("BotRace", info, botRaceString);
JSONTools::ReadString("EnemyRace", info, enemyRaceString);
JSONTools::ReadString("MapFile", info, mapString);
JSONTools::ReadInt("StepSize", info, stepSize);
JSONTools::ReadInt("EnemyDifficulty", info, enemyDifficulty);
}
else
{
std::cerr << "Config file has no 'Game Info' object, required for starting the bot\n";
std::cerr << "Please read the instructions and try again\n";
exit(-1);
}
// Add the custom bot, it will control the players. // Add the custom bot, it will control the players.
IDABot bot1; IDABot bot1;
//IDABot bot2; //IDABot bot2;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment