Skip to content

Commit

Permalink
fix: data dir
Browse files Browse the repository at this point in the history
修复因为image/record文件夹不存在而导致的mod加载异常
  • Loading branch information
mystringEmpty committed Nov 11, 2023
1 parent 691a40a commit 2467dcf
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Dice/CharacterCard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ unordered_map<int, string> PlayerErrors{
{-23,"strPCLockedWrite"},
{-24,"strPCLockedRead"},
};
CardTemp ModelBRP{ "BRP", fifo_dict_ci<>{}, std::vector<std::vector<std::string>>{}, fifo_dict_ci<>{}, fifo_dict_ci<>{}, fifo_dict_ci<int>{
CardTemp ModelBRP{ "BRP", dict_ci<>{}, std::vector<std::vector<std::string>>{}, dict_ci<>{}, dict_ci<>{}, dict_ci<int>{
{"__DefaultDice",100}
}};
std::vector<std::pair<std::string, std::string>> BuildCOC7 = {
Expand Down
8 changes: 4 additions & 4 deletions Dice/CharacterCard.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class CardTemp
{
public:
string type;
fifo_dict_ci<> replaceName = {};
dict_ci<> replaceName = {};
//作成时生成
vector<vector<string>> vBasicList = {};
//元表
Expand All @@ -85,9 +85,9 @@ class CardTemp
dict_ci<CardPreset> presets = {};
CardTemp() = default;

CardTemp(const string& type, const fifo_dict_ci<>& replace, vector<vector<string>> basic,
const fifo_dict_ci<>& dynamic, const fifo_dict_ci<>& exps,
const fifo_dict_ci<int>& def_skill, const dict_ci<CardPreset>& option = {}) : type(type),
CardTemp(const string& type, const dict_ci<>& replace, vector<vector<string>> basic,
const dict_ci<>& dynamic, const dict_ci<>& exps,
const dict_ci<int>& def_skill, const dict_ci<CardPreset>& option = {}) : type(type),
replaceName(replace),
vBasicList(basic),
presets(option)
Expand Down
4 changes: 2 additions & 2 deletions Dice/DiceFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ std::pair<T1, T2> readini(const string& line, char delim = '='){

void readini(ifstream& fin, std::string& s);

template <typename T1, typename T2, class Sorter>
void readini(string s, fifo_map<T1, T2, Sorter>& m)
template <typename T1, typename T2, class Hasher, class Equal>
void readini(string s, unordered_map<T1, T2, Hasher, Equal>& m)
{
std::pair<T1, T2> p;
string line;
Expand Down
2 changes: 2 additions & 0 deletions Dice/DiceMod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1083,12 +1083,14 @@ void DiceMod::loadDir() {
}
}
if (fs::exists(pathDir / "image")) {
std::filesystem::create_directories(dirExe / "data" / "image");
std::filesystem::copy(pathDir / "image", dirExe / "data" / "image",
std::filesystem::copy_options::recursive |
(Enabled ? std::filesystem::copy_options::update_existing : std::filesystem::copy_options::overwrite_existing));
cntImage = cntDirFile(pathDir / "image");
}
if (fs::exists(pathDir / "audio")) {
std::filesystem::create_directories(dirExe / "data" / "record");
std::filesystem::copy(pathDir / "audio", dirExe / "data" / "record",
(Enabled ? std::filesystem::copy_options::update_existing : std::filesystem::copy_options::overwrite_existing));
cntAudio = cntDirFile(pathDir / "audio");
Expand Down
14 changes: 9 additions & 5 deletions Dice/RDConstant.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

typedef int int_errno;

inline fifo_dict_ci<std::string> SkillNameReplace = {
inline dict_ci<std::string> SkillNameReplace = {
{"str", "力量"},
{"dex", "敏捷"},
{"pow", "意志"},
Expand Down Expand Up @@ -95,6 +95,9 @@ inline fifo_dict_ci<std::string> SkillNameReplace = {
{"步/散", "步枪/霰弹枪"},
{"图书馆", "图书馆使用"},
{"机修", "机械维修"},
{"重型操作", "操作重型机械"},
{"重型机械", "操作重型机械"},
{"重型", "操作重型机械"},
{"电器维修", "电气维修"},
{"cm", "克苏鲁神话"},
{"克苏鲁", "克苏鲁神话"},
Expand All @@ -113,7 +116,7 @@ inline fifo_dict_ci<std::string> SkillNameReplace = {
{"飞行器", "飞行器驾驶"},
{"驾驶飞行器", "飞行器驾驶"},
{"驾驶:飞行器", "飞行器驾驶"},
{"驾驶(飞行器)", "飞行器驾驶"}
{"驾驶(飞行器)", "飞行器驾驶"},
};
inline std::vector<std::vector<std::string>> BasicCOC7 = {
{"职业", "年龄", "性别", "住地", "出身", "时代"},
Expand All @@ -122,7 +125,7 @@ inline std::vector<std::vector<std::string>> BasicCOC7 = {
{"身体状态", "精神状态"},
{"DB", "闪避", "护甲"}
};
inline fifo_dict_ci<std::string> mVariableCOC7 = {
inline dict_ci<std::string> mVariableCOC7 = {
{"灵感", "&智力"},
{"知识", "&教育"},
{"取悦", "&魅惑"},
Expand All @@ -132,7 +135,7 @@ inline fifo_dict_ci<std::string> mVariableCOC7 = {
{"母语", "&教育"},
{"闪避", "{敏捷}/2"}
};
static fifo_dict_ci<std::string> ExpressionCOC7 = {
inline dict_ci<std::string> ExpressionCOC7 = {
{"__DefaultDiceExp", "1D"},
{"医学回复", "1D3"},
{"精神分析回复", "1D3"},
Expand Down Expand Up @@ -254,7 +257,7 @@ static fifo_dict_ci<std::string> ExpressionCOC7 = {
{"火焰喷射器", "2D6"},
{"轻型反坦克炮", "8D10"}
};
static fifo_dict_ci<int> SkillDefaultVal = {
inline dict_ci<int> SkillDefaultVal = {
{"__DefaultDice", 100},
{"会计", 5},
{"人类学", 1},
Expand All @@ -264,6 +267,7 @@ static fifo_dict_ci<int> SkillDefaultVal = {
{"摄影", 5},
{"表演", 5},
{"伪造", 5},
{"伪造文书", 5},
{"文学", 5},
{"书法", 5},
{"乐理", 5},
Expand Down

0 comments on commit 2467dcf

Please sign in to comment.