mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-02-22 17:18:12 +01:00
Better way to cast refs at load.
This commit is contained in:
parent
adc47a4ae7
commit
565993fdb8
@ -176,11 +176,7 @@ void DataManager::load_spells() {
|
|||||||
|
|
||||||
ERR_CONTINUE(!s.is_valid());
|
ERR_CONTINUE(!s.is_valid());
|
||||||
|
|
||||||
Resource *r = (*s);
|
Ref<Spell> spell = s;
|
||||||
|
|
||||||
Spell *sp = cast_to<Spell>(r);
|
|
||||||
|
|
||||||
Ref<Spell> spell = Ref<Spell>(sp);
|
|
||||||
|
|
||||||
ERR_CONTINUE(!spell.is_valid());
|
ERR_CONTINUE(!spell.is_valid());
|
||||||
|
|
||||||
@ -219,11 +215,7 @@ void DataManager::load_auras() {
|
|||||||
|
|
||||||
ERR_CONTINUE(!s.is_valid());
|
ERR_CONTINUE(!s.is_valid());
|
||||||
|
|
||||||
Resource *r = (*s);
|
Ref<Aura> aura = s;
|
||||||
|
|
||||||
Aura *a = cast_to<Aura>(r);
|
|
||||||
|
|
||||||
Ref<Aura> aura = Ref<Aura>(a);
|
|
||||||
|
|
||||||
ERR_CONTINUE(!aura.is_valid());
|
ERR_CONTINUE(!aura.is_valid());
|
||||||
|
|
||||||
@ -262,11 +254,7 @@ void DataManager::load_characters() {
|
|||||||
|
|
||||||
ERR_CONTINUE(!s.is_valid());
|
ERR_CONTINUE(!s.is_valid());
|
||||||
|
|
||||||
Resource *r = (*s);
|
Ref<CharacterClass> cls = s;
|
||||||
|
|
||||||
CharacterClass *cc = cast_to<CharacterClass>(r);
|
|
||||||
|
|
||||||
Ref<CharacterClass> cls = Ref<CharacterClass>(cc);
|
|
||||||
|
|
||||||
ERR_CONTINUE(!cls.is_valid());
|
ERR_CONTINUE(!cls.is_valid());
|
||||||
|
|
||||||
@ -305,11 +293,7 @@ void DataManager::load_craft_datas() {
|
|||||||
|
|
||||||
ERR_CONTINUE(!s.is_valid());
|
ERR_CONTINUE(!s.is_valid());
|
||||||
|
|
||||||
Resource *r = (*s);
|
Ref<CraftDataAttribute> cda = s;
|
||||||
|
|
||||||
CraftDataAttribute *cc = cast_to<CraftDataAttribute>(r);
|
|
||||||
|
|
||||||
Ref<CraftDataAttribute> cda = Ref<CraftDataAttribute>(cc);
|
|
||||||
|
|
||||||
ERR_CONTINUE(!cda.is_valid());
|
ERR_CONTINUE(!cda.is_valid());
|
||||||
|
|
||||||
@ -348,11 +332,7 @@ void DataManager::load_item_templates() {
|
|||||||
|
|
||||||
ERR_CONTINUE(!s.is_valid());
|
ERR_CONTINUE(!s.is_valid());
|
||||||
|
|
||||||
Resource *r = (*s);
|
Ref<ItemTemplate> it = s;
|
||||||
|
|
||||||
ItemTemplate *cc = cast_to<ItemTemplate>(r);
|
|
||||||
|
|
||||||
Ref<ItemTemplate> it = Ref<ItemTemplate>(cc);
|
|
||||||
|
|
||||||
ERR_CONTINUE(!it.is_valid());
|
ERR_CONTINUE(!it.is_valid());
|
||||||
|
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
#ifndef ENTITY_H
|
#ifndef ENTITY_H
|
||||||
#define ENTITY_H
|
#define ENTITY_H
|
||||||
|
|
||||||
|
#ifdef ENTITIES_2D
|
||||||
|
#include "scene/2d/physics_body_2d.h"
|
||||||
|
#else
|
||||||
|
#include "scene/3d/physics_body.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "../data/character.h"
|
#include "../data/character.h"
|
||||||
#include "../data/craft_data_attribute.h"
|
#include "../data/craft_data_attribute.h"
|
||||||
#include "../data/spell.h"
|
#include "../data/spell.h"
|
||||||
@ -12,7 +19,7 @@
|
|||||||
#include "../inventory/bag_slot.h"
|
#include "../inventory/bag_slot.h"
|
||||||
#include "../data/item_instance.h"
|
#include "../data/item_instance.h"
|
||||||
#include "player_talent.h"
|
#include "player_talent.h"
|
||||||
#include "scene/2d/physics_body_2d.h"
|
|
||||||
|
|
||||||
#include "../data/spell.h"
|
#include "../data/spell.h"
|
||||||
#include "stats/stat.h"
|
#include "stats/stat.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user