mirror of
https://github.com/modelec/TCPSocketServer.git
synced 2026-01-19 00:47:36 +01:00
change function definition
This commit is contained in:
@@ -267,7 +267,7 @@ void TCPServer::broadcastMessage(const char* message, int senderSocket)
|
||||
}
|
||||
|
||||
void TCPServer::broadcastMessage(std::string &message, int senderSocket) {
|
||||
if (!TCPUtils::endsWith(message, "\n")) {
|
||||
if (!TCPUtils::endWith(message, "\n")) {
|
||||
message += "\n";
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ void TCPServer::startGameBlueTeam() {
|
||||
bool found = false;
|
||||
while (!found) {
|
||||
for (const auto & arucoTag : this->arucoTags) {
|
||||
if (TCPUtils::endsWith(arucoTag.name(), "flower")) {
|
||||
if (TCPUtils::endWith(arucoTag.name(), "flower")) {
|
||||
if (arucoTag.pos().first[0] < 800 && arucoTag.pos().first[0] > 300 && arucoTag.pos().first[1] < 300 && arucoTag.pos().first[1] > -300) {
|
||||
tag = arucoTag;
|
||||
found = true;
|
||||
@@ -444,7 +444,7 @@ void TCPServer::startGameBlueTeam() {
|
||||
found = false;
|
||||
while (!found) {
|
||||
for (const auto & arucoTag : this->arucoTags) {
|
||||
if (TCPUtils::endsWith(arucoTag.name(), "flower")) {
|
||||
if (TCPUtils::endWith(arucoTag.name(), "flower")) {
|
||||
if (arucoTag.pos().first[0] < 800 && arucoTag.pos().first[0] > 300 && arucoTag.pos().first[1] < 300 && arucoTag.pos().first[1] > -300) {
|
||||
tag = arucoTag;
|
||||
found = true;
|
||||
@@ -484,7 +484,7 @@ void TCPServer::startGameBlueTeam() {
|
||||
found = false;
|
||||
while (!found) {
|
||||
for (const auto & arucoTag : this->arucoTags) {
|
||||
if (TCPUtils::endsWith(arucoTag.name(), "flower")) {
|
||||
if (TCPUtils::endWith(arucoTag.name(), "flower")) {
|
||||
if (arucoTag.pos().first[0] < 800 && arucoTag.pos().first[0] > 300 && arucoTag.pos().first[1] < 300 && arucoTag.pos().first[1] > -300) {
|
||||
tag = arucoTag;
|
||||
found = true;
|
||||
|
||||
@@ -5,7 +5,7 @@ bool TCPUtils::startWith(const std::string& str, const std::string& start)
|
||||
return str.rfind(start, 0) == 0;
|
||||
}
|
||||
|
||||
bool TCPUtils::endsWith(const std::string& str, const std::string& end)
|
||||
bool TCPUtils::endWith(const std::string& str, const std::string& end)
|
||||
{
|
||||
if (str.length() >= end.length())
|
||||
{
|
||||
|
||||
2
utils.h
2
utils.h
@@ -13,7 +13,7 @@ enum PinceState {
|
||||
namespace TCPUtils {
|
||||
bool startWith(const std::string& str, const std::string& start);
|
||||
|
||||
bool endsWith(const std::string& str, const std::string& end);
|
||||
bool endWith(const std::string& str, const std::string& end);
|
||||
|
||||
bool contains(const std::string& str, const std::string& sub);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user