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/>.
23 #include "stdpch.h" // First include for pre-compiled headers.
25 #include "entity_sheet.h"
27 #include "nel/misc/string_conversion.h"
29 using namespace NLMISC
;
31 static const CStringConversion
<CEntitySheet::TType
>::CPair sheetTypeStringTableDef
[] =
33 { "CHAR", CEntitySheet::CHAR
},
34 { "FAUNA", CEntitySheet::FAUNA
},
35 { "FLORA", CEntitySheet::FLORA
},
36 { "OBJECT", CEntitySheet::OBJECT
},
37 { "FX", CEntitySheet::FX
},
38 { "BUILDING", CEntitySheet::BUILDING
},
39 { "ITEM", CEntitySheet::ITEM
},
40 { "PLANT", CEntitySheet::PLANT
},
41 { "MISSION", CEntitySheet::MISSION
},
42 { "RACE_STATS", CEntitySheet::RACE_STATS
},
43 { "PACT", CEntitySheet::PACT
},
44 { "LIGHT_CYCLE", CEntitySheet::LIGHT_CYCLE
},
45 { "WEATHER_SETUP", CEntitySheet::WEATHER_SETUP
},
46 { "CONTINENT", CEntitySheet::CONTINENT
},
47 { "WORLD", CEntitySheet::WORLD
},
48 { "WEATHER_FUNCTION_PARAMS", CEntitySheet::WEATHER_FUNCTION_PARAMS
},
49 { "BOTCHAT", CEntitySheet::BOTCHAT
},
50 { "MISSION_ICON", CEntitySheet::MISSION_ICON
},
51 { "SBRICK", CEntitySheet::SBRICK
},
52 { "SPHRASE", CEntitySheet::SPHRASE
},
53 { "SKILLS_TREE", CEntitySheet::SKILLS_TREE
},
54 { "UNBLOCK_TITLES", CEntitySheet::UNBLOCK_TITLES
},
55 { "SUCCESS_TABLE", CEntitySheet::SUCCESS_TABLE
},
56 { "AUTOMATON_LIST", CEntitySheet::AUTOMATON_LIST
},
57 { "ANIMATION_SET_LIST", CEntitySheet::ANIMATION_SET_LIST
},
58 { "SPELL", CEntitySheet::SPELL
},
59 { "SPELL_LIST", CEntitySheet::SPELL_LIST
},
60 { "CAST_FX", CEntitySheet::CAST_FX
},
61 { "EMOT", CEntitySheet::EMOT
},
62 { "ANIMATION_FX", CEntitySheet::ANIMATION_FX
},
63 { "ID_TO_STRING_ARRAY", CEntitySheet::ID_TO_STRING_ARRAY
},
64 { "FORAGE_SOURCE", CEntitySheet::FORAGE_SOURCE
},
65 { "CREATURE_ATTACK", CEntitySheet::CREATURE_ATTACK
},
66 { "ANIMATION_FX_SET", CEntitySheet::ANIMATION_FX_SET
},
67 { "ATTACK_LIST", CEntitySheet::ATTACK_LIST
},
68 { "SKY", CEntitySheet::SKY
},
69 { "TEXT_EMOT", CEntitySheet::TEXT_EMOT
},
70 { "OUTPOST", CEntitySheet::OUTPOST
},
71 { "OUTPOST_SQUAD", CEntitySheet::OUTPOST_SQUAD
},
72 { "FACTION", CEntitySheet::FACTION
}
74 static CStringConversion
<CEntitySheet::TType
> sheetTypeStringTable(sheetTypeStringTableDef
, sizeofarray(sheetTypeStringTableDef
), CEntitySheet::UNKNOWN_SHEET_TYPE
);
76 std::vector
<std::string
> CEntitySheet::_Debug
;
78 //-----------------------------------------------
80 // Add string to the debug stack.
81 //-----------------------------------------------
82 void CEntitySheet::debug(const std::string
&str
)
84 // Add the string to the debug stack.
85 _Debug
.push_back(str
);
88 //-----------------------------------------------
90 // Flush the debug stack with a title parameter.
91 //-----------------------------------------------
92 void CEntitySheet::flush(const std::string
&/* title */)
94 // If debug stack is not empty
99 nlwarning("Bug in the form '%s':", title.c_str());
100 for(uint i=0; i<_Debug.size(); ++i)
101 nlwarning(" %s", _Debug[i]);
103 // Empty line separator
112 // ***************************************************************************
113 const std::string
&CEntitySheet::typeToString(TType e
)
115 return sheetTypeStringTable
.toString(e
);
118 // ***************************************************************************
119 CEntitySheet::TType
CEntitySheet::typeFromString(const std::string
&s
)
121 return sheetTypeStringTable
.fromString(s
);