Skip to content

Commit 04f650d

Browse files
committedJun 8, 2024
fix(st): attr_name
修复一个bug,该bug导致st &格式的指令必定失败
1 parent 0a1bc13 commit 04f650d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed
 

‎Dice/CharacterCard.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -540,21 +540,22 @@ int Player::removeCard(const string& name){
540540
++it;
541541
}
542542
}
543+
NameList.erase(name);
543544
mCardList.erase(id);
544545
while (!mCardList.count(indexMax))indexMax--;
545-
NameList.erase(name);
546546
return 0;
547547
}
548548
int Player::renameCard(const string& name, const string& name_new) {
549549
std::lock_guard<std::mutex> lock_queue(cardMutex);
550550
if (name_new.empty())return -3;
551551
if (NameList.count(name_new))return -4;
552552
if (name_new.find(":") != string::npos)return -6;
553-
const auto i = NameList[name]->getID();
554-
if (mCardList[i]->locked("n"))return -22;
555-
NameList[name_new] = NameList[name];
553+
auto pc{ NameList[name] };
554+
const auto i = pc->getID();
555+
if (pc->locked("n"))return -22;
556+
NameList[name_new] = pc;
556557
NameList.erase(name);
557-
mCardList[i]->setName(name_new);
558+
pc->setName(name_new);
558559
return 0;
559560
}
560561
int Player::copyCard(const string& name1, const string& name2, long long group)

‎Dice/DiceEvent.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4064,7 +4064,7 @@ int DiceEvent::InnerOrder() {
40644064
if (strMsg[intMsgCnt] == '&') {
40654065
if (!(attr_name = readToColon()).empty()) {
40664066
string attr_new;
4067-
if (pc->set(get_str("attr"), attr_new = readExp())) {
4067+
if (pc->set(attr_name, attr_new = readExp())) {
40684068
set("detailed");
40694069
trans = AnysTable{ {
40704070
{"attr", attr_name},

0 commit comments

Comments
 (0)