Added ai command setEquipment
[ryzomcore.git] / ryzom / server / src / ai_service / debug_history.h
blobed91478ef4fa3dac0097b459d633533b404c90b2
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
6 //
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef RYAI_DEBUG_HISTORY_H
21 #define RYAI_DEBUG_HISTORY_H
23 class CDebugHistory
25 private:
26 typedef std::deque<std::string> THistoryContainer;
27 public:
28 explicit CDebugHistory()
29 : m_Recording(false)
32 virtual ~CDebugHistory() { }
33 void addHistory(std::string const& txt)
35 if (m_Recording)
36 m_History.push_back(txt);
38 void addHistory(char const* txt)
40 if (m_Recording)
41 addHistory(NLMISC::toString(txt));
44 template <class A>
45 void addHistory(char const* txt, A a) { if (m_Recording) addHistory(NLMISC::toString(txt, a)); }
46 template <class A, class B>
47 void addHistory(char const* txt, A a, B b) { if (m_Recording) addHistory(NLMISC::toString(txt, a, b)); }
48 template <class A, class B, class C>
49 void addHistory(char const* txt, A a, B b, C c) { if (m_Recording) addHistory(NLMISC::toString(txt, a, b, c)); }
50 template <class A, class B, class C, class D>
51 void addHistory(char const* txt, A a, B b, C c, D d) { if (m_Recording) addHistory(NLMISC::toString(txt, a, b, c, d)); }
53 void setRecording(bool val) { m_Recording = val; }
54 inline bool isRecording() { return m_Recording; }
56 void writeAsInfo()
58 int j = 0;
59 FOREACH(itHistory, THistoryContainer, m_History)
61 nlinfo("HIST %3i: %s", j, itHistory->c_str());
62 ++j;
66 private:
67 bool m_Recording;
68 THistoryContainer m_History;
71 #endif