Linux build fix attempt 1 (#141)

This commit is contained in:
Elmsroth 2021-03-05 21:15:44 +01:00 committed by GitHub
parent ad2795835e
commit 6adae96680
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 12 deletions

View File

@ -2,7 +2,6 @@
#include "playerbot.h" #include "playerbot.h"
#include "Util.h" #include "Util.h"
#include <algorithm> #include <algorithm>
#include <functional>
#include <cctype> #include <cctype>
#include <locale> #include <locale>
@ -78,12 +77,3 @@ uint64 extractGuid(WorldPacket& packet)
return guid; return guid;
} }
std::string &rtrim(std::string &s) {
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
return s;
}
std::string &trim(std::string &s) {
return ltrim(rtrim(s));
}

View File

@ -15,6 +15,7 @@
#include "PlayerbotAI.h" #include "PlayerbotAI.h"
#include "PlayerbotFactory.h" #include "PlayerbotFactory.h"
#include "PlayerbotSecurity.h" #include "PlayerbotSecurity.h"
#include "Util.h"
using namespace ai; using namespace ai;
using namespace std; using namespace std;
@ -23,7 +24,6 @@ vector<string>& split(const string &s, char delim, vector<string> &elems);
vector<string> split(const string &s, char delim); vector<string> split(const string &s, char delim);
char * strstri (string str1, string str2); char * strstri (string str1, string str2);
uint64 extractGuid(WorldPacket& packet); uint64 extractGuid(WorldPacket& packet);
std::string &trim(std::string &s);
uint32 PlayerbotChatHandler::extractQuestId(string str) uint32 PlayerbotChatHandler::extractQuestId(string str)
{ {

View File

@ -32,6 +32,7 @@
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <cctype> #include <cctype>
#include <functional>
/** /**
* @brief * @brief
@ -115,13 +116,22 @@ inline uint32 secsToTimeBitFields(time_t secs)
} }
inline std::string ltrim(std::string& s) { inline std::string& ltrim(std::string& s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) { s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) {
return !std::isspace(ch); return !std::isspace(ch);
})); }));
return s; return s;
} }
inline std::string& rtrim(std::string& s) {
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
return s;
}
inline std::string& trim(std::string& s) {
return ltrim(rtrim(s));
}
/** /**
* @brief Return a random number in the range min..max; (max-min) must be smaller than 32768. * @brief Return a random number in the range min..max; (max-min) must be smaller than 32768.
* *