Skip to content

Commit

Permalink
fix: AttrVar add
Browse files Browse the repository at this point in the history
完善AttrVar加法符号重载
  • Loading branch information
mystringEmpty committed Mar 1, 2024
1 parent 4795076 commit 70b526b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dice/DiceAttrVar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ AttrVar AttrVar::operator+(const AttrVar& other) {
return (sum == (int)sum) ? (int)sum :
((sum == (long long)sum) ? (long long)sum : sum);
}
else if (type == Type::Text || other.type == Type::Text)
return to_str() + other.to_str();
return other ? AttrVar() : *this;
}

Expand Down
7 changes: 7 additions & 0 deletions Dice/DiceEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3378,6 +3378,9 @@ int DiceEvent::InnerOrder() {
if (is_empty("show"))replyMsg("strPcNewEmptyCard");
else replyMsg("strPcNewCardShow");
}
else {
set("char", strPC);
}
}
else if (strOption == "build") {
string strPC{ strip(filter_CQcode(readRest(), fromChat.gid))};
Expand All @@ -3387,6 +3390,9 @@ int DiceEvent::InnerOrder() {
set("char", pc->getName());
replyMsg("strPcCardBuild");
}
else {
set("char", strPC);
}
}
else if (strOption == "list") {
set("show",pl.listCard());
Expand All @@ -3397,6 +3403,7 @@ int DiceEvent::InnerOrder() {
string& strPC{ (at("new_name") = strip(filter_CQcode(readRest(),fromChat.gid))).text};
set("old_name",pl[fromChat.gid]->getName());
if (!(resno = pl.renameCard(get_str("old_name"), strPC)))replyMsg("strPcCardRename");
else set("char", strPC);
}
else if (strOption == "del") {
set("char",strip(readRest()));
Expand Down

0 comments on commit 70b526b

Please sign in to comment.