mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-05-09 22:41:39 +02:00
Fixed a few potential crashes.
This commit is contained in:
parent
435b57337a
commit
d269ebb51a
@ -555,7 +555,7 @@ void Spell::set_training_required_skill_level(int value) {
|
|||||||
//// Spell System ////
|
//// Spell System ////
|
||||||
|
|
||||||
void Spell::sstart_casting_simple(Entity *caster, float spell_scale) {
|
void Spell::sstart_casting_simple(Entity *caster, float spell_scale) {
|
||||||
ERR_FAIL_COND(caster == NULL);
|
ERR_FAIL_COND(!caster || !ObjectDB::instance_validate(caster));
|
||||||
|
|
||||||
Ref<SpellCastInfo> info = Ref<SpellCastInfo>(memnew(SpellCastInfo()));
|
Ref<SpellCastInfo> info = Ref<SpellCastInfo>(memnew(SpellCastInfo()));
|
||||||
|
|
||||||
@ -570,7 +570,7 @@ void Spell::sstart_casting_simple(Entity *caster, float spell_scale) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Spell::sinterrupt_cast_simple(Entity *caster) {
|
void Spell::sinterrupt_cast_simple(Entity *caster) {
|
||||||
ERR_FAIL_COND(caster == NULL);
|
ERR_FAIL_COND(!caster || !ObjectDB::instance_validate(caster));
|
||||||
|
|
||||||
Ref<SpellCastInfo> info(memnew(SpellCastInfo()));
|
Ref<SpellCastInfo> info(memnew(SpellCastInfo()));
|
||||||
|
|
||||||
@ -581,7 +581,7 @@ void Spell::sinterrupt_cast_simple(Entity *caster) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Spell::sstart_casting_triggered_simple(Entity *caster) {
|
void Spell::sstart_casting_triggered_simple(Entity *caster) {
|
||||||
ERR_FAIL_COND(caster == NULL);
|
ERR_FAIL_COND(!caster || !ObjectDB::instance_validate(caster));
|
||||||
|
|
||||||
Ref<SpellCastInfo> info(memnew(SpellCastInfo()));
|
Ref<SpellCastInfo> info(memnew(SpellCastInfo()));
|
||||||
|
|
||||||
|
@ -4,7 +4,11 @@
|
|||||||
|
|
||||||
//// SpellCastInfo ////
|
//// SpellCastInfo ////
|
||||||
|
|
||||||
Entity *SpellCastInfo::get_caster() const {
|
Entity *SpellCastInfo::get_caster() {
|
||||||
|
if (_caster && !ObjectDB::instance_validate(_caster)) {
|
||||||
|
_caster = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return _caster;
|
return _caster;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +30,11 @@ void SpellCastInfo::set_caster_bind(Node *caster) {
|
|||||||
_caster = e;
|
_caster = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity *SpellCastInfo::get_target() const {
|
Entity *SpellCastInfo::get_target() {
|
||||||
|
if (_target && !ObjectDB::instance_validate(_target)) {
|
||||||
|
_target = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return _target;
|
return _target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,11 +11,11 @@ class SpellCastInfo : public Reference {
|
|||||||
GDCLASS(SpellCastInfo, Reference);
|
GDCLASS(SpellCastInfo, Reference);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Entity *get_caster() const;
|
Entity *get_caster();
|
||||||
void set_caster(Entity *caster);
|
void set_caster(Entity *caster);
|
||||||
void set_caster_bind(Node *caster);
|
void set_caster_bind(Node *caster);
|
||||||
|
|
||||||
Entity *get_target() const;
|
Entity *get_target();
|
||||||
void set_target(Entity *caster);
|
void set_target(Entity *caster);
|
||||||
void set_target_bind(Node *caster);
|
void set_target_bind(Node *caster);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user