| 253 | } |
| 254 | |
| 255 | sugoi_group_t* sugoi_storage_t::clone_group(sugoi_group_t* srcG) |
| 256 | { |
| 257 | if(auto g = try_get_group(srcG->type)) |
| 258 | return g; |
| 259 | sugoi_group_t& proto = *new (groupPool.allocate()) sugoi_group_t(); |
| 260 | std::memcpy(&proto, srcG, sizeof(sugoi_group_t)); |
| 261 | char* buffer = (char*)(&proto + 1); |
| 262 | proto.type = sugoi::clone(srcG->type, buffer); |
| 263 | proto.archetype = clone_archetype(srcG->archetype); |
| 264 | if (srcG->dead) |
| 265 | { |
| 266 | proto.dead = clone_group(srcG->dead); |
| 267 | } |
| 268 | if (srcG->cloned) |
| 269 | { |
| 270 | proto.cloned = clone_group(srcG->cloned); |
| 271 | } |
| 272 | groups.insert({ proto.type, &proto }); |
| 273 | return &proto; |
| 274 | } |
| 275 | |
| 276 | sugoi::archetype_t* sugoi_storage_t::try_get_archetype(const sugoi_type_set_t& type) const |
| 277 | { |