From a4764cd2257b3f7d660a888f692f10d430a99569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Leclaire-Fournier?= Date: Mon, 29 Jan 2024 18:10:53 -0500 Subject: [PATCH] Petits tweaks --- GPA675Lab1GOL/GOLTeamH.cpp | 3 ++- GPA675Lab1GOL/GridTeamH.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/GPA675Lab1GOL/GOLTeamH.cpp b/GPA675Lab1GOL/GOLTeamH.cpp index 4c31c64..269cc48 100644 --- a/GPA675Lab1GOL/GOLTeamH.cpp +++ b/GPA675Lab1GOL/GOLTeamH.cpp @@ -326,7 +326,6 @@ void GOLTeamH::randomize(double percentAlive) //! \return true si le patron est valide, false sinon. //! -// TODO bool GOLTeamH::setFromPattern(std::string const& pattern, int centerX, int centerY) { auto sq = parsePattern(pattern); @@ -556,6 +555,8 @@ std::optional GOLTeamH::parsePattern(std::string const& p { // Analyse du pattern size_t pos{}, processedNumbers{}; + if (pattern.size() < 6) + return std::nullopt; // Vérification du '[' initial if (pattern[pos++] != '[') { diff --git a/GPA675Lab1GOL/GridTeamH.cpp b/GPA675Lab1GOL/GridTeamH.cpp index 4a125e7..4d2ddf6 100644 --- a/GPA675Lab1GOL/GridTeamH.cpp +++ b/GPA675Lab1GOL/GridTeamH.cpp @@ -59,11 +59,11 @@ GridTeamH& GridTeamH::operator=(GridTeamH&& mv) noexcept if (this != &mv) { dealloc(); - mAliveCount = std::move(mv.mAliveCount); - mWidth = std::move(mv.mWidth); - mHeight = std::move(mv.mHeight); - mData = std::move(mv.mData); - mIntermediateData = std::move(mv.mIntermediateData); + mAliveCount = mv.mAliveCount; + mWidth = mv.mWidth; + mHeight = mv.mHeight; + mData = mv.mData; + mIntermediateData = mv.mIntermediateData; // Il faut que le destructeur de l'ancien objet soit valide. mv.mData = nullptr;