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 "game_share/object.h"
33 CObject
* CPalette::getPaletteElement(const std::string
& key
) const
35 //H_AUTO(R2_CPalette_getPaletteElement)
36 TMap::const_iterator
find(_Map
.find(key
));
37 if (find
!= _Map
.end())
44 void CPalette::addPaletteElement(const std::string
& key
, CObject
* paletteElement
)
46 //H_AUTO(R2_CPalette_addPaletteElement)
47 std::pair
< TMap::iterator
, bool> result
;
48 result
= _Map
.insert( std::pair
<std::string
, CObject
*>(key
, paletteElement
));
53 nlwarning("Palette element added twice : %s", key
.c_str());
54 delete paletteElement
;
58 bool CPalette::isInPalette(const std::string
&key
) const
60 //H_AUTO(R2_CPalette_isInPalette)
61 TMap::const_iterator
found(_Map
.find(key
));
62 if (found
!= _Map
.end())
69 TMap::iterator
first(_Map
.begin()), last(_Map
.end());
70 for (; first
!= last
; ++first
)
72 delete(first
->second
);