Commit 38e3690a authored by mercury233's avatar mercury233 Committed by GitHub

fix & update loading database (#2410)

parent 41ca58d6
...@@ -62,11 +62,7 @@ bool DataManager::LoadDB(const wchar_t* wfile) { ...@@ -62,11 +62,7 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
cd.race = sqlite3_column_int(pStmt, 8); cd.race = sqlite3_column_int(pStmt, 8);
cd.attribute = sqlite3_column_int(pStmt, 9); cd.attribute = sqlite3_column_int(pStmt, 9);
cd.category = sqlite3_column_int(pStmt, 10); cd.category = sqlite3_column_int(pStmt, 10);
auto it = _datas.find(cd.code); _datas[cd.code] = cd;
if(it != _datas.end())
it->second = cd;
else
_datas.insert(std::make_pair(cd.code, cd));
if(const char* text = (const char*)sqlite3_column_text(pStmt, 12)) { if(const char* text = (const char*)sqlite3_column_text(pStmt, 12)) {
BufferIO::DecodeUTF8(text, strBuffer); BufferIO::DecodeUTF8(text, strBuffer);
cs.name = strBuffer; cs.name = strBuffer;
...@@ -81,7 +77,7 @@ bool DataManager::LoadDB(const wchar_t* wfile) { ...@@ -81,7 +77,7 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
cs.desc[i] = strBuffer; cs.desc[i] = strBuffer;
} }
} }
_strings.emplace(cd.code, cs); _strings[cd.code] = cs;
} }
} while(step != SQLITE_DONE); } while(step != SQLITE_DONE);
sqlite3_finalize(pStmt); sqlite3_finalize(pStmt);
......
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