From dd2876d2e2a7487978663a8c8adaf1e94ffc5018 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 20 Jun 2020 22:36:31 +0200 Subject: [PATCH] 4.0 compile fix. --- data/loot/loot_data_base.cpp | 6 ++---- data/species/species_model_data.cpp | 4 ++++ defines.h | 4 ++++ entities/entity.cpp | 20 ++++++++++++++++++++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/data/loot/loot_data_base.cpp b/data/loot/loot_data_base.cpp index b471864..8f24433 100644 --- a/data/loot/loot_data_base.cpp +++ b/data/loot/loot_data_base.cpp @@ -22,6 +22,8 @@ SOFTWARE. #include "loot_data_base.h" +#include "../../defines.h" + int LootDataBase::get_loot_db_size() const { return _loot_dbs.size(); } @@ -140,7 +142,6 @@ bool LootDataBase::_set(const StringName &p_name, const Variant &p_value) { String name = p_name; if (name.begins_with("loot_dbs/")) { - int index = name.get_slicec('/', 1).to_int(); String what = name.get_slicec('/', 2); @@ -165,7 +166,6 @@ bool LootDataBase::_set(const StringName &p_name, const Variant &p_value) { return false; } else if (name.begins_with("items/")) { - int index = name.get_slicec('/', 1).to_int(); String what = name.get_slicec('/', 2); @@ -197,7 +197,6 @@ bool LootDataBase::_get(const StringName &p_name, Variant &r_ret) const { String name = p_name; if (name.begins_with("loot_dbs/")) { - int index = name.get_slicec('/', 1).to_int(); String what = name.get_slicec('/', 2); @@ -219,7 +218,6 @@ bool LootDataBase::_get(const StringName &p_name, Variant &r_ret) const { return false; } else if (name.begins_with("items/")) { - int index = name.get_slicec('/', 1).to_int(); String what = name.get_slicec('/', 2); diff --git a/data/species/species_model_data.cpp b/data/species/species_model_data.cpp index e5ff614..2b474c8 100644 --- a/data/species/species_model_data.cpp +++ b/data/species/species_model_data.cpp @@ -136,7 +136,11 @@ Vector SpeciesModelData::get_customizable_slot_entries(const int slot_i ERR_FAIL_INDEX_V(slot_index, _customizable_slots.size(), r); for (int i = 0; i < _customizable_slots[slot_index].size(); i++) { +#if GODOT4 + r.push_back(_customizable_slots[slot_index][i]); +#else r.push_back(_customizable_slots[slot_index][i].get_ref_ptr()); +#endif } return r; } diff --git a/defines.h b/defines.h index 6cff52d..7cf46c0 100644 --- a/defines.h +++ b/defines.h @@ -33,8 +33,12 @@ #define SpatialEditorPlugin Node3DEditorPlugin #define SpatialEditorViewport Node3DEditorViewport #define PoolStringArray PackedStringArray + #define REAL FLOAT + #define POOL_STRING_ARRAY PACKED_STRING_ARRAY +#define POOL_INT_ARRAY PACKED_INT32_ARRAY + #define Spatial Node3D typedef class RenderingServer VisualServer; diff --git a/entities/entity.cpp b/entities/entity.cpp index fb15be4..5fe23f6 100644 --- a/entities/entity.cpp +++ b/entities/entity.cpp @@ -1691,10 +1691,16 @@ PoolIntArray Entity::states_gets() const { PoolIntArray arr; arr.resize(EntityEnums::ENTITY_STATE_TYPE_INDEX_MAX); +#if !GODOT4 PoolIntArray::Write w = arr.write(); +#endif for (int i = 0; i < EntityEnums::ENTITY_STATE_TYPE_INDEX_MAX; ++i) { +#if !GODOT4 w[i] = _s_states[i]; +#else + arr.write[i] = _s_states[i]; +#endif } return arr; @@ -4789,10 +4795,17 @@ void Entity::class_talent_cclear() { PoolIntArray Entity::sclass_talents_get() { PoolIntArray arr; arr.resize(_s_class_talents.size()); + +#if !GODOT4 PoolIntArray::Write w = arr.write(); +#endif for (int i = 0; i < _s_class_talents.size(); ++i) { +#if !GODOT4 w[i] = _s_class_talents[i]; +#else + arr.write[i] = _s_class_talents[i]; +#endif } return arr; @@ -5029,10 +5042,17 @@ void Entity::character_talent_cclear() { PoolIntArray Entity::scharacter_talents_get() { PoolIntArray arr; arr.resize(_s_character_talents.size()); + +#if !GODOT4 PoolIntArray::Write w = arr.write(); +#endif for (int i = 0; i < _s_character_talents.size(); ++i) { +#if !GODOT4 w[i] = _s_character_talents[i]; +#else + arr.write[i] = _s_character_talents[i]; +#endif } return arr;