mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Remove incorrect destructors - fl::Engine is responsible for these
This commit is contained in:
		| @@ -278,22 +278,6 @@ float TacticalAdvantageEngine::getTacticalAdvantage(const CArmedInstance * we, c | ||||
| 	return output; | ||||
| } | ||||
|  | ||||
| TacticalAdvantageEngine::~TacticalAdvantageEngine() | ||||
| { | ||||
| 	//TODO: smart pointers? | ||||
| 	delete ourWalkers; | ||||
| 	delete ourShooters; | ||||
| 	delete ourFlyers; | ||||
| 	delete enemyWalkers; | ||||
| 	delete enemyShooters; | ||||
| 	delete enemyFlyers; | ||||
| 	delete ourSpeed; | ||||
| 	delete enemySpeed; | ||||
| 	delete bankPresent; | ||||
| 	delete castleWalls; | ||||
| 	delete threat; | ||||
| } | ||||
|  | ||||
| //std::shared_ptr<AbstractGoal> chooseSolution (std::vector<std::shared_ptr<AbstractGoal>> & vec) | ||||
|  | ||||
| Goals::TSubgoal FuzzyHelper::chooseSolution(Goals::TGoalVec vec) | ||||
| @@ -427,14 +411,6 @@ void HeroMovementGoalEngineBase::setSharedFuzzyVariables(Goals::AbstractGoal & g | ||||
| 	} | ||||
| } | ||||
|  | ||||
| HeroMovementGoalEngineBase::~HeroMovementGoalEngineBase() | ||||
| { | ||||
| 	delete strengthRatio; | ||||
| 	delete heroStrength; | ||||
| 	delete turnDistance; | ||||
| 	delete missionImportance; | ||||
| } | ||||
|  | ||||
| float FuzzyHelper::evaluate(Goals::VisitTile & g) | ||||
| { | ||||
| 	return visitTileEngine.evaluate(g); | ||||
| @@ -553,11 +529,6 @@ GetObjEngine::GetObjEngine() | ||||
| 	configure(); | ||||
| } | ||||
|  | ||||
| GetObjEngine::~GetObjEngine() | ||||
| {  | ||||
| 	delete objectValue; | ||||
| } | ||||
|  | ||||
| float GetObjEngine::evaluate(Goals::AbstractGoal & goal) | ||||
| { | ||||
| 	auto g = dynamic_cast<Goals::GetObj &>(goal); | ||||
| @@ -603,10 +574,6 @@ VisitTileEngine::VisitTileEngine() //so far no VisitTile-specific variables that | ||||
| 	configure(); | ||||
| } | ||||
|  | ||||
| VisitTileEngine::~VisitTileEngine() | ||||
| { | ||||
| } | ||||
|  | ||||
| float VisitTileEngine::evaluate(Goals::AbstractGoal & goal) | ||||
| { | ||||
| 	auto g = dynamic_cast<Goals::VisitTile &>(goal); | ||||
|   | ||||
| @@ -16,7 +16,7 @@ class CArmedInstance; | ||||
| class CBank; | ||||
| struct SectorMap; | ||||
|  | ||||
| class engineBase | ||||
| class engineBase //subclasses create fuzzylite variables with "new" that are not freed - this is desired as fl::Engine wants to destroy these... | ||||
| { | ||||
| protected: | ||||
| 	fl::Engine engine; | ||||
| @@ -31,9 +31,7 @@ class TacticalAdvantageEngine : public engineBase | ||||
| { | ||||
| public: | ||||
| 	TacticalAdvantageEngine(); | ||||
|  | ||||
| 	float getTacticalAdvantage(const CArmedInstance * we, const CArmedInstance * enemy); //returns factor how many times enemy is stronger than us | ||||
| 	~TacticalAdvantageEngine(); | ||||
| private: | ||||
| 	fl::InputVariable * ourWalkers, *ourShooters, *ourFlyers, *enemyWalkers, *enemyShooters, *enemyFlyers; | ||||
| 	fl::InputVariable * ourSpeed, *enemySpeed; | ||||
| @@ -48,7 +46,6 @@ public: | ||||
| 	HeroMovementGoalEngineBase(); | ||||
|  | ||||
| 	virtual float evaluate(Goals::AbstractGoal & goal) = 0; | ||||
| 	virtual ~HeroMovementGoalEngineBase(); | ||||
|  | ||||
| protected: | ||||
| 	void setSharedFuzzyVariables(Goals::AbstractGoal & goal); | ||||
| @@ -67,7 +64,6 @@ class VisitTileEngine : public HeroMovementGoalEngineBase | ||||
| { | ||||
| public: | ||||
| 	VisitTileEngine(); | ||||
| 	~VisitTileEngine(); | ||||
| 	float evaluate(Goals::AbstractGoal & goal) override; | ||||
| }; | ||||
|  | ||||
| @@ -75,7 +71,6 @@ class GetObjEngine : public HeroMovementGoalEngineBase | ||||
| { | ||||
| public: | ||||
| 	GetObjEngine(); | ||||
| 	~GetObjEngine(); | ||||
| 	float evaluate(Goals::AbstractGoal & goal) override; | ||||
| protected: | ||||
| 	fl::InputVariable * objectValue; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user