Skip to content

Commit

Permalink
fix(st): attr_name
Browse files Browse the repository at this point in the history
修复一个bug,该bug导致st &格式的指令必定失败
  • Loading branch information
mystringEmpty committed Jun 8, 2024
1 parent 0a1bc13 commit 04f650d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions Dice/CharacterCard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,21 +540,22 @@ int Player::removeCard(const string& name){
++it;
}
}
NameList.erase(name);
mCardList.erase(id);
while (!mCardList.count(indexMax))indexMax--;
NameList.erase(name);
return 0;
}
int Player::renameCard(const string& name, const string& name_new) {
std::lock_guard<std::mutex> lock_queue(cardMutex);
if (name_new.empty())return -3;
if (NameList.count(name_new))return -4;
if (name_new.find(":") != string::npos)return -6;
const auto i = NameList[name]->getID();
if (mCardList[i]->locked("n"))return -22;
NameList[name_new] = NameList[name];
auto pc{ NameList[name] };
const auto i = pc->getID();
if (pc->locked("n"))return -22;
NameList[name_new] = pc;
NameList.erase(name);
mCardList[i]->setName(name_new);
pc->setName(name_new);
return 0;
}
int Player::copyCard(const string& name1, const string& name2, long long group)
Expand Down
2 changes: 1 addition & 1 deletion Dice/DiceEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4064,7 +4064,7 @@ int DiceEvent::InnerOrder() {
if (strMsg[intMsgCnt] == '&') {
if (!(attr_name = readToColon()).empty()) {
string attr_new;
if (pc->set(get_str("attr"), attr_new = readExp())) {
if (pc->set(attr_name, attr_new = readExp())) {
set("detailed");
trans = AnysTable{ {
{"attr", attr_name},
Expand Down

0 comments on commit 04f650d

Please sign in to comment.