This commit is contained in:
Perttu Ahola 2014-10-02 10:49:00 +03:00
parent 21a11a67a7
commit 41c3d9309c

View File

@ -35,12 +35,10 @@ ss_ dump(const magic::VectorBuffer &buf)
{ {
std::ostringstream os(std::ios::binary); std::ostringstream os(std::ios::binary);
os<<"["; os<<"[";
bool first = true; for(size_t i = 0; i < buf.GetBuffer().Size(); i++){
for(auto it = buf.GetBuffer().Begin(); it != buf.GetBuffer().End(); ++it){ if(i != 0)
if(!first)
os<<", "; os<<", ";
first = false; os<<cs(buf.GetBuffer().At(i));
os<<(*it);
} }
os<<"]"; os<<"]";
return os.str(); return os.str();
@ -210,6 +208,7 @@ struct Module: public interface::Module, public entitysync::Interface
node->WriteInitialDeltaUpdate(buf); node->WriteInitialDeltaUpdate(buf);
// TODO: User variables (see Network/Connection.cpp) // TODO: User variables (see Network/Connection.cpp)
buf.WriteVLE(0);
// Components // Components
buf.WriteVLE(node->GetNumNetworkComponents()); buf.WriteVLE(node->GetNumNetworkComponents());
@ -274,6 +273,18 @@ struct Module: public interface::Module, public entitysync::Interface
send_to_all("entitysync:latest_node_data", buf); send_to_all("entitysync:latest_node_data", buf);
} }
if(node_state.dirtyAttributes_.Count() || node_state.dirtyVars_.Size()){
magic::VectorBuffer buf;
buf.WriteNetID(node->GetID());
node->WriteDeltaUpdate(buf, node_state.dirtyAttributes_);
// TODO: User variables
buf.WriteVLE(0);
send_to_all("entitysync:latest_node_data", buf);
}
} }
} }