From aeb800283c51ecdea6bca4de0a449fa0b750f4f4 Mon Sep 17 00:00:00 2001 From: jerrrrycho Date: Sat, 4 Jul 2026 06:09:04 +0200 Subject: [PATCH] reformat: functions can be made static --- Console/PoKeys55.h | 2 +- McZapkie/MOVER.h | 6 ++-- McZapkie/Oerlikon_ESt.h | 2 +- McZapkie/hamulce.h | 16 +++++----- application/application.cpp | 4 +-- application/application.h | 22 ++++++------- application/drivermode.cpp | 2 +- application/drivermode.h | 4 +-- application/driveruilayer.h | 2 +- application/driveruipanels.h | 12 +++---- application/editormode.h | 6 ++-- application/editoruipanels.cpp | 2 +- application/editoruipanels.h | 2 +- application/uilayer.h | 2 +- audio/audio.cpp | 3 +- audio/audio.h | 4 +-- environment/moon.cpp | 3 +- environment/moon.h | 4 +-- environment/skydome.h | 8 ++--- environment/sun.h | 2 +- gl/query.h | 2 +- gl/shader.h | 2 +- imgui/imgui.h | 16 +++++----- input/command.cpp | 3 +- input/command.h | 6 ++-- input/drivermouseinput.h | 2 +- input/editormouseinput.h | 2 +- input/gamepadinput.h | 2 +- input/keyboardinput.cpp | 3 +- input/keyboardinput.h | 4 +-- launcher/scenery_list.h | 8 ++--- launcher/textures_scanner.h | 2 +- launcher/vehicle_picker.h | 6 ++-- model/AnimModel.cpp | 3 +- model/AnimModel.h | 2 +- model/Texture.h | 4 +-- network/backend/asio.h | 2 +- rendering/opengl33light.h | 2 +- rendering/opengl33renderer.h | 18 +++++------ rendering/openglrenderer.h | 4 +-- scene/scene.cpp | 3 +- scene/scene.h | 8 ++--- scene/sceneeditor.h | 10 +++--- scene/scenenodegroups.h | 2 +- scripting/PyInt.h | 16 +++++----- scripting/ladderlogic.cpp | 2 +- scripting/ladderlogic.h | 4 +-- simulation/simulation.h | 12 +++---- simulation/simulationenvironment.h | 2 +- simulation/simulationstateserializer.cpp | 3 +- simulation/simulationstateserializer.h | 40 ++++++++++++------------ simulation/simulationtime.cpp | 9 ++++-- simulation/simulationtime.h | 12 +++---- utilities/headtrack.h | 2 +- utilities/translation.h | 2 +- vehicle/Driver.cpp | 5 +-- vehicle/Driver.h | 6 ++-- vehicle/DynObj.h | 8 ++--- vehicle/Train.h | 3 +- widgets/map.h | 4 +-- widgets/vehicleparams.h | 2 +- world/Event.cpp | 3 +- world/Event.h | 4 +-- world/Track.cpp | 6 ++-- world/Track.h | 12 +++---- world/station.h | 2 +- 66 files changed, 199 insertions(+), 184 deletions(-) diff --git a/Console/PoKeys55.h b/Console/PoKeys55.h index a32cf529..292a9867 100644 --- a/Console/PoKeys55.h +++ b/Console/PoKeys55.h @@ -27,7 +27,7 @@ class TPoKeys55 TPoKeys55(); ~TPoKeys55(); bool Connect(); - void Close(); + static void Close(); bool Write(unsigned char c, unsigned char b3, unsigned char b4 = 0, unsigned char b5 = 0); bool Read(); bool ReadLoop(int i); diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index 3cff1b25..3c6a0c30 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -2569,9 +2569,9 @@ class TMoverParameters void LoadFIZ_DimmerList(std::string const &Input); void LoadFIZ_CompressorList(std::string const &Input); void LoadFIZ_PowerParamsDecode(TPowerParameters &Powerparameters, std::string Prefix, std::string const &Input); - TPowerType LoadFIZ_PowerDecode(std::string const &Power); - TPowerSource LoadFIZ_SourceDecode(std::string const &Source); - TEngineType LoadFIZ_EngineDecode(std::string const &Engine); + static TPowerType LoadFIZ_PowerDecode(std::string const &Power); + static TPowerSource LoadFIZ_SourceDecode(std::string const &Source); + static TEngineType LoadFIZ_EngineDecode(std::string const &Engine); bool readMPT0(std::string const &line); bool readMPT(std::string const &line); // Q 20160717 bool readMPTElectricSeries(std::string const &line); diff --git a/McZapkie/Oerlikon_ESt.h b/McZapkie/Oerlikon_ESt.h index b474a339..f485a45b 100644 --- a/McZapkie/Oerlikon_ESt.h +++ b/McZapkie/Oerlikon_ESt.h @@ -210,7 +210,7 @@ class TNESt3 : public TBrake { {} void Init( double PP, double HPP, double LPP, double BP, int BDF ) /*override*/; virtual double GetPF( double PP, double dt, double Vel ) /*override*/; // przeplyw miedzy komora wstepna i PG - void EStParams(double i_crc); // parametry charakterystyczne dla ESt + static void EStParams(double i_crc); // parametry charakterystyczne dla ESt virtual double GetCRP() /*override*/; void CheckState(double BCP, double &dV1); // glowny przyrzad rozrzadczy void CheckReleaser(double dt); // odluzniacz diff --git a/McZapkie/hamulce.h b/McZapkie/hamulce.h index a7af7a4e..7c9fefe4 100644 --- a/McZapkie/hamulce.h +++ b/McZapkie/hamulce.h @@ -582,7 +582,7 @@ class TESt : public TBrake double GetPF(double PP, double dt, double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG /// Sets ESt-specific characteristic parameters (placeholder; used by some variants). /// Characteristic value. - void EStParams(double i_crc); // parametry charakterystyczne dla ESt + static void EStParams(double i_crc); // parametry charakterystyczne dla ESt /// Returns the control reservoir (ZS) pressure. double GetCRP() /*override*/; /// @@ -877,7 +877,7 @@ class TCV1 : public TBrake /// In/out brake pipe flow correction. void CheckState(double BCP, double &dV1); /// Returns the ZS-filling slide valve opening factor for the given cylinder pressure. - double CVs(double BP); + static double CVs(double BP); /// Returns the ZP-filling slide valve opening factor for the given cylinder pressure. double BVs(double BCP); /// Vents valve, brake and control reservoirs to zero. @@ -1143,9 +1143,9 @@ class TFV4aM : public TDriverHandle /// Returns the brake pipe pressure target interpolated from BPT[] for the given handle position. /// /// Handle position. - double LPP_RP(double pos); + static double LPP_RP(double pos); /// Returns true if pos is within ±0.5 of i_pos (detent comparison). - bool EQ(double pos, double i_pos); + static bool EQ(double pos, double i_pos); public: /// Computes brake pipe flow for the FV4a/M handle (interpolated BPT, wave modelling, accelerator). @@ -1193,9 +1193,9 @@ class TMHZ_EN57 : public TDriverHandle static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 }; /// Returns the brake pipe pressure target for the given handle position (piecewise). - double LPP_RP(double pos); + static double LPP_RP(double pos); /// Returns true if pos is within ±0.5 of i_pos. - bool EQ(double pos, double i_pos); + static bool EQ(double pos, double i_pos); public: /// Computes brake pipe flow for MHZ_EN57 (covers handle positions -1..10 with EP/pneumatic mix). @@ -1249,7 +1249,7 @@ class TMHZ_K5P : public TDriverHandle static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 }; /// Returns true if pos is within ±0.5 of i_pos. - bool EQ(double pos, double i_pos); + static bool EQ(double pos, double i_pos); public: /// Computes brake pipe flow for the K5P 5-position handle (release / cut-off / brake / emergency). @@ -1302,7 +1302,7 @@ class TMHZ_6P : public TDriverHandle static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 }; /// Returns true if pos is within ±0.5 of i_pos. - bool EQ(double pos, double i_pos); + static bool EQ(double pos, double i_pos); public: /// Computes brake pipe flow for the 6P handle. diff --git a/application/application.cpp b/application/application.cpp index 150f0c30..3f98ac4c 100644 --- a/application/application.cpp +++ b/application/application.cpp @@ -960,7 +960,7 @@ GLFWmonitor *eu07_application::find_monitor(const std::string &str) const return nullptr; } -std::string eu07_application::describe_monitor(GLFWmonitor *monitor) const +std::string eu07_application::describe_monitor(GLFWmonitor *monitor) { std::string name(glfwGetMonitorName(monitor)); std::replace(std::begin(name), std::end(name), ' ', '_'); @@ -973,7 +973,7 @@ std::string eu07_application::describe_monitor(GLFWmonitor *monitor) const // private: -bool eu07_application::needs_ogl() const +bool eu07_application::needs_ogl() { return !Global.NvRenderer; } diff --git a/application/application.h b/application/application.h index 0c3a2c8a..e20954e9 100644 --- a/application/application.h +++ b/application/application.h @@ -66,14 +66,14 @@ public: set_progress( float Progress = 0.f, float Subtaskprogress = 0.f ); void set_tooltip( std::string const &Tooltip ); - void + static void set_cursor( int Mode ); void set_cursor_pos( double Horizontal, double Vertical ); void queue_screenshot(); // input handlers void on_key( int Key, int Scancode, int Action, int Mods ); - void on_char( unsigned int Char ); + static void on_char( unsigned int Char ); void on_cursor_pos( double Horizontal, double Vertical ); void on_mouse_button( int Button, int Action, int Mods ); void on_scroll( double Xoffset, double Yoffset ); @@ -83,9 +83,9 @@ public: GLFWwindow * window( int Windowindex = 0, bool visible = false, int width = 1, int height = 1, GLFWmonitor *monitor = nullptr, bool keep_ownership = true, bool share_ctx = true ); GLFWmonitor * find_monitor( const std::string &str ) const; - std::string describe_monitor( GLFWmonitor *monitor ) const; + static std::string describe_monitor( GLFWmonitor *monitor ); // generate network sync verification number - double + static double generate_sync(); void queue_quit(bool direct); @@ -99,19 +99,19 @@ private: using modeptr_array = std::array, static_cast( count_ )>; using mode_stack = std::stack; // methods - bool needs_ogl() const; + static bool needs_ogl(); void init_debug(); - void init_console(); + static void init_console(); void init_files(); - int init_settings( int Argc, char *Argv[] ); - int init_locale(); + static int init_settings( int Argc, char *Argv[] ); + static int init_locale(); int init_glfw(); void init_callbacks(); - int init_ogl(); + static int init_ogl(); int init_ui(); int init_gfx(); - int init_audio(); - int init_data(); + static int init_audio(); + static int init_data(); int init_modes(); bool init_network(); int run_crashgui(); diff --git a/application/drivermode.cpp b/application/drivermode.cpp index 98b80f04..fbd49b89 100644 --- a/application/drivermode.cpp +++ b/application/drivermode.cpp @@ -127,7 +127,7 @@ std::unordered_map> commandf {user_command::batterydisable, {user_command::batterytoggle, user_command::none}}, }; -std::pair driver_mode::drivermode_input::command_fallback(user_command const Command) const +std::pair driver_mode::drivermode_input::command_fallback(user_command const Command) { if (Command == user_command::none) diff --git a/application/drivermode.h b/application/drivermode.h index 43f45ad3..f82c6a1b 100644 --- a/application/drivermode.h +++ b/application/drivermode.h @@ -85,8 +85,8 @@ private: void poll(); std::string binding_hints( std::pair const &Commands ) const; - std::pair - command_fallback( user_command Command ) const; + static std::pair + command_fallback( user_command Command ); }; // methods diff --git a/application/driveruilayer.h b/application/driveruilayer.h index 026093f0..e23690b4 100644 --- a/application/driveruilayer.h +++ b/application/driveruilayer.h @@ -48,7 +48,7 @@ protected: private: // methods // sets visibility of the cursor - void + static void set_cursor( bool Visible ); // render() subclass details void diff --git a/application/driveruipanels.h b/application/driveruipanels.h index 0c9d25c2..9d47c1ad 100644 --- a/application/driveruipanels.h +++ b/application/driveruipanels.h @@ -84,23 +84,23 @@ private: void update_section_engine( std::vector &Output ); void update_section_ai( std::vector &Output ); void update_section_scantable( std::vector &Output ); - void update_section_scenario( std::vector &Output ); + static void update_section_scenario( std::vector &Output ); void update_section_eventqueue( std::vector &Output ); - void update_section_powergrid( std::vector &Output ); + static void update_section_powergrid( std::vector &Output ); void update_section_camera( std::vector &Output ); - void update_section_renderer( std::vector &Output ); + static void update_section_renderer( std::vector &Output ); #ifdef WITH_UART - void update_section_uart( std::vector &Output ); + static void update_section_uart( std::vector &Output ); #endif // section update helpers std::string update_vehicle_coupler( int Side ); std::string update_vehicle_brake() const; // renders provided lines, under specified collapsing header bool render_section( std::string const &Header, std::vector const &Lines ); - bool render_section( std::vector const &Lines ); + static bool render_section( std::vector const &Lines ); bool render_section_scenario(); bool render_section_eventqueue(); - bool render_section_settings(); + static bool render_section_settings(); bool render_section_developer(); // members std::array m_buffer; diff --git a/application/editormode.h b/application/editormode.h index 139aea7a..626283c0 100644 --- a/application/editormode.h +++ b/application/editormode.h @@ -186,9 +186,9 @@ class editor_mode : public application_mode bool m_stream_persist{true}; // save edited chunks to disk and load them back // hierarchy management - void add_to_hierarchy(scene::basic_node *node); - void remove_from_hierarchy(scene::basic_node *node); - scene::basic_node* find_in_hierarchy(const std::string &uuid_str); + static void add_to_hierarchy(scene::basic_node *node); + static void remove_from_hierarchy(scene::basic_node *node); + static scene::basic_node* find_in_hierarchy(const std::string &uuid_str); scene::basic_node* find_node_by_any(scene::basic_node *node_ptr, const std::string &uuid_str, const std::string &name); // clear history/redo pointers that reference the given node (prevent dangling pointers) diff --git a/application/editoruipanels.cpp b/application/editoruipanels.cpp index 7727a24f..3a661a26 100644 --- a/application/editoruipanels.cpp +++ b/application/editoruipanels.cpp @@ -599,7 +599,7 @@ const std::string *nodebank_panel::get_active_template() return m_selectedtemplate.get(); } -std::string nodebank_panel::generate_node_label(std::string Input) const +std::string nodebank_panel::generate_node_label(std::string Input) { auto tokenizer{cParser(Input)}; diff --git a/application/editoruipanels.h b/application/editoruipanels.h index 8b56a649..b1050c8b 100644 --- a/application/editoruipanels.h +++ b/application/editoruipanels.h @@ -93,7 +93,7 @@ class nodebank_panel : public ui_panel private: // methods: - std::string generate_node_label(std::string Input) const; + static std::string generate_node_label(std::string Input); // members: std::vector>> m_nodebank; char m_nodesearch[128]; diff --git a/application/uilayer.h b/application/uilayer.h index 6d4019c6..18e06c29 100644 --- a/application/uilayer.h +++ b/application/uilayer.h @@ -98,7 +98,7 @@ public: static void render_internal(); // begins new UI frame // (this is separate from render() to allow for debug GUI outside of proper UI framework) - void begin_ui_frame(); + static void begin_ui_frame(); static void begin_ui_frame_internal(); // static void set_cursor( int Mode ); diff --git a/audio/audio.cpp b/audio/audio.cpp index 0d86a47d..be61bbfb 100644 --- a/audio/audio.cpp +++ b/audio/audio.cpp @@ -182,7 +182,8 @@ buffer_manager::find_buffer( std::string const &Buffername ) const { } std::string -buffer_manager::find_file( std::string const &Filename ) const { +buffer_manager::find_file( std::string const &Filename ) +{ auto const lookup { FileExists( diff --git a/audio/audio.h b/audio/audio.h index 4dd65436..184c6d18 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -69,8 +69,8 @@ private: buffer_handle find_buffer( std::string const &Buffername ) const; // checks whether specified file exists. returns: name of the located file, or empty string. - std::string - find_file( std::string const &Filename ) const; + static std::string + find_file( std::string const &Filename ); // members buffer_sequence m_buffers; index_map m_buffermappings; diff --git a/environment/moon.cpp b/environment/moon.cpp index 550c56e0..15a16279 100644 --- a/environment/moon.cpp +++ b/environment/moon.cpp @@ -306,7 +306,8 @@ cMoon::phase() { // normalize values to range 0...1 float -cMoon::normalize( const float Value ) const { +cMoon::normalize( const float Value ) +{ float value = Value - floor( Value ); if( value < 0.f ) { ++value; } diff --git a/environment/moon.h b/environment/moon.h index d60bbded..7fa2a2fd 100644 --- a/environment/moon.h +++ b/environment/moon.h @@ -12,7 +12,7 @@ public: // methods: void init(); void update( bool Includephase = false ); - void render(); + static void render(); // returns vector pointing at the sun glm::vec3 getDirection() const; // returns current elevation above horizon @@ -50,7 +50,7 @@ protected: void irradiance(); void phase(); // helper, normalize values to range 0...1 - float normalize(float Value ) const; + static float normalize(float Value ); // members: diff --git a/environment/skydome.h b/environment/skydome.h index 54826f56..c5528a12 100644 --- a/environment/skydome.h +++ b/environment/skydome.h @@ -59,9 +59,9 @@ private: static float m_zenithymatrix[ 3 ][ 4 ]; // coloring - void GetPerez( float *Perez, float Distribution[ 5 ][ 2 ], float Turbidity ); - float GetZenith( float Zenithmatrix[ 3 ][ 4 ], float Theta, float Turbidity ); - float PerezFunctionO1( float Perezcoeffs[ 5 ], float Thetasun, float Zenithval ); - float PerezFunctionO2( float Perezcoeffs[ 5 ], float Icostheta, float Gamma, float Cosgamma2, float Zenithval ); + static void GetPerez( float *Perez, float Distribution[ 5 ][ 2 ], float Turbidity ); + static float GetZenith( float Zenithmatrix[ 3 ][ 4 ], float Theta, float Turbidity ); + static float PerezFunctionO1( float Perezcoeffs[ 5 ], float Thetasun, float Zenithval ); + static float PerezFunctionO2( float Perezcoeffs[ 5 ], float Icostheta, float Gamma, float Cosgamma2, float Zenithval ); }; diff --git a/environment/sun.h b/environment/sun.h index 8161968c..5c0ded03 100644 --- a/environment/sun.h +++ b/environment/sun.h @@ -14,7 +14,7 @@ public: // methods: void init(); void update(); - void render(); + static void render(); /* // returns location of the sun in the 3d scene glm::vec3 getPosition(); diff --git a/gl/query.h b/gl/query.h index 83114092..cc293eb5 100644 --- a/gl/query.h +++ b/gl/query.h @@ -22,7 +22,7 @@ private: thread_local static query* active_queries[6]; protected: - GLenum glenum_target(targets target); + static GLenum glenum_target(targets target); public: query(targets target); diff --git a/gl/shader.h b/gl/shader.h index 16e54f27..9434a48d 100644 --- a/gl/shader.h +++ b/gl/shader.h @@ -73,7 +73,7 @@ namespace gl void parse_texture_entries(std::string &str); void parse_param_entries(std::string &str); - std::string read_file(const std::string &filename); + static std::string read_file(const std::string &filename); static std::unordered_map components_mapping; static std::unordered_map defaultparams_mapping; diff --git a/imgui/imgui.h b/imgui/imgui.h index 89056699..e0800e35 100644 --- a/imgui/imgui.h +++ b/imgui/imgui.h @@ -2148,14 +2148,14 @@ struct ImFontAtlas // Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list) // NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create UTF-8 string literal using the u8"Hello world" syntax. See FAQ for details. // NB: Consider using ImFontGlyphRangesBuilder to build glyph ranges from textual data. - IMGUI_API const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin - IMGUI_API const ImWchar* GetGlyphRangesKorean(); // Default + Korean characters - IMGUI_API const ImWchar* GetGlyphRangesJapanese(); // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs - IMGUI_API const ImWchar* GetGlyphRangesChineseFull(); // Default + Half-Width + Japanese Hiragana/Katakana + full set of about 21000 CJK Unified Ideographs - IMGUI_API const ImWchar* GetGlyphRangesChineseSimplifiedCommon();// Default + Half-Width + Japanese Hiragana/Katakana + set of 2500 CJK Unified Ideographs for common simplified Chinese - IMGUI_API const ImWchar* GetGlyphRangesCyrillic(); // Default + about 400 Cyrillic characters - IMGUI_API const ImWchar* GetGlyphRangesThai(); // Default + Thai characters - IMGUI_API const ImWchar* GetGlyphRangesVietnamese(); // Default + Vietnamese characters + IMGUI_API static const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin + IMGUI_API static const ImWchar* GetGlyphRangesKorean(); // Default + Korean characters + IMGUI_API static const ImWchar* GetGlyphRangesJapanese(); // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs + IMGUI_API static const ImWchar* GetGlyphRangesChineseFull(); // Default + Half-Width + Japanese Hiragana/Katakana + full set of about 21000 CJK Unified Ideographs + IMGUI_API static const ImWchar* GetGlyphRangesChineseSimplifiedCommon();// Default + Half-Width + Japanese Hiragana/Katakana + set of 2500 CJK Unified Ideographs for common simplified Chinese + IMGUI_API static const ImWchar* GetGlyphRangesCyrillic(); // Default + about 400 Cyrillic characters + IMGUI_API static const ImWchar* GetGlyphRangesThai(); // Default + Thai characters + IMGUI_API static const ImWchar* GetGlyphRangesVietnamese(); // Default + Vietnamese characters //------------------------------------------- // [BETA] Custom Rectangles/Glyphs API diff --git a/input/command.cpp b/input/command.cpp index 280bab6a..bd5f5c15 100644 --- a/input/command.cpp +++ b/input/command.cpp @@ -877,7 +877,8 @@ void command_queue::push_commands(const commands_map &commands) { void command_relay::post(user_command const Command, double const Param1, double const Param2, - int const Action, uint16_t Recipient, glm::vec3 Position, const std::string *Payload) const { + int const Action, uint16_t Recipient, glm::vec3 Position, const std::string *Payload) +{ auto const &command = simulation::Commands_descriptions[ static_cast( Command ) ]; diff --git a/input/command.h b/input/command.h index d55b460a..f91c4ff2 100644 --- a/input/command.h +++ b/input/command.h @@ -468,7 +468,7 @@ public: void update(); // checks if given command must be scheduled on server - bool + static bool is_network_target(uint32_t Recipient); // pops commands from intercept queue @@ -527,9 +527,9 @@ class command_relay { public: // methods // posts specified command for the specified recipient - void + static void post(user_command Command, double Param1, double Param2, - int Action, uint16_t Recipient, glm::vec3 Position = glm::vec3(0.0f) , const std::string *Payload = nullptr) const; + int Action, uint16_t Recipient, glm::vec3 Position = glm::vec3(0.0f) , const std::string *Payload = nullptr); private: // types // members diff --git a/input/drivermouseinput.h b/input/drivermouseinput.h index 2ff41153..a6f7fe49 100644 --- a/input/drivermouseinput.h +++ b/input/drivermouseinput.h @@ -89,7 +89,7 @@ private: void default_bindings(); // potentially replaces supplied command with a more relevant one - user_command + static user_command adjust_command( user_command Command ); // members diff --git a/input/editormouseinput.h b/input/editormouseinput.h index 3a998448..ffb441b0 100644 --- a/input/editormouseinput.h +++ b/input/editormouseinput.h @@ -18,7 +18,7 @@ public: editormouse_input() = default; // methods - bool + static bool init(); void position( double Horizontal, double Vertical ); diff --git a/input/gamepadinput.h b/input/gamepadinput.h index 160971ce..251ef75a 100644 --- a/input/gamepadinput.h +++ b/input/gamepadinput.h @@ -77,7 +77,7 @@ private: using inputaxis_sequence = std::vector; // methods bool recall_bindings(); - void bind( std::vector< std::reference_wrapper > &Targets, cParser &Input, std::unordered_map const &Translator, std::string Point ); + static void bind( std::vector< std::reference_wrapper > &Targets, cParser &Input, std::unordered_map const &Translator, std::string Point ); void on_button( int Button, int Action ); void process_axes(); diff --git a/input/keyboardinput.cpp b/input/keyboardinput.cpp index ecb7fca3..ea869eb8 100644 --- a/input/keyboardinput.cpp +++ b/input/keyboardinput.cpp @@ -323,7 +323,8 @@ keyboard_input::key( int const Key, int const Action ) { } int -keyboard_input::key( int const Key ) const { +keyboard_input::key( int const Key ) +{ return input::keys[ Key ]; } diff --git a/input/keyboardinput.h b/input/keyboardinput.h index 644ada82..b4806710 100644 --- a/input/keyboardinput.h +++ b/input/keyboardinput.h @@ -51,8 +51,8 @@ public: init() { return true; } bool key( int Key, int Action ); - int - key( int Key ) const; + static int + key( int Key ); void poll(); user_command const diff --git a/launcher/scenery_list.h b/launcher/scenery_list.h index 957f1b5e..e34583c3 100644 --- a/launcher/scenery_list.h +++ b/launcher/scenery_list.h @@ -61,12 +61,12 @@ private: void draw_launch_box(); void draw_trainset_box(); bool launch_simulation(); - void add_replace_entry(const trainset_desc &trainset); - void draw_summary_tooltip(const dynamic_desc &dyn_desc); + static void add_replace_entry(const trainset_desc &trainset); + static void draw_summary_tooltip(const dynamic_desc &dyn_desc); - void open_link(const std::string &link); + static void open_link(const std::string &link); void draw_trainset(trainset_desc &trainset); - void draw_droptarget(trainset_desc &trainset, int position); + static void draw_droptarget(trainset_desc &trainset, int position); void purge_selected_trainset(); }; } // namespace ui diff --git a/launcher/textures_scanner.h b/launcher/textures_scanner.h index affa0b94..a4d87439 100644 --- a/launcher/textures_scanner.h +++ b/launcher/textures_scanner.h @@ -87,7 +87,7 @@ private: void parse_texture_rule(const std::string &target, const std::string ¶m); void parse_texture_info(const std::string &target, const std::string ¶m, std::shared_ptr meta); - std::shared_ptr parse_meta(const std::string &str); + static std::shared_ptr parse_meta(const std::string &str); std::shared_ptr get_vehicle(const std::string &name); vehicle_type ctx_type = vehicle_type::unknown; diff --git a/launcher/vehicle_picker.h b/launcher/vehicle_picker.h index ad6e6dc2..6ef8c6f1 100644 --- a/launcher/vehicle_picker.h +++ b/launcher/vehicle_picker.h @@ -14,7 +14,7 @@ class vehiclepicker_panel : public ui_panel void render_contents() override; private: - bool selectable_image(const char *desc, bool selected, const deferred_image *image, const skin_set *pickable = nullptr); + static bool selectable_image(const char *desc, bool selected, const deferred_image *image, const skin_set *pickable = nullptr); vehicle_type selected_type = vehicle_type::none; std::shared_ptr selected_vehicle; @@ -59,7 +59,7 @@ private: int number; }; - std::vector parse_search_query(const std::string &str); - bool skin_filter(const skin_set *skin, std::vector &info_list); + static std::vector parse_search_query(const std::string &str); + static bool skin_filter(const skin_set *skin, std::vector &info_list); }; } // namespace ui diff --git a/model/AnimModel.cpp b/model/AnimModel.cpp index 5db9c00b..b8b0c82d 100644 --- a/model/AnimModel.cpp +++ b/model/AnimModel.cpp @@ -267,7 +267,8 @@ bool TAnimModel::Init(std::string const &asName, std::string const &asReplacable } bool -TAnimModel::is_keyword( std::string const &Token ) const { +TAnimModel::is_keyword( std::string const &Token ) +{ return Token == "endmodel" || Token == "lights" diff --git a/model/AnimModel.h b/model/AnimModel.h index f6f78dfc..19d40945 100644 --- a/model/AnimModel.h +++ b/model/AnimModel.h @@ -171,7 +171,7 @@ public: // export() subclass details, sends basic content of the class in legacy (text) format to provided stream void export_as_text_( std::ostream &Output ) const; // checks whether provided token is a legacy (text) format keyword - bool is_keyword( std::string const &Token ) const; + static bool is_keyword( std::string const &Token ); // members std::shared_ptr pRoot; // pojemniki sterujące, tylko dla aniomowanych submodeli diff --git a/model/Texture.h b/model/Texture.h index c09189b8..1f5fd654 100644 --- a/model/Texture.h +++ b/model/Texture.h @@ -100,7 +100,7 @@ struct opengl_texture : public ITexture { public: // methods void make_request(); - void load_PNG(); + static void load_PNG(); void load_DDS(); void load_KTX(); void load_TEX(); @@ -143,7 +143,7 @@ public: ~texture_manager() { delete_textures(); } // activates specified texture unit - void + static void unit( GLint Textureunit ); // creates texture object out of data stored in specified file texture_handle diff --git a/network/backend/asio.h b/network/backend/asio.h index f7f250fb..f2079a9d 100644 --- a/network/backend/asio.h +++ b/network/backend/asio.h @@ -32,7 +32,7 @@ namespace network::tcp std::string m_header_buffer; std::string m_body_buffer; - void write_message(const message &msg, std::ostream &stream); + static void write_message(const message &msg, std::ostream &stream); void send_data(std::shared_ptr buffer); void read_header(); void handle_header(const asio::error_code &err, size_t bytes_transferred); diff --git a/rendering/opengl33light.h b/rendering/opengl33light.h index b034a927..0daddb9e 100644 --- a/rendering/opengl33light.h +++ b/rendering/opengl33light.h @@ -18,7 +18,7 @@ struct opengl33_light : public basic_light { float factor; void apply_intensity(float Factor = 1.0f); - void apply_angle(); + static void apply_angle(); opengl33_light &operator=(basic_light const &Right) { basic_light::operator=(Right); diff --git a/rendering/opengl33renderer.h b/rendering/opengl33renderer.h index 46794b23..82814a46 100644 --- a/rendering/opengl33renderer.h +++ b/rendering/opengl33renderer.h @@ -254,15 +254,15 @@ class opengl33_renderer : public gfx_renderer { typedef std::vector opengllight_array; // methods - std::unique_ptr make_shader(std::string v, std::string f); + static std::unique_ptr make_shader(std::string v, std::string f); bool Init_caps(); void setup_pass(viewport_config &Viewport, renderpass_config &Config, rendermode Mode, float Znear = 0.f, float Zfar = 1.f, bool Ignoredebug = false); void setup_matrices(); void setup_drawing(bool Alpha = false); - void setup_shadow_unbind_map(); + static void setup_shadow_unbind_map(); void setup_shadow_bind_map(); void setup_shadow_color( glm::vec4 const &Shadowcolor ); - void setup_env_map(gl::cubemap *tex); + static void setup_env_map(gl::cubemap *tex); void setup_environment_light(TEnvironmentType Environment = e_flat); void setup_sunlight_intensity( float Factor = 1.f); // runs jobs needed to generate graphics for specified render pass @@ -310,8 +310,8 @@ class opengl33_renderer : public gfx_renderer { bool Render_Alpha(TModel3d *Model, material_data const *Material, float Squaredistance); void Render_Alpha(TSubModel *Submodel); void Update_Lights(light_array &Lights); - glm::vec3 pick_color(std::size_t Index); - std::size_t pick_index(glm::ivec3 const &Color); + static glm::vec3 pick_color(std::size_t Index); + static std::size_t pick_index(glm::ivec3 const &Color); bool init_viewport(viewport_config &vp); @@ -394,10 +394,10 @@ class opengl33_renderer : public gfx_renderer { double m_precipitationrotation; - glm::mat4 perspective_projection_raw(float fovy, float aspect, float znear, float zfar); - glm::mat4 perspective_projection(const viewport_proj_config &c, float n, float f, glm::mat4 &frustum); - glm::mat4 ortho_projection(float left, float right, float bottom, float top, float z_near, float z_far); - glm::mat4 ortho_frustumtest_projection(float left, float right, float bottom, float top, float z_near, float z_far); + static glm::mat4 perspective_projection_raw(float fovy, float aspect, float znear, float zfar); + static glm::mat4 perspective_projection(const viewport_proj_config &c, float n, float f, glm::mat4 &frustum); + static glm::mat4 ortho_projection(float left, float right, float bottom, float top, float z_near, float z_far); + static glm::mat4 ortho_frustumtest_projection(float left, float right, float bottom, float top, float z_near, float z_far); std::vector> m_control_pick_requests; std::vector> m_node_pick_requests; diff --git a/rendering/openglrenderer.h b/rendering/openglrenderer.h index 8096b16b..25c17ddb 100644 --- a/rendering/openglrenderer.h +++ b/rendering/openglrenderer.h @@ -273,9 +273,9 @@ private: Update_Lights( light_array &Lights ); bool Init_caps(); - glm::vec3 + static glm::vec3 pick_color( std::size_t Index ); - std::size_t + static std::size_t pick_index( glm::ivec3 const &Color ); // members diff --git a/scene/scene.cpp b/scene/scene.cpp index ee9abdec..baabc19c 100644 --- a/scene/scene.cpp +++ b/scene/scene.cpp @@ -1093,7 +1093,8 @@ basic_region::update_traction( TDynamicObject *Vehicle, int const Pantographinde // checks whether specified file is a valid region data file bool -basic_region::is_scene( std::string const &Scenariofile ) const { +basic_region::is_scene( std::string const &Scenariofile ) +{ auto filename { Scenariofile }; while( filename[ 0 ] == '$' ) { diff --git a/scene/scene.h b/scene/scene.h index 3b87b407..d12852ef 100644 --- a/scene/scene.h +++ b/scene/scene.h @@ -213,7 +213,7 @@ public: using eventlauncher_sequence = std::vector; using memorycell_sequence = std::vector; // methods - void + static void launch_event(TEventLauncher *Launcher, bool local_only); void enclose_area( basic_node *Node ); @@ -387,8 +387,8 @@ public: void update_sounds(); // checks whether specified file is a valid region data file - bool - is_scene( std::string const &Scenariofile ) const; + static bool + is_scene( std::string const &Scenariofile ); // stores content of the class in file with specified name void serialize( std::string const &Scenariofile ) const; @@ -475,7 +475,7 @@ public: // methods // checks whether specified point is within boundaries of the region - bool + static bool point_inside( glm::dvec3 const &Location ); // legacy method, trims provided shape to fit into a section. adds trimmed part at the end of provided list, returns true if changes were made static diff --git a/scene/sceneeditor.h b/scene/sceneeditor.h index 5fe4d295..2d59585e 100644 --- a/scene/sceneeditor.h +++ b/scene/sceneeditor.h @@ -45,17 +45,17 @@ private: translate_node( basic_node *Node, glm::dvec3 const &Location ); void translate_node( basic_node *Node, float Offset ); - void + static void translate_instance( TAnimModel *Instance, glm::dvec3 const &Location ); - void + static void translate_instance( TAnimModel *Instance, float Offset ); - void + static void translate_memorycell( TMemCell *Memorycell, glm::dvec3 const &Location ); - void + static void translate_memorycell( TMemCell *Memorycell, float Offset ); void rotate_node( basic_node *Node, glm::vec3 const &Angle ); - void + static void rotate_instance( TAnimModel *Instance, glm::vec3 const &Angle ); }; diff --git a/scene/scenenodegroups.h b/scene/scenenodegroups.h index c8ab2631..c591f9f3 100644 --- a/scene/scenenodegroups.h +++ b/scene/scenenodegroups.h @@ -64,7 +64,7 @@ private: // creates handle for a new group group_handle create_handle(); - bool + static bool assign_cross_switch(map::track_switch&sw, std::string &sw_name, const std::string &id, size_t idx); // members group_map m_groupmap; // map of established node groups diff --git a/scripting/PyInt.h b/scripting/PyInt.h index c97fa0b4..b957ad29 100644 --- a/scripting/PyInt.h +++ b/scripting/PyInt.h @@ -81,7 +81,7 @@ class render_task // methods void run(); void upload(); - void cancel(); + static void cancel(); auto target() const -> std::shared_ptr { return m_target; @@ -110,19 +110,19 @@ class python_taskqueue python_taskqueue() = default; // methods // initializes the module. returns true on success - auto init() -> bool; + static auto init() -> bool; // shuts down the module - void exit(); + static void exit(); // adds specified task along with provided collection of data to the work queue. returns true on success - auto insert(task_request const &Task) -> bool; + static auto insert(task_request const &Task) -> bool; // executes python script stored in specified file. returns true on success - auto run_file(std::string const &File, std::string const &Path = "") -> bool; + static auto run_file(std::string const &File, std::string const &Path = "") -> bool; // acquires the python gil and sets the main thread as current - void acquire_lock(); + static void acquire_lock(); // releases the python gil and swaps the main thread out - void release_lock(); + static void release_lock(); - void update(); + static void update(); private: // types diff --git a/scripting/ladderlogic.cpp b/scripting/ladderlogic.cpp index 2010bc49..e24b9fcc 100644 --- a/scripting/ladderlogic.cpp +++ b/scripting/ladderlogic.cpp @@ -380,7 +380,7 @@ basic_controller::log_error( std::string const &Error, int const Line ) const { } auto -basic_controller::guess_element_type_from_name( std::string const &Name ) const -> basic_element::type_e { +basic_controller::guess_element_type_from_name( std::string const &Name ) -> basic_element::type_e { auto const name { split_string_and_number( Name ) }; diff --git a/scripting/ladderlogic.h b/scripting/ladderlogic.h index 3ac77606..9566cefc 100644 --- a/scripting/ladderlogic.h +++ b/scripting/ladderlogic.h @@ -104,8 +104,8 @@ private: // runs one cycle of current program. returns: error code or 0 if there's no error auto run() -> int; void log_error( std::string const &Error, int Line = -1 ) const; - auto guess_element_type_from_name( std::string const &Name ) const->basic_element::type_e; - auto inverse( int const Value ) const -> int { + static auto guess_element_type_from_name( std::string const &Name ) -> basic_element::type_e; + static auto inverse( int const Value ) -> int { return Value == 0 ? 1 : 0; } // element access auto element( element_handle const Element ) const -> basic_element const { diff --git a/simulation/simulation.h b/simulation/simulation.h index 4805425c..75975e14 100644 --- a/simulation/simulation.h +++ b/simulation/simulation.h @@ -25,17 +25,17 @@ class state_manager { public: // methods - void + static void init_scripting_interface(); // legacy method, calculates changes in simulation state over specified time - void + static void update( double Deltatime, int Iterationcount ); - void + static void update_clocks(); void update_scripting_interface(); // process input commands - void + static void process_commands(); // create model from node string TAnimModel * @@ -44,10 +44,10 @@ public: TEventLauncher * create_eventlauncher(const std::string &src, const std::string &name, const glm::dvec3 &position); // delete TAnimModel instance - void + static void delete_model(TAnimModel *model); // delete TEventLauncher instance - void + static void delete_eventlauncher(TEventLauncher *launcher); // starts deserialization from specified file, returns context pointer on success, throws otherwise std::shared_ptr diff --git a/simulation/simulationenvironment.h b/simulation/simulationenvironment.h index 416da682..2e8eb74b 100644 --- a/simulation/simulationenvironment.h +++ b/simulation/simulationenvironment.h @@ -38,7 +38,7 @@ public: // calculates current season of the year based on set simulation date void compute_season( int Yearday ); // calculates current weather - void compute_weather(); + static void compute_weather(); // data access auto const & sun() const { diff --git a/simulation/simulationstateserializer.cpp b/simulation/simulationstateserializer.cpp index 2078b964..c997fe92 100644 --- a/simulation/simulationstateserializer.cpp +++ b/simulation/simulationstateserializer.cpp @@ -1281,7 +1281,8 @@ state_serializer::export_as_text(std::string const &Scenariofile) const { } void -state_serializer::export_nodes_to_stream(std::ostream &scmfile, bool Dirty) const { +state_serializer::export_nodes_to_stream(std::ostream &scmfile, bool Dirty) +{ // groups scmfile << "// groups\n"; scene::Groups.export_as_text( scmfile, Dirty ); diff --git a/simulation/simulationstateserializer.h b/simulation/simulationstateserializer.h index a5d6f2dc..7b73082e 100644 --- a/simulation/simulationstateserializer.h +++ b/simulation/simulationstateserializer.h @@ -49,33 +49,33 @@ public: private: // methods // restores class data from provided stream - void deserialize_area( cParser &Input, scene::scratch_data &Scratchpad ); - void deserialize_isolated( cParser &Input, scene::scratch_data &Scratchpad ); - void deserialize_assignment( cParser &Input, scene::scratch_data &Scratchpad ); - void deserialize_atmo( cParser &Input, scene::scratch_data &Scratchpad ); - void deserialize_camera( cParser &Input, scene::scratch_data &Scratchpad ); - void deserialize_config( cParser &Input, scene::scratch_data &Scratchpad ); + static void deserialize_area( cParser &Input, scene::scratch_data &Scratchpad ); + static void deserialize_isolated( cParser &Input, scene::scratch_data &Scratchpad ); + static void deserialize_assignment( cParser &Input, scene::scratch_data &Scratchpad ); + static void deserialize_atmo( cParser &Input, scene::scratch_data &Scratchpad ); + static void deserialize_camera( cParser &Input, scene::scratch_data &Scratchpad ); + static void deserialize_config( cParser &Input, scene::scratch_data &Scratchpad ); void deserialize_description( cParser &Input, scene::scratch_data &Scratchpad ); void deserialize_event( cParser &Input, scene::scratch_data &Scratchpad ); - void deserialize_lua( cParser &Input, scene::scratch_data &Scratchpad ); + static void deserialize_lua( cParser &Input, scene::scratch_data &Scratchpad ); void deserialize_firstinit( cParser &Input, scene::scratch_data &Scratchpad ); - void deserialize_group( cParser &Input, scene::scratch_data &Scratchpad ); - void deserialize_endgroup( cParser &Input, scene::scratch_data &Scratchpad ); + static void deserialize_group( cParser &Input, scene::scratch_data &Scratchpad ); + static void deserialize_endgroup( cParser &Input, scene::scratch_data &Scratchpad ); void deserialize_light( cParser &Input, scene::scratch_data &Scratchpad ); void deserialize_node( cParser &Input, scene::scratch_data &Scratchpad ); - void deserialize_origin( cParser &Input, scene::scratch_data &Scratchpad ); - void deserialize_endorigin( cParser &Input, scene::scratch_data &Scratchpad ); - void deserialize_scale( cParser &Input, scene::scratch_data &Scratchpad ); - void deserialize_endscale( cParser &Input, scene::scratch_data &Scratchpad ); - void deserialize_rotate( cParser &Input, scene::scratch_data &Scratchpad ); + static void deserialize_origin( cParser &Input, scene::scratch_data &Scratchpad ); + static void deserialize_endorigin( cParser &Input, scene::scratch_data &Scratchpad ); + static void deserialize_scale( cParser &Input, scene::scratch_data &Scratchpad ); + static void deserialize_endscale( cParser &Input, scene::scratch_data &Scratchpad ); + static void deserialize_rotate( cParser &Input, scene::scratch_data &Scratchpad ); void deserialize_sky( cParser &Input, scene::scratch_data &Scratchpad ); void deserialize_test( cParser &Input, scene::scratch_data &Scratchpad ); void deserialize_time( cParser &Input, scene::scratch_data &Scratchpad ); void deserialize_trainset( cParser &Input, scene::scratch_data &Scratchpad ); void deserialize_terrain( cParser &Input, scene::scratch_data &Scratchpad ); void deserialize_editorterrain( cParser &Input, scene::scratch_data &Scratchpad ); - void deserialize_endtrainset( cParser &Input, scene::scratch_data &Scratchpad ); - TTrack * deserialize_path( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ); + static void deserialize_endtrainset( cParser &Input, scene::scratch_data &Scratchpad ); + static TTrack * deserialize_path( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ); TTraction * deserialize_traction( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ); TTractionPowerSource * deserialize_tractionpowersource( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ); TMemCell * deserialize_memorycell( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ); @@ -83,12 +83,12 @@ private: TAnimModel * deserialize_model( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ); TDynamicObject * deserialize_dynamic( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ); sound_source * deserialize_sound( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ); - void init_time(); + static void init_time(); // skips content of stream until specified token - void skip_until( cParser &Input, std::string const &Token ); + static void skip_until( cParser &Input, std::string const &Token ); // transforms provided location by specifed rotation and offset - glm::dvec3 transform( glm::dvec3 Location, scene::scratch_data const &Scratchpad ); - void export_nodes_to_stream( std::ostream &, bool Dirty ) const; + static glm::dvec3 transform( glm::dvec3 Location, scene::scratch_data const &Scratchpad ); + static void export_nodes_to_stream( std::ostream &, bool Dirty ); }; } // simulation diff --git a/simulation/simulationtime.cpp b/simulation/simulationtime.cpp index df3722f9..88ac24da 100644 --- a/simulation/simulationtime.cpp +++ b/simulation/simulationtime.cpp @@ -194,7 +194,8 @@ void scenario_time::set_time(int yearday, int minute) { // calculates day of week for provided date int -scenario_time::day_of_week( int const Day, int const Month, int const Year ) const { +scenario_time::day_of_week( int const Day, int const Month, int const Year ) +{ // using Zeller's congruence, http://en.wikipedia.org/wiki/Zeller%27s_congruence int const q = Day; @@ -234,7 +235,8 @@ scenario_time::day_of_month( int const Week, int const Weekday, int const Month, // returns number of days between specified days of week int -scenario_time::weekdays( int const First, int const Second ) const { +scenario_time::weekdays( int const First, int const Second ) +{ if( Second >= First ) { return Second - First; } else { return 7 - First + Second; } @@ -249,7 +251,8 @@ scenario_time::convert_transition_time( SYSTEMTIME &Time ) const { } bool -scenario_time::is_leap( int const Year ) const { +scenario_time::is_leap( int const Year ) +{ return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0); diff --git a/simulation/simulationtime.h b/simulation/simulationtime.h index 12efdb86..bb000824 100644 --- a/simulation/simulationtime.h +++ b/simulation/simulationtime.h @@ -56,17 +56,17 @@ private: int year_day( int Day, int Month, int Year ) const; // calculates day of week for provided date - int - day_of_week( int Day, int Month, int Year ) const; + static int + day_of_week( int Day, int Month, int Year ); // calculates day of month for specified weekday of specified month of the year int day_of_month( int Week, int Weekday, int Month, int Year ) const; // returns number of days between specified days of week - int - weekdays( int First, int Second ) const; + static int + weekdays( int First, int Second ); // returns true if specified year is a leap year, false otherwise - bool - is_leap( int Year ) const; + static bool + is_leap( int Year ); SYSTEMTIME m_time; double m_milliseconds{ 0.0 }; diff --git a/utilities/headtrack.h b/utilities/headtrack.h index e22cbe79..7aab21a5 100644 --- a/utilities/headtrack.h +++ b/utilities/headtrack.h @@ -5,7 +5,7 @@ class headtrack int joy_id = -1; void find_joy(); - float get_axis(const float *data, int count, int axis, float mul); + static float get_axis(const float *data, int count, int axis, float mul); public: headtrack(); diff --git a/utilities/translation.h b/utilities/translation.h index 5a48f711..10949765 100644 --- a/utilities/translation.h +++ b/utilities/translation.h @@ -23,7 +23,7 @@ public: private: bool parse_translation(std::istream &stream); - std::string parse_c_literal(const std::string &str); + static std::string parse_c_literal(const std::string &str); std::unordered_map lang_mapping; std::unordered_map pointer_cache; diff --git a/vehicle/Driver.cpp b/vehicle/Driver.cpp index 976b1758..840bf3e2 100644 --- a/vehicle/Driver.cpp +++ b/vehicle/Driver.cpp @@ -452,7 +452,7 @@ void TController::TableClear() eSignSkip = nullptr; // nic nie pomijamy }; -std::vector TController::CheckTrackEvent( TTrack *Track, double const fDirection ) const +std::vector TController::CheckTrackEvent( TTrack *Track, double const fDirection ) { // sprawdzanie eventów na podanym torze do podstawowego skanowania std::vector events; auto const &eventsequence { ( fDirection > 0 ? Track->m_events2 : Track->m_events1 ) }; @@ -1918,7 +1918,8 @@ TController::~TController() }; // zamiana kodu rozkazu na opis -std::string TController::Order2Str(TOrders Order) const { +std::string TController::Order2Str(TOrders Order) +{ if( (Order & Change_direction) != 0 && Order != Change_direction ) { diff --git a/vehicle/Driver.h b/vehicle/Driver.h index 9114aeed..9cad987b 100644 --- a/vehicle/Driver.h +++ b/vehicle/Driver.h @@ -471,7 +471,7 @@ private: void OrdersInit( double fVel ); void OrdersClear(); void OrdersDump( std::string Neworder, bool Verbose = true ); - std::string Order2Str( TOrders Order ) const; + static std::string Order2Str( TOrders Order ); // members std::string m_assignment; glm::dvec3 vCommandLocation; // polozenie wskaznika, sygnalizatora lub innego obiektu do ktorego odnosi sie komenda // NOTE: not used @@ -488,7 +488,7 @@ public: } //jak jedzie do tyłu to trzeba uwzględniać, że distance jest ujemna private: // Ra: metody obsługujące skanowanie toru - std::vector CheckTrackEvent( TTrack *Track, double fDirection ) const; + static std::vector CheckTrackEvent( TTrack *Track, double fDirection ); bool TableAddNew(); bool TableNotFound( basic_event const *Event, double Distance ) const; void TableTraceRoute( double fDistance, TDynamicObject *pVehicle ); @@ -511,7 +511,7 @@ private: int TableDirection() { return iTableDirection; } // Ra: stare funkcje skanujące, używane do szukania sygnalizatora z tyłu bool IsOccupiedByAnotherConsist( TTrack *Track, double Distance ); - basic_event *CheckTrackEventBackward( double fDirection, TTrack *Track, TDynamicObject *Vehicle, int Eventdirection = 1, end End = rear ); + static basic_event *CheckTrackEventBackward( double fDirection, TTrack *Track, TDynamicObject *Vehicle, int Eventdirection = 1, end End = rear ); TTrack *BackwardTraceRoute( double &fDistance, double &fDirection, TDynamicObject *Vehicle, basic_event *&Event, int Eventdirection = 1, end End = rear, bool Untiloccupied = true ); void SetProximityVelocity( double dist, double vel, glm::dvec3 const *pos ); TCommandType BackwardScan( double Range ); diff --git a/vehicle/DynObj.h b/vehicle/DynObj.h index 1d95447e..226fa02c 100644 --- a/vehicle/DynObj.h +++ b/vehicle/DynObj.h @@ -206,7 +206,7 @@ public: int iAxleFirst; // numer pierwszej osi w kierunku ruchu (oś wiążąca pojazd z torem i wyzwalająca eventy) float fAxleDist; // rozstaw wózków albo osi do liczenia proporcji zacienienia glm::vec3 modelRot; // obrot pudła względem świata - do przeanalizowania, czy potrzebne!!! - TDynamicObject * ABuFindNearestObject(glm::vec3 pos, TTrack *Track, TDynamicObject *MyPointer, int &CouplNr ); + static TDynamicObject * ABuFindNearestObject(glm::vec3 pos, TTrack *Track, TDynamicObject *MyPointer, int &CouplNr ); glm::dvec3 m_future_movement; glm::dvec3 m_future_wheels_angle; @@ -290,7 +290,7 @@ private: void UpdateDoorRotate(TAnim *pAnim); // animacja drzwi - obrót void UpdateDoorFold(TAnim *pAnim); // animacja drzwi - składanie void UpdateDoorPlug(TAnim *pAnim); // animacja drzwi - odskokowo-przesuwne - void UpdatePant(TAnim *pAnim); // animacja pantografu + static void UpdatePant(TAnim *pAnim); // animacja pantografu void UpdatePlatformTranslate(TAnim *pAnim); // doorstep animation, shift void UpdatePlatformRotate(TAnim *pAnim); // doorstep animation, rotate void UpdateMirror(TAnim *pAnim); // mirror animation @@ -460,7 +460,7 @@ private: // methods void ABuLittleUpdate(double ObjSqrDist); void ABuBogies(); - void ABuModelRoll(); + static void ABuModelRoll(); void TurnOff(); // update state of load exchange operation void update_exchange( double Deltatime ); @@ -869,7 +869,7 @@ public: void update( double dt, int iter ); // legacy method, checks for presence and height of traction wire for specified vehicle - void + static void update_traction( TDynamicObject *Vehicle ); // legacy method, sends list of vehicles over network void diff --git a/vehicle/Train.h b/vehicle/Train.h index 102a5254..613c99e5 100644 --- a/vehicle/Train.h +++ b/vehicle/Train.h @@ -214,7 +214,8 @@ class TTrain { void update_sounds_runningnoise( sound_source &Sound ); void update_sounds_resonancenoise( sound_source &Sound ); void update_sounds_radio(); - end cab_to_end( int const End ) const { + static end cab_to_end( int const End ) + { return End == 2 ? rear : front; } end cab_to_end() const { return cab_to_end( iCabn ); } diff --git a/widgets/map.h b/widgets/map.h index 9cb8a064..417f1bfc 100644 --- a/widgets/map.h +++ b/widgets/map.h @@ -123,9 +123,9 @@ class map_panel : public ui_panel float zoom = 1.0f / 1000.0f; enum { MODE_MANUAL = 0, MODE_CAMERA, MODE_VEHICLE } mode = MODE_MANUAL; - float get_vehicle_rotation(); + static float get_vehicle_rotation(); void render_map_texture(glm::mat4 transform, glm::vec2 surface_size); - void render_labels(glm::mat4 transform, ImVec2 origin, glm::vec2 surface_size); + static void render_labels(glm::mat4 transform, ImVec2 origin, glm::vec2 surface_size); bool init_done = false; diff --git a/widgets/vehicleparams.h b/widgets/vehicleparams.h index e4c1bcc9..62a5d2ec 100644 --- a/widgets/vehicleparams.h +++ b/widgets/vehicleparams.h @@ -13,7 +13,7 @@ class vehicleparams_panel : public ui_panel command_relay m_relay; texture_handle vehicle_mini; - void draw_infobutton(const char *str, ImVec2 pos = ImVec2(-1.0f, -1.0f), ImVec4 color = ImVec4(1.0f, 1.0f, 0.0f, 1.0f)); + static void draw_infobutton(const char *str, ImVec2 pos = ImVec2(-1.0f, -1.0f), ImVec4 color = ImVec4(1.0f, 1.0f, 0.0f, 1.0f)); void draw_mini(const TMoverParameters &mover); public: vehicleparams_panel(const std::string &vehicle); diff --git a/world/Event.cpp b/world/Event.cpp index b2604444..c735464a 100644 --- a/world/Event.cpp +++ b/world/Event.cpp @@ -829,7 +829,8 @@ putvalues_event::export_as_text_( std::ostream &Output ) const { //determines whether provided input should be passed to consist owner bool -putvalues_event::is_command_for_owner( input_data const &Input ) const { +putvalues_event::is_command_for_owner( input_data const &Input ) +{ if (Input.data_text.starts_with("Load=") || Input.data_text.starts_with("UnLoad=")) { return false; diff --git a/world/Event.h b/world/Event.h index e99330dc..f189e74c 100644 --- a/world/Event.h +++ b/world/Event.h @@ -278,8 +278,8 @@ private: void run_() override; // export_as_text() subclass details void export_as_text_( std::ostream &Output ) const override; - //determines whether provided input should be passed to consist owner - bool is_command_for_owner( input_data const &Input ) const; + // determines whether provided input should be passed to consist owner + static bool is_command_for_owner( input_data const &Input ); }; diff --git a/world/Track.cpp b/world/Track.cpp index a6bb4487..72dd5893 100644 --- a/world/Track.cpp +++ b/world/Track.cpp @@ -3594,7 +3594,8 @@ path_table::TrackBusyList() const { // legacy method, sends list of occupied path sections over network void -path_table::IsolatedBusyList() const { +path_table::IsolatedBusyList() +{ // wysłanie informacji o wszystkich odcinkach izolowanych TIsolated *Current; for( Current = TIsolated::Root(); Current; Current = Current->Next() ) { @@ -3607,7 +3608,8 @@ path_table::IsolatedBusyList() const { // legacy method, sends state of specified path section over network void -path_table::IsolatedBusy( std::string const &Name ) const { +path_table::IsolatedBusy( std::string const &Name ) +{ // wysłanie informacji o odcinku izolowanym (t) // Ra 2014-06: do wyszukania użyć drzewka nazw TIsolated *Current; diff --git a/world/Track.h b/world/Track.h index fad09fa0..366a10bf 100644 --- a/world/Track.h +++ b/world/Track.h @@ -274,8 +274,8 @@ public: void Load(cParser *parser, glm::dvec3 const &pOrigin); bool AssignEvents(); bool AssignForcedEvents(basic_event *NewEventPlus, basic_event *NewEventMinus); - void QueueEvents( event_sequence const &Events, TDynamicObject const *Owner ); - void QueueEvents( event_sequence const &Events, TDynamicObject const *Owner, double Delaylimit ); + static void QueueEvents( event_sequence const &Events, TDynamicObject const *Owner ); + static void QueueEvents( event_sequence const &Events, TDynamicObject const *Owner, double Delaylimit ); bool CheckDynamicObject(TDynamicObject *Dynamic); bool AddDynamicObject(TDynamicObject *Dynamic); bool RemoveDynamicObject(TDynamicObject *Dynamic); @@ -381,11 +381,11 @@ public: void TrackBusyList() const; // legacy method, sends list of occupied path sections over network - void - IsolatedBusyList() const; + static void + IsolatedBusyList(); // legacy method, sends state of specified path section over network - void - IsolatedBusy( std::string const &Name ) const; + static void + IsolatedBusy( std::string const &Name ); }; //--------------------------------------------------------------------------- diff --git a/world/station.h b/world/station.h index 80f6e151..7eee99a1 100644 --- a/world/station.h +++ b/world/station.h @@ -17,7 +17,7 @@ class basic_station { public: // methods // exchanges load with consist attached to specified vehicle, operating on specified schedule; returns: time needed for exchange, in seconds - double + static double update_load( TDynamicObject *First, Mtable::TTrainParameters &Schedule, int Platform ); };