18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-27 21:45:16 +01:00
Files
maszyna/utilities/inionlysettings.h
jerrrrycho 68c704e513 fix(config): a scenery switches a script runtime off as before, only switching it on is refused
keep() put python.enabled, luascreens.enabled, wasm.enabled and lua.fulllibraries back in either
direction, so a scenery with config python.enabled no endconfig, which the release honoured, was
overridden and got an error in the log. They are put back now only when the scenery turned them
on; switched off they stay so, silently.
2026-11-17 10:00:49 +01:00

57 lines
1.9 KiB
C++

/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "utilities/Globals.h"
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
// the settings only eu07.ini sets. a scenery's config block is read by the parser of eu07.ini
// (state_serializer::deserialize_config, global_settings::ConfigParse), and with these keys it would run a program
// (execonexit, extcam.cmd, extcam.rec), write the screenshots elsewhere (screenshotsdir), open connections and ports
// (network.server, network.client, zmq.address, motiontelemetry, uart, feedbackmode, feedbackport), switch back on a
// script runtime the player switched off (python.enabled, luascreens.enabled, wasm.enabled) or take its own scripts
// out of the sandbox (lua.fulllibraries). they keep what eu07.ini set; a scenery may still switch a runtime off, or
// keep its scripts in the sandbox when eu07.ini didn't, as it always could
class ini_only_settings
{
public:
// what Settings holds now, as eu07.ini set it
explicit ini_only_settings(global_settings const &Settings);
// puts back into Settings what changed since, and gives the keys of eu07.ini whose settings changed
std::vector<std::string_view> restore(global_settings &Settings) const;
private:
std::string m_exec_on_exit;
std::string m_screenshot_dir;
std::string m_extcam_cmd;
std::string m_extcam_rec;
std::vector<std::pair<std::string, std::string>> m_network_servers;
std::optional<std::pair<std::string, std::string>> m_network_client;
#ifdef WITH_ZMQ
std::string m_zmq_address;
#endif
motiontelemetry::conf_t m_motiontelemetry;
#ifdef WITH_UART
uart_input::conf_t m_uart;
#endif
int m_feedback_mode;
int m_feedback_port;
bool m_python_enabled;
bool m_luascreens_enabled;
bool m_lua_fulllibraries;
bool m_wasm_enabled;
};