1
This commit is contained in:
parent
fbc71c035c
commit
4477bfa454
@ -19,6 +19,7 @@ struct AttrAddition : public std::enable_shared_from_this<AttrAddition>
|
|||||||
int attr_id;
|
int attr_id;
|
||||||
float value;
|
float value;
|
||||||
std::shared_ptr<AttrAddition> holder;
|
std::shared_ptr<AttrAddition> holder;
|
||||||
|
std::shared_ptr<std::function<std::string()>> get_source;
|
||||||
|
|
||||||
AttrAddition(int attr_id, float value)
|
AttrAddition(int attr_id, float value)
|
||||||
{
|
{
|
||||||
@ -396,7 +397,11 @@ std::vector<std::string> Ability::GMShowAttrs()
|
|||||||
AttrAddition* e = list_entry(pos,
|
AttrAddition* e = list_entry(pos,
|
||||||
AttrAddition,
|
AttrAddition,
|
||||||
list_entry);
|
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;
|
++i;
|
||||||
}
|
}
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
@ -531,3 +536,9 @@ bool Ability::HasDecAttr(int attr_id)
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Ability::SetSource(AttrHandle handle, std::shared_ptr<std::function<std::string()>> cb)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -29,6 +29,7 @@ class Ability
|
|||||||
void GMDelAttr(int attr_id, int idx);
|
void GMDelAttr(int attr_id, int idx);
|
||||||
void GMClearAttr();
|
void GMClearAttr();
|
||||||
std::vector<std::string> GMShowAttrs();
|
std::vector<std::string> GMShowAttrs();
|
||||||
|
void SetSource(AttrHandle handle, std::shared_ptr<std::function<std::string()>> cb);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Clear();
|
void Clear();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user