Large overhaul of pointers to shared_ptrs, implemented function evaluation

This commit is contained in:
2019-06-01 19:20:31 +02:00
parent 8b70eed516
commit 4408cf00cd
17 changed files with 261 additions and 129 deletions

View File

@@ -11,13 +11,10 @@ class NumericEvalValue : public EvalValue{
virtual double GetFloatValue() = 0;
protected:
ScriptType* _type;
std::shared_ptr<ScriptType> _type;
public:
~NumericEvalValue() override{
delete _type;
};
virtual const bool IsFloat() = 0;
ScriptType* GetType() override {
std::shared_ptr<ScriptType> GetType() override {
return _type;
}
@@ -34,7 +31,7 @@ class IntegerEvalValue : public NumericEvalValue{
double GetFloatValue() final{ throw EvaluationException("Attempting to retrieve float from int eval value."); }
public:
explicit IntegerEvalValue(long value){
_type = new NumericScriptType(true, false);
_type = std::make_shared<NumericScriptType>(true, false);
_value = value;
}
const bool IsFloat() final{
@@ -62,7 +59,7 @@ class FloatEvalValue : public NumericEvalValue{
double GetFloatValue() final{return _value;}
public:
explicit FloatEvalValue(double value){
_type = new NumericScriptType(true, true);
_type = std::make_shared<NumericScriptType>(true, true);
_value = value;
}
const bool IsFloat() final{