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

Method getTrapFromStream

source/traps/TrapManager.cpp:423–439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

421}
422
423Trap* TrapManager::getTrapFromStream(GameMap* gameMap, std::istream& is)
424{
425 TrapType type;
426 if(!(is >> type))
427 return nullptr;
428
429 std::vector<const TrapFactory*>& factories = getFactories();
430 uint32_t index = static_cast<uint32_t>(type);
431 if(index >= factories.size())
432 {
433 OD_LOG_ERR("type=" + Helper::toString(index) + ", factories.size=" + Helper::toString(factories.size()));
434 return nullptr;
435 }
436
437 const TrapFactory& factory = *factories[index];
438 return factory.getTrapFromStream(gameMap, is);
439}
440
441const std::string& TrapManager::getTrapNameFromTrapType(TrapType type)
442{

Callers 1

loadMethod · 0.45

Calls 1

toStringFunction · 0.50

Tested by

no test coverage detected