|
@@ -237,7 +237,9 @@ namespace LOTRO_DAT {
|
|
|
if (!dat)
|
|
|
return DatOperationResult<>(ERROR, "LOCALEDEINIT: no connection with Dat (dat is nullptr)");
|
|
|
|
|
|
- return CommitLocales();
|
|
|
+ auto result = CommitLocales();
|
|
|
+ ClearData();
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -433,13 +435,10 @@ namespace LOTRO_DAT {
|
|
|
*/
|
|
|
|
|
|
DatOperationResult<> DatLocaleManager::CommitLocales() {
|
|
|
- if (!dat->Initialized()) {
|
|
|
- ClearData();
|
|
|
+ if (!dat->Initialized())
|
|
|
return DatOperationResult<>(SUCCESS);
|
|
|
- }
|
|
|
|
|
|
if (patch_dict_.empty()) {
|
|
|
- ClearData();
|
|
|
dat->GetIO().WriteData(BinaryData::FromNumber<4>(0), 4, 296);
|
|
|
dat->GetIO().WriteData(BinaryData::FromNumber<4>(0), 4, 300);
|
|
|
return DatOperationResult<>(SUCCESS);
|
|
@@ -504,7 +503,6 @@ namespace LOTRO_DAT {
|
|
|
|
|
|
auto operation = dat->GetIO().WriteData(binary_data, binary_data.size(), new_dict_offset);
|
|
|
if (operation.result != SUCCESS) {
|
|
|
- ClearData();
|
|
|
return DatOperationResult<>(ERROR, "LOCALEDEINIT: Cannot write locales");
|
|
|
}
|
|
|
|
|
@@ -536,14 +534,12 @@ namespace LOTRO_DAT {
|
|
|
auto operation = dat->GetIO().WriteData(binary_data, binary_data.size(), dict_offset);
|
|
|
|
|
|
if (operation.result != SUCCESS) {
|
|
|
- ClearData();
|
|
|
return DatOperationResult<>(ERROR, "LOCALEDEINIT: Cannot write locales. ERRMSG: " + operation.msg);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
LOG(INFO) << "Locales committed successfully";
|
|
|
- ClearData();
|
|
|
return DatOperationResult<>(SUCCESS);
|
|
|
}
|
|
|
|