Revert "use osyncstream for writing to gamelog.txt"

This reverts commit 4695b8c86d.
develop
Myk Taylor 2023-09-17 21:38:48 -07:00
parent 4695b8c86d
commit a61b8d11d0
No known key found for this signature in database
1 changed files with 5 additions and 11 deletions

@ -28,11 +28,7 @@ distribution.
#include <string>
#include <vector>
#include <map>
#include <syncstream>
using std::map;
using std::string;
using std::vector;
using namespace std;
#include "modules/Gui.h"
#include "MemAccess.h"
@ -1401,10 +1397,8 @@ DFHACK_EXPORT void Gui::writeToGamelog(std::string message)
return;
std::ofstream fseed("gamelog.txt", std::ios::out | std::ios::app);
if(fseed.is_open()) {
std::osyncstream wrapped_fseed(fseed);
wrapped_fseed << message << std::endl;
}
if(fseed.is_open())
fseed << message << std::endl;
fseed.close();
}
@ -1546,7 +1540,7 @@ DFHACK_EXPORT int Gui::makeAnnouncement(df::announcement_type type, df::announce
if (flags.bits.D_DISPLAY)
{
world->status.display_timer = ANNOUNCE_DISPLAY_TIME;
Gui::writeToGamelog('x' + std::to_string(repeat_count + 1));
Gui::writeToGamelog('x' + to_string(repeat_count + 1));
}
return -1;
}
@ -1808,7 +1802,7 @@ bool Gui::autoDFAnnouncement(df::report_init r, string message)
if (a_flags.bits.D_DISPLAY)
{
world->status.display_timer = r.display_timer;
Gui::writeToGamelog('x' + std::to_string(repeat_count + 1));
Gui::writeToGamelog('x' + to_string(repeat_count + 1));
}
DEBUG(gui).print("Announcement succeeded as repeat:\n%s\n", message.c_str());
return true;