graph: add adjust_height per request (resolves #388)
this command adjusts height (z-component) of all the graph nodes on map with specified height offset, negative height offset can be passed as parameter as well.
This commit is contained in:
parent
65884329dc
commit
0a45ea6ad7
2 changed files with 24 additions and 0 deletions
|
|
@ -124,6 +124,7 @@ private:
|
|||
int cmdNodeIterateCamp ();
|
||||
int cmdNodeShowStats ();
|
||||
int cmdNodeFileInfo ();
|
||||
int cmdAdjustHeight ();
|
||||
|
||||
private:
|
||||
int menuMain (int item);
|
||||
|
|
@ -187,6 +188,13 @@ public:
|
|||
return m_args[arg].int_ ();
|
||||
}
|
||||
|
||||
float floatValue (size_t arg) const {
|
||||
if (!hasArg (arg)) {
|
||||
return 0.0f;
|
||||
}
|
||||
return m_args[arg].float_ ();
|
||||
}
|
||||
|
||||
StringRef strValue (size_t arg) {
|
||||
if (!hasArg (arg)) {
|
||||
return "";
|
||||
|
|
|
|||
|
|
@ -333,6 +333,7 @@ int BotControl::cmdNode () {
|
|||
addGraphCmd ("upload", "upload", "Uploads created graph to graph database.", &BotControl::cmdNodeUpload);
|
||||
addGraphCmd ("stats", "stats [noarguments]", "Shows the stats about node types on the map.", &BotControl::cmdNodeShowStats);
|
||||
addGraphCmd ("fileinfo", "fileinfo [noarguments]", "Shows basic information about graph file.", &BotControl::cmdNodeFileInfo);
|
||||
addGraphCmd ("adjust_height", "adjust_height [height offset]", "Modifies all the graph nodes height (z-component) with specified offset.", &BotControl::cmdAdjustHeight);
|
||||
|
||||
// add path commands
|
||||
addGraphCmd ("path_create", "path_create [noarguments]", "Opens and displays path creation menu.", &BotControl::cmdNodePathCreate);
|
||||
|
|
@ -867,6 +868,21 @@ int BotControl::cmdNodeFileInfo () {
|
|||
return BotCommandResult::Handled;
|
||||
}
|
||||
|
||||
int BotControl::cmdAdjustHeight() {
|
||||
enum args { graph_cmd = 1, cmd, offset };
|
||||
|
||||
if (!hasArg (offset)) {
|
||||
return BotCommandResult::BadFormat;
|
||||
}
|
||||
auto heightOffset = floatValue (offset);
|
||||
|
||||
// adjust the height for all the nodes (negative values possible)
|
||||
for (int i = 0; i < graph.length (); ++i) {
|
||||
graph[i].origin.z += heightOffset;
|
||||
}
|
||||
return BotCommandResult::Handled;
|
||||
}
|
||||
|
||||
int BotControl::menuMain (int item) {
|
||||
closeMenu (); // reset menu display
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue