Smart pointers for most library and battle classes.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
namespace PkmnLib::Battling {
|
||||
class Battle : public CreatureLib::Battling::Battle {
|
||||
private:
|
||||
CreatureLib::Battling::Script* _weatherScript = nullptr;
|
||||
std::unique_ptr<CreatureLib::Battling::Script> _weatherScript = nullptr;
|
||||
|
||||
public:
|
||||
Battle(const BattleLibrary* library, const ArbUt::List<CreatureLib::Battling::BattleParty*>& parties,
|
||||
|
||||
Reference in New Issue
Block a user