|
@@ -24,15 +24,6 @@ void JExpressionMemory::unlock()
|
|
|
cs.unlock();
|
|
cs.unlock();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-float JExpressionMemory::getNoise(
|
|
|
|
|
- Framework::Text name, float x, float y, float z) const
|
|
|
|
|
-{
|
|
|
|
|
- Noise* currentNoise = noises.z(name, name.getLength());
|
|
|
|
|
- if (currentNoise)
|
|
|
|
|
- return (float)currentNoise->getNoise((double)x, (double)y, (double)z);
|
|
|
|
|
- return 0.f;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
Noise* JExpressionMemory::zNoiseP(Framework::Text name)
|
|
Noise* JExpressionMemory::zNoiseP(Framework::Text name)
|
|
|
{
|
|
{
|
|
|
return noises.z(name, name.getLength());
|
|
return noises.z(name, name.getLength());
|
|
@@ -49,11 +40,6 @@ void JExpressionMemory::setCurrentChunk(Chunk* chunk)
|
|
|
currentChunk = chunk;
|
|
currentChunk = chunk;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-float JExpressionMemory::getFloatVariable(const Framework::Text& name) const
|
|
|
|
|
-{
|
|
|
|
|
- return floatVariables.get(name, name.getLength());
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
float* JExpressionMemory::getFloatVariableP(const Framework::Text& name)
|
|
float* JExpressionMemory::getFloatVariableP(const Framework::Text& name)
|
|
|
{
|
|
{
|
|
|
if (!floatVariables.contains(name, name.getLength()))
|
|
if (!floatVariables.contains(name, name.getLength()))
|
|
@@ -63,17 +49,6 @@ float* JExpressionMemory::getFloatVariableP(const Framework::Text& name)
|
|
|
return floatVariables.getP(name, name.getLength());
|
|
return floatVariables.getP(name, name.getLength());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void JExpressionMemory::setFloatVariable(
|
|
|
|
|
- const Framework::Text& name, float value)
|
|
|
|
|
-{
|
|
|
|
|
- floatVariables.set(name, name.getLength(), value);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-bool JExpressionMemory::getBoolVariable(const Framework::Text& name) const
|
|
|
|
|
-{
|
|
|
|
|
- return boolVariables.get(name, name.getLength());
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
bool* JExpressionMemory::getBoolVariableP(const Framework::Text& name)
|
|
bool* JExpressionMemory::getBoolVariableP(const Framework::Text& name)
|
|
|
{
|
|
{
|
|
|
if (!boolVariables.contains(name, name.getLength()))
|
|
if (!boolVariables.contains(name, name.getLength()))
|
|
@@ -83,16 +58,6 @@ bool* JExpressionMemory::getBoolVariableP(const Framework::Text& name)
|
|
|
return boolVariables.getP(name, name.getLength());
|
|
return boolVariables.getP(name, name.getLength());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void JExpressionMemory::setBoolVariable(const Framework::Text& name, bool value)
|
|
|
|
|
-{
|
|
|
|
|
- return boolVariables.set(name, name.getLength(), value);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-Chunk* JExpressionMemory::zCurrentChunk()
|
|
|
|
|
-{
|
|
|
|
|
- return currentChunk;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
Chunk** JExpressionMemory::zzCurrentChunk()
|
|
Chunk** JExpressionMemory::zzCurrentChunk()
|
|
|
{
|
|
{
|
|
|
return ¤tChunk;
|
|
return ¤tChunk;
|
|
@@ -103,17 +68,9 @@ JFloatExpression::JFloatExpression()
|
|
|
compiled(0)
|
|
compiled(0)
|
|
|
{}
|
|
{}
|
|
|
|
|
|
|
|
-float JFloatExpression::getValue(JExpressionMemory* zMemory)
|
|
|
|
|
|
|
+float JFloatExpression::getValue()
|
|
|
{
|
|
{
|
|
|
- FloatFunc func = compile(zMemory);
|
|
|
|
|
- float result = func();
|
|
|
|
|
- /* float old = getValueOld(zMemory);
|
|
|
|
|
- if (result != old)
|
|
|
|
|
- {
|
|
|
|
|
- float x = func();
|
|
|
|
|
- Framework::Logging::debug() << "fehler" << x << " != " << old;
|
|
|
|
|
- }*/
|
|
|
|
|
- return result;
|
|
|
|
|
|
|
+ return compiled();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
FloatFunc JFloatExpression::compile(JExpressionMemory* zMemory)
|
|
FloatFunc JFloatExpression::compile(JExpressionMemory* zMemory)
|
|
@@ -135,15 +92,9 @@ JBoolExpression::JBoolExpression()
|
|
|
compiled(0)
|
|
compiled(0)
|
|
|
{}
|
|
{}
|
|
|
|
|
|
|
|
-bool JBoolExpression::getValue(JExpressionMemory* zMemory)
|
|
|
|
|
|
|
+bool JBoolExpression::getValue()
|
|
|
{
|
|
{
|
|
|
- bool result = compile(zMemory)();
|
|
|
|
|
- /* bool old = getValueOld(zMemory);
|
|
|
|
|
- if (result != old)
|
|
|
|
|
- {
|
|
|
|
|
- Framework::Logging::debug() << "fehler";
|
|
|
|
|
- }*/
|
|
|
|
|
- return result;
|
|
|
|
|
|
|
+ return compiled();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
BoolFunc JBoolExpression::compile(JExpressionMemory* zMemory)
|
|
BoolFunc JBoolExpression::compile(JExpressionMemory* zMemory)
|
|
@@ -165,11 +116,6 @@ JVariableFloatExpression::JVariableFloatExpression()
|
|
|
: JFloatExpression()
|
|
: JFloatExpression()
|
|
|
{}
|
|
{}
|
|
|
|
|
|
|
|
-float JVariableFloatExpression::getValueOld(JExpressionMemory* zMemory)
|
|
|
|
|
-{
|
|
|
|
|
- return zMemory->getFloatVariable(name);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
Framework::Assembly::AssemblyBlock& JVariableFloatExpression::buildAssembly(
|
|
Framework::Assembly::AssemblyBlock& JVariableFloatExpression::buildAssembly(
|
|
|
JExpressionMemory* zMemory)
|
|
JExpressionMemory* zMemory)
|
|
|
{
|
|
{
|
|
@@ -224,11 +170,6 @@ JVariableBoolExpression::JVariableBoolExpression()
|
|
|
: JBoolExpression()
|
|
: JBoolExpression()
|
|
|
{}
|
|
{}
|
|
|
|
|
|
|
|
-bool JVariableBoolExpression::getValueOld(JExpressionMemory* zMemory)
|
|
|
|
|
-{
|
|
|
|
|
- return zMemory->getBoolVariable(name);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
Framework::Assembly::AssemblyBlock& JVariableBoolExpression::buildAssembly(
|
|
Framework::Assembly::AssemblyBlock& JVariableBoolExpression::buildAssembly(
|
|
|
JExpressionMemory* zMemory)
|
|
JExpressionMemory* zMemory)
|
|
|
{
|
|
{
|
|
@@ -284,11 +225,6 @@ JConstantFloatExpression::JConstantFloatExpression()
|
|
|
value(0)
|
|
value(0)
|
|
|
{}
|
|
{}
|
|
|
|
|
|
|
|
-float JConstantFloatExpression::getValueOld(JExpressionMemory* zMemory)
|
|
|
|
|
-{
|
|
|
|
|
- return value;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
Framework::Assembly::AssemblyBlock& JConstantFloatExpression::buildAssembly(
|
|
Framework::Assembly::AssemblyBlock& JConstantFloatExpression::buildAssembly(
|
|
|
JExpressionMemory* zMemory)
|
|
JExpressionMemory* zMemory)
|
|
|
{
|
|
{
|
|
@@ -342,11 +278,6 @@ JConstantBoolExpression::JConstantBoolExpression()
|
|
|
: JBoolExpression()
|
|
: JBoolExpression()
|
|
|
{}
|
|
{}
|
|
|
|
|
|
|
|
-bool JConstantBoolExpression::getValueOld(JExpressionMemory* zMemory)
|
|
|
|
|
-{
|
|
|
|
|
- return value;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
Framework::Assembly::AssemblyBlock& JConstantBoolExpression::buildAssembly(
|
|
Framework::Assembly::AssemblyBlock& JConstantBoolExpression::buildAssembly(
|
|
|
JExpressionMemory* zMemory)
|
|
JExpressionMemory* zMemory)
|
|
|
{
|
|
{
|
|
@@ -410,14 +341,6 @@ JNoiseFloatExpression::~JNoiseFloatExpression()
|
|
|
if (z) z->release();
|
|
if (z) z->release();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-float JNoiseFloatExpression::getValueOld(JExpressionMemory* zMemory)
|
|
|
|
|
-{
|
|
|
|
|
- return zMemory->getNoise(name,
|
|
|
|
|
- x->getValueOld(zMemory),
|
|
|
|
|
- y->getValueOld(zMemory),
|
|
|
|
|
- z->getValueOld(zMemory));
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
Framework::Assembly::AssemblyBlock& JNoiseFloatExpression::buildAssembly(
|
|
Framework::Assembly::AssemblyBlock& JNoiseFloatExpression::buildAssembly(
|
|
|
JExpressionMemory* zMemory)
|
|
JExpressionMemory* zMemory)
|
|
|
{
|
|
{
|
|
@@ -595,29 +518,9 @@ const char* JNoiseFloatExpressionFactory::getTypeToken() const
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
JOperatorFloatExpression::JOperatorFloatExpression()
|
|
JOperatorFloatExpression::JOperatorFloatExpression()
|
|
|
- : JFloatExpression(),
|
|
|
|
|
- accumulator([](float a, float b) { return 0.f; })
|
|
|
|
|
|
|
+ : JFloatExpression()
|
|
|
{}
|
|
{}
|
|
|
|
|
|
|
|
-float JOperatorFloatExpression::getValueOld(JExpressionMemory* zMemory)
|
|
|
|
|
-{
|
|
|
|
|
- bool first = 1;
|
|
|
|
|
- float val = 0.f;
|
|
|
|
|
- for (JFloatExpression* expression : values)
|
|
|
|
|
- {
|
|
|
|
|
- if (first)
|
|
|
|
|
- {
|
|
|
|
|
- first = 0;
|
|
|
|
|
- val = expression->getValueOld(zMemory);
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- val = accumulator(val, expression->getValueOld(zMemory));
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return val;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
Framework::Assembly::AssemblyBlock& JOperatorFloatExpression::buildAssembly(
|
|
Framework::Assembly::AssemblyBlock& JOperatorFloatExpression::buildAssembly(
|
|
|
JExpressionMemory* zMemory)
|
|
JExpressionMemory* zMemory)
|
|
|
{
|
|
{
|
|
@@ -690,11 +593,9 @@ Framework::Assembly::AssemblyBlock& JOperatorFloatExpression::buildAssembly(
|
|
|
return codeBlock;
|
|
return codeBlock;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void JOperatorFloatExpression::setOperator(
|
|
|
|
|
- Framework::Text op, std::function<float(float a, float b)> accumulator)
|
|
|
|
|
|
|
+void JOperatorFloatExpression::setOperator(Framework::Text op)
|
|
|
{
|
|
{
|
|
|
this->op = op;
|
|
this->op = op;
|
|
|
- this->accumulator = accumulator;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Framework::Text JOperatorFloatExpression::getOperator()
|
|
Framework::Text JOperatorFloatExpression::getOperator()
|
|
@@ -721,23 +622,7 @@ JOperatorFloatExpression* JOperatorFloatExpressionFactory::fromJson(
|
|
|
Framework::JSON::JSONObject* zJson) const
|
|
Framework::JSON::JSONObject* zJson) const
|
|
|
{
|
|
{
|
|
|
JOperatorFloatExpression* result = new JOperatorFloatExpression();
|
|
JOperatorFloatExpression* result = new JOperatorFloatExpression();
|
|
|
- Framework::Text op = zJson->zValue("operator")->asString()->getString();
|
|
|
|
|
- if (op.istGleich("+"))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator("+", [](float a, float b) { return a + b; });
|
|
|
|
|
- }
|
|
|
|
|
- else if (op.istGleich("-"))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator("-", [](float a, float b) { return a - b; });
|
|
|
|
|
- }
|
|
|
|
|
- else if (op.istGleich("*"))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator("*", [](float a, float b) { return a * b; });
|
|
|
|
|
- }
|
|
|
|
|
- else if (op.istGleich("/"))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator("/", [](float a, float b) { return a / b; });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ result->setOperator(zJson->zValue("operator")->asString()->getString());
|
|
|
for (Framework::JSON::JSONValue* value :
|
|
for (Framework::JSON::JSONValue* value :
|
|
|
*zJson->zValue("values")->asArray())
|
|
*zJson->zValue("values")->asArray())
|
|
|
{
|
|
{
|
|
@@ -785,25 +670,6 @@ JBoolOperatorBoolExpression::JBoolOperatorBoolExpression()
|
|
|
: JBoolExpression()
|
|
: JBoolExpression()
|
|
|
{}
|
|
{}
|
|
|
|
|
|
|
|
-bool JBoolOperatorBoolExpression::getValueOld(JExpressionMemory* zMemory)
|
|
|
|
|
-{
|
|
|
|
|
- bool first = 1;
|
|
|
|
|
- bool val = 0;
|
|
|
|
|
- for (JBoolExpression* expression : values)
|
|
|
|
|
- {
|
|
|
|
|
- if (first)
|
|
|
|
|
- {
|
|
|
|
|
- first = 0;
|
|
|
|
|
- val = expression->getValueOld(zMemory);
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- val = accumulator(val, expression->getValueOld(zMemory));
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return val;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
Framework::Assembly::AssemblyBlock& JBoolOperatorBoolExpression::buildAssembly(
|
|
Framework::Assembly::AssemblyBlock& JBoolOperatorBoolExpression::buildAssembly(
|
|
|
JExpressionMemory* zMemory)
|
|
JExpressionMemory* zMemory)
|
|
|
{
|
|
{
|
|
@@ -855,11 +721,9 @@ Framework::Assembly::AssemblyBlock& JBoolOperatorBoolExpression::buildAssembly(
|
|
|
return codeBlock;
|
|
return codeBlock;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void JBoolOperatorBoolExpression::setOperator(
|
|
|
|
|
- Framework::Text op, std::function<float(float a, float b)> accumulator)
|
|
|
|
|
|
|
+void JBoolOperatorBoolExpression::setOperator(Framework::Text op)
|
|
|
{
|
|
{
|
|
|
this->op = op;
|
|
this->op = op;
|
|
|
- this->accumulator = accumulator;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Framework::Text JBoolOperatorBoolExpression::getOperator()
|
|
Framework::Text JBoolOperatorBoolExpression::getOperator()
|
|
@@ -892,15 +756,7 @@ JBoolOperatorBoolExpression* JBoolOperatorBoolExpressionFactory::fromJson(
|
|
|
result->addValue(
|
|
result->addValue(
|
|
|
Game::INSTANCE->zTypeRegistry()->fromJson<JBoolExpression>(value));
|
|
Game::INSTANCE->zTypeRegistry()->fromJson<JBoolExpression>(value));
|
|
|
}
|
|
}
|
|
|
- Framework::Text op = zJson->zValue("operator")->asString()->getString();
|
|
|
|
|
- if (op.istGleich("&&"))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator("&&", [](bool a, bool b) { return a && b; });
|
|
|
|
|
- }
|
|
|
|
|
- else if (op.istGleich("||"))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator("||", [](bool a, bool b) { return a || b; });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ result->setOperator(zJson->zValue("operator")->asString()->getString());
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -942,22 +798,6 @@ JFloatOperatorBoolExpression::JFloatOperatorBoolExpression()
|
|
|
: JBoolExpression()
|
|
: JBoolExpression()
|
|
|
{}
|
|
{}
|
|
|
|
|
|
|
|
-bool JFloatOperatorBoolExpression::getValueOld(JExpressionMemory* zMemory)
|
|
|
|
|
-{
|
|
|
|
|
- bool first = 1;
|
|
|
|
|
- bool val = 1;
|
|
|
|
|
- float last = 0.f;
|
|
|
|
|
- for (JFloatExpression* expression : values)
|
|
|
|
|
- {
|
|
|
|
|
- float current = expression->getValueOld(zMemory);
|
|
|
|
|
- if (!first) val &= accumulator(last, current);
|
|
|
|
|
- first = 0;
|
|
|
|
|
- last = current;
|
|
|
|
|
- if (!val) break;
|
|
|
|
|
- }
|
|
|
|
|
- return val;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
Framework::Assembly::AssemblyBlock& JFloatOperatorBoolExpression::buildAssembly(
|
|
Framework::Assembly::AssemblyBlock& JFloatOperatorBoolExpression::buildAssembly(
|
|
|
JExpressionMemory* zMemory)
|
|
JExpressionMemory* zMemory)
|
|
|
{
|
|
{
|
|
@@ -1088,11 +928,9 @@ Framework::Assembly::AssemblyBlock& JFloatOperatorBoolExpression::buildAssembly(
|
|
|
return codeBlock;
|
|
return codeBlock;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void JFloatOperatorBoolExpression::setOperator(
|
|
|
|
|
- Framework::Text op, std::function<bool(float a, float b)> accumulator)
|
|
|
|
|
|
|
+void JFloatOperatorBoolExpression::setOperator(Framework::Text op)
|
|
|
{
|
|
{
|
|
|
this->op = op;
|
|
this->op = op;
|
|
|
- this->accumulator = accumulator;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Framework::Text JFloatOperatorBoolExpression::getOperator()
|
|
Framework::Text JFloatOperatorBoolExpression::getOperator()
|
|
@@ -1119,61 +957,7 @@ JFloatOperatorBoolExpression* JFloatOperatorBoolExpressionFactory::fromJson(
|
|
|
Framework::JSON::JSONObject* zJson) const
|
|
Framework::JSON::JSONObject* zJson) const
|
|
|
{
|
|
{
|
|
|
JFloatOperatorBoolExpression* result = new JFloatOperatorBoolExpression();
|
|
JFloatOperatorBoolExpression* result = new JFloatOperatorBoolExpression();
|
|
|
- Framework::Text op = zJson->zValue("operator")->asString()->getString();
|
|
|
|
|
- if (op.istGleich(">"))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator(">", [](float a, float b) { return a > b; });
|
|
|
|
|
- }
|
|
|
|
|
- else if (op.istGleich("<"))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator("<", [](float a, float b) { return a < b; });
|
|
|
|
|
- }
|
|
|
|
|
- else if (op.istGleich(">="))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator(">=", [](float a, float b) { return a >= b; });
|
|
|
|
|
- }
|
|
|
|
|
- else if (op.istGleich("<="))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator("<=", [](float a, float b) { return a <= b; });
|
|
|
|
|
- }
|
|
|
|
|
- else if (op.istGleich("=="))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator("==", [](float a, float b) { return a == b; });
|
|
|
|
|
- }
|
|
|
|
|
- else if (op.istGleich("!="))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator("!=", [](float a, float b) { return a != b; });
|
|
|
|
|
- }
|
|
|
|
|
- else if (op.istGleich(">i"))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator(
|
|
|
|
|
- ">i", [](float a, float b) { return (int)a > (int)b; });
|
|
|
|
|
- }
|
|
|
|
|
- else if (op.istGleich("<i"))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator(
|
|
|
|
|
- "<i", [](float a, float b) { return (int)a < (int)b; });
|
|
|
|
|
- }
|
|
|
|
|
- else if (op.istGleich(">=i"))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator(
|
|
|
|
|
- ">=i", [](float a, float b) { return (int)a >= (int)b; });
|
|
|
|
|
- }
|
|
|
|
|
- else if (op.istGleich("<=i"))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator(
|
|
|
|
|
- "<=i", [](float a, float b) { return (int)a <= (int)b; });
|
|
|
|
|
- }
|
|
|
|
|
- else if (op.istGleich("==i"))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator(
|
|
|
|
|
- "==i", [](float a, float b) { return (int)a == (int)b; });
|
|
|
|
|
- }
|
|
|
|
|
- else if (op.istGleich("!=i"))
|
|
|
|
|
- {
|
|
|
|
|
- result->setOperator(
|
|
|
|
|
- "!=i", [](float a, float b) { return (int)a != (int)b; });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ result->setOperator(zJson->zValue("operator")->asString()->getString());
|
|
|
for (Framework::JSON::JSONValue* value :
|
|
for (Framework::JSON::JSONValue* value :
|
|
|
*zJson->zValue("values")->asArray())
|
|
*zJson->zValue("values")->asArray())
|
|
|
{
|
|
{
|
|
@@ -1251,21 +1035,6 @@ bool JBlockTypeBoolExpression::isValidPosition(
|
|
|
&& Game::getChunkCenter(x, y) == currentChunk->getCenter();
|
|
&& Game::getChunkCenter(x, y) == currentChunk->getCenter();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-bool JBlockTypeBoolExpression::getValueOld(JExpressionMemory* zMemory)
|
|
|
|
|
-{
|
|
|
|
|
- int x = (int)(round(this->x->getValueOld(zMemory)));
|
|
|
|
|
- int y = (int)(round(this->y->getValueOld(zMemory)));
|
|
|
|
|
- int z = (int)(round(this->z->getValueOld(zMemory)));
|
|
|
|
|
- if (z < 0 || z >= WORLD_HEIGHT || !zMemory->zCurrentChunk()
|
|
|
|
|
- || Game::getChunkCenter(x, y) != zMemory->zCurrentChunk()->getCenter())
|
|
|
|
|
- {
|
|
|
|
|
- return 0;
|
|
|
|
|
- }
|
|
|
|
|
- return zMemory->zCurrentChunk()->getBlockTypeAt(
|
|
|
|
|
- Dimension::chunkCoordinates({x, y, z}))
|
|
|
|
|
- == typeId;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
Framework::Assembly::AssemblyBlock& JBlockTypeBoolExpression::buildAssembly(
|
|
Framework::Assembly::AssemblyBlock& JBlockTypeBoolExpression::buildAssembly(
|
|
|
JExpressionMemory* zMemory)
|
|
JExpressionMemory* zMemory)
|
|
|
{
|
|
{
|