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

Method getSpellFromStream

source/spells/SpellManager.cpp:158–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158Spell* SpellManager::getSpellFromStream(GameMap* gameMap, std::istream& is)
159{
160 SpellType type;
161 if(!(is >> type))
162 return nullptr;
163
164 std::vector<const SpellFactory*>& factories = getFactories();
165 uint32_t index = static_cast<uint32_t>(type);
166 if(index >= factories.size())
167 {
168 OD_LOG_ERR("type=" + Helper::toString(index) + ", factories.size=" + Helper::toString(factories.size()));
169 return nullptr;
170 }
171
172 const SpellFactory& factory = *factories[index];
173 return factory.getSpellFromStream(gameMap, is);
174}
175
176Spell* SpellManager::getSpellFromPacket(GameMap* gameMap, ODPacket& is)
177{

Callers 1

loadMethod · 0.45

Calls 1

toStringFunction · 0.50

Tested by

no test coverage detected