diff options
author | Aki <please@ignore.pl> | 2022-04-12 18:33:34 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-04-12 18:33:34 +0200 |
commit | 9c1439b0e5e1c90723c0f2f6e22a24a935623542 (patch) | |
tree | f1999c9dc2e62c576fcc14f326992514ea20e016 /StarsEx/Starshatter.cpp | |
parent | 220f110e298a211d0f508ed33bae0fa9e9bf4689 (diff) | |
download | starshatter-9c1439b0e5e1c90723c0f2f6e22a24a935623542.zip starshatter-9c1439b0e5e1c90723c0f2f6e22a24a935623542.tar.gz starshatter-9c1439b0e5e1c90723c0f2f6e22a24a935623542.tar.bz2 |
Changed error returning in DataLoader
This is to allow meaningful return values for identification of unique
sources.
Diffstat (limited to 'StarsEx/Starshatter.cpp')
-rw-r--r-- | StarsEx/Starshatter.cpp | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/StarsEx/Starshatter.cpp b/StarsEx/Starshatter.cpp index 62b728f..dc60533 100644 --- a/StarsEx/Starshatter.cpp +++ b/StarsEx/Starshatter.cpp @@ -171,14 +171,9 @@ chat_mode(0), exit_time(1.2), cutscene(0) loader = DataLoader::GetLoader(); int loadstat = loader->EnableDatafile("shatter.dat"); - if (loadstat != DataLoader::DATAFILE_OK) { - const char* err_msg = loadstat == DataLoader::DATAFILE_INVALID ? - "The file 'shatter.dat' appears to have been damaged. Please re-install Starshatter." : - "Starshatter cannot open the file 'shatter.dat'. Please re-install Starshatter."; - - ::MessageBox(hwnd, err_msg, "Starshatter - Error", MB_OK); - ::Print(err_msg); - ::Print("\n\nFATAL ERROR: EXIT."); + if (loadstat == DataLoader::FAILED) { + ::MessageBox(hwnd, loader->LastError(), "Starshatter - Error", MB_OK); + ::Print("FATAL ERROR: %s\n", loader->LastError()); exit(-1); } @@ -191,17 +186,6 @@ chat_mode(0), exit_time(1.2), cutscene(0) if (loader->FindFile("content.dat")) loader->EnableDatafile("content.dat"); - //if (loadstat != DataLoader::DATAFILE_OK) { - // const char* err_msg = loadstat == DataLoader::DATAFILE_INVALID ? - // "The file 'content.dat' appears to have been damaged. Please re-install the latest Starshatter update." : - // "Starshatter cannot open the file 'content.dat'. Please re-install the latest Starshatter update."; - - // ::MessageBox(hwnd, err_msg, "Starshatter - Error", MB_OK); - // ::Print(err_msg); - // ::Print("\n\nFATAL ERROR: EXIT."); - // exit(-1); - //} - LoadVideoConfig("video.cfg"); // create the fonts |