diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000000..3d280eed2c
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,24 @@
+AlignConsecutiveAssignments: true
+AlignConsecutiveDeclarations: true
+AlignTrailingComments: true
+AllowShortBlocksOnASingleLine: true
+AllowShortCaseLabelsOnASingleLine: true
+AllowShortIfStatementsOnASingleLine: WithoutElse
+BasedOnStyle: Microsoft
+BreakBeforeBraces: Allman
+ColumnLimit: 130
+Cpp11BracedListStyle: true
+FixNamespaceComments: true
+IncludeBlocks: Regroup
+IndentPPDirectives: BeforeHash
+IndentWidth: 4
+Language: Cpp
+NamespaceIndentation: All
+ReflowComments: true
+SortIncludes: true
+SortUsingDeclarations: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesInParentheses: false
+Standard: Cpp11
+UseTab: Never
\ No newline at end of file
diff --git a/source/main/Application.cpp b/source/main/Application.cpp
index 2cf4cdd9fe..24db3aa5dc 100644
--- a/source/main/Application.cpp
+++ b/source/main/Application.cpp
@@ -17,21 +17,19 @@
along with Rigs of Rods. If not, see .
*/
-
/// @file Application.cpp
/// @author Petr Ohlidal
/// @date 05/2014
-
#include "Application.h"
#include "CacheSystem.h"
#include "ContentManager.h"
#include "GUIManager.h"
#include "InputEngine.h"
+#include "MumbleIntegration.h"
#include "OgreSubsystem.h"
#include "OverlayWrapper.h"
-#include "MumbleIntegration.h"
/* -------------------- Research of debug options (only_a_ptr, 06/2017) ----------------------
@@ -40,452 +38,490 @@
["Debug Truck Mass"] | GVar: diag_truck_mass --- extra logging on runtime - mass recalculation.
["Debug Collisions"] | GVar: diag_collisions --- visual debug of static map collisions. Only effective on map load.
["EnvMapDebug"] | GVar: diag_envmap --- effective on terrain load (envmap init).
-["VideoCameraDebug"] | GVar: diag_videocameras--- creates debug mesh showing videocamera direction. Effective on vehicle spawn.
+["VideoCameraDebug"] | GVar: diag_videocameras--- creates debug mesh showing videocamera direction. Effective on vehicle
+spawn.
-["Enable Ingame Console"] | + --- Equivalent to "\log" console command, echoes all RoR.log output to console. Reported to cause massive slowdown on startup.
+["Enable Ingame Console"] | + --- Equivalent to "\log" console command, echoes all RoR.log output to
+console. Reported to cause massive slowdown on startup.
["Beam Break Debug"] | + --- Use before spawn, lasts entire vehicle lifetime.
["Beam Deform Debug"] | + --- Use before spawn, lasts entire vehicle lifetime.
["Trigger Debug"] | + --- Use before spawn, lasts entire vehicle lifetime.
["Advanced Logging"] | ~ no gvar ~ --- DEAD, used in removed 'ScopeLog' feature of old spawner.
-["DebugBeams"] --- Pre configured debug overlay mode --- DEAD since debug overlay has been remade with different modes
+["DebugBeams"] --- Pre configured debug overlay mode --- DEAD since debug overlay has been
+remade with different modes
*/
-namespace RoR {
-namespace App {
-
-// ================================================================================
-// Global variables
-// ================================================================================
-
-
-// Object instances
-static OgreSubsystem* g_ogre_subsystem;
-static ContentManager g_content_manager;
-static OverlayWrapper* g_overlay_wrapper;
-static GUIManager* g_gui_manager;
-static Console* g_console;
-static InputEngine* g_input_engine;
-static CacheSystem* g_cache_system;
-static MainMenu* g_main_menu;
-static SimController* g_sim_controller;
-static MumbleIntegration* g_mumble;
-static TerrainManager* g_sim_terrain;
-
-// App
- GVarEnum_AP app_state ("app_state", nullptr, AppState::BOOTSTRAP, AppState::MAIN_MENU);
- GVarStr_A<50> app_language ("app_language", "Language", "en");
- GVarStr_A<50> app_country ("app_country", "Country", "us");
- GVarPod_A app_skip_main_menu ("app_skip_main_menu", "SkipMainMenu", false);
- GVarPod_APS app_async_physics ("app_async_physics", "AsyncPhysics", true,
- true, true);
- GVarPod_APS app_num_workers ("app_num_workers", "NumWorkerThreads", 0,
- 0, 0);
- GVarStr_AP<50> app_screenshot_format ("app_screenshot_format", "Screenshot Format", "png", "png");
- GVarStr_A<100> app_rendersys_override ("app_rendersys_override", "Render system", "");
- GVarStr_A<300> app_extra_mod_path ("app_extra_mod_path", "Extra mod path", "");
- GVarPod_A app_force_cache_purge ("app_force_cache_purge", nullptr, false);
- GVarPod_A app_force_cache_udpate ("app_force_cache_udpate", nullptr, false);
- GVarPod_A app_disable_online_api ("app_disable_online_api", "Disable Online API", false);
-
-
-// Simulation
- GVarEnum_AP sim_state ("sim_state", nullptr, SimState::OFF, SimState::OFF);
- GVarStr_AP<200> sim_terrain_name ("sim_terrain_name", nullptr, "", "");
- GVarStr_AP<300> sim_terrain_gui_name ("sim_terrain_gui_name", nullptr, "", "");
- GVarStr_A<100> sim_savegame ("sim_savegame", nullptr, "");
- GVarPod_A sim_load_savegame ("sim_load_savegame", nullptr, false);
- GVarPod_A sim_spawn_running ("sim_spawn_running", "Engines spawn running", true);
- GVarPod_A sim_replay_enabled ("sim_replay_enabled", "Replay mode", false);
- GVarPod_A sim_replay_length ("sim_replay_length", "Replay length", 200);
- GVarPod_A sim_replay_stepping ("sim_replay_stepping", "Replay Steps per second", 1000);
- GVarPod_A sim_realistic_commands ("sim_realistic_commands", "Realistic forward commands",false);
- GVarPod_A sim_races_enabled ("sim_races_enabled", "Races", true);
- GVarPod_A sim_no_collisions ("sim_no_collisions", "DisableCollisions", false);
- GVarPod_A sim_no_self_collisions ("sim_no_self_collisions", "DisableSelfCollisions", false);
- GVarEnum_AP sim_gearbox_mode ("sim_gearbox_mode", "GearboxMode", SimGearboxMode::AUTO, SimGearboxMode::AUTO);
-
-// Multiplayer
- GVarEnum_AP mp_state ("mp_state", nullptr, MpState::DISABLED, MpState::DISABLED);
- GVarPod_APS mp_join_on_startup ("mp_join_on_startup", "Auto connect", false, false, false);
- GVarPod_A mp_chat_auto_hide ("mp_chat_auto_hide", "Auto hide chat", true);
- GVarPod_A mp_hide_net_labels ("mp_hide_net_labels", "Hide net labels", false);
- GVarPod_A mp_hide_own_net_label ("mp_hide_own_net_label", "Hide own net label", true);
- GVarPod_A mp_pseudo_collisions ("mp_pseudo_collisions", "Multiplayer collisions", false);
- GVarStr_AP<200> mp_server_host ("mp_server_host", "Server name", "", "");
- GVarPod_A mp_server_port ("mp_server_port", "Server port", 0);
- GVarStr_APS<100> mp_server_password ("mp_server_password", "Server password", "", "", "");
- GVarStr_AP<100> mp_player_name ("mp_player_name", "Nickname", "Player", "Player");
- GVarStr_AP<100> mp_player_token ("mp_player_token", "User Token", "", "");
- GVarStr_A<100> mp_api_url ("mp_api_url", "Online API URL", "http://api.rigsofrods.org");
-
-// Diagnostic
- GVarPod_A diag_auto_spawner_report("diag_auto_spawner_report","AutoActorSpawnerReport", false);
- GVarPod_A diag_camera ("diag_camera", "Camera Debug", false);
- GVarPod_A diag_trace_globals ("diag_trace_globals", nullptr, false); // Don't init to 'true', logger is not ready at startup
- GVarPod_A diag_rig_log_node_import("diag_rig_log_node_import","RigImporter_Debug_TraverseAndLogAllNodes", false);
- GVarPod_A diag_rig_log_node_stats ("diag_rig_log_node_stats", "RigImporter_PrintNodeStatsToLog", false);
- GVarPod_A diag_rig_log_messages ("diag_rig_log_messages", "RigImporter_PrintMessagesToLog", false);
- GVarPod_A diag_collisions ("diag_collisions", "Debug Collisions", false);
- GVarPod_A diag_truck_mass ("diag_truck_mass", "Debug Truck Mass", false);
- GVarPod_A diag_envmap ("diag_envmap", "EnvMapDebug", false);
- GVarPod_A diag_videocameras ("diag_videocameras", "VideoCameraDebug", false);
- GVarStr_APS<100> diag_preset_terrain ("diag_preset_terrain", "Preselected Terrain", "", "", "");
- GVarStr_A<100> diag_preset_spawn_pos ("diag_spawn_position", nullptr, "");
- GVarStr_A<100> diag_preset_spawn_rot ("diag_spawn_rotation", nullptr, "");
- GVarStr_APS<100> diag_preset_vehicle ("diag_preset_vehicle", "Preselected Truck", "", "", "");
- GVarStr_A<100> diag_preset_veh_config ("diag_preset_veh_config", "Preselected TruckConfig", "");
- GVarPod_APS diag_preset_veh_enter ("diag_preset_veh_enter", "Enter Preselected Truck", false, false, false);
- GVarPod_A diag_log_console_echo ("diag_log_console_echo", "Enable Ingame Console", false);
- GVarPod_A diag_log_beam_break ("diag_log_beam_break", "Beam Break Debug", false);
- GVarPod_A diag_log_beam_deform ("diag_log_beam_deform", "Beam Deform Debug", false);
- GVarPod_A diag_log_beam_trigger ("diag_log_beam_trigger", "Trigger Debug", false);
- GVarPod_A diag_simple_materials ("diag_simple_materials", "SimpleMaterials", false);
- GVarPod_A diag_warning_texture ("diag_warning_texture", "Warning texture", false);
- GVarPod_A diag_hide_broken_beams ("diag_hide_broken_beams", "Hide broken beams", false);
- GVarPod_A diag_hide_beam_stress ("diag_hide_beam_stress", "Hide beam stress", true);
- GVarPod_A diag_hide_wheel_info ("diag_hide_wheel_info", "Hide wheel info", true);
- GVarPod_A diag_hide_wheels ("diag_hide_wheels", "Hide wheels", false);
- GVarPod_A diag_hide_nodes ("diag_hide_nodes", "Hide nodes", false);
- GVarPod_A diag_physics_dt ("diag_physics_dt", "PhysicsTimeStep", 0.0005f);
-
-// System (all paths are without ending slash!)
- GVarStr_A<300> sys_process_dir ("sys_process_dir", nullptr, "");
- GVarStr_A<300> sys_user_dir ("sys_user_dir", nullptr, "");
- GVarStr_A<300> sys_config_dir ("sys_config_dir", "Config Root", "");
- GVarStr_A<300> sys_cache_dir ("sys_cache_dir", "Cache Path", "");
- GVarStr_A<300> sys_logs_dir ("sys_logs_dir", "Log Path", "");
- GVarStr_A<300> sys_resources_dir ("sys_resources_dir", "Resources Path", "");
- GVarStr_A<300> sys_profiler_dir ("sys_profiler_dir", "Profiler output dir", "");
- GVarStr_A<300> sys_savegames_dir ("sys_savegames_dir", nullptr, "");
- GVarStr_A<300> sys_screenshot_dir ("sys_screenshot_dir", nullptr, "");
-
-// Input - Output
- GVarPod_A io_analog_smoothing ("io_analog_smoothing", "Analog Input Smoothing", 1.f);
- GVarPod_A io_analog_sensitivity ("io_analog_sensitivity", "Analog Input Sensitivity", 1.f);
- GVarPod_A io_ffb_enabled ("io_ffb_enabled", "Force Feedback", false);
- GVarPod_A io_ffb_camera_gain ("io_ffb_camera_gain", "Force Feedback Camera", 0.f);
- GVarPod_A io_ffb_center_gain ("io_ffb_center_gain", "Force Feedback Centering", 0.f);
- GVarPod_A io_ffb_master_gain ("io_ffb_master_gain", "Force Feedback Gain", 0.f);
- GVarPod_A io_ffb_stress_gain ("io_ffb_stress_gain", "Force Feedback Stress", 0.f);
- GVarEnum_AP io_input_grab_mode ("io_input_grab_mode", "Input Grab", IoInputGrabMode::ALL, IoInputGrabMode::ALL);
- GVarPod_A io_arcade_controls ("io_arcade_controls", "ArcadeControls", false);
- GVarPod_A io_outgauge_mode ("io_outgauge_mode", "OutGauge Mode", 0); // 0 = disabled, 1 = enabled
- GVarStr_A<50> io_outgauge_ip ("io_outgauge_ip", "OutGauge IP", "192.168.1.100");
- GVarPod_A io_outgauge_port ("io_outgauge_port", "OutGauge Port", 1337);
- GVarPod_A io_outgauge_delay ("io_outgauge_delay", "OutGauge Delay", 10.f);
- GVarPod_A io_outgauge_id ("io_outgauge_id", "OutGauge ID", 0);
- GVarPod_A io_discord_rpc ("io_discord_rpc", "Discord Rich Presence", true);
-
-// Audio
- GVarPod_A audio_master_volume ("audio_master_volume", "Sound Volume", 1);
- GVarPod_A audio_enable_creak ("audio_enable_creak", "Creak Sound", false);
- GVarStr_AP<100> audio_device_name ("audio_device_name", "AudioDevice", "", "");
- GVarPod_A audio_menu_music ("audio_menu_music", "MainMenuMusic", false);
-
-// Graphics
- GVarEnum_AP gfx_flares_mode ("gfx_flares_mode", "Lights", GfxFlaresMode::ALL_VEHICLES_ALL_LIGHTS, GfxFlaresMode::ALL_VEHICLES_ALL_LIGHTS);
- GVarEnum_AP gfx_shadow_type ("gfx_shadow_type", "Shadow technique", GfxShadowType::PSSM, GfxShadowType::PSSM);
- GVarEnum_AP gfx_extcam_mode ("gfx_extcam_mode", "External Camera Mode", GfxExtCamMode::PITCHING, GfxExtCamMode::PITCHING);
- GVarEnum_AP gfx_sky_mode ("gfx_sky_mode", "Sky effects", GfxSkyMode::CAELUM, GfxSkyMode::CAELUM);
- GVarEnum_AP gfx_texture_filter ("gfx_texture_filter", "Texture Filtering", GfxTexFilter::ANISOTROPIC, GfxTexFilter::ANISOTROPIC);
- GVarEnum_AP gfx_vegetation_mode ("gfx_vegetation_mode", "Vegetation", GfxVegetation::FULL, GfxVegetation::FULL);
- GVarEnum_AP gfx_water_mode ("gfx_water_mode", "Water effects", GfxWaterMode::FULL_FAST, GfxWaterMode::FULL_FAST);
- GVarPod_A gfx_anisotropy ("gfx_anisotropy", "Anisotropy", 4);
- GVarPod_A gfx_water_waves ("gfx_water_waves", "Waves", false);
- GVarPod_A gfx_particles_mode ("gfx_particles_mode", "Particles", 0);
- GVarPod_A gfx_enable_videocams ("gfx_enable_videocams", "gfx_enable_videocams", false);
- GVarPod_A gfx_window_videocams ("gfx_window_videocams", "UseVideocameraWindows", false);
- GVarPod_APS gfx_surveymap_icons ("gfx_surveymap_icons", "Overview map icons", true, true, true);
- GVarPod_A gfx_declutter_map ("gfx_declutter_map", "Declutter overview map", true);
- GVarPod_A gfx_envmap_enabled ("gfx_envmap_enabled", "Reflections", true);
- GVarPod_A gfx_envmap_rate ("gfx_envmap_rate", "ReflectionUpdateRate", 1);
- GVarPod_A gfx_shadow_quality ("gfx_shadow_quality", "Shadows Quality", 2);
- GVarPod_A gfx_skidmarks_mode ("gfx_skidmarks_mode", "Skidmarks", 0);
- GVarPod_A gfx_sight_range ("gfx_sight_range", "SightRange", 5000); // Previously either 2000 or 4500 (inconsistent)
- GVarPod_A gfx_camera_height ("gfx_camera_height", "Static camera height", 5);
- GVarPod_APS gfx_fov_external ("gfx_fov_external", "FOV External", 60, 60, 60);
- GVarPod_APS gfx_fov_internal ("gfx_fov_internal", "FOV Internal", 75, 75, 75);
- GVarPod_A gfx_static_cam_fov_exp ("gfx_static_cam_fov_exp", nullptr, 1.f);
- GVarPod_A gfx_fixed_cam_tracking ("gfx_fixed_cam_tracking", nullptr, false);
- GVarPod_A gfx_fps_limit ("gfx_fps_limit", "FPS-Limiter", 0); // 0 = unlimited
- GVarPod_A gfx_speedo_digital ("gfx_speedo_digital", "DigitalSpeedo", true);
- GVarPod_A gfx_speedo_imperial ("gfx_speedo_imperial", "gfx_speedo_imperial", false);
- GVarPod_A gfx_flexbody_lods ("gfx_flexbody_lods", "Flexbody_EnableLODs", false);
- GVarPod_A gfx_flexbody_cache ("gfx_flexbody_cache", "Flexbody_UseCache", false);
- GVarPod_A gfx_reduce_shadows ("gfx_reduce_shadows", "Shadow optimizations", true);
- GVarPod_A gfx_enable_rtshaders ("gfx_enable_rtshaders", "Use RTShader System", false);
-
-// Instance management
-void SetMainMenu (MainMenu* obj) { g_main_menu = obj; }
-void SetSimController (SimController* obj) { g_sim_controller = obj;}
-void SetSimTerrain (TerrainManager* obj) { g_sim_terrain = obj;}
-void SetCacheSystem (CacheSystem* obj) { g_cache_system = obj; }
-
-// Instance access
-OgreSubsystem* GetOgreSubsystem () { return g_ogre_subsystem; };
-ContentManager* GetContentManager () { return &g_content_manager;}
-OverlayWrapper* GetOverlayWrapper () { return g_overlay_wrapper;}
-GUIManager* GetGuiManager () { return g_gui_manager;}
-Console* GetConsole () { return g_gui_manager->GetConsole();}
-InputEngine* GetInputEngine () { return g_input_engine;}
-CacheSystem* GetCacheSystem () { return g_cache_system;}
-MainMenu* GetMainMenu () { return g_main_menu;}
-SimController* GetSimController () { return g_sim_controller; }
-MumbleIntegration* GetMumble () { return g_mumble; }
-TerrainManager* GetSimTerrain () { return g_sim_terrain; }
-
-void StartOgreSubsystem()
+namespace RoR
{
- g_ogre_subsystem = new OgreSubsystem();
- if (g_ogre_subsystem == nullptr)
+ namespace App
{
- throw std::runtime_error("[RoR] Failed to create OgreSubsystem");
- }
- if (! g_ogre_subsystem->StartOgre("", ""))
- {
- throw std::runtime_error("[RoR] Failed to start up OGRE 3D engine");
- }
-}
+ // ================================================================================
+ // Global variables
+ // ================================================================================
+
+ // Object instances
+ static OgreSubsystem * g_ogre_subsystem;
+ static ContentManager g_content_manager;
+ static OverlayWrapper * g_overlay_wrapper;
+ static GUIManager * g_gui_manager;
+ static Console * g_console;
+ static InputEngine * g_input_engine;
+ static CacheSystem * g_cache_system;
+ static MainMenu * g_main_menu;
+ static SimController * g_sim_controller;
+ static MumbleIntegration *g_mumble;
+ static TerrainManager * g_sim_terrain;
+
+ // App
+ GVarEnum_AP app_state("app_state", nullptr, AppState::BOOTSTRAP, AppState::MAIN_MENU);
+ GVarStr_A<50> app_language("app_language", "Language", "en");
+ GVarStr_A<50> app_country("app_country", "Country", "us");
+ GVarPod_A app_skip_main_menu("app_skip_main_menu", "SkipMainMenu", false);
+ GVarPod_APS app_async_physics("app_async_physics", "AsyncPhysics", true, true, true);
+ GVarPod_APS app_num_workers("app_num_workers", "NumWorkerThreads", 0, 0, 0);
+ GVarStr_AP<50> app_screenshot_format("app_screenshot_format", "Screenshot Format", "png", "png");
+ GVarStr_A<100> app_rendersys_override("app_rendersys_override", "Render system", "");
+ GVarStr_A<300> app_extra_mod_path("app_extra_mod_path", "Extra mod path", "");
+ GVarPod_A app_force_cache_purge("app_force_cache_purge", nullptr, false);
+ GVarPod_A app_force_cache_udpate("app_force_cache_udpate", nullptr, false);
+ GVarPod_A app_disable_online_api("app_disable_online_api", "Disable Online API", false);
+
+ // Simulation
+ GVarEnum_AP sim_state("sim_state", nullptr, SimState::OFF, SimState::OFF);
+ GVarStr_AP<200> sim_terrain_name("sim_terrain_name", nullptr, "", "");
+ GVarStr_AP<300> sim_terrain_gui_name("sim_terrain_gui_name", nullptr, "", "");
+ GVarStr_A<100> sim_savegame("sim_savegame", nullptr, "");
+ GVarPod_A sim_load_savegame("sim_load_savegame", nullptr, false);
+ GVarPod_A sim_spawn_running("sim_spawn_running", "Engines spawn running", true);
+ GVarPod_A sim_replay_enabled("sim_replay_enabled", "Replay mode", false);
+ GVarPod_A sim_replay_length("sim_replay_length", "Replay length", 200);
+ GVarPod_A sim_replay_stepping("sim_replay_stepping", "Replay Steps per second", 1000);
+ GVarPod_A sim_realistic_commands("sim_realistic_commands", "Realistic forward commands", false);
+ GVarPod_A sim_races_enabled("sim_races_enabled", "Races", true);
+ GVarPod_A sim_no_collisions("sim_no_collisions", "DisableCollisions", false);
+ GVarPod_A sim_no_self_collisions("sim_no_self_collisions", "DisableSelfCollisions", false);
+ GVarEnum_AP sim_gearbox_mode("sim_gearbox_mode", "GearboxMode", SimGearboxMode::AUTO,
+ SimGearboxMode::AUTO);
+
+ // Multiplayer
+ GVarEnum_AP mp_state("mp_state", nullptr, MpState::DISABLED, MpState::DISABLED);
+ GVarPod_APS mp_join_on_startup("mp_join_on_startup", "Auto connect", false, false, false);
+ GVarPod_A mp_chat_auto_hide("mp_chat_auto_hide", "Auto hide chat", true);
+ GVarPod_A mp_hide_net_labels("mp_hide_net_labels", "Hide net labels", false);
+ GVarPod_A mp_hide_own_net_label("mp_hide_own_net_label", "Hide own net label", true);
+ GVarPod_A mp_pseudo_collisions("mp_pseudo_collisions", "Multiplayer collisions", false);
+ GVarStr_AP<200> mp_server_host("mp_server_host", "Server name", "", "");
+ GVarPod_A mp_server_port("mp_server_port", "Server port", 0);
+ GVarStr_APS<100> mp_server_password("mp_server_password", "Server password", "", "", "");
+ GVarStr_AP<100> mp_player_name("mp_player_name", "Nickname", "Player", "Player");
+ GVarStr_AP<100> mp_player_token("mp_player_token", "User Token", "", "");
+ GVarStr_A<100> mp_api_url("mp_api_url", "Online API URL", "http://api.rigsofrods.org");
+
+ // Diagnostic
+ GVarPod_A diag_auto_spawner_report("diag_auto_spawner_report", "AutoActorSpawnerReport", false);
+ GVarPod_A diag_camera("diag_camera", "Camera Debug", false);
+ GVarPod_A diag_trace_globals("diag_trace_globals", nullptr,
+ false); // Don't init to 'true', logger is not ready at startup
+ GVarPod_A diag_rig_log_node_import("diag_rig_log_node_import", "RigImporter_Debug_TraverseAndLogAllNodes", false);
+ GVarPod_A diag_rig_log_node_stats("diag_rig_log_node_stats", "RigImporter_PrintNodeStatsToLog", false);
+ GVarPod_A diag_rig_log_messages("diag_rig_log_messages", "RigImporter_PrintMessagesToLog", false);
+ GVarPod_A diag_collisions("diag_collisions", "Debug Collisions", false);
+ GVarPod_A diag_truck_mass("diag_truck_mass", "Debug Truck Mass", false);
+ GVarPod_A diag_envmap("diag_envmap", "EnvMapDebug", false);
+ GVarPod_A diag_videocameras("diag_videocameras", "VideoCameraDebug", false);
+ GVarStr_APS<100> diag_preset_terrain("diag_preset_terrain", "Preselected Terrain", "", "", "");
+ GVarStr_A<100> diag_preset_spawn_pos("diag_spawn_position", nullptr, "");
+ GVarStr_A<100> diag_preset_spawn_rot("diag_spawn_rotation", nullptr, "");
+ GVarStr_APS<100> diag_preset_vehicle("diag_preset_vehicle", "Preselected Truck", "", "", "");
+ GVarStr_A<100> diag_preset_veh_config("diag_preset_veh_config", "Preselected TruckConfig", "");
+ GVarPod_APS diag_preset_veh_enter("diag_preset_veh_enter", "Enter Preselected Truck", false, false, false);
+ GVarPod_A diag_log_console_echo("diag_log_console_echo", "Enable Ingame Console", false);
+ GVarPod_A diag_log_beam_break("diag_log_beam_break", "Beam Break Debug", false);
+ GVarPod_A diag_log_beam_deform("diag_log_beam_deform", "Beam Deform Debug", false);
+ GVarPod_A diag_log_beam_trigger("diag_log_beam_trigger", "Trigger Debug", false);
+ GVarPod_A diag_simple_materials("diag_simple_materials", "SimpleMaterials", false);
+ GVarPod_A diag_warning_texture("diag_warning_texture", "Warning texture", false);
+ GVarPod_A diag_hide_broken_beams("diag_hide_broken_beams", "Hide broken beams", false);
+ GVarPod_A diag_hide_beam_stress("diag_hide_beam_stress", "Hide beam stress", true);
+ GVarPod_A diag_hide_wheel_info("diag_hide_wheel_info", "Hide wheel info", true);
+ GVarPod_A diag_hide_wheels("diag_hide_wheels", "Hide wheels", false);
+ GVarPod_A diag_hide_nodes("diag_hide_nodes", "Hide nodes", false);
+ GVarPod_A diag_physics_dt("diag_physics_dt", "PhysicsTimeStep", 0.0005f);
+
+ // System (all paths are without ending slash!)
+ GVarStr_A<300> sys_process_dir("sys_process_dir", nullptr, "");
+ GVarStr_A<300> sys_user_dir("sys_user_dir", nullptr, "");
+ GVarStr_A<300> sys_config_dir("sys_config_dir", "Config Root", "");
+ GVarStr_A<300> sys_cache_dir("sys_cache_dir", "Cache Path", "");
+ GVarStr_A<300> sys_logs_dir("sys_logs_dir", "Log Path", "");
+ GVarStr_A<300> sys_resources_dir("sys_resources_dir", "Resources Path", "");
+ GVarStr_A<300> sys_profiler_dir("sys_profiler_dir", "Profiler output dir", "");
+ GVarStr_A<300> sys_savegames_dir("sys_savegames_dir", nullptr, "");
+ GVarStr_A<300> sys_screenshot_dir("sys_screenshot_dir", nullptr, "");
+
+ // Input - Output
+ GVarPod_A io_analog_smoothing("io_analog_smoothing", "Analog Input Smoothing", 1.f);
+ GVarPod_A io_analog_sensitivity("io_analog_sensitivity", "Analog Input Sensitivity", 1.f);
+ GVarPod_A io_ffb_enabled("io_ffb_enabled", "Force Feedback", false);
+ GVarPod_A io_ffb_camera_gain("io_ffb_camera_gain", "Force Feedback Camera", 0.f);
+ GVarPod_A io_ffb_center_gain("io_ffb_center_gain", "Force Feedback Centering", 0.f);
+ GVarPod_A io_ffb_master_gain("io_ffb_master_gain", "Force Feedback Gain", 0.f);
+ GVarPod_A io_ffb_stress_gain("io_ffb_stress_gain", "Force Feedback Stress", 0.f);
+ GVarEnum_AP io_input_grab_mode("io_input_grab_mode", "Input Grab", IoInputGrabMode::ALL,
+ IoInputGrabMode::ALL);
+ GVarPod_A io_arcade_controls("io_arcade_controls", "ArcadeControls", false);
+ GVarPod_A io_outgauge_mode("io_outgauge_mode", "OutGauge Mode", 0); // 0 = disabled, 1 = enabled
+ GVarStr_A<50> io_outgauge_ip("io_outgauge_ip", "OutGauge IP", "192.168.1.100");
+ GVarPod_A io_outgauge_port("io_outgauge_port", "OutGauge Port", 1337);
+ GVarPod_A io_outgauge_delay("io_outgauge_delay", "OutGauge Delay", 10.f);
+ GVarPod_A io_outgauge_id("io_outgauge_id", "OutGauge ID", 0);
+ GVarPod_A io_discord_rpc("io_discord_rpc", "Discord Rich Presence", true);
+
+ // Audio
+ GVarPod_A audio_master_volume("audio_master_volume", "Sound Volume", 1);
+ GVarPod_A audio_enable_creak("audio_enable_creak", "Creak Sound", false);
+ GVarStr_AP<100> audio_device_name("audio_device_name", "AudioDevice", "", "");
+ GVarPod_A audio_menu_music("audio_menu_music", "MainMenuMusic", false);
+
+ // Graphics
+ GVarEnum_AP gfx_flares_mode("gfx_flares_mode", "Lights", GfxFlaresMode::ALL_VEHICLES_ALL_LIGHTS,
+ GfxFlaresMode::ALL_VEHICLES_ALL_LIGHTS);
+ GVarEnum_AP gfx_shadow_type("gfx_shadow_type", "Shadow technique", GfxShadowType::PSSM,
+ GfxShadowType::PSSM);
+ GVarEnum_AP gfx_extcam_mode("gfx_extcam_mode", "External Camera Mode", GfxExtCamMode::PITCHING,
+ GfxExtCamMode::PITCHING);
+ GVarEnum_AP gfx_sky_mode("gfx_sky_mode", "Sky effects", GfxSkyMode::CAELUM, GfxSkyMode::CAELUM);
+ GVarEnum_AP gfx_texture_filter("gfx_texture_filter", "Texture Filtering", GfxTexFilter::ANISOTROPIC,
+ GfxTexFilter::ANISOTROPIC);
+ GVarEnum_AP gfx_vegetation_mode("gfx_vegetation_mode", "Vegetation", GfxVegetation::FULL,
+ GfxVegetation::FULL);
+ GVarEnum_AP gfx_water_mode("gfx_water_mode", "Water effects", GfxWaterMode::FULL_FAST,
+ GfxWaterMode::FULL_FAST);
+ GVarPod_A gfx_anisotropy("gfx_anisotropy", "Anisotropy", 4);
+ GVarPod_A gfx_water_waves("gfx_water_waves", "Waves", false);
+ GVarPod_A gfx_particles_mode("gfx_particles_mode", "Particles", 0);
+ GVarPod_A gfx_enable_videocams("gfx_enable_videocams", "gfx_enable_videocams", false);
+ GVarPod_A gfx_window_videocams("gfx_window_videocams", "UseVideocameraWindows", false);
+ GVarPod_APS gfx_surveymap_icons("gfx_surveymap_icons", "Overview map icons", true, true, true);
+ GVarPod_A gfx_declutter_map("gfx_declutter_map", "Declutter overview map", true);
+ GVarPod_A gfx_envmap_enabled("gfx_envmap_enabled", "Reflections", true);
+ GVarPod_A gfx_envmap_rate("gfx_envmap_rate", "ReflectionUpdateRate", 1);
+ GVarPod_A gfx_shadow_quality("gfx_shadow_quality", "Shadows Quality", 2);
+ GVarPod_A gfx_skidmarks_mode("gfx_skidmarks_mode", "Skidmarks", 0);
+ GVarPod_A gfx_sight_range("gfx_sight_range", "SightRange", 5000); // Previously either 2000 or 4500 (inconsistent)
+ GVarPod_A gfx_camera_height("gfx_camera_height", "Static camera height", 5);
+ GVarPod_APS gfx_fov_external("gfx_fov_external", "FOV External", 60, 60, 60);
+ GVarPod_APS gfx_fov_internal("gfx_fov_internal", "FOV Internal", 75, 75, 75);
+ GVarPod_A gfx_static_cam_fov_exp("gfx_static_cam_fov_exp", nullptr, 1.f);
+ GVarPod_A gfx_fixed_cam_tracking("gfx_fixed_cam_tracking", nullptr, false);
+ GVarPod_A gfx_fps_limit("gfx_fps_limit", "FPS-Limiter", 0); // 0 = unlimited
+ GVarPod_A gfx_speedo_digital("gfx_speedo_digital", "DigitalSpeedo", true);
+ GVarPod_A gfx_speedo_imperial("gfx_speedo_imperial", "gfx_speedo_imperial", false);
+ GVarPod_A gfx_flexbody_lods("gfx_flexbody_lods", "Flexbody_EnableLODs", false);
+ GVarPod_A gfx_flexbody_cache("gfx_flexbody_cache", "Flexbody_UseCache", false);
+ GVarPod_A gfx_reduce_shadows("gfx_reduce_shadows", "Shadow optimizations", true);
+ GVarPod_A gfx_enable_rtshaders("gfx_enable_rtshaders", "Use RTShader System", false);
+
+ // Instance management
+ void SetMainMenu(MainMenu *obj)
+ {
+ g_main_menu = obj;
+ }
+ void SetSimController(SimController *obj)
+ {
+ g_sim_controller = obj;
+ }
+ void SetSimTerrain(TerrainManager *obj)
+ {
+ g_sim_terrain = obj;
+ }
+ void SetCacheSystem(CacheSystem *obj)
+ {
+ g_cache_system = obj;
+ }
+
+ // Instance access
+ OgreSubsystem *GetOgreSubsystem()
+ {
+ return g_ogre_subsystem;
+ };
+ ContentManager *GetContentManager()
+ {
+ return &g_content_manager;
+ }
+ OverlayWrapper *GetOverlayWrapper()
+ {
+ return g_overlay_wrapper;
+ }
+ GUIManager *GetGuiManager()
+ {
+ return g_gui_manager;
+ }
+ Console *GetConsole()
+ {
+ return g_gui_manager->GetConsole();
+ }
+ InputEngine *GetInputEngine()
+ {
+ return g_input_engine;
+ }
+ CacheSystem *GetCacheSystem()
+ {
+ return g_cache_system;
+ }
+ MainMenu *GetMainMenu()
+ {
+ return g_main_menu;
+ }
+ SimController *GetSimController()
+ {
+ return g_sim_controller;
+ }
+ MumbleIntegration *GetMumble()
+ {
+ return g_mumble;
+ }
+ TerrainManager *GetSimTerrain()
+ {
+ return g_sim_terrain;
+ }
+
+ void StartOgreSubsystem()
+ {
+ g_ogre_subsystem = new OgreSubsystem();
+ if (g_ogre_subsystem == nullptr) { throw std::runtime_error("[RoR] Failed to create OgreSubsystem"); }
+
+ if (!g_ogre_subsystem->StartOgre("", "")) { throw std::runtime_error("[RoR] Failed to start up OGRE 3D engine"); }
+ }
+
+ void ShutdownOgreSubsystem()
+ {
+ assert(g_ogre_subsystem != nullptr && "ShutdownOgreSubsystem(): Ogre subsystem was not started");
+ delete g_ogre_subsystem;
+ g_ogre_subsystem = nullptr;
+ }
+
+ void CreateOverlayWrapper()
+ {
+ g_overlay_wrapper = new OverlayWrapper();
+ if (g_overlay_wrapper == nullptr) { throw std::runtime_error("[RoR] Failed to create OverlayWrapper"); }
+ }
+
+ void DestroyOverlayWrapper()
+ {
+ delete g_overlay_wrapper; // deleting nullptr does nothing
+ g_overlay_wrapper = nullptr;
+ }
+
+ void CreateGuiManagerIfNotExists()
+ {
+ if (g_gui_manager == nullptr) { g_gui_manager = new GUIManager(); }
+ }
+
+ void DeleteGuiManagerIfExists()
+ {
+ if (g_gui_manager != nullptr)
+ {
+ delete g_gui_manager;
+ g_gui_manager = nullptr;
+ }
+ }
+
+ void CreateInputEngine()
+ {
+ assert(g_input_engine == nullptr);
+ g_input_engine = new InputEngine();
+ }
+
+ void CheckAndCreateMumble()
+ {
+#ifdef USE_MUMBLE // The class is always forward-declared but only defined if USE_MUMBLE is defined
+ if (g_mumble == nullptr) g_mumble = new MumbleIntegration();
+#endif // USE_MUMBLE
+ }
-void ShutdownOgreSubsystem()
-{
- assert(g_ogre_subsystem != nullptr && "ShutdownOgreSubsystem(): Ogre subsystem was not started");
- delete g_ogre_subsystem;
- g_ogre_subsystem = nullptr;
-}
+ } // namespace App
-void CreateOverlayWrapper()
-{
- g_overlay_wrapper = new OverlayWrapper();
- if (g_overlay_wrapper == nullptr)
+ const char *EnumToStr(AppState v)
{
- throw std::runtime_error("[RoR] Failed to create OverlayWrapper");
+ switch (v)
+ {
+ case AppState::BOOTSTRAP: return "BOOTSTRAP";
+ case AppState::MAIN_MENU: return "MAIN_MENU";
+ case AppState::PRINT_HELP_EXIT: return "PRINT_HELP_EXIT";
+ case AppState::PRINT_VERSION_EXIT: return "PRINT_VERSION_EXIT";
+ case AppState::SHUTDOWN: return "SHUTDOWN";
+ case AppState::SIMULATION: return "SIMULATION";
+ default: return "~invalid~";
+ }
}
-}
-
-void DestroyOverlayWrapper()
-{
- delete g_overlay_wrapper; // deleting nullptr does nothing
- g_overlay_wrapper = nullptr;
-}
-void CreateGuiManagerIfNotExists()
-{
- if (g_gui_manager == nullptr)
+ const char *EnumToStr(MpState v)
{
- g_gui_manager = new GUIManager();
+ switch (v)
+ {
+ case MpState::DISABLED: return "DISABLED";
+ case MpState::CONNECTED: return "CONNECTED";
+ default: return "~invalid~";
+ }
}
-}
-void DeleteGuiManagerIfExists()
-{
- if (g_gui_manager != nullptr)
+ const char *EnumToStr(SimState v)
{
- delete g_gui_manager;
- g_gui_manager = nullptr;
+ switch (v)
+ {
+ case SimState::OFF: return "OFF";
+ case SimState::RUNNING: return "RUNNING";
+ case SimState::PAUSED: return "PAUSED";
+ case SimState::SELECTING: return "SELECTING";
+ case SimState::EDITOR_MODE: return "EDITOR_MODE";
+ default: return "~invalid~";
+ }
}
-}
-
-void CreateInputEngine()
-{
- assert(g_input_engine == nullptr);
- g_input_engine = new InputEngine();
-}
-
-void CheckAndCreateMumble()
-{
-#ifdef USE_MUMBLE // The class is always forward-declared but only defined if USE_MUMBLE is defined
- if (g_mumble == nullptr)
- g_mumble = new MumbleIntegration();
-#endif // USE_MUMBLE
-}
-
-} // namespace App
-
-const char* EnumToStr(AppState v)
-{
- switch (v)
+ const char *EnumToStr(SimGearboxMode v)
{
- case AppState::BOOTSTRAP: return "BOOTSTRAP";
- case AppState::MAIN_MENU: return "MAIN_MENU";
- case AppState::PRINT_HELP_EXIT: return "PRINT_HELP_EXIT";
- case AppState::PRINT_VERSION_EXIT: return "PRINT_VERSION_EXIT";
- case AppState::SHUTDOWN: return "SHUTDOWN";
- case AppState::SIMULATION: return "SIMULATION";
- default: return "~invalid~";
+ switch (v)
+ {
+ case SimGearboxMode::AUTO: return "AUTO";
+ case SimGearboxMode::SEMI_AUTO: return "SEMI_AUTO";
+ case SimGearboxMode::MANUAL: return "MANUAL";
+ case SimGearboxMode::MANUAL_STICK: return "MANUAL_STICK";
+ case SimGearboxMode::MANUAL_RANGES: return "MANUAL_RANGES";
+ default: return "~invalid~";
+ }
}
-}
-const char* EnumToStr(MpState v)
-{
- switch (v)
+ const char *EnumToStr(GfxFlaresMode v)
{
- case MpState::DISABLED: return "DISABLED";
- case MpState::CONNECTED: return "CONNECTED";
- default: return "~invalid~";
+ switch (v)
+ {
+ case GfxFlaresMode::NONE: return "NONE";
+ case GfxFlaresMode::NO_LIGHTSOURCES: return "NO_LIGHTSOURCES";
+ case GfxFlaresMode::CURR_VEHICLE_HEAD_ONLY: return "CURR_VEHICLE_HEAD_ONLY";
+ case GfxFlaresMode::ALL_VEHICLES_HEAD_ONLY: return "ALL_VEHICLES_HEAD_ONLY";
+ case GfxFlaresMode::ALL_VEHICLES_ALL_LIGHTS: return "ALL_VEHICLES_ALL_LIGHTS";
+ default: return "~invalid~";
+ }
}
-}
-const char* EnumToStr(SimState v)
-{
- switch (v)
+ const char *EnumToStr(GfxVegetation v)
{
- case SimState::OFF : return "OFF";
- case SimState::RUNNING : return "RUNNING";
- case SimState::PAUSED : return "PAUSED";
- case SimState::SELECTING : return "SELECTING";
- case SimState::EDITOR_MODE: return "EDITOR_MODE";
- default : return "~invalid~";
+ switch (v)
+ {
+ case GfxVegetation::NONE: return "NONE";
+ case GfxVegetation::x20PERC: return "20%";
+ case GfxVegetation::x50PERC: return "50%";
+ case GfxVegetation::FULL: return "FULL";
+ default: return "~invalid~";
+ }
}
-}
-const char* EnumToStr(SimGearboxMode v)
-{
- switch (v)
+ const char *EnumToStr(GfxWaterMode v)
{
- case SimGearboxMode::AUTO : return "AUTO";
- case SimGearboxMode::SEMI_AUTO : return "SEMI_AUTO";
- case SimGearboxMode::MANUAL : return "MANUAL";
- case SimGearboxMode::MANUAL_STICK : return "MANUAL_STICK";
- case SimGearboxMode::MANUAL_RANGES: return "MANUAL_RANGES";
- default : return "~invalid~";
+ switch (v)
+ {
+ case GfxWaterMode::NONE: return "NONE";
+ case GfxWaterMode::BASIC: return "BASIC";
+ case GfxWaterMode::REFLECT: return "REFLECT";
+ case GfxWaterMode::FULL_FAST: return "FULL_FAST";
+ case GfxWaterMode::FULL_HQ: return "FULL_HQ";
+ case GfxWaterMode::HYDRAX: return "HYDRAX";
+ default: return "~invalid~";
+ }
}
-}
-const char* EnumToStr(GfxFlaresMode v)
-{
- switch (v)
+ const char *EnumToStr(GfxSkyMode v)
{
- case GfxFlaresMode::NONE : return "NONE";
- case GfxFlaresMode::NO_LIGHTSOURCES : return "NO_LIGHTSOURCES";
- case GfxFlaresMode::CURR_VEHICLE_HEAD_ONLY : return "CURR_VEHICLE_HEAD_ONLY";
- case GfxFlaresMode::ALL_VEHICLES_HEAD_ONLY : return "ALL_VEHICLES_HEAD_ONLY";
- case GfxFlaresMode::ALL_VEHICLES_ALL_LIGHTS: return "ALL_VEHICLES_ALL_LIGHTS";
- default : return "~invalid~";
+ switch (v)
+ {
+ case GfxSkyMode::SANDSTORM: return "SANDSTORM";
+ case GfxSkyMode::CAELUM: return "CAELUM";
+ case GfxSkyMode::SKYX: return "SKYX";
+ default: return "~invalid~";
+ }
}
-}
-const char* EnumToStr(GfxVegetation v)
-{
- switch(v)
+ const char *EnumToStr(IoInputGrabMode v)
{
- case GfxVegetation::NONE : return "NONE";
- case GfxVegetation::x20PERC : return "20%";
- case GfxVegetation::x50PERC : return "50%";
- case GfxVegetation::FULL : return "FULL";
- default : return "~invalid~";
+ switch (v)
+ {
+ case IoInputGrabMode::NONE: return "NONE";
+ case IoInputGrabMode::ALL: return "ALL";
+ case IoInputGrabMode::DYNAMIC: return "DYNAMIC";
+ default: return "~invalid~";
+ }
}
-}
-const char* EnumToStr(GfxWaterMode v)
-{
- switch(v)
+ const char *EnumToStr(GfxShadowType v)
{
- case GfxWaterMode::NONE : return "NONE";
- case GfxWaterMode::BASIC : return "BASIC";
- case GfxWaterMode::REFLECT : return "REFLECT";
- case GfxWaterMode::FULL_FAST : return "FULL_FAST";
- case GfxWaterMode::FULL_HQ : return "FULL_HQ";
- case GfxWaterMode::HYDRAX : return "HYDRAX";
- default : return "~invalid~";
+ switch (v)
+ {
+ case GfxShadowType::NONE: return "NONE";
+ case GfxShadowType::PSSM: return "PSSM";
+ default: return "~invalid~";
+ }
}
-}
-const char* EnumToStr(GfxSkyMode v)
-{
- switch(v)
+ const char *EnumToStr(GfxTexFilter v)
{
- case GfxSkyMode::SANDSTORM: return "SANDSTORM";
- case GfxSkyMode::CAELUM : return "CAELUM";
- case GfxSkyMode::SKYX : return "SKYX";
- default : return "~invalid~";
+ switch (v)
+ {
+ case GfxTexFilter::NONE: return "NONE";
+ case GfxTexFilter::BILINEAR: return "BILINEAR";
+ case GfxTexFilter::TRILINEAR: return "TRILINEAR";
+ case GfxTexFilter::ANISOTROPIC: return "ANISOTROPIC";
+ default: return "~invalid~";
+ }
}
-}
-const char* EnumToStr(IoInputGrabMode v)
-{
- switch (v)
+ const char *EnumToStr(GfxExtCamMode v)
{
- case IoInputGrabMode::NONE : return "NONE";
- case IoInputGrabMode::ALL : return "ALL";
- case IoInputGrabMode::DYNAMIC: return "DYNAMIC";
- default : return "~invalid~";
+ switch (v)
+ {
+ case GfxExtCamMode::NONE: return "NONE";
+ case GfxExtCamMode::STATIC: return "STATIC";
+ case GfxExtCamMode::PITCHING: return "PITCHING";
+ default: return "~invalid~";
+ }
}
-}
-const char* EnumToStr(GfxShadowType v)
-{
- switch(v)
+ void Log(const char *msg)
{
- case GfxShadowType::NONE : return "NONE";
- case GfxShadowType::PSSM : return "PSSM";
- default : return "~invalid~";
+ Ogre::LogManager::getSingleton().logMessage(msg);
}
-}
-const char* EnumToStr(GfxTexFilter v)
-{
- switch (v)
+ void LogFormat(const char *format, ...)
{
- case GfxTexFilter::NONE : return "NONE";
- case GfxTexFilter::BILINEAR : return "BILINEAR";
- case GfxTexFilter::TRILINEAR : return "TRILINEAR";
- case GfxTexFilter::ANISOTROPIC: return "ANISOTROPIC";
- default : return "~invalid~";
- }
-}
+ char buffer[2000] = {};
-const char* EnumToStr(GfxExtCamMode v)
-{
- switch (v)
- {
- case GfxExtCamMode::NONE: return "NONE";
- case GfxExtCamMode::STATIC: return "STATIC";
- case GfxExtCamMode::PITCHING: return "PITCHING";
- default: return "~invalid~";
- }
-}
-
-void Log(const char* msg)
-{
- Ogre::LogManager::getSingleton().logMessage(msg);
-}
-
-void LogFormat(const char* format, ...)
-{
- char buffer[2000] = {};
-
- va_list args;
- va_start(args, format);
+ va_list args;
+ va_start(args, format);
vsprintf(buffer, format, args);
- va_end(args);
+ va_end(args);
- RoR::Log(buffer);
-}
+ RoR::Log(buffer);
+ }
-const char* GVarBase::LOG_FMT_S = "[RoR|GVar] %20s: %s(), new: \"%s\", old: \"%s\"";
-const char* GVarBase::LOG_FMT_D = "[RoR|GVar] %20s: %s(), new: \"%d\", old: \"%d\"";
-const char* GVarBase::LOG_FMT_F = "[RoR|GVar] %20s: %s(), new: \"%f\", old: \"%f\"";
+ const char *GVarBase::LOG_FMT_S = "[RoR|GVar] %20s: %s(), new: \"%s\", old: \"%s\"";
+ const char *GVarBase::LOG_FMT_D = "[RoR|GVar] %20s: %s(), new: \"%d\", old: \"%d\"";
+ const char *GVarBase::LOG_FMT_F = "[RoR|GVar] %20s: %s(), new: \"%f\", old: \"%f\"";
-void GVarBase::LogFormat(const char* format, ...) const
-{
- if (! App::diag_trace_globals.GetActive())
+ void GVarBase::LogFormat(const char *format, ...) const
{
- return;
- }
+ if (!App::diag_trace_globals.GetActive()) { return; }
- char buffer[2000] = {};
+ char buffer[2000] = {};
- va_list args;
- va_start(args, format);
+ va_list args;
+ va_start(args, format);
vsprintf(buffer, format, args);
- va_end(args);
+ va_end(args);
- RoR::Log(buffer);
-}
+ RoR::Log(buffer);
+ }
} // namespace RoR
diff --git a/source/main/Application.h b/source/main/Application.h
index 079b2c6d1a..104f681b10 100644
--- a/source/main/Application.h
+++ b/source/main/Application.h
@@ -17,7 +17,6 @@
along with Rigs of Rods. If not, see .
*/
-
/// @file Application.h
/// @author Petr Ohlidal
/// @date 05/2014
@@ -31,803 +30,969 @@
#include
#include
-namespace RoR {
-
-
-// ------------------------------------------------------------------------------------------------
-// Global definitions and enumerations
-// ------------------------------------------------------------------------------------------------
-
-
-enum class AppState
+namespace RoR
{
- BOOTSTRAP, ///< Initial state
- MAIN_MENU,
- SIMULATION,
- SHUTDOWN,
- PRINT_HELP_EXIT,
- PRINT_VERSION_EXIT,
-};
-const char* EnumToStr(AppState v);
-
-enum class MpState
-{
- DISABLED, ///< Not connected for whatever reason.
- CONNECTING,
- CONNECTED,
-};
-const char* EnumToStr(MpState v);
-enum class SimState
-{
- OFF,
- RUNNING,
- PAUSED,
- SELECTING, ///< The selector GUI window is displayed.
- EDITOR_MODE ///< Hacky, but whatever... added by Ulteq, 2016
-};
-const char* EnumToStr(SimState v);
-
-enum class SimGearboxMode
-{
- AUTO, ///< Automatic shift
- SEMI_AUTO, ///< Manual shift - Auto clutch
- MANUAL, ///< Fully Manual: sequential shift
- MANUAL_STICK, ///< Fully manual: stick shift
- MANUAL_RANGES, ///< Fully Manual: stick shift with ranges
-};
-const char* EnumToStr(SimGearboxMode v);
-
-enum class GfxShadowType
-{
- NONE,
- PSSM
-};
-const char* EnumToStr(GfxShadowType v);
-
-enum class GfxExtCamMode
-{
- NONE,
- STATIC,
- PITCHING,
-};
-const char* EnumToStr(GfxExtCamMode v);
-
-enum class GfxTexFilter
-{
- NONE,
- BILINEAR,
- TRILINEAR,
- ANISOTROPIC,
-};
-const char* EnumToStr(GfxTexFilter v);
-
-enum class GfxVegetation
-{
- NONE,
- x20PERC,
- x50PERC,
- FULL,
-};
-const char* EnumToStr(GfxVegetation v);
-
-enum class GfxFlaresMode
-{
- NONE, ///< None (fastest)
- NO_LIGHTSOURCES, ///< No light sources
- CURR_VEHICLE_HEAD_ONLY, ///< Only current vehicle, main lights
- ALL_VEHICLES_HEAD_ONLY, ///< All vehicles, main lights
- ALL_VEHICLES_ALL_LIGHTS, ///< All vehicles, all lights
-};
-const char* EnumToStr(GfxFlaresMode v);
-
-enum class GfxWaterMode
-{
- NONE, ///< None
- BASIC, ///< Basic (fastest)
- REFLECT, ///< Reflection
- FULL_FAST, ///< Reflection + refraction (speed optimized)
- FULL_HQ, ///< Reflection + refraction (quality optimized)
- HYDRAX, ///< HydraX
-};
-const char* EnumToStr(GfxWaterMode v);
-
-enum class GfxSkyMode
-{
- SANDSTORM, ///< Sandstorm (fastest)
- CAELUM, ///< Caelum (best looking, slower)
- SKYX, ///< SkyX (best looking, slower)
-};
-const char* EnumToStr(GfxSkyMode v);
+ // ------------------------------------------------------------------------------------------------
+ // Global definitions and enumerations
+ // ------------------------------------------------------------------------------------------------
-enum class IoInputGrabMode
-{
- NONE,
- ALL,
- DYNAMIC,
-};
-const char* EnumToStr(IoInputGrabMode v);
+ enum class AppState
+ {
+ BOOTSTRAP, ///< Initial state
+ MAIN_MENU,
+ SIMULATION,
+ SHUTDOWN,
+ PRINT_HELP_EXIT,
+ PRINT_VERSION_EXIT,
+ };
+ const char *EnumToStr(AppState v);
+
+ enum class MpState
+ {
+ DISABLED, ///< Not connected for whatever reason.
+ CONNECTING,
+ CONNECTED,
+ };
+ const char *EnumToStr(MpState v);
+ enum class SimState
+ {
+ OFF,
+ RUNNING,
+ PAUSED,
+ SELECTING, ///< The selector GUI window is displayed.
+ EDITOR_MODE ///< Hacky, but whatever... added by Ulteq, 2016
+ };
+ const char *EnumToStr(SimState v);
+
+ enum class SimGearboxMode
+ {
+ AUTO, ///< Automatic shift
+ SEMI_AUTO, ///< Manual shift - Auto clutch
+ MANUAL, ///< Fully Manual: sequential shift
+ MANUAL_STICK, ///< Fully manual: stick shift
+ MANUAL_RANGES, ///< Fully Manual: stick shift with ranges
+ };
+ const char *EnumToStr(SimGearboxMode v);
+
+ enum class GfxShadowType
+ {
+ NONE,
+ PSSM
+ };
+ const char *EnumToStr(GfxShadowType v);
-// ------------------------------------------------------------------------------------------------
-// Generic utilities
-// ------------------------------------------------------------------------------------------------
+ enum class GfxExtCamMode
+ {
+ NONE,
+ STATIC,
+ PITCHING,
+ };
+ const char *EnumToStr(GfxExtCamMode v);
+ enum class GfxTexFilter
+ {
+ NONE,
+ BILINEAR,
+ TRILINEAR,
+ ANISOTROPIC,
+ };
+ const char *EnumToStr(GfxTexFilter v);
+
+ enum class GfxVegetation
+ {
+ NONE,
+ x20PERC,
+ x50PERC,
+ FULL,
+ };
+ const char *EnumToStr(GfxVegetation v);
+
+ enum class GfxFlaresMode
+ {
+ NONE, ///< None (fastest)
+ NO_LIGHTSOURCES, ///< No light sources
+ CURR_VEHICLE_HEAD_ONLY, ///< Only current vehicle, main lights
+ ALL_VEHICLES_HEAD_ONLY, ///< All vehicles, main lights
+ ALL_VEHICLES_ALL_LIGHTS, ///< All vehicles, all lights
+ };
+ const char *EnumToStr(GfxFlaresMode v);
+
+ enum class GfxWaterMode
+ {
+ NONE, ///< None
+ BASIC, ///< Basic (fastest)
+ REFLECT, ///< Reflection
+ FULL_FAST, ///< Reflection + refraction (speed optimized)
+ FULL_HQ, ///< Reflection + refraction (quality optimized)
+ HYDRAX, ///< HydraX
+ };
+ const char *EnumToStr(GfxWaterMode v);
+
+ enum class GfxSkyMode
+ {
+ SANDSTORM, ///< Sandstorm (fastest)
+ CAELUM, ///< Caelum (best looking, slower)
+ SKYX, ///< SkyX (best looking, slower)
+ };
+ const char *EnumToStr(GfxSkyMode v);
-/// Wrapper for classic c-string (local buffer)
-/// Refresher: `strlen()` excludes '\0' terminator; `strncat()` Appends '\0' terminator
-/// @author Petr Ohlidal, 2017
-template class Str
-{
-public:
- // Constructors
- inline Str() { this->Clear(); }
- inline Str(Str const & src) { this->Assign(src); }
- inline Str(const char* src) { this->Assign(src); }
-
- // Reading
- inline const char* ToCStr() const { return m_buffer; }
- inline bool IsEmpty() const { return m_buffer[0] == '\0'; }
- inline char* GetBuffer() { return m_buffer; }
- inline size_t GetCapacity() const { return m_capacity; }
- inline int Compare(const char* str) const { return std::strncmp(m_buffer, str, L); }
- inline size_t GetLength() const { return std::strlen(m_buffer); }
-
- // Writing
- inline Str& Clear() { std::memset(m_buffer, 0, L); return *this; }
- inline Str& Assign(const char* src) { this->Clear(); this->Append(src); return *this; }
- inline Str& Append(const char* src) { std::strncat(m_buffer, src, (L - (this->GetLength() + 1))); return *this; }
- inline Str& Append(float f) { char buf[50]; std::snprintf(buf, 50, "%f", f); this->Append(buf); return *this; }
- inline Str& Append(int i) { char buf[50]; std::snprintf(buf, 50, "%d", i); this->Append(buf); return *this; }
- inline Str& Append(size_t z) { char buf[50]; std::snprintf(buf, 50, "%lu", static_cast(z)); this->Append(buf); return *this; }
- inline Str& Append(char c) { char buf[2] = {}; buf[0] = c; this->Append(buf); return *this; }
-
- // Operators
- inline operator const char*() const { return this->ToCStr(); }
- inline Str& operator= (const char* src) { return this->Assign(src); }
- inline Str& operator= (std::string const& str) { return this->Assign(str.c_str()); }
- inline Str& operator<< (const char* src) { return this->Append(src); }
- inline Str& operator<< (std::string const& str) { return this->Append(str.c_str()); }
- inline Str& operator<< (float f) { return this->Append(f); }
- inline Str& operator<< (int i) { return this->Append(i); }
- inline Str& operator<< (size_t z) { return this->Append(z); }
- inline Str& operator<< (char c) { return this->Append(c); }
- inline bool operator== (const char* other) const { return (this->Compare(other) == 0); }
-
-private:
- char m_buffer[L];
- const size_t m_capacity = L;
-};
-
-
-void Log(const char* msg); ///< The ultimate, application-wide logging function. Adds a line (any length) in 'RoR.log' file.
-void LogFormat(const char* format, ...); ///< Improved logging utility. Uses fixed 2Kb buffer.
-inline const char* BoolToStr(bool b) { return (b) ? "true" : "false"; }
-
-
-// ------------------------------------------------------------------------------------------------
-// Global variables
-// ------------------------------------------------------------------------------------------------
-
-
-/// A global variable - only for use in 'Application.(h/cpp)'
-///
-/// Concept: A GVar may contain 1-3 values:
-/// * [A] Active value = the value currently in effect. Each GVar has an active value.
-/// * [P] Pending value = the value to be set as active on earliest occasion (occasion may be anything from next frame to game restart)
-/// When no change is requested, value of Pending equals value of Active.
-/// Currently all GVars contain a pending value, but this design may be changed in the future.
-/// * [S] Stored value = The user-defined value to be persisted in config file.
-/// - When not present, Active is taken as Stored.
-/// - When present, it's unaffected by Active and only changes when user wants.
-/// GVar classes are named _A, _AP or _APS depending on which values they contain. NOTE this concept is not fully implemented yet.
-///
-/// API usage:
-/// SetPending(): new pending value, active stands. GVars without pending value don't have this function.
-/// SetActive(): direct update of active (+pending, if present) value
-/// ApplyPending(): updates active from pending. GVars without pending value don't have this function.
-/// ResetPending(): updates pending from active. GVars without pending value don't have this function.
-/// GetStored(): gets stored value, if present, or active value if not.
-/// SetStored(): direct update of stored value. GVars without stored value don't have this function.
-///
-/// Usage guidelines:
-/// * There are no definite rules how to use and update a GVar. Each one is specific.
-/// * Each GVar should have an Owner - a piece of code which checks for 'pending' values and Apply()-ies them.
-/// This may be any thread and any code location, but there should be just 1 per GVar.
-///
-/// Implementation notes:
-/// GVars use virtual functions (-> overhead: vtable per class, vptr per instance, function-ptr calls).
-/// The choice was 1) duplicate code in A/AP/APS classes 2) virtual inheritance. Rationale:
-/// * Call overhead is not considered a problem because virtuals only do non-frequent tasks:
-/// setting value (user action) and retrieving 'Stored' value (user console action/saving config on game exit).
-/// * Vtable pointer is not considered a problem because sane number of GVars is not more than ~250 (RoR has ~100 now).
-struct GVarBase
-{
-public:
- GVarBase(const char* name, const char* conf_name):
- name(name), conf_name(conf_name)
- {}
+ enum class IoInputGrabMode
+ {
+ NONE,
+ ALL,
+ DYNAMIC,
+ };
+ const char *EnumToStr(IoInputGrabMode v);
+
+ // ------------------------------------------------------------------------------------------------
+ // Generic utilities
+ // ------------------------------------------------------------------------------------------------
+
+ /// Wrapper for classic c-string (local buffer)
+ /// Refresher: `strlen()` excludes '\0' terminator; `strncat()` Appends '\0' terminator
+ /// @author Petr Ohlidal, 2017
+ template class Str
+ {
+ public:
+ // Constructors
+ inline Str()
+ {
+ this->Clear();
+ }
+ inline Str(Str const &src)
+ {
+ this->Assign(src);
+ }
+ inline Str(const char *src)
+ {
+ this->Assign(src);
+ }
- const char* const name;
- const char* const conf_name;
+ // Reading
+ inline const char *ToCStr() const
+ {
+ return m_buffer;
+ }
+ inline bool IsEmpty() const
+ {
+ return m_buffer[0] == '\0';
+ }
+ inline char *GetBuffer()
+ {
+ return m_buffer;
+ }
+ inline size_t GetCapacity() const
+ {
+ return m_capacity;
+ }
+ inline int Compare(const char *str) const
+ {
+ return std::strncmp(m_buffer, str, L);
+ }
+ inline size_t GetLength() const
+ {
+ return std::strlen(m_buffer);
+ }
-protected:
+ // Writing
+ inline Str &Clear()
+ {
+ std::memset(m_buffer, 0, L);
+ return *this;
+ }
+ inline Str &Assign(const char *src)
+ {
+ this->Clear();
+ this->Append(src);
+ return *this;
+ }
+ inline Str &Append(const char *src)
+ {
+ std::strncat(m_buffer, src, (L - (this->GetLength() + 1)));
+ return *this;
+ }
+ inline Str &Append(float f)
+ {
+ char buf[50];
+ std::snprintf(buf, 50, "%f", f);
+ this->Append(buf);
+ return *this;
+ }
+ inline Str &Append(int i)
+ {
+ char buf[50];
+ std::snprintf(buf, 50, "%d", i);
+ this->Append(buf);
+ return *this;
+ }
+ inline Str &Append(size_t z)
+ {
+ char buf[50];
+ std::snprintf(buf, 50, "%lu", static_cast(z));
+ this->Append(buf);
+ return *this;
+ }
+ inline Str &Append(char c)
+ {
+ char buf[2] = {};
+ buf[0] = c;
+ this->Append(buf);
+ return *this;
+ }
- static const char* LOG_FMT_S;
- static const char* LOG_FMT_D;
- static const char* LOG_FMT_F;
+ // Operators
+ inline operator const char *() const
+ {
+ return this->ToCStr();
+ }
+ inline Str &operator=(const char *src)
+ {
+ return this->Assign(src);
+ }
+ inline Str &operator=(std::string const &str)
+ {
+ return this->Assign(str.c_str());
+ }
+ inline Str &operator<<(const char *src)
+ {
+ return this->Append(src);
+ }
+ inline Str &operator<<(std::string const &str)
+ {
+ return this->Append(str.c_str());
+ }
+ inline Str &operator<<(float f)
+ {
+ return this->Append(f);
+ }
+ inline Str &operator<<(int i)
+ {
+ return this->Append(i);
+ }
+ inline Str &operator<<(size_t z)
+ {
+ return this->Append(z);
+ }
+ inline Str &operator<<(char c)
+ {
+ return this->Append(c);
+ }
+ inline bool operator==(const char *other) const
+ {
+ return (this->Compare(other) == 0);
+ }
- void LogFormat(const char* format, ...) const;
+ private:
+ char m_buffer[L];
+ const size_t m_capacity = L;
+ };
- // arg = the new value, cur = the old value
- inline void LogSetPending(const char* arg, const char* cur) const { this->LogFormat(LOG_FMT_S, name, "SetPending", arg, cur); }
- inline void LogSetPending(int arg, int cur) const { this->LogFormat(LOG_FMT_D, name, "SetPending", arg, cur); }
- inline void LogSetPending(float arg, float cur) const { this->LogFormat(LOG_FMT_F, name, "SetPending", arg, cur); }
- inline void LogSetPending(bool arg, bool cur) const { this->LogSetPending(BoolToStr(arg), BoolToStr(cur)); }
+ void Log(const char *msg); ///< The ultimate, application-wide logging function. Adds a line (any length) in 'RoR.log' file.
+ void LogFormat(const char *format, ...); ///< Improved logging utility. Uses fixed 2Kb buffer.
+ inline const char *BoolToStr(bool b)
+ {
+ return (b) ? "true" : "false";
+ }
- inline void LogSetActive(const char* arg, const char* cur) const { this->LogFormat(LOG_FMT_S, name, "SetActive", arg, cur); }
- inline void LogSetActive(int arg, int cur) const { this->LogFormat(LOG_FMT_D, name, "SetActive", arg, cur); }
- inline void LogSetActive(float arg, float cur) const { this->LogFormat(LOG_FMT_F, name, "SetActive", arg, cur); }
- inline void LogSetActive(bool arg, bool cur) const { this->LogSetActive(BoolToStr(arg), BoolToStr(cur)); }
+ // ------------------------------------------------------------------------------------------------
+ // Global variables
+ // ------------------------------------------------------------------------------------------------
+
+ /// A global variable - only for use in 'Application.(h/cpp)'
+ ///
+ /// Concept: A GVar may contain 1-3 values:
+ /// * [A] Active value = the value currently in effect. Each GVar has an active value.
+ /// * [P] Pending value = the value to be set as active on earliest occasion (occasion may be anything from next frame to
+ /// game restart)
+ /// When no change is requested, value of Pending equals value of Active.
+ /// Currently all GVars contain a pending value, but this design may be changed in the future.
+ /// * [S] Stored value = The user-defined value to be persisted in config file.
+ /// - When not present, Active is taken as Stored.
+ /// - When present, it's unaffected by Active and only changes when user wants.
+ /// GVar classes are named _A, _AP or _APS depending on which values they contain. NOTE this concept is not fully implemented
+ /// yet.
+ ///
+ /// API usage:
+ /// SetPending(): new pending value, active stands. GVars without pending value don't have this function.
+ /// SetActive(): direct update of active (+pending, if present) value
+ /// ApplyPending(): updates active from pending. GVars without pending value don't have this function.
+ /// ResetPending(): updates pending from active. GVars without pending value don't have this function.
+ /// GetStored(): gets stored value, if present, or active value if not.
+ /// SetStored(): direct update of stored value. GVars without stored value don't have this function.
+ ///
+ /// Usage guidelines:
+ /// * There are no definite rules how to use and update a GVar. Each one is specific.
+ /// * Each GVar should have an Owner - a piece of code which checks for 'pending' values and Apply()-ies them.
+ /// This may be any thread and any code location, but there should be just 1 per GVar.
+ ///
+ /// Implementation notes:
+ /// GVars use virtual functions (-> overhead: vtable per class, vptr per instance, function-ptr calls).
+ /// The choice was 1) duplicate code in A/AP/APS classes 2) virtual inheritance. Rationale:
+ /// * Call overhead is not considered a problem because virtuals only do non-frequent tasks:
+ /// setting value (user action) and retrieving 'Stored' value (user console action/saving config on game exit).
+ /// * Vtable pointer is not considered a problem because sane number of GVars is not more than ~250 (RoR has ~100 now).
+ struct GVarBase
+ {
+ public:
+ GVarBase(const char *name, const char *conf_name) : name(name), conf_name(conf_name)
+ {
+ }
- inline void LogSetStored(const char* arg, const char* cur) const { this->LogFormat(LOG_FMT_S, name, "SetStored", arg, cur); }
- inline void LogSetStored(int arg, int cur) const { this->LogFormat(LOG_FMT_D, name, "SetStored", arg, cur); }
- inline void LogSetStored(float arg, float cur) const { this->LogFormat(LOG_FMT_F, name, "SetStored", arg, cur); }
- inline void LogSetStored(bool arg, bool cur) const { this->LogSetStored(BoolToStr(arg), BoolToStr(cur)); }
+ const char *const name;
+ const char *const conf_name;
- // p = 'Pending' value, a = 'Active' value
- inline void LogApplyPending(const char* p, const char* a) const { this->LogFormat(LOG_FMT_S, name, "ApplyPending", p, a); }
- inline void LogApplyPending(int p, int a) const { this->LogFormat(LOG_FMT_D, name, "ApplyPending", p, a); }
- inline void LogApplyPending(float p, float a) const { this->LogFormat(LOG_FMT_F, name, "ApplyPending", p, a); }
- inline void LogApplyPending(bool p, bool a) const { this->LogApplyPending(BoolToStr(p), BoolToStr(a)); }
+ protected:
+ static const char *LOG_FMT_S;
+ static const char *LOG_FMT_D;
+ static const char *LOG_FMT_F;
- inline void LogResetPending(const char* p, const char* a) const { this->LogFormat(LOG_FMT_S, name, "ResetPending", a, p); }
- inline void LogResetPending(int p, int a) const { this->LogFormat(LOG_FMT_D, name, "ResetPending", a, p); }
- inline void LogResetPending(float p, float a) const { this->LogFormat(LOG_FMT_F, name, "ResetPending", a, p); }
- inline void LogResetPending(bool p, bool a) const { this->LogResetPending(BoolToStr(p), BoolToStr(a)); }
-};
+ void LogFormat(const char *format, ...) const;
+ // arg = the new value, cur = the old value
+ inline void LogSetPending(const char *arg, const char *cur) const
+ {
+ this->LogFormat(LOG_FMT_S, name, "SetPending", arg, cur);
+ }
+ inline void LogSetPending(int arg, int cur) const
+ {
+ this->LogFormat(LOG_FMT_D, name, "SetPending", arg, cur);
+ }
+ inline void LogSetPending(float arg, float cur) const
+ {
+ this->LogFormat(LOG_FMT_F, name, "SetPending", arg, cur);
+ }
+ inline void LogSetPending(bool arg, bool cur) const
+ {
+ this->LogSetPending(BoolToStr(arg), BoolToStr(cur));
+ }
-/// POD = Plain old data (C++ concept); _A = Has only 'Active' field
-template class GVarPod_A: public GVarBase
-{
-public:
- GVarPod_A(const char* name, const char* conf, T active_val):
- GVarBase(name, conf), m_value_active(active_val)
- {}
+ inline void LogSetActive(const char *arg, const char *cur) const
+ {
+ this->LogFormat(LOG_FMT_S, name, "SetActive", arg, cur);
+ }
+ inline void LogSetActive(int arg, int cur) const
+ {
+ this->LogFormat(LOG_FMT_D, name, "SetActive", arg, cur);
+ }
+ inline void LogSetActive(float arg, float cur) const
+ {
+ this->LogFormat(LOG_FMT_F, name, "SetActive", arg, cur);
+ }
+ inline void LogSetActive(bool arg, bool cur) const
+ {
+ this->LogSetActive(BoolToStr(arg), BoolToStr(cur));
+ }
- virtual ~GVarPod_A() {}
+ inline void LogSetStored(const char *arg, const char *cur) const
+ {
+ this->LogFormat(LOG_FMT_S, name, "SetStored", arg, cur);
+ }
+ inline void LogSetStored(int arg, int cur) const
+ {
+ this->LogFormat(LOG_FMT_D, name, "SetStored", arg, cur);
+ }
+ inline void LogSetStored(float arg, float cur) const
+ {
+ this->LogFormat(LOG_FMT_F, name, "SetStored", arg, cur);
+ }
+ inline void LogSetStored(bool arg, bool cur) const
+ {
+ this->LogSetStored(BoolToStr(arg), BoolToStr(cur));
+ }
- inline T GetActive() const
- {
- return m_value_active;
- }
+ // p = 'Pending' value, a = 'Active' value
+ inline void LogApplyPending(const char *p, const char *a) const
+ {
+ this->LogFormat(LOG_FMT_S, name, "ApplyPending", p, a);
+ }
+ inline void LogApplyPending(int p, int a) const
+ {
+ this->LogFormat(LOG_FMT_D, name, "ApplyPending", p, a);
+ }
+ inline void LogApplyPending(float p, float a) const
+ {
+ this->LogFormat(LOG_FMT_F, name, "ApplyPending", p, a);
+ }
+ inline void LogApplyPending(bool p, bool a) const
+ {
+ this->LogApplyPending(BoolToStr(p), BoolToStr(a));
+ }
- virtual T GetStored() const
- {
- return m_value_active;
- }
+ inline void LogResetPending(const char *p, const char *a) const
+ {
+ this->LogFormat(LOG_FMT_S, name, "ResetPending", a, p);
+ }
+ inline void LogResetPending(int p, int a) const
+ {
+ this->LogFormat(LOG_FMT_D, name, "ResetPending", a, p);
+ }
+ inline void LogResetPending(float p, float a) const
+ {
+ this->LogFormat(LOG_FMT_F, name, "ResetPending", a, p);
+ }
+ inline void LogResetPending(bool p, bool a) const
+ {
+ this->LogResetPending(BoolToStr(p), BoolToStr(a));
+ }
+ };
- virtual void SetActive(T val)
+ /// POD = Plain old data (C++ concept); _A = Has only 'Active' field
+ template class GVarPod_A : public GVarBase
{
- if (val != m_value_active)
+ public:
+ GVarPod_A(const char *name, const char *conf, T active_val) : GVarBase(name, conf), m_value_active(active_val)
{
- GVarBase::LogSetActive(val, m_value_active);
- m_value_active = val;
}
- }
-protected:
- T m_value_active;
-};
+ virtual ~GVarPod_A()
+ {
+ }
+ inline T GetActive() const
+ {
+ return m_value_active;
+ }
-/// POD = Plain old data (C++ concept); _AP = Has 'Active' and 'Pending' fields
-template class GVarPod_AP: public GVarPod_A
-{
-public:
- GVarPod_AP(const char* name, const char* conf, T active_val, T pending_val):
- GVarPod_A(name, conf, active_val), m_value_pending(pending_val)
- {}
+ virtual T GetStored() const
+ {
+ return m_value_active;
+ }
- virtual ~GVarPod_AP() {}
+ virtual void SetActive(T val)
+ {
+ if (val != m_value_active)
+ {
+ GVarBase::LogSetActive(val, m_value_active);
+ m_value_active = val;
+ }
+ }
- inline T GetPending() const
- {
- return m_value_pending;
- }
+ protected:
+ T m_value_active;
+ };
- void SetPending(T val)
+ /// POD = Plain old data (C++ concept); _AP = Has 'Active' and 'Pending' fields
+ template class GVarPod_AP : public GVarPod_A
{
- if (val != m_value_pending)
+ public:
+ GVarPod_AP(const char *name, const char *conf, T active_val, T pending_val)
+ : GVarPod_A(name, conf, active_val), m_value_pending(pending_val)
{
- GVarBase::LogSetPending(val, m_value_pending);
- m_value_pending = val;
}
- }
- virtual void SetActive(T val) override
- {
- if ((val != GVarPod_A::m_value_active) || (val != m_value_pending))
+ virtual ~GVarPod_AP()
{
- GVarBase::LogSetActive(val, GVarPod_A::m_value_active);
- GVarPod_A::m_value_active = val;
- m_value_pending = val;
}
- }
- void ApplyPending()
- {
- if (GVarPod_A::m_value_active != m_value_pending)
+ inline T GetPending() const
{
- GVarBase::LogApplyPending(m_value_pending, GVarPod_A::m_value_active);
- GVarPod_A::m_value_active = m_value_pending;
+ return m_value_pending;
}
- }
- void ResetPending()
- {
- if (GVarPod_A::m_value_active != m_value_pending)
+ void SetPending(T val)
{
- GVarBase::LogResetPending(m_value_pending, GVarPod_A::m_value_active);
- m_value_pending = GVarPod_A::m_value_active;
+ if (val != m_value_pending)
+ {
+ GVarBase::LogSetPending(val, m_value_pending);
+ m_value_pending = val;
+ }
}
- }
-
-protected:
- T m_value_pending;
-};
+ virtual void SetActive(T val) override
+ {
+ if ((val != GVarPod_A::m_value_active) || (val != m_value_pending))
+ {
+ GVarBase::LogSetActive(val, GVarPod_A::m_value_active);
+ GVarPod_A::m_value_active = val;
+ m_value_pending = val;
+ }
+ }
-/// POD = Plain old data (C++ concept); _APS = Has 'Active, Pending, Stored' fields
-template class GVarPod_APS: public GVarPod_AP
-{
-public:
- GVarPod_APS(const char* name, const char* conf, T active_val, T pending_val, T stored_val):
- GVarPod_AP(name, conf, active_val, pending_val), m_value_stored(stored_val)
- {}
+ void ApplyPending()
+ {
+ if (GVarPod_A::m_value_active != m_value_pending)
+ {
+ GVarBase::LogApplyPending(m_value_pending, GVarPod_A::m_value_active);
+ GVarPod_A::m_value_active = m_value_pending;
+ }
+ }
- virtual ~GVarPod_APS() {}
+ void ResetPending()
+ {
+ if (GVarPod_A::m_value_active != m_value_pending)
+ {
+ GVarBase::LogResetPending(m_value_pending, GVarPod_A::m_value_active);
+ m_value_pending = GVarPod_A::m_value_active;
+ }
+ }
- virtual T GetStored() const override
- {
- return m_value_stored;
- }
+ protected:
+ T m_value_pending;
+ };
- void SetStored(T val)
+ /// POD = Plain old data (C++ concept); _APS = Has 'Active, Pending, Stored' fields
+ template class GVarPod_APS : public GVarPod_AP
{
- if (val != m_value_stored)
+ public:
+ GVarPod_APS(const char *name, const char *conf, T active_val, T pending_val, T stored_val)
+ : GVarPod_AP(name, conf, active_val, pending_val), m_value_stored(stored_val)
{
- GVarBase::LogSetStored(val, m_value_stored);
- m_value_stored = val;
}
- }
-protected:
- T m_value_stored;
-};
+ virtual ~GVarPod_APS()
+ {
+ }
+ virtual T GetStored() const override
+ {
+ return m_value_stored;
+ }
-/// _A = Has only 'Active' field
-template class GVarEnum_A: public GVarBase
-{
-public:
- GVarEnum_A(const char* name, const char* conf, E active_val):
- GVarBase(name, conf), m_value_active(active_val)
- {}
+ void SetStored(T val)
+ {
+ if (val != m_value_stored)
+ {
+ GVarBase::LogSetStored(val, m_value_stored);
+ m_value_stored = val;
+ }
+ }
- virtual ~GVarEnum_A() {};
+ protected:
+ T m_value_stored;
+ };
- inline E GetActive() const
+ /// _A = Has only 'Active' field
+ template class GVarEnum_A : public GVarBase
{
- return m_value_active;
- }
-
- virtual void SetActive(E val)
- {
- if (val != m_value_active)
+ public:
+ GVarEnum_A(const char *name, const char *conf, E active_val) : GVarBase(name, conf), m_value_active(active_val)
{
- GVarBase::LogSetActive(EnumToStr(val), EnumToStr(m_value_active)); // Conversion needed
- m_value_active = val;
}
- }
-
-protected:
- E m_value_active;
-};
+ virtual ~GVarEnum_A(){};
-/// _AP = Has 'Active' and 'Pending' fields
-template class GVarEnum_AP: public GVarEnum_A
-{
-public:
- GVarEnum_AP(const char* name, const char* conf, E active_val, E pending_val):
- GVarEnum_A(name, conf, active_val), m_value_pending(pending_val)
- {}
+ inline E GetActive() const
+ {
+ return m_value_active;
+ }
- virtual ~GVarEnum_AP() {}
+ virtual void SetActive(E val)
+ {
+ if (val != m_value_active)
+ {
+ GVarBase::LogSetActive(EnumToStr(val), EnumToStr(m_value_active)); // Conversion needed
+ m_value_active = val;
+ }
+ }
- inline E GetPending()
- {
- return m_value_pending;
- }
+ protected:
+ E m_value_active;
+ };
- void SetPending(E val)
+ /// _AP = Has 'Active' and 'Pending' fields
+ template class GVarEnum_AP : public GVarEnum_A
{
- if (val != m_value_pending)
+ public:
+ GVarEnum_AP(const char *name, const char *conf, E active_val, E pending_val)
+ : GVarEnum_A(name, conf, active_val), m_value_pending(pending_val)
{
- GVarBase::LogSetPending(EnumToStr(val), EnumToStr(m_value_pending));
- m_value_pending = val;
}
- }
- virtual void SetActive(E val) override
- {
- if ((val != GVarEnum_A::m_value_active) || (val != m_value_pending))
+ virtual ~GVarEnum_AP()
{
- GVarBase::LogSetPending(EnumToStr(val), EnumToStr(GVarEnum_A::m_value_active));
- GVarEnum_A::m_value_active = val;
- m_value_pending = val;
}
- }
- void ApplyPending()
- {
- if (GVarEnum_A::m_value_active != m_value_pending)
+ inline E GetPending()
{
- GVarBase::LogApplyPending(EnumToStr(m_value_pending), EnumToStr(GVarEnum_A::m_value_active));
- GVarEnum_A::m_value_active = m_value_pending;
+ return m_value_pending;
}
- }
- void ResetPending()
- {
- if (GVarEnum_A::m_value_active != m_value_pending)
+ void SetPending(E val)
{
- GVarBase::LogResetPending(EnumToStr(m_value_pending), EnumToStr(GVarEnum_A::m_value_active));
- m_value_pending = GVarEnum_A::m_value_active;
+ if (val != m_value_pending)
+ {
+ GVarBase::LogSetPending(EnumToStr(val), EnumToStr(m_value_pending));
+ m_value_pending = val;
+ }
}
- }
-protected:
- E m_value_pending;
-};
+ virtual void SetActive(E val) override
+ {
+ if ((val != GVarEnum_A::m_value_active) || (val != m_value_pending))
+ {
+ GVarBase::LogSetPending(EnumToStr(val), EnumToStr(GVarEnum_A::m_value_active));
+ GVarEnum_A::m_value_active = val;
+ m_value_pending = val;
+ }
+ }
+ void ApplyPending()
+ {
+ if (GVarEnum_A::m_value_active != m_value_pending)
+ {
+ GVarBase::LogApplyPending(EnumToStr(m_value_pending), EnumToStr(GVarEnum_A::m_value_active));
+ GVarEnum_A