From ca0eecee808238980e4606390eb4c549d9f1fe2b Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sun, 26 Oct 2014 18:11:46 -0400 Subject: [PATCH] pavg0 / pavg1 properties can be set through the console and prop --- src/lua/CommandInterface.cpp | 6 ++++++ src/lua/LegacyLuaAPI.cpp | 6 ++++++ src/simulation/Particle.cpp | 2 ++ 3 files changed, 14 insertions(+) diff --git a/src/lua/CommandInterface.cpp b/src/lua/CommandInterface.cpp index 6b2248887e..8f8e5cef24 100644 --- a/src/lua/CommandInterface.cpp +++ b/src/lua/CommandInterface.cpp @@ -74,6 +74,12 @@ int CommandInterface::GetPropertyOffset(std::string key_, FormatType & format) } else if (strcmp(key, "dcolor")==0){ offset = offsetof(Particle, dcolour); format = FormatInt; + } else if (!strcmp(key, "pavg0")){ + offset = offsetof(Particle, pavg[0]); + format = FormatFloat; + } else if (!strcmp(key, "pavg1")){ + offset = offsetof(Particle, pavg[1]); + format = FormatFloat; } else { offset = -1; } diff --git a/src/lua/LegacyLuaAPI.cpp b/src/lua/LegacyLuaAPI.cpp index 17fd59453a..cd70c91a99 100644 --- a/src/lua/LegacyLuaAPI.cpp +++ b/src/lua/LegacyLuaAPI.cpp @@ -146,6 +146,12 @@ int luacon_particle_getproperty(const char * key, int * format) } else if (!strcmp(key, "dcolor")) { offset = offsetof(Particle, dcolour); *format = 0; + } else if (!strcmp(key, "pavg0")) { + offset = offsetof(Particle, pavg[0]); + *format = 1; + } else if (!strcmp(key, "pavg1")) { + offset = offsetof(Particle, pavg[1]); + *format = 1; } else { offset = -1; } diff --git a/src/simulation/Particle.cpp b/src/simulation/Particle.cpp index 19089a1e9f..3d851ccb8e 100644 --- a/src/simulation/Particle.cpp +++ b/src/simulation/Particle.cpp @@ -16,5 +16,7 @@ std::vector Particle::GetProperties() properties.push_back(StructProperty("tmp", StructProperty::Integer, offsetof(Particle, tmp))); properties.push_back(StructProperty("tmp2", StructProperty::Integer, offsetof(Particle, tmp2))); properties.push_back(StructProperty("dcolour", StructProperty::UInteger, offsetof(Particle, dcolour))); + properties.push_back(StructProperty("pavg0", StructProperty::Float, offsetof(Particle, pavg[0]))); + properties.push_back(StructProperty("pavg1", StructProperty::Float, offsetof(Particle, pavg[1]))); return properties; }