fix: non closeable autopath menu.

This commit is contained in:
ds 2020-08-23 11:08:27 +03:00
commit 379feb8311
3 changed files with 21 additions and 14 deletions

View file

@ -370,6 +370,7 @@ public:
void convertFromPOD (Path &path, const PODPath &pod); void convertFromPOD (Path &path, const PODPath &pod);
void convertToPOD (const Path &path, PODPath &pod); void convertToPOD (const Path &path, PODPath &pod);
void convertCampDirection (Path &path); void convertCampDirection (Path &path);
void setAutoPathDistance (const float distance);
const char *getDataDirectory (bool isMemoryFile = false); const char *getDataDirectory (bool isMemoryFile = false);
const char *getOldFormatGraphName (bool isMemoryFile = false); const char *getOldFormatGraphName (bool isMemoryFile = false);
@ -407,10 +408,6 @@ public:
m_editFlags &= ~flag; m_editFlags &= ~flag;
} }
void setAutoPathDistance (const float distance) {
m_autoPathDistance = distance;
}
const Vector &getBombOrigin () const { const Vector &getBombOrigin () const {
return m_bombOrigin; return m_bombOrigin;
} }

View file

@ -1428,21 +1428,20 @@ int BotControl::menuAutoPathDistance (int item) {
showMenu (Menu::None); // reset menu display showMenu (Menu::None); // reset menu display
constexpr float distances[] = { 0.0f, 100.0f, 130.0f, 160.0f, 190.0f, 220.0f, 250.0f }; 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) { if (item >= 1 && item <= 7) {
result = distances[item - 1]; graph.setAutoPathDistance (distances[item - 1]);
graph.setAutoPathDistance (result);
} }
if (cr::fzero (result)) { switch (item) {
msg ("Autopathing is now disabled."); default:
} showMenu (Menu::NodeAutoPath);
else { break;
msg ("Autopath distance is set to %.2f.", result);
}
showMenu (Menu::NodeAutoPath);
case 10:
showMenu (Menu::None);
break;
}
return BotCommandResult::Handled; return BotCommandResult::Handled;
} }

View file

@ -1065,6 +1065,17 @@ void BotGraph::cachePoint (int index) {
ctrl.msg ("Node %d has been put into memory.", m_cacheNodeIndex); 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) { void BotGraph::calculatePathRadius (int index) {
// calculate "wayzones" for the nearest node (meaning a dynamic distance area to vary node origin) // calculate "wayzones" for the nearest node (meaning a dynamic distance area to vary node origin)