From 911b9837ddf0eef9a59cf2957f48b3f42fb9f352 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 19 Nov 2024 08:38:29 -0500 Subject: [PATCH] sync --- include/silvergun/mgr/messages.hpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/include/silvergun/mgr/messages.hpp b/include/silvergun/mgr/messages.hpp index 7937be33..0ffd000a 100644 --- a/include/silvergun/mgr/messages.hpp +++ b/include/silvergun/mgr/messages.hpp @@ -123,7 +123,8 @@ class messages final : private manager { const char ch = al_fgetc(&file); if (ch == '\0') break; // End loop if null terminated. if (ch == EOF) { - throw engine_exception("Bad message file format!", "Messages", 2); + //throw engine_exception("Bad message file format!", "Messages", 2); + break; } sys += ch; } @@ -222,9 +223,7 @@ class messages final : private manager { static bool load_script(const std::string& fname) { // Open data file - read binary mode. ALLEGRO_FILE* file; - std::cout << "file not yet opened\n"; file = al_fopen(fname.c_str(), "rb"); - std::cout << "file opened\n"; // File not found, error. if (!file) { al_fclose(file); @@ -232,17 +231,13 @@ class messages final : private manager { } // Loop through the entire data file loading into the queue. - while (true) { - if (al_feof(file)) break; // End loop if eof. - + while (!al_feof(file)) { int64_t timer = -1; std::string sys, to, from, cmd, args; try { // Read the message from file. - std::cout << "before read\n"; read(*file, timer, sys, to, from, cmd, args); - std::cout << "after read\n"; // Add the current time to the timer value. if (timer != -1) timer += engine_time::check(); // Add message to queue. Ignore incomplete messages. Sort while adding.