return os.str();
}
-std::string LuaEntitySAO::getStaticData() const
+void LuaEntitySAO::getStaticData(std::string *result) const
{
verbosestream<<FUNCTION_NAME<<std::endl;
std::ostringstream os(std::ios::binary);
writeV3F1000(os, m_velocity);
// yaw
writeF1000(os, m_yaw);
- return os.str();
+ *result = os.str();
}
int LuaEntitySAO::punch(v3f dir,
return os.str();
}
-std::string PlayerSAO::getStaticData() const
+void PlayerSAO::getStaticData(std::string *result) const
{
- FATAL_ERROR("Deprecated function (?)");
- return "";
+ FATAL_ERROR("Deprecated function");
}
void PlayerSAO::step(float dtime, bool send_recommended)
const std::string &data);
void step(float dtime, bool send_recommended);
std::string getClientInitializationData(u16 protocol_version);
- std::string getStaticData() const;
+ void getStaticData(std::string *result) const;
int punch(v3f dir,
const ToolCapabilities *toolcap=NULL,
ServerActiveObject *puncher=NULL,
void removingFromEnvironment();
bool isStaticAllowed() const { return false; }
std::string getClientInitializationData(u16 protocol_version);
- std::string getStaticData() const;
+ void getStaticData(std::string *result) const;
void step(float dtime, bool send_recommended);
void setBasePosition(const v3f &position);
void setPos(const v3f &pos);
{
// Add static object to active static list of the block
v3f objectpos = object->getBasePosition();
- std::string staticdata = object->getStaticData();
+ std::string staticdata = "";
+ object->getStaticData(&staticdata);
StaticObject s_obj(object->getType(), objectpos, staticdata);
// Add to the block where the object is located in
v3s16 blockpos = getNodeBlockPos(floatToInt(objectpos, BS));
<<std::endl;
continue;
}
- std::string staticdata_new = obj->getStaticData();
+ std::string staticdata_new = "";
+ obj->getStaticData(&staticdata_new);
StaticObject s_obj(obj->getType(), objectpos, staticdata_new);
block->m_static_objects.insert(id, s_obj);
obj->m_static_block = blockpos_o;
if(obj->isStaticAllowed())
{
// Create new static object
- std::string staticdata_new = obj->getStaticData();
+ std::string staticdata_new = "";
+ obj->getStaticData(&staticdata_new);
StaticObject s_obj(obj->getType(), objectpos, staticdata_new);
bool stays_in_same_block = false;
when it is created (converted from static to active - actually
the data is the static form)
*/
- virtual std::string getStaticData()
+ virtual void getStaticData(std::string *result)
{
assert(isStaticAllowed());
- return "";
+ *result = "";
}
/*
Return false in here to never save and instead remove object