Fixed libloadorder 6 compatibility.

Didn't take into account behavioural differences when last updating the
code.
This commit is contained in:
Oliver Hamlet
2014-12-21 19:51:23 +00:00
parent b320984b4d
commit da8a86825c
+18 -10
View File
@@ -253,7 +253,7 @@ namespace loot {
else if (Id() == Game::fonv) else if (Id() == Game::fonv)
ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str(), NULL); ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str(), NULL);
if (ret != LIBLO_OK && ret != LIBLO_WARN_LO_MISMATCH) { if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
const char * e = nullptr; const char * e = nullptr;
string err; string err;
lo_get_error_message(&e); lo_get_error_message(&e);
@@ -269,9 +269,9 @@ namespace loot {
throw error(error::liblo_error, err); throw error(error::liblo_error, err);
} }
if (id != Game::tes5) {
ret = lo_set_game_master(gh, _masterFile.c_str()); ret = lo_set_game_master(gh, _masterFile.c_str());
if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
if (ret != LIBLO_OK) {
const char * e = nullptr; const char * e = nullptr;
string err; string err;
lo_get_error_message(&e); lo_get_error_message(&e);
@@ -287,8 +287,10 @@ namespace loot {
lo_cleanup(); lo_cleanup();
throw error(error::liblo_error, err); throw error(error::liblo_error, err);
} }
}
if (lo_get_active_plugins(gh, &pluginArr, &pluginArrSize) != LIBLO_OK) { ret = lo_get_active_plugins(gh, &pluginArr, &pluginArrSize);
if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
const char * e = nullptr; const char * e = nullptr;
string err; string err;
lo_get_error_message(&e); lo_get_error_message(&e);
@@ -334,7 +336,7 @@ namespace loot {
else if (Id() == Game::fonv) else if (Id() == Game::fonv)
ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str(), NULL); ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str(), NULL);
if (ret != LIBLO_OK && ret != LIBLO_WARN_LO_MISMATCH) { if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
const char * e = nullptr; const char * e = nullptr;
string err; string err;
lo_get_error_message(&e); lo_get_error_message(&e);
@@ -350,9 +352,10 @@ namespace loot {
throw error(error::liblo_error, err); throw error(error::liblo_error, err);
} }
if (id != Game::tes5) {
ret = lo_set_game_master(gh, _masterFile.c_str()); ret = lo_set_game_master(gh, _masterFile.c_str());
if (ret != LIBLO_OK) { if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
const char * e = nullptr; const char * e = nullptr;
string err; string err;
lo_get_error_message(&e); lo_get_error_message(&e);
@@ -368,8 +371,10 @@ namespace loot {
lo_cleanup(); lo_cleanup();
throw error(error::liblo_error, err); throw error(error::liblo_error, err);
} }
}
if (lo_get_load_order(gh, &pluginArr, &pluginArrSize) != LIBLO_OK) { ret = lo_get_load_order(gh, &pluginArr, &pluginArrSize);
if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
const char * e = nullptr; const char * e = nullptr;
string err; string err;
lo_get_error_message(&e); lo_get_error_message(&e);
@@ -410,7 +415,7 @@ namespace loot {
else if (Id() == Game::fonv) else if (Id() == Game::fonv)
ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str(), NULL); ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str(), NULL);
if (ret != LIBLO_OK && ret != LIBLO_WARN_LO_MISMATCH) { if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
const char * e = nullptr; const char * e = nullptr;
string err; string err;
lo_get_error_message(&e); lo_get_error_message(&e);
@@ -426,8 +431,9 @@ namespace loot {
throw error(error::liblo_error, err); throw error(error::liblo_error, err);
} }
if (id != Game::tes5) {
ret = lo_set_game_master(gh, _masterFile.c_str()); ret = lo_set_game_master(gh, _masterFile.c_str());
if (ret != LIBLO_OK) { if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
const char * e = nullptr; const char * e = nullptr;
string err; string err;
lo_get_error_message(&e); lo_get_error_message(&e);
@@ -443,6 +449,7 @@ namespace loot {
lo_cleanup(); lo_cleanup();
throw error(error::liblo_error, err); throw error(error::liblo_error, err);
} }
}
pluginArrSize = loadOrder.size(); pluginArrSize = loadOrder.size();
pluginArr = new char*[pluginArrSize]; pluginArr = new char*[pluginArrSize];
@@ -453,7 +460,8 @@ namespace loot {
++i; ++i;
} }
if (lo_set_load_order(gh, pluginArr, pluginArrSize) != LIBLO_OK) { ret = lo_set_load_order(gh, pluginArr, pluginArrSize);
if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
for (size_t i=0; i < pluginArrSize; i++) for (size_t i=0; i < pluginArrSize; i++)
delete [] pluginArr[i]; delete [] pluginArr[i];
delete [] pluginArr; delete [] pluginArr;