Smart pointers for most library and battle classes.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-06-02 20:37:21 +02:00
parent 1d1dc877a0
commit 2d3a2fc63b
22 changed files with 91 additions and 89 deletions

View File

@@ -2,14 +2,13 @@
void PkmnLib::Battling::Battle::SetWeather(const ArbUt::CaseInsensitiveConstString& name) {
if (_weatherScript != nullptr) {
_weatherScript->OnRemove();
delete _weatherScript;
}
_weatherScript = _library->LoadScript(static_cast<ScriptCategory>(PkmnScriptCategory::Weather), name);
_weatherScript = std::unique_ptr<CreatureLib::Battling::Script>(
_library->LoadScript(static_cast<ScriptCategory>(PkmnScriptCategory::Weather), name));
_eventHook.TriggerEvent(new WeatherChangeEvent(name));
}
void PkmnLib::Battling::Battle::ClearWeather() {
_weatherScript->OnRemove();
delete _weatherScript;
_weatherScript = nullptr;
_eventHook.TriggerEvent(new WeatherChangeEvent(""_cnc));
}