This commit is contained in:
aozhiwei 2024-01-10 12:05:01 +08:00
parent fbc71c035c
commit 4477bfa454
2 changed files with 13 additions and 1 deletions

View File

@ -19,6 +19,7 @@ struct AttrAddition : public std::enable_shared_from_this<AttrAddition>
int attr_id;
float value;
std::shared_ptr<AttrAddition> holder;
std::shared_ptr<std::function<std::string()>> get_source;
AttrAddition(int attr_id, float value)
{
@ -396,7 +397,11 @@ std::vector<std::string> Ability::GMShowAttrs()
AttrAddition* e = list_entry(pos,
AttrAddition,
list_entry);
data += "" + a8::XValue(e->value).GetString() + ",";
if (e->get_source) {
data += "" + a8::XValue(e->value).GetString() + (*e->get_source)() + ",";
} else {
data += "" + a8::XValue(e->value).GetString() + "<-none,";
}
++i;
}
if (i > 0) {
@ -531,3 +536,9 @@ bool Ability::HasDecAttr(int attr_id)
}
return false;
}
void Ability::SetSource(AttrHandle handle, std::shared_ptr<std::function<std::string()>> cb)
{
}

View File

@ -29,6 +29,7 @@ class Ability
void GMDelAttr(int attr_id, int idx);
void GMClearAttr();
std::vector<std::string> GMShowAttrs();
void SetSource(AttrHandle handle, std::shared_ptr<std::function<std::string()>> cb);
private:
void Clear();