Skip to content

Commit 31f27e7

Browse files
committed
fix(pc): build
1 parent fc8adf0 commit 31f27e7

File tree

5 files changed

+25
-21
lines changed

5 files changed

+25
-21
lines changed

Dice/CharacterCard.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,17 @@ void CharaCard::cntRcStat(int die, int rate) {
504504
}
505505
unordered_map<long long, Player> PList;
506506

507+
Player::Player() {
508+
mGroupCard[0] = mCardList[0] = std::make_shared<CharaCard>("角色卡", (size_t)0);
509+
}
510+
511+
Player::Player(const Player& pl)
512+
{
513+
indexMax = pl.indexMax;
514+
mCardList = pl.mCardList;
515+
NameList = pl.NameList;
516+
mGroupCard = pl.mGroupCard;
517+
}
507518
Player& getPlayer(long long uid)
508519
{
509520
//if (!PList.count(uid))PList[uid] = {};
@@ -573,11 +584,11 @@ int Player::copyCard(const string& name1, const string& name2, long long group)
573584
*getCard(name1) << *getCard(name2);
574585
return 0;
575586
}
576-
PC Player::getCard(const string& name, long long group)
587+
PC Player::getCard(const string& name, long long group) const
577588
{
578-
if (!name.empty() && NameList.count(name))return NameList[name];
579-
if (mGroupCard.count(group))return mGroupCard[group];
580-
if (mGroupCard.count(0))return mGroupCard[0];
589+
if (!name.empty() && NameList.count(name))return NameList.at(name);
590+
if (mGroupCard.count(group))return mGroupCard.at(group);
591+
if (mGroupCard.count(0))return mGroupCard.at(0);
581592
return mCardList.begin()->second;
582593
}
583594
PC Player::getCardByID(long long id)const {

Dice/CharacterCard.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -285,17 +285,9 @@ class Player
285285
// 人物卡互斥
286286
mutable std::mutex cardMutex;
287287
public:
288-
Player() {
289-
mCardList[0] = std::make_shared<CharaCard>("角色卡", 0);
290-
}
288+
Player();
291289

292-
Player(const Player& pl)
293-
{
294-
indexMax = pl.indexMax;
295-
mCardList = pl.mCardList;
296-
NameList = pl.NameList;
297-
mGroupCard = pl.mGroupCard;
298-
}
290+
Player(const Player& pl);
299291

300292
/*Player& operator=(const Player& pl)
301293
{
@@ -347,7 +339,7 @@ class Player
347339
return Res.show();
348340
}
349341

350-
PC getCard(const string& name, long long group = 0);
342+
PC getCard(const string& name, long long group = 0) const;
351343

352344
PC getCardByID(long long id) const;
353345
PC operator[](long long id) const {

Dice/DiceConsole.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const std::unordered_map<std::string,string>Console::confComment{
114114
{"ReferMsgReply","响应消息时回复该消息,需要框架支持"},
115115
{"EnableWebUI","是否启用WebUI,重启生效"},
116116
{"WebUIAllowInternetAccess","是否允许远程访问WebUI(端口须对外开放)重启生效"},
117-
{"WebUIPort","固定WebUI端口,重启生效"},
117+
{"WebUIPort","指定使用的WebUI端口号,重启生效"},
118118
{"EnablePython","是否启用Python,重启生效"},
119119
{"DebugMode","调试模式:将所有接受的指令写入文件"},
120120
{"DefaultCOCRoomRule","未设置rc房规时调用的检定规则"},

Dice/DiceEvent.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ int DiceEvent::BasicOrder()
887887
while (isspace(static_cast<unsigned char>(strMsg[intMsgCnt])))
888888
intMsgCnt++;
889889
//指令匹配
890-
if (console["DebugMode"])console.log("listen:" + strMsg, 0, printSTNow());
890+
if (console["DebugMode"])DD::debugLog(printSTNow() + " listen:" + strMsg);
891891
if (strLowerMessage.substr(intMsgCnt, 9) == "authorize")
892892
{
893893
intMsgCnt += 9;
@@ -3398,9 +3398,9 @@ int DiceEvent::InnerOrder() {
33983398
else if (strOption == "build") {
33993399
string strPC{ strip(filter_CQcode(readRest(), fromChat.gid))};
34003400
if (!(resno = pl.buildCard(strPC, false, fromChat.gid))) {
3401-
auto pc = pl.getCard(strPC);
3401+
auto pc = pl[fromChat.gid];
34023402
set("show", pc->show(true));
3403-
set("char", pc->getName());
3403+
set("char", strPC);
34043404
replyMsg("strPcCardBuild");
34053405
}
34063406
else {
@@ -3610,14 +3610,14 @@ int DiceEvent::InnerOrder() {
36103610
}
36113611
}
36123612
if (attr.find("自动成功") == 0) {
3613-
strDifficulty = attr.substr(0, 8);
3613+
strDifficulty = attr.substr(0, 12);
36143614
attr = attr.substr(12);
36153615
isAutomatic = true;
36163616
}
36173617
if (attr.find("困难") == 0 || attr.find("极难") == 0) {
36183618
strDifficulty += attr.substr(0, 6);
36193619
intDifficulty = (attr.substr(0, 6) == "困难") ? 2 : 5;
3620-
attr = attr.substr(4);
3620+
attr = attr.substr(6);
36213621
}
36223622
if (pc) {
36233623
attr = pc->standard(attr);

DiceWebUI

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit cd70ad71f0957f36f5cb4203d2749421a26d4cb9

0 commit comments

Comments
 (0)