From 3f85861892b6ddff384c38660704bfbf1caeabdb Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 5 Oct 2014 20:59:54 +0000 Subject: [PATCH] Move side::illegal_type down --- common/main/segment.h | 60 +++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/common/main/segment.h b/common/main/segment.h index 523279386..9420d5357 100644 --- a/common/main/segment.h +++ b/common/main/segment.h @@ -167,37 +167,11 @@ struct wallnum_t : prohibit_void_ptr struct side { - struct illegal_type : std::runtime_error - { - const segment *m_segment; - const side *m_side; - illegal_type(const segment *seg, const side *s) : - std::runtime_error("illegal side type"), - m_segment(seg), m_side(s) - { - } - illegal_type(const side *s) : - std::runtime_error("illegal side type"), - m_segment(nullptr), m_side(s) - { - } - }; + struct illegal_type; side_type m_type; // replaces num_faces and tri_edge, 1 = quad, 2 = 0:2 triangulation, 3 = 1:3 triangulation const side_type &get_type() const { return m_type; } void set_type(side_type t) { m_type = t; } - void set_type(unsigned t) - { - switch (t) - { - case SIDE_IS_QUAD: - case SIDE_IS_TRI_02: - case SIDE_IS_TRI_13: - set_type(static_cast(t)); - break; - default: - throw illegal_type(this); - } - } + inline void set_type(unsigned t); wallnum_t wall_num; short tmap_num; short tmap_num2; @@ -324,6 +298,36 @@ static inline segnum_t operator-(const segment *s, const segment_array_t &S) return segnum_t(static_cast(s - (&*S.begin()))); } +struct side::illegal_type : std::runtime_error +{ + const segment *m_segment; + const side *m_side; + illegal_type(const segment *seg, const side *s) : + runtime_error("illegal side type"), + m_segment(seg), m_side(s) + { + } + illegal_type(const side *s) : + runtime_error("illegal side type"), + m_segment(nullptr), m_side(s) + { + } +}; + +void side::set_type(unsigned t) +{ + switch (t) + { + case SIDE_IS_QUAD: + case SIDE_IS_TRI_02: + case SIDE_IS_TRI_13: + set_type(static_cast(t)); + break; + default: + throw illegal_type(this); + } +} + extern const sbyte Side_to_verts[MAX_SIDES_PER_SEGMENT][4]; // Side_to_verts[my_side] is list of vertices forming side my_side. extern const int Side_to_verts_int[MAX_SIDES_PER_SEGMENT][4]; // Side_to_verts[my_side] is list of vertices forming side my_side. extern const char Side_opposite[MAX_SIDES_PER_SEGMENT]; // Side_opposite[my_side] returns side opposite cube from my_side.