Skip to content

Commit d9c0a40

Browse files
committed
fix and warnings added
1 parent 9d7576d commit d9c0a40

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

include/behaviortree_cpp_v3/bt_factory.h

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

9393
#else
94-
#define BTCPP_EXPORT
94+
#define BTCPP_EXPORT static
9595
#endif
9696
/* Use this macro to automatically register one or more custom Nodes
9797
* into a factory. For instance:
@@ -110,7 +110,7 @@ inline TreeNodeManifest CreateManifest(const std::string& ID,
110110
*/
111111

112112
#define BT_REGISTER_NODES(factory) \
113-
static BTCPP_EXPORT void BT_RegisterNodesFromPlugin(BT::BehaviorTreeFactory& factory)
113+
BTCPP_EXPORT void BT_RegisterNodesFromPlugin(BT::BehaviorTreeFactory& factory)
114114

115115
constexpr const char* PLUGIN_SYMBOL = "BT_RegisterNodesFromPlugin";
116116

src/bt_factory.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,13 @@ const std::set<std::string>& BehaviorTreeFactory::builtinNodes() const
278278
Tree BehaviorTreeFactory::createTreeFromText(const std::string& text,
279279
Blackboard::Ptr blackboard)
280280
{
281+
if(!parser_->registeredBehaviorTrees().empty()) {
282+
std::cout << "WARNING: You executed BehaviorTreeFactory::createTreeFromText "
283+
"after registerBehaviorTreeFrom[File/Text].\n"
284+
"This is NOTm probably, what you want to do.\n"
285+
"You should probably use BehaviorTreeFactory::createTree, instead"
286+
<< std::endl;
287+
}
281288
XMLParser parser(*this);
282289
parser.loadFromText(text);
283290
auto tree = parser.instantiateTree(blackboard);
@@ -288,6 +295,14 @@ Tree BehaviorTreeFactory::createTreeFromText(const std::string& text,
288295
Tree BehaviorTreeFactory::createTreeFromFile(const std::string& file_path,
289296
Blackboard::Ptr blackboard)
290297
{
298+
if(!parser_->registeredBehaviorTrees().empty()) {
299+
std::cout << "WARNING: You executed BehaviorTreeFactory::createTreeFromFile "
300+
"after registerBehaviorTreeFrom[File/Text].\n"
301+
"This is NOTm probably, what you want to do.\n"
302+
"You should probably use BehaviorTreeFactory::createTree, instead"
303+
<< std::endl;
304+
}
305+
291306
XMLParser parser(*this);
292307
parser.loadFromFile(file_path);
293308
auto tree = parser.instantiateTree(blackboard);

0 commit comments

Comments
 (0)