diff --git a/inc/graph.h b/inc/graph.h index 5864a70..08d7ce6 100644 --- a/inc/graph.h +++ b/inc/graph.h @@ -370,6 +370,7 @@ public: void convertFromPOD (Path &path, const PODPath &pod); void convertToPOD (const Path &path, PODPath &pod); void convertCampDirection (Path &path); + void setAutoPathDistance (const float distance); const char *getDataDirectory (bool isMemoryFile = false); const char *getOldFormatGraphName (bool isMemoryFile = false); @@ -407,10 +408,6 @@ public: m_editFlags &= ~flag; } - void setAutoPathDistance (const float distance) { - m_autoPathDistance = distance; - } - const Vector &getBombOrigin () const { return m_bombOrigin; } diff --git a/src/control.cpp b/src/control.cpp index 4dfdb49..80793b1 100644 --- a/src/control.cpp +++ b/src/control.cpp @@ -1428,21 +1428,20 @@ int BotControl::menuAutoPathDistance (int item) { showMenu (Menu::None); // reset menu display constexpr float distances[] = { 0.0f, 100.0f, 130.0f, 160.0f, 190.0f, 220.0f, 250.0f }; - float result = 0.0f; if (item >= 1 && item <= 7) { - result = distances[item - 1]; - graph.setAutoPathDistance (result); + graph.setAutoPathDistance (distances[item - 1]); } - if (cr::fzero (result)) { - msg ("Autopathing is now disabled."); - } - else { - msg ("Autopath distance is set to %.2f.", result); - } - showMenu (Menu::NodeAutoPath); + switch (item) { + default: + showMenu (Menu::NodeAutoPath); + break; + case 10: + showMenu (Menu::None); + break; + } return BotCommandResult::Handled; } diff --git a/src/graph.cpp b/src/graph.cpp index 7b5255b..7db2d5b 100644 --- a/src/graph.cpp +++ b/src/graph.cpp @@ -1065,6 +1065,17 @@ void BotGraph::cachePoint (int index) { ctrl.msg ("Node %d has been put into memory.", m_cacheNodeIndex); } +void BotGraph::setAutoPathDistance (const float distance) { + m_autoPathDistance = distance; + + if (cr::fzero (distance)) { + ctrl.msg ("Autopathing is now disabled."); + } + else { + ctrl.msg ("Autopath distance is set to %.2f.", distance); + } +} + void BotGraph::calculatePathRadius (int index) { // calculate "wayzones" for the nearest node (meaning a dynamic distance area to vary node origin)