From 46153002933f355e1a6044a0e26df823c9c902a8 Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 24 Apr 2020 14:56:10 +0200 Subject: [PATCH] Removed the info parameter of _setup. --- entities/entity.cpp | 31 ++++++++++++++++++++++--------- entities/entity.h | 2 +- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/entities/entity.cpp b/entities/entity.cpp index 3f081be..d715807 100644 --- a/entities/entity.cpp +++ b/entities/entity.cpp @@ -535,8 +535,13 @@ void Entity::setup(Ref info) { sets_original_entity_controller(info->get_entity_controller()); sets_entity_controller(info->get_entity_controller()); - sets_entity_name(info->get_entity_name()); + _s_character_level = info->get_character_level(); + _s_class_level = info->get_class_level(); + _s_class_xp = info->get_class_xp(); + _s_character_xp = info->get_character_xp(); + + sets_entity_name(info->get_entity_name()); sets_entity_data(info->get_entity_data()); if (!info->get_serialized_data().empty()) { @@ -544,11 +549,11 @@ void Entity::setup(Ref info) { } if (has_method("_setup")) { - call_multilevel("_setup", info); + call_multilevel("_setup"); } } -void Entity::_setup(Ref info) { +void Entity::_setup() { if (!_s_entity_data.is_valid()) return; @@ -714,11 +719,19 @@ void Entity::_setup(Ref info) { sets_entity_name(_s_entity_data->get_name()); } - scharacter_levelup(info->get_character_level() - 1); - sclass_levelup(info->get_class_level() - 1); + int chl = _s_character_level; + int cl = _s_class_level; + int chxp = _s_character_xp; + int clxp = _s_class_xp; - sets_class_xp(info->get_class_xp()); - sets_character_xp(info->get_character_xp()); + _s_character_level = 1; + _s_class_level = 1; + + scharacter_levelup(chl - 1); + sclass_levelup(cl - 1); + + sets_class_xp(clxp); + sets_character_xp(chxp); if (ESS::get_instance()->get_allow_class_spell_learning()) { Ref class_profile = ProfileManager::get_instance()->getc_player_profile()->get_class_profile(_s_entity_data->get_path()); @@ -6746,7 +6759,7 @@ void Entity::_bind_methods() { ADD_SIGNAL(MethodInfo("cskill_changed", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::OBJECT, "skill", PROPERTY_HINT_RESOURCE_TYPE, "EntitySkill"))); //setup - BIND_VMETHOD(MethodInfo("_setup", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "EntityCreateInfo"))); + BIND_VMETHOD(MethodInfo("_setup")); //Windows ADD_SIGNAL(MethodInfo("onc_open_loot_winow_request")); @@ -6754,7 +6767,7 @@ void Entity::_bind_methods() { ADD_SIGNAL(MethodInfo("onc_open_vendor_winow_request")); ClassDB::bind_method(D_METHOD("setup", "info"), &Entity::setup); - ClassDB::bind_method(D_METHOD("_setup", "info"), &Entity::_setup); + ClassDB::bind_method(D_METHOD("_setup"), &Entity::_setup); ClassDB::bind_method(D_METHOD("setup_actionbars"), &Entity::setup_actionbars); //binds diff --git a/entities/entity.h b/entities/entity.h index 6910724..9a85d09 100644 --- a/entities/entity.h +++ b/entities/entity.h @@ -911,7 +911,7 @@ public: String random_name(); void setup(Ref info); - virtual void _setup(Ref info); + virtual void _setup(); void setup_actionbars(); //// AI ////