mirror of https://github.com/OpenRCT2/OpenRCT2.git
Reduce transient inclusion of `<future>` (#21944)
This commit is contained in:
parent
15ee7a244b
commit
ad79699b21
|
@ -9,6 +9,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <deque>
|
||||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/interface/InteractiveConsole.h>
|
||||
#include <openrct2/localisation/FormatCodes.h>
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "entity/EntityTweener.h"
|
||||
#include "interface/Chat.h"
|
||||
#include "interface/InteractiveConsole.h"
|
||||
#include "interface/StdInOutConsole.h"
|
||||
#include "interface/Viewport.h"
|
||||
#include "localisation/Date.h"
|
||||
#include "localisation/Formatter.h"
|
||||
|
|
|
@ -12,9 +12,6 @@
|
|||
#include "../common.h"
|
||||
#include "../localisation/FormatCodes.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <future>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
|
||||
struct DrawPixelInfo;
|
||||
|
@ -49,26 +46,3 @@ public:
|
|||
virtual void Hide() abstract;
|
||||
virtual void WriteLine(const std::string& s, FormatToken colourFormat) abstract;
|
||||
};
|
||||
|
||||
class StdInOutConsole final : public InteractiveConsole
|
||||
{
|
||||
private:
|
||||
std::queue<std::tuple<std::promise<void>, std::string>> _evalQueue;
|
||||
std::atomic<bool> _isPromptShowing{};
|
||||
|
||||
public:
|
||||
void Start();
|
||||
std::future<void> Eval(const std::string& s);
|
||||
void ProcessEvalQueue();
|
||||
|
||||
void Clear() override;
|
||||
void Close() override;
|
||||
void Hide() override
|
||||
{
|
||||
}
|
||||
void WriteLine(const std::string& s)
|
||||
{
|
||||
InteractiveConsole::WriteLine(s);
|
||||
}
|
||||
void WriteLine(const std::string& s, FormatToken colourFormat) override;
|
||||
};
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "StdInOutConsole.h"
|
||||
|
||||
#include "../Context.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../platform/Platform.h"
|
||||
#include "../scripting/ScriptEngine.h"
|
||||
#include "InteractiveConsole.h"
|
||||
|
||||
#include <linenoise.hpp>
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2024 OpenRCT2 developers
|
||||
*
|
||||
* For a complete list of all authors, please refer to contributors.md
|
||||
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "InteractiveConsole.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <future>
|
||||
#include <queue>
|
||||
|
||||
class StdInOutConsole final : public InteractiveConsole
|
||||
{
|
||||
private:
|
||||
std::queue<std::tuple<std::promise<void>, std::string>> _evalQueue;
|
||||
std::atomic<bool> _isPromptShowing{};
|
||||
|
||||
public:
|
||||
void Start();
|
||||
std::future<void> Eval(const std::string& s);
|
||||
void ProcessEvalQueue();
|
||||
|
||||
void Clear() override;
|
||||
void Close() override;
|
||||
void Hide() override
|
||||
{
|
||||
}
|
||||
void WriteLine(const std::string& s)
|
||||
{
|
||||
InteractiveConsole::WriteLine(s);
|
||||
}
|
||||
void WriteLine(const std::string& s, FormatToken colourFormat) override;
|
||||
};
|
Loading…
Reference in New Issue