From c7f10892a9b6d3b3c019acbca842780ed8a4a382 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Thu, 28 Jun 2018 04:50:01 +0300 Subject: [PATCH] [General] Add vectorContains util for checking strings in vectors --- components/openmw-mp/Utils.cpp | 5 +++++ components/openmw-mp/Utils.hpp | 1 + 2 files changed, 6 insertions(+) diff --git a/components/openmw-mp/Utils.cpp b/components/openmw-mp/Utils.cpp index f96173190..4c32acf83 100644 --- a/components/openmw-mp/Utils.cpp +++ b/components/openmw-mp/Utils.cpp @@ -90,6 +90,11 @@ bool Utils::vectorContains(std::vector* vectorChecked, int value) return std::find(vectorChecked->begin(), vectorChecked->end(), value) != vectorChecked->end(); } +bool Utils::vectorContains(std::vector* vectorChecked, std::string value) +{ + return std::find(vectorChecked->begin(), vectorChecked->end(), value) != vectorChecked->end(); +} + std::string Utils::toString(int num) { std::ostringstream stream; diff --git a/components/openmw-mp/Utils.hpp b/components/openmw-mp/Utils.hpp index a809e3796..318a4f150 100644 --- a/components/openmw-mp/Utils.hpp +++ b/components/openmw-mp/Utils.hpp @@ -28,6 +28,7 @@ namespace Utils bool compareDoubles(double a, double b, double epsilon); bool vectorContains(std::vector* vectorChecked, int value); + bool vectorContains(std::vector* vectorChecked, std::string value); std::string replaceString(const std::string &source, const char *find, const char *replace);