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/>.
17 #ifndef _SCRIPT_COMP_H_
18 #define _SCRIPT_COMP_H_
21 struct ReadFightActionException
:public NLMISC::Exception
23 ReadFightActionException(const std::string
&reason
):NLMISC::Exception(reason
){}
28 class CFightScriptComp
29 :public NLMISC::CRefCount
34 virtual ~CFightScriptComp()
36 virtual std::string
toString() const = 0;
38 virtual bool update(CSpawnBot
&bot
) const = 0; // returns true if it behaves normally, false if there a problem and callers may not consider it behaves normally.
39 // for instance ONCE may not consider that this call happened.
40 virtual void remove(CFightScriptComp
*child
)
46 class CFightScriptCompReader
47 :public NLMISC::CRefCount
50 CFightScriptCompReader()
52 virtual ~CFightScriptCompReader()
54 virtual CFightScriptComp
*create (const std::string
&inStr
) = 0;
55 virtual std::string
getName () const =0;
57 static CFightScriptCompReader
*getScriptReader (const std::string
&str
);
59 static CFightScriptComp
*createScriptComp(const std::string
&str
);
67 virtual ~CFightScript()
70 void add(CFightScriptCompReader
*reader
);
72 typedef CHashMap
<std::string
, NLMISC::CSmartPtr
<CFightScriptCompReader
> > TFightScriptMap
;
74 static TFightScriptMap _ScriptCompList
;
78 //////////////////////////////////////////////////////////////////////////
82 class CFightSelectFilter
83 :public CFightScriptComp
86 CFightSelectFilter(CFightScriptComp
*customComp
, std::string param
)
87 :_CustomComp(customComp
)
91 virtual ~CFightSelectFilter()
93 bool update (CSpawnBot
&bot
) const;
94 const std::string
&getParam() const
99 std::string
toString() const;
103 NLMISC::CSmartPtr
<CFightScriptComp
> _CustomComp
;
108 class CFightSelectFilterReader
109 :public CFightScriptCompReader
112 CFightSelectFilterReader() {}
113 virtual ~CFightSelectFilterReader() {}
115 CFightScriptComp
*create(const std::string
&inStr
);
116 std::string
getName () const
118 return std::string("SELECT");