1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "state_profil.h"
21 #include "ai_bot_npc.h"
22 #include "ai_grp_npc.h"
25 std::string
CAIStateProfile::getIndexString () const
27 return getOwner()->getIndexString()+NLMISC::toString(":%u", getChildIndex());
31 void CAIStateProfile::grpKeywordFilterAdd(const std::string
&keyword
)
33 CKeywordFilter filter
;
35 if (!CAIKeywords::groupFilter(keyword
, filter
))
37 nlwarning("There are some keyword error in '%s'", getAliasNode()->fullName().c_str());
40 _grpKeywordFilter
+=filter
;
44 bool CAIStateProfile::testCompatibility(const CGroupNpc
&grp
) const
46 const std::string
&groupName
= grp
.getName();
47 bool grpOK
= _namedGrps
.empty() && _grpKeywordFilter
.isEmpty();
49 // as long as group not flagged OK - test the list of named groups to see if we match
50 for (uint i
=0;!grpOK
&& i
<_namedGrps
.size();++i
)
51 grpOK
= (groupName
==_namedGrps
[i
]);
53 // if all else fails try the keyword test
55 || ( !_grpKeywordFilter
.isEmpty()
56 && _grpKeywordFilter
.test(grp
.getKeywords())