redid some of the includes and changed way statics are saved
This commit is contained in:
@ -3,7 +3,13 @@
|
||||
//
|
||||
|
||||
#include "DestructionPower.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
map<int,float> DestructionPower_Properties::SpeedTable =
|
||||
{
|
||||
{1,0.001}
|
||||
};
|
||||
|
||||
|
||||
void DestructionPower::PreProcessing(const vector<Part*>* partArray)
|
||||
{
|
||||
@ -31,14 +37,18 @@ void DestructionPower::DestructionOfSurrounding(const coor constraintCoordinate)
|
||||
if(constraintCoordinate.row > 0)
|
||||
{
|
||||
divisor++;
|
||||
newDestructionArray[i] += m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row-1].m_destruction.DestructionArray[i];
|
||||
newDestructionArray[i] += m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row-1].DestructionArray[i];
|
||||
}
|
||||
if(constraintCoordinate.col > 0)
|
||||
{
|
||||
divisor++;
|
||||
newDestructionArray[i] += m_constraintMatrix[constraintCoordinate.col-1][constraintCoordinate.row].m_destruction.DestructionArray[i];
|
||||
newDestructionArray[i] += m_constraintMatrix[constraintCoordinate.col-1][constraintCoordinate.row].DestructionArray[i];
|
||||
}
|
||||
if(divisor)
|
||||
newDestructionArray[i] /=divisor;
|
||||
}
|
||||
}
|
||||
DestructionPower_Properties::DestructionPower_Properties() {
|
||||
for(int i=0;i<sizeof(DestructionArray);i++)
|
||||
DestructionArray.emplace_back(DestructionPower_Properties::SpeedTable[i]*DESTRUCTION_INIT);
|
||||
}
|
@ -5,25 +5,25 @@
|
||||
#ifndef SOURCE_DESTRUCTIONPOWER_H
|
||||
#define SOURCE_DESTRUCTIONPOWER_H
|
||||
|
||||
#define DESTRUCTION_INIT 0.5
|
||||
#define DESTRUCTION_COUNT 1
|
||||
|
||||
#include "../AbstraktionLayer_Base.h"
|
||||
#include "DestructionPower_Properties.h"
|
||||
#include "../AbstraktionLayer_Base.h"
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
#include <random>
|
||||
|
||||
class DestructionPower : public AbstraktionLayer_Base<DestructionPower_Properties>
|
||||
class DestructionPower : public AbstractionLayer_Base<DestructionPower_Properties>
|
||||
{
|
||||
public:
|
||||
void PreProcessing(const vector<Part*>* partArray);//override
|
||||
bool EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector);
|
||||
bool SetConstraintOnPosition(const coor constraintCoordinate, const AbstractionLayer_1_Properties constraint);
|
||||
bool RemoveConstraintOnPosition(const coor constraintCoordinate);
|
||||
void PreProcessing(const vector<Part*>* partArray) override;
|
||||
bool EvaluateQuality (coor constraintCoordinate, qualityVector& qVector) override;
|
||||
bool SetConstraintOnPosition(coor constraintCoordinate, AbstractionLayer_1_Properties constraint);
|
||||
bool RemoveConstraintOnPosition(coor constraintCoordinate)override;
|
||||
|
||||
void DestructionOfSurrounding(const coor constraintCoordinate);
|
||||
void DestructionOfSurrounding(coor constraintCoordinate);
|
||||
|
||||
private:
|
||||
};
|
||||
|
@ -1,47 +1,29 @@
|
||||
//
|
||||
// Created by mpapa on 05.12.2017.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#ifndef SOURCE_DESTRUCTIONPOWER_PROPERTIES_H
|
||||
#define SOURCE_DESTRUCTIONPOWER_PROPERTIES_H
|
||||
|
||||
#define DESTRUCTION_INIT 0.5
|
||||
#include <stdint.h>
|
||||
#include "DestructionPower.h"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class DestructionPower_Properties
|
||||
{
|
||||
public:
|
||||
DestructionPower_Properties()
|
||||
{
|
||||
for(int i=0;i<sizeof(DestructionArray);i++)
|
||||
DestructionArray[i]=(SpeedTable[i]*DESTRUCTION_INIT);
|
||||
|
||||
setSpeedTable();
|
||||
|
||||
}
|
||||
explicit DestructionPower_Properties();
|
||||
map<int,float> getSpeedTable()
|
||||
{
|
||||
return SpeedTable;
|
||||
}
|
||||
void setSpeedTable()
|
||||
{ SpeedTable=create_SpeedTable();}
|
||||
void setSpeedTable();
|
||||
|
||||
private:
|
||||
|
||||
static map<int,float> create_SpeedTable();
|
||||
static map<int,float> SpeedTable;
|
||||
|
||||
float DestructionArray[DESTRUCTION_COUNT];
|
||||
|
||||
vector<float> DestructionArray;
|
||||
friend class DestructionPower;
|
||||
|
||||
};
|
||||
|
||||
map<int,float> DestructionPower_Properties::create_SpeedTable()
|
||||
{
|
||||
map<int, float> m;
|
||||
m[1] = 0.001;
|
||||
return m;
|
||||
}
|
||||
|
||||
#endif //SOURCE_DESTRUCTIONPOWER_PROPERTIES_H
|
||||
};
|
Reference in New Issue
Block a user