From 96a099acdfcd028cc204ce3c68431943c9b3b6a3 Mon Sep 17 00:00:00 2001 From: jerrrrycho Date: Sat, 4 Jul 2026 07:14:02 +0200 Subject: [PATCH] reformat: parameters can be made pointer to const --- McZapkie/MOVER.h | 2 +- McZapkie/Mover.cpp | 2 +- application/editormode.cpp | 4 +- application/editormode.h | 4 +- extras/piped_proc.cpp | 2 +- extras/piped_proc.h | 2 +- gl/framebuffer.cpp | 2 +- gl/framebuffer.h | 2 +- imgui/imgui.cpp | 52 ++++++++--------- imgui/imgui_demo.cpp | 2 +- imgui/imgui_draw.cpp | 10 ++-- imgui/imgui_impl_opengl2.cpp | 2 +- imgui/imgui_impl_opengl3.cpp | 2 +- imgui/imgui_internal.h | 26 ++++----- imgui/imgui_widgets.cpp | 20 +++---- imgui/imstb_rectpack.h | 2 +- imgui/imstb_truetype.h | 64 ++++++++++---------- input/gamepadinput.cpp | 2 +- input/gamepadinput.h | 2 +- launcher/vehicle_picker.cpp | 2 +- launcher/vehicle_picker.h | 2 +- scene/scene.cpp | 10 ++-- scene/scene.h | 4 +- scene/scenenodegroups.cpp | 2 +- scene/scenenodegroups.h | 2 +- scripting/PyInt.cpp | 2 +- scripting/PyInt.h | 2 +- scripting/pythonscreenviewer.cpp | 6 +- scripting/pythonscreenviewer.h | 6 +- simulation/simulation.cpp | 2 +- simulation/simulation.h | 2 +- simulation/simulationstateserializer.cpp | 10 ++-- simulation/simulationstateserializer.h | 10 ++-- stb/stb_image.h | 72 +++++++++++------------ stb/stb_image_write.h | 26 ++++----- utilities/Float3d.cpp | 2 +- utilities/Float3d.h | 2 +- vehicle/AirCoupler.cpp | 2 +- vehicle/AirCoupler.h | 2 +- vehicle/Driver.cpp | 8 +-- vehicle/Driver.h | 6 +- vehicle/DynObj.cpp | 28 ++++----- vehicle/DynObj.h | 22 +++---- vehicle/Train.cpp | 74 ++++++++++++------------ vehicle/Train.h | 74 ++++++++++++------------ widgets/map.cpp | 2 +- widgets/map.h | 2 +- world/Track.cpp | 8 +-- world/Track.h | 8 +-- world/station.cpp | 2 +- world/station.h | 2 +- 51 files changed, 304 insertions(+), 304 deletions(-) diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index 45ce9641..8b983dae 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -2310,7 +2310,7 @@ class TMoverParameters bool CurrentSwitch(bool State); bool IsMotorOverloadRelayHighThresholdOn() const; void UpdateBatteryVoltage(double dt); - double ComputeMovement(double dt, double dt1, const TTrackShape &Shape, TTrackParam &Track, TTractionParam &ElectricTraction, TLocation const &NewLoc, + double ComputeMovement(double dt, double dt1, const TTrackShape &Shape, const TTrackParam &Track, const TTractionParam &ElectricTraction, TLocation const &NewLoc, TRotation const &NewRot); // oblicza przesuniecie pojazdu double FastComputeMovement(double dt, const TTrackShape &Shape, TTrackParam &Track, TLocation const &NewLoc, TRotation const &NewRot); // oblicza przesuniecie pojazdu - wersja zoptymalizowana void compute_movement_(double Deltatime); diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 71b6d79f..eb877e31 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -1354,7 +1354,7 @@ void TMoverParameters::Derail(DerailReason const Reason) // ************************************************************************************************* // Oblicza przemieszczenie taboru // ************************************************************************************************* -double TMoverParameters::ComputeMovement(const double dt, const double dt1, const TTrackShape &Shape, TTrackParam &Track, TTractionParam &ElectricTraction, TLocation const &NewLoc, TRotation const &NewRot) +double TMoverParameters::ComputeMovement(const double dt, const double dt1, const TTrackShape &Shape, const TTrackParam &Track, const TTractionParam &ElectricTraction, TLocation const &NewLoc, TRotation const &NewRot) { constexpr double Vepsilon = 1e-5; constexpr double Aepsilon = 1e-3; // ASBSpeed=0.8; diff --git a/application/editormode.cpp b/application/editormode.cpp index 8febf510..5edb6f93 100644 --- a/application/editormode.cpp +++ b/application/editormode.cpp @@ -342,7 +342,7 @@ void editor_mode::add_to_hierarchy(scene::basic_node *node) scene::Hierarchy[node->uuid.to_string()] = node; } -void editor_mode::remove_from_hierarchy(scene::basic_node *node) +void editor_mode::remove_from_hierarchy(const scene::basic_node *node) { if (!node) return; const auto it = scene::Hierarchy.find(node->uuid.to_string()); @@ -423,7 +423,7 @@ glm::dvec3 editor_mode::clamp_mouse_offset_to_max(const glm::dvec3 &offset) return glm::normalize(offset) * static_cast(kMaxPlacementDistance); } -void editor_mode::nullify_history_pointers(scene::basic_node *node) +void editor_mode::nullify_history_pointers(const scene::basic_node *node) { if (!node) return; diff --git a/application/editormode.h b/application/editormode.h index 53c6ab51..70c0ecc1 100644 --- a/application/editormode.h +++ b/application/editormode.h @@ -187,12 +187,12 @@ class editor_mode : public application_mode // hierarchy management static void add_to_hierarchy(scene::basic_node *node); - static void remove_from_hierarchy(scene::basic_node *node); + static void remove_from_hierarchy(const 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) - void nullify_history_pointers(scene::basic_node *node); + void nullify_history_pointers(const scene::basic_node *node); void render_change_history(); void render_settings(); diff --git a/extras/piped_proc.cpp b/extras/piped_proc.cpp index 8466c6f8..5f6680e0 100644 --- a/extras/piped_proc.cpp +++ b/extras/piped_proc.cpp @@ -97,7 +97,7 @@ size_t piped_proc::read(unsigned char *buf, const size_t len) return read; } -size_t piped_proc::write(unsigned char *buf, const size_t len) +size_t piped_proc::write(const unsigned char *buf, const size_t len) { if (!pipe_wr) return 0; diff --git a/extras/piped_proc.h b/extras/piped_proc.h index b16c6b3d..51255a1a 100644 --- a/extras/piped_proc.h +++ b/extras/piped_proc.h @@ -25,6 +25,6 @@ HANDLE pipe_wr = nullptr; public: piped_proc(std::string cmd, bool write = false); size_t read(unsigned char *buf, size_t len); - size_t write(unsigned char *buf, size_t len); + size_t write(const unsigned char *buf, size_t len); ~piped_proc(); }; diff --git a/gl/framebuffer.cpp b/gl/framebuffer.cpp index 15b58b8b..8d04eb87 100644 --- a/gl/framebuffer.cpp +++ b/gl/framebuffer.cpp @@ -80,7 +80,7 @@ void gl::framebuffer::blit_from(framebuffer *other, const int w, const int h, co blit(other, this, 0, 0, w, h, mask, attachment); } -void gl::framebuffer::blit(framebuffer *src, framebuffer *dst, const int sx, const int sy, const int w, const int h, const GLbitfield mask, const GLenum attachment) +void gl::framebuffer::blit(const framebuffer *src, const framebuffer *dst, const int sx, const int sy, const int w, const int h, const GLbitfield mask, const GLenum attachment) { glBindFramebuffer(GL_READ_FRAMEBUFFER, src ? *src : 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dst ? *dst : 0); diff --git a/gl/framebuffer.h b/gl/framebuffer.h index e5dccf57..f8712eb3 100644 --- a/gl/framebuffer.h +++ b/gl/framebuffer.h @@ -26,7 +26,7 @@ namespace gl void blit_to(framebuffer *other, int w, int h, GLbitfield mask, GLenum attachment); void blit_from(framebuffer *other, int w, int h, GLbitfield mask, GLenum attachment); - static void blit(framebuffer *src, framebuffer *dst, int sx, int sy, int w, int h, GLbitfield mask, GLenum attachment); + static void blit(const framebuffer *src, const framebuffer *dst, int sx, int sy, int w, int h, GLbitfield mask, GLenum attachment); using bindable::bind; static void bind(GLuint id); diff --git a/imgui/imgui.cpp b/imgui/imgui.cpp index eb855c21..4c99b78b 100644 --- a/imgui/imgui.cpp +++ b/imgui/imgui.cpp @@ -1038,7 +1038,7 @@ static void SetCurrentWindow(ImGuiWindow* window); static void FindHoveredWindow(); static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags); static void CheckStacksSize(ImGuiWindow* window, bool write); -static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window, bool snap_on_edges); +static ImVec2 CalcNextScrollFromScrollTargetAndClamp(const ImGuiWindow * window, bool snap_on_edges); static void AddDrawListToDrawData(ImVector* out_list, ImDrawList* draw_list); static void AddWindowToSortBuffer(ImVector* out_sorted_windows, ImGuiWindow* window); @@ -1048,7 +1048,7 @@ static ImRect GetViewportRect(); // Settings static void* SettingsHandlerWindow_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*, const char* name); static void SettingsHandlerWindow_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line); -static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf); +static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, const ImGuiSettingsHandler * handler, ImGuiTextBuffer* buf); // Platform Dependents default implementation for IO functions static const char* GetClipboardTextFn_DefaultImpl(void* user_data); @@ -1071,7 +1071,7 @@ static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb static ImVec2 NavCalcPreferredRefPos(); static void NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window); static ImGuiWindow* NavRestoreLastChildNavWindow(ImGuiWindow* window); -static int FindWindowFocusIndex(ImGuiWindow* window); +static int FindWindowFocusIndex(const ImGuiWindow * window); // Misc static void UpdateMouseInputs(); @@ -1110,8 +1110,8 @@ ImGuiContext* GImGui = NULL; // If you use DLL hotreloading you might need to call SetAllocatorFunctions() after reloading code from this file. // Otherwise, you probably don't want to modify them mid-program, and if you use global/static e.g. ImVector<> instances you may need to keep them accessible during program destruction. #ifndef IMGUI_DISABLE_DEFAULT_ALLOCATORS -static void* MallocWrapper(const size_t size, void* user_data) { IM_UNUSED(user_data); return malloc(size); } -static void FreeWrapper(void* ptr, void* user_data) { IM_UNUSED(user_data); free(ptr); } +static void* MallocWrapper(const size_t size, const void * user_data) { IM_UNUSED(user_data); return malloc(size); } +static void FreeWrapper(void* ptr, const void * user_data) { IM_UNUSED(user_data); free(ptr); } #else static void* MallocWrapper(size_t size, void* user_data) { IM_UNUSED(user_data); IM_UNUSED(size); IM_ASSERT(0); return NULL; } static void FreeWrapper(void* ptr, void* user_data) { IM_UNUSED(user_data); IM_UNUSED(ptr); IM_ASSERT(0); } @@ -1915,7 +1915,7 @@ ImU32 ImGui::GetColorU32(const ImU32 col) //----------------------------------------------------------------------------- // std::lower_bound but without the bullshit -static ImGuiStorage::ImGuiStoragePair* LowerBound(ImVector& data, const ImGuiID key) +static ImGuiStorage::ImGuiStoragePair* LowerBound(const ImVector& data, const ImGuiID key) { ImGuiStorage::ImGuiStoragePair* first = data.Data; const ImGuiStorage::ImGuiStoragePair* last = data.Data + data.Size; @@ -2669,7 +2669,7 @@ void ImGui::RenderNavHighlight(const ImRect& bb, const ImGuiID id, const ImGuiNa //----------------------------------------------------------------------------- // ImGuiWindow is mostly a dumb struct. It merely has a constructor and a few helper methods -ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name) +ImGuiWindow::ImGuiWindow(const ImGuiContext * context, const char* name) : DrawListInst(&context->DrawListSharedData) { Name = ImStrdup(name); @@ -2942,7 +2942,7 @@ void ImGui::MarkItemEdited(const ImGuiID id) g.CurrentWindow->DC.LastItemStatusFlags |= ImGuiItemStatusFlags_Edited; } -static inline bool IsWindowContentHoverable(ImGuiWindow* window, const ImGuiHoveredFlags flags) +static inline bool IsWindowContentHoverable(const ImGuiWindow * window, const ImGuiHoveredFlags flags) { // An active popup disable hovering on other windows (apart from its own children) // FIXME-OPT: This could be cached/stored within the window. @@ -3449,7 +3449,7 @@ void ImGui::UpdateMouseMovingWindowEndFrame() } } -static bool IsWindowActiveAndVisible(ImGuiWindow* window) +static bool IsWindowActiveAndVisible(const ImGuiWindow * window) { return (window->Active) && (!window->Hidden); } @@ -4119,7 +4119,7 @@ void ImDrawDataBuilder::FlattenIntoSingleLayer() } } -static void SetupDrawData(ImVector* draw_lists, ImDrawData* draw_data) +static void SetupDrawData(const ImVector* draw_lists, ImDrawData* draw_data) { const ImGuiIO & io = ImGui::GetIO(); draw_data->Valid = true; @@ -4909,7 +4909,7 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, const ImGuiWi return window; } -static ImVec2 CalcWindowSizeAfterConstraint(ImGuiWindow* window, ImVec2 new_size) +static ImVec2 CalcWindowSizeAfterConstraint(const ImGuiWindow * window, ImVec2 new_size) { const ImGuiContext & g = *GImGui; if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint) @@ -4941,7 +4941,7 @@ static ImVec2 CalcWindowSizeAfterConstraint(ImGuiWindow* window, ImVec2 new_size return new_size; } -static ImVec2 CalcWindowContentSize(ImGuiWindow* window) +static ImVec2 CalcWindowContentSize(const ImGuiWindow * window) { if (window->Collapsed) if (window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0) @@ -5036,7 +5036,7 @@ static const ImGuiResizeGripDef resize_grip_def[4] = { ImVec2(1,0), ImVec2(-1,+1), 9,12 }, // Upper right }; -static ImRect GetResizeBorderRect(ImGuiWindow* window, const int border_n, const float perp_padding, const float thickness) +static ImRect GetResizeBorderRect(const ImGuiWindow * window, const int border_n, const float perp_padding, const float thickness) { ImRect rect = window->Rect(); if (thickness == 0.0f) rect.Max -= ImVec2(1,1); @@ -6129,7 +6129,7 @@ void ImGui::FocusWindow(ImGuiWindow* window) BringWindowToDisplayFront(window); } -void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window) +void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, const ImGuiWindow * ignore_window) { ImGuiContext& g = *GImGui; @@ -6499,7 +6499,7 @@ const char* ImGui::GetStyleColorName(const ImGuiCol idx) return "Unknown"; } -bool ImGui::IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent) +bool ImGui::IsWindowChildOf(const ImGuiWindow * window, const ImGuiWindow * potential_parent) { if (window->RootWindow == potential_parent) return true; @@ -6577,7 +6577,7 @@ bool ImGui::IsWindowFocused(const ImGuiFocusedFlags flags) // Can we focus this window with CTRL+TAB (or PadMenu + PadFocusPrev/PadFocusNext) // Note that NoNavFocus makes the window not reachable with CTRL+TAB but it can still be focused with mouse or programmaticaly. // If you want a window to never be focused, you may use the e.g. NoInputs flag. -bool ImGui::IsWindowNavFocusable(ImGuiWindow* window) +bool ImGui::IsWindowNavFocusable(const ImGuiWindow * window) { return window->Active && window == window->RootWindow && !(window->Flags & ImGuiWindowFlags_NoNavFocus); } @@ -7193,7 +7193,7 @@ void ImGui::Unindent(const float indent_w) // [SECTION] SCROLLING //----------------------------------------------------------------------------- -static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window, const bool snap_on_edges) +static ImVec2 CalcNextScrollFromScrollTargetAndClamp(const ImGuiWindow * window, const bool snap_on_edges) { const ImGuiContext & g = *GImGui; ImVec2 scroll = window->Scroll; @@ -7521,7 +7521,7 @@ bool ImGui::OpenPopupOnItemClick(const char* str_id, const int mouse_button) return false; } -void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window, const bool restore_focus_to_window_under_popup) +void ImGui::ClosePopupsOverWindow(const ImGuiWindow * ref_window, const bool restore_focus_to_window_under_popup) { ImGuiContext& g = *GImGui; if (g.OpenPopupStack.empty()) @@ -7781,7 +7781,7 @@ ImVec2 ImGui::FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& s return pos; } -ImRect ImGui::GetWindowAllowedExtentRect(ImGuiWindow* window) +ImRect ImGui::GetWindowAllowedExtentRect(const ImGuiWindow * window) { IM_UNUSED(window); const ImVec2 padding = GImGui->Style.DisplaySafeAreaPadding; @@ -8096,7 +8096,7 @@ void ImGui::NavMoveRequestForward(const ImGuiDir move_dir, const ImGuiDir clip_d g.NavWindow->NavRectRel[g.NavLayer] = bb_rel; } -void ImGui::NavMoveRequestTryWrapping(ImGuiWindow* window, const ImGuiNavMoveFlags move_flags) +void ImGui::NavMoveRequestTryWrapping(const ImGuiWindow * window, const ImGuiNavMoveFlags move_flags) { const ImGuiContext & g = *GImGui; if (g.NavWindow != window || !NavMoveRequestButNoResultYet() || g.NavMoveRequestForward != ImGuiNavForward_None || g.NavLayer != 0) @@ -8170,7 +8170,7 @@ static inline void ImGui::NavUpdateAnyRequestFlag() } // This needs to be called before we submit any widget (aka in or before Begin) -void ImGui::NavInitWindow(ImGuiWindow* window, const bool force_reinit) +void ImGui::NavInitWindow(const ImGuiWindow * window, const bool force_reinit) { ImGuiContext& g = *GImGui; IM_ASSERT(window == g.NavWindow); @@ -8662,7 +8662,7 @@ static float ImGui::NavUpdatePageUpPageDown(const int allowed_dir_flags) return 0.0f; } -static int ImGui::FindWindowFocusIndex(ImGuiWindow* window) // FIXME-OPT O(N) +static int ImGui::FindWindowFocusIndex(const ImGuiWindow * window) // FIXME-OPT O(N) { ImGuiContext& g = *GImGui; for (int i = g.WindowsFocusOrder.Size-1; i >= 0; i--) @@ -8841,7 +8841,7 @@ static void ImGui::NavUpdateWindowing() } // Window has already passed the IsWindowNavFocusable() -static const char* GetFallbackWindowNameForWindowingList(ImGuiWindow* window) +static const char* GetFallbackWindowNameForWindowingList(const ImGuiWindow * window) { if (window->Flags & ImGuiWindowFlags_Popup) return "(Popup)"; @@ -9384,7 +9384,7 @@ void ImGui::MarkIniSettingsDirty() g.SettingsDirtyTimer = g.IO.IniSavingRate; } -void ImGui::MarkIniSettingsDirty(ImGuiWindow* window) +void ImGui::MarkIniSettingsDirty(const ImGuiWindow * window) { ImGuiContext& g = *GImGui; if (!(window->Flags & ImGuiWindowFlags_NoSavedSettings)) @@ -9557,7 +9557,7 @@ static void SettingsHandlerWindow_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, else if (sscanf(line, "Collapsed=%d", &i) == 1) settings->Collapsed = (i != 0); } -static void SettingsHandlerWindow_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf) +static void SettingsHandlerWindow_WriteAll(ImGuiContext* ctx, const ImGuiSettingsHandler * handler, ImGuiTextBuffer* buf) { // Gather data from windows that were active during this session // (if a window wasn't opened in this session we preserve its settings) @@ -9817,7 +9817,7 @@ void ImGui::ShowMetricsWindow(bool* p_open) // - NodeTabBar struct Funcs { - static ImRect GetWindowRect(ImGuiWindow* window, const int rect_type) + static ImRect GetWindowRect(const ImGuiWindow * window, const int rect_type) { if (rect_type == WRT_OuterRect) { return window->Rect(); } else diff --git a/imgui/imgui_demo.cpp b/imgui/imgui_demo.cpp index dfe51033..c8991c55 100644 --- a/imgui/imgui_demo.cpp +++ b/imgui/imgui_demo.cpp @@ -980,7 +980,7 @@ static void ShowDemoWindowWidgets() static char buf3[64] = ""; ImGui::InputText("hexadecimal", buf3, 64, ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase); static char buf4[64] = ""; ImGui::InputText("uppercase", buf4, 64, ImGuiInputTextFlags_CharsUppercase); static char buf5[64] = ""; ImGui::InputText("no blank", buf5, 64, ImGuiInputTextFlags_CharsNoBlank); - struct TextFilters { static int FilterImGuiLetters(ImGuiInputTextCallbackData* data) { if (data->EventChar < 256 && strchr("imgui", (char)data->EventChar)) return 0; return 1; } }; + struct TextFilters { static int FilterImGuiLetters(const ImGuiInputTextCallbackData * data) { if (data->EventChar < 256 && strchr("imgui", (char)data->EventChar)) return 0; return 1; } }; static char buf6[64] = ""; ImGui::InputText("\"imgui\" letters", buf6, 64, ImGuiInputTextFlags_CallbackCharFilter, TextFilters::FilterImGuiLetters); ImGui::Text("Password input"); diff --git a/imgui/imgui_draw.cpp b/imgui/imgui_draw.cpp index eabe11ef..a1e4706a 100644 --- a/imgui/imgui_draw.cpp +++ b/imgui/imgui_draw.cpp @@ -1247,7 +1247,7 @@ void ImDrawListSplitter::Split(ImDrawList* draw_list, const int channels_count) } } -static inline bool CanMergeDrawCommands(ImDrawCmd* a, ImDrawCmd* b) +static inline bool CanMergeDrawCommands(const ImDrawCmd * a, const ImDrawCmd * b) { return memcmp(&a->ClipRect, &b->ClipRect, sizeof(a->ClipRect)) == 0 && a->TextureId == b->TextureId && a->VtxOffset == b->VtxOffset && !a->UserCallback && !b->UserCallback; } @@ -1365,7 +1365,7 @@ void ImDrawData::ScaleClipRects(const ImVec2& fb_scale) //----------------------------------------------------------------------------- // Generic linear color gradient, write to RGB fields, leave A untouched. -void ImGui::ShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list, const int vert_start_idx, const int vert_end_idx, const ImVec2 gradient_p0, const ImVec2 gradient_p1, const ImU32 col0, +void ImGui::ShadeVertsLinearColorGradientKeepAlpha(const ImDrawList * draw_list, const int vert_start_idx, const int vert_end_idx, const ImVec2 gradient_p0, const ImVec2 gradient_p1, const ImU32 col0, const ImU32 col1) { const ImVec2 gradient_extent = gradient_p1 - gradient_p0; @@ -1384,7 +1384,7 @@ void ImGui::ShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list, const } // Distribute UV over (a, b) rectangle -void ImGui::ShadeVertsLinearUV(ImDrawList* draw_list, const int vert_start_idx, const int vert_end_idx, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, const bool clamp) +void ImGui::ShadeVertsLinearUV(const ImDrawList * draw_list, const int vert_start_idx, const int vert_end_idx, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, const bool clamp) { const ImVec2 size = b - a; const ImVec2 uv_size = uv_b - uv_a; @@ -2111,7 +2111,7 @@ void ImFontAtlasBuildRegisterDefaultCustomRects(ImFontAtlas* atlas) atlas->CustomRectIds[0] = atlas->AddCustomRectRegular(FONT_ATLAS_DEFAULT_TEX_DATA_ID, 2, 2); } -void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, const float ascent, const float descent) +void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, const ImFontConfig * font_config, const float ascent, const float descent) { if (!font_config->MergeMode) { @@ -3201,7 +3201,7 @@ static const unsigned char *stb_decompress_token(const unsigned char *i) return i; } -static unsigned int stb_adler32(const unsigned int adler32, unsigned char *buffer, unsigned int buflen) +static unsigned int stb_adler32(const unsigned int adler32, const unsigned char *buffer, unsigned int buflen) { constexpr unsigned long ADLER_MOD = 65521; unsigned long s1 = adler32 & 0xffff, s2 = adler32 >> 16; diff --git a/imgui/imgui_impl_opengl2.cpp b/imgui/imgui_impl_opengl2.cpp index 291133d2..108910fd 100644 --- a/imgui/imgui_impl_opengl2.cpp +++ b/imgui/imgui_impl_opengl2.cpp @@ -57,7 +57,7 @@ void ImGui_ImplOpenGL2_NewFrame() ImGui_ImplOpenGL2_CreateDeviceObjects(); } -static void ImGui_ImplOpenGL2_SetupRenderState(ImDrawData* draw_data, const int fb_width, const int fb_height) +static void ImGui_ImplOpenGL2_SetupRenderState(const ImDrawData * draw_data, const int fb_width, const int fb_height) { // Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers, polygon fill. glEnable(GL_BLEND); diff --git a/imgui/imgui_impl_opengl3.cpp b/imgui/imgui_impl_opengl3.cpp index 8357a45e..a298a797 100644 --- a/imgui/imgui_impl_opengl3.cpp +++ b/imgui/imgui_impl_opengl3.cpp @@ -132,7 +132,7 @@ void ImGui_ImplOpenGL3_NewFrame() ImGui_ImplOpenGL3_CreateDeviceObjects(); } -static void ImGui_ImplOpenGL3_SetupRenderState(ImDrawData* draw_data, const int fb_width, const int fb_height, const GLuint vertex_array_object) +static void ImGui_ImplOpenGL3_SetupRenderState(const ImDrawData * draw_data, const int fb_width, const int fb_height, const GLuint vertex_array_object) { // Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill glEnable(GL_BLEND); diff --git a/imgui/imgui_internal.h b/imgui/imgui_internal.h index 7f645995..6655b61d 100644 --- a/imgui/imgui_internal.h +++ b/imgui/imgui_internal.h @@ -1367,7 +1367,7 @@ struct IMGUI_API ImGuiWindow int MemoryDrawListVtxCapacity; public: - ImGuiWindow(ImGuiContext* context, const char* name); + ImGuiWindow(const ImGuiContext * context, const char* name); ~ImGuiWindow(); ImGuiID GetID(const char* str, const char* str_end = NULL); @@ -1493,15 +1493,15 @@ namespace ImGui IMGUI_API ImGuiWindow* FindWindowByID(ImGuiID id); IMGUI_API ImGuiWindow* FindWindowByName(const char* name); IMGUI_API void FocusWindow(ImGuiWindow* window); - IMGUI_API void FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window); + IMGUI_API void FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, const ImGuiWindow * ignore_window); IMGUI_API void BringWindowToFocusFront(ImGuiWindow* window); IMGUI_API void BringWindowToDisplayFront(ImGuiWindow* window); IMGUI_API void BringWindowToDisplayBack(ImGuiWindow* window); IMGUI_API void UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window); IMGUI_API ImVec2 CalcWindowExpectedSize(ImGuiWindow* window); - IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent); - IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window); - IMGUI_API ImRect GetWindowAllowedExtentRect(ImGuiWindow* window); + IMGUI_API bool IsWindowChildOf(const ImGuiWindow * window, const ImGuiWindow * potential_parent); + IMGUI_API bool IsWindowNavFocusable(const ImGuiWindow * window); + IMGUI_API ImRect GetWindowAllowedExtentRect(const ImGuiWindow * window); IMGUI_API void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond = 0); IMGUI_API void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond = 0); IMGUI_API void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond = 0); @@ -1525,7 +1525,7 @@ namespace ImGui // Settings IMGUI_API void MarkIniSettingsDirty(); - IMGUI_API void MarkIniSettingsDirty(ImGuiWindow* window); + IMGUI_API void MarkIniSettingsDirty(const ImGuiWindow * window); IMGUI_API ImGuiWindowSettings* CreateNewWindowSettings(const char* name); IMGUI_API ImGuiWindowSettings* FindWindowSettings(ImGuiID id); IMGUI_API ImGuiWindowSettings* FindOrCreateWindowSettings(const char* name); @@ -1578,7 +1578,7 @@ namespace ImGui // Popups, Modals, Tooltips IMGUI_API void OpenPopupEx(ImGuiID id); IMGUI_API void ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup); - IMGUI_API void ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to_window_under_popup); + IMGUI_API void ClosePopupsOverWindow(const ImGuiWindow * ref_window, bool restore_focus_to_window_under_popup); IMGUI_API bool IsPopupOpen(ImGuiID id); // Test for id within current popup stack level (currently begin-ed into); this doesn't scan the whole popup stack! IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags); IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip = true); @@ -1587,11 +1587,11 @@ namespace ImGui IMGUI_API ImVec2 FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_outer, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy = ImGuiPopupPositionPolicy_Default); // Navigation - IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit); + IMGUI_API void NavInitWindow(const ImGuiWindow * window, bool force_reinit); IMGUI_API bool NavMoveRequestButNoResultYet(); IMGUI_API void NavMoveRequestCancel(); IMGUI_API void NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, const ImRect& bb_rel, ImGuiNavMoveFlags move_flags); - IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags); + IMGUI_API void NavMoveRequestTryWrapping(const ImGuiWindow * window, ImGuiNavMoveFlags move_flags); IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode); IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f); IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate); @@ -1695,7 +1695,7 @@ namespace ImGui // Data type helpers IMGUI_API const ImGuiDataTypeInfo* DataTypeGetInfo(ImGuiDataType data_type); IMGUI_API int DataTypeFormatString(char* buf, int buf_size, ImGuiDataType data_type, const void* data_ptr, const char* format); - IMGUI_API void DataTypeApplyOp(ImGuiDataType data_type, int op, void* output, void* arg_1, const void* arg_2); + IMGUI_API void DataTypeApplyOp(ImGuiDataType data_type, int op, void* output, const void * arg_1, const void* arg_2); IMGUI_API bool DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* data_ptr, const char* format); // InputText @@ -1713,8 +1713,8 @@ namespace ImGui IMGUI_API void PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size); // Shade functions (write over already created vertices) - IMGUI_API void ShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1); - IMGUI_API void ShadeVertsLinearUV(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, bool clamp); + IMGUI_API void ShadeVertsLinearColorGradientKeepAlpha(const ImDrawList * draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1); + IMGUI_API void ShadeVertsLinearUV(const ImDrawList * draw_list, int vert_start_idx, int vert_end_idx, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, bool clamp); // Debug Tools inline void DebugStartItemPicker() { GImGui->DebugItemPickerActive = true; } @@ -1724,7 +1724,7 @@ namespace ImGui // ImFontAtlas internals IMGUI_API bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas); IMGUI_API void ImFontAtlasBuildRegisterDefaultCustomRects(ImFontAtlas* atlas); -IMGUI_API void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent); +IMGUI_API void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, const ImFontConfig * font_config, float ascent, float descent); IMGUI_API void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* stbrp_context_opaque); IMGUI_API void ImFontAtlasBuildFinish(ImFontAtlas* atlas); IMGUI_API void ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_table[256], float in_multiply_factor); diff --git a/imgui/imgui_widgets.cpp b/imgui/imgui_widgets.cpp index 6f11b002..2180a20e 100644 --- a/imgui/imgui_widgets.cpp +++ b/imgui/imgui_widgets.cpp @@ -1533,7 +1533,7 @@ void ImGui::EndCombo() } // Getter for the old Combo() API: const char*[] -static bool Items_ArrayGetter(void* data, const int idx, const char** out_text) +static bool Items_ArrayGetter(const void * data, const int idx, const char** out_text) { const auto items = (const char* const*)data; if (out_text) @@ -1542,7 +1542,7 @@ static bool Items_ArrayGetter(void* data, const int idx, const char** out_text) } // Getter for the old Combo() API: "item1\0item2\0item3\0" -static bool Items_SingleStringGetter(void* data, const int idx, const char** out_text) +static bool Items_SingleStringGetter(const void * data, const int idx, const char** out_text) { // FIXME-OPT: we could pre-compute the indices to fasten this. But only 1 active combo means the waste is limited. const auto items_separated_by_zeros = (const char*)data; @@ -1709,7 +1709,7 @@ int ImGui::DataTypeFormatString(char* buf, const int buf_size, const ImGuiDataTy return 0; } -void ImGui::DataTypeApplyOp(const ImGuiDataType data_type, const int op, void* output, void* arg1, const void* arg2) +void ImGui::DataTypeApplyOp(const ImGuiDataType data_type, const int op, void* output, const void * arg1, const void* arg2) { IM_ASSERT(op == '+' || op == '-'); switch (data_type) @@ -6349,10 +6349,10 @@ bool ImGui::MenuItem(const char* label, const char* shortcut, bool* p_selected, namespace ImGui { static void TabBarLayout(ImGuiTabBar* tab_bar); - static ImU32 TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label); + static ImU32 TabBarCalcTabID(const ImGuiTabBar * tab_bar, const char* label); static float TabBarCalcMaxTabWidth(); - static float TabBarScrollClamp(ImGuiTabBar* tab_bar, float scrolling); - static void TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab); + static float TabBarScrollClamp(const ImGuiTabBar * tab_bar, float scrolling); + static void TabBarScrollToTab(ImGuiTabBar* tab_bar, const ImGuiTabItem * tab); static ImGuiTabItem* TabBarScrollingButtons(ImGuiTabBar* tab_bar); static ImGuiTabItem* TabBarTabListPopupButton(ImGuiTabBar* tab_bar); } @@ -6661,7 +6661,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) } // Dockables uses Name/ID in the global namespace. Non-dockable items use the ID stack. -static ImU32 ImGui::TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label) +static ImU32 ImGui::TabBarCalcTabID(const ImGuiTabBar * tab_bar, const char* label) { if (tab_bar->Flags & ImGuiTabBarFlags_DockNode) { @@ -6718,13 +6718,13 @@ void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab) } } -static float ImGui::TabBarScrollClamp(ImGuiTabBar* tab_bar, float scrolling) +static float ImGui::TabBarScrollClamp(const ImGuiTabBar * tab_bar, float scrolling) { scrolling = ImMin(scrolling, tab_bar->OffsetMax - tab_bar->BarRect.GetWidth()); return ImMax(scrolling, 0.0f); } -static void ImGui::TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab) +static void ImGui::TabBarScrollToTab(ImGuiTabBar* tab_bar, const ImGuiTabItem * tab) { const ImGuiContext & g = *GImGui; const float margin = g.FontSize * 1.0f; // When to scroll to make Tab N+1 visible always make a bit of N visible to suggest more scrolling area (since we don't have a scrollbar) @@ -7244,7 +7244,7 @@ float ImGui::GetColumnNormFromOffset(const ImGuiColumns* columns, const float of static constexpr float COLUMNS_HIT_RECT_HALF_WIDTH = 4.0f; -static float GetDraggedColumnOffset(ImGuiColumns* columns, const int column_index) +static float GetDraggedColumnOffset(const ImGuiColumns * columns, const int column_index) { // Active (dragged) column always follow mouse. The reason we need this is that dragging a column to the right edge of an auto-resizing // window creates a feedback loop because we store normalized positions. So while dragging we enforce absolute positioning. diff --git a/imgui/imstb_rectpack.h b/imgui/imstb_rectpack.h index 8e2d89e6..0f33e42c 100644 --- a/imgui/imstb_rectpack.h +++ b/imgui/imstb_rectpack.h @@ -292,7 +292,7 @@ STBRP_DEF void stbrp_init_target(stbrp_context *context, const int width, const } // find minimum y position if it starts at x1 -static int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first, const int x0, const int width, int *pwaste) +static int stbrp__skyline_find_min_y(const stbrp_context *c, const stbrp_node *first, const int x0, const int width, int *pwaste) { const stbrp_node *node = first; const int x1 = x0 + width; diff --git a/imgui/imstb_truetype.h b/imgui/imstb_truetype.h index cbfc73a1..f66bfb06 100644 --- a/imgui/imstb_truetype.h +++ b/imgui/imstb_truetype.h @@ -549,7 +549,7 @@ typedef struct STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, int pw, int ph, // same data as above int char_index, // character to display - float *xpos, float *ypos, // pointers to current position in screen pixel space + float *xpos, const float *ypos, // pointers to current position in screen pixel space stbtt_aligned_quad *q, // output: quad to draw int opengl_fillrule); // true if opengl fill rule; false if DX9 or earlier // Call GetBakedQuad with char_index = 'character - first_char', and it @@ -597,7 +597,7 @@ STBTT_DEF int stbtt_PackBegin(stbtt_pack_context *spc, unsigned char *pixels, i // // Returns 0 on failure, 1 on success. -STBTT_DEF void stbtt_PackEnd (stbtt_pack_context *spc); +STBTT_DEF void stbtt_PackEnd (const stbtt_pack_context *spc); // Cleans up the packing context and frees all memory. #define STBTT_POINT_SIZE(x) (-(x)) @@ -657,13 +657,13 @@ STBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context *spc, int s STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, // same data as above int char_index, // character to display - float *xpos, float *ypos, // pointers to current position in screen pixel space + float *xpos, const float *ypos, // pointers to current position in screen pixel space stbtt_aligned_quad *q, // output: quad to draw int align_to_integer); -STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects); -STBTT_DEF void stbtt_PackFontRangesPackRects(stbtt_pack_context *spc, stbrp_rect *rects, int num_rects); -STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects); +STBTT_DEF int stbtt_PackFontRangesGatherRects(const stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects); +STBTT_DEF void stbtt_PackFontRangesPackRects(const stbtt_pack_context *spc, stbrp_rect *rects, int num_rects); +STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, const stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects); // Calling these functions in sequence is roughly equivalent to calling // stbtt_PackFontRanges(). If you more control over the packing of multiple // fonts, or if you want to pack custom data into a font texture, take a look @@ -851,7 +851,7 @@ STBTT_DEF void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *vertice // BITMAP RENDERING // -STBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata); +STBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, const void *userdata); // frees the bitmap allocated below STBTT_DEF unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff); @@ -925,7 +925,7 @@ STBTT_DEF void stbtt_Rasterize(stbtt__bitmap *result, // 1-channel bitmap // // Signed Distance Function (or Field) rendering -STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, void *userdata); +STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, const void *userdata); // frees the SDF bitmap allocated below STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float scale, int glyph, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff); @@ -1120,7 +1120,7 @@ static stbtt_uint8 stbtt__buf_get8(stbtt__buf *b) return b->data[b->cursor++]; } -static stbtt_uint8 stbtt__buf_peek8(stbtt__buf *b) +static stbtt_uint8 stbtt__buf_peek8(const stbtt__buf *b) { if (b->cursor >= b->size) return 0; @@ -1276,15 +1276,15 @@ static stbtt__buf stbtt__cff_index_get(stbtt__buf b, const int i) #define ttCHAR(p) (* (stbtt_int8 *) (p)) #define ttFixed(p) ttLONG(p) -static stbtt_uint16 ttUSHORT(stbtt_uint8 *p) { return p[0]*256 + p[1]; } -static stbtt_int16 ttSHORT(stbtt_uint8 *p) { return p[0]*256 + p[1]; } -static stbtt_uint32 ttULONG(stbtt_uint8 *p) { return (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; } -static stbtt_int32 ttLONG(stbtt_uint8 *p) { return (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; } +static stbtt_uint16 ttUSHORT(const stbtt_uint8 *p) { return p[0]*256 + p[1]; } +static stbtt_int16 ttSHORT(const stbtt_uint8 *p) { return p[0]*256 + p[1]; } +static stbtt_uint32 ttULONG(const stbtt_uint8 *p) { return (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; } +static stbtt_int32 ttLONG(const stbtt_uint8 *p) { return (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; } #define stbtt_tag4(p,c0,c1,c2,c3) ((p)[0] == (c0) && (p)[1] == (c1) && (p)[2] == (c2) && (p)[3] == (c3)) #define stbtt_tag(p,str) stbtt_tag4(p,str[0],str[1],str[2],str[3]) -static int stbtt__isfont(stbtt_uint8 *font) +static int stbtt__isfont(const stbtt_uint8 *font) { // check the version number if (stbtt_tag4(font, '1',0,0,0)) return 1; // TrueType 1 @@ -2702,7 +2702,7 @@ typedef struct stbtt__hheap int num_remaining_in_head_chunk; } stbtt__hheap; -static void *stbtt__hheap_alloc(stbtt__hheap *hh, const size_t size, void *userdata) +static void *stbtt__hheap_alloc(stbtt__hheap *hh, const size_t size, const void *userdata) { if (hh->first_free) { void *p = hh->first_free; @@ -2729,7 +2729,7 @@ static void stbtt__hheap_free(stbtt__hheap *hh, void *p) hh->first_free = p; } -static void stbtt__hheap_cleanup(stbtt__hheap *hh, void *userdata) +static void stbtt__hheap_cleanup(const stbtt__hheap *hh, const void *userdata) { stbtt__hheap_chunk *c = hh->head; while (c) { @@ -2960,7 +2960,7 @@ static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, // the edge passed in here does not cross the vertical line at x or the vertical line at x+1 // (i.e. it has already been clipped to those) -static void stbtt__handle_clipped_edge(float *scanline, const int x, stbtt__active_edge *e, float x0, float y0, float x1, float y1) +static void stbtt__handle_clipped_edge(float *scanline, const int x, const stbtt__active_edge *e, float x0, float y0, float x1, float y1) { if (y0 == y1) return; STBTT_assert(y0 < y1); @@ -3161,7 +3161,7 @@ static void stbtt__fill_active_edges_new(float *scanline, float *scanline_fill, } // directly AA rasterize edges w/o supersampling -static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, const int n, const int vsubsample, const int off_x, const int off_y, void *userdata) +static void stbtt__rasterize_sorted_edges(const stbtt__bitmap *result, stbtt__edge *e, const int n, const int vsubsample, const int off_x, const int off_y, void *userdata) { stbtt__hheap hh = { 0, 0, 0 }; stbtt__active_edge *active = NULL; @@ -3354,7 +3354,7 @@ typedef struct float x,y; } stbtt__point; -static void stbtt__rasterize(stbtt__bitmap *result, stbtt__point *pts, int *wcount, const int windings, const float scale_x, const float scale_y, const float shift_x, const float shift_y, +static void stbtt__rasterize(stbtt__bitmap *result, const stbtt__point *pts, const int *wcount, const int windings, const float scale_x, const float scale_y, const float shift_x, const float shift_y, const int off_x, const int off_y, const int invert, void *userdata) { const float y_scale_inv = invert ? -scale_y : scale_y; @@ -3485,7 +3485,7 @@ static void stbtt__tesselate_cubic(stbtt__point *points, int *num_points, const } // returns number of contours -static stbtt__point *stbtt_FlattenCurves(stbtt_vertex *vertices, const int num_verts, const float objspace_flatness, int **contour_lengths, int *num_contours, void *userdata) +static stbtt__point *stbtt_FlattenCurves(const stbtt_vertex *vertices, const int num_verts, const float objspace_flatness, int **contour_lengths, int *num_contours, const void *userdata) { stbtt__point *points=0; int num_points=0; @@ -3576,7 +3576,7 @@ STBTT_DEF void stbtt_Rasterize(stbtt__bitmap *result, const float flatness_in_pi } } -STBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata) +STBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, const void *userdata) { STBTT_free(bitmap, userdata); } @@ -3687,7 +3687,7 @@ STBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned ch // // This is SUPER-CRAPPY packing to keep source code small -static int stbtt_BakeFontBitmap_internal(unsigned char *data, const int offset, // font location (use offset=0 for plain .ttf) +static int stbtt_BakeFontBitmap_internal(const unsigned char *data, const int offset, // font location (use offset=0 for plain .ttf) const float pixel_height, // height of font in pixels unsigned char *pixels, const int pw, const int ph, // bitmap to be filled in const int first_char, const int num_chars, // characters to bake @@ -3733,7 +3733,7 @@ static int stbtt_BakeFontBitmap_internal(unsigned char *data, const int offset, return bottom_y; } -STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, const int pw, const int ph, const int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, const int opengl_fillrule) +STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, const int pw, const int ph, const int char_index, float *xpos, const float *ypos, stbtt_aligned_quad *q, const int opengl_fillrule) { const float d3d_bias = opengl_fillrule ? 0 : -0.5f; float ipw = 1.0f / pw, iph = 1.0f / ph; @@ -3863,7 +3863,7 @@ STBTT_DEF int stbtt_PackBegin(stbtt_pack_context *spc, unsigned char *pixels, co return 1; } -STBTT_DEF void stbtt_PackEnd (stbtt_pack_context *spc) +STBTT_DEF void stbtt_PackEnd (const stbtt_pack_context *spc) { STBTT_free(spc->nodes , spc->user_allocator_context); STBTT_free(spc->pack_info, spc->user_allocator_context); @@ -4023,7 +4023,7 @@ static float stbtt__oversample_shift(const int oversample) } // rects array must be big enough to accommodate all characters in the given ranges -STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, const int num_ranges, stbrp_rect *rects) +STBTT_DEF int stbtt_PackFontRangesGatherRects(const stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, const int num_ranges, stbrp_rect *rects) { int i,j,k; @@ -4081,7 +4081,7 @@ STBTT_DEF void stbtt_MakeGlyphBitmapSubpixelPrefilter(const stbtt_fontinfo *info } // rects array must be big enough to accommodate all characters in the given ranges -STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, const int num_ranges, stbrp_rect *rects) +STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, const stbtt_pack_range *ranges, const int num_ranges, stbrp_rect *rects) { int i,j,k, return_value = 1; @@ -4163,7 +4163,7 @@ STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const return return_value; } -STBTT_DEF void stbtt_PackFontRangesPackRects(stbtt_pack_context *spc, stbrp_rect *rects, const int num_rects) +STBTT_DEF void stbtt_PackFontRangesPackRects(const stbtt_pack_context *spc, stbrp_rect *rects, const int num_rects) { stbrp_pack_rects((stbrp_context *) spc->pack_info, rects, num_rects); } @@ -4229,7 +4229,7 @@ STBTT_DEF void stbtt_GetScaledFontVMetrics(const unsigned char *fontdata, const *lineGap = (float) i_lineGap * scale; } -STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, const int pw, const int ph, const int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, const int align_to_integer) +STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, const int pw, const int ph, const int char_index, float *xpos, const float *ypos, stbtt_aligned_quad *q, const int align_to_integer) { float ipw = 1.0f / pw, iph = 1.0f / ph; const stbtt_packedchar *b = chardata + char_index; @@ -4328,12 +4328,12 @@ static int stbtt__ray_intersect_bezier(float orig[2], float ray[2], float q0[2], } } -static int equal(float *a, float *b) +static int equal(const float *a, const float *b) { return (a[0] == b[0] && a[1] == b[1]); } -static int stbtt__compute_crossings_x(const float x, float y, const int nverts, stbtt_vertex *verts) +static int stbtt__compute_crossings_x(const float x, float y, const int nverts, const stbtt_vertex *verts) { int i; float orig[2], ray[2] = { 1, 0 }; @@ -4633,7 +4633,7 @@ STBTT_DEF unsigned char * stbtt_GetCodepointSDF(const stbtt_fontinfo *info, cons return stbtt_GetGlyphSDF(info, scale, stbtt_FindGlyphIndex(info, codepoint), padding, onedge_value, pixel_dist_scale, width, height, xoff, yoff); } -STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, void *userdata) +STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, const void *userdata) { STBTT_free(bitmap, userdata); } @@ -4644,7 +4644,7 @@ STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, void *userdata) // // check if a utf8 string contains a prefix which is the utf16 string; if so return length of matching utf8 string -static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(stbtt_uint8 *s1, const stbtt_int32 len1, stbtt_uint8 *s2, stbtt_int32 len2) +static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, const stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2) { stbtt_int32 i=0; diff --git a/input/gamepadinput.cpp b/input/gamepadinput.cpp index ac819b82..3a165dc6 100644 --- a/input/gamepadinput.cpp +++ b/input/gamepadinput.cpp @@ -125,7 +125,7 @@ gamepad_input::poll() { } void -gamepad_input::bind( std::vector< std::reference_wrapper > &Targets, cParser &Input, std::unordered_map const &Translator, std::string const Point ) { +gamepad_input::bind(const std::vector< std::reference_wrapper > &Targets, cParser &Input, std::unordered_map const &Translator, std::string const Point ) { for( auto &bindingtarget : Targets ) { // grab command(s) associated with the input pin diff --git a/input/gamepadinput.h b/input/gamepadinput.h index 251ef75a..9fff205f 100644 --- a/input/gamepadinput.h +++ b/input/gamepadinput.h @@ -77,7 +77,7 @@ private: using inputaxis_sequence = std::vector; // methods bool recall_bindings(); - static void bind( std::vector< std::reference_wrapper > &Targets, cParser &Input, std::unordered_map const &Translator, std::string Point ); + static void bind(const 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/launcher/vehicle_picker.cpp b/launcher/vehicle_picker.cpp index 8bf9927b..7ac0414c 100644 --- a/launcher/vehicle_picker.cpp +++ b/launcher/vehicle_picker.cpp @@ -219,7 +219,7 @@ std::vector ui::vehiclepicker_panel::parse return info_list; } -bool ui::vehiclepicker_panel::skin_filter(const skin_set *skin, std::vector &info_list) +bool ui::vehiclepicker_panel::skin_filter(const skin_set *skin, const std::vector &info_list) { bool any = false; bool alternative_present = false; diff --git a/launcher/vehicle_picker.h b/launcher/vehicle_picker.h index 6ef8c6f1..895da148 100644 --- a/launcher/vehicle_picker.h +++ b/launcher/vehicle_picker.h @@ -60,6 +60,6 @@ private: }; static std::vector parse_search_query(const std::string &str); - static bool skin_filter(const skin_set *skin, std::vector &info_list); + static bool skin_filter(const skin_set *skin, const std::vector &info_list); }; } // namespace ui diff --git a/scene/scene.cpp b/scene/scene.cpp index 920c275d..dbaefc87 100644 --- a/scene/scene.cpp +++ b/scene/scene.cpp @@ -429,7 +429,7 @@ basic_cell::erase( TAnimModel *Instance ) { m_instancetranslucent.erase( std::remove_if( std::begin( m_instancetranslucent ), std::end( m_instancetranslucent ), - [=]( TAnimModel *instance ) { + [=](const TAnimModel *instance ) { return instance == Instance; } ), std::end( m_instancetranslucent ) ); } @@ -439,7 +439,7 @@ basic_cell::erase( TAnimModel *Instance ) { m_instancesopaque.erase( std::remove_if( std::begin( m_instancesopaque ), std::end( m_instancesopaque ), - [=]( TAnimModel *instance ) { + [=](const TAnimModel *instance ) { return instance == Instance; } ), std::end( m_instancesopaque ) ); // also remove from the per-(pModel, skins) instance bucket if present @@ -466,12 +466,12 @@ basic_cell::erase( TAnimModel *Instance ) { // removes provided memory cell from the cell void -basic_cell::erase( TMemCell *Memorycell ) { +basic_cell::erase(const TMemCell *Memorycell ) { m_memorycells.erase( std::remove_if( std::begin( m_memorycells ), std::end( m_memorycells ), - [=]( TMemCell *memorycell ) { + [=](const TMemCell *memorycell ) { return memorycell == Memorycell; } ), std::end( m_memorycells ) ); } @@ -675,7 +675,7 @@ glm::vec3 basic_cell::find_nearest_track_point(const glm::dvec3 &pos) // executes event assigned to specified launcher void -basic_cell::launch_event( TEventLauncher *Launcher, const bool local_only ) { +basic_cell::launch_event(const TEventLauncher *Launcher, const bool local_only ) { WriteLog( "Eventlauncher: " + Launcher->name() ); if (!local_only) { if( Launcher->Event1 ) { diff --git a/scene/scene.h b/scene/scene.h index f14a434b..400febaa 100644 --- a/scene/scene.h +++ b/scene/scene.h @@ -150,7 +150,7 @@ public: erase( TAnimModel *Instance ); // removes provided memory cell from the cell void - erase( TMemCell *Memorycell ); + erase(const TMemCell *Memorycell ); // find a vehicle located nearest to specified point, within specified radius. reurns: located vehicle and distance std::tuple find( glm::dvec3 const &Point, float Radius, bool Onlycontrolled, bool Findbycoupler ) const; @@ -214,7 +214,7 @@ public: using memorycell_sequence = std::vector; // methods static void - launch_event(TEventLauncher *Launcher, bool local_only); + launch_event(const TEventLauncher *Launcher, bool local_only); void enclose_area( basic_node *Node ); // members diff --git a/scene/scenenodegroups.cpp b/scene/scenenodegroups.cpp index 2cb83e20..3c15b9b9 100644 --- a/scene/scenenodegroups.cpp +++ b/scene/scenenodegroups.cpp @@ -53,7 +53,7 @@ node_groups::close() return handle(); } -bool node_groups::assign_cross_switch(map::track_switch& sw, std::string &sw_name, std::string const &id, const size_t idx) +bool node_groups::assign_cross_switch(map::track_switch& sw, const std::string &sw_name, std::string const &id, const size_t idx) { sw.action[idx] = simulation::Events.FindEvent(sw_name + ":" + id); if (!sw.action[idx]) diff --git a/scene/scenenodegroups.h b/scene/scenenodegroups.h index c591f9f3..ff74e34f 100644 --- a/scene/scenenodegroups.h +++ b/scene/scenenodegroups.h @@ -65,7 +65,7 @@ private: group_handle create_handle(); static bool - assign_cross_switch(map::track_switch&sw, std::string &sw_name, const std::string &id, size_t idx); + assign_cross_switch(map::track_switch&sw, const std::string &sw_name, const std::string &id, size_t idx); // members group_map m_groupmap; // map of established node groups std::stack m_activegroup; // helper, group to be assigned to newly created nodes diff --git a/scripting/PyInt.cpp b/scripting/PyInt.cpp index 6cc514a8..9e12daa7 100644 --- a/scripting/PyInt.cpp +++ b/scripting/PyInt.cpp @@ -514,7 +514,7 @@ auto python_taskqueue::fetch_renderer(std::string const Renderer) -> PyObject * return renderer; } -void python_taskqueue::run(GLFWwindow *Context, rendertask_sequence &Tasks, uploadtask_sequence &Upload_Tasks, threading::condition_variable &Condition, std::atomic &Exit) +void python_taskqueue::run(GLFWwindow *Context, rendertask_sequence &Tasks, uploadtask_sequence &Upload_Tasks, threading::condition_variable &Condition, const std::atomic &Exit) { if (Context) diff --git a/scripting/PyInt.h b/scripting/PyInt.h index 5b64c28d..0da7704c 100644 --- a/scripting/PyInt.h +++ b/scripting/PyInt.h @@ -132,7 +132,7 @@ class python_taskqueue using uploadtask_sequence = threading::lockable>>; // methods auto fetch_renderer(std::string Renderer) -> PyObject *; - void run(GLFWwindow *Context, rendertask_sequence &Tasks, uploadtask_sequence &Upload_Tasks, threading::condition_variable &Condition, std::atomic &Exit); + void run(GLFWwindow *Context, rendertask_sequence &Tasks, uploadtask_sequence &Upload_Tasks, threading::condition_variable &Condition, const std::atomic &Exit); void error(); // members diff --git a/scripting/pythonscreenviewer.cpp b/scripting/pythonscreenviewer.cpp index db3fe308..13333762 100644 --- a/scripting/pythonscreenviewer.cpp +++ b/scripting/pythonscreenviewer.cpp @@ -185,7 +185,7 @@ void python_screen_viewer::threadfunc() } } -void python_screen_viewer::notify_window_fb_size(GLFWwindow *window, const int w, const int h) +void python_screen_viewer::notify_window_fb_size(const GLFWwindow *window, const int w, const int h) { for (const auto &conf : m_windows) { if (conf->window == window) { @@ -196,7 +196,7 @@ void python_screen_viewer::notify_window_fb_size(GLFWwindow *window, const int w } } -void python_screen_viewer::notify_window_size(GLFWwindow *window, const int w, const int h) +void python_screen_viewer::notify_window_size(const GLFWwindow *window, const int w, const int h) { for (const auto &conf : m_windows) { if (conf->window == window) { @@ -207,7 +207,7 @@ void python_screen_viewer::notify_window_size(GLFWwindow *window, const int w, c } } -void python_screen_viewer::notify_cursor_pos(GLFWwindow *window, const double x, const double y) +void python_screen_viewer::notify_cursor_pos(const GLFWwindow *window, const double x, const double y) { for (const auto &conf : m_windows) { if (conf->window == window) { diff --git a/scripting/pythonscreenviewer.h b/scripting/pythonscreenviewer.h index bd0634c3..3edf32d7 100644 --- a/scripting/pythonscreenviewer.h +++ b/scripting/pythonscreenviewer.h @@ -38,8 +38,8 @@ public: python_screen_viewer(std::shared_ptr rt, std::shared_ptr> touchlist, std::string name); ~python_screen_viewer(); - void notify_window_size(GLFWwindow *window, int w, int h); - void notify_window_fb_size(GLFWwindow *window, int w, int h); - void notify_cursor_pos(GLFWwindow *window, double x, double y); + void notify_window_size(const GLFWwindow *window, int w, int h); + void notify_window_fb_size(const GLFWwindow *window, int w, int h); + void notify_cursor_pos(const GLFWwindow *window, double x, double y); void notify_click(GLFWwindow *window, int button, int action); }; diff --git a/simulation/simulation.cpp b/simulation/simulation.cpp index 9de3cada..5a8f6771 100644 --- a/simulation/simulation.cpp +++ b/simulation/simulation.cpp @@ -503,7 +503,7 @@ void state_manager::delete_eventlauncher(TEventLauncher *launcher) { // passes specified sound to all vehicles within range as a radio message broadcasted on specified channel void -radio_message( sound_source *Message, int const Channel ) { +radio_message(const sound_source *Message, int const Channel ) { if( Train != nullptr ) { Train->radio_message( Message, Channel ); diff --git a/simulation/simulation.h b/simulation/simulation.h index 75975e14..2bd79799 100644 --- a/simulation/simulation.h +++ b/simulation/simulation.h @@ -68,7 +68,7 @@ private: }; // passes specified sound to all vehicles within range as a radio message broadcasted on specified channel -void radio_message( sound_source *Message, int Channel ); +void radio_message(const sound_source *Message, int Channel ); extern state_manager State; extern event_manager Events; diff --git a/simulation/simulationstateserializer.cpp b/simulation/simulationstateserializer.cpp index 4f4bac69..9f9cdec0 100644 --- a/simulation/simulationstateserializer.cpp +++ b/simulation/simulationstateserializer.cpp @@ -662,7 +662,7 @@ state_serializer::deserialize_origin( cParser &Input, scene::scratch_data &Scrat } void -state_serializer::deserialize_endorigin( cParser &Input, scene::scratch_data &Scratchpad ) { +state_serializer::deserialize_endorigin(const cParser &Input, scene::scratch_data &Scratchpad ) { if( false == Scratchpad.location.offset.empty() ) { Scratchpad.location.offset.pop(); @@ -696,7 +696,7 @@ state_serializer::deserialize_scale( cParser &Input, scene::scratch_data &Scratc } void -state_serializer::deserialize_endscale( cParser &Input, scene::scratch_data &Scratchpad ) { +state_serializer::deserialize_endscale(const cParser &Input, scene::scratch_data &Scratchpad ) { if( false == Scratchpad.location.scale.empty() ) { Scratchpad.location.scale.pop(); @@ -832,7 +832,7 @@ state_serializer::deserialize_editorterrain(cParser &Input, scene::scratch_data } void -state_serializer::deserialize_endtrainset( cParser &Input, scene::scratch_data &Scratchpad ) { +state_serializer::deserialize_endtrainset(const cParser &Input, scene::scratch_data &Scratchpad ) { if( false == Scratchpad.trainset.is_open || true == Scratchpad.trainset.vehicles.empty() ) { @@ -920,7 +920,7 @@ state_serializer::deserialize_traction( cParser &Input, scene::scratch_data &Scr } TTractionPowerSource * -state_serializer::deserialize_tractionpowersource( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ) { +state_serializer::deserialize_tractionpowersource( cParser &Input, const scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ) { if( false == Global.bLoadTraction ) { skip_until( Input, "end" ); @@ -936,7 +936,7 @@ state_serializer::deserialize_tractionpowersource( cParser &Input, scene::scratc } TMemCell * -state_serializer::deserialize_memorycell( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ) { +state_serializer::deserialize_memorycell( cParser &Input, const scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ) { auto *memorycell = new TMemCell( Nodedata ); memorycell->Load( &Input ); diff --git a/simulation/simulationstateserializer.h b/simulation/simulationstateserializer.h index 7b73082e..c15a36bc 100644 --- a/simulation/simulationstateserializer.h +++ b/simulation/simulationstateserializer.h @@ -64,9 +64,9 @@ private: void deserialize_light( cParser &Input, scene::scratch_data &Scratchpad ); void deserialize_node( 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_endorigin(const 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_endscale(const 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 ); @@ -74,11 +74,11 @@ private: 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 ); - static void deserialize_endtrainset( cParser &Input, scene::scratch_data &Scratchpad ); + static void deserialize_endtrainset(const 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 ); + TTractionPowerSource * deserialize_tractionpowersource( cParser &Input, const scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ); + TMemCell * deserialize_memorycell( cParser &Input, const scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ); TEventLauncher * deserialize_eventlauncher( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ); 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 ); diff --git a/stb/stb_image.h b/stb/stb_image.h index 1d7148ae..7940c538 100644 --- a/stb/stb_image.h +++ b/stb/stb_image.h @@ -832,7 +832,7 @@ static void stbi__start_mem(stbi__context *s, stbi_uc const *buffer, const int l } // initialize a callback-based context -static void stbi__start_callbacks(stbi__context *s, stbi_io_callbacks *c, void *user) +static void stbi__start_callbacks(stbi__context *s, const stbi_io_callbacks *c, void *user) { s->io = *c; s->io_user_data = user; @@ -906,7 +906,7 @@ typedef struct #ifndef STBI_NO_JPEG static int stbi__jpeg_test(stbi__context *s); -static void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, const stbi__result_info *ri); static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp); #endif @@ -925,7 +925,7 @@ static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp); #ifndef STBI_NO_TGA static int stbi__tga_test(stbi__context *s); -static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, const stbi__result_info *ri); static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp); #endif @@ -938,19 +938,19 @@ static int stbi__psd_is16(stbi__context *s); #ifndef STBI_NO_HDR static int stbi__hdr_test(stbi__context *s); -static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, const stbi__result_info *ri); static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp); #endif #ifndef STBI_NO_PIC static int stbi__pic_test(stbi__context *s); -static void *stbi__pic_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static void *stbi__pic_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, const stbi__result_info *ri); static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp); #endif #ifndef STBI_NO_GIF static int stbi__gif_test(stbi__context *s); -static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, const stbi__result_info *ri); static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y, int *z, int *comp, int req_comp); static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp); #endif @@ -1310,7 +1310,7 @@ static stbi__uint16 *stbi__load_and_postprocess_16bit(stbi__context *s, int *x, } #if !defined(STBI_NO_HDR) && !defined(STBI_NO_LINEAR) -static void stbi__float_postprocess(float *result, int *x, int *y, int *comp, const int req_comp) +static void stbi__float_postprocess(float *result, const int *x, const int *y, const int *comp, const int req_comp) { if (stbi__vertically_flip_on_load && result != NULL) { const int channels = req_comp ? req_comp : *comp; @@ -1624,7 +1624,7 @@ stbi_inline static stbi_uc stbi__get8(stbi__context *s) #if defined(STBI_NO_JPEG) && defined(STBI_NO_HDR) && defined(STBI_NO_PIC) && defined(STBI_NO_PNM) // nothing #else -stbi_inline static int stbi__at_eof(stbi__context *s) +stbi_inline static int stbi__at_eof(const stbi__context *s) { if (s->io.read) { if (!(s->io.eof)(s->io_user_data)) return 0; @@ -1999,7 +1999,7 @@ typedef struct stbi_uc *(*resample_row_hv_2_kernel)(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs); } stbi__jpeg; -static int stbi__build_huffman(stbi__huffman *h, int *count) +static int stbi__build_huffman(stbi__huffman *h, const int *count) { int i,j,k=0; unsigned int code; @@ -2046,7 +2046,7 @@ static int stbi__build_huffman(stbi__huffman *h, int *count) // build a table that decodes both magnitude and value of small ACs in // one go. -static void stbi__build_fast_ac(stbi__int16 *fast_ac, stbi__huffman *h) +static void stbi__build_fast_ac(stbi__int16 *fast_ac, const stbi__huffman *h) { int i; for (i=0; i < (1 << FAST_BITS); ++i) { @@ -2093,7 +2093,7 @@ static void stbi__grow_buffer_unsafe(stbi__jpeg *j) static const stbi__uint32 stbi__bmask[17]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535}; // decode a jpeg huffman value from the bitstream -stbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffman *h) +stbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, const stbi__huffman *h) { unsigned int temp; int c,k; @@ -2206,7 +2206,7 @@ static const stbi_uc stbi__jpeg_dezigzag[64+15] = }; // decode one 64-entry block-- -static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, const int b, stbi__uint16 *dequant) +static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, const stbi__int16 *fac, const int b, const stbi__uint16 *dequant) { int diff,dc,k; int t; @@ -2291,7 +2291,7 @@ static int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64], stbi__ // @OPTIMIZE: store non-zigzagged during the decode passes, // and only de-zigzag when dequantizing -static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__huffman *hac, stbi__int16 *fac) +static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__huffman *hac, const stbi__int16 *fac) { int k; if (j->spec_start == 0) return stbi__err("can't merge dc and ac", "Corrupt JPEG"); @@ -3069,7 +3069,7 @@ static int stbi__parse_entropy_coded_data(stbi__jpeg *z) } } -static void stbi__jpeg_dequantize(short *data, stbi__uint16 *dequant) +static void stbi__jpeg_dequantize(short *data, const stbi__uint16 *dequant) { int i; for (i=0; i < 64; ++i) @@ -3385,7 +3385,7 @@ static int stbi__decode_jpeg_header(stbi__jpeg *z, const int scan) return 1; } -static stbi_uc stbi__skip_jpeg_junk_at_end(stbi__jpeg *j) +static stbi_uc stbi__skip_jpeg_junk_at_end(const stbi__jpeg *j) { // some JPEGs have junk at end, skip over it but if we find what looks // like a valid marker, resume there @@ -3452,7 +3452,7 @@ typedef stbi_uc *(*resample_row_func)(stbi_uc *out, stbi_uc *in0, stbi_uc *in1, #define stbi__div4(x) ((stbi_uc) ((x) >> 2)) -static stbi_uc *resample_row_1(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, const int w, const int hs) +static stbi_uc *resample_row_1(const stbi_uc *out, stbi_uc *in_near, const stbi_uc *in_far, const int w, const int hs) { STBI_NOTUSED(out); STBI_NOTUSED(in_far); @@ -3461,7 +3461,7 @@ static stbi_uc *resample_row_1(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, return in_near; } -static stbi_uc* stbi__resample_row_v_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, const int w, const int hs) +static stbi_uc* stbi__resample_row_v_2(stbi_uc *out, const stbi_uc *in_near, const stbi_uc *in_far, const int w, const int hs) { // need to generate two samples vertically for every one in input int i; @@ -3471,7 +3471,7 @@ static stbi_uc* stbi__resample_row_v_2(stbi_uc *out, stbi_uc *in_near, stbi_uc * return out; } -static stbi_uc* stbi__resample_row_h_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, const int w, const int hs) +static stbi_uc* stbi__resample_row_h_2(stbi_uc *out, const stbi_uc *in_near, const stbi_uc *in_far, const int w, const int hs) { // need to generate two samples horizontally for every one in input int i; @@ -3501,7 +3501,7 @@ static stbi_uc* stbi__resample_row_h_2(stbi_uc *out, stbi_uc *in_near, stbi_uc #define stbi__div16(x) ((stbi_uc) ((x) >> 4)) -static stbi_uc *stbi__resample_row_hv_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, const int w, const int hs) +static stbi_uc *stbi__resample_row_hv_2(stbi_uc *out, const stbi_uc *in_near, const stbi_uc *in_far, const int w, const int hs) { // need to generate 2x2 samples for every one in input int i,t0,t1; @@ -3642,7 +3642,7 @@ static stbi_uc *stbi__resample_row_hv_2_simd(stbi_uc *out, stbi_uc *in_near, stb } #endif -static stbi_uc *stbi__resample_row_generic(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, const int w, const int hs) +static stbi_uc *stbi__resample_row_generic(stbi_uc *out, const stbi_uc *in_near, const stbi_uc *in_far, const int w, const int hs) { // resample with nearest-neighbor int i,j; @@ -4024,7 +4024,7 @@ static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, int *comp } } -static void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, const int req_comp, stbi__result_info *ri) +static void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, const int req_comp, const stbi__result_info *ri) { unsigned char* result; stbi__jpeg* j = (stbi__jpeg*) stbi__malloc(sizeof(stbi__jpeg)); @@ -4188,7 +4188,7 @@ typedef struct stbi__zhuffman z_length, z_distance; } stbi__zbuf; -stbi_inline static int stbi__zeof(stbi__zbuf *z) +stbi_inline static int stbi__zeof(const stbi__zbuf *z) { return (z->zbuffer >= z->zbuffer_end); } @@ -4220,7 +4220,7 @@ stbi_inline static unsigned int stbi__zreceive(stbi__zbuf *z, const int n) return k; } -static int stbi__zhuffman_decode_slowpath(stbi__zbuf *a, stbi__zhuffman *z) +static int stbi__zhuffman_decode_slowpath(stbi__zbuf *a, const stbi__zhuffman *z) { int b,s,k; // not resolved by fast table, so compute it the slow way @@ -4671,7 +4671,7 @@ static const stbi_uc stbi__depth_scale_table[9] = { 0, 0xff, 0x55, 0, 0x11, 0,0, // adds an extra all-255 alpha channel // dest == src is legal // img_n must be 1 or 3 -static void stbi__create_png_alpha_expand8(stbi_uc *dest, stbi_uc *src, const stbi__uint32 x, const int img_n) +static void stbi__create_png_alpha_expand8(stbi_uc *dest, const stbi_uc *src, const stbi__uint32 x, const int img_n) { int i; // must process data backwards since we allow dest==src @@ -4692,7 +4692,7 @@ static void stbi__create_png_alpha_expand8(stbi_uc *dest, stbi_uc *src, const st } // create the png data from post-deflated data -static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, const stbi__uint32 raw_len, const int out_n, const stbi__uint32 x, const stbi__uint32 y, const int depth, const int color) +static int stbi__create_png_image_raw(stbi__png *a, const stbi_uc *raw, const stbi__uint32 raw_len, const int out_n, const stbi__uint32 x, const stbi__uint32 y, const int depth, const int color) { const int bytes = (depth == 16 ? 2 : 1); const stbi__context *s = a->s; @@ -4902,7 +4902,7 @@ static int stbi__create_png_image(stbi__png *a, stbi_uc *image_data, stbi__uint3 return 1; } -static int stbi__compute_transparency(stbi__png *z, stbi_uc tc[3], const int out_n) +static int stbi__compute_transparency(const stbi__png *z, stbi_uc tc[3], const int out_n) { const stbi__context *s = z->s; stbi__uint32 i, pixel_count = s->img_x * s->img_y; @@ -4927,7 +4927,7 @@ static int stbi__compute_transparency(stbi__png *z, stbi_uc tc[3], const int out return 1; } -static int stbi__compute_transparency16(stbi__png *z, stbi__uint16 tc[3], const int out_n) +static int stbi__compute_transparency16(const stbi__png *z, stbi__uint16 tc[3], const int out_n) { const stbi__context *s = z->s; stbi__uint32 i, pixel_count = s->img_x * s->img_y; @@ -4952,7 +4952,7 @@ static int stbi__compute_transparency16(stbi__png *z, stbi__uint16 tc[3], const return 1; } -static int stbi__expand_png_palette(stbi__png *a, stbi_uc *palette, const int len, const int pal_img_n) +static int stbi__expand_png_palette(stbi__png *a, const stbi_uc *palette, const int len, const int pal_img_n) { stbi__uint32 i, pixel_count = a->s->img_x * a->s->img_y; stbi_uc *p, *temp_out, *orig = a->out; @@ -5029,7 +5029,7 @@ STBIDEF void stbi_convert_iphone_png_to_rgb_thread(const int flag_true_if_should : stbi__de_iphone_flag_global) #endif // STBI_THREAD_LOCAL -static void stbi__de_iphone(stbi__png *z) +static void stbi__de_iphone(const stbi__png *z) { const stbi__context *s = z->s; stbi__uint32 i, pixel_count = s->img_x * s->img_y; @@ -5865,7 +5865,7 @@ static void stbi__tga_read_rgb16(stbi__context *s, stbi_uc* out) // so let's treat all 15 and 16bit TGAs as RGB with no alpha. } -static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, const int req_comp, stbi__result_info *ri) +static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, const int req_comp, const stbi__result_info *ri) { // read in the TGA header stuff const int tga_offset = stbi__get8(s); @@ -6494,7 +6494,7 @@ static stbi_uc *stbi__pic_load_core(stbi__context *s, const int width, const int return result; } -static void *stbi__pic_load(stbi__context *s,int *px,int *py,int *comp,int req_comp, stbi__result_info *ri) +static void *stbi__pic_load(stbi__context *s,int *px,int *py,int *comp,int req_comp, const stbi__result_info *ri) { stbi_uc *result; int i, x,y, internal_comp; @@ -6772,7 +6772,7 @@ static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g) // this function is designed to support animated gifs, although stb_image doesn't support it // two back is the image from two frames ago, used for a very specific disposal format -static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, const int req_comp, stbi_uc *two_back) +static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, const int req_comp, const stbi_uc *two_back) { int dispose; int first_frame; @@ -6946,7 +6946,7 @@ static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, c } } -static void *stbi__load_gif_main_outofmem(stbi__gif *g, stbi_uc *out, int **delays) +static void *stbi__load_gif_main_outofmem(const stbi__gif *g, stbi_uc *out, int **delays) { STBI_FREE(g->out); STBI_FREE(g->history); @@ -7042,7 +7042,7 @@ static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y, } } -static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, const int req_comp, stbi__result_info *ri) +static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, const int req_comp, const stbi__result_info *ri) { stbi_uc *u = 0; stbi__gif g; @@ -7125,7 +7125,7 @@ static char *stbi__hdr_gettoken(stbi__context *z, char *buffer) return buffer; } -static void stbi__hdr_convert(float *output, stbi_uc *input, const int req_comp) +static void stbi__hdr_convert(float *output, const stbi_uc *input, const int req_comp) { if ( input[3] != 0 ) { float f1; @@ -7152,7 +7152,7 @@ static void stbi__hdr_convert(float *output, stbi_uc *input, const int req_comp) } } -static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) +static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, const stbi__result_info *ri) { char buffer[STBI__HDR_BUFLEN]; char *token; diff --git a/stb/stb_image_write.h b/stb/stb_image_write.h index e6b86c4b..14c56007 100644 --- a/stb/stb_image_write.h +++ b/stb/stb_image_write.h @@ -280,7 +280,7 @@ static void stbi__start_write_callbacks(stbi__write_context *s, stbi_write_func #ifndef STBI_WRITE_NO_STDIO -static void stbi__stdio_write(void *context, void *data, const int size) +static void stbi__stdio_write(void *context, const void *data, const int size) { fwrite(data,1,size,(FILE*) context); } @@ -335,7 +335,7 @@ static int stbi__start_write_file(stbi__write_context *s, const char *filename) return f != NULL; } -static void stbi__end_write_file(stbi__write_context *s) +static void stbi__end_write_file(const stbi__write_context *s) { fclose((FILE *)s->context); } @@ -345,7 +345,7 @@ static void stbi__end_write_file(stbi__write_context *s) typedef unsigned int stbiw_uint32; typedef int stb_image_write_test[sizeof(stbiw_uint32)==4 ? 1 : -1]; -static void stbiw__writefv(stbi__write_context *s, const char *fmt, va_list v) +static void stbiw__writefv(const stbi__write_context *s, const char *fmt, va_list v) { while (*fmt) { switch (*fmt++) { @@ -392,7 +392,7 @@ static void stbiw__write_flush(stbi__write_context *s) } } -static void stbiw__putc(stbi__write_context *s, unsigned char c) +static void stbiw__putc(const stbi__write_context *s, unsigned char c) { s->func(s->context, &c, 1); } @@ -416,7 +416,7 @@ static void stbiw__write3(stbi__write_context *s, const unsigned char a, const u s->buffer[n+2] = c; } -static void stbiw__write_pixel(stbi__write_context *s, const int rgb_dir, const int comp, const int write_alpha, const int expand_mono, unsigned char *d) +static void stbiw__write_pixel(stbi__write_context *s, const int rgb_dir, const int comp, const int write_alpha, const int expand_mono, const unsigned char *d) { unsigned char bg[3] = { 255, 0, 255}, px[3]; int k; @@ -625,7 +625,7 @@ STBIWDEF int stbi_write_tga(char const *filename, const int x, const int y, cons #define stbiw__max(a, b) ((a) > (b) ? (a) : (b)) -static void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear) +static void stbiw__linear_to_rgbe(unsigned char *rgbe, const float *linear) { int exponent; const float maxcomp = stbiw__max(linear[0], stbiw__max(linear[1], linear[2])); @@ -642,7 +642,7 @@ static void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear) } } -static void stbiw__write_run_data(stbi__write_context *s, const int length, unsigned char databyte) +static void stbiw__write_run_data(const stbi__write_context *s, const int length, unsigned char databyte) { unsigned char lengthbyte = STBIW_UCHAR(length+128); STBIW_ASSERT(length+128 <= 255); @@ -650,7 +650,7 @@ static void stbiw__write_run_data(stbi__write_context *s, const int length, unsi s->func(s->context, &databyte, 1); } -static void stbiw__write_dump_data(stbi__write_context *s, const int length, unsigned char *data) +static void stbiw__write_dump_data(const stbi__write_context *s, const int length, unsigned char *data) { unsigned char lengthbyte = STBIW_UCHAR(length); STBIW_ASSERT(length <= 128); // inconsistent with spec but consistent with official code @@ -658,7 +658,7 @@ static void stbiw__write_dump_data(stbi__write_context *s, const int length, uns s->func(s->context, data, length); } -static void stbiw__write_hdr_scanline(stbi__write_context *s, const int width, const int ncomp, unsigned char *scratch, float *scanline) +static void stbiw__write_hdr_scanline(stbi__write_context *s, const int width, const int ncomp, unsigned char *scratch, const float *scanline) { unsigned char scanlineheader[4] = { 2, 2, 0, 0 }; unsigned char rgbe[4]; @@ -846,7 +846,7 @@ static int stbiw__zlib_bitrev(int code, int codebits) return res; } -static unsigned int stbiw__zlib_countm(unsigned char *a, unsigned char *b, const int limit) +static unsigned int stbiw__zlib_countm(const unsigned char *a, const unsigned char *b, const int limit) { int i; for (i=0; i < limit && i < 258; ++i) @@ -854,7 +854,7 @@ static unsigned int stbiw__zlib_countm(unsigned char *a, unsigned char *b, const return i; } -static unsigned int stbiw__zhash(unsigned char *data) +static unsigned int stbiw__zhash(const unsigned char *data) { stbiw_uint32 hash = data[0] + (data[1] << 8) + (data[2] << 16); hash ^= hash << 3; @@ -1062,7 +1062,7 @@ static unsigned char stbiw__paeth(const int a, const int b, const int c) } // @OPTIMIZE: provide an option that always forces left-predict or paeth predict -static void stbiw__encode_png_line(unsigned char *pixels, const int stride_bytes, const int width, const int height, const int y, const int n, const int filter_type, signed char *line_buffer) +static void stbiw__encode_png_line(const unsigned char *pixels, const int stride_bytes, const int width, const int height, const int y, const int n, const int filter_type, signed char *line_buffer) { static int mapping[] = { 0,1,2,3,4 }; static int firstmap[] = { 0,1,0,5,6 }; @@ -1298,7 +1298,7 @@ static void stbiw__jpg_calcBits(int val, unsigned short bits[2]) { bits[0] = val & ((1<x * q->x, yy = q->y * q->y, zz = q->z * q->z; float xy = q->x * q->y, xz = q->x * q->z, yz = q->y * q->z; diff --git a/utilities/Float3d.h b/utilities/Float3d.h index 8fe92e50..fd3e30dd 100644 --- a/utilities/Float3d.h +++ b/utilities/Float3d.h @@ -254,7 +254,7 @@ public: return false; return true; } - void Quaternion(float4 *q); + void Quaternion(const float4 *q); float3 *TranslationGet() { return (float3 *)(e + 12); diff --git a/vehicle/AirCoupler.cpp b/vehicle/AirCoupler.cpp index 4db2adad..b60a5461 100644 --- a/vehicle/AirCoupler.cpp +++ b/vehicle/AirCoupler.cpp @@ -51,7 +51,7 @@ void AirCoupler::Clear() /** * Looks for submodels in the model and updates pointers. */ -void AirCoupler::Init(std::string const &asName, TModel3d *Model) +void AirCoupler::Init(std::string const &asName, const TModel3d *Model) { if (!Model) return; diff --git a/vehicle/AirCoupler.h b/vehicle/AirCoupler.h index b2d299a6..0567bb91 100644 --- a/vehicle/AirCoupler.h +++ b/vehicle/AirCoupler.h @@ -25,7 +25,7 @@ public: ///Reset members. void Clear(); ///Looks for submodels. - void Init(std::string const &asName, TModel3d *Model); + void Init(std::string const &asName, const TModel3d *Model); ///Loads info about coupler. void Load(cParser *Parser, TModel3d *Model); int GetStatus(); diff --git a/vehicle/Driver.cpp b/vehicle/Driver.cpp index ad5d5654..e47ae129 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 ) +std::vector TController::CheckTrackEvent(const 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 ) }; @@ -5258,7 +5258,7 @@ std::string TController::StopReasonText() const //- rozpoznają tylko zerową prędkość (jako koniec toru i brak podstaw do dalszego skanowania) //---------------------------------------------------------------------------------------------------------------------- -bool TController::IsOccupiedByAnotherConsist( TTrack *Track, double const Distance = 0 ) +bool TController::IsOccupiedByAnotherConsist(const TTrack *Track, double const Distance = 0 ) { // najpierw sprawdzamy, czy na danym torze są pojazdy z innego składu if( false == Track->Dynamics.empty() ) { for (const auto dynamic : Track->Dynamics ) { @@ -5827,7 +5827,7 @@ std::string TController::TableText( std::size_t const Index ) const } }; -int TController::CrossRoute(TTrack *tr) +int TController::CrossRoute(const TTrack *tr) { // zwraca numer segmentu dla skrzyżowania (tr) // pożądany numer segmentu jest określany podczas skanowania drogi // droga powinna być określona sposobem przejazdu przez skrzyżowania albo współrzędnymi miejsca @@ -6037,7 +6037,7 @@ TController::determine_consist_state() { pVehicle->for_each( control, - [this]( TDynamicObject * Vehicle ) { + [this](const TDynamicObject * Vehicle ) { auto const *vehicle { Vehicle->MoverParameters }; IsAnyConverterOverloadRelayOpen |= vehicle->ConvOvldFlag; IsAnyMotorOverloadRelayOpen |= vehicle->FuseFlag; diff --git a/vehicle/Driver.h b/vehicle/Driver.h index c94019e4..de31c0d3 100644 --- a/vehicle/Driver.h +++ b/vehicle/Driver.h @@ -482,13 +482,13 @@ private: // scantable // methods public: - int CrossRoute( TTrack *tr ); + int CrossRoute(const TTrack *tr ); void MoveDistanceAdd(const double distance ) { dMoveLen += distance * iDirection; } //jak jedzie do tyłu to trzeba uwzględniać, że distance jest ujemna private: // Ra: metody obsługujące skanowanie toru - static std::vector CheckTrackEvent( TTrack *Track, double fDirection ); + static std::vector CheckTrackEvent(const TTrack *Track, double fDirection ); bool TableAddNew(); bool TableNotFound( basic_event const *Event, double Distance ) const; void TableTraceRoute( double fDistance, TDynamicObject *pVehicle ); @@ -510,7 +510,7 @@ private: void TableClear(); int TableDirection() { return iTableDirection; } // Ra: stare funkcje skanujące, używane do szukania sygnalizatora z tyłu - bool IsOccupiedByAnotherConsist( TTrack *Track, double Distance ); + bool IsOccupiedByAnotherConsist(const TTrack *Track, double Distance ); 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 ); diff --git a/vehicle/DynObj.cpp b/vehicle/DynObj.cpp index f2c181e7..85cee419 100644 --- a/vehicle/DynObj.cpp +++ b/vehicle/DynObj.cpp @@ -50,7 +50,7 @@ bool TDynamicObject::bDynamicRemove { false }; // helper, locates submodel with specified name in specified 3d model; returns: pointer to the submodel, or null TSubModel * -GetSubmodelFromName( TModel3d * const Model, std::string const Name ) { +GetSubmodelFromName(const TModel3d * const Model, std::string const Name ) { return Model ? Model->GetFromName(Name) : nullptr; } @@ -550,7 +550,7 @@ void TDynamicObject::SetPneumatic(const bool front, const bool red) } // który pokazywać z tyłu } -void TDynamicObject::UpdateAxle(TAnim *pAnim) +void TDynamicObject::UpdateAxle(const TAnim *pAnim) { // animacja osi const size_t wheel_id = pAnim->dWheelAngle; pAnim->smAnimated->SetRotate(float3(1, 0, 0), dWheelAngle[wheel_id]); @@ -558,7 +558,7 @@ void TDynamicObject::UpdateAxle(TAnim *pAnim) }; // animacja drzwi - przesuw -void TDynamicObject::UpdateDoorTranslate(TAnim *pAnim) { +void TDynamicObject::UpdateDoorTranslate(const TAnim *pAnim) { if( pAnim->smAnimated == nullptr ) { return; } auto const &door { MoverParameters->Doors.instances[ ( @@ -574,7 +574,7 @@ void TDynamicObject::UpdateDoorTranslate(TAnim *pAnim) { }; // animacja drzwi - obrót -void TDynamicObject::UpdateDoorRotate(TAnim *pAnim) { +void TDynamicObject::UpdateDoorRotate(const TAnim *pAnim) { if( pAnim->smAnimated == nullptr ) { return; } @@ -589,7 +589,7 @@ void TDynamicObject::UpdateDoorRotate(TAnim *pAnim) { }; // animacja drzwi - obrót -void TDynamicObject::UpdateDoorFold(TAnim *pAnim) { +void TDynamicObject::UpdateDoorFold(const TAnim *pAnim) { if( pAnim->smAnimated == nullptr ) { return; } @@ -621,7 +621,7 @@ void TDynamicObject::UpdateDoorFold(TAnim *pAnim) { }; // animacja drzwi - odskokprzesuw -void TDynamicObject::UpdateDoorPlug(TAnim *pAnim) { +void TDynamicObject::UpdateDoorPlug(const TAnim *pAnim) { if( pAnim->smAnimated == nullptr ) { return; } @@ -641,7 +641,7 @@ void TDynamicObject::UpdateDoorPlug(TAnim *pAnim) { door.position - MoverParameters->Doors.range_out * 0.5f ) } ); } -void TDynamicObject::UpdatePant(TAnim *pAnim) +void TDynamicObject::UpdatePant(const TAnim *pAnim) { // animacja pantografu - 4 obracane ramiona, ślizg piąty float a, b, c; a = glm::degrees(pAnim->fParamPants->fAngleL - pAnim->fParamPants->fAngleL0); @@ -660,7 +660,7 @@ void TDynamicObject::UpdatePant(TAnim *pAnim) } // doorstep animation, shift -void TDynamicObject::UpdatePlatformTranslate( TAnim *pAnim ) { +void TDynamicObject::UpdatePlatformTranslate(const TAnim *pAnim ) { if( pAnim->smAnimated == nullptr ) { return; } @@ -677,7 +677,7 @@ void TDynamicObject::UpdatePlatformTranslate( TAnim *pAnim ) { } // doorstep animation, rotate -void TDynamicObject::UpdatePlatformRotate( TAnim *pAnim ) { +void TDynamicObject::UpdatePlatformRotate(const TAnim *pAnim ) { if( pAnim->smAnimated == nullptr ) { return; } @@ -692,7 +692,7 @@ void TDynamicObject::UpdatePlatformRotate( TAnim *pAnim ) { } // mirror animation, rotate -void TDynamicObject::UpdateMirror( TAnim *pAnim ) { +void TDynamicObject::UpdateMirror(const TAnim *pAnim ) { if( pAnim->smAnimated == nullptr ) { return; } @@ -713,7 +713,7 @@ void TDynamicObject::UpdateMirror( TAnim *pAnim ) { } // wipers -void TDynamicObject::UpdateWiper(TAnim* pAnim) +void TDynamicObject::UpdateWiper(const TAnim * pAnim) { if (!pAnim || !pAnim->smElement) return; @@ -7691,7 +7691,7 @@ TDynamicObject * TDynamicObject::FindPowered() auto *lookup { find_vehicle( coupling, - []( TDynamicObject * vehicle ) { + [](const TDynamicObject * vehicle ) { return vehicle->MoverParameters->Power > 1.0; } ) }; return lookup != nullptr ? lookup : this; // always return valid vehicle for backward compatibility @@ -7707,7 +7707,7 @@ TDynamicObject::FindPantographCarrier() { auto *result = find_vehicle( coupling, - []( TDynamicObject * vehicle ) { + [](const TDynamicObject * vehicle ) { return vehicle->MoverParameters->EnginePowerSource.SourceType == TPowerSource::CurrentCollector && vehicle->MoverParameters->EnginePowerSource.CollectorParameters.CollectorsNo > 0; } ); if( result != nullptr ) { return result; @@ -7760,7 +7760,7 @@ void TDynamicObject::ParamSet(const int what, const int into) } }; -int TDynamicObject::RouteWish(TTrack *tr) +int TDynamicObject::RouteWish(const TTrack *tr) { // zapytanie do AI, po którym // segmencie (-6..6) jechać na // skrzyżowaniu (tr) diff --git a/vehicle/DynObj.h b/vehicle/DynObj.h index 7c48d4c8..3c3e97f9 100644 --- a/vehicle/DynObj.h +++ b/vehicle/DynObj.h @@ -285,16 +285,16 @@ private: /* void UpdateNone(TAnim *pAnim){}; // animacja pusta (funkcje ustawiania submodeli, gdy blisko kamery) */ - void UpdateAxle(TAnim *pAnim); // animacja osi - void UpdateDoorTranslate(TAnim *pAnim); // animacja drzwi - przesuw - void UpdateDoorRotate(TAnim *pAnim); // animacja drzwi - obrót - void UpdateDoorFold(TAnim *pAnim); // animacja drzwi - składanie - void UpdateDoorPlug(TAnim *pAnim); // animacja drzwi - odskokowo-przesuwne - 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 - void UpdateWiper(TAnim *pAnim); // wiper animation + void UpdateAxle(const TAnim *pAnim); // animacja osi + void UpdateDoorTranslate(const TAnim *pAnim); // animacja drzwi - przesuw + void UpdateDoorRotate(const TAnim *pAnim); // animacja drzwi - obrót + void UpdateDoorFold(const TAnim *pAnim); // animacja drzwi - składanie + void UpdateDoorPlug(const TAnim *pAnim); // animacja drzwi - odskokowo-przesuwne + static void UpdatePant(const TAnim *pAnim); // animacja pantografu + void UpdatePlatformTranslate(const TAnim *pAnim); // doorstep animation, shift + void UpdatePlatformRotate(const TAnim *pAnim); // doorstep animation, rotate + void UpdateMirror(const TAnim *pAnim); // mirror animation + void UpdateWiper(const TAnim *pAnim); // wiper animation /* void UpdateLeverDouble(TAnim *pAnim); // animacja gałki zależna od double void UpdateLeverFloat(TAnim *pAnim); // animacja gałki zależna od float @@ -804,7 +804,7 @@ private: void for_each( coupling Coupling, UnaryFunction_ Function ); void ParamSet(int what, int into); // zapytanie do AI, po którym segmencie skrzyżowania jechać - int RouteWish(TTrack *tr); + int RouteWish(const TTrack *tr); void DestinationSet(std::string to, std::string numer); material_handle DestinationFind( std::string Destination ); void OverheadTrack(float o); diff --git a/vehicle/Train.cpp b/vehicle/Train.cpp index 2ca45bce..7dd573cd 100644 --- a/vehicle/Train.cpp +++ b/vehicle/Train.cpp @@ -1027,7 +1027,7 @@ void TTrain::zero_charging_train_brake() } } -void TTrain::set_train_brake_speed(TDynamicObject *Vehicle, int const Speed) +void TTrain::set_train_brake_speed(const TDynamicObject *Vehicle, int const Speed) { if (true == Vehicle->MoverParameters->BrakeDelaySwitch(Speed)) @@ -1085,7 +1085,7 @@ TDynamicObject *TTrain::find_nearest_consist_vehicle(bool freefly, glm::vec3 pos } // command handlers -void TTrain::OnCommand_aidriverenable(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_aidriverenable(const TTrain *Train, command_data const &Command) { if (Command.action == GLFW_PRESS) @@ -1105,7 +1105,7 @@ void TTrain::OnCommand_aidriverenable(TTrain *Train, command_data const &Command } } -void TTrain::OnCommand_aidriverdisable(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_aidriverdisable(const TTrain *Train, command_data const &Command) { if (Command.action == GLFW_PRESS) @@ -1325,7 +1325,7 @@ void TTrain::OnCommand_mastercontrollerset(TTrain *Train, command_data const &Co Train->m_mastercontrollerreturndelay = EU07_CONTROLLER_BASERETURNDELAY; // NOTE: keyboard return delay is omitted for other input sources } } -void TTrain::OnCommand_DynamicBrakeControllerIncrease(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_DynamicBrakeControllerIncrease(const TTrain *Train, command_data const &Command) { if (Command.action == GLFW_RELEASE) { @@ -1340,7 +1340,7 @@ void TTrain::OnCommand_DynamicBrakeControllerIncrease(TTrain *Train, command_dat Train->mvControlled->IncDynamicBrakeLevel(1.0f); } -void TTrain::OnCommand_DynamicBrakeControllerIncreaseFast(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_DynamicBrakeControllerIncreaseFast(const TTrain *Train, command_data const &Command) { if (Command.action != GLFW_PRESS) { @@ -1354,7 +1354,7 @@ void TTrain::OnCommand_DynamicBrakeControllerIncreaseFast(TTrain *Train, command Train->mvControlled->IncDynamicBrakeLevel(static_cast(Train->mvControlled->DynamicBrakeCtrlPosNo)); } -void TTrain::OnCommand_DynamicBrakeControllerDecrease(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_DynamicBrakeControllerDecrease(const TTrain *Train, command_data const &Command) { if (Command.action == GLFW_RELEASE) { @@ -1369,7 +1369,7 @@ void TTrain::OnCommand_DynamicBrakeControllerDecrease(TTrain *Train, command_dat Train->mvControlled->DecDynamicBrakeLevel(1.0f); } -void TTrain::OnCommand_DynamicBrakeControllerDecreaseFast(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_DynamicBrakeControllerDecreaseFast(const TTrain *Train, command_data const &Command) { if (Command.action != GLFW_PRESS) { @@ -1383,7 +1383,7 @@ void TTrain::OnCommand_DynamicBrakeControllerDecreaseFast(TTrain *Train, command Train->mvControlled->DecDynamicBrakeLevel(static_cast(Train->mvControlled->DynamicBrakeCtrlPosNo)); } -void TTrain::OnCommand_DynamicBrakeControllerSet(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_DynamicBrakeControllerSet(const TTrain *Train, command_data const &Command) { if (Command.action == GLFW_RELEASE) { @@ -1446,7 +1446,7 @@ void TTrain::OnCommand_secondcontrollerincrease(TTrain *Train, command_data cons } } -void TTrain::OnCommand_secondcontrollerincreasefast(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_secondcontrollerincreasefast(const TTrain *Train, command_data const &Command) { if (Command.action != GLFW_RELEASE) @@ -1463,7 +1463,7 @@ void TTrain::OnCommand_secondcontrollerincreasefast(TTrain *Train, command_data } } -void TTrain::OnCommand_notchingrelaytoggle(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_notchingrelaytoggle(const TTrain *Train, command_data const &Command) { if (Command.action == GLFW_PRESS) @@ -1662,7 +1662,7 @@ void TTrain::OnCommand_secondcontrollerdecrease(TTrain *Train, command_data cons } } -void TTrain::OnCommand_secondcontrollerdecreasefast(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_secondcontrollerdecreasefast(const TTrain *Train, command_data const &Command) { if (Command.action != GLFW_RELEASE) @@ -1824,7 +1824,7 @@ void TTrain::OnCommand_independentbrakedecreasefast(TTrain *Train, command_data } } -void TTrain::OnCommand_independentbrakeset(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_independentbrakeset(const TTrain *Train, command_data const &Command) { if (Command.action != GLFW_RELEASE) @@ -2075,7 +2075,7 @@ void TTrain::OnCommand_trainbrakeemergency(TTrain *Train, command_data const &Co } } -void TTrain::OnCommand_trainbrakebasepressureincrease(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_trainbrakebasepressureincrease(const TTrain *Train, command_data const &Command) { if (Command.action != GLFW_RELEASE) @@ -2097,7 +2097,7 @@ void TTrain::OnCommand_trainbrakebasepressureincrease(TTrain *Train, command_dat } } -void TTrain::OnCommand_trainbrakebasepressuredecrease(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_trainbrakebasepressuredecrease(const TTrain *Train, command_data const &Command) { if (Command.action != GLFW_RELEASE) @@ -2119,7 +2119,7 @@ void TTrain::OnCommand_trainbrakebasepressuredecrease(TTrain *Train, command_dat } } -void TTrain::OnCommand_trainbrakebasepressurereset(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_trainbrakebasepressurereset(const TTrain *Train, command_data const &Command) { if (Command.action == GLFW_PRESS) @@ -2129,7 +2129,7 @@ void TTrain::OnCommand_trainbrakebasepressurereset(TTrain *Train, command_data c } } -void TTrain::OnCommand_trainbrakeoperationtoggle(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_trainbrakeoperationtoggle(const TTrain *Train, command_data const &Command) { if (Command.action == GLFW_PRESS) @@ -2145,7 +2145,7 @@ void TTrain::OnCommand_trainbrakeoperationtoggle(TTrain *Train, command_data con } } -void TTrain::OnCommand_manualbrakeincrease(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_manualbrakeincrease(const TTrain *Train, command_data const &Command) { if (Command.action != GLFW_RELEASE) @@ -2165,7 +2165,7 @@ void TTrain::OnCommand_manualbrakeincrease(TTrain *Train, command_data const &Co } } -void TTrain::OnCommand_manualbrakedecrease(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_manualbrakedecrease(const TTrain *Train, command_data const &Command) { if (Command.action != GLFW_RELEASE) @@ -2571,7 +2571,7 @@ void TTrain::OnCommand_brakeactingspeedsetrapid(TTrain *Train, command_data cons } } -void TTrain::OnCommand_brakeloadcompensationincrease(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_brakeloadcompensationincrease(const TTrain *Train, command_data const &Command) { if (true == Command.freefly && Command.action == GLFW_PRESS) @@ -2584,7 +2584,7 @@ void TTrain::OnCommand_brakeloadcompensationincrease(TTrain *Train, command_data } } -void TTrain::OnCommand_brakeloadcompensationdecrease(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_brakeloadcompensationdecrease(const TTrain *Train, command_data const &Command) { if (true == Command.freefly && Command.action == GLFW_PRESS) @@ -2659,7 +2659,7 @@ void TTrain::OnCommand_wiperswitchdecrease(TTrain *Train, command_data const &Co } } -void TTrain::OnCommand_reverserincrease(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_reverserincrease(const TTrain *Train, command_data const &Command) { if (Command.action == GLFW_PRESS) @@ -2684,7 +2684,7 @@ void TTrain::OnCommand_reverserincrease(TTrain *Train, command_data const &Comma } } -void TTrain::OnCommand_reverserdecrease(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_reverserdecrease(const TTrain *Train, command_data const &Command) { if (Command.action == GLFW_PRESS) @@ -4998,7 +4998,7 @@ void TTrain::OnCommand_motorblowersdisableall(TTrain *Train, command_data const } } -void TTrain::OnCommand_coolingfanstoggle(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_coolingfanstoggle(const TTrain *Train, command_data const &Command) { if (Command.action != GLFW_PRESS) @@ -5088,7 +5088,7 @@ void TTrain::OnCommand_motorconnectorsclose(TTrain *Train, command_data const &C } } -void TTrain::OnCommand_motordisconnect(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_motordisconnect(const TTrain *Train, command_data const &Command) { if (Train->mvControlled->TrainType == dt_EZT ? Train->mvControlled != Train->mvOccupied : Train->iCabn != 0) @@ -6854,7 +6854,7 @@ void TTrain::OnCommand_springbrakeshutofftoggle(TTrain *Train, command_data cons } }; -void TTrain::OnCommand_springbrakeshutoffenable(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_springbrakeshutoffenable(const TTrain *Train, command_data const &Command) { if (Command.action == GLFW_PRESS) { @@ -6863,7 +6863,7 @@ void TTrain::OnCommand_springbrakeshutoffenable(TTrain *Train, command_data cons } }; -void TTrain::OnCommand_springbrakeshutoffdisable(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_springbrakeshutoffdisable(const TTrain *Train, command_data const &Command) { if (Command.action == GLFW_PRESS) { @@ -6872,7 +6872,7 @@ void TTrain::OnCommand_springbrakeshutoffdisable(TTrain *Train, command_data con } }; -void TTrain::OnCommand_springbrakerelease(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_springbrakerelease(const TTrain *Train, command_data const &Command) { if (Command.action == GLFW_PRESS) { @@ -7717,7 +7717,7 @@ void TTrain::OnCommand_doorsteptoggle(TTrain *Train, command_data const &Command } } -void TTrain::OnCommand_doormodetoggle(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_doormodetoggle(const TTrain *Train, command_data const &Command) { if (Command.action == GLFW_PRESS) @@ -7726,7 +7726,7 @@ void TTrain::OnCommand_doormodetoggle(TTrain *Train, command_data const &Command } } -void TTrain::OnCommand_mirrorstoggle(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_mirrorstoggle(const TTrain *Train, command_data const &Command) { if (Command.action != GLFW_PRESS) @@ -7747,7 +7747,7 @@ void TTrain::OnCommand_mirrorstoggle(TTrain *Train, command_data const &Command) } } -void TTrain::OnCommand_nearestcarcouplingincrease(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_nearestcarcouplingincrease(const TTrain *Train, command_data const &Command) { if (true == Command.freefly && Command.action == GLFW_PRESS) @@ -7771,7 +7771,7 @@ void TTrain::OnCommand_nearestcarcouplingincrease(TTrain *Train, command_data co } } -void TTrain::OnCommand_nearestcarcouplingdisconnect(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_nearestcarcouplingdisconnect(const TTrain *Train, command_data const &Command) { if (true == Command.freefly && Command.action == GLFW_PRESS) @@ -8075,7 +8075,7 @@ void TTrain::OnCommand_radiotoggle(TTrain *Train, command_data const &Command) } } -void TTrain::OnCommand_radioenable(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_radioenable(const TTrain *Train, command_data const &Command) { if (Command.action != GLFW_PRESS) { @@ -8088,7 +8088,7 @@ void TTrain::OnCommand_radioenable(TTrain *Train, command_data const &Command) } } -void TTrain::OnCommand_radiodisable(TTrain *Train, command_data const &Command) +void TTrain::OnCommand_radiodisable(const TTrain *Train, command_data const &Command) { if (Command.action != GLFW_PRESS) { @@ -8352,7 +8352,7 @@ void TTrain::OnCommand_cabchangebackward(TTrain *Train, command_data const &Comm } } -void TTrain::OnCommand_vehiclemoveforwards(TTrain *Train, const command_data &Command) +void TTrain::OnCommand_vehiclemoveforwards(const TTrain *Train, const command_data &Command) { if (Command.action == GLFW_RELEASE || !DebugModeFlag) return; @@ -8360,7 +8360,7 @@ void TTrain::OnCommand_vehiclemoveforwards(TTrain *Train, const command_data &Co Train->DynamicObject->move_set(100.0); } -void TTrain::OnCommand_vehiclemovebackwards(TTrain *Train, const command_data &Command) +void TTrain::OnCommand_vehiclemovebackwards(const TTrain *Train, const command_data &Command) { if (Command.action == GLFW_RELEASE || !DebugModeFlag) return; @@ -8368,7 +8368,7 @@ void TTrain::OnCommand_vehiclemovebackwards(TTrain *Train, const command_data &C Train->DynamicObject->move_set(-100.0); } -void TTrain::OnCommand_vehicleboost(TTrain *Train, const command_data &Command) +void TTrain::OnCommand_vehicleboost(const TTrain *Train, const command_data &Command) { if (Command.action == GLFW_RELEASE || !DebugModeFlag) return; @@ -11032,7 +11032,7 @@ const TTrain::screenentry_sequence &TTrain::get_screens() return m_screens; } -void TTrain::radio_message(sound_source *Message, int const Channel) +void TTrain::radio_message(const sound_source *Message, int const Channel) { auto const soundrange{Message->range()}; diff --git a/vehicle/Train.h b/vehicle/Train.h index 37d5ce74..c98368f8 100644 --- a/vehicle/Train.h +++ b/vehicle/Train.h @@ -202,7 +202,7 @@ class TTrain { // potentially moves train brake lever to neutral position void zero_charging_train_brake(); // sets specified brake acting speed for specified vehicle, potentially updating state of cab controls to match - void set_train_brake_speed( TDynamicObject *Vehicle, int Speed ); + void set_train_brake_speed(const TDynamicObject *Vehicle, int Speed ); // sets the motor connector button in paired unit to specified state void set_paired_open_motor_connectors_button( bool State ); // helper, common part of pantograph selection methods @@ -227,8 +227,8 @@ class TTrain { static void OnCommand_lightsset(TTrain *Train, command_data const &Command); static void OnCommand_wiperswitchincrease(TTrain *Train, command_data const &Command); static void OnCommand_wiperswitchdecrease(TTrain *Train, command_data const &Command); - static void OnCommand_aidriverenable( TTrain *Train, command_data const &Command ); - static void OnCommand_aidriverdisable( TTrain *Train, command_data const &Command ); + static void OnCommand_aidriverenable(const TTrain *Train, command_data const &Command ); + static void OnCommand_aidriverdisable(const TTrain *Train, command_data const &Command ); static void OnCommand_jointcontrollerset( TTrain *Train, command_data const &Command ); static void OnCommand_mastercontrollerincrease( TTrain *Train, command_data const &Command ); @@ -237,25 +237,25 @@ class TTrain { static void OnCommand_mastercontrollerdecreasefast( TTrain *Train, command_data const &Command ); static void OnCommand_mastercontrollerset( TTrain *Train, command_data const &Command ); - static void OnCommand_DynamicBrakeControllerIncrease( TTrain *Train, command_data const &Command ); - static void OnCommand_DynamicBrakeControllerIncreaseFast( TTrain *Train, command_data const &Command ); - static void OnCommand_DynamicBrakeControllerDecrease( TTrain *Train, command_data const &Command ); - static void OnCommand_DynamicBrakeControllerDecreaseFast( TTrain *Train, command_data const &Command ); - static void OnCommand_DynamicBrakeControllerSet( TTrain *Train, command_data const &Command ); + static void OnCommand_DynamicBrakeControllerIncrease(const TTrain *Train, command_data const &Command ); + static void OnCommand_DynamicBrakeControllerIncreaseFast(const TTrain *Train, command_data const &Command ); + static void OnCommand_DynamicBrakeControllerDecrease(const TTrain *Train, command_data const &Command ); + static void OnCommand_DynamicBrakeControllerDecreaseFast(const TTrain *Train, command_data const &Command ); + static void OnCommand_DynamicBrakeControllerSet(const TTrain *Train, command_data const &Command ); static void OnCommand_secondcontrollerincrease( TTrain *Train, command_data const &Command ); - static void OnCommand_secondcontrollerincreasefast( TTrain *Train, command_data const &Command ); + static void OnCommand_secondcontrollerincreasefast(const TTrain *Train, command_data const &Command ); static void OnCommand_secondcontrollerdecrease( TTrain *Train, command_data const &Command ); - static void OnCommand_secondcontrollerdecreasefast( TTrain *Train, command_data const &Command ); + static void OnCommand_secondcontrollerdecreasefast(const TTrain *Train, command_data const &Command ); static void OnCommand_secondcontrollerset( TTrain *Train, command_data const &Command ); - static void OnCommand_notchingrelaytoggle( TTrain *Train, command_data const &Command ); + static void OnCommand_notchingrelaytoggle(const TTrain *Train, command_data const &Command ); static void OnCommand_tempomattoggle( TTrain *Train, command_data const &Command ); static void OnCommand_mucurrentindicatorothersourceactivate( TTrain *Train, command_data const &Command ); static void OnCommand_independentbrakeincrease( TTrain *Train, command_data const &Command ); static void OnCommand_independentbrakeincreasefast( TTrain *Train, command_data const &Command ); static void OnCommand_independentbrakedecrease( TTrain *Train, command_data const &Command ); static void OnCommand_independentbrakedecreasefast( TTrain *Train, command_data const &Command ); - static void OnCommand_independentbrakeset( TTrain *Train, command_data const &Command ); + static void OnCommand_independentbrakeset(const TTrain *Train, command_data const &Command ); static void OnCommand_independentbrakebailoff( TTrain *Train, command_data const &Command ); static void OnCommand_universalbrakebutton1(TTrain *Train, command_data const &Command); static void OnCommand_universalbrakebutton2(TTrain *Train, command_data const &Command); @@ -270,12 +270,12 @@ class TTrain { static void OnCommand_trainbrakefullservice( TTrain *Train, command_data const &Command ); static void OnCommand_trainbrakehandleoff( TTrain *Train, command_data const &Command ); static void OnCommand_trainbrakeemergency( TTrain *Train, command_data const &Command ); - static void OnCommand_trainbrakebasepressureincrease( TTrain *Train, command_data const &Command ); - static void OnCommand_trainbrakebasepressuredecrease( TTrain *Train, command_data const &Command ); - static void OnCommand_trainbrakebasepressurereset( TTrain *Train, command_data const &Command ); - static void OnCommand_trainbrakeoperationtoggle( TTrain *Train, command_data const &Command ); - static void OnCommand_manualbrakeincrease( TTrain *Train, command_data const &Command ); - static void OnCommand_manualbrakedecrease( TTrain *Train, command_data const &Command ); + static void OnCommand_trainbrakebasepressureincrease(const TTrain *Train, command_data const &Command ); + static void OnCommand_trainbrakebasepressuredecrease(const TTrain *Train, command_data const &Command ); + static void OnCommand_trainbrakebasepressurereset(const TTrain *Train, command_data const &Command ); + static void OnCommand_trainbrakeoperationtoggle(const TTrain *Train, command_data const &Command ); + static void OnCommand_manualbrakeincrease(const TTrain *Train, command_data const &Command ); + static void OnCommand_manualbrakedecrease(const TTrain *Train, command_data const &Command ); static void OnCommand_alarmchaintoggle( TTrain *Train, command_data const &Command ); static void OnCommand_alarmchainenable(TTrain *Train, command_data const &Command); static void OnCommand_alarmchaindisable(TTrain *Train, command_data const &Command); @@ -294,11 +294,11 @@ class TTrain { static void OnCommand_brakeactingspeedsetcargo( TTrain *Train, command_data const &Command ); static void OnCommand_brakeactingspeedsetpassenger( TTrain *Train, command_data const &Command ); static void OnCommand_brakeactingspeedsetrapid( TTrain *Train, command_data const &Command ); - static void OnCommand_brakeloadcompensationincrease( TTrain *Train, command_data const &Command ); - static void OnCommand_brakeloadcompensationdecrease( TTrain *Train, command_data const &Command ); + static void OnCommand_brakeloadcompensationincrease(const TTrain *Train, command_data const &Command ); + static void OnCommand_brakeloadcompensationdecrease(const TTrain *Train, command_data const &Command ); static void OnCommand_mubrakingindicatortoggle( TTrain *Train, command_data const &Command ); - static void OnCommand_reverserincrease( TTrain *Train, command_data const &Command ); - static void OnCommand_reverserdecrease( TTrain *Train, command_data const &Command ); + static void OnCommand_reverserincrease(const TTrain *Train, command_data const &Command ); + static void OnCommand_reverserdecrease(const TTrain *Train, command_data const &Command ); static void OnCommand_reverserforwardhigh( TTrain *Train, command_data const &Command ); static void OnCommand_reverserforward( TTrain *Train, command_data const &Command ); static void OnCommand_reverserneutral( TTrain *Train, command_data const &Command ); @@ -372,10 +372,10 @@ class TTrain { static void OnCommand_motorblowersenablerear( TTrain *Train, command_data const &Command ); static void OnCommand_motorblowersdisablerear( TTrain *Train, command_data const &Command ); static void OnCommand_motorblowersdisableall( TTrain *Train, command_data const &Command ); - static void OnCommand_coolingfanstoggle( TTrain *Train, command_data const &Command ); + static void OnCommand_coolingfanstoggle(const TTrain *Train, command_data const &Command ); static void OnCommand_motorconnectorsopen( TTrain *Train, command_data const &Command ); static void OnCommand_motorconnectorsclose( TTrain *Train, command_data const &Command ); - static void OnCommand_motordisconnect( TTrain *Train, command_data const &Command ); + static void OnCommand_motordisconnect(const TTrain *Train, command_data const &Command ); static void OnCommand_motoroverloadrelaythresholdtoggle( TTrain *Train, command_data const &Command ); static void OnCommand_motoroverloadrelaythresholdsetlow( TTrain *Train, command_data const &Command ); static void OnCommand_motoroverloadrelaythresholdsethigh( TTrain *Train, command_data const &Command ); @@ -455,10 +455,10 @@ class TTrain { static void OnCommand_dooropenall( TTrain *Train, command_data const &Command ); static void OnCommand_doorcloseall( TTrain *Train, command_data const &Command ); static void OnCommand_doorsteptoggle( TTrain *Train, command_data const &Command ); - static void OnCommand_doormodetoggle( TTrain *Train, command_data const &Command ); - static void OnCommand_mirrorstoggle( TTrain *Train, command_data const &Command ); - static void OnCommand_nearestcarcouplingincrease( TTrain *Train, command_data const &Command ); - static void OnCommand_nearestcarcouplingdisconnect( TTrain *Train, command_data const &Command ); + static void OnCommand_doormodetoggle(const TTrain *Train, command_data const &Command ); + static void OnCommand_mirrorstoggle(const TTrain *Train, command_data const &Command ); + static void OnCommand_nearestcarcouplingincrease(const TTrain *Train, command_data const &Command ); + static void OnCommand_nearestcarcouplingdisconnect(const TTrain *Train, command_data const &Command ); static void OnCommand_nearestcarcoupleradapterattach( TTrain *Train, command_data const &Command ); static void OnCommand_nearestcarcoupleradapterremove( TTrain *Train, command_data const &Command ); static void OnCommand_occupiedcarcouplingdisconnect( TTrain *Train, command_data const &Command ); @@ -468,8 +468,8 @@ class TTrain { static void OnCommand_hornhighactivate( TTrain *Train, command_data const &Command ); static void OnCommand_whistleactivate( TTrain *Train, command_data const &Command ); static void OnCommand_radiotoggle( TTrain *Train, command_data const &Command ); - static void OnCommand_radioenable( TTrain *Train, command_data const &Command ); - static void OnCommand_radiodisable( TTrain *Train, command_data const &Command ); + static void OnCommand_radioenable(const TTrain *Train, command_data const &Command ); + static void OnCommand_radiodisable(const TTrain *Train, command_data const &Command ); static void OnCommand_radiochannelincrease( TTrain *Train, command_data const &Command ); static void OnCommand_radiochanneldecrease( TTrain *Train, command_data const &Command ); static void OnCommand_radiochannelset( TTrain *Train, command_data const &Command ); @@ -485,16 +485,16 @@ class TTrain { static void OnCommand_cabchangeforward( TTrain *Train, command_data const &Command ); static void OnCommand_cabchangebackward( TTrain *Train, command_data const &Command ); static void OnCommand_generictoggle( TTrain *Train, command_data const &Command ); - static void OnCommand_vehiclemoveforwards( TTrain *Train, command_data const &Command ); - static void OnCommand_vehiclemovebackwards( TTrain *Train, command_data const &Command ); - static void OnCommand_vehicleboost( TTrain *Train, command_data const &Command ); + static void OnCommand_vehiclemoveforwards(const TTrain *Train, command_data const &Command ); + static void OnCommand_vehiclemovebackwards(const TTrain *Train, command_data const &Command ); + static void OnCommand_vehicleboost(const TTrain *Train, command_data const &Command ); static void OnCommand_springbraketoggle(TTrain *Train, command_data const &Command); static void OnCommand_springbrakeenable(TTrain *Train, command_data const &Command); static void OnCommand_springbrakedisable(TTrain *Train, command_data const &Command); static void OnCommand_springbrakeshutofftoggle(TTrain *Train, command_data const &Command); - static void OnCommand_springbrakeshutoffenable(TTrain *Train, command_data const &Command); - static void OnCommand_springbrakeshutoffdisable(TTrain *Train, command_data const &Command); - static void OnCommand_springbrakerelease(TTrain *Train, command_data const &Command); + static void OnCommand_springbrakeshutoffenable(const TTrain *Train, command_data const &Command); + static void OnCommand_springbrakeshutoffdisable(const TTrain *Train, command_data const &Command); + static void OnCommand_springbrakerelease(const TTrain *Train, command_data const &Command); static void OnCommand_distancecounteractivate( TTrain *Train, command_data const &Command ); static void OnCommand_speedcontrolincrease(TTrain *Train, command_data const &Command); static void OnCommand_speedcontroldecrease(TTrain *Train, command_data const &Command); @@ -919,7 +919,7 @@ private: float fDieselParams[9][10]; // parametry dla silnikow asynchronicznych // plays provided sound from position of the radio bool radio_message_played; - void radio_message( sound_source *Message, int Channel ); + void radio_message(const sound_source *Message, int Channel ); auto const RadioChannel() const { return Dynamic()->Mechanik ? Dynamic()->Mechanik->iRadioChannel : 1; } auto &RadioChannel() { return Dynamic()->Mechanik->iRadioChannel; } TDynamicObject *Dynamic() { return DynamicObject; }; diff --git a/widgets/map.cpp b/widgets/map.cpp index 897cd22c..77ea87f8 100644 --- a/widgets/map.cpp +++ b/widgets/map.cpp @@ -368,7 +368,7 @@ void ui::map_panel::render_contents() render_labels(transform, window_origin, surface_size); } -void ui::handle_map_object_click(ui_panel &parent, std::shared_ptr &obj) +void ui::handle_map_object_click(ui_panel &parent, const std::shared_ptr &obj) { if (auto sem = std::dynamic_pointer_cast(obj)) { diff --git a/widgets/map.h b/widgets/map.h index 417f1bfc..70500939 100644 --- a/widgets/map.h +++ b/widgets/map.h @@ -136,6 +136,6 @@ class map_panel : public ui_panel void render_contents() override; }; -void handle_map_object_click(ui_panel &parent, std::shared_ptr &obj); +void handle_map_object_click(ui_panel &parent, const std::shared_ptr &obj); void handle_map_object_hover(std::shared_ptr &obj); } // namespace ui diff --git a/world/Track.cpp b/world/Track.cpp index 65e77d34..a3a6de5e 100644 --- a/world/Track.cpp +++ b/world/Track.cpp @@ -1080,7 +1080,7 @@ bool TTrack::AddDynamicObject(TDynamicObject *Dynamic) constexpr int numPts = 4; -bool TTrack::CheckDynamicObject(TDynamicObject *Dynamic) +bool TTrack::CheckDynamicObject(const TDynamicObject *Dynamic) { // sprawdzenie, czy pojazd jest przypisany do toru for (const auto dynamic : Dynamics ) { if( dynamic == Dynamic ) { @@ -1090,7 +1090,7 @@ bool TTrack::CheckDynamicObject(TDynamicObject *Dynamic) return false; }; -bool TTrack::RemoveDynamicObject(TDynamicObject *Dynamic) +bool TTrack::RemoveDynamicObject(const TDynamicObject *Dynamic) { // usunięcie pojazdu z listy przypisanych do toru bool result = false; if( *Dynamics.begin() == Dynamic ) { @@ -1201,7 +1201,7 @@ void TTrack::create_map_geometry(std::vector &Bank, const gfx } } -TTrack *TTrack::Next(TTrack *visitor) { +TTrack *TTrack::Next(const TTrack *visitor) { if (eType == tt_Normal) { if (trNext != visitor) return trNext; @@ -1887,7 +1887,7 @@ bool TTrack::Switch(int i, float const t, float const d) return false; }; -bool TTrack::SwitchForced(const int i, TDynamicObject *o) +bool TTrack::SwitchForced(const int i, const TDynamicObject *o) { // rozprucie rozjazdu if (SwitchExtension) if (eType == tt_Switch) diff --git a/world/Track.h b/world/Track.h index 2e87437c..98e5bc2f 100644 --- a/world/Track.h +++ b/world/Track.h @@ -262,7 +262,7 @@ public: TTrack *Connected(int s, double &d) const; bool SetConnections(int i); bool Switch(int i, float t = -1.f, float d = -1.f); - bool SwitchForced(int i, TDynamicObject *o); + bool SwitchForced(int i, const TDynamicObject *o); int CrossSegment(int from, int into); int GetSwitchState() { return SwitchExtension ? SwitchExtension->CurrentIndex : -1; }; @@ -276,9 +276,9 @@ public: bool AssignForcedEvents(basic_event *NewEventPlus, basic_event *NewEventMinus); 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 CheckDynamicObject(const TDynamicObject *Dynamic); bool AddDynamicObject(TDynamicObject *Dynamic); - bool RemoveDynamicObject(TDynamicObject *Dynamic); + bool RemoveDynamicObject(const TDynamicObject *Dynamic); // set origin point void @@ -290,7 +290,7 @@ public: gfx::geometrybank_handle extra_map_geometry; // handle for map highlighting - TTrack *Next(TTrack *visitor); + TTrack *Next(const TTrack *visitor); double ActiveLength(); void create_geometry( gfx::geometrybank_handle const &Bank ); // wypełnianie VBO diff --git a/world/station.cpp b/world/station.cpp index 06754b4b..f37575cf 100644 --- a/world/station.cpp +++ b/world/station.cpp @@ -22,7 +22,7 @@ basic_station Station; // exchanges load with consist attached to specified vehicle, operating on specified schedule double -basic_station::update_load( TDynamicObject *First, TTrainParameters &Schedule, int const Platform ) { +basic_station::update_load( TDynamicObject *First, const TTrainParameters &Schedule, int const Platform ) { // TODO: filter out maintenance stops when determining first and last stop auto const firststop { Schedule.StationIndex == 1 }; diff --git a/world/station.h b/world/station.h index 7eee99a1..c6732dac 100644 --- a/world/station.h +++ b/world/station.h @@ -18,7 +18,7 @@ public: // methods // exchanges load with consist attached to specified vehicle, operating on specified schedule; returns: time needed for exchange, in seconds static double - update_load( TDynamicObject *First, Mtable::TTrainParameters &Schedule, int Platform ); + update_load( TDynamicObject *First, const Mtable::TTrainParameters &Schedule, int Platform ); }; namespace simulation {