diff --git a/ex01/ScavTrap/ScavTrap.cpp b/ex01/ScavTrap/ScavTrap.cpp index a0b0792..b069329 100644 --- a/ex01/ScavTrap/ScavTrap.cpp +++ b/ex01/ScavTrap/ScavTrap.cpp @@ -30,10 +30,7 @@ ScavTrap::ScavTrap(std::string name) : ClapTrap(name) << std::endl; } -ScavTrap::ScavTrap(const ScavTrap &other) : ClapTrap(other) -{ - *this = other; -} +ScavTrap::ScavTrap(const ScavTrap &other) : ClapTrap(other) { } ScavTrap& ScavTrap::operator=(const ScavTrap &other) { @@ -71,6 +68,17 @@ void ScavTrap::attack(const std::string &target) void ScavTrap::guardGate() { - std::cout << "ScavTrap " << this->name << " is in Gate keeper mode" + if (this->guardGate) + { + this->guardGate = false; + std::cout << "ScavTrap " << this->name << " is not in Gate keeper mode" << std::endl; + } + else + { + this->guardGate = true; + std::cout << "ScavTrap " << this->name << " is in Gate keeper mode" + << std::endl; + } + } diff --git a/ex01/ScavTrap/ScavTrap.hpp b/ex01/ScavTrap/ScavTrap.hpp index 6096965..1798e36 100644 --- a/ex01/ScavTrap/ScavTrap.hpp +++ b/ex01/ScavTrap/ScavTrap.hpp @@ -19,6 +19,8 @@ class ScavTrap : public ClapTrap { + private: + boold guarding_gate; public: ScavTrap(); ScavTrap(std::string name); diff --git a/ex02/ScavTrap/ScavTrap.cpp b/ex02/ScavTrap/ScavTrap.cpp index c38736c..b069329 100644 --- a/ex02/ScavTrap/ScavTrap.cpp +++ b/ex02/ScavTrap/ScavTrap.cpp @@ -68,6 +68,17 @@ void ScavTrap::attack(const std::string &target) void ScavTrap::guardGate() { - std::cout << "ScavTrap " << this->name << " is in Gate keeper mode" + if (this->guardGate) + { + this->guardGate = false; + std::cout << "ScavTrap " << this->name << " is not in Gate keeper mode" << std::endl; + } + else + { + this->guardGate = true; + std::cout << "ScavTrap " << this->name << " is in Gate keeper mode" + << std::endl; + } + } diff --git a/ex02/ScavTrap/ScavTrap.hpp b/ex02/ScavTrap/ScavTrap.hpp index 6096965..1798e36 100644 --- a/ex02/ScavTrap/ScavTrap.hpp +++ b/ex02/ScavTrap/ScavTrap.hpp @@ -19,6 +19,8 @@ class ScavTrap : public ClapTrap { + private: + boold guarding_gate; public: ScavTrap(); ScavTrap(std::string name);