MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / getGameEntityFromStream

Function getGameEntityFromStream

source/entities/EntityLoading.cpp:46–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44namespace Entities
45{
46GameEntity* getGameEntityFromStream(GameMap* gameMap, GameEntityType type, std::istream& is)
47{
48 GameEntity* entity = nullptr;
49 switch(type)
50 {
51 case GameEntityType::buildingObject:
52 {
53 // Building objects are not stored in level files, we should not be here
54 OD_LOG_ERR("Cannot create entity from stream");
55 break;
56 }
57 case GameEntityType::chickenEntity:
58 {
59 entity = ChickenEntity::getChickenEntityFromStream(gameMap, is);
60 break;
61 }
62 case GameEntityType::craftedTrap:
63 {
64 entity = CraftedTrap::getCraftedTrapFromStream(gameMap, is);
65 break;
66 }
67 case GameEntityType::creature:
68 {
69 entity = Creature::getCreatureFromStream(gameMap, is);
70 break;
71 }
72 case GameEntityType::mapLight:
73 {
74 entity = MapLight::getMapLightFromStream(gameMap, is);
75 break;
76 }
77 case GameEntityType::missileObject:
78 {
79 entity = MissileObject::getMissileObjectFromStream(gameMap, is);
80 break;
81 }
82 case GameEntityType::persistentObject:
83 {
84 // Persistent objects are not stored in level files, we should not be here
85 OD_LOG_ERR("Cannot create entity from stream");
86 break;
87 }
88 case GameEntityType::smallSpiderEntity:
89 {
90 // Small spiders are not stored in level files, we should not be here
91 OD_LOG_ERR("Cannot create entity from stream");
92 break;
93 }
94 case GameEntityType::spell:
95 {
96 entity = SpellManager::getSpellFromStream(gameMap, is);
97 break;
98 }
99 case GameEntityType::trapEntity:
100 {
101 // Trap entities are handled by the trap
102 OD_LOG_ERR("Cannot create entity from stream");
103 break;

Callers 1

readGameEntityFunction · 0.85

Calls 1

toStringFunction · 0.50

Tested by

no test coverage detected