diff --git a/src/flamegpu/io/JSONRunPlanReader.cpp b/src/flamegpu/io/JSONRunPlanReader.cpp index b8fd56c84..a93917b01 100644 --- a/src/flamegpu/io/JSONRunPlanReader.cpp +++ b/src/flamegpu/io/JSONRunPlanReader.cpp @@ -80,7 +80,7 @@ class JSONRunPlanReader_impl : public rapidjson::BaseReaderHandlersecond.data)); } // Copy in the specific value - const auto prop_it = rp.property_overrides.at(lastKey); + const auto &prop_it = rp.property_overrides.at(lastKey); if (val_type == std::type_index(typeid(float))) { static_cast(const_cast(prop_it.ptr))[current_array_index++] = static_cast(val); } else if (val_type == std::type_index(typeid(double))) { diff --git a/src/flamegpu/io/JSONRunPlanWriter.cpp b/src/flamegpu/io/JSONRunPlanWriter.cpp index 3a42cb670..645e3a39c 100644 --- a/src/flamegpu/io/JSONRunPlanWriter.cpp +++ b/src/flamegpu/io/JSONRunPlanWriter.cpp @@ -54,25 +54,25 @@ void JSONRunPlanWriter::writeRunPlan(std::unique_ptr &writer, const RunPlan & // Loop through elements, to construct array for (unsigned int el = 0; el < p_meta.data.elements; ++el) { if (p_meta.data.type == std::type_index(typeid(float))) { - writer->Double(*(reinterpret_cast(p_meta.data.ptr) + el)); + writer->Double(*(reinterpret_cast(p.ptr) + el)); } else if (p_meta.data.type == std::type_index(typeid(double))) { - writer->Double(*(reinterpret_cast(p_meta.data.ptr) + el)); + writer->Double(*(reinterpret_cast(p.ptr) + el)); } else if (p_meta.data.type == std::type_index(typeid(int64_t))) { - writer->Int64(*(reinterpret_cast(p_meta.data.ptr) + el)); + writer->Int64(*(reinterpret_cast(p.ptr) + el)); } else if (p_meta.data.type == std::type_index(typeid(uint64_t))) { - writer->Uint64(*(reinterpret_cast(p_meta.data.ptr) + el)); + writer->Uint64(*(reinterpret_cast(p.ptr) + el)); } else if (p_meta.data.type == std::type_index(typeid(int32_t))) { - writer->Int(*(reinterpret_cast(p_meta.data.ptr) + el)); + writer->Int(*(reinterpret_cast(p.ptr) + el)); } else if (p_meta.data.type == std::type_index(typeid(uint32_t))) { - writer->Uint(*(reinterpret_cast(p_meta.data.ptr) + el)); + writer->Uint(*(reinterpret_cast(p.ptr) + el)); } else if (p_meta.data.type == std::type_index(typeid(int16_t))) { - writer->Int(*(reinterpret_cast(p_meta.data.ptr) + el)); + writer->Int(*(reinterpret_cast(p.ptr) + el)); } else if (p_meta.data.type == std::type_index(typeid(uint16_t))) { - writer->Uint(*(reinterpret_cast(p_meta.data.ptr) + el)); + writer->Uint(*(reinterpret_cast(p.ptr) + el)); } else if (p_meta.data.type == std::type_index(typeid(int8_t))) { - writer->Int(static_cast(*(reinterpret_cast(p_meta.data.ptr) + el))); // Char outputs weird if being used as an integer + writer->Int(static_cast(*(reinterpret_cast(p.ptr) + el))); // Char outputs weird if being used as an integer } else if (p_meta.data.type == std::type_index(typeid(uint8_t))) { - writer->Uint(static_cast(*(reinterpret_cast(p_meta.data.ptr) + el))); // Char outputs weird if being used as an integer + writer->Uint(static_cast(*(reinterpret_cast(p.ptr) + el))); // Char outputs weird if being used as an integer } else { THROW exception::RapidJSONError("RunPlan contains environment property '%s' of unsupported type '%s', " "in JSONRunPlanWriter::writeRunPlan()\n", name.c_str(), p_meta.data.type.name());