App::cArithmeticaResource class

Represents an .arth file, which is ascripts that allows doing mathematical operations on certain values.

Example usage:

App::cArithmeticaResource arithmetica;
App::cArithmeticaResource::Load(id("CustomArthTest"), GroupIDs::Scripts1, arithmetica);
arithmetica.SetValue("myVariable", 2.0f);
arithmetica.ComputeAll();
App::ConsolePrintF("%f", arithmetica.GetValue("output"));

Base classes

class Resource::CachedResourceObject

Public types

struct ArithmeticaFunction
struct ArithmeticaState
struct OperationDefinition

Public static variables

static const uint32_t TYPE

Public static functions

static auto Load(uint32_t instanceID, uint32_t groupID, cArithmeticaResource& dst) -> bool
Loads an instance of arithmetica resource.

Constructors, destructors, conversion operators

cArithmeticaResource()
~cArithmeticaResource() virtual
ASSERT_SIZE(OperationDefinition, 0x10)
ASSERT_SIZE(ArithmeticaState, 0x28)
ASSERT_SIZE(ArithmeticaFunction, 8)

Public functions

auto func14h() -> void virtual
auto ComputeFunction(const char* functionName) -> void virtual
Clears all data and computes only a specific function in the file.
auto ComputeAll() -> void virtual
Clears all data and computes the entire arithmetic file.
auto GetValue(const char* variableName) -> float
Gets the value of a variable, the file must have been computed before calling this.
auto SetValue(const char* variableName, float value) -> void
Sets the value of a variable.

Public variables

eastl::vector<eastl::string> mVariableNames
eastl::vector<float> mVariableValues
eastl::vector<OperationDefinition> mOperators
int field_54
ArithmeticaState mState
eastl::vector<ArithmeticaFunction> mFunctions

Function documentation

static bool App::cArithmeticaResource::Load(uint32_t instanceID, uint32_t groupID, cArithmeticaResource& dst)

Loads an instance of arithmetica resource.

Parameters
instanceID
groupID Usually GroupIDs::Scripts1
dst

void App::cArithmeticaResource::ComputeFunction(const char* functionName) virtual

Clears all data and computes only a specific function in the file.

Parameters
functionName

float App::cArithmeticaResource::GetValue(const char* variableName)

Gets the value of a variable, the file must have been computed before calling this.

Parameters
variableName
Returns The value of the variable, or 0.0 if the variable is not found

void App::cArithmeticaResource::SetValue(const char* variableName, float value)

Sets the value of a variable.

Parameters
variableName
value

It will not affect the results until the file is computed again.