If i run the following
#include <mapgen/MapGenerator.hpp>
int main(int argc, char ** argv) {
MapGenerator * mapgen = new MapGenerator(1600, 900);
mapgen->setSeed(4000);
mapgen->update();
mapgen->startSimulation();
delete mapgen;
}
I get a read access violation in Map::getRegionDistance trying to read from std::shared_ptrr.
I think this may be related to passing in a raw pointer Region * in Simulator.cpp makeRoad
and then casting them back to shared_ptr in LeastCostEstimate?
Or in AdjactedCost the micropather is given a reference to n which immediatly falls out of scope?
I tried changing
int result = pather->Solve(c->region.get(), oc->region.get() &path, &totalCost);
to
int result = pather->Solve(&(c->region), &(oc->region), &path, &totalCost);
and
for (auto n : r->neighbors) {
to
for (auto &n : r->neighbors) {
in AdjacentCost but then it crashes while trying to delete cities in removeBadPorts
If i run the following
I get a read access violation in Map::getRegionDistance trying to read from std::shared_ptrr.
I think this may be related to passing in a raw pointer
Region *in Simulator.cpp makeRoadand then casting them back to shared_ptr in LeastCostEstimate?
Or in AdjactedCost the micropather is given a reference to n which immediatly falls out of scope?
I tried changing
to
and
to
in AdjacentCost but then it crashes while trying to delete cities in removeBadPorts