Skip to content

Commit 662aea2

Browse files
committed
fix and warnings added
1 parent 9bd6830 commit 662aea2

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

include/behaviortree_cpp/bt_factory.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ inline TreeNodeManifest CreateManifest(const std::string& ID,
5656
#endif
5757

5858
#else
59-
#define BTCPP_EXPORT
59+
#define BTCPP_EXPORT static
6060
#endif
6161
/* Use this macro to automatically register one or more custom Nodes
6262
* into a factory. For instance:
@@ -75,7 +75,7 @@ inline TreeNodeManifest CreateManifest(const std::string& ID,
7575
*/
7676

7777
#define BT_REGISTER_NODES(factory) \
78-
static BTCPP_EXPORT void BT_RegisterNodesFromPlugin(BT::BehaviorTreeFactory& factory)
78+
BTCPP_EXPORT void BT_RegisterNodesFromPlugin(BT::BehaviorTreeFactory& factory)
7979

8080
constexpr const char* PLUGIN_SYMBOL = "BT_RegisterNodesFromPlugin";
8181

src/bt_factory.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,13 @@ const std::set<std::string>& BehaviorTreeFactory::builtinNodes() const
299299
Tree BehaviorTreeFactory::createTreeFromText(const std::string& text,
300300
Blackboard::Ptr blackboard)
301301
{
302+
if(!parser_->registeredBehaviorTrees().empty()) {
303+
std::cout << "WARNING: You executed BehaviorTreeFactory::createTreeFromText "
304+
"after registerBehaviorTreeFrom[File/Text].\n"
305+
"This is NOTm probably, what you want to do.\n"
306+
"You should probably use BehaviorTreeFactory::createTree, instead"
307+
<< std::endl;
308+
}
302309
XMLParser parser(*this);
303310
parser.loadFromText(text);
304311
auto tree = parser.instantiateTree(blackboard);
@@ -309,6 +316,14 @@ Tree BehaviorTreeFactory::createTreeFromText(const std::string& text,
309316
Tree BehaviorTreeFactory::createTreeFromFile(const std::string& file_path,
310317
Blackboard::Ptr blackboard)
311318
{
319+
if(!parser_->registeredBehaviorTrees().empty()) {
320+
std::cout << "WARNING: You executed BehaviorTreeFactory::createTreeFromFile "
321+
"after registerBehaviorTreeFrom[File/Text].\n"
322+
"This is NOTm probably, what you want to do.\n"
323+
"You should probably use BehaviorTreeFactory::createTree, instead"
324+
<< std::endl;
325+
}
326+
312327
XMLParser parser(*this);
313328
parser.loadFromFile(file_path);
314329
auto tree = parser.instantiateTree(blackboard);

0 commit comments

Comments
 (0)