More work on exceptions.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-07-31 14:17:38 +02:00
parent 9c93ca6995
commit bd7ecb6b33
3 changed files with 18 additions and 4 deletions

View File

@@ -155,7 +155,7 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, const ArbUt::Bo
break;
}
auto& hit = hitIterator[hitIndex];
uint8_t hitType = hit.GetType();
uint8_t hitType = attack->GetAttack()->GetAttack()->GetType();
HOOK(ChangeAttackType, targetSource, attack, target.GetRaw(), hitIndex, &hitType);
hit.SetType(hitType);
auto effectiveness = library->GetTypeLibrary()->GetEffectiveness(hitType, target->GetTypes());

View File

@@ -5,7 +5,11 @@
auto next = aggregator.GetNext(); \
if (next == nullptr) \
continue; \
next->hookName(__VA_ARGS__); \
try { \
next->hookName(__VA_ARGS__); \
} catch (const std::exception& e) { \
THROW_CREATURE("Exception running script hook '" #hookName "': " << e.what()) \
} \
} \
}
@@ -16,6 +20,10 @@
auto next = aggregator.GetNext(); \
if (next == nullptr) \
continue; \
next->hookName(__VA_ARGS__); \
try { \
next->hookName(__VA_ARGS__); \
} catch (const std::exception& e) { \
THROW_CREATURE("Exception running script hook '" #hookName "': " << e.what()) \
} \
} \
}