void GameObject::Save( XMLPrinter & p ) { p.OpenElement("Item"); p.PushAttribute("name", GetName().c_str()); p.PushAttribute("id", GetId().c_str()); p.PushAttribute("description", GetDescription().c_str()); p.PushAttribute("match", GetNamePattern().str().c_str()); SaveProperties(p); p.CloseElement(); }
void Player::Save( XMLPrinter & p ) { p.OpenElement("Player"); p.PushAttribute("name", GetName().c_str()); p.PushAttribute("id", GetId().c_str()); p.PushAttribute("description", GetDescription().c_str()); p.OpenElement("Items"); for(auto i : GetItems() ) i->Save(p); p.CloseElement(); SaveProperties(p); p.CloseElement(); }
void GameObject::SaveProperties( XMLPrinter & p ) { p.OpenElement("Properties"); for(auto property : GetProperties()) { p.OpenElement("Property"); p.PushAttribute("id",property.second->GetId().c_str()); p.PushAttribute("type", "string"); string tmp = (*property.second).As<string>(); p.PushAttribute("value", tmp.c_str()); p.CloseElement(); } p.CloseElement(); }