| 117 | } |
| 118 | |
| 119 | void SpellManager::checkSpellCast(GameMap* gameMap, SpellType type, const InputManager& inputManager, InputCommand& inputCommand) |
| 120 | { |
| 121 | Player* player = gameMap->getLocalPlayer(); |
| 122 | float cooldown = player->getSpellCooldownSmoothTime(type); |
| 123 | if(cooldown > 0) |
| 124 | { |
| 125 | std::string errorStr = getSpellNameFromSpellType(type) |
| 126 | + " (" + Helper::toString(cooldown, 2)+ " s)"; |
| 127 | |
| 128 | inputCommand.displayText(Ogre::ColourValue::Red, errorStr); |
| 129 | return; |
| 130 | } |
| 131 | |
| 132 | std::vector<const SpellFactory*>& factories = getFactories(); |
| 133 | uint32_t index = static_cast<uint32_t>(type); |
| 134 | if(index >= factories.size()) |
| 135 | { |
| 136 | OD_LOG_ERR("type=" + Helper::toString(index) + ", factories.size=" + Helper::toString(factories.size())); |
| 137 | return; |
| 138 | } |
| 139 | |
| 140 | const SpellFactory& factory = *factories[index]; |
| 141 | factory.checkSpellCast(gameMap, inputManager, inputCommand); |
| 142 | } |
| 143 | |
| 144 | bool SpellManager::castSpell(GameMap* gameMap, SpellType type, Player* player, ODPacket& packet) |
| 145 | { |
nothing calls this directly
no test coverage detected