v1.4.4
This commit is contained in:
commit
9c94d113d3
10260 changed files with 1237388 additions and 0 deletions
55
source/game/StarEntityFactory.hpp
Normal file
55
source/game/StarEntityFactory.hpp
Normal file
|
@ -0,0 +1,55 @@
|
|||
#ifndef STAR_ENTITY_FACTORY_HPP
|
||||
#define STAR_ENTITY_FACTORY_HPP
|
||||
|
||||
#include "StarVersioningDatabase.hpp"
|
||||
#include "StarEntity.hpp"
|
||||
|
||||
namespace Star {
|
||||
|
||||
STAR_CLASS(VersioningDatabase);
|
||||
STAR_CLASS(PlayerFactory);
|
||||
STAR_CLASS(MonsterDatabase);
|
||||
STAR_CLASS(ObjectDatabase);
|
||||
STAR_CLASS(ProjectileDatabase);
|
||||
STAR_CLASS(NpcDatabase);
|
||||
|
||||
STAR_CLASS(EntityFactory);
|
||||
|
||||
STAR_EXCEPTION(EntityFactoryException, StarException);
|
||||
|
||||
class EntityFactory {
|
||||
public:
|
||||
EntityFactory();
|
||||
|
||||
ByteArray netStoreEntity(EntityPtr const& entity) const;
|
||||
EntityPtr netLoadEntity(EntityType type, ByteArray const& netStore) const;
|
||||
|
||||
Json diskStoreEntity(EntityPtr const& entity) const;
|
||||
EntityPtr diskLoadEntity(EntityType type, Json const& diskStore) const;
|
||||
|
||||
Json loadVersionedJson(VersionedJson const& versionedJson, EntityType expectedType) const;
|
||||
VersionedJson storeVersionedJson(EntityType type, Json const& store) const;
|
||||
|
||||
// Wraps the normal Json based Entity store / load in a VersionedJson, and
|
||||
// uses sripts in the VersionedingDatabase to bring the version of the store
|
||||
// forward to match the current version.
|
||||
EntityPtr loadVersionedEntity(VersionedJson const& versionedJson) const;
|
||||
VersionedJson storeVersionedEntity(EntityPtr const& entityPtr) const;
|
||||
|
||||
private:
|
||||
static EnumMap<EntityType> const EntityStorageIdentifiers;
|
||||
|
||||
mutable RecursiveMutex m_mutex;
|
||||
|
||||
PlayerFactoryConstPtr m_playerFactory;
|
||||
MonsterDatabaseConstPtr m_monsterDatabase;
|
||||
ObjectDatabaseConstPtr m_objectDatabase;
|
||||
ProjectileDatabaseConstPtr m_projectileDatabase;
|
||||
NpcDatabaseConstPtr m_npcDatabase;
|
||||
VehicleDatabaseConstPtr m_vehicleDatabase;
|
||||
VersioningDatabaseConstPtr m_versioningDatabase;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue