Overhaul memory model to new Arbutils memory.
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
@@ -21,7 +21,8 @@ bool Battle::TrySetChoice(BaseTurnChoice* choice) {
|
||||
AssertNotNull(choice)
|
||||
if (!CanUse(choice))
|
||||
return false;
|
||||
choice->GetUser()->GetBattleSide()->SetChoice(choice);
|
||||
Assert(choice->GetUser()->GetBattleSide().HasValue())
|
||||
choice->GetUser()->GetBattleSide().GetValue()->SetChoice(choice);
|
||||
CheckChoicesSetAndRun();
|
||||
return true;
|
||||
}
|
||||
@@ -155,15 +156,15 @@ void Battle::ValidateBattleState() {
|
||||
}
|
||||
void Battle::AddVolatileScript(const ArbUt::StringView& key) {
|
||||
auto script = _volatile.Get(key);
|
||||
if (script != nullptr) {
|
||||
script->Stack();
|
||||
if (script.has_value()) {
|
||||
script.value()->Stack();
|
||||
return;
|
||||
}
|
||||
script = _library->LoadScript(ScriptCategory::Battle, key);
|
||||
if (script == nullptr) {
|
||||
if (!script.has_value()) {
|
||||
THROW("Invalid volatile script requested for battle: '" << key.c_str() << "'.");
|
||||
}
|
||||
return _volatile.Add(script.GetRaw());
|
||||
return _volatile.Add(script.value().GetRaw());
|
||||
}
|
||||
void Battle::AddVolatileScript(Script* script) { return _volatile.Add(script); }
|
||||
void Battle::RemoveVolatileScript(Script* script) { _volatile.Remove(script->GetName()); }
|
||||
|
||||
Reference in New Issue
Block a user