Destroy array of costs after we're done with them

This commit is contained in:
Michael Votaw
2025-02-11 19:39:03 -08:00
committed by teejusb
parent d5817b6264
commit 36c4223a38
+9 -1
View File
@@ -102,7 +102,6 @@ namespace StepParity {
int whereTheFeetAre[NUM_Foot]; // the inverse of columns
bool didTheFootMove[NUM_Foot]; // the inverse of movedFeet
bool isTheFootHolding[NUM_Foot]; //inverse of holdFeet
// These hashes are used in operator<() to speed up the comparison of the vectors.
// Their values are computed by calculateHashes(), which is used in StepParityGenerator::buildStateGraph().
int columnsHash = 0;
@@ -242,6 +241,15 @@ namespace StepParity {
State state;
std::unordered_map<StepParityNode *, float*> neighbors; // Connections to, and the cost of moving to, the connected nodes
~StepParityNode()
{
for(auto neighbor: neighbors)
{
delete[] neighbor.second;
}
neighbors.clear();
}
StepParityNode(const State &_state)
{
state = _state;