Merge branch '138-toggle-free-look-with-hotkey' into 'main/atys-live'
[ryzomcore.git] / nel / src / ligo / ligo_error.cpp
blob30315b3e6f3bc9fb6b0271c90c7af2958ea5f7ab
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
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.
8 //
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 #include "stdligo.h"
18 #include "nel/ligo/ligo_error.h"
20 namespace NLLIGO
23 // ***************************************************************************
25 CLigoError::CLigoError()
27 clear ();
30 // ***************************************************************************
32 void CLigoError::pushVertexError (TError code, uint id, uint edge)
34 // Check if this vertex exist in the error list
35 uint vertex;
36 for (vertex=0; vertex<_VertexError.size(); vertex++)
38 if (_VertexError[vertex].Id == id)
40 _VertexError[vertex] = CVertex (code, id, edge);
41 break;
45 // Not found ?
46 if (vertex == _VertexError.size())
48 // Add a vertex error
49 _VertexError.push_back (CVertex (code, id, edge));
53 // ***************************************************************************
55 uint CLigoError::numVertexError () const
57 return (uint)_VertexError.size ();
60 // ***************************************************************************
62 CLigoError::TError CLigoError::getVertexError (uint error, uint &id, uint &edge) const
64 const CVertex &vertex = _VertexError[error];
65 id = vertex.Id;
66 edge = vertex.Edge;
67 return vertex.Code;
70 // ***************************************************************************
72 void CLigoError::clear ()
74 MainError = NoError;
75 _VertexError.clear ();
78 // ***************************************************************************
80 const char* CLigoError::_StringError[CLigoError::ErrorCount]=
82 "No error", // NoError
83 "No vertex in the edge list", // NoEdgeVertices
84 "Opened edges detected", // OpenedEdge
85 "Multiple edge on the boundary",// MultipleEdge
86 "Vertex list invalid. One vertex should be a corner", // VertexList
87 "The vertex has not been inserted in the edge list", // NotInserted
88 "The vertex has been inserted in the edge list", // Inserted
89 "Flat zone, all vertices are in the same corner", // FlatZone
90 "The zone must have 4 edges to define a material", // MustHave4Edges
91 "A edge of the zone is not symetrical", // NotSymetrical
92 "Not the same number of vertex", // NotSameVerticesNumber
93 "Some vertices are not the same", // NotSameVertex
94 "No corner found", // NoCornerFound
95 "A edge has two times the same corner", // TwoCornerVertices
96 "A corner is missing in this edge", // CornerIsMissing
97 "A boundary vertex is used by multiple edges", // VertexAlreadyUsed
98 "Unknown error", // UnknownError
101 // ***************************************************************************
103 const char* CLigoError::getStringError (TError errorCode)
105 if (errorCode<=ErrorCount)
107 return _StringError[errorCode];
109 else
111 return _StringError[UnknownError];
115 // ***************************************************************************