Small fixes.

This commit is contained in:
Relintai 2019-10-15 22:21:14 +02:00
parent 18afb79b58
commit 9e976eaebf
3 changed files with 3 additions and 7 deletions

View File

@ -1217,12 +1217,7 @@ void Entity::set_stat_int(int index, Ref<Stat> entry) {
}
Ref<Stat> Entity::get_stat_enum(Stat::StatId stat_id) {
//ERR_FAIL_COND_V(stat_id == Stat::STAT_ID_NONE);
if (stat_id == Stat::STAT_ID_NONE) {
print_error("Add fail cond here, stat has STAT_ID_NONE!");
return _stats[0];
}
ERR_FAIL_INDEX_V(stat_id, Stat::STAT_ID_TOTAL_STATS, Ref<Stat>());
return _stats[stat_id];
}

View File

@ -305,7 +305,7 @@ void Stat::remove_modifier_index(int index) {
}
void Stat::apply_modifiers() {
ERR_FAIL_COND(_owner == NULL);
ERR_FAIL_COND(!ObjectDB::instance_validate(_owner));
ERR_FAIL_COND(!_stat_data_entry.is_valid());
reset_values();

View File

@ -111,6 +111,7 @@ StatDataEntry::StatDataEntry() {
_modifier_apply_type = Stat::MODIFIER_APPLY_TYPE_STANDARD;
for (int i = 0; i < MAX_MOD_STATS; ++i) {
_mod_stats[i].stat_id = Stat::STAT_ID_HEALTH;
_mod_stats[i].max_value = 1000;
}
}