Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
JueXiuHuang committed Apr 6, 2024
2 parents cff2f6e + 09aa35f commit 55c3cde
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/ConfigParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ std::ostream &operator<<(std::ostream &os, const PrivateConf &conf) {

std::ostream &operator<<(std::ostream &os, const MoveConf &conf) {
os << "Use Flash: " << (conf.use_flash ? "True" : "False") << std::endl;
os << "Max Interval: " << conf.max_interval << std::endl;
return os;
}

Expand Down Expand Up @@ -159,6 +160,7 @@ static MoveConf parseMove(toml::table *table) {
MoveConf conf;

conf.use_flash = (*table)["use_flash"].value_or(false);
conf.max_interval = (*table)["max_interval"].value_or(1);

std::cout << conf << std::endl;

Expand Down
1 change: 1 addition & 0 deletions src/ConfigParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct PrivateConf {

struct MoveConf {
bool use_flash;
std::size_t max_interval;
};

struct OtherConf {
Expand Down
4 changes: 2 additions & 2 deletions src/CustomTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ Botcraft::Status FindPathAndMoveImpl(Botcraft::BehaviourClient &c,
std::cout << GetTime() << "Find a path from " << from << " to " << to
<< "\n";
// find path and go
r = finder.findPathAndGo(from, goal, 15000);
r = finder.findPathAndGo(from, goal, artist.conf.move.max_interval, 15000);
if (r) break;
from = getFromPosition(); // get the latest position
std::cout << GetTime() << "Failed, retry after 5 seconds..." << std::endl;
Expand Down Expand Up @@ -785,7 +785,7 @@ Botcraft::Status FindPathAndMoveImpl(Botcraft::BehaviourClient &c,
pf::Position from = getFromPosition();
std::cout << GetTime() << "Find a path from " << from << " to " << to
<< "\n";
r = finder.findPathAndGo(from, goal, 15000);
r = finder.findPathAndGo(from, goal, artist.conf.move.max_interval, 15000);
}

return (r ? Botcraft::Status::Success : Botcraft::Status::Failure);
Expand Down

0 comments on commit 55c3cde

Please sign in to comment.