diff --git a/src/BatchMode.cpp b/src/BatchMode.cpp index d99d76e4..1d9a88ac 100644 --- a/src/BatchMode.cpp +++ b/src/BatchMode.cpp @@ -4955,7 +4955,7 @@ void setUpSpeciesTrait(vector parameters) { const bool isOutput = parameters[14] == "TRUE"; // Create species trait - SpeciesTrait* trait = new SpeciesTrait( + unique_ptr trait(new SpeciesTrait( traitType, sex, positions, expressionType, initDist, initParams, @@ -4964,7 +4964,7 @@ void setUpSpeciesTrait(vector parameters) { mutationDistribution, mutationParameters, ploidy, isOutput - ); + )); pSpecies->addTrait(traitType, *trait); } @@ -6478,7 +6478,7 @@ void RunBatch(int nSimuls, int nLandscapes) bool params_ok; simParams sim = paramsSim->getSim(); - Landscape* pLandscape = NULL; // pointer to landscape + Landscape* pLandscape = nullptr; // pointer to landscape t0 = (int)time(0); @@ -6503,7 +6503,7 @@ void RunBatch(int nSimuls, int nLandscapes) for (int j = 0; j < nLandscapes; j++) { // create new landscape - if (pLandscape != NULL) delete pLandscape; + if (pLandscape != nullptr) delete pLandscape; pLandscape = new Landscape; bool landOK = true; @@ -6698,10 +6698,10 @@ void RunBatch(int nSimuls, int nLandscapes) ifsTraits.clear(); } - if (pLandscape != NULL) + if (pLandscape != nullptr) { delete pLandscape; - pLandscape = NULL; + pLandscape = nullptr; } } // end of landOK condition diff --git a/src/RScore/Cell.cpp b/src/RScore/Cell.cpp index 85fa78ce..7f1e5660 100644 --- a/src/RScore/Cell.cpp +++ b/src/RScore/Cell.cpp @@ -182,7 +182,9 @@ unsigned long int Cell::getVisits(void) { return visits; } // Initial species distribution cell functions DistCell::DistCell(int xx, int yy) { - x = xx; y = yy; initialise = false; + x = xx; + y = yy; + initialise = false; } DistCell::~DistCell() { @@ -201,7 +203,10 @@ bool DistCell::toInitialise(locn loc) { bool DistCell::selected(void) { return initialise; } locn DistCell::getLocn(void) { - locn loc; loc.x = x; loc.y = y; return loc; + locn loc; + loc.x = x; + loc.y = y; + return loc; } //---------------------------------------------------------------------------