Commit 3ed93d3e authored by Gerrit Erichsen's avatar Gerrit Erichsen
Browse files

Fixed hotfix errors: Fixed misplaced else-case and added missing funcion for location count

parent b385dbf6
......@@ -266,9 +266,9 @@ void CharLAlgorithm::insertOrReplaceLocation(size_t node, size_t location, strin
{
if (node < m_nodes.size())
{
if (m_nodes.size() < location)
if (m_nodes[node]->getLocationCount() <= location)
{
if (m_nodes.size() != location)
if (m_nodes[node]->getLocationCount() != location)
{
int diff = location - m_nodes.size();
for (int i = 0; i < diff; i++)
......@@ -281,11 +281,11 @@ void CharLAlgorithm::insertOrReplaceLocation(size_t node, size_t location, strin
Location newLocation(name, lat, lon, areaSolar, areaWind, m_preferences);
m_nodes[node]->addLocation(newLocation);
}
}
else
{
Location newLocation(name, lat, lon, areaSolar, areaWind, m_preferences);
m_nodes[node]->setLocation(location, newLocation);
else
{
Location newLocation(name, lat, lon, areaSolar, areaWind, m_preferences);
m_nodes[node]->setLocation(location, newLocation);
}
}
}
......
......@@ -931,6 +931,11 @@ const Location * Node::getLocationPtr(size_t index) const
return nullptr;
}
size_t Node::getLocationCount() const
{
return m_locations.size();
}
const SimulationPreferences * Node::getSimulationPreferences() const
{
//tz - simple getter
......
......@@ -152,6 +152,7 @@ public:
Conventional * getConventional(int index) const; //tc - storages in network for NOT const return necessary for getStatusAtTimeStep in OptimisationSchedule.cpp (Alternative might be: #include Network.h and use m_storage[index])
Storage * getStorage(int index) const; //get specific storage
const Location * getLocationPtr(size_t index) const;
size_t getLocationCount() const;
const SimulationPreferences * getSimulationPreferences() const; //tz - simulation preferences
//////////////////////////
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment