Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Use std::max_element

Michał Janiszewskia6309b14b71c
diff --git a/toonz/sources/toonzlib/sandor_fxs/SDirection.cpp b/toonz/sources/toonzlib/sandor_fxs/SDirection.cpp
index 5a907ae22..9dd14c137 100644
--- a/toonz/sources/toonzlib/sandor_fxs/SDirection.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/SDirection.cpp
@@ -5,6 +5,7 @@
//////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <memory.h>
+#include <algorithm>
#include "SDirection.h"
#include "SError.h"
@@ -158,7 +159,7 @@ UCHAR CSDirection::getDir(const int xx, const int yy, UCHAR *sel) {
}
}
if (w == 0) return 0;
- short ma = std::max({sum[0], sum[1], sum[2], sum[3]});
+ short ma = *std::max_element(sum, sum + 4);
double angle = getAngle(sum, ma);
// tmsg_info(" - dir - %d, %d, %d, %d angle=%f", sum[0],sum[1],sum[2],sum[3],
// angle-50.0);