From 5530ae1b37675d52f4c49b9219e2c7c1c831853d Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Fri, 15 Nov 2019 15:48:49 +0200 Subject: [PATCH] Remove ERR_EXPLAIN in favor of *_MSG macros Fixes build against Godot 3.2.beta, namely: godotengine/godot#33517. --- clipper.cpp | 18 ++++-------------- thirdparty/clipper2/clipper.cpp | 10 +++------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/clipper.cpp b/clipper.cpp index 4d3c355..6b2fe8b 100644 --- a/clipper.cpp +++ b/clipper.cpp @@ -38,8 +38,7 @@ void Clipper::add_points(const Vector &points) { void Clipper::execute(bool build_hierarchy) { - ERR_EXPLAIN("Cannot build hierarchy outside of MODE_CLIP"); - ERR_FAIL_COND(build_hierarchy && mode != MODE_CLIP) + ERR_FAIL_COND_MSG(build_hierarchy && mode != MODE_CLIP, "Cannot build hierarchy outside of MODE_CLIP"); switch (mode) { @@ -81,20 +80,12 @@ int Clipper::get_solution_count(SolutionType type) const { Vector Clipper::get_solution(int idx, SolutionType type) { switch (type) { - case TYPE_CLOSED: { - - ERR_EXPLAIN("Closed solution not found"); - ERR_FAIL_INDEX_V(idx, solution_closed.size(), Vector()); - + ERR_FAIL_INDEX_V_MSG(idx, solution_closed.size(), Vector(), "Closed solution not found"); return _scale_down(solution_closed[idx], PRECISION); } break; - case TYPE_OPEN: { - - ERR_EXPLAIN("Open solution not found"); - ERR_FAIL_INDEX_V(idx, solution_open.size(), Vector()); - + ERR_FAIL_INDEX_V_MSG(idx, solution_open.size(), Vector(), "Open solution not found"); return _scale_down(solution_open[idx], PRECISION); } break; } @@ -103,8 +94,7 @@ Vector Clipper::get_solution(int idx, SolutionType type) { Rect2 Clipper::get_bounds() { - ERR_EXPLAIN("Cannot get solution bounds in MODE_OFFSET"); - ERR_FAIL_COND_V(mode == MODE_OFFSET, Rect2()); + ERR_FAIL_COND_V_MSG(mode == MODE_OFFSET, Rect2(), "Cannot get solution bounds in MODE_OFFSET"); cl::Rect64 b(0, 0, 0, 0); diff --git a/thirdparty/clipper2/clipper.cpp b/thirdparty/clipper2/clipper.cpp index 7aa03d0..ef47a2d 100644 --- a/thirdparty/clipper2/clipper.cpp +++ b/thirdparty/clipper2/clipper.cpp @@ -592,9 +592,7 @@ namespace clipperlib { void Clipper::AddPath(const Path &path, PathType polytype, bool is_open) { if (is_open) { - ERR_EXPLAINC("AddPath: Only subject paths may be open."); - ERR_FAIL_COND(polytype == ptClip) - + ERR_FAIL_COND_MSG(polytype == ptClip,"AddPath: Only subject paths may be open.") has_open_paths_ = true; } minima_list_sorted_ = false; @@ -968,8 +966,7 @@ namespace clipperlib { void Clipper::AddLocalMaxPoly(Active &e1, Active &e2, const Point64 pt) { - ERR_EXPLAINC("Error in AddLocalMaxPoly()."); - ERR_FAIL_COND(!IsHotEdge(e2)) + ERR_FAIL_COND_MSG(!IsHotEdge(e2), "Error in AddLocalMaxPoly()."); AddOutPt(e1, pt); if (e1.outrec == e2.outrec) { @@ -994,8 +991,7 @@ namespace clipperlib { SwapSides(*e2.outrec); } else if (!FixOrientation(e1) && !FixOrientation(e2)) { - ERR_EXPLAINC("Error in JoinOutrecPaths()"); - ERR_FAIL(); + ERR_FAIL_MSG("Error in JoinOutrecPaths()"); } if (e1.outrec->owner == e2.outrec) e1.outrec->owner = e2.outrec->owner;