Commit 35359f0b authored by nanahira's avatar nanahira

add wchar_t LoadStrings

parent 8d51b160
Pipeline #38070 passed with stages
in 6 minutes and 56 seconds
...@@ -121,6 +121,17 @@ bool DataManager::LoadStrings(const char* file) { ...@@ -121,6 +121,17 @@ bool DataManager::LoadStrings(const char* file) {
std::fclose(fp); std::fclose(fp);
return true; return true;
} }
bool DataManager::LoadStrings(const wchar_t* file) {
FILE* fp = mywfopen(file, "r");
if(!fp)
return false;
char linebuf[TEXT_LINE_SIZE]{};
while(std::fgets(linebuf, sizeof linebuf, fp)) {
ReadStringConfLine(linebuf);
}
std::fclose(fp);
return true;
}
bool DataManager::LoadStrings(irr::io::IReadFile* reader) { bool DataManager::LoadStrings(irr::io::IReadFile* reader) {
char ch{}; char ch{};
std::string linebuf; std::string linebuf;
......
...@@ -47,6 +47,7 @@ public: ...@@ -47,6 +47,7 @@ public:
bool LoadDB(const wchar_t* wfile); bool LoadDB(const wchar_t* wfile);
bool LoadDB(irr::io::IReadFile* reader); bool LoadDB(irr::io::IReadFile* reader);
bool LoadStrings(const char* file); bool LoadStrings(const char* file);
bool LoadStrings(const wchar_t* file);
bool LoadStrings(irr::io::IReadFile* reader); bool LoadStrings(irr::io::IReadFile* reader);
void ReadStringConfLine(const char* linebuf); void ReadStringConfLine(const char* linebuf);
bool Error(sqlite3* pDB, sqlite3_stmt* pStmt = nullptr); bool Error(sqlite3* pDB, sqlite3_stmt* pStmt = nullptr);
......
...@@ -1246,9 +1246,7 @@ void Game::LoadExpansions(const wchar_t* expansions_path) { ...@@ -1246,9 +1246,7 @@ void Game::LoadExpansions(const wchar_t* expansions_path) {
deckManager.LoadLFListSingle(fpath, true); deckManager.LoadLFListSingle(fpath, true);
lflist_changed = true; lflist_changed = true;
} else { } else {
char upath[1024]; dataManager.LoadStrings(fpath);
BufferIO::EncodeUTF8(fpath, upath);
dataManager.LoadStrings(upath);
} }
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment