Implemented better exceptions
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2019-10-31 13:26:56 +01:00
parent ffba5fb24c
commit 65f814b006
9 changed files with 55 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
#include "BattleSide.hpp"
#include "../../Core/Exceptions/CreatureException.hpp"
#include <algorithm>
using namespace CreatureLib::Battling;
@@ -25,7 +26,7 @@ const std::vector<const BaseTurnChoice *>& BattleSide::GetChoices() const{
void BattleSide::SetChoice(const BaseTurnChoice *choice) {
auto find = std::find(_creatures.begin(), _creatures.end(), choice->GetUser());
if (find ==_creatures.end())
throw "User not found";
throw CreatureException("User not found");
uint8_t index = std::distance(_creatures.begin(),find);
_choices[index] = choice;
}