1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

Remove SetEnvironment from NetworkBase and all its other wrappers

This commit is contained in:
ZehMatt
2021-08-17 06:25:47 +03:00
parent 40313b1ea3
commit e440942c54
4 changed files with 4 additions and 24 deletions

View File

@@ -477,7 +477,6 @@ namespace OpenRCT2
gGameSoundsOff = !gConfigSound.master_sound_enabled;
}
network_set_env(_env);
chat_init();
CopyOriginalUserFilesOver();

View File

@@ -147,11 +147,6 @@ NetworkBase::NetworkBase(OpenRCT2::IContext& context)
_server_log_fs << std::unitbuf;
}
void NetworkBase::SetEnvironment(const std::shared_ptr<IPlatformEnvironment>& env)
{
_env = env;
}
bool NetworkBase::Init()
{
status = NETWORK_STATUS_READY;
@@ -1101,7 +1096,8 @@ void NetworkBase::AppendLog(std::ostream& fs, const std::string& s)
void NetworkBase::BeginChatLog()
{
auto directory = _env->GetDirectoryPath(DIRBASE::USER, DIRID::LOG_CHAT);
auto env = _context.GetPlatformEnvironment();
auto directory = env->GetDirectoryPath(DIRBASE::USER, DIRID::LOG_CHAT);
_chatLogPath = BeginLog(directory, "", _chatLogFilenameFormat);
# if defined(_WIN32) && !defined(__MINGW32__)
@@ -1127,7 +1123,8 @@ void NetworkBase::CloseChatLog()
void NetworkBase::BeginServerLog()
{
auto directory = _env->GetDirectoryPath(DIRBASE::USER, DIRID::LOG_SERVER);
auto env = _context.GetPlatformEnvironment();
auto directory = env->GetDirectoryPath(DIRBASE::USER, DIRID::LOG_SERVER);
_serverLogPath = BeginLog(directory, ServerName, _serverLogFilenameFormat);
# if defined(_WIN32) && !defined(__MINGW32__)
@@ -3217,11 +3214,6 @@ void NetworkBase::Client_Handle_GAMEINFO([[maybe_unused]] NetworkConnection& con
network_chat_show_server_greeting();
}
void network_set_env(const std::shared_ptr<IPlatformEnvironment>& env)
{
OpenRCT2::GetContext()->GetNetwork().SetEnvironment(env);
}
void network_close()
{
OpenRCT2::GetContext()->GetNetwork().Close();
@@ -4237,9 +4229,6 @@ void network_close()
void network_reconnect()
{
}
void network_set_env(const std::shared_ptr<OpenRCT2::IPlatformEnvironment>&)
{
}
void network_shutdown_client()
{
}

View File

@@ -29,7 +29,6 @@ public: // Uncategorized
bool BeginClient(const std::string& host, uint16_t port);
public: // Common
void SetEnvironment(const std::shared_ptr<OpenRCT2::IPlatformEnvironment>& env);
bool Init();
void Close();
uint32_t GetServerTick();
@@ -180,7 +179,6 @@ public: // Public common
private: // Common Data
using CommandHandler = void (NetworkBase::*)(NetworkConnection& connection, NetworkPacket& packet);
std::shared_ptr<OpenRCT2::IPlatformEnvironment> _env;
std::vector<uint8_t> chunk_buffer;
std::ofstream _chat_log_fs;
uint32_t _lastUpdateTime = 0;

View File

@@ -35,12 +35,6 @@ enum class ModifyGroupType : uint8_t;
enum class PermissionState : uint8_t;
enum class NetworkPermission : uint32_t;
namespace OpenRCT2
{
struct IPlatformEnvironment;
}
void network_set_env(const std::shared_ptr<OpenRCT2::IPlatformEnvironment>& env);
void network_close();
void network_reconnect();
void network_shutdown_client();