| 41 | } |
| 42 | |
| 43 | ByteArray EntityFactory::netStoreEntity(EntityPtr const& entity, NetCompatibilityRules rules) const { |
| 44 | RecursiveMutexLocker locker(m_mutex); |
| 45 | |
| 46 | if (auto player = as<Player>(entity)) { |
| 47 | return player->netStore(rules); |
| 48 | } else if (auto monster = as<Monster>(entity)) { |
| 49 | return monster->netStore(rules); |
| 50 | } else if (auto object = as<Object>(entity)) { |
| 51 | return object->netStore(rules); |
| 52 | } else if (auto plant = as<Plant>(entity)) { |
| 53 | return plant->netStore(rules); |
| 54 | } else if (auto plantDrop = as<PlantDrop>(entity)) { |
| 55 | return plantDrop->netStore(rules); |
| 56 | } else if (auto projectile = as<Projectile>(entity)) { |
| 57 | return projectile->netStore(rules); |
| 58 | } else if (auto itemDrop = as<ItemDrop>(entity)) { |
| 59 | return itemDrop->netStore(rules); |
| 60 | } else if (auto npc = as<Npc>(entity)) { |
| 61 | return npc->netStore(rules); |
| 62 | } else if (auto stagehand = as<Stagehand>(entity)) { |
| 63 | return stagehand->netStore(rules); |
| 64 | } else if (auto vehicle = as<Vehicle>(entity)) { |
| 65 | return m_vehicleDatabase->netStore(vehicle, rules); |
| 66 | } else { |
| 67 | throw EntityFactoryException::format("Don't know how to make net store for entity type '{}'", EntityTypeNames.getRight(entity->entityType())); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | EntityPtr EntityFactory::netLoadEntity(EntityType type, ByteArray const& netStore, NetCompatibilityRules rules) const { |
| 72 | RecursiveMutexLocker locker(m_mutex); |
no test coverage detected