Rework evaluation to use shared pointers, fix bugs

This commit is contained in:
2019-06-01 21:38:39 +02:00
parent 4408cf00cd
commit 6206fef4c5
17 changed files with 122 additions and 133 deletions

View File

@@ -20,7 +20,7 @@ public:
return ! (this->operator==(b));
}
virtual EvalValue* Clone() = 0;
virtual shared_ptr<EvalValue> Clone() = 0;
virtual long EvaluateInteger(){
throw EvaluationException("Can't evaluate this EvalValue as integer.");
@@ -45,8 +45,8 @@ public:
_type = std::make_shared<ScriptType>(TypeClass::Bool);
}
EvalValue* Clone() final{
return new BooleanEvalValue(_value);
shared_ptr<EvalValue> Clone() final{
return make_shared<BooleanEvalValue>(_value);
}
std::shared_ptr<ScriptType> GetType() final{