listener_sptr create(application &app, const rpc::session_options &opts, const std::string &name) { vtrc::shared_ptr<listener_unix>new_l (vtrc::make_shared<listener_unix>( vtrc::ref(app), vtrc::ref(opts), vtrc::ref(name) ) ); return new_l; }
listener_sptr create(application &app, const rpc::session_options &opts, const std::string &address, unsigned short service, bool tcp_nodelay) { vtrc::shared_ptr<listener_tcp>new_l (vtrc::make_shared<listener_tcp>( vtrc::ref(app), vtrc::ref(opts), vtrc::ref(address), service, tcp_nodelay )); return new_l; }
void sMap::InsertLayerFromMap(int where, const sMap& map, int layer) { const sLayer& old_l = map.GetLayer(layer); sLayer new_l(old_l.GetWidth(), old_l.GetHeight()); // merge the two tilesets, updating the indices in layer 'l' sTileset& dst_ts = m_Tileset; const sTileset& src_ts = map.GetTileset(); // add each tile to the tileset for (int i = src_ts.GetNumTiles() - 1; i >= 0; i--) { // if it's already in the old tileset, we don't need to add it bool duplication = false; for (int j = 0; j < dst_ts.GetNumTiles(); j++) { if (src_ts.GetTile(i) == dst_ts.GetTile(j)) { // put 'j' where 'i' was in old layer for (int iy = 0; iy < old_l.GetHeight(); iy++) { for (int ix = 0; ix < old_l.GetWidth(); ix++) { if (old_l.GetTile(ix, iy) == i) { new_l.SetTile(ix, iy, j); } } } duplication = true; break; } } // add tile to end of tileset if (!duplication) { dst_ts.AppendTiles(1); int j = dst_ts.GetNumTiles() - 1; dst_ts.GetTile(j) = src_ts.GetTile(i); // put 'j' where 'i' was in old layer for (int iy = 0; iy < old_l.GetHeight(); iy++) { for (int ix = 0; ix < old_l.GetWidth(); ix++) { if (old_l.GetTile(ix, iy) == i) { new_l.SetTile(ix, iy, j); } } } } } InsertLayer(where, new_l); }