From b3bbb35502671258e657acdce813dde4f0805863 Mon Sep 17 00:00:00 2001 From: Vankata453 <78196474+Vankata453@users.noreply.github.com> Date: Fri, 22 Nov 2024 02:33:15 +0200 Subject: [PATCH] Mark simple getters and setters as `inline` Simple `get_` and `set_` member functions in classes, as well as functions that are meant to simply call another function in the class, have been marked with the `inline` compiler hint, so we can ensure function calls will be eliminated whenever possible. --- src/addon/addon.cpp | 37 --- src/addon/addon.hpp | 40 +-- src/addon/addon_manager.cpp | 12 - src/addon/addon_manager.hpp | 4 +- src/addon/downloader.hpp | 2 +- src/audio/sound_manager.hpp | 8 +- src/audio/stream_sound_source.hpp | 4 +- src/badguy/badguy.hpp | 8 +- src/badguy/crusher.hpp | 10 +- src/badguy/dart.cpp | 6 - src/badguy/dart.hpp | 2 +- src/badguy/granito.hpp | 2 +- src/badguy/granito_big.hpp | 2 +- src/badguy/mrbomb.hpp | 2 +- src/badguy/treewillowisp.cpp | 6 - src/badguy/treewillowisp.hpp | 2 +- src/badguy/walking_badguy.cpp | 6 - src/badguy/walking_badguy.hpp | 11 +- src/badguy/willowisp.hpp | 2 +- src/collision/collision.hpp | 8 +- src/collision/collision_object.hpp | 22 +- src/control/controller.cpp | 12 - src/control/controller.hpp | 4 +- src/control/game_controller_manager.hpp | 2 +- src/control/input_manager.hpp | 4 +- src/control/joystick_manager.hpp | 4 +- src/editor/bezier_marker.hpp | 2 +- src/editor/editor.cpp | 24 -- src/editor/editor.hpp | 39 +-- src/editor/layer_icon.hpp | 2 +- src/editor/object_group.hpp | 6 +- src/editor/object_icon.hpp | 2 +- src/editor/object_info.hpp | 4 +- src/editor/object_option.hpp | 8 +- src/editor/object_settings.hpp | 4 +- src/editor/overlay_widget.cpp | 7 - src/editor/overlay_widget.hpp | 6 +- src/editor/particle_editor.hpp | 2 +- src/editor/tilebox.cpp | 6 - src/editor/tilebox.hpp | 18 +- src/editor/tip.hpp | 4 +- src/editor/tool_icon.hpp | 2 +- src/editor/toolbox_widget.hpp | 4 +- src/gui/dialog.hpp | 4 +- src/gui/menu.cpp | 7 - src/gui/menu.hpp | 4 +- src/gui/menu_item.hpp | 12 +- src/gui/menu_manager.cpp | 12 - src/gui/menu_manager.hpp | 4 +- src/gui/menu_transition.hpp | 4 +- src/gui/mousecursor.cpp | 12 - src/gui/mousecursor.hpp | 6 +- src/gui/notification.hpp | 2 +- src/interface/control.hpp | 8 +- src/interface/control_checkbox.hpp | 6 +- src/interface/control_enum.hpp | 6 +- src/interface/control_scrollbar.cpp | 14 - src/interface/control_scrollbar.hpp | 14 +- src/interface/control_textbox.hpp | 2 +- src/interface/control_textbox_float.hpp | 6 +- src/interface/control_textbox_int.hpp | 6 +- src/interface/label.hpp | 8 +- src/math/rect.hpp | 14 +- src/math/rectf.hpp | 44 +-- src/object/ambient_light.cpp | 12 - src/object/ambient_light.hpp | 4 +- src/object/background.cpp | 36 --- src/object/background.hpp | 20 +- src/object/bonus_block.hpp | 4 +- src/object/bullet.hpp | 4 +- src/object/camera.cpp | 42 --- src/object/camera.hpp | 24 +- src/object/candle.cpp | 6 - src/object/candle.hpp | 2 +- src/object/cloud_particle_system.cpp | 36 --- src/object/cloud_particle_system.hpp | 13 +- src/object/conveyor_belt.cpp | 9 +- src/object/conveyor_belt.hpp | 2 +- src/object/custom_particle_system.cpp | 293 ------------------ src/object/custom_particle_system.hpp | 98 +++--- src/object/decal.hpp | 4 +- src/object/display_effect.cpp | 12 - src/object/display_effect.hpp | 4 +- src/object/explosion.hpp | 4 +- src/object/fallblock.hpp | 4 +- src/object/floating_image.cpp | 54 ---- src/object/floating_image.hpp | 18 +- src/object/gradient.cpp | 6 - src/object/gradient.hpp | 12 +- src/object/lantern.hpp | 2 +- src/object/moving_sprite.cpp | 12 - src/object/moving_sprite.hpp | 10 +- src/object/music_object.cpp | 18 -- src/object/music_object.hpp | 6 +- src/object/particle_zone.hpp | 6 +- src/object/particlesystem.cpp | 12 - src/object/particlesystem.hpp | 6 +- src/object/path.hpp | 6 +- src/object/path_gameobject.hpp | 2 +- src/object/path_object.hpp | 2 +- src/object/path_walker.hpp | 2 +- src/object/platform.hpp | 4 +- src/object/player.cpp | 96 ------ src/object/player.hpp | 84 ++--- src/object/portable.hpp | 4 +- src/object/rock.hpp | 2 +- src/object/scripted_object.cpp | 42 --- src/object/scripted_object.hpp | 14 +- src/object/sound_object.cpp | 6 - src/object/sound_object.hpp | 2 +- src/object/spotlight.cpp | 48 --- src/object/spotlight.hpp | 16 +- src/object/sticky_object.hpp | 4 +- src/object/text_array_object.cpp | 24 -- src/object/text_array_object.hpp | 8 +- src/object/text_object.cpp | 84 ----- src/object/text_object.hpp | 36 +-- src/object/textscroller.cpp | 6 - src/object/textscroller.hpp | 5 +- src/object/tilemap.cpp | 14 +- src/object/tilemap.hpp | 30 +- src/object/torch.cpp | 12 - src/object/torch.hpp | 4 +- src/sprite/sprite.cpp | 78 ----- src/sprite/sprite.hpp | 46 +-- src/squirrel/squirrel_environment.hpp | 2 +- src/squirrel/squirrel_virtual_machine.hpp | 2 +- src/supertux/autotile.hpp | 14 +- src/supertux/command_line_arguments.hpp | 4 +- src/supertux/console.cpp | 9 - src/supertux/console.hpp | 6 +- src/supertux/debug.cpp | 7 +- src/supertux/debug.hpp | 4 +- src/supertux/game_object.cpp | 18 -- src/supertux/game_object.hpp | 16 +- src/supertux/game_object_manager.hpp | 6 +- src/supertux/game_session.cpp | 32 -- src/supertux/game_session.hpp | 30 +- src/supertux/gameconfig.hpp | 2 +- src/supertux/level.hpp | 12 +- src/supertux/menu/download_dialog.cpp | 6 - src/supertux/menu/download_dialog.hpp | 3 +- .../menu/editor_levelset_select_menu.hpp | 2 +- src/supertux/moving_object.cpp | 36 --- src/supertux/moving_object.hpp | 14 +- src/supertux/object_factory.hpp | 4 +- src/supertux/physic.cpp | 14 - src/supertux/physic.hpp | 40 ++- src/supertux/profile.hpp | 10 +- src/supertux/savegame.hpp | 4 +- src/supertux/screen_manager.cpp | 18 +- src/supertux/screen_manager.hpp | 6 +- src/supertux/sector.cpp | 36 +-- src/supertux/sector.hpp | 15 +- src/supertux/sector_base.hpp | 6 +- src/supertux/statistics.hpp | 12 +- src/supertux/tile.hpp | 16 +- src/supertux/timer.hpp | 12 +- src/supertux/world.hpp | 16 +- src/trigger/door.hpp | 4 +- src/trigger/secretarea_trigger.hpp | 2 +- src/util/reader_collection.hpp | 4 +- src/util/reader_document.hpp | 2 +- src/util/reader_iterator.hpp | 2 +- src/util/reader_mapping.hpp | 4 +- src/util/reader_object.hpp | 4 +- src/video/bitmap_font.hpp | 2 +- src/video/canvas.hpp | 2 +- src/video/color.hpp | 2 +- src/video/drawing_context.cpp | 73 ++--- src/video/drawing_context.hpp | 88 +++--- src/video/gl/gl33core_context.hpp | 6 +- src/video/gl/gl_framebuffer.hpp | 2 +- src/video/gl/gl_program.hpp | 26 +- src/video/gl/gl_texture.hpp | 10 +- src/video/gl/gl_video_system.hpp | 2 +- src/video/paint_style.hpp | 8 +- src/video/sampler.hpp | 8 +- src/video/sdl/sdl_screen_renderer.hpp | 2 +- src/video/sdl/sdl_texture.hpp | 4 +- src/video/surface.hpp | 6 +- src/video/surface_batch.hpp | 8 +- src/video/texture.hpp | 2 +- src/video/texture_manager.hpp | 2 +- src/video/ttf_font.hpp | 6 +- src/video/ttf_surface.hpp | 4 +- src/video/viewport.hpp | 4 +- src/worldmap/camera.hpp | 4 +- src/worldmap/level_tile.cpp | 14 - src/worldmap/level_tile.hpp | 26 +- src/worldmap/spawn_point.hpp | 6 +- src/worldmap/special_tile.hpp | 12 +- src/worldmap/sprite_change.hpp | 2 +- src/worldmap/teleporter.hpp | 10 +- src/worldmap/tux.cpp | 18 -- src/worldmap/tux.hpp | 14 +- src/worldmap/worldmap.cpp | 13 - src/worldmap/worldmap.hpp | 16 +- src/worldmap/worldmap_object.hpp | 2 +- src/worldmap/worldmap_sector.hpp | 6 +- 200 files changed, 787 insertions(+), 2112 deletions(-) diff --git a/src/addon/addon.cpp b/src/addon/addon.cpp index 1cdb4e31c43..aeb92b3cc58 100644 --- a/src/addon/addon.cpp +++ b/src/addon/addon.cpp @@ -232,30 +232,6 @@ Addon::get_filename() const return get_id() + ".zip"; } -const std::string& -Addon::get_install_filename() const -{ - return m_install_filename; -} - -bool -Addon::is_installed() const -{ - return !m_install_filename.empty(); -} - -bool -Addon::is_enabled() const -{ - return m_enabled; -} - -bool -Addon::is_visible() const -{ - return true; -} - bool Addon::is_levelset() const { @@ -277,17 +253,4 @@ Addon::requires_restart() const return m_type == LANGUAGEPACK || m_type == RESOURCEPACK; } -void -Addon::set_install_filename(const std::string& absolute_filename, const std::string& md5) -{ - m_install_filename = absolute_filename; - m_md5 = md5; -} - -void -Addon::set_enabled(bool v) -{ - m_enabled = v; -} - /* EOF */ diff --git a/src/addon/addon.hpp b/src/addon/addon.hpp index d14c567f615..4e211d3e7d2 100644 --- a/src/addon/addon.hpp +++ b/src/addon/addon.hpp @@ -62,34 +62,38 @@ class Addon final Addon(); public: - const std::string& get_id() const { return m_id; } - int get_version() const { return m_version; } - int get_format() const { return m_format; } + inline const std::string& get_id() const { return m_id; } + inline int get_version() const { return m_version; } + inline int get_format() const { return m_format; } - Type get_type() const { return m_type; } - const std::string& get_title() const { return m_title; } - const std::string& get_author() const { return m_author; } - const std::string& get_license() const { return m_license; } + inline Type get_type() const { return m_type; } + inline const std::string& get_title() const { return m_title; } + inline const std::string& get_author() const { return m_author; } + inline const std::string& get_license() const { return m_license; } - const std::string& get_description() const { return m_description; } - const std::string& get_url() const { return m_url; } - const std::string& get_md5() const { return m_md5; } - const std::vector& get_screenshots() const { return m_screenshots; } - const std::vector& get_dependencies() const { return m_dependencies; } + inline const std::string& get_description() const { return m_description; } + inline const std::string& get_url() const { return m_url; } + inline const std::string& get_md5() const { return m_md5; } + inline const std::vector& get_screenshots() const { return m_screenshots; } + inline const std::vector& get_dependencies() const { return m_dependencies; } std::string get_filename() const; - const std::string& get_install_filename() const; + inline const std::string& get_install_filename() const { return m_install_filename; } - bool is_installed() const; - bool is_enabled() const; - bool is_visible() const; + inline bool is_installed() const { return !m_install_filename.empty(); } + inline bool is_enabled() const { return m_enabled; } + inline bool is_visible() const { return true; } bool is_levelset() const; bool overrides_data() const; bool requires_restart() const; - void set_install_filename(const std::string& absolute_filename, const std::string& md5); - void set_enabled(bool v); + inline void set_install_filename(const std::string& absolute_filename, const std::string& md5) + { + m_install_filename = absolute_filename; + m_md5 = md5; + } + inline void set_enabled(bool v) { m_enabled = v; } private: Addon(const Addon&) = delete; diff --git a/src/addon/addon_manager.cpp b/src/addon/addon_manager.cpp index 54be09eca1a..07b517e1e85 100644 --- a/src/addon/addon_manager.cpp +++ b/src/addon/addon_manager.cpp @@ -259,18 +259,6 @@ AddonManager::get_installed_addons() const return get_addons(m_installed_addons); } -bool -AddonManager::has_online_support() const -{ - return true; -} - -bool -AddonManager::has_been_updated() const -{ - return m_has_been_updated; -} - TransferStatusPtr AddonManager::request_check_online() { diff --git a/src/addon/addon_manager.hpp b/src/addon/addon_manager.hpp index 7e3e9a0d9e9..ed1d02440eb 100644 --- a/src/addon/addon_manager.hpp +++ b/src/addon/addon_manager.hpp @@ -61,8 +61,8 @@ class AddonManager final : public Currenton void empty_cache_directory(); - bool has_online_support() const; - bool has_been_updated() const; + inline bool has_online_support() const { return true; } + inline bool has_been_updated() const { return m_has_been_updated; } void check_online(); TransferStatusPtr request_check_online(); diff --git a/src/addon/downloader.hpp b/src/addon/downloader.hpp index 5e6bfb8de54..2557a1fa978 100644 --- a/src/addon/downloader.hpp +++ b/src/addon/downloader.hpp @@ -98,7 +98,7 @@ class TransferStatusList final int get_download_now() const; int get_download_total() const; - const std::string& get_error() const { return m_error_msg; } + inline const std::string& get_error() const { return m_error_msg; } bool is_active() const; diff --git a/src/audio/sound_manager.hpp b/src/audio/sound_manager.hpp index d692980b871..c282ca5e4fd 100644 --- a/src/audio/sound_manager.hpp +++ b/src/audio/sound_manager.hpp @@ -90,11 +90,11 @@ class SoundManager final : public Currenton void stop_sounds(); void set_sound_volume(int volume); - bool is_music_enabled() const { return m_music_enabled; } - bool is_sound_enabled() const { return m_sound_enabled; } + inline bool is_music_enabled() const { return m_music_enabled; } + inline bool is_sound_enabled() const { return m_sound_enabled; } - bool is_audio_enabled() const { return m_device != nullptr && m_context != nullptr; } - const std::string& get_current_music() const { return m_current_music; } + inline bool is_audio_enabled() const { return m_device != nullptr && m_context != nullptr; } + inline const std::string& get_current_music() const { return m_current_music; } void update(); /** Tell soundmanager to call update() for stream_sound_source. */ diff --git a/src/audio/stream_sound_source.hpp b/src/audio/stream_sound_source.hpp index 4fbf604cf41..21eee626927 100644 --- a/src/audio/stream_sound_source.hpp +++ b/src/audio/stream_sound_source.hpp @@ -42,8 +42,8 @@ class StreamSoundSource final : public OpenALSoundSource void set_sound_file(std::unique_ptr newfile); void set_fading(FadeState state, float fadetime); - FadeState get_fade_state() const { return m_fade_state; } - bool get_looping() const { return m_looping; } + inline FadeState get_fade_state() const { return m_fade_state; } + inline bool get_looping() const { return m_looping; } private: bool fillBufferAndQueue(ALuint buffer); diff --git a/src/badguy/badguy.hpp b/src/badguy/badguy.hpp index 9973086c8be..e67a902e655 100644 --- a/src/badguy/badguy.hpp +++ b/src/badguy/badguy.hpp @@ -102,8 +102,8 @@ class BadGuy : public MovingSprite, current form. */ virtual bool can_break() const { return false; } - Vector get_start_position() const { return m_start_position; } - void set_start_position(const Vector& vec) { m_start_position = vec; } + inline Vector get_start_position() const { return m_start_position; } + inline void set_start_position(const Vector& vec) { m_start_position = vec; } virtual void grab(MovingObject& object, const Vector& pos, Direction dir) override; virtual void ungrab(MovingObject& object, Direction dir) override; @@ -157,7 +157,7 @@ class BadGuy : public MovingSprite, /** Adds velocity from wind */ virtual void add_wind_velocity(const Vector& velocity, const Vector& end_speed); - Physic& get_physic() { return m_physic; } + inline Physic& get_physic() { return m_physic; } protected: enum State { @@ -216,7 +216,7 @@ class BadGuy : public MovingSprite, void kill_squished(GameObject& object); void set_state(State state); - State get_state() const { return m_state; } + inline State get_state() const { return m_state; } bool check_state_timer() { return m_state_timer.check(); diff --git a/src/badguy/crusher.hpp b/src/badguy/crusher.hpp index a0dd52a3c91..4ed365411f4 100644 --- a/src/badguy/crusher.hpp +++ b/src/badguy/crusher.hpp @@ -64,7 +64,7 @@ class Crusher final : public MovingSprite virtual void draw(DrawingContext& context) override; virtual void after_editor_set() override; - virtual bool is_sideways() const { return m_sideways; } + inline bool is_sideways() const { return m_sideways; } static std::string class_name() { return "crusher"; } virtual std::string get_class_name() const override { return class_name(); } @@ -78,9 +78,9 @@ class Crusher final : public MovingSprite virtual void on_flip(float height) override; - Physic& get_physic() { return m_physic; } - bool is_big() const { return m_ic_size == LARGE; } - CrusherState get_state() const { return m_state; } + inline Physic& get_physic() { return m_physic; } + inline bool is_big() const { return m_ic_size == LARGE; } + inline CrusherState get_state() const { return m_state; } private: void spawn_roots(Direction direction); @@ -123,7 +123,7 @@ class CrusherRoot : public MovingSprite private: void start_animation(); - bool delay_gone() const { return m_delay_remaining <= 0.f; } + inline bool delay_gone() const { return m_delay_remaining <= 0.f; } private: Vector m_original_pos; diff --git a/src/badguy/dart.cpp b/src/badguy/dart.cpp index 9b4fc77b424..ca704454251 100644 --- a/src/badguy/dart.cpp +++ b/src/badguy/dart.cpp @@ -149,12 +149,6 @@ Dart::play_looping_sounds() } } -void -Dart::set_flip(Flip flip) -{ - m_flip = flip; -} - std::vector Dart::get_allowed_directions() const { diff --git a/src/badguy/dart.hpp b/src/badguy/dart.hpp index e5cfc99bb58..3df7ed01028 100644 --- a/src/badguy/dart.hpp +++ b/src/badguy/dart.hpp @@ -54,7 +54,7 @@ class Dart final : public BadGuy virtual void on_flip(float height) override; - void set_flip(Flip flip); + inline void set_flip(Flip flip) { m_flip = flip; } protected: virtual std::vector get_allowed_directions() const override; diff --git a/src/badguy/granito.hpp b/src/badguy/granito.hpp index a009a959ad8..88ace291249 100644 --- a/src/badguy/granito.hpp +++ b/src/badguy/granito.hpp @@ -133,7 +133,7 @@ class Granito : public WalkingBadguy * @scripting * @description Gets the current Granito state. Value is any of the ""GRANITO_STATE"" enumerators. */ - int get_state() const { return static_cast(m_state); } + inline int get_state() const { return static_cast(m_state); } /** * @scripting diff --git a/src/badguy/granito_big.hpp b/src/badguy/granito_big.hpp index 7d6f6467e16..1fa339fd969 100644 --- a/src/badguy/granito_big.hpp +++ b/src/badguy/granito_big.hpp @@ -49,7 +49,7 @@ class GranitoBig final : public Granito virtual GameObjectTypes get_types() const override; void carry(Granito* granito); - Granito* get_carrying() const { return m_carrying; } + inline Granito* get_carrying() const { return m_carrying; } /** * @scripting diff --git a/src/badguy/mrbomb.hpp b/src/badguy/mrbomb.hpp index 4cc07c600be..48d88324c48 100644 --- a/src/badguy/mrbomb.hpp +++ b/src/badguy/mrbomb.hpp @@ -44,7 +44,7 @@ class MrBomb : public WalkingBadguy virtual void freeze() override; virtual bool is_freezable() const override; - bool is_ticking() const { return m_state == MB_STATE_TICKING; } + inline bool is_ticking() const { return m_state == MB_STATE_TICKING; } virtual void trigger(Player* player); virtual void explode(); diff --git a/src/badguy/treewillowisp.cpp b/src/badguy/treewillowisp.cpp index b147d881f2c..0f3762904a6 100644 --- a/src/badguy/treewillowisp.cpp +++ b/src/badguy/treewillowisp.cpp @@ -154,12 +154,6 @@ TreeWillOWisp::set_color(const Color& color_) m_sprite->set_color(color_); } -Color -TreeWillOWisp::get_color() const -{ - return color; -} - void TreeWillOWisp::stop_looping_sounds() { if (sound_source) { diff --git a/src/badguy/treewillowisp.hpp b/src/badguy/treewillowisp.hpp index a03c9a8dc93..6b3cc044a84 100644 --- a/src/badguy/treewillowisp.hpp +++ b/src/badguy/treewillowisp.hpp @@ -46,7 +46,7 @@ class TreeWillOWisp final : public BadGuy void start_sucking(const Vector& suck_target); void set_color(const Color& color); - Color get_color() const; + inline Color get_color() const { return color; } protected: virtual bool collides(GameObject& other, const CollisionHit& hit) const override; diff --git a/src/badguy/walking_badguy.cpp b/src/badguy/walking_badguy.cpp index 51b07ccf3fc..a1c242f3513 100644 --- a/src/badguy/walking_badguy.cpp +++ b/src/badguy/walking_badguy.cpp @@ -255,10 +255,4 @@ WalkingBadguy::unfreeze(bool melt) WalkingBadguy::initialize(); } -void -WalkingBadguy::set_velocity_y(float vy) -{ - m_physic.set_velocity_y(vy); -} - /* EOF */ diff --git a/src/badguy/walking_badguy.hpp b/src/badguy/walking_badguy.hpp index 4e43ed62235..c2bfacf9cb1 100644 --- a/src/badguy/walking_badguy.hpp +++ b/src/badguy/walking_badguy.hpp @@ -65,16 +65,17 @@ class WalkingBadguy : public BadGuy /** used by objects that should make badguys not turn around when they are walking on them */ void override_stay_on_platform() { m_stay_on_platform_overridden = true; } - float get_velocity_x() const { return m_physic.get_velocity_x(); } - float get_velocity_y() const { return m_physic.get_velocity_y(); } - void set_velocity_y(float vy); + inline float get_velocity_x() const { return m_physic.get_velocity_x(); } + inline float get_velocity_y() const { return m_physic.get_velocity_y(); } + inline void set_velocity_x(float vx) { m_physic.set_velocity_x(vx); } + inline void set_velocity_y(float vy) { m_physic.set_velocity_y(vy); } /** Adds velocity to the badguy (be careful when using this) */ void add_velocity(const Vector& velocity); - float get_walk_speed() const { return walk_speed; } + inline float get_walk_speed() const { return walk_speed; } void set_walk_speed (float); - bool is_active() const { return BadGuy::is_active(); } + inline bool is_active() const { return BadGuy::is_active(); } /** Set max_drop_height depending on the given behavior */ void set_ledge_behavior(LedgeBehavior behavior); diff --git a/src/badguy/willowisp.hpp b/src/badguy/willowisp.hpp index 91436301b3a..b14bda56e3a 100644 --- a/src/badguy/willowisp.hpp +++ b/src/badguy/willowisp.hpp @@ -78,7 +78,7 @@ class WillOWisp final : public BadGuy, /** make WillOWisp vanish */ void vanish(); - Color get_color() const { return m_color; } + inline Color get_color() const { return m_color; } protected: virtual std::vector get_allowed_directions() const override; diff --git a/src/collision/collision.hpp b/src/collision/collision.hpp index bd51f192fbe..76b4ace4838 100644 --- a/src/collision/collision.hpp +++ b/src/collision/collision.hpp @@ -86,12 +86,12 @@ class Constraints final float get_position_left () const { return position_left; } float get_position_right () const { return position_right; } float get_position_top () const { return position_top; } - float get_position_bottom () const { return position_bottom; } + inline float get_position_bottom () const { return position_bottom; } - float get_height () const { return (position_bottom - position_top); } - float get_width () const { return (position_right - position_left); } + inline float get_height () const { return (position_bottom - position_top); } + inline float get_width () const { return (position_right - position_left); } - float get_x_midpoint () const { return (.5f * (position_left + position_right)); } + inline float get_x_midpoint () const { return (.5f * (position_left + position_right)); } CollisionHit hit; diff --git a/src/collision/collision_object.hpp b/src/collision/collision_object.hpp index daf931d7acb..97f9f37a243 100644 --- a/src/collision/collision_object.hpp +++ b/src/collision/collision_object.hpp @@ -56,30 +56,30 @@ class CollisionObject void notify_object_removal(CollisionObject* other); - void set_ground_movement_manager(const std::shared_ptr& movement_manager) + inline void set_ground_movement_manager(const std::shared_ptr& movement_manager) { m_ground_movement_manager = movement_manager; } void clear_bottom_collision_list(); - bool is_unisolid() const { return m_unisolid; } - void set_unisolid(bool unisolid) { m_unisolid = unisolid; } + inline bool is_unisolid() const { return m_unisolid; } + inline void set_unisolid(bool unisolid) { m_unisolid = unisolid; } /** returns the bounding box of the Object */ - const Rectf& get_bbox() const + inline const Rectf& get_bbox() const { return m_bbox; } - void set_movement(const Vector& movement) + inline void set_movement(const Vector& movement) { m_movement = movement; } void propagate_movement(const Vector& movement); - const Vector& get_movement() const + inline const Vector& get_movement() const { return m_movement; } @@ -93,12 +93,12 @@ class CollisionObject m_bbox.set_pos(pos); } - Vector get_pos() const + inline Vector get_pos() const { return m_bbox.p1(); } - Vector get_pressure() const + inline Vector get_pressure() const { return m_pressure; } @@ -106,7 +106,7 @@ class CollisionObject /** moves entire object to a specific position, including all points those the object has, exactly like the object has spawned in that given pos instead.*/ - void move_to(const Vector& pos) + inline void move_to(const Vector& pos) { set_pos(pos); } @@ -129,14 +129,14 @@ class CollisionObject m_bbox.set_size(w, h); } - CollisionGroup get_group() const + inline CollisionGroup get_group() const { return m_group; } bool is_valid() const; - CollisionListener& get_listener() + inline CollisionListener& get_listener() { return m_listener; } diff --git a/src/control/controller.cpp b/src/control/controller.cpp index 5b23863eac7..d4d1d9e8637 100644 --- a/src/control/controller.cpp +++ b/src/control/controller.cpp @@ -106,12 +106,6 @@ Controller::set_jump_key_with_up(bool value) } } -void -Controller::set_touchscreen(bool value) -{ - m_touchscreen = value; -} - bool Controller::hold(Control control) const { @@ -130,12 +124,6 @@ Controller::released(Control control) const return m_old_controls[static_cast(control)] && !m_controls[static_cast(control)]; } -bool -Controller::is_touchscreen() const -{ - return m_touchscreen; -} - void Controller::update() { diff --git a/src/control/controller.hpp b/src/control/controller.hpp index 37b285e6c41..88be82c2917 100644 --- a/src/control/controller.hpp +++ b/src/control/controller.hpp @@ -68,7 +68,7 @@ class Controller void set_jump_key_with_up(bool value); /** Touchscreen flag is set by MobileController, cleared when starting the level */ - void set_touchscreen(bool value); + inline void set_touchscreen(bool value) { m_touchscreen = value; } /** returns true if the control is pressed down */ bool hold(Control control) const; @@ -93,7 +93,7 @@ class Controller void reset(); /** returns true if the controller event has been generated by touchscreen */ - bool is_touchscreen() const; + inline bool is_touchscreen() const { return m_touchscreen; } protected: /** current control status */ diff --git a/src/control/game_controller_manager.hpp b/src/control/game_controller_manager.hpp index 626065f4c90..9e2855e83e2 100644 --- a/src/control/game_controller_manager.hpp +++ b/src/control/game_controller_manager.hpp @@ -54,7 +54,7 @@ class GameControllerManager final void bind_controller(SDL_GameController* controller, int player_id); - std::unordered_map& get_controller_mapping() { return m_game_controllers; } + inline std::unordered_map& get_controller_mapping() { return m_game_controllers; } private: InputManager* m_parent; diff --git a/src/control/input_manager.hpp b/src/control/input_manager.hpp index 00f986f785e..9d14d37a5ff 100644 --- a/src/control/input_manager.hpp +++ b/src/control/input_manager.hpp @@ -53,12 +53,12 @@ class InputManager final : public Currenton void reset(); void use_game_controller(bool v); - bool use_game_controller() const { return m_use_game_controller; } + inline bool use_game_controller() const { return m_use_game_controller; } const Controller& get_controller(int player_id = 0) const; Controller& get_controller(int player_id = 0); - int get_num_users() const { return static_cast(m_controllers.size()); } + inline int get_num_users() const { return static_cast(m_controllers.size()); } bool can_add_user() const; void push_user(); void pop_user(); diff --git a/src/control/joystick_manager.hpp b/src/control/joystick_manager.hpp index 9fea95a8bac..f9c3d400205 100644 --- a/src/control/joystick_manager.hpp +++ b/src/control/joystick_manager.hpp @@ -52,7 +52,7 @@ class JoystickManager final void on_joystick_added(int joystick_index); void on_joystick_removed(int instance_id); - int get_num_joysticks() const { return static_cast(joysticks.size()); } + inline int get_num_joysticks() const { return static_cast(joysticks.size()); } void on_player_removed(int player_id); bool has_corresponding_joystick(int player_id) const; @@ -62,7 +62,7 @@ class JoystickManager final void bind_joystick(SDL_Joystick* joystick, int player_id); - std::unordered_map& get_joystick_mapping() { return joysticks; } + inline std::unordered_map& get_joystick_mapping() { return joysticks; } private: InputManager* parent; diff --git a/src/editor/bezier_marker.hpp b/src/editor/bezier_marker.hpp index daf2e038a57..b3f67b136e1 100644 --- a/src/editor/bezier_marker.hpp +++ b/src/editor/bezier_marker.hpp @@ -37,7 +37,7 @@ class BezierMarker final : public MarkerObject void update_iterator(Path::Node* it, Vector* bezier_pos); - void set_parent(UID uid) { m_parent = uid; } + inline void set_parent(UID uid) { m_parent = uid; } NodeMarker* get_parent() const; void save_state() override; diff --git a/src/editor/editor.cpp b/src/editor/editor.cpp index 6eef96cbe15..bfd17406952 100644 --- a/src/editor/editor.cpp +++ b/src/editor/editor.cpp @@ -392,30 +392,6 @@ Editor::open_level_directory() FileSystem::open_path(path); } -void -Editor::set_world(std::unique_ptr w) -{ - m_world = std::move(w); -} - -int -Editor::get_tileselect_select_mode() const -{ - return m_toolbox_widget->get_tileselect_select_mode(); -} - -int -Editor::get_tileselect_move_mode() const -{ - return m_toolbox_widget->get_tileselect_move_mode(); -} - -void -Editor::update_autotileset() -{ - m_overlay_widget->update_autotileset(); -} - void Editor::scroll(const Vector& velocity) { diff --git a/src/editor/editor.hpp b/src/editor/editor.hpp index 5eec578fd42..d55232c5b0e 100644 --- a/src/editor/editor.hpp +++ b/src/editor/editor.hpp @@ -87,26 +87,27 @@ class Editor final : public Screen, void disable_keyboard() { m_enabled = false; } - Level* get_level() const { return m_level.get(); } + inline Level* get_level() const { return m_level.get(); } - void set_world(std::unique_ptr w); - World* get_world() const { return m_world.get(); } + inline void set_world(std::unique_ptr w) { m_world = std::move(w); } + inline World* get_world() const { return m_world.get(); } - TileSet* get_tileset() const { return m_tileset; } - TileSelection* get_tiles() const { return m_toolbox_widget->get_tilebox().get_tiles(); } - std::string get_tileselect_object() const { return m_toolbox_widget->get_tilebox().get_object(); } + inline TileSet* get_tileset() const { return m_tileset; } + inline TileSelection* get_tiles() const { return m_toolbox_widget->get_tilebox().get_tiles(); } + inline std::string get_tileselect_object() const { return m_toolbox_widget->get_tilebox().get_object(); } - EditorTilebox::InputType get_tileselect_input_type() const { return m_toolbox_widget->get_tilebox().get_input_type(); } + inline EditorTilebox::InputType get_tileselect_input_type() const { return m_toolbox_widget->get_tilebox().get_input_type(); } - bool has_active_toolbox_tip() const { return m_toolbox_widget->get_tilebox().has_active_object_tip(); } + inline bool has_active_toolbox_tip() const { return m_toolbox_widget->get_tilebox().has_active_object_tip(); } - int get_tileselect_select_mode() const; - int get_tileselect_move_mode() const; + inline int get_tileselect_select_mode() const { return m_toolbox_widget->get_tileselect_select_mode(); } + inline int get_tileselect_move_mode() const { return m_toolbox_widget->get_tileselect_move_mode(); } - const std::string& get_levelfile() const { return m_levelfile; } + inline const std::string& get_levelfile() const { return m_levelfile; } - void set_level(const std::string& levelfile_) { - m_levelfile = levelfile_; + inline void set_level(const std::string& levelfile) + { + m_levelfile = levelfile; m_reload_request = true; } @@ -114,7 +115,7 @@ class Editor final : public Screen, void open_level_directory(); - bool is_testing_level() const { return m_leveltested; } + inline bool is_testing_level() const { return m_leveltested; } void remove_autosave_file(); @@ -122,9 +123,9 @@ class Editor final : public Screen, void convert_tiles_by_file(const std::string& file); void check_deprecated_tiles(bool focus = false); - bool has_deprecated_tiles() const { return m_has_deprecated_tiles; } + inline bool has_deprecated_tiles() const { return m_has_deprecated_tiles; } - void update_autotileset(); + inline void update_autotileset() { m_overlay_widget->update_autotileset(); } /** Checks whether the level can be saved and does not contain obvious issues (currently: check if main sector and a spawn point @@ -149,7 +150,7 @@ class Editor final : public Screen, void scroll(const Vector& velocity); - bool is_level_loaded() const { return m_levelloaded; } + inline bool is_level_loaded() const { return m_levelloaded; } void edit_path(PathGameObject* path, GameObject* new_marked_object) { m_overlay_widget->edit_path(path, new_marked_object); @@ -157,9 +158,9 @@ class Editor final : public Screen, void add_layer(GameObject* layer) { m_layers_widget->add_layer(layer); } - TileMap* get_selected_tilemap() const { return m_layers_widget->get_selected_tilemap(); } + inline TileMap* get_selected_tilemap() const { return m_layers_widget->get_selected_tilemap(); } - Sector* get_sector() { return m_sector; } + inline Sector* get_sector() { return m_sector; } void retoggle_undo_tracking(); void undo_stack_cleanup(); diff --git a/src/editor/layer_icon.hpp b/src/editor/layer_icon.hpp index 4b664ee4625..970bf6a64ca 100644 --- a/src/editor/layer_icon.hpp +++ b/src/editor/layer_icon.hpp @@ -34,7 +34,7 @@ class LayerIcon : public ObjectIcon int get_zpos() const; bool is_valid() const; - GameObject* get_layer() const { return m_layer; } + inline GameObject* get_layer() const { return m_layer; } bool is_tilemap() const; private: diff --git a/src/editor/object_group.hpp b/src/editor/object_group.hpp index e40cd6c2535..64833d32373 100644 --- a/src/editor/object_group.hpp +++ b/src/editor/object_group.hpp @@ -32,12 +32,12 @@ class ObjectGroup final void add_icon(const std::string& object, const std::string& icon_path); - const std::string& get_name() const { return m_name; } + inline const std::string& get_name() const { return m_name; } bool is_worldmap() const { return m_for_worldmap; } - const std::vector& get_icons() const { return m_icons; } - std::vector& get_icons() { return m_icons; } + inline const std::vector& get_icons() const { return m_icons; } + inline std::vector& get_icons() { return m_icons; } private: std::string m_name; diff --git a/src/editor/object_icon.hpp b/src/editor/object_icon.hpp index c37f0bff026..5645bd1e194 100644 --- a/src/editor/object_icon.hpp +++ b/src/editor/object_icon.hpp @@ -35,7 +35,7 @@ class ObjectIcon virtual void draw(DrawingContext& context, const Vector& pos); virtual void draw(DrawingContext& context, const Vector& pos, int pixels_shown); - const std::string& get_object_class() const { return m_object_class; } + inline const std::string& get_object_class() const { return m_object_class; } ObjectIcon(const ObjectIcon&) = default; ObjectIcon& operator=(const ObjectIcon&) = default; diff --git a/src/editor/object_info.hpp b/src/editor/object_info.hpp index 29afe3fedf2..e07943bb0a6 100644 --- a/src/editor/object_info.hpp +++ b/src/editor/object_info.hpp @@ -26,8 +26,8 @@ class ObjectInfo final public: ObjectInfo(); - int get_num_worldmap_groups() const { return get_num_groups(true); } - int get_num_level_groups() const { return get_num_groups(false); } + inline int get_num_worldmap_groups() const { return get_num_groups(true); } + inline int get_num_level_groups() const { return get_num_groups(false); } int get_first_worldmap_group_index() const; diff --git a/src/editor/object_option.hpp b/src/editor/object_option.hpp index 2385921be40..53e1323a80f 100644 --- a/src/editor/object_option.hpp +++ b/src/editor/object_option.hpp @@ -73,9 +73,9 @@ class BaseObjectOption virtual void save_old_state(std::ostream& out) const; virtual void save_new_state(Writer& writer) const; - const std::string& get_key() const { return m_key; } - const std::string& get_text() const { return m_text; } - unsigned int get_flags() const { return m_flags; } + inline const std::string& get_key() const { return m_key; } + inline const std::string& get_text() const { return m_text; } + inline unsigned int get_flags() const { return m_flags; } protected: const std::string m_text; @@ -96,7 +96,7 @@ class ObjectOption: public BaseObjectOption ObjectOption(const std::string& text, const std::string& key, unsigned int flags, T* pointer = nullptr); virtual ~ObjectOption() override = default; - virtual T* get_value() const { return m_value_pointer; } + inline T* get_value() const { return m_value_pointer; } protected: T* const m_value_pointer; diff --git a/src/editor/object_settings.hpp b/src/editor/object_settings.hpp index df523d17113..fc889dc8c2e 100644 --- a/src/editor/object_settings.hpp +++ b/src/editor/object_settings.hpp @@ -48,7 +48,7 @@ class ObjectSettings final ObjectSettings& operator=(ObjectSettings&&) = default; - const std::string& get_name() const { return m_name; } + inline const std::string& get_name() const { return m_name; } void add_bool(const std::string& text, bool* value_ptr, const std::string& key = {}, @@ -164,7 +164,7 @@ class ObjectSettings final // VERY UNSTABLE - use with care ~ Semphris (author of that option) void add_button(const std::string& text, const std::function& callback); - const std::vector >& get_options() const { return m_options; } + inline const std::vector>& get_options() const { return m_options; } /** Reorder the options in the given order, this is a hack to get saving identical to the other editor */ diff --git a/src/editor/overlay_widget.cpp b/src/editor/overlay_widget.cpp index 2ccdd600593..6c423a8260d 100644 --- a/src/editor/overlay_widget.cpp +++ b/src/editor/overlay_widget.cpp @@ -1651,11 +1651,4 @@ EditorOverlayWidget::align_to_tilemap(const Vector& sp, int tile_size) const return glm::trunc(sp_) * static_cast(tile_size); } -void -EditorOverlayWidget::set_warning(const std::string& text, float time) -{ - m_warning_text = text; - m_warning_timer.start(time); -} - /* EOF */ diff --git a/src/editor/overlay_widget.hpp b/src/editor/overlay_widget.hpp index 29ab9ac9824..13d12080c22 100644 --- a/src/editor/overlay_widget.hpp +++ b/src/editor/overlay_widget.hpp @@ -126,7 +126,11 @@ class EditorOverlayWidget final : public Widget Rectf selection_draw_rect() const; void update_tile_selection(); - void set_warning(const std::string& text, float time); + inline void set_warning(const std::string& text, float time) + { + m_warning_text = text; + m_warning_timer.start(time); + } private: Editor& m_editor; diff --git a/src/editor/particle_editor.hpp b/src/editor/particle_editor.hpp index 0be83856831..18e607ae1f0 100644 --- a/src/editor/particle_editor.hpp +++ b/src/editor/particle_editor.hpp @@ -73,7 +73,7 @@ class ParticleEditor final : public Screen, void save(Writer& writer); void request_save(bool is_save_as = false, const std::function& callback = [](bool was_saved){}); - void open(const std::string& filename) { m_filename = filename; reload(); } + inline void open(const std::string& filename) { m_filename = filename; reload(); } void new_file() { m_filename = ""; reload(); } /** Reloads the particle object from the filename in m_filename. diff --git a/src/editor/tilebox.cpp b/src/editor/tilebox.cpp index bc082898499..1ee9d53e74e 100644 --- a/src/editor/tilebox.cpp +++ b/src/editor/tilebox.cpp @@ -377,12 +377,6 @@ EditorTilebox::select_tilegroup(int id) reset_scrollbar(); } -void -EditorTilebox::set_tilegroup(std::unique_ptr tilegroup) -{ - m_active_tilegroup = std::move(tilegroup); -} - void EditorTilebox::select_objectgroup(int id) { diff --git a/src/editor/tilebox.hpp b/src/editor/tilebox.hpp index c76392d18f1..3284605a72e 100644 --- a/src/editor/tilebox.hpp +++ b/src/editor/tilebox.hpp @@ -70,26 +70,26 @@ class EditorTilebox final : public Widget virtual void on_window_resize() override; void set_rect(const Rectf& rect); - Rectf get_rect() const { return m_rect; } + inline Rectf get_rect() const { return m_rect; } void on_select(const std::function& callback); void select_tilegroup(int id); - void set_tilegroup(std::unique_ptr tilegroup); + inline void set_tilegroup(std::unique_ptr tilegroup) { m_active_tilegroup = std::move(tilegroup); } void select_objectgroup(int id); bool select_layers_objectgroup(); - const ObjectInfo& get_object_info() const { return *m_object_info; } - InputType get_input_type() const { return m_input_type; } - void set_input_type(InputType input_type) { m_input_type = input_type; } + inline const ObjectInfo& get_object_info() const { return *m_object_info; } + inline InputType get_input_type() const { return m_input_type; } + inline void set_input_type(InputType input_type) { m_input_type = input_type; } - TileSelection* get_tiles() const { return m_tiles.get(); } - const std::string& get_object() const { return m_object; } - void set_object(const std::string& object) { m_object = object; } + inline TileSelection* get_tiles() const { return m_tiles.get(); } + inline const std::string& get_object() const { return m_object; } + inline void set_object(const std::string& object) { m_object = object; } float get_tiles_height() const; - bool has_active_object_tip() const { return m_object_tip->get_visible(); } + inline bool has_active_object_tip() const { return m_object_tip->get_visible(); } private: Vector get_tile_coords(int pos, bool relative = true) const; diff --git a/src/editor/tip.hpp b/src/editor/tip.hpp index f779465464a..736725e329f 100644 --- a/src/editor/tip.hpp +++ b/src/editor/tip.hpp @@ -35,8 +35,8 @@ class Tip final void set_info(const std::string& text); void set_info(const std::string& header, const std::vector& text); void set_info_for_object(GameObject& object); - void set_visible(bool visible) { m_visible = visible; } - bool get_visible() const { return m_visible; } + inline void set_visible(bool visible) { m_visible = visible; } + inline bool get_visible() const { return m_visible; } private: std::vector m_strings; diff --git a/src/editor/tool_icon.hpp b/src/editor/tool_icon.hpp index 5c16f0f98e7..2b5480f09b5 100644 --- a/src/editor/tool_icon.hpp +++ b/src/editor/tool_icon.hpp @@ -32,7 +32,7 @@ class ToolIcon final void draw(DrawingContext& context); - int get_mode() const { return m_mode; } + inline int get_mode() const { return m_mode; } void next_mode(); diff --git a/src/editor/toolbox_widget.hpp b/src/editor/toolbox_widget.hpp index 521a0c7dbfb..dce0bc610de 100644 --- a/src/editor/toolbox_widget.hpp +++ b/src/editor/toolbox_widget.hpp @@ -61,9 +61,9 @@ class EditorToolboxWidget final : public Widget void update_mouse_icon(); - EditorTilebox& get_tilebox() const { return *m_tilebox; } + inline EditorTilebox& get_tilebox() const { return *m_tilebox; } - bool has_mouse_focus() const { return m_has_mouse_focus; } + inline bool has_mouse_focus() const { return m_has_mouse_focus; } private: Vector get_tool_coords(int pos) const; diff --git a/src/gui/dialog.hpp b/src/gui/dialog.hpp index 25b0fa30652..7de6e5f3673 100644 --- a/src/gui/dialog.hpp +++ b/src/gui/dialog.hpp @@ -76,8 +76,8 @@ class Dialog Vector get_center_pos() const; - float get_width() const { return m_size.width; } - float get_height() const { return m_size.height; } + inline float get_width() const { return m_size.width; } + inline float get_height() const { return m_size.height; } static void show_message(const std::string& text, bool passive = false, bool no_auto_clear = false, const std::function& ok_callback = {}) { diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index fc4486925ac..83400b74390 100644 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -73,13 +73,6 @@ Menu::~Menu() { } -void -Menu::set_center_pos(float x, float y) -{ - m_pos.x = x; - m_pos.y = y; -} - /* Add an item to a menu */ MenuItem& Menu::add_item(std::unique_ptr new_item) diff --git a/src/gui/menu.hpp b/src/gui/menu.hpp index 59362245315..8d6082347b0 100644 --- a/src/gui/menu.hpp +++ b/src/gui/menu.hpp @@ -121,8 +121,8 @@ class Menu int get_active_item_id() const; void set_active_item(int id); - Vector get_center_pos() const { return m_pos; } - void set_center_pos(float x, float y); + inline Vector get_center_pos() const { return m_pos; } + inline void set_center_pos(float x, float y) { m_pos.x = x; m_pos.y = y; } float get_width() const; float get_height() const; diff --git a/src/gui/menu_item.hpp b/src/gui/menu_item.hpp index 274c201b37f..95aaccbb4e1 100644 --- a/src/gui/menu_item.hpp +++ b/src/gui/menu_item.hpp @@ -26,16 +26,16 @@ class MenuItem MenuItem(const std::string& text, int id = -1); virtual ~MenuItem(); - int get_id() const { return m_id; } + inline int get_id() const { return m_id; } void set_help(const std::string& help_text); - const std::string& get_help() const { return m_help; } + inline const std::string& get_help() const { return m_help; } - void set_text(const std::string& text) { m_text = text; } - const std::string& get_text() const { return m_text; } + inline void set_text(const std::string& text) { m_text = text; } + inline const std::string& get_text() const { return m_text; } - void set_font(const FontPtr font) { m_font = font; } - const FontPtr& get_font() const { return m_font; } + inline void set_font(const FontPtr font) { m_font = font; } + inline const FontPtr& get_font() const { return m_font; } /** Draws the menu item. */ virtual void draw(DrawingContext&, const Vector& pos, int menu_width, bool active); diff --git a/src/gui/menu_manager.cpp b/src/gui/menu_manager.cpp index d568333edf4..7542bf90481 100644 --- a/src/gui/menu_manager.cpp +++ b/src/gui/menu_manager.cpp @@ -286,18 +286,6 @@ MenuManager::on_window_resize() } -bool -MenuManager::is_active() const -{ - return !m_menu_stack.empty(); -} - -bool -MenuManager::has_dialog() const -{ - return m_dialog.current || m_dialog.has_next; -} - Menu* MenuManager::current_menu() const { diff --git a/src/gui/menu_manager.hpp b/src/gui/menu_manager.hpp index 765b0d2f237..91ea5c4a566 100644 --- a/src/gui/menu_manager.hpp +++ b/src/gui/menu_manager.hpp @@ -82,8 +82,8 @@ class MenuManager final : public Currenton void on_window_resize(); - bool is_active() const; - bool has_dialog() const; + inline bool is_active() const { return !m_menu_stack.empty(); } + inline bool has_dialog() const { return m_dialog.current || m_dialog.has_next; } Menu* current_menu() const; Menu* previous_menu() const; diff --git a/src/gui/menu_transition.hpp b/src/gui/menu_transition.hpp index a04754571a5..8360a4a6460 100644 --- a/src/gui/menu_transition.hpp +++ b/src/gui/menu_transition.hpp @@ -39,8 +39,8 @@ class MenuTransition final void update(); void draw(DrawingContext& context); - void set(const Rectf& rect) { m_to_rect = m_from_rect = rect; } - bool is_active() const { return m_is_active; } + inline void set(const Rectf& rect) { m_to_rect = m_from_rect = rect; } + inline bool is_active() const { return m_is_active; } }; #endif diff --git a/src/gui/mousecursor.cpp b/src/gui/mousecursor.cpp index 03f3ec99b68..6ac71b7ad6d 100644 --- a/src/gui/mousecursor.cpp +++ b/src/gui/mousecursor.cpp @@ -40,18 +40,6 @@ MouseCursor::MouseCursor(SpritePtr sprite) : { } -void -MouseCursor::set_state(MouseCursorState state) -{ - m_state = state; -} - -void -MouseCursor::set_icon(SurfacePtr icon) -{ - m_icon = std::move(icon); -} - void MouseCursor::apply_state(MouseCursorState state) { diff --git a/src/gui/mousecursor.hpp b/src/gui/mousecursor.hpp index a8a7293e01d..706d7612cd6 100644 --- a/src/gui/mousecursor.hpp +++ b/src/gui/mousecursor.hpp @@ -54,10 +54,10 @@ class MouseCursor final : public Currenton void draw(DrawingContext& context); - void set_state(MouseCursorState state); - void set_icon(SurfacePtr icon); + inline void set_state(MouseCursorState state) { m_state = state; } + inline void set_icon(SurfacePtr icon) { m_icon = std::move(icon); } - void set_pos(int x, int y) { m_mobile_mode = true; m_x = x; m_y = y; } + inline void set_pos(int x, int y) { m_mobile_mode = true; m_x = x; m_y = y; } private: void apply_state(MouseCursorState state); diff --git a/src/gui/notification.hpp b/src/gui/notification.hpp index 8297be8b383..086df411e25 100644 --- a/src/gui/notification.hpp +++ b/src/gui/notification.hpp @@ -55,7 +55,7 @@ class Notification void set_text(const std::string& text); void set_mini_text(const std::string& text); - void on_press(const std::function& callback) { m_callback = callback; } + inline void on_press(const std::function& callback) { m_callback = callback; } void event(const SDL_Event& event); void process_input(const Controller& controller); diff --git a/src/interface/control.hpp b/src/interface/control.hpp index 6be4bcf766d..c220fa337fe 100644 --- a/src/interface/control.hpp +++ b/src/interface/control.hpp @@ -34,11 +34,11 @@ class InterfaceControl : public Widget virtual void draw(DrawingContext& context) override { if (m_label) m_label->draw(context); } virtual bool on_mouse_motion(const SDL_MouseMotionEvent& motion) override { if (m_label) m_label->on_mouse_motion(motion); return false; } - void set_focus(bool focus) { m_has_focus = focus; } - bool has_focus() const { return m_has_focus; } + inline void set_focus(bool focus) { m_has_focus = focus; } + inline bool has_focus() const { return m_has_focus; } - void set_rect(const Rectf& rect) { m_rect = rect; } - Rectf get_rect() const { return m_rect; } + inline void set_rect(const Rectf& rect) { m_rect = rect; } + inline Rectf get_rect() const { return m_rect; } public: /** Optional; a function that will be called each time the bound value diff --git a/src/interface/control_checkbox.hpp b/src/interface/control_checkbox.hpp index 5bb1af21747..4e705516f40 100644 --- a/src/interface/control_checkbox.hpp +++ b/src/interface/control_checkbox.hpp @@ -29,9 +29,9 @@ class ControlCheckbox : public InterfaceControl virtual bool on_mouse_button_down(const SDL_MouseButtonEvent& button) override; virtual bool on_key_up(const SDL_KeyboardEvent& key) override; - bool get_value() const { return *m_value; } - void set_value(bool value) { *m_value = value; } - void bind_value(bool* value) { m_value = value; } + inline bool get_value() const { return *m_value; } + inline void set_value(bool value) { *m_value = value; } + inline void bind_value(bool* value) { m_value = value; } private: bool* m_value; diff --git a/src/interface/control_enum.hpp b/src/interface/control_enum.hpp index 2110269fce8..1bfa2ee2c6a 100644 --- a/src/interface/control_enum.hpp +++ b/src/interface/control_enum.hpp @@ -36,9 +36,9 @@ class ControlEnum : public InterfaceControl virtual bool on_key_up(const SDL_KeyboardEvent& key) override; virtual bool on_key_down(const SDL_KeyboardEvent& key) override; - T get_value() const { return *m_value; } - void set_value(T value) { *m_value = value; } - void bind_value(T* value) { m_value = value; } + inline T get_value() const { return *m_value; } + inline void set_value(T value) { *m_value = value; } + inline void bind_value(T* value) { m_value = value; } void add_option(T key, const std::string& label) { m_options.push_back(std::make_pair(key, label)); } diff --git a/src/interface/control_scrollbar.cpp b/src/interface/control_scrollbar.cpp index 7103920b4ea..dfd9acd509d 100644 --- a/src/interface/control_scrollbar.cpp +++ b/src/interface/control_scrollbar.cpp @@ -158,20 +158,6 @@ ControlScrollbar::scroll(float amount) m_progress = m_total_region - m_covered_region; } -void -ControlScrollbar::set_covered_region(float region) -{ - m_covered_region = region; - check_regions(); -} - -void -ControlScrollbar::set_total_region(float region) -{ - m_total_region = region; - check_regions(); -} - void ControlScrollbar::check_regions() { diff --git a/src/interface/control_scrollbar.hpp b/src/interface/control_scrollbar.hpp index 25ae5622163..79f5c523ad8 100644 --- a/src/interface/control_scrollbar.hpp +++ b/src/interface/control_scrollbar.hpp @@ -42,16 +42,16 @@ class ControlScrollbar final : public Widget void scroll(float amount); - void set_mouse_wheel_speed(float speed) { m_mouse_wheel_speed = speed; } + inline void set_mouse_wheel_speed(float speed) { m_mouse_wheel_speed = speed; } - void set_rect(const Rectf& rect) { m_rect = rect; } - const Rectf& get_rect() const { return m_rect; } + inline void set_rect(const Rectf& rect) { m_rect = rect; } + inline const Rectf& get_rect() const { return m_rect; } - float get_covered_region() const { return m_covered_region; } - float get_total_region() const { return m_total_region; } + inline float get_covered_region() const { return m_covered_region; } + inline float get_total_region() const { return m_total_region; } - void set_covered_region(float region); - void set_total_region(float region); + inline void set_covered_region(float region) { m_covered_region = region; check_regions(); } + inline void set_total_region(float region) { m_total_region = region; check_regions(); } private: void check_regions(); diff --git a/src/interface/control_textbox.hpp b/src/interface/control_textbox.hpp index ec81d53ef40..c0a25ab85af 100644 --- a/src/interface/control_textbox.hpp +++ b/src/interface/control_textbox.hpp @@ -39,7 +39,7 @@ class ControlTextbox : public InterfaceControl virtual void update(float dt_sec) override; /** Binds a string to the textbox */ - void bind_string(std::string* value) { m_string = value; } + inline void bind_string(std::string* value) { m_string = value; } /** Returns the full string held in m_charlist */ const std::string& get_string() const; diff --git a/src/interface/control_textbox_float.hpp b/src/interface/control_textbox_float.hpp index cf41463e57d..84c6995d6fb 100644 --- a/src/interface/control_textbox_float.hpp +++ b/src/interface/control_textbox_float.hpp @@ -26,14 +26,14 @@ class ControlTextboxFloat : public ControlTextbox virtual void update(float dt_sec) override; - float get_value() const { return *m_value; } - void set_value(float value) { *m_value = value; revert_value(); } + inline float get_value() const { return *m_value; } + inline void set_value(float value) { *m_value = value; revert_value(); } /** Binds a float to this textbox. Set m_validate_float(float) if you want * custom validation. (You may also use m_validate_string(string), though * it's not recommended) * @param value A pointer to the value to be bound. MUST NOT BE NULL (FIXME) */ - void bind_value(float* value) { m_value = value; revert_value(); } + inline void bind_value(float* value) { m_value = value; revert_value(); } protected: virtual bool parse_value(bool call_on_change = true) override; diff --git a/src/interface/control_textbox_int.hpp b/src/interface/control_textbox_int.hpp index f720b3ff7aa..ffca76bab61 100644 --- a/src/interface/control_textbox_int.hpp +++ b/src/interface/control_textbox_int.hpp @@ -26,14 +26,14 @@ class ControlTextboxInt : public ControlTextbox virtual void update(float dt_sec) override; - int get_value() const { return *m_value; } - void set_value(int value) { *m_value = value; revert_value(); } + inline int get_value() const { return *m_value; } + inline void set_value(int value) { *m_value = value; revert_value(); } /** Binds an int to this textbox. Set m_validate_fint(int) if you want * custom validation. (You may also use m_validate_string(string), though * it's not recommended) * @param value A pointer to the value to be bound. MUST NOT BE NULL (FIXME) */ - void bind_value(int* value) { m_value = value; revert_value(); } + inline void bind_value(int* value) { m_value = value; revert_value(); } protected: virtual bool parse_value(bool call_on_change = true) override; diff --git a/src/interface/label.hpp b/src/interface/label.hpp index 288cdd84860..e622e0106cb 100644 --- a/src/interface/label.hpp +++ b/src/interface/label.hpp @@ -32,11 +32,11 @@ class InterfaceLabel : public Widget virtual void draw(DrawingContext& context) override; virtual bool on_mouse_motion(const SDL_MouseMotionEvent& motion) override; - void set_rect(const Rectf& rect) { m_rect = rect; } - Rectf get_rect() const { return m_rect; } + inline void set_rect(const Rectf& rect) { m_rect = rect; } + inline Rectf get_rect() const { return m_rect; } - void set_label(const std::string& label) { m_label = label; } - const std::string& get_label() const { return m_label; } + inline void set_label(const std::string& label) { m_label = label; } + inline const std::string& get_label() const { return m_label; } bool fits(const std::string& text) const; std::string get_truncated_text() const; diff --git a/src/math/rect.hpp b/src/math/rect.hpp index 3183cda4f6f..f73e0e86180 100644 --- a/src/math/rect.hpp +++ b/src/math/rect.hpp @@ -98,15 +98,15 @@ class Rect final top <= other.top && other.bottom <= bottom); } - const int& get_left() const { return left; } - const int& get_right() const { return right; } - const int& get_top() const { return top; } - const int& get_bottom() const { return bottom; } + inline const int& get_left() const { return left; } + inline const int& get_right() const { return right; } + inline const int& get_top() const { return top; } + inline const int& get_bottom() const { return bottom; } int get_width() const { return right - left; } - int get_height() const { return bottom - top; } - Size get_size() const { return Size(right - left, bottom - top); } - int get_area() const { return get_width() * get_height(); } + inline int get_height() const { return bottom - top; } + inline Size get_size() const { return Size(right - left, bottom - top); } + inline int get_area() const { return get_width() * get_height(); } bool empty() const { diff --git a/src/math/rectf.hpp b/src/math/rectf.hpp index 1e374e28480..a216d396565 100644 --- a/src/math/rectf.hpp +++ b/src/math/rectf.hpp @@ -81,35 +81,35 @@ class Rectf final m_size == other.m_size); } - float& get_left() { return m_p1.x; } - float& get_top() { return m_p1.y; } + inline float& get_left() { return m_p1.x; } + inline float& get_top() { return m_p1.y; } - float get_left() const { return m_p1.x; } - float get_right() const { return m_p1.x + m_size.width; } - float get_top() const { return m_p1.y; } - float get_bottom() const { return m_p1.y + m_size.height; } + inline float get_left() const { return m_p1.x; } + inline float get_right() const { return m_p1.x + m_size.width; } + inline float get_top() const { return m_p1.y; } + inline float get_bottom() const { return m_p1.y + m_size.height; } - float& get_width() { return m_size.width; } - float& get_height() { return m_size.height; } + inline float& get_width() { return m_size.width; } + inline float& get_height() { return m_size.height; } - float get_width() const { return m_size.width; } - float get_height() const { return m_size.height; } + inline float get_width() const { return m_size.width; } + inline float get_height() const { return m_size.height; } - void set_left(float v) { m_size.width -= v - m_p1.x; m_p1.x = v; } - void set_right(float v) { m_size.width += v - get_right(); } + inline void set_left(float v) { m_size.width -= v - m_p1.x; m_p1.x = v; } + inline void set_right(float v) { m_size.width += v - get_right(); } - void set_top(float v) { m_size.height -= v - m_p1.y; m_p1.y = v; } - void set_bottom(float v) { m_size.height += v - get_bottom(); } + inline void set_top(float v) { m_size.height -= v - m_p1.y; m_p1.y = v; } + inline void set_bottom(float v) { m_size.height += v - get_bottom(); } Vector get_middle() const { return Vector(m_p1.x + m_size.width / 2.0f, m_p1.y + m_size.height / 2.0f); } - void set_pos(const Vector& v) { m_p1 = v; } + inline void set_pos(const Vector& v) { m_p1 = v; } - void set_width(float width) { m_size.width = width; } - void set_height(float height) { m_size.height = height; } - void set_size(float width, float height) { m_size = Sizef(width, height); } - Sizef get_size() const { return m_size; } + inline void set_width(float width) { m_size.width = width; } + inline void set_height(float height) { m_size.height = height; } + inline void set_size(float width, float height) { m_size = Sizef(width, height); } + inline Sizef get_size() const { return m_size; } bool empty() const { @@ -117,7 +117,7 @@ class Rectf final get_height() <= 0; } - void move(const Vector& v) { m_p1 += v; } + inline void move(const Vector& v) { m_p1 += v; } Rectf moved(const Vector& v) const { return Rectf(m_p1 + v, m_size); } bool contains(const Vector& v) const { @@ -161,8 +161,8 @@ class Rectf final // leave these two public to save the headaches of set/get functions for such // simple things :) - Vector p1() const { return m_p1; } - Vector p2() const { return Vector(m_p1.x + m_size.width, m_p1.y + m_size.height); } + inline Vector p1() const { return m_p1; } + inline Vector p2() const { return Vector(m_p1.x + m_size.width, m_p1.y + m_size.height); } void set_p1(const Vector& p) { m_size = Sizef(m_size.width + (m_p1.x - p.x), diff --git a/src/object/ambient_light.cpp b/src/object/ambient_light.cpp index 04040f74c46..8f7e3e07677 100644 --- a/src/object/ambient_light.cpp +++ b/src/object/ambient_light.cpp @@ -86,18 +86,6 @@ AmbientLight::draw(DrawingContext& context) context.set_ambient_color(m_ambient_light); } -void -AmbientLight::set_ambient_light(const Color& ambient_light) -{ - m_ambient_light = ambient_light; -} - -Color -AmbientLight::get_ambient_light() const -{ - return m_ambient_light; -} - void AmbientLight::fade_to_ambient_light(float red, float green, float blue, float seconds) { diff --git a/src/object/ambient_light.hpp b/src/object/ambient_light.hpp index 43311a21ac2..35a6683c1b3 100644 --- a/src/object/ambient_light.hpp +++ b/src/object/ambient_light.hpp @@ -41,8 +41,8 @@ class AmbientLight : public GameObject virtual ObjectSettings get_settings() override; - void set_ambient_light(const Color& ambient_light); - Color get_ambient_light() const; + inline void set_ambient_light(const Color& ambient_light) { m_ambient_light = ambient_light; } + inline Color get_ambient_light() const { return m_ambient_light; } /** Fades to the target ambient light */ void fade_to_ambient_light(float red, float green, float blue, float seconds); diff --git a/src/object/background.cpp b/src/object/background.cpp index 4a94a075127..dda71674c84 100644 --- a/src/object/background.cpp +++ b/src/object/background.cpp @@ -336,12 +336,6 @@ Background::update(float dt_sec) } } -void -Background::set_color(float red, float green, float blue, float alpha) -{ - m_color = Color(red, green, blue, alpha); -} - void Background::fade_color(Color color, float time) { @@ -353,12 +347,6 @@ Background::fade_color(Color color, float time) m_color = m_src_color; } -void -Background::fade_color(float red, float green, float blue, float alpha, float time) -{ - fade_color(Color(red, green, blue, alpha), time); -} - void Background::set_image(const std::string& name) { @@ -388,30 +376,6 @@ Background::set_speed(float speed) m_parallax_speed.y = speed; } -float -Background::get_color_red() const -{ - return m_color.red; -} - -float -Background::get_color_green() const -{ - return m_color.green; -} - -float -Background::get_color_blue() const -{ - return m_color.blue; -} - -float -Background::get_color_alpha() const -{ - return m_color.alpha; -} - void Background::draw_image(DrawingContext& context, const Vector& pos_) { diff --git a/src/object/background.hpp b/src/object/background.hpp index 1f3ce4480c5..c1216ba26e4 100644 --- a/src/object/background.hpp +++ b/src/object/background.hpp @@ -63,11 +63,11 @@ class Background final : public GameObject void draw_image(DrawingContext& context, const Vector& pos); - const std::string& get_image() const { return m_imagefile; } - float get_speed() const { return m_parallax_speed.x; } - int get_layer() const { return m_layer; } + inline const std::string& get_image() const { return m_imagefile; } + inline float get_speed() const { return m_parallax_speed.x; } + inline int get_layer() const { return m_layer; } - Color get_color() const { return m_color; } + inline Color get_color() const { return m_color; } void fade_color(Color color, float time); /** @@ -96,22 +96,22 @@ class Background final : public GameObject * @scripting * @description Returns the red color value. */ - float get_color_red() const; + inline float get_color_red() const { return m_color.red; } /** * @scripting * @description Returns the green color value. */ - float get_color_green() const; + inline float get_color_green() const { return m_color.green; } /** * @scripting * @description Returns the blue color value. */ - float get_color_blue() const; + inline float get_color_blue() const { return m_color.blue; } /** * @scripting * @description Returns the alpha color value. */ - float get_color_alpha() const; + inline float get_color_alpha() const { return m_color.alpha; } /** * @scripting * @description Sets the background color. @@ -120,7 +120,7 @@ class Background final : public GameObject * @param float $blue * @param float $alpha */ - void set_color(float red, float green, float blue, float alpha); + inline void set_color(float red, float green, float blue, float alpha) { m_color = Color(red, green, blue, alpha); } /** * @scripting * @description Fades to specified background color in ""time"" seconds. @@ -130,7 +130,7 @@ class Background final : public GameObject * @param float $alpha * @param float $time */ - void fade_color(float red, float green, float blue, float alpha, float time); + inline void fade_color(float red, float green, float blue, float alpha, float time) { fade_color(Color(red, green, blue, alpha), time); } /** * Sets the sprite action for the top image. * @param string $action diff --git a/src/object/bonus_block.hpp b/src/object/bonus_block.hpp index 924f59bc0ad..d179aa9ff15 100644 --- a/src/object/bonus_block.hpp +++ b/src/object/bonus_block.hpp @@ -67,8 +67,8 @@ class BonusBlock final : public Block GameObjectTypes get_types() const override; std::string get_default_sprite_name() const override; - Content get_contents() const { return m_contents; } - int get_hit_counter() const { return m_hit_counter; } + inline Content get_contents() const { return m_contents; } + inline int get_hit_counter() const { return m_hit_counter; } void try_open(Player* player); diff --git a/src/object/bullet.hpp b/src/object/bullet.hpp index 601c35b1d0a..2fbbfc110b6 100644 --- a/src/object/bullet.hpp +++ b/src/object/bullet.hpp @@ -47,9 +47,9 @@ class Bullet final : public MovingObject bullet. */ void ricochet(GameObject& other, const CollisionHit& hit); - BonusType get_type() const { return type; } + inline BonusType get_type() const { return type; } - Player& get_player() const { return m_player; } + inline Player& get_player() const { return m_player; } private: Player& m_player; diff --git a/src/object/camera.cpp b/src/object/camera.cpp index 3bfb030b1d3..23b2f0c8e19 100644 --- a/src/object/camera.cpp +++ b/src/object/camera.cpp @@ -768,12 +768,6 @@ Camera::ease_scale(float scale, float time, easing ease, AnchorPoint anchor) } } -void -Camera::set_pos(float x, float y) -{ - scroll_to(Vector(x, y), 0.0f); -} - void Camera::move(float x, float y) { @@ -791,42 +785,6 @@ Camera::set_mode(const std::string& mode) log_warning << "Camera mode '" << mode << "' unknown." << std::endl; } -void -Camera::scroll_to(float x, float y, float scrolltime) -{ - scroll_to(Vector(x, y), scrolltime); -} - -void -Camera::set_scale(float scale) -{ - m_scale = scale; -} - -void -Camera::set_scale_anchor(float scale, int anchor) -{ - ease_scale_anchor(scale, 0, anchor, ""); -} - -void -Camera::scale(float scale, float time) -{ - ease_scale(scale, time, ""); -} - -void -Camera::scale_anchor(float scale, float time, int anchor) -{ - ease_scale_anchor(scale, time, anchor, ""); -} - -void -Camera::ease_scale(float scale, float time, const std::string& ease) -{ - ease_scale_anchor(scale, time, AnchorPoint::ANCHOR_MIDDLE, ease); -} - void Camera::ease_scale_anchor(float scale, float time, int anchor, const std::string& ease) { diff --git a/src/object/camera.hpp b/src/object/camera.hpp index f91a9d34b32..544221de29d 100644 --- a/src/object/camera.hpp +++ b/src/object/camera.hpp @@ -88,7 +88,7 @@ class Camera final : public GameObject, /** return camera position */ const Vector get_translation() const; - void set_translation(const Vector& translation) { m_translation = translation; } + inline void set_translation(const Vector& translation) { m_translation = translation; } void set_translation_centered(const Vector& translation); void keep_in_bounds(const Rectf& bounds); @@ -116,15 +116,15 @@ class Camera final : public GameObject, /** get the width and height of the screen*/ const Sizef& get_screen_size() const; - void set_mode(Mode mode_) { m_mode = mode_; } + inline void set_mode(Mode mode_) { m_mode = mode_; } - Mode get_mode() const { return m_mode; } + inline Mode get_mode() const { return m_mode; } /** get the exact scale at this exact moment */ - float get_current_scale() const { return m_enfore_minimum_scale ? std::min(m_minimum_scale, m_scale) : m_scale; } + inline float get_current_scale() const { return m_enfore_minimum_scale ? std::min(m_minimum_scale, m_scale) : m_scale; } /** get the scale towards which the camera is moving */ - float get_target_scale() const { return m_scale_target; } + inline float get_target_scale() const { return m_scale_target; } /** smoothly slide the scale and anchor position of the camera towards a new value */ void ease_scale(float scale, float time, easing ease, AnchorPoint anchor = AnchorPoint::ANCHOR_MIDDLE); @@ -136,7 +136,7 @@ class Camera final : public GameObject, * @param float $x * @param float $y */ - void set_pos(float x, float y); + inline void set_pos(float x, float y) { scroll_to(Vector(x, y), 0.0f); } /** * @scripting * @description Moves the camera ""x"" to the left and ""y"" down. @@ -157,13 +157,13 @@ class Camera final : public GameObject, * @param float $y * @param float $scrolltime */ - void scroll_to(float x, float y, float scrolltime); + inline void scroll_to(float x, float y, float scrolltime) { scroll_to(Vector(x, y), scrolltime); } /** * @scripting * @description Sets the scale factor. * @param float $scale */ - void set_scale(float scale); + inline void set_scale(float scale) { m_scale = scale; } /** * @scripting * @description Sets the scale factor and the target position anchor. @@ -171,14 +171,14 @@ class Camera final : public GameObject, * @param float $scale * @param int $anchor Anchor point as represented by the ""ANCHOR_*"" constants (see ${SRG_REF_AnchorPoints}). */ - void set_scale_anchor(float scale, int anchor); + inline void set_scale_anchor(float scale, int anchor) { ease_scale_anchor(scale, 0, anchor, ""); } /** * @scripting * @description Fades to a specified scale factor in ""time"" seconds. * @param float $scale * @param float $time */ - void scale(float scale, float time); + inline void scale(float scale, float time) { ease_scale(scale, time, ""); } /** * @scripting * @description Fades to a specified scale factor and target position anchor in ""time"" seconds. @@ -187,7 +187,7 @@ class Camera final : public GameObject, * @param float $time * @param int $anchor Anchor point as represented by the ""ANCHOR_*"" constants (see ${SRG_REF_AnchorPoints}). */ - void scale_anchor(float scale, float time, int anchor); + inline void scale_anchor(float scale, float time, int anchor) { ease_scale_anchor(scale, time, anchor, ""); } /** * @scripting * @description Fades to a specified scale factor in ""time"" seconds with easing (smooth movement). @@ -195,7 +195,7 @@ class Camera final : public GameObject, * @param float $time * @param string $ease */ - void ease_scale(float scale, float time, const std::string& ease); + inline void ease_scale(float scale, float time, const std::string& ease) { ease_scale_anchor(scale, time, AnchorPoint::ANCHOR_MIDDLE, ease); } /** * @scripting * @description Fades to a specified scale factor and target position anchor in ""time"" seconds with easing (smooth movement). diff --git a/src/object/candle.cpp b/src/object/candle.cpp index ad605007d03..8c023b68846 100644 --- a/src/object/candle.cpp +++ b/src/object/candle.cpp @@ -120,12 +120,6 @@ Candle::puff_smoke() LAYER_BACKGROUNDTILES+2); } -bool -Candle::get_burning() const -{ - return burning; -} - void Candle::set_burning(bool burning_) { diff --git a/src/object/candle.hpp b/src/object/candle.hpp index 71fff88c190..2731e83799c 100644 --- a/src/object/candle.hpp +++ b/src/object/candle.hpp @@ -58,7 +58,7 @@ class Candle final : public MovingSprite * @scripting * @description Returns ""true"" if the candle is lit up. */ - bool get_burning() const; + inline bool get_burning() const { return burning; } /** * @scripting * @description Sets the burning state of the candle. diff --git a/src/object/cloud_particle_system.cpp b/src/object/cloud_particle_system.cpp index 1b7c0826fbe..865bcac4d8d 100644 --- a/src/object/cloud_particle_system.cpp +++ b/src/object/cloud_particle_system.cpp @@ -79,42 +79,12 @@ CloudParticleSystem::init() add_clouds(m_current_amount, 0.f); } -void -CloudParticleSystem::set_x_speed(float speed) -{ - m_current_speed_x = speed; -} - -float -CloudParticleSystem::get_x_speed() const -{ - return m_current_speed_x; -} - -void -CloudParticleSystem::set_y_speed(float speed) -{ - m_current_speed_y = speed; -} - -float -CloudParticleSystem::get_y_speed() const -{ - return m_current_speed_y; -} - void CloudParticleSystem::set_fog_opacity(float opacity) { m_fog_opacity = std::clamp(opacity, 0.f, 100.f); } -float -CloudParticleSystem::get_fog_opacity() const -{ - return m_fog_opacity; -} - ObjectSettings CloudParticleSystem::get_settings() { @@ -325,12 +295,6 @@ CloudParticleSystem::fade_amount(int new_amount, float fade_time, float time_bet } } -void -CloudParticleSystem::set_amount(int amount, float time) -{ - fade_amount(amount, time, 0.f); -} - void CloudParticleSystem::draw(DrawingContext& context) { diff --git a/src/object/cloud_particle_system.hpp b/src/object/cloud_particle_system.hpp index fc1cd0006f8..89764aaacf5 100644 --- a/src/object/cloud_particle_system.hpp +++ b/src/object/cloud_particle_system.hpp @@ -79,7 +79,7 @@ class CloudParticleSystem final : public ParticleSystem * @param int $amount * @param float $time */ - void set_amount(int amount, float time); + inline void set_amount(int amount, float time) { fade_amount(amount, time, 0.f); } // Minimum and maximum multiplier for the amount of clouds static int constexpr const max_amount = 500; @@ -90,25 +90,25 @@ class CloudParticleSystem final : public ParticleSystem * @description Sets the horizontal speed of the cloud particles. * @param float $speed */ - void set_x_speed(float speed); + inline void set_x_speed(float speed) { m_current_speed_x = speed; } /** * @scripting * @description Gets the horizontal speed of the cloud particles. * @return float */ - float get_x_speed() const; + inline float get_x_speed() const { return m_current_speed_x; } /** * @scripting * @description Sets the vertical speed of the cloud particles. * @param float $speed */ - void set_y_speed(float speed); + inline void set_y_speed(float speed) { m_current_speed_y = speed; } /** * @scripting * @description Gets the vertical speed of the cloud particles. * @return float */ - float get_y_speed() const; + inline float get_y_speed() const { return m_current_speed_y; } /** * @scripting * @description Sets the fog's opacity. @@ -120,7 +120,7 @@ class CloudParticleSystem final : public ParticleSystem * @description Gets the fog's opacity. * @return float */ - float get_fog_opacity() const; + inline float get_fog_opacity() const { return m_fog_opacity; } private: /** Returns the amount that got inserted (In case max_amount got hit) */ @@ -161,6 +161,7 @@ class CloudParticleSystem final : public ParticleSystem int m_current_real_amount; float m_fog_opacity; + private: CloudParticleSystem(const CloudParticleSystem&) = delete; CloudParticleSystem& operator=(const CloudParticleSystem&) = delete; diff --git a/src/object/conveyor_belt.cpp b/src/object/conveyor_belt.cpp index eec094c33f5..7920c89f01e 100644 --- a/src/object/conveyor_belt.cpp +++ b/src/object/conveyor_belt.cpp @@ -166,14 +166,7 @@ ConveyorBelt::move_right() void ConveyorBelt::set_speed(float target_speed) { - target_speed = math::clamp(target_speed, 0.0f, MAX_SPEED); - m_speed = target_speed; -} - -float -ConveyorBelt::get_speed() const -{ - return m_speed; + m_speed = math::clamp(target_speed, 0.0f, MAX_SPEED); } diff --git a/src/object/conveyor_belt.hpp b/src/object/conveyor_belt.hpp index 9f1449d8920..288754259c9 100644 --- a/src/object/conveyor_belt.hpp +++ b/src/object/conveyor_belt.hpp @@ -84,7 +84,7 @@ class ConveyorBelt final : public MovingSprite * @scripting * @description Returns the shifting speed of the conveyor. */ - float get_speed() const; + inline float get_speed() const { return m_speed; } private: void update_hitbox() override; diff --git a/src/object/custom_particle_system.cpp b/src/object/custom_particle_system.cpp index 11ecc6be51c..57fc754cf7d 100644 --- a/src/object/custom_particle_system.cpp +++ b/src/object/custom_particle_system.cpp @@ -1224,12 +1224,6 @@ CustomParticleSystem::spawn_particles(float lifetime) // SCRIPTING -void -CustomParticleSystem::clear() -{ - custom_particles.clear(); -} - void CustomParticleSystem::ease_value(float* value, float target, float time, easing func) { @@ -1264,30 +1258,6 @@ CustomParticleSystem::spawn_particles(int amount, bool instantly) // ============================ ATTRIBUTES ================================= // ============================================================================= -int -CustomParticleSystem::get_max_amount() const -{ - return m_max_amount; -} - -void -CustomParticleSystem::set_max_amount(int amount) -{ - m_max_amount = amount; -} - -bool -CustomParticleSystem::get_cover_screen() const -{ - return m_cover_screen; -} - -void -CustomParticleSystem::set_cover_screen(bool cover) -{ - m_cover_screen = cover; -} - std::string CustomParticleSystem::get_birth_mode() const { @@ -1449,18 +1419,6 @@ CustomParticleSystem::set_offscreen_mode(const std::string& mode) // Delay // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_delay() const -{ - return m_delay; -} - -void -CustomParticleSystem::set_delay(float delay) -{ - m_delay = delay; -} - void CustomParticleSystem::fade_delay(float delay, float time) { @@ -1477,18 +1435,6 @@ CustomParticleSystem::ease_delay(float delay, float time, const std::string& eas // Lifetime // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_lifetime() const -{ - return m_particle_lifetime; -} - -void -CustomParticleSystem::set_lifetime(float lifetime) -{ - m_particle_lifetime = lifetime; -} - void CustomParticleSystem::fade_lifetime(float lifetime, float time) { @@ -1505,18 +1451,6 @@ CustomParticleSystem::ease_lifetime(float lifetime, float time, const std::strin // Lifetime variation // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_lifetime_variation() const -{ - return m_particle_lifetime_variation; -} - -void -CustomParticleSystem::set_lifetime_variation(float lifetime_variation) -{ - m_particle_lifetime_variation = lifetime_variation; -} - void CustomParticleSystem::fade_lifetime_variation(float lifetime_variation, float time) { @@ -1533,18 +1467,6 @@ CustomParticleSystem::ease_lifetime_variation(float lifetime_variation, float ti // Birth time // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_birth_time() const -{ - return m_particle_birth_time; -} - -void -CustomParticleSystem::set_birth_time(float birth_time) -{ - m_particle_birth_time = birth_time; -} - void CustomParticleSystem::fade_birth_time(float birth_time, float time) { @@ -1561,18 +1483,6 @@ CustomParticleSystem::ease_birth_time(float birth_time, float time, const std::s // Birth time variation // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_birth_time_variation() const -{ - return m_particle_birth_time_variation; -} - -void -CustomParticleSystem::set_birth_time_variation(float birth_time_variation) -{ - m_particle_birth_time_variation = birth_time_variation; -} - void CustomParticleSystem::fade_birth_time_variation(float birth_time_variation, float time) { @@ -1589,18 +1499,6 @@ CustomParticleSystem::ease_birth_time_variation(float birth_time_variation, floa // Death time // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_death_time() const -{ - return m_particle_death_time; -} - -void -CustomParticleSystem::set_death_time(float death_time) -{ - m_particle_death_time = death_time; -} - void CustomParticleSystem::fade_death_time(float death_time, float time) { @@ -1618,17 +1516,6 @@ CustomParticleSystem::ease_death_time(float death_time, float time, const std::s // ============================================================================= // Death time variation // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_death_time_variation() const -{ - return m_particle_death_time_variation; -} - -void -CustomParticleSystem::set_death_time_variation(float death_time_variation) -{ - m_particle_death_time_variation = death_time_variation; -} void CustomParticleSystem::fade_death_time_variation(float death_time_variation, float time) @@ -1646,18 +1533,6 @@ CustomParticleSystem::ease_death_time_variation(float death_time_variation, floa // X speed // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_speed_x() const -{ - return m_particle_speed_x; -} - -void -CustomParticleSystem::set_speed_x(float speed_x) -{ - m_particle_speed_x = speed_x; -} - void CustomParticleSystem::fade_speed_x(float speed_x, float time) { @@ -1674,18 +1549,6 @@ CustomParticleSystem::ease_speed_x(float speed_x, float time, const std::string& // Y speed // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_speed_y() const -{ - return m_particle_speed_y; -} - -void -CustomParticleSystem::set_speed_y(float speed_y) -{ - m_particle_speed_y = speed_y; -} - void CustomParticleSystem::fade_speed_y(float speed_y, float time) { @@ -1702,18 +1565,6 @@ CustomParticleSystem::ease_speed_y(float speed_y, float time, const std::string& // X speed variation // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_speed_variation_x() const -{ - return m_particle_speed_variation_x; -} - -void -CustomParticleSystem::set_speed_variation_x(float speed_variation_x) -{ - m_particle_speed_variation_x = speed_variation_x; -} - void CustomParticleSystem::fade_speed_variation_x(float speed_variation_x, float time) { @@ -1730,18 +1581,6 @@ CustomParticleSystem::ease_speed_variation_x(float speed_variation_x, float time // Y speed variation // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_speed_variation_y() const -{ - return m_particle_speed_variation_y; -} - -void -CustomParticleSystem::set_speed_variation_y(float speed_variation_y) -{ - m_particle_speed_variation_y = speed_variation_y; -} - void CustomParticleSystem::fade_speed_variation_y(float speed_variation_y, float time) { @@ -1758,18 +1597,6 @@ CustomParticleSystem::ease_speed_variation_y(float speed_variation_y, float time // X acceleration // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_acceleration_x() const -{ - return m_particle_acceleration_x; -} - -void -CustomParticleSystem::set_acceleration_x(float acceleration_x) -{ - m_particle_acceleration_x = acceleration_x; -} - void CustomParticleSystem::fade_acceleration_x(float acceleration_x, float time) { @@ -1786,18 +1613,6 @@ CustomParticleSystem::ease_acceleration_x(float acceleration_x, float time, cons // Y acceleration // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_acceleration_y() const -{ - return m_particle_acceleration_y; -} - -void -CustomParticleSystem::set_acceleration_y(float acceleration_y) -{ - m_particle_acceleration_y = acceleration_y; -} - void CustomParticleSystem::fade_acceleration_y(float acceleration_y, float time) { @@ -1814,18 +1629,6 @@ CustomParticleSystem::ease_acceleration_y(float acceleration_y, float time, cons // X friction // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_friction_x() const -{ - return m_particle_friction_x; -} - -void -CustomParticleSystem::set_friction_x(float friction_x) -{ - m_particle_friction_x = friction_x; -} - void CustomParticleSystem::fade_friction_x(float friction_x, float time) { @@ -1842,18 +1645,6 @@ CustomParticleSystem::ease_friction_x(float friction_x, float time, const std::s // Y friction // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_friction_y() const -{ - return m_particle_friction_y; -} - -void -CustomParticleSystem::set_friction_y(float friction_y) -{ - m_particle_friction_y = friction_y; -} - void CustomParticleSystem::fade_friction_y(float friction_y, float time) { @@ -1870,18 +1661,6 @@ CustomParticleSystem::ease_friction_y(float friction_y, float time, const std::s // Feather factor // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_feather_factor() const -{ - return m_particle_feather_factor; -} - -void -CustomParticleSystem::set_feather_factor(float feather_factor) -{ - m_particle_feather_factor = feather_factor; -} - void CustomParticleSystem::fade_feather_factor(float feather_factor, float time) { @@ -1898,18 +1677,6 @@ CustomParticleSystem::ease_feather_factor(float feather_factor, float time, cons // Rotation // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_rotation() const -{ - return m_particle_rotation; -} - -void -CustomParticleSystem::set_rotation(float rotation) -{ - m_particle_rotation = rotation; -} - void CustomParticleSystem::fade_rotation(float rotation, float time) { @@ -1926,18 +1693,6 @@ CustomParticleSystem::ease_rotation(float rotation, float time, const std::strin // Rotation variation // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_rotation_variation() const -{ - return m_particle_rotation_variation; -} - -void -CustomParticleSystem::set_rotation_variation(float rotation_variation) -{ - m_particle_rotation_variation = rotation_variation; -} - void CustomParticleSystem::fade_rotation_variation(float rotation_variation, float time) { @@ -1954,18 +1709,6 @@ CustomParticleSystem::ease_rotation_variation(float rotation_variation, float ti // Rotation speed // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_rotation_speed() const -{ - return m_particle_rotation_speed; -} - -void -CustomParticleSystem::set_rotation_speed(float rotation_speed) -{ - m_particle_rotation_speed = rotation_speed; -} - void CustomParticleSystem::fade_rotation_speed(float rotation_speed, float time) { @@ -1982,18 +1725,6 @@ CustomParticleSystem::ease_rotation_speed(float rotation_speed, float time, cons // Rotation speed variation // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_rotation_speed_variation() const -{ - return m_particle_rotation_speed_variation; -} - -void -CustomParticleSystem::set_rotation_speed_variation(float rotation_speed_variation) -{ - m_particle_rotation_speed_variation = rotation_speed_variation; -} - void CustomParticleSystem::fade_rotation_speed_variation(float rotation_speed_variation, float time) { @@ -2010,18 +1741,6 @@ CustomParticleSystem::ease_rotation_speed_variation(float rotation_speed_variati // Rotation acceleration // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_rotation_acceleration() const -{ - return m_particle_rotation_acceleration; -} - -void -CustomParticleSystem::set_rotation_acceleration(float rotation_acceleration) -{ - m_particle_rotation_acceleration = rotation_acceleration; -} - void CustomParticleSystem::fade_rotation_acceleration(float rotation_acceleration, float time) { @@ -2038,18 +1757,6 @@ CustomParticleSystem::ease_rotation_acceleration(float rotation_acceleration, fl // Rotation decceleration // ----------------------------------------------------------------------------- -float -CustomParticleSystem::get_rotation_decceleration() const -{ - return m_particle_rotation_decceleration; -} - -void -CustomParticleSystem::set_rotation_decceleration(float rotation_decceleration) -{ - m_particle_rotation_decceleration = rotation_decceleration; -} - void CustomParticleSystem::fade_rotation_decceleration(float rotation_decceleration, float time) { diff --git a/src/object/custom_particle_system.hpp b/src/object/custom_particle_system.hpp index f38fc31d0f7..a320c1d1560 100644 --- a/src/object/custom_particle_system.hpp +++ b/src/object/custom_particle_system.hpp @@ -98,7 +98,7 @@ class CustomParticleSystem : public ParticleSystem_Interactive * @scripting * @description Instantly removes all particles of that type on the screen. */ - void clear(); + inline void clear() { custom_particles.clear(); } /** * @scripting @@ -111,12 +111,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - int get_max_amount() const; + inline int get_max_amount() const { return m_max_amount; } /** * @scripting * @param int $amount */ - void set_max_amount(int amount); + inline void set_max_amount(int amount) { m_max_amount = amount; } /** * @scripting @@ -176,22 +176,22 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - bool get_cover_screen() const; + inline bool get_cover_screen() const { return m_cover_screen; } /** * @scripting * @param bool $cover */ - void set_cover_screen(bool cover); + inline void set_cover_screen(bool cover) { m_cover_screen = cover; } /** * @scripting */ - float get_delay() const; + inline float get_delay() const { return m_delay; } /** * @scripting * @param float $delay */ - void set_delay(float delay); + inline void set_delay(float delay) { m_delay = delay; } /** * @scripting * @param float $delay @@ -209,12 +209,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_lifetime() const; + inline float get_lifetime() const { return m_particle_lifetime; } /** * @scripting * @param float $lifetime */ - void set_lifetime(float lifetime); + inline void set_lifetime(float lifetime) { m_particle_lifetime = lifetime; } /** * @scripting * @param float $lifetime @@ -232,12 +232,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_lifetime_variation() const; + inline float get_lifetime_variation() const { return m_particle_lifetime_variation; } /** * @scripting * @param float $lifetime_variation */ - void set_lifetime_variation(float lifetime_variation); + inline void set_lifetime_variation(float lifetime_variation) { m_particle_lifetime_variation = lifetime_variation; } /** * @scripting * @param float $lifetime_variation @@ -255,12 +255,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_birth_time() const; + inline float get_birth_time() const { return m_particle_birth_time; } /** * @scripting * @param float $birth_time */ - void set_birth_time(float birth_time); + inline void set_birth_time(float birth_time) { m_particle_birth_time = birth_time; } /** * @scripting * @param float $birth_time @@ -278,12 +278,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_birth_time_variation() const; + inline float get_birth_time_variation() const { return m_particle_birth_time_variation; } /** * @scripting * @param float $birth_time_variation */ - void set_birth_time_variation(float birth_time_variation); + inline void set_birth_time_variation(float birth_time_variation) { m_particle_birth_time_variation = birth_time_variation; } /** * @scripting * @param float $birth_time_variation @@ -301,12 +301,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_death_time() const; + inline float get_death_time() const { return m_particle_death_time; } /** * @scripting * @param float $death_time */ - void set_death_time(float death_time); + inline void set_death_time(float death_time) { m_particle_death_time = death_time; } /** * @scripting * @param float $death_time @@ -324,12 +324,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_death_time_variation() const; + inline float get_death_time_variation() const { return m_particle_death_time_variation; } /** * @scripting * @param float $death_time_variation */ - void set_death_time_variation(float death_time_variation); + inline void set_death_time_variation(float death_time_variation) { m_particle_death_time_variation = death_time_variation; } /** * @scripting * @param float $death_time_variation @@ -347,12 +347,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_speed_x() const; + inline float get_speed_x() const { return m_particle_speed_x; } /** * @scripting * @param float $speed_x */ - void set_speed_x(float speed_x); + inline void set_speed_x(float speed_x) { m_particle_speed_x = speed_x; } /** * @scripting * @param float $speed_x @@ -370,12 +370,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_speed_y() const; + inline float get_speed_y() const { return m_particle_speed_y; } /** * @scripting * @param float $speed_y */ - void set_speed_y(float speed_y); + inline void set_speed_y(float speed_y) { m_particle_speed_y = speed_y; } /** * @scripting * @param float $speed_y @@ -393,12 +393,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_speed_variation_x() const; + inline float get_speed_variation_x() const { return m_particle_speed_variation_x; } /** * @scripting * @param float $speed_variation_x */ - void set_speed_variation_x(float speed_variation_x); + inline void set_speed_variation_x(float speed_variation_x) { m_particle_speed_variation_x = speed_variation_x; } /** * @scripting * @param float $speed_variation_x @@ -416,12 +416,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_speed_variation_y() const; + inline float get_speed_variation_y() const { return m_particle_speed_variation_y; } /** * @scripting * @param float $speed_variation_y */ - void set_speed_variation_y(float speed_variation_y); + inline void set_speed_variation_y(float speed_variation_y) { m_particle_speed_variation_y = speed_variation_y; } /** * @scripting * @param float $speed_variation_y @@ -439,12 +439,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_acceleration_x() const; + inline float get_acceleration_x() const { return m_particle_acceleration_x; } /** * @scripting * @param float $acceleration_x */ - void set_acceleration_x(float acceleration_x); + inline void set_acceleration_x(float acceleration_x) { m_particle_acceleration_x = acceleration_x; } /** * @scripting * @param float $acceleration_x @@ -462,12 +462,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_acceleration_y() const; + inline float get_acceleration_y() const { return m_particle_acceleration_y; } /** * @scripting * @param float $acceleration_y */ - void set_acceleration_y(float acceleration_y); + inline void set_acceleration_y(float acceleration_y) { m_particle_acceleration_y = acceleration_y; } /** * @scripting * @param float $acceleration_y @@ -485,12 +485,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_friction_x() const; + inline float get_friction_x() const { return m_particle_friction_x; } /** * @scripting * @param float $friction_x */ - void set_friction_x(float friction_x); + inline void set_friction_x(float friction_x) { m_particle_friction_x = friction_x; } /** * @scripting * @param float $friction_x @@ -508,12 +508,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_friction_y() const; + inline float get_friction_y() const { return m_particle_friction_y; } /** * @scripting * @param float $friction_y */ - void set_friction_y(float friction_y); + inline void set_friction_y(float friction_y) { m_particle_friction_y = friction_y; } /** * @scripting * @param float $friction_y @@ -531,12 +531,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_feather_factor() const; + inline float get_feather_factor() const { return m_particle_feather_factor; } /** * @scripting * @param float $feather_factor */ - void set_feather_factor(float feather_factor); + inline void set_feather_factor(float feather_factor) { m_particle_feather_factor = feather_factor; } /** * @scripting * @param float $feather_factor @@ -554,12 +554,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_rotation() const; + inline float get_rotation() const { return m_particle_rotation; } /** * @scripting * @param float $rotation */ - void set_rotation(float rotation); + inline void set_rotation(float rotation) { m_particle_rotation = rotation; } /** * @scripting * @param float $rotation @@ -577,12 +577,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_rotation_variation() const; + inline float get_rotation_variation() const { return m_particle_rotation_variation; } /** * @scripting * @param float $rotation_variation */ - void set_rotation_variation(float rotation_variation); + inline void set_rotation_variation(float rotation_variation) { m_particle_rotation_variation = rotation_variation; } /** * @scripting * @param float $rotation_variation @@ -600,12 +600,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_rotation_speed() const; + inline float get_rotation_speed() const { return m_particle_rotation_speed; } /** * @scripting * @param float $rotation_speed */ - void set_rotation_speed(float rotation_speed); + inline void set_rotation_speed(float rotation_speed) { m_particle_rotation_speed = rotation_speed; } /** * @scripting * @param float $rotation_speed @@ -623,12 +623,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_rotation_speed_variation() const; + inline float get_rotation_speed_variation() const { return m_particle_rotation_speed_variation; } /** * @scripting * @param float $rotation_speed_variation */ - void set_rotation_speed_variation(float rotation_speed_variation); + inline void set_rotation_speed_variation(float rotation_speed_variation) { m_particle_rotation_speed_variation = rotation_speed_variation; } /** * @scripting * @param float $rotation_speed_variation @@ -646,12 +646,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_rotation_acceleration() const; + inline float get_rotation_acceleration() const { return m_particle_rotation_acceleration; } /** * @scripting * @param float $rotation_acceleration */ - void set_rotation_acceleration(float rotation_acceleration); + inline void set_rotation_acceleration(float rotation_acceleration) { m_particle_rotation_acceleration = rotation_acceleration; } /** * @scripting * @param float $rotation_acceleration @@ -669,12 +669,12 @@ class CustomParticleSystem : public ParticleSystem_Interactive /** * @scripting */ - float get_rotation_decceleration() const; + inline float get_rotation_decceleration() const { return m_particle_rotation_decceleration; } /** * @scripting * @param float $rotation_decceleration */ - void set_rotation_decceleration(float rotation_decceleration); + inline void set_rotation_decceleration(float rotation_decceleration) { m_particle_rotation_decceleration = rotation_decceleration; } /** * @scripting * @param float $rotation_decceleration diff --git a/src/object/decal.hpp b/src/object/decal.hpp index edff1bd404a..81d175486b2 100644 --- a/src/object/decal.hpp +++ b/src/object/decal.hpp @@ -86,8 +86,8 @@ class Decal final : public MovingSprite */ void fade_out(float time); - void set_visible(bool v) { m_visible = v; } - bool is_visible() const { return m_visible; } + inline void set_visible(bool v) { m_visible = v; } + inline bool is_visible() const { return m_visible; } private: std::string m_default_action; diff --git a/src/object/display_effect.cpp b/src/object/display_effect.cpp index d6bb60670db..a7087dc1d56 100644 --- a/src/object/display_effect.cpp +++ b/src/object/display_effect.cpp @@ -152,18 +152,6 @@ DisplayEffect::fade_in(float fadetime) screen_fade = FadeType::FADE_IN; } -void -DisplayEffect::set_black(bool enabled) -{ - black = enabled; -} - -bool -DisplayEffect::is_black() const -{ - return black; -} - void DisplayEffect::sixteen_to_nine(float fadetime) { diff --git a/src/object/display_effect.hpp b/src/object/display_effect.hpp index 9a8961e6581..291b78d117f 100644 --- a/src/object/display_effect.hpp +++ b/src/object/display_effect.hpp @@ -62,13 +62,13 @@ class DisplayEffect final : public GameObject * @description Blackens or un-blackens the screen (depending on the value of ""black""). * @param bool $black */ - void set_black(bool black); + inline void set_black(bool black_) { black = black_; } /** * @scripting * @description Returns ""true"" if the screen has been blackened by ""set_black"". Note: Calling ""fade_in"" or ""fade_out"" resets the return value to ""false"". */ - bool is_black() const; + inline bool is_black() const { return black; } /** * @scripting * @description Sets the display ratio to 16:9, effectively adding black bars at the top and bottom of the screen. diff --git a/src/object/explosion.hpp b/src/object/explosion.hpp index ecdabf9c5ce..7af953d9a26 100644 --- a/src/object/explosion.hpp +++ b/src/object/explosion.hpp @@ -43,8 +43,8 @@ class Explosion final : public MovingSprite virtual HitResponse collision(GameObject& other, const CollisionHit& hit) override; virtual bool is_saveable() const override { return false; } - bool hurts() const { return hurt; } - void hurts (bool val) { hurt = val; } + inline bool hurts() const { return hurt; } + inline void hurts(bool val) { hurt = val; } private: /** plays sound, starts animation */ diff --git a/src/object/fallblock.hpp b/src/object/fallblock.hpp index 202b56e5d1e..4337482bd85 100644 --- a/src/object/fallblock.hpp +++ b/src/object/fallblock.hpp @@ -45,7 +45,7 @@ class FallBlock : public MovingSprite virtual void on_flip(float height) override; public: - Physic& get_physic() { return m_physic; } + inline Physic& get_physic() { return m_physic; } enum State { @@ -55,7 +55,7 @@ class FallBlock : public MovingSprite LAND }; - State get_state() const { return m_state; } + inline State get_state() const { return m_state; } private: State m_state; diff --git a/src/object/floating_image.cpp b/src/object/floating_image.cpp index 270137d65f7..953d1ca61d1 100644 --- a/src/object/floating_image.cpp +++ b/src/object/floating_image.cpp @@ -62,60 +62,6 @@ FloatingImage::update(float dt_sec) } } -void -FloatingImage::set_layer(int layer) -{ - m_layer = layer; -} - -int -FloatingImage::get_layer() const -{ - return m_layer; -} - -void -FloatingImage::set_pos(float x, float y) -{ - m_pos = Vector(x, y); -} - -float -FloatingImage::get_x() const -{ - return m_pos.x; -} - -float -FloatingImage::get_y() const -{ - return m_pos.y; -} - -void -FloatingImage::set_anchor_point(int anchor) -{ - m_anchor = static_cast(anchor); -} - -int -FloatingImage::get_anchor_point() const -{ - return static_cast(m_anchor); -} - -bool -FloatingImage::get_visible() const -{ - return m_visible; -} - -void -FloatingImage::set_visible(bool visible) -{ - m_visible = visible; -} - void FloatingImage::set_action(const std::string& action) { diff --git a/src/object/floating_image.hpp b/src/object/floating_image.hpp index efb97226de6..37fa1f349e4 100644 --- a/src/object/floating_image.hpp +++ b/src/object/floating_image.hpp @@ -50,29 +50,29 @@ class FloatingImage final : public GameObject * @description Sets the layer of the floating image. * @param int $layer */ - void set_layer(int layer); + inline void set_layer(int layer) { m_layer = layer; } /** * @scripting * @description Returns the layer the floating image is on. */ - int get_layer() const; + inline int get_layer() const { return m_layer; } /** * @scripting * @description Sets the location of the image in relation to the current anchor point. * @param float $x * @param float $y */ - void set_pos(float x, float y); + inline void set_pos(float x, float y) { m_pos = Vector(x, y); } /** * @scripting * @description Returns the image's X coordinate relative to the current anchor point. */ - float get_x() const; + inline float get_x() const { return m_pos.x; } /** * @scripting * @description Returns the image's Y coordinate relative to the current anchor point. */ - float get_y() const; + inline float get_y() const { return m_pos.y; } #ifdef DOXYGEN_SCRIPTING /** * @scripting @@ -92,23 +92,23 @@ class FloatingImage final : public GameObject * @description Sets the image's anchor point. * @param int $anchor Anchor point as represented by the ""ANCHOR_*"" constants (see ${SRG_REF_AnchorPoints}). */ - void set_anchor_point(int anchor); + inline void set_anchor_point(int anchor) { m_anchor = static_cast(anchor); } /** * @scripting * @description Returns the current anchor point. */ - int get_anchor_point() const; + inline int get_anchor_point() const { return static_cast(m_anchor); } /** * @scripting * @description Sets the visibility of the floating image. * @param bool $visible */ - void set_visible(bool visible); + inline void set_visible(bool visible) { m_visible = visible; } /** * @scripting * @description Returns the visibility state of the floating image. */ - bool get_visible() const; + inline bool get_visible() const { return m_visible; } /** * @scripting * @description Sets the action of the image. diff --git a/src/object/gradient.cpp b/src/object/gradient.cpp index e65e3774d01..a089d538df0 100644 --- a/src/object/gradient.cpp +++ b/src/object/gradient.cpp @@ -210,12 +210,6 @@ Gradient::get_direction_string() const return nullptr; } -void -Gradient::set_direction(const GradientDirection& direction) -{ - m_gradient_direction = direction; -} - void Gradient::set_direction(const std::string& direction) { diff --git a/src/object/gradient.hpp b/src/object/gradient.hpp index 7259b25ae88..458a3c6d55c 100644 --- a/src/object/gradient.hpp +++ b/src/object/gradient.hpp @@ -60,15 +60,15 @@ class Gradient final : public GameObject void set_gradient(const Color& top, const Color& bottom); void fade_gradient(const Color& top, const Color& bottom, float time); - Color get_gradient_top() const { return m_gradient_top; } - Color get_gradient_bottom() const { return m_gradient_bottom; } + inline Color get_gradient_top() const { return m_gradient_top; } + inline Color get_gradient_bottom() const { return m_gradient_bottom; } - GradientDirection get_direction() const { return m_gradient_direction; } + inline GradientDirection get_direction() const { return m_gradient_direction; } std::string get_direction_string() const; - void set_direction(const GradientDirection& direction); + inline void set_direction(const GradientDirection& direction) { m_gradient_direction = direction; } - void set_layer(int layer) { m_layer = layer; } - int get_layer() const { return m_layer; } + inline void set_layer(int layer) { m_layer = layer; } + inline int get_layer() const { return m_layer; } /** * @scripting diff --git a/src/object/lantern.hpp b/src/object/lantern.hpp index 435a1feaa02..270b775b39c 100644 --- a/src/object/lantern.hpp +++ b/src/object/lantern.hpp @@ -47,7 +47,7 @@ class Lantern final : public Rock bool is_open() const; /** returns the lamp's color */ - Color get_color() const { return lightcolor; } + inline Color get_color() const { return lightcolor; } void add_color(const Color& c); private: diff --git a/src/object/moving_sprite.cpp b/src/object/moving_sprite.cpp index e71205bb0c9..b23a26c324c 100644 --- a/src/object/moving_sprite.cpp +++ b/src/object/moving_sprite.cpp @@ -123,12 +123,6 @@ MovingSprite::matches_sprite(const std::string& sprite_file) const return m_sprite_name == sprite_file || m_sprite_name == "/" + sprite_file; } -void -MovingSprite::set_sprite(const std::string& file) -{ - change_sprite(file); -} - std::string MovingSprite::get_action() const { @@ -149,12 +143,6 @@ MovingSprite::set_action(const std::string& name) update_hitbox(); } -void -MovingSprite::set_action_loops(const std::string& name, int loops) -{ - set_action(name, loops); -} - void MovingSprite::set_action(const std::string& name, int loops) { diff --git a/src/object/moving_sprite.hpp b/src/object/moving_sprite.hpp index 87050496008..44ab1dad888 100644 --- a/src/object/moving_sprite.hpp +++ b/src/object/moving_sprite.hpp @@ -66,8 +66,8 @@ class MovingSprite : public MovingObject int get_layer() const override { return m_layer; } void set_layer(int layer) { m_layer = layer; } - bool has_found_sprite() const { return m_sprite_found; } - const std::string& get_sprite_name() const { return m_sprite_name; } + inline bool has_found_sprite() const { return m_sprite_found; } + inline const std::string& get_sprite_name() const { return m_sprite_name; } virtual std::string get_default_sprite_name() const { return m_default_sprite_name; } bool matches_sprite(const std::string& sprite_file) const; @@ -75,10 +75,10 @@ class MovingSprite : public MovingObject void spawn_explosion_sprites(int count, const std::string& sprite_path); /** Get various sprite properties. **/ - Sprite* get_sprite() const { return m_sprite.get(); } + inline Sprite* get_sprite() const { return m_sprite.get(); } /** "void" wrapper for "change_sprite()" to be used for the "sprite" scripting property. **/ - void set_sprite(const std::string& file); + inline void set_sprite(const std::string& file) { change_sprite(file); } #ifdef DOXYGEN_SCRIPTING /** @@ -112,7 +112,7 @@ class MovingSprite : public MovingObject * @param string $name * @param int $loops */ - void set_action_loops(const std::string& name, int loops); + inline void set_action_loops(const std::string& name, int loops) { set_action(name, loops); } /** Sets the action from an action name, as well as the number of times it should loop. */ void set_action(const std::string& name, int loops); diff --git a/src/object/music_object.cpp b/src/object/music_object.cpp index 91185316b20..333e9822a35 100644 --- a/src/object/music_object.cpp +++ b/src/object/music_object.cpp @@ -83,24 +83,6 @@ MusicObject::resume_music(bool instantly) } } -MusicType -MusicObject::get_music_type() const -{ - return m_currentmusic; -} - -void -MusicObject::set_music(const std::string& music) -{ - m_music = music; -} - -const std::string& -MusicObject::get_music() const -{ - return m_music; -} - ObjectSettings MusicObject::get_settings() { diff --git a/src/object/music_object.hpp b/src/object/music_object.hpp index b9c6e4c0448..29c445d1746 100644 --- a/src/object/music_object.hpp +++ b/src/object/music_object.hpp @@ -48,10 +48,10 @@ class MusicObject : public GameObject void play_music(MusicType musictype); void resume_music(bool instantly = false); - MusicType get_music_type() const; + inline MusicType get_music_type() const { return m_currentmusic; } - void set_music(const std::string& music); - const std::string& get_music() const; + inline void set_music(const std::string& music) { m_music = music; } + inline const std::string& get_music() const { return m_music; } private: MusicType m_currentmusic; diff --git a/src/object/particle_zone.hpp b/src/object/particle_zone.hpp index 7504f30bd1c..d83f7b4e5b3 100644 --- a/src/object/particle_zone.hpp +++ b/src/object/particle_zone.hpp @@ -73,7 +73,7 @@ class ParticleZone final : public MovingObject void set_particle_name(std::string& particle_name) {m_particle_name = particle_name;} /** Returns the name of the particle object for this area */ - const std::string& get_particle_name() const { return m_particle_name; } + inline const std::string& get_particle_name() const { return m_particle_name; } /** Move the area around. Multiple calls stack (e. g. calling one before * the other finished will play both movements simultaneously) @@ -86,10 +86,10 @@ class ParticleZone final : public MovingObject //void resize(int width, int height, float time, std::string easing); /** Returns the current X position of the zone */ - float current_x() const { return m_col.m_bbox.get_left(); } + inline float current_x() const { return m_col.m_bbox.get_left(); } /** Returns the current Y position of the zone */ - float current_y() const { return m_col.m_bbox.get_top(); } + inline float current_y() const { return m_col.m_bbox.get_top(); } /** Returns the target X position of the zone */ //float target_x() {return m_col.m_bbox.get_left();} diff --git a/src/object/particlesystem.cpp b/src/object/particlesystem.cpp index 9905180ddcf..b5f56d02188 100644 --- a/src/object/particlesystem.cpp +++ b/src/object/particlesystem.cpp @@ -132,18 +132,6 @@ ParticleSystem::draw(DrawingContext& context) context.pop_transform(); } -void -ParticleSystem::set_enabled(bool enabled_) -{ - enabled = enabled_; -} - -bool -ParticleSystem::get_enabled() const -{ - return enabled; -} - void ParticleSystem::register_class(ssq::VM& vm) diff --git a/src/object/particlesystem.hpp b/src/object/particlesystem.hpp index 4eb1c6fb9d7..b65a72f9a0b 100644 --- a/src/object/particlesystem.hpp +++ b/src/object/particlesystem.hpp @@ -71,14 +71,14 @@ class ParticleSystem : public GameObject * @description Enables/disables the system. * @param bool $enable */ - void set_enabled(bool enable); + inline void set_enabled(bool enable) { enabled = enable; } /** * @scripting * @description Returns ""true"" if the system is enabled. */ - bool get_enabled() const; + inline bool get_enabled() const { return enabled; } - int get_layer() const { return z_pos; } + inline int get_layer() const { return z_pos; } protected: class Particle diff --git a/src/object/path.hpp b/src/object/path.hpp index 6fbe9652065..49dfefaba54 100644 --- a/src/object/path.hpp +++ b/src/object/path.hpp @@ -74,7 +74,7 @@ class Path final easing() {} - Path& get_parent() const { return *parent; } + inline Path& get_parent() const { return *parent; } }; public: @@ -101,9 +101,9 @@ class Path final /** Returns false when has no nodes */ bool is_valid() const; - const std::vector& get_nodes() const { return m_nodes; } + inline const std::vector& get_nodes() const { return m_nodes; } - PathGameObject& get_gameobject() const { return m_parent_gameobject; } + inline PathGameObject& get_gameobject() const { return m_parent_gameobject; } private: PathGameObject& m_parent_gameobject; diff --git a/src/object/path_gameobject.hpp b/src/object/path_gameobject.hpp index cbb7c7984cb..95040409d3e 100644 --- a/src/object/path_gameobject.hpp +++ b/src/object/path_gameobject.hpp @@ -61,7 +61,7 @@ class PathGameObject : public GameObject void regenerate_name(); - Path& get_path() { return *m_path; } + inline Path& get_path() { return *m_path; } void copy_into(PathGameObject& other); diff --git a/src/object/path_object.hpp b/src/object/path_object.hpp index 18cf66b6acf..2417207551c 100644 --- a/src/object/path_object.hpp +++ b/src/object/path_object.hpp @@ -49,7 +49,7 @@ class PathObject PathGameObject* get_path_gameobject() const; Path* get_path() const; - PathWalker* get_walker() const { return m_walker.get(); } + inline PathWalker* get_walker() const { return m_walker.get(); } void editor_clone_path(PathGameObject* path_object); diff --git a/src/object/path_walker.hpp b/src/object/path_walker.hpp index 6c9d744dc4f..00a4f748811 100644 --- a/src/object/path_walker.hpp +++ b/src/object/path_walker.hpp @@ -66,7 +66,7 @@ class PathWalker final void stop_moving(); /** returns true if PathWalker is currently moving */ - bool is_running() const { return m_running; } + inline bool is_running() const { return m_running; } private: void advance_node(); diff --git a/src/object/platform.hpp b/src/object/platform.hpp index 7c852bc2008..acd128722fe 100644 --- a/src/object/platform.hpp +++ b/src/object/platform.hpp @@ -62,8 +62,8 @@ class Platform : public MovingSprite, void save_state() override; void check_state() override; - const Vector& get_speed() const { return m_speed; } - const Vector& get_movement() const { return m_movement; } + inline const Vector& get_speed() const { return m_speed; } + inline const Vector& get_movement() const { return m_movement; } /** Moves platform instantly to given node. Replaces PathObject::set_node's implementation in scripting. */ diff --git a/src/object/player.cpp b/src/object/player.cpp index 132f359050d..df1c87e6958 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -275,18 +275,6 @@ Player::~Player() if (m_climbing) stop_climbing(*m_climbing); } -float -Player::get_speedlimit() const -{ - return m_speedlimit; -} - -void -Player::set_speedlimit(float newlimit) -{ - m_speedlimit = newlimit; -} - void Player::set_id(int id) { @@ -294,12 +282,6 @@ Player::set_id(int id) m_controller = &(InputManager::current()->get_controller(id)); } -void -Player::set_controller(const Controller* controller_) -{ - m_controller = controller_; -} - void Player::set_winning() { @@ -1174,18 +1156,6 @@ Player::swim(float pointx, float pointy, bool boost) } } -bool -Player::on_ground() const -{ - return m_on_ground_flag; -} - -void -Player::set_on_ground(bool flag) -{ - m_on_ground_flag = flag; -} - void Player::apply_friction() { @@ -1896,18 +1866,6 @@ Player::handle_input_ghost() m_physic.set_acceleration(0, 0); } -void -Player::add_coins(int count) -{ - m_player_status.add_coins(count); -} - -int -Player::get_coins() const -{ - return m_player_status.coins; -} - BonusType Player::string_to_bonus(const std::string& bonus) const { @@ -2030,24 +1988,6 @@ Player::set_bonus(BonusType type, bool animate) return true; } -BonusType -Player::get_bonus() const -{ - return m_player_status.bonus[m_id]; -} - -void -Player::set_visible(bool visible) -{ - m_visible = visible; -} - -bool -Player::get_visible() const -{ - return m_visible; -} - void Player::kick() { @@ -2653,30 +2593,6 @@ Player::add_velocity(const Vector& velocity, const Vector& end_speed) m_physic.set_velocity_y(std::max(m_physic.get_velocity_y() + velocity.y, end_speed.y)); } -Vector -Player::get_velocity() const -{ - return m_physic.get_velocity(); -} - -float -Player::get_velocity_x() const -{ - return m_physic.get_velocity_x(); -} - -float -Player::get_velocity_y() const -{ - return m_physic.get_velocity_y(); -} - -void -Player::set_velocity(float x, float y) -{ - m_physic.set_velocity(x, y); -} - void Player::bounce(BadGuy& ) { @@ -2727,12 +2643,6 @@ Player::get_input_released(const std::string& input) return m_controller->released(Control_from_string(input).value()); } -void -Player::walk(float speed) -{ - m_physic.set_velocity_x(speed); -} - void Player::set_dir(bool right) { @@ -2762,12 +2672,6 @@ Player::set_ghost_mode(bool enable) } } -bool -Player::get_ghost_mode() const -{ - return m_ghost_mode; -} - void Player::start_climbing(Climbable& climbable) { diff --git a/src/object/player.hpp b/src/object/player.hpp index 0b791c30ce0..d3b8c6104b7 100644 --- a/src/object/player.hpp +++ b/src/object/player.hpp @@ -94,21 +94,21 @@ class Player final : public MovingObject virtual void remove_me() override; virtual GameObjectClasses get_class_types() const override { return MovingObject::get_class_types().add(typeid(Player)); } - int get_id() const { return m_id; } + inline int get_id() const { return m_id; } void set_id(int id); virtual int get_layer() const override { return LAYER_OBJECTS + 1; } - void set_controller(const Controller* controller); + inline void set_controller(const Controller* controller) { m_controller = controller; } /** Level solved. Don't kill Tux any more. */ void set_winning(); - bool is_winning() const { return m_winning; } + inline bool is_winning() const { return m_winning; } // Tux can only go this fast. If set to 0 no special limit is used, only the default limits. - void set_speedlimit(float newlimit); - float get_speedlimit() const; + inline void set_speedlimit(float limit) { m_speedlimit = limit; } + inline float get_speedlimit() const { return m_speedlimit; } - const Controller& get_controller() const { return *m_controller; } + inline const Controller& get_controller() const { return *m_controller; } /** * @scripting @@ -135,23 +135,23 @@ class Player final : public MovingObject void make_invincible(); void make_temporarily_safe(float safe_time); - bool is_invincible() const { return m_invincible_timer.started(); } - bool is_dying() const { return m_dying; } + inline bool is_invincible() const { return m_invincible_timer.started(); } + inline bool is_dying() const { return m_dying; } /** * Returns true if the player is currently alive * (not dying or dead) */ - bool is_alive() const { return !is_dying() && !is_dead(); } + inline bool is_alive() const { return !is_dying() && !is_dead(); } /** * Returns true if the player can be controlled. * (alive and not currently in a win sequence) */ - bool is_active() const { return is_alive() && !is_winning(); } + inline bool is_active() const { return is_alive() && !is_winning(); } - Direction peeking_direction_x() const { return m_peekingX; } - Direction peeking_direction_y() const { return m_peekingY; } + inline Direction peeking_direction_x() const { return m_peekingX; } + inline Direction peeking_direction_y() const { return m_peekingY; } /** * @scripting @@ -190,12 +190,12 @@ class Player final : public MovingObject will stop changing). * @param int $count */ - void add_coins(int count); + inline void add_coins(int count) { m_player_status.add_coins(count); } /** * @scripting * @description Returns the number of coins the player currently has. */ - int get_coins() const; + inline int get_coins() const { return m_player_status.coins; } /** picks up a bonus, taking care not to pick up lesser bonus items than we already have @@ -205,11 +205,11 @@ class Player final : public MovingObject /** like add_bonus, but can also downgrade the bonus items carried */ bool set_bonus(BonusType type, bool animate = false); - BonusType get_bonus() const; + inline BonusType get_bonus() const { return m_player_status.bonus[m_id]; } std::string bonus_to_string() const; - PlayerStatus& get_status() const { return m_player_status; } + inline PlayerStatus& get_status() const { return m_player_status; } /** * @scripting @@ -267,55 +267,55 @@ class Player final : public MovingObject void add_velocity(const Vector& velocity, const Vector& end_speed); /** Returns the current velocity of the player */ - Vector get_velocity() const; + inline Vector get_velocity() const { return m_physic.get_velocity(); } /** * @scripting * @description Returns Tux’s velocity in X direction. */ - float get_velocity_x() const; + inline float get_velocity_x() const { return m_physic.get_velocity_x(); } /** * @scripting * @description Returns Tux’s velocity in Y direction. */ - float get_velocity_y() const; + inline float get_velocity_y() const { return m_physic.get_velocity_y(); } /** * @scripting * @description Sets the velocity of the player to a programmable/variable speed. * @param float $x The speed Tux will move on the x axis. * @param float $y The speed Tux will move on the y axis. */ - void set_velocity(float x, float y); + inline void set_velocity(float x, float y) { m_physic.set_velocity(x, y); } void bounce(BadGuy& badguy); - void override_velocity() { m_velocity_override = true; } + inline void override_velocity() { m_velocity_override = true; } - bool is_dead() const { return m_dead; } - bool is_big() const { return get_bonus() != BONUS_NONE; } - bool is_stone() const { return m_stone; } - bool is_sliding() const { return m_sliding; } - bool is_swimming() const { return m_swimming; } - bool is_swimboosting() const { return m_swimboosting; } - bool is_water_jumping() const { return m_water_jump; } - bool is_skidding() const { return m_skidding_timer.started(); } - float get_swimming_angle() const { return m_swimming_angle; } + inline bool is_dead() const { return m_dead; } + inline bool is_big() const { return get_bonus() != NO_BONUS; } + inline bool is_stone() const { return m_stone; } + inline bool is_sliding() const { return m_sliding; } + inline bool is_swimming() const { return m_swimming; } + inline bool is_swimboosting() const { return m_swimboosting; } + inline bool is_water_jumping() const { return m_water_jump; } + inline bool is_skidding() const { return m_skidding_timer.started(); } + inline float get_swimming_angle() const { return m_swimming_angle; } /** * @scripting * @description Set Tux visible or invisible. * @param bool $visible */ - void set_visible(bool visible); + inline void set_visible(bool visible) { m_visible = visible; } /** * @scripting * @description Returns ""true"" if Tux is currently visible (has not been set invisible by the ""set_visible()"" method). */ - bool get_visible() const; + inline bool get_visible() const { return m_visible; } - bool on_ground() const; - void set_on_ground(bool flag); + inline bool on_ground() const { return m_on_ground_flag; } + inline void set_on_ground(bool flag) { m_on_ground_flag = flag; } - Portable* get_grabbed_object() const { return m_grabbed_object; } - void stop_grabbing() { ungrab_object(); } + inline Portable* get_grabbed_object() const { return m_grabbed_object; } + inline void stop_grabbing() { ungrab_object(); } /** * @scripting @@ -334,7 +334,7 @@ class Player final : public MovingObject * @scripting * @description Returns whether ghost mode is currently enabled. */ - bool get_ghost_mode() const; + inline bool get_ghost_mode() const { return m_ghost_mode; } /** Changes height of bounding box. Returns true if successful, false otherwise */ @@ -363,7 +363,7 @@ class Player final : public MovingObject /** Requests that the player stop climbing the given Climbable */ void stop_climbing(Climbable& climbable); - Physic& get_physic() { return m_physic; } + inline Physic& get_physic() { return m_physic; } /** * @scripting @@ -403,7 +403,7 @@ class Player final : public MovingObject * @description Makes Tux walk. * @param float $speed */ - void walk(float speed); + inline void walk(float speed) { m_physic.set_velocity_x(speed); } /** * @scripting * @description Face Tux in the proper direction. @@ -438,10 +438,10 @@ class Player final : public MovingObject void multiplayer_prepare_spawn(); - void set_ending_direction(int direction) { m_ending_direction = direction; } - int get_ending_direction() const { return m_ending_direction; } + inline void set_ending_direction(int direction) { m_ending_direction = direction; } + inline int get_ending_direction() const { return m_ending_direction; } - const std::vector& get_collected_keys() const { return m_collected_keys; } + inline const std::vector& get_collected_keys() const { return m_collected_keys; } void add_collected_key(Key* key); void remove_collected_key(Key* key); diff --git a/src/object/portable.hpp b/src/object/portable.hpp index 753948806a3..b9c7bc313f9 100644 --- a/src/object/portable.hpp +++ b/src/object/portable.hpp @@ -36,15 +36,17 @@ class Portable : public GameObjectComponent virtual void grab(MovingObject& other, const Vector& pos, Direction dir) { m_owner = &other; } virtual void ungrab(MovingObject& other, Direction ) { m_owner = nullptr; } - virtual MovingObject* get_owner() const { return m_owner; } + inline MovingObject* get_owner() const { return m_owner; } virtual bool is_grabbed() const { return m_owner != nullptr; } virtual bool is_portable() const { return true; } /** Is the object so heavy/bulky/fragile that Tux can't run while carrying it? */ virtual bool is_hampering() const { return false; } + protected: MovingObject* m_owner = nullptr; + private: Portable(const Portable&) = delete; Portable& operator=(const Portable&) = delete; diff --git a/src/object/rock.hpp b/src/object/rock.hpp index 3ac5d20c56b..76dc7db661f 100644 --- a/src/object/rock.hpp +++ b/src/object/rock.hpp @@ -48,7 +48,7 @@ class Rock : public MovingSprite, /** Adds velocity from wind */ virtual void add_wind_velocity(const Vector& velocity, const Vector& end_speed); - Physic& get_physic() { return physic; } + inline Physic& get_physic() { return physic; } private: enum Type { diff --git a/src/object/scripted_object.cpp b/src/object/scripted_object.cpp index a3f5427d99b..442f866623c 100644 --- a/src/object/scripted_object.cpp +++ b/src/object/scripted_object.cpp @@ -86,30 +86,6 @@ ScriptedObject::set_velocity(float x, float y) new_vel_set = true; } -float -ScriptedObject::get_velocity_x() const -{ - return physic.get_velocity_x(); -} - -float -ScriptedObject::get_velocity_y() const -{ - return physic.get_velocity_y(); -} - -void -ScriptedObject::set_visible(bool visible_) -{ - visible = visible_; -} - -bool -ScriptedObject::is_visible() const -{ - return visible; -} - void ScriptedObject::set_solid(bool solid_) { @@ -121,24 +97,6 @@ ScriptedObject::set_solid(bool solid_) } } -bool -ScriptedObject::is_solid() const -{ - return solid; -} - -bool -ScriptedObject::gravity_enabled() const -{ - return physic.gravity_enabled(); -} - -void -ScriptedObject::enable_gravity(bool f) -{ - physic.enable_gravity(f); -} - void ScriptedObject::update(float dt_sec) { diff --git a/src/object/scripted_object.hpp b/src/object/scripted_object.hpp index 38a3674de22..7c3cc4e7403 100644 --- a/src/object/scripted_object.hpp +++ b/src/object/scripted_object.hpp @@ -77,36 +77,36 @@ class ScriptedObject final : public MovingSprite * @scripting * @description Returns the X coordinate of the object's velocity. */ - float get_velocity_x() const; + inline float get_velocity_x() const { return physic.get_velocity_x(); } /** * @scripting * @description Returns the Y coordinate of the object's velocity. */ - float get_velocity_y() const; + inline float get_velocity_y() const { return physic.get_velocity_y(); } /** * @scripting * @description Enables or disables gravity, according to the value of ""enabled"". * @param bool $enabled */ - void enable_gravity(bool enabled); + inline void enable_gravity(bool enabled) { physic.enable_gravity(enabled); } /** * @scripting * @description Returns ""true"" if the object's gravity is enabled. */ - bool gravity_enabled() const; + inline bool gravity_enabled() const { return physic.gravity_enabled(); } /** * @scripting * @description Shows or hides the object, according to the value of ""visible"". * @param bool $visible */ - void set_visible(bool visible); + inline void set_visible(bool visible_) { visible = visible_; } /** * @scripting * @description Returns ""true"" if the object is visible. */ - bool is_visible() const; + inline bool is_visible() const { return visible; } /** * @scripting @@ -118,7 +118,7 @@ class ScriptedObject final : public MovingSprite * @scripting * @description Returns ""true"" if the object is solid. */ - bool is_solid() const; + inline bool is_solid() const { return solid; } private: Physic physic; diff --git a/src/object/sound_object.cpp b/src/object/sound_object.cpp index 68a899dce86..e2778b59a1a 100644 --- a/src/object/sound_object.cpp +++ b/src/object/sound_object.cpp @@ -129,12 +129,6 @@ SoundObject::set_volume(float volume) m_sound_source->set_gain(volume); } -float -SoundObject::get_volume() const -{ - return m_volume; -} - void SoundObject::register_class(ssq::VM& vm) diff --git a/src/object/sound_object.hpp b/src/object/sound_object.hpp index d3765eb9d69..27ce6bc4ea6 100644 --- a/src/object/sound_object.hpp +++ b/src/object/sound_object.hpp @@ -74,7 +74,7 @@ class SoundObject final : public GameObject * @scripting * @description Returns the volume of the played sound. */ - float get_volume() const; + inline float get_volume() const { return m_volume; } /** @} */ diff --git a/src/object/spotlight.cpp b/src/object/spotlight.cpp index 8cfebb27814..7cc545144d1 100644 --- a/src/object/spotlight.cpp +++ b/src/object/spotlight.cpp @@ -176,72 +176,24 @@ Spotlight::collision(GameObject& other, const CollisionHit& hit_) return FORCE_MOVE; } -void -Spotlight::set_enabled(bool enabled) -{ - m_enabled = enabled; -} - -bool -Spotlight::is_enabled() -{ - return m_enabled; -} - void Spotlight::set_direction(const std::string& direction) { m_direction = Direction_from_string(direction); } -void -Spotlight::set_speed(float speed) -{ - m_speed = speed; -} - -void -Spotlight::fade_speed(float speed, float time) -{ - ease_speed(time, speed); -} - void Spotlight::ease_speed(float speed, float time, const std::string& easing_) { ease_speed(time, speed, EasingMode_from_string(easing_)); } -void -Spotlight::set_angle(float angle) -{ - m_angle = angle; -} - -void -Spotlight::fade_angle(float angle, float time) -{ - ease_angle(time, angle); -} - void Spotlight::ease_angle(float angle, float time, const std::string& easing_) { ease_angle(time, angle, EasingMode_from_string(easing_)); } -void -Spotlight::set_color_rgba(float r, float g, float b, float a) -{ - m_color = Color(r, g, b, a); -} - -void -Spotlight::fade_color_rgba(float r, float g, float b, float a, float time) -{ - ease_color(time, Color(r, g, b, a)); -} - void Spotlight::ease_color_rgba(float r, float g, float b, float a, float time, const std::string& easing_) { diff --git a/src/object/spotlight.hpp b/src/object/spotlight.hpp index 6f5fc65c400..52559610d0a 100644 --- a/src/object/spotlight.hpp +++ b/src/object/spotlight.hpp @@ -69,12 +69,12 @@ class Spotlight final : public MovingObject * @description Enables/disables the spotlight. * @param bool $enabled */ - void set_enabled(bool enabled); + inline void set_enabled(bool enabled) { m_enabled = enabled; } /** * @scripting * @description Returns ""true"" if the spotlight is enabled. */ - bool is_enabled(); + inline bool is_enabled() { return m_enabled; } /** * @scripting @@ -88,14 +88,14 @@ class Spotlight final : public MovingObject * @description Sets the angle of the spotlight. * @param float $angle */ - void set_angle(float angle); + inline void set_angle(float angle) { m_angle = angle; } /** * @scripting * @description Fades the angle of the spotlight in ""time"" seconds. * @param float $angle * @param float $time */ - void fade_angle(float angle, float time); + inline void fade_angle(float angle, float time) { ease_angle(time, angle); } /** * @scripting * @description Fades the angle of the spotlight in ""time"" seconds, with easing. @@ -110,14 +110,14 @@ class Spotlight final : public MovingObject * @description Sets the speed of the spotlight. * @param float $speed */ - void set_speed(float speed); + inline void set_speed(float speed) { m_speed = speed; } /** * @scripting * @description Fades the speed of the spotlight in ""time"" seconds. * @param float $speed * @param float $time */ - void fade_speed(float speed, float time); + inline void fade_speed(float speed, float time) { ease_speed(time, speed); } /** * @scripting * @description Fades the speed of the spotlight in ""time"" seconds, with easing. @@ -135,7 +135,7 @@ class Spotlight final : public MovingObject * @param float $b * @param float $a */ - void set_color_rgba(float r, float g, float b, float a); + inline void set_color_rgba(float r, float g, float b, float a) { m_color = Color(r, g, b, a); } /** * @scripting * @description Fades the spotlight to a new RGBA color in ""time"" seconds. @@ -145,7 +145,7 @@ class Spotlight final : public MovingObject * @param float $a * @param float $time */ - void fade_color_rgba(float r, float g, float b, float a, float time); + inline void fade_color_rgba(float r, float g, float b, float a, float time) { ease_color(time, Color(r, g, b, a)); } /** * @scripting * @description Fades the spotlight to a new RGBA color in ""time"" seconds, with easing. diff --git a/src/object/sticky_object.hpp b/src/object/sticky_object.hpp index 13c7ed61316..f177d74bb3b 100644 --- a/src/object/sticky_object.hpp +++ b/src/object/sticky_object.hpp @@ -39,7 +39,7 @@ class StickyObject : public MovingSprite virtual void move_for_owner(MovingObject& object); - bool is_sticky() const { return m_sticky; } + inline bool is_sticky() const { return m_sticky; } private: template @@ -89,7 +89,7 @@ class StickyBadguy : public BadGuy virtual void move_for_owner(MovingObject& object); - bool is_sticky() const { return m_sticky; } + inline bool is_sticky() const { return m_sticky; } private: template diff --git a/src/object/text_array_object.cpp b/src/object/text_array_object.cpp index 276cbf4eb9c..fa7d65de499 100644 --- a/src/object/text_array_object.cpp +++ b/src/object/text_array_object.cpp @@ -68,12 +68,6 @@ TextArrayObject::set_text_index(ta_index index) m_curTextIndex = index; } -void -TextArrayObject::set_fade_time(float fadetime) -{ - m_fadetime = fadetime; -} - void TextArrayObject::next_text() { @@ -106,18 +100,6 @@ TextArrayObject::prev_text() reset_automation(); } -void -TextArrayObject::set_keep_visible(bool keep_visible) -{ - m_keep_visible = keep_visible; -} - -void -TextArrayObject::set_fade_transition(bool fade_transition) -{ - m_fade_transition = fade_transition; -} - TextArrayItem* TextArrayObject::get_text_item(ta_index index) const { @@ -141,12 +123,6 @@ TextArrayObject::get_last_text_item() const return get_text_item(m_lastTextIndex); } -void -TextArrayObject::set_done(bool done) -{ - m_finished = done; -} - void TextArrayObject::set_auto(bool is_auto) { diff --git a/src/object/text_array_object.hpp b/src/object/text_array_object.hpp index 60e7098ce58..0769c3c337f 100644 --- a/src/object/text_array_object.hpp +++ b/src/object/text_array_object.hpp @@ -92,26 +92,26 @@ class TextArrayObject final : public GameObject * @description If set, keeps the current text object visible. * @param bool $keep_visible */ - void set_keep_visible(bool keep_visible); + inline void set_keep_visible(bool keep_visible) { m_keep_visible = keep_visible; } /** * @scripting * @description If set, allows for a fade-in and fade-out transition. * @param bool $fade_transition */ - void set_fade_transition(bool fade_transition); + inline void set_fade_transition(bool fade_transition) { m_fade_transition = fade_transition; } /** * @scripting * @description Sets the fade-in and fade-out time. * @param float $fadetime */ - void set_fade_time(float fadetime); + inline void set_fade_time(float fadetime) { m_fadetime = fadetime; } /** * @scripting * @description If set, sets the text array as finished going through all text objects. Alternatively, the "finished" property can be modified. * @param bool $done */ - void set_done(bool done); + inline void set_done(bool done) { m_finished = done; } /** * @scripting * @description If set, lets the text array automatically go through all text objects. diff --git a/src/object/text_object.cpp b/src/object/text_object.cpp index d81230f4e69..0ccfc4ec96b 100644 --- a/src/object/text_object.cpp +++ b/src/object/text_object.cpp @@ -98,12 +98,6 @@ TextObject::set_text(const std::string& text) wrap_text(); } -const std::string& -TextObject::get_text() const -{ - return m_text; -} - void TextObject::grow_in(float fadetime) { @@ -153,72 +147,6 @@ TextObject::set_visible(bool visible) } } -bool -TextObject::get_visible() const -{ - return m_visible; -} - -void -TextObject::set_centered(bool centered) -{ - m_centered = centered; -} - -bool -TextObject::get_centered() const -{ - return m_centered; -} - -void -TextObject::set_pos(float x, float y) -{ - m_pos = Vector(x, y); -} - -float -TextObject::get_x() const -{ - return m_pos.x; -} - -float -TextObject::get_y() const -{ - return m_pos.y; -} - -void -TextObject::set_anchor_point(int anchor) -{ - m_anchor = static_cast(anchor); -} - -int -TextObject::get_anchor_point() const -{ - return static_cast(m_anchor); -} - -void -TextObject::set_anchor_offset(float x, float y) -{ - m_anchor_offset = Vector(x, y); -} - -float -TextObject::get_wrap_width() const -{ - return m_wrap_width; -} - -void -TextObject::set_wrap_width(float width) -{ - m_wrap_width = width; -} - void TextObject::set_front_fill_color(float red, float green, float blue, float alpha) { @@ -237,18 +165,6 @@ TextObject::set_text_color(float red, float green, float blue, float alpha) m_text_color = Color(red, green, blue, alpha); } -void -TextObject::set_roundness(float roundness) -{ - m_roundness = roundness; -} - -float -TextObject::get_roundness() const -{ - return m_roundness; -} - void TextObject::draw(DrawingContext& context) { diff --git a/src/object/text_object.hpp b/src/object/text_object.hpp index d42ca7756fa..e1a1f2f7c43 100644 --- a/src/object/text_object.hpp +++ b/src/object/text_object.hpp @@ -69,7 +69,7 @@ class TextObject final : public GameObject * @scripting * @description Returns the displayed text. */ - const std::string& get_text() const; + inline const std::string& get_text() const { return m_text; } /** * @scripting * @description Sets the font of the text to be displayed. @@ -110,35 +110,35 @@ class TextObject final : public GameObject * @scripting * @description Returns ""true"" if the text is visible. */ - bool get_visible() const; + inline bool get_visible() const { return m_visible; } /** * @scripting * @description If ""centered"" is ""true"", the text will be centered on the screen. Otherwise, it will be left-aligned. * @param bool $centered */ - void set_centered(bool centered); + inline void set_centered(bool centered) { m_centered = centered; } /** * @scripting * @description Returns ""true"" if the text is centered. */ - bool get_centered() const; + inline bool get_centered() const { return m_centered; } /** * @scripting * @description Sets the offset of the text, relative to the anchor point. * @param float $x * @param float $y */ - void set_pos(float x, float y); + inline void set_pos(float x, float y) { m_pos = Vector(x, y); } /** * @scripting * @description Returns the X offset of the text, relative to the anchor point. */ - float get_x() const; + inline float get_x() const { return m_pos.x; } /** * @scripting * @description Returns the Y offset of the text, relative to the anchor point. */ - float get_y() const; + inline float get_y() const { return m_pos.y; } #ifdef DOXYGEN_SCRIPTING /** * @scripting @@ -158,30 +158,30 @@ class TextObject final : public GameObject * @description Sets the anchor point of the text. * @param int $anchor One of the ""ANCHOR_*"" constants (see ${SRG_REF_AnchorPoints}). */ - void set_anchor_point(int anchor); + inline void set_anchor_point(int anchor) { m_anchor = static_cast(anchor); } /** * @scripting * @description Returns the current anchor point of the text (one of the ""ANCHOR_*"" constants; see ${SRG_REF_AnchorPoints}). */ - int get_anchor_point() const; + inline int get_anchor_point() const { return static_cast(m_anchor); } /** * @scripting * @description Sets the anchor offset of the text. * @param float $x * @param float $y */ - void set_anchor_offset(float x, float y); + inline void set_anchor_offset(float x, float y) { m_anchor_offset = Vector(x, y); } /** * @scripting * @description Gets the text wrap width of the text. */ - float get_wrap_width() const; + inline float get_wrap_width() const { return m_wrap_width; } /** * @scripting * @description Sets the text wrap width of the text. * @param float $width */ - void set_wrap_width(float width); + inline void set_wrap_width(float width) { m_wrap_width = width; } /** * @scripting * @description Sets the front fill color of the text. @@ -214,18 +214,18 @@ class TextObject final : public GameObject * @description Sets the frame's roundness. * @param float $roundness */ - void set_roundness(float roundness); + inline void set_roundness(float roundness) { m_roundness = roundness; } /** * @scripting * @description Returns the roundness of the text. */ - float get_roundness() const; + inline float get_roundness() const { return m_roundness; } - void set_anchor_point(AnchorPoint anchor) { m_anchor = anchor; } - void set_anchor_offset(const Vector& offset) { m_anchor_offset = offset; } + inline void set_anchor_point(AnchorPoint anchor) { m_anchor = anchor; } + inline void set_anchor_offset(const Vector& offset) { m_anchor_offset = offset; } - void set_pos(const Vector& pos) { m_pos = pos; } - const Vector& get_pos() const { return m_pos; } + inline void set_pos(const Vector& pos) { m_pos = pos; } + inline const Vector& get_pos() const { return m_pos; } private: void wrap_text(); diff --git a/src/object/textscroller.cpp b/src/object/textscroller.cpp index 5f7ae398005..540626e2b3d 100644 --- a/src/object/textscroller.cpp +++ b/src/object/textscroller.cpp @@ -324,12 +324,6 @@ TextScroller::update(float dt_sec) } } -void -TextScroller::set_default_speed(float default_speed) -{ - m_default_speed = default_speed; -} - void TextScroller::scroll(float offset) { diff --git a/src/object/textscroller.hpp b/src/object/textscroller.hpp index d484c4fe78b..c356a4d4aa6 100644 --- a/src/object/textscroller.hpp +++ b/src/object/textscroller.hpp @@ -47,9 +47,10 @@ class TextScroller : public GameObject virtual GameObjectClasses get_class_types() const override { return GameObject::get_class_types().add(typeid(TextScroller)); } virtual const std::string get_icon_path() const override { return "images/engine/editor/textscroller.png"; } - void set_default_speed(float default_speed); void scroll(float offset); - bool is_finished() const { return m_finished; } + + inline void set_default_speed(float default_speed) { m_default_speed = default_speed; } + inline bool is_finished() const { return m_finished; } protected: const Controller* controller; diff --git a/src/object/tilemap.cpp b/src/object/tilemap.cpp index 1d13934d7a6..809dcb6376e 100644 --- a/src/object/tilemap.cpp +++ b/src/object/tilemap.cpp @@ -643,13 +643,7 @@ void TileMap::set_solid(bool solid) { m_real_solid = solid; - update_effective_solid (); -} - -bool -TileMap::get_solid() const -{ - return m_effective_solid; + update_effective_solid(); } uint32_t @@ -981,12 +975,6 @@ TileMap::update_effective_solid(bool update_manager) get_parent()->update_solid(this); } -void -TileMap::set_tileset(const TileSet* new_tileset) -{ - m_tileset = new_tileset; -} - void TileMap::register_class(ssq::VM& vm) diff --git a/src/object/tilemap.hpp b/src/object/tilemap.hpp index 3922f1ced14..93857dbf441 100644 --- a/src/object/tilemap.hpp +++ b/src/object/tilemap.hpp @@ -92,12 +92,12 @@ class TileMap final : public GameObject, int xoffset = 0, int yoffset = 0); void resize(const Size& newsize, const Size& resize_offset); - int get_width() const { return m_width; } - int get_height() const { return m_height; } - Size get_size() const { return Size(m_width, m_height); } + inline int get_width() const { return m_width; } + inline int get_height() const { return m_height; } + inline Size get_size() const { return Size(m_width, m_height); } - void set_offset(const Vector &offset_) { m_offset = offset_; } - Vector get_offset() const { return m_offset; } + inline void set_offset(const Vector &offset_) { m_offset = offset_; } + inline Vector get_offset() const { return m_offset; } void set_ground_movement_manager(const std::shared_ptr& movement_manager) { @@ -143,10 +143,10 @@ class TileMap final : public GameObject, void hits_object_bottom(CollisionObject& object); void notify_object_removal(CollisionObject* other); - int get_layer() const { return m_z_pos; } - void set_layer(int layer) { m_z_pos = layer; } + inline int get_layer() const { return m_z_pos; } + inline void set_layer(int layer) { m_z_pos = layer; } - bool is_solid() const { return m_real_solid && m_effective_solid; } + inline bool is_solid() const { return m_real_solid && m_effective_solid; } /** * @scripting @@ -159,7 +159,7 @@ class TileMap final : public GameObject, * @scripting * @description Returns the effective solidity of the tilemap. */ - bool get_solid() const; + inline bool get_solid() const { return m_effective_solid; } bool is_outside_bounds(const Vector& pos) const; const Tile& get_tile(int x, int y) const; @@ -218,8 +218,8 @@ class TileMap final : public GameObject, /** Returns the Autotilesets associated with the given tile */ std::vector get_autotilesets(uint32_t tile) const; - void set_flip(Flip flip) { m_flip = flip; } - Flip get_flip() const { return m_flip; } + inline void set_flip(Flip flip) { m_flip = flip; } + inline Flip get_flip() const { return m_flip; } /** * @scripting @@ -245,7 +245,7 @@ class TileMap final : public GameObject, */ void tint_fade(float time, float red, float green, float blue, float alpha); - Color get_current_tint() const { return m_current_tint; } + inline Color get_current_tint() const { return m_current_tint; } /** * @scripting @@ -260,11 +260,11 @@ class TileMap final : public GameObject, */ float get_alpha() const; - float get_target_alpha() const { return m_alpha; } + inline float get_target_alpha() const { return m_alpha; } - void set_tileset(const TileSet* new_tileset); + inline void set_tileset(const TileSet* tileset) { m_tileset = tileset; } - const std::vector& get_tiles() const { return m_tiles; } + inline const std::vector& get_tiles() const { return m_tiles; } private: void update_effective_solid(bool update_manager = true); diff --git a/src/object/torch.cpp b/src/object/torch.cpp index 0bf8a7a56cd..39aeaf165eb 100644 --- a/src/object/torch.cpp +++ b/src/object/torch.cpp @@ -111,18 +111,6 @@ Torch::after_editor_set() m_flame_light->set_color(m_light_color); } -bool -Torch::get_burning() const -{ - return m_burning; -} - -void -Torch::set_burning(bool burning) -{ - m_burning = burning; -} - void Torch::on_flip(float height) { diff --git a/src/object/torch.hpp b/src/object/torch.hpp index e8be5b8b74e..3c4265d0b06 100644 --- a/src/object/torch.hpp +++ b/src/object/torch.hpp @@ -57,13 +57,13 @@ class Torch final : public MovingSprite * @scripting * @description Returns ""true"" if the torch is burning. */ - bool get_burning() const; + inline bool get_burning() const { return m_burning; } /** * @scripting * @description Switches the burning state of the torch. * @param bool $burning */ - void set_burning(bool burning); + inline void set_burning(bool burning) { m_burning = burning; } private: Color m_light_color; diff --git a/src/sprite/sprite.cpp b/src/sprite/sprite.cpp index b3dc6bf58bd..691fbc4b3f4 100644 --- a/src/sprite/sprite.cpp +++ b/src/sprite/sprite.cpp @@ -231,88 +231,10 @@ Sprite::get_action_surfaces(const std::string& name) const return action->surfaces; } -bool -Sprite::is_current_hitbox_unisolid() const -{ - return m_action->hitbox_unisolid; -} - -float -Sprite::get_current_hitbox_x_offset() const -{ - return m_action->x_offset; -} - -float -Sprite::get_current_hitbox_y_offset() const -{ - return m_action->y_offset; -} - -float -Sprite::get_current_hitbox_width() const -{ - return m_action->hitbox_w; -} - -float -Sprite::get_current_hitbox_height() const -{ - return m_action->hitbox_h; -} - Rectf Sprite::get_current_hitbox() const { return Rectf(m_action->x_offset, m_action->y_offset, m_action->x_offset + m_action->hitbox_w, m_action->y_offset + m_action->hitbox_h); } -void -Sprite::set_angle(float a) -{ - m_angle = a; -} - -float -Sprite::get_angle() const -{ - return m_angle; -} - -void -Sprite::set_alpha(float a) -{ - m_alpha = a; -} - -float -Sprite::get_alpha() const -{ - return m_alpha; -} - -void -Sprite::set_color(const Color& c) -{ - m_color = c; -} - -Color -Sprite::get_color() const -{ - return m_color; -} - -void -Sprite::set_blend(const Blend& b) -{ - m_blend = b; -} - -Blend -Sprite::get_blend() const -{ - return m_blend; -} - /* EOF */ diff --git a/src/sprite/sprite.hpp b/src/sprite/sprite.hpp index 76c85c326a9..5abd3b8a623 100644 --- a/src/sprite/sprite.hpp +++ b/src/sprite/sprite.hpp @@ -61,11 +61,11 @@ class Sprite final void set_action(const Direction& dir, int loops = -1); /** Set number of animation cycles until animation stops */ - void set_animation_loops(int loops = -1) { m_animation_loops = loops; } + inline void set_animation_loops(int loops = -1) { m_animation_loops = loops; } - void set_frame_progress(float frame_progress) { m_frame = frame_progress; } + inline void set_frame_progress(float frame_progress) { m_frame = frame_progress; } - void set_frame(int frame) { m_frameidx = frame; } + inline void set_frame(int frame) { m_frameidx = frame; } /* Stop animation */ void stop_animation() { m_animation_loops = 0; } @@ -77,16 +77,16 @@ class Sprite final bool animation_done() const; /** Get current action total frames */ - int get_frames() const { return static_cast(m_action->surfaces.size()); } + inline int get_frames() const { return static_cast(m_action->surfaces.size()); } /** Get currently drawn frame */ - int get_current_frame() const { return m_frameidx; } + inline int get_current_frame() const { return m_frameidx; } /** Get current frame progress */ - float get_current_frame_progress() const { return m_frame; } + inline float get_current_frame_progress() const { return m_frame; } /** Get current action name */ - const std::string& get_action() const { return m_action->name; } + inline const std::string& get_action() const { return m_action->name; } int get_width() const; int get_height() const; @@ -94,37 +94,37 @@ class Sprite final const std::optional> get_action_surfaces(const std::string& name) const; /** Return the "unisolid" property for the current action's hitbox. */ - bool is_current_hitbox_unisolid() const; + inline bool is_current_hitbox_unisolid() const { return m_action->hitbox_unisolid; } /** return x-offset of current action's hitbox, relative to start of image */ - float get_current_hitbox_x_offset() const; + inline float get_current_hitbox_x_offset() const { return m_action->x_offset; } /** return y-offset of current action's hitbox, relative to start of image */ - float get_current_hitbox_y_offset() const; + inline float get_current_hitbox_y_offset() const { return m_action->y_offset; } /** return width of current action's hitbox */ - float get_current_hitbox_width() const; + inline float get_current_hitbox_width() const { return m_action->hitbox_w; } /** return height of current action's hitbox */ - float get_current_hitbox_height() const; + inline float get_current_hitbox_height() const { return m_action->hitbox_h; } /** return current action's hitbox, relative to 0,0 */ Rectf get_current_hitbox() const; /** Set the angle of the sprite rotation in degree */ - void set_angle(float angle); + inline void set_angle(float angle) { m_angle = angle; } /** Get the angle of the sprite rotation in degree */ - float get_angle() const; + inline float get_angle() const { return m_angle; } - void set_color(const Color& color); - Color get_color() const; + inline void set_color(const Color& color) { m_color = color; } + inline Color get_color() const { return m_color; } - void set_alpha(float alpha); - float get_alpha() const; + inline void set_alpha(float alpha) { m_alpha = alpha; } + inline float get_alpha() const { return m_alpha; } - void set_blend(const Blend& blend); - Blend get_blend() const; + inline void set_blend(const Blend& blend) { m_blend = blend; } + inline Blend get_blend() const { return m_blend; } - bool has_action (const std::string& name) const { return (m_data.get_action(name) != nullptr); } - size_t get_actions_count() const { return m_data.actions.size(); } + inline bool has_action(const std::string& name) const { return m_data.get_action(name); } + inline size_t get_actions_count() const { return m_data.actions.size(); } - bool load_successful() const { return m_data.m_load_successful; } + inline bool load_successful() const { return m_data.m_load_successful; } private: void update(); diff --git a/src/squirrel/squirrel_environment.hpp b/src/squirrel/squirrel_environment.hpp index 338350b1584..8c067f4997d 100644 --- a/src/squirrel/squirrel_environment.hpp +++ b/src/squirrel/squirrel_environment.hpp @@ -38,7 +38,7 @@ class SquirrelEnvironment final virtual ~SquirrelEnvironment(); public: - ssq::VM& get_vm() const { return m_vm; } + inline ssq::VM& get_vm() const { return m_vm; } /** Expose this engine under 'name' */ void expose_self(); diff --git a/src/squirrel/squirrel_virtual_machine.hpp b/src/squirrel/squirrel_virtual_machine.hpp index 01e67cd0a33..f1a5efd6f5d 100644 --- a/src/squirrel/squirrel_virtual_machine.hpp +++ b/src/squirrel/squirrel_virtual_machine.hpp @@ -32,7 +32,7 @@ class SquirrelVirtualMachine final : public Currenton SquirrelVirtualMachine(bool enable_debugger); ~SquirrelVirtualMachine() override; - ssq::VM& get_vm() { return m_vm; } + inline ssq::VM& get_vm() { return m_vm; } SQInteger wait_for_seconds(HSQUIRRELVM vm, float seconds); SQInteger skippable_wait_for_seconds(HSQUIRRELVM vm, float seconds); diff --git a/src/supertux/autotile.hpp b/src/supertux/autotile.hpp index 1d2e8a92df1..5ce89681c8a 100644 --- a/src/supertux/autotile.hpp +++ b/src/supertux/autotile.hpp @@ -30,7 +30,7 @@ class AutotileMask final bool matches(uint8_t mask, bool center) const; - uint8_t get_mask() const { return m_mask; } + inline uint8_t get_mask() const { return m_mask; } private: uint8_t m_mask; @@ -48,7 +48,7 @@ class Autotile final bool matches(uint8_t mask, bool center) const; /** @deprecated Returns the base tile ID. */ - uint32_t get_tile_id() const { return m_tile_id; } + inline uint32_t get_tile_id() const { return m_tile_id; } /** Picks a tile randomly amongst the possible ones for this autotile. */ uint32_t pick_tile(int x, int y) const; @@ -60,10 +60,10 @@ class Autotile final uint8_t get_first_mask() const; /** Returns all possible tiles for this autotile */ - const std::vector>& get_all_tile_ids() const { return m_alt_tiles; } + inline const std::vector>& get_all_tile_ids() const { return m_alt_tiles; } /** Returns true if the "center" bool of masks are true. All masks of given Autotile must have the same value for their "center" property.*/ - bool is_solid() const { return m_solid; } + inline bool is_solid() const { return m_solid; } private: uint32_t m_tile_id; @@ -98,9 +98,9 @@ class AutotileSet final ) const; /** Returns the id of the first block in the autotileset. Used for erronous configs. */ - uint32_t get_default_tile() const { return m_default; } + inline uint32_t get_default_tile() const { return m_default; } - const std::string& get_name() const { return m_name; } + inline const std::string& get_name() const { return m_name; } /** true if the given tile is present in the autotileset */ bool is_member(uint32_t tile_id) const; @@ -109,7 +109,7 @@ class AutotileSet final bool is_solid(uint32_t tile_id) const; /** true if this is a corner-based autotileset */ - bool is_corner() const { return m_corner; } + inline bool is_corner() const { return m_corner; } /** Returns the first mask corresponding to the current tile * (useful for corners-based autotilesets) diff --git a/src/supertux/command_line_arguments.hpp b/src/supertux/command_line_arguments.hpp index 6bef6c28632..6f650a07d95 100644 --- a/src/supertux/command_line_arguments.hpp +++ b/src/supertux/command_line_arguments.hpp @@ -85,8 +85,8 @@ class CommandLineArguments final public: CommandLineArguments(); - Action get_action() const { return m_action; } - LogLevel get_log_level() const { return m_log_level; } + inline Action get_action() const { return m_action; } + inline LogLevel get_log_level() const { return m_log_level; } void parse_args(int argc, char** argv); diff --git a/src/supertux/console.cpp b/src/supertux/console.cpp index 5c0f1dac4f7..7b0b71bc788 100644 --- a/src/supertux/console.cpp +++ b/src/supertux/console.cpp @@ -36,15 +36,6 @@ ConsoleBuffer::ConsoleBuffer() : { } -void -ConsoleBuffer::set_console(Console* console) -{ - assert((console && !m_console) || - (m_console && !console)); - - m_console = console; -} - void ConsoleBuffer::addLines(const std::string& s) { diff --git a/src/supertux/console.hpp b/src/supertux/console.hpp index dffb5585b28..5b6b1a3fde4 100644 --- a/src/supertux/console.hpp +++ b/src/supertux/console.hpp @@ -49,7 +49,11 @@ class ConsoleBuffer final : public Currenton void flush(ConsoleStreamBuffer& buffer); /**< act upon changes in a ConsoleStreamBuffer */ - void set_console(Console* console); + inline void set_console(Console* console) + { + assert((console && !m_console) || (m_console && !console)); + m_console = console; + } private: ConsoleBuffer(const ConsoleBuffer&) = delete; diff --git a/src/supertux/debug.cpp b/src/supertux/debug.cpp index 14f41dc11c0..6441997da8d 100644 --- a/src/supertux/debug.cpp +++ b/src/supertux/debug.cpp @@ -38,16 +38,11 @@ Debug::set_use_bitmap_fonts(bool value) Resources::load(); } -bool -Debug::get_use_bitmap_fonts() const -{ - return m_use_bitmap_fonts; -} - void Debug::set_game_speed_multiplier(float v) { m_game_speed_multiplier = v; log_info << m_game_speed_multiplier << std::endl; } + /* EOF */ diff --git a/src/supertux/debug.hpp b/src/supertux/debug.hpp index 8d49f8a8893..372e1ce9cc0 100644 --- a/src/supertux/debug.hpp +++ b/src/supertux/debug.hpp @@ -23,10 +23,10 @@ class Debug Debug(); void set_use_bitmap_fonts(bool value); - bool get_use_bitmap_fonts() const; + inline bool get_use_bitmap_fonts() const { return m_use_bitmap_fonts; } void set_game_speed_multiplier(float v); - float get_game_speed_multiplier() const { return m_game_speed_multiplier; } + inline float get_game_speed_multiplier() const { return m_game_speed_multiplier; } public: /** Show collision rectangles of moving objects */ diff --git a/src/supertux/game_object.cpp b/src/supertux/game_object.cpp index d245bcf8604..688d7ba93c4 100644 --- a/src/supertux/game_object.cpp +++ b/src/supertux/game_object.cpp @@ -144,30 +144,12 @@ GameObject::get_settings() return result; } -const std::string& -GameObject::get_name() const -{ - return m_name; -} - -int -GameObject::get_type() const -{ - return m_type; -} - std::vector GameObject::get_patches() const { return {}; } -int -GameObject::get_version() const -{ - return m_version; -} - int GameObject::get_latest_version() const { diff --git a/src/supertux/game_object.hpp b/src/supertux/game_object.hpp index 7b4ce294ba5..cd431d6ed5b 100644 --- a/src/supertux/game_object.hpp +++ b/src/supertux/game_object.hpp @@ -99,7 +99,7 @@ class GameObject : public ExposableClass by name, those connection can be resolved here. */ virtual void finish_construction() {} - UID get_uid() const { return m_uid; } + inline UID get_uid() const { return m_uid; } /** This function is called once per frame and allows the object to update it's state. The dt_sec is the time that has passed since @@ -133,7 +133,7 @@ class GameObject : public ExposableClass * @scripting * @description Returns the current version of the object. */ - int get_version() const; + inline int get_version() const { return m_version; } /** * @scripting * @description Returns the latest version of the object. @@ -175,7 +175,7 @@ class GameObject : public ExposableClass * @scripting * @description Returns the type index of the object. */ - int get_type() const; + inline int get_type() const { return m_type; } virtual void after_editor_set(); @@ -186,7 +186,7 @@ class GameObject : public ExposableClass virtual void remove_me() { m_scheduled_for_removal = true; } /** returns true if the object is not scheduled to be removed yet */ - bool is_valid() const { return !m_scheduled_for_removal; } + inline bool is_valid() const { return !m_scheduled_for_removal; } /** registers a remove listener which will be called if the object gets removed/destroyed */ @@ -196,12 +196,12 @@ class GameObject : public ExposableClass the object gets removed/destroyed */ void del_remove_listener(ObjectRemoveListener* listener); - void set_name(const std::string& name) { m_name = name; } + inline void set_name(const std::string& name) { m_name = name; } /** * @scripting * @description Returns the name of the object. */ - const std::string& get_name() const; + inline const std::string& get_name() const { return m_name; } virtual const std::string get_icon_path() const { return "images/tiles/auxiliary/notile.png"; @@ -254,7 +254,7 @@ class GameObject : public ExposableClass together (e.g. platform on a path) */ virtual void editor_update() {} - GameObjectManager* get_parent() const { return m_parent; } + inline GameObjectManager* get_parent() const { return m_parent; } protected: /** Parse object type. **/ @@ -269,7 +269,7 @@ class GameObject : public ExposableClass std::string type_value_to_id(int value) const; private: - void set_uid(const UID& uid) { m_uid = uid; } + inline void set_uid(const UID& uid) { m_uid = uid; } private: /** The parent GameObjectManager. Set by the manager itself. */ diff --git a/src/supertux/game_object_manager.hpp b/src/supertux/game_object_manager.hpp index e45a5ca1f66..fa31a099c4a 100644 --- a/src/supertux/game_object_manager.hpp +++ b/src/supertux/game_object_manager.hpp @@ -252,14 +252,14 @@ class GameObjectManager : public ExposableClass return total; } - const std::vector& get_solid_tilemaps() const { return m_solid_tilemaps; } - const std::vector& get_all_tilemaps() const { return m_all_tilemaps; } + inline const std::vector& get_solid_tilemaps() const { return m_solid_tilemaps; } + inline const std::vector& get_all_tilemaps() const { return m_all_tilemaps; } void update_solid(TileMap* solid); /** Toggle object change tracking for undo/redo. */ void toggle_undo_tracking(bool enabled); - bool undo_tracking_enabled() const { return m_undo_tracking; } + inline bool undo_tracking_enabled() const { return m_undo_tracking; } /** Set undo stack size. */ void set_undo_stack_size(int size); diff --git a/src/supertux/game_session.cpp b/src/supertux/game_session.cpp index 242d474c4cf..375ee469fd4 100644 --- a/src/supertux/game_session.cpp +++ b/src/supertux/game_session.cpp @@ -787,7 +787,6 @@ GameSession::respawn_with_fade(const std::string& sector, player->make_temporarily_safe(TELEPORT_FADE_TIME); } } - } void @@ -805,19 +804,6 @@ GameSession::set_start_pos(const std::string& sector, const Vector& pos) m_spawnpoints.insert(m_spawnpoints.begin(), { sector, pos }); } -void -GameSession::set_respawn_point(const std::string& sector, - const std::string& spawnpoint) -{ - m_spawnpoints.push_back({ sector, spawnpoint }); -} - -void -GameSession::set_respawn_pos(const std::string& sector, const Vector& pos) -{ - m_spawnpoints.push_back({ sector, pos }); -} - void GameSession::clear_respawn_points() { @@ -826,12 +812,6 @@ GameSession::clear_respawn_points() m_spawnpoints.erase(m_spawnpoints.begin() + 1, m_spawnpoints.end()); } -const GameSession::SpawnPoint& -GameSession::get_last_spawnpoint() const -{ - return m_spawnpoints.back(); -} - void GameSession::set_checkpoint_pos(const std::string& sector, const Vector& pos) { @@ -839,24 +819,12 @@ GameSession::set_checkpoint_pos(const std::string& sector, const Vector& pos) m_activated_checkpoint = &m_spawnpoints.back(); } -const GameSession::SpawnPoint* -GameSession::get_active_checkpoint_spawnpoint() const -{ - return m_activated_checkpoint; -} - std::string GameSession::get_working_directory() const { return FileSystem::dirname(m_levelfile); } -bool -GameSession::has_active_sequence() const -{ - return m_end_sequence; -} - void GameSession::start_sequence(Player* caller, Sequence seq, const SequenceData* data) { diff --git a/src/supertux/game_session.hpp b/src/supertux/game_session.hpp index 6068b9b1580..f2b81edd479 100644 --- a/src/supertux/game_session.hpp +++ b/src/supertux/game_session.hpp @@ -100,21 +100,25 @@ class GameSession final : public Screen, void on_player_added(int id); bool on_player_removed(int id); - void set_start_point(const std::string& sectorname, - const std::string& spawnpointname); - void set_start_pos(const std::string& sectorname, const Vector& pos); - void set_respawn_point(const std::string& sectorname, - const std::string& spawnpointname); - void set_respawn_pos(const std::string& sectorname, const Vector& pos); + void set_start_point(const std::string& sector, const std::string& spawnpoint); + void set_start_pos(const std::string& sector, const Vector& pos); + inline void set_respawn_point(const std::string& sector, const std::string& spawnpoint) + { + m_spawnpoints.push_back({ sector, spawnpoint }); + } + inline void set_respawn_pos(const std::string& sector, const Vector& pos) + { + m_spawnpoints.push_back({ sector, pos }); + } void clear_respawn_points(); - const SpawnPoint& get_last_spawnpoint() const; + inline const SpawnPoint& get_last_spawnpoint() const { return m_spawnpoints.back(); } void set_checkpoint_pos(const std::string& sectorname, const Vector& pos); - const SpawnPoint* get_active_checkpoint_spawnpoint() const; + inline const SpawnPoint* get_active_checkpoint_spawnpoint() const { return m_activated_checkpoint; } - Sector& get_current_sector() const { return *m_currentsector; } - Level& get_current_level() const { return *m_level; } + inline Sector& get_current_sector() const { return *m_currentsector; } + inline Level& get_current_level() const { return *m_level; } void start_sequence(Player* caller, Sequence seq, const SequenceData* data = nullptr); void set_target_timer_paused(bool paused); @@ -125,15 +129,15 @@ class GameSession final : public Screen, * resources for the current level/world */ std::string get_working_directory() const; - const std::string& get_level_file() const { return m_levelfile; } - bool has_active_sequence() const; + inline const std::string& get_level_file() const { return m_levelfile; } + inline bool has_active_sequence() const { return m_end_sequence; } int restart_level(bool after_death = false, bool preserve_music = false); void toggle_pause(); void abort_level(); bool is_active() const; - Savegame& get_savegame() const { return m_savegame; } + inline Savegame& get_savegame() const { return m_savegame; } void set_scheduler(SquirrelScheduler& new_scheduler); diff --git a/src/supertux/gameconfig.hpp b/src/supertux/gameconfig.hpp index a726247e484..656dab2a341 100644 --- a/src/supertux/gameconfig.hpp +++ b/src/supertux/gameconfig.hpp @@ -36,7 +36,7 @@ class Config final void check_values(); - bool is_initial() const { return m_initial; } + inline bool is_initial() const { return m_initial; } private: bool m_initial; diff --git a/src/supertux/level.hpp b/src/supertux/level.hpp index 36d78a308e6..03909b9415d 100644 --- a/src/supertux/level.hpp +++ b/src/supertux/level.hpp @@ -47,18 +47,18 @@ class Level final void save(std::ostream& stream); void add_sector(std::unique_ptr sector); - const std::string& get_name() const { return m_name; } - const std::string& get_author() const { return m_author; } + inline const std::string& get_name() const { return m_name; } + inline const std::string& get_author() const { return m_author; } Sector* get_sector(const std::string& name) const; size_t get_sector_count() const; Sector* get_sector(size_t num) const; - const std::vector >& get_sectors() const { return m_sectors; } + inline const std::vector>& get_sectors() const { return m_sectors; } std::vector get_players() const; - const std::string& get_tileset() const { return m_tileset; } + inline const std::string& get_tileset() const { return m_tileset; } int get_total_coins() const; int get_total_badguys() const; @@ -66,9 +66,9 @@ class Level final void reactivate(); - bool is_worldmap() const { return m_is_worldmap; } + inline bool is_worldmap() const { return m_is_worldmap; } - const std::string& get_license() const { return m_license; } + inline const std::string& get_license() const { return m_license; } private: void initialize(const Statistics::Preferences& stat_preferences); diff --git a/src/supertux/menu/download_dialog.cpp b/src/supertux/menu/download_dialog.cpp index 82ecc43e4dd..68a2df8a3b3 100644 --- a/src/supertux/menu/download_dialog.cpp +++ b/src/supertux/menu/download_dialog.cpp @@ -74,12 +74,6 @@ DownloadDialog::update() update_text(); } -void -DownloadDialog::set_title(const std::string& title) -{ - m_title = title; -} - void DownloadDialog::update_text() { diff --git a/src/supertux/menu/download_dialog.hpp b/src/supertux/menu/download_dialog.hpp index cfdf4b73f94..0977f6252c9 100644 --- a/src/supertux/menu/download_dialog.hpp +++ b/src/supertux/menu/download_dialog.hpp @@ -39,9 +39,10 @@ class DownloadDialog final : public Dialog DownloadDialog(TransferStatusListPtr statuses, bool auto_close = false, bool passive = false, bool no_error_msg = false); - void set_title(const std::string& title); void update() override; + inline void set_title(const std::string& title) { m_title = title; } + private: void update_text(); diff --git a/src/supertux/menu/editor_levelset_select_menu.hpp b/src/supertux/menu/editor_levelset_select_menu.hpp index 80c884625e8..0462b93e05a 100644 --- a/src/supertux/menu/editor_levelset_select_menu.hpp +++ b/src/supertux/menu/editor_levelset_select_menu.hpp @@ -32,7 +32,7 @@ class EditorLevelsetSelectMenu final : public Menu void initialize(); void reload_menu(); - std::vector& get_contrib_worlds() { return m_contrib_worlds; } + inline std::vector& get_contrib_worlds() { return m_contrib_worlds; } private: EditorLevelsetSelectMenu(const EditorLevelsetSelectMenu&) = delete; diff --git a/src/supertux/moving_object.cpp b/src/supertux/moving_object.cpp index 7a391677446..72692e6f9d1 100644 --- a/src/supertux/moving_object.cpp +++ b/src/supertux/moving_object.cpp @@ -81,42 +81,6 @@ MovingObject::set_parent_dispenser(Dispenser* dispenser) } } -float -MovingObject::get_x() const -{ - return m_col.m_bbox.get_left(); -} - -float -MovingObject::get_y() const -{ - return m_col.m_bbox.get_top(); -} - -void -MovingObject::set_pos(float x, float y) -{ - set_pos(Vector(x, y)); -} - -void -MovingObject::move(float x, float y) -{ - move(Vector(x, y)); -} - -float -MovingObject::get_width() const -{ - return m_col.m_bbox.get_width(); -} - -float -MovingObject::get_height() const -{ - return m_col.m_bbox.get_height(); -} - void MovingObject::editor_select() { diff --git a/src/supertux/moving_object.hpp b/src/supertux/moving_object.hpp index 873533a5644..ac784122771 100644 --- a/src/supertux/moving_object.hpp +++ b/src/supertux/moving_object.hpp @@ -106,7 +106,7 @@ class MovingObject : public GameObject, } void set_parent_dispenser(Dispenser* dispenser); - Dispenser* get_parent_dispenser() const { return m_parent_dispenser; } + inline Dispenser* get_parent_dispenser() const { return m_parent_dispenser; } static std::string class_name() { return "moving-object"; } virtual std::string get_class_name() const override { return class_name(); } @@ -123,37 +123,37 @@ class MovingObject : public GameObject, * @scripting * @description Returns the object's X coordinate. */ - float get_x() const; + inline float get_x() const { return m_col.m_bbox.get_left(); } /** * @scripting * @description Returns the object's Y coordinate. */ - float get_y() const; + inline float get_y() const { return m_col.m_bbox.get_top(); } /** * @scripting * @description Sets the position of the object. * @param float $x * @param float $y */ - void set_pos(float x, float y); + inline void set_pos(float x, float y) { set_pos(Vector(x, y)); } /** * @scripting * @description Moves the object by ""x"" units to the right and ""y"" down, relative to its current position. * @param float $x * @param float $y */ - void move(float x, float y); + inline void move(float x, float y) { move(Vector(x, y)); } /** * @scripting * @description Returns the object's hitbox width. */ - float get_width() const; + inline float get_width() const { return m_col.m_bbox.get_width(); } /** * @scripting * @description Returns the object's hitbox height. */ - float get_height() const; + inline float get_height() const { return m_col.m_bbox.get_height(); } protected: void set_group(CollisionGroup group) diff --git a/src/supertux/object_factory.hpp b/src/supertux/object_factory.hpp index 877bc743ba7..3a10b8047e9 100644 --- a/src/supertux/object_factory.hpp +++ b/src/supertux/object_factory.hpp @@ -64,9 +64,9 @@ class ObjectFactory bool has_params(const std::string& name, uint8_t params); - std::vector& get_registered_badguys() { return m_badguys_names; } + inline std::vector& get_registered_badguys() { return m_badguys_names; } std::vector get_registered_badguys(uint8_t params); - std::vector& get_registered_objects() { return m_objects_names; } + inline std::vector& get_registered_objects() { return m_objects_names; } std::vector get_registered_objects(uint8_t params); protected: diff --git a/src/supertux/physic.cpp b/src/supertux/physic.cpp index b84b409c860..a5e58bce29a 100644 --- a/src/supertux/physic.cpp +++ b/src/supertux/physic.cpp @@ -34,13 +34,6 @@ Physic::reset() gravity_enabled_flag = true; } -void -Physic::set_velocity(float nvx, float nvy) -{ - vx = nvx; - vy = nvy; -} - void Physic::set_velocity(const Vector& vector) { @@ -48,13 +41,6 @@ Physic::set_velocity(const Vector& vector) vy = vector.y; } -void -Physic::set_acceleration(float nax, float nay) -{ - ax = nax; - ay = nay; -} - void Physic::set_acceleration(const Vector& vector) { diff --git a/src/supertux/physic.hpp b/src/supertux/physic.hpp index 77ad3f7fe97..83e65d977a3 100644 --- a/src/supertux/physic.hpp +++ b/src/supertux/physic.hpp @@ -33,42 +33,50 @@ class Physic final void reset(); /// Sets velocity to a fixed value. - void set_velocity(float nvx, float nvy); + inline void set_velocity(float nvx, float nvy) + { + vx = nvx; + vy = nvy; + } void set_velocity(const Vector& vector); - void set_velocity_x(float nvx) { vx = nvx; } - void set_velocity_y(float nvy) { vy = nvy; } + inline void set_velocity_x(float nvx) { vx = nvx; } + inline void set_velocity_y(float nvy) { vy = nvy; } /// Velocity inversion. void inverse_velocity_x() { vx = -vx; } void inverse_velocity_y() { vy = -vy; } - Vector get_velocity() const { return Vector(vx, vy); } - float get_velocity_x() const { return vx; } - float get_velocity_y() const { return vy; } + inline Vector get_velocity() const { return Vector(vx, vy); } + inline float get_velocity_x() const { return vx; } + inline float get_velocity_y() const { return vy; } /// Set acceleration. /** Sets acceleration applied to the object. (Note that gravity is * eventually added to the vertical acceleration) */ - void set_acceleration(float nax, float nay); + inline void set_acceleration(float nax, float nay) + { + ax = nax; + ay = nay; + } void set_acceleration(const Vector& vector); - void set_acceleration_x(float nax) { ax = nax; } - void set_acceleration_y(float nay) { ay = nay; } + inline void set_acceleration_x(float nax) { ax = nax; } + inline void set_acceleration_y(float nay) { ay = nay; } - Vector get_acceleration() const { return Vector(ax, ay); } - float get_acceleration_x() const { return ax; } - float get_acceleration_y() const { return ay; } + inline Vector get_acceleration() const { return Vector(ax, ay); } + inline float get_acceleration_x() const { return ax; } + inline float get_acceleration_y() const { return ay; } /// Enables or disables handling of gravity. - void enable_gravity(bool enable) { gravity_enabled_flag = enable; } - bool gravity_enabled() const { return gravity_enabled_flag; } + inline void enable_gravity(bool enable) { gravity_enabled_flag = enable; } + inline bool gravity_enabled() const { return gravity_enabled_flag; } /** Set gravity modifier factor to apply to object when enabled */ - void set_gravity_modifier(float modifier) { gravity_modifier = modifier; } + inline void set_gravity_modifier(float modifier) { gravity_modifier = modifier; } - float get_gravity_modifier() const { return gravity_modifier; } + inline float get_gravity_modifier() const { return gravity_modifier; } Vector get_movement(float dt_sec); diff --git a/src/supertux/profile.hpp b/src/supertux/profile.hpp index 0224fe27082..b51b49eed6b 100644 --- a/src/supertux/profile.hpp +++ b/src/supertux/profile.hpp @@ -35,12 +35,12 @@ class Profile final void create_basedir(); std::string get_basedir() const; - int get_id() const { return m_id; } - const std::string& get_name() const { return m_name; } - const std::string& get_last_world() const { return m_last_world; } + inline int get_id() const { return m_id; } + inline const std::string& get_name() const { return m_name; } + inline const std::string& get_last_world() const { return m_last_world; } - void set_name(const std::string& name) { m_name = name; } - void set_last_world(const std::string& world) { m_last_world = world; } + inline void set_name(const std::string& name) { m_name = name; } + inline void set_last_world(const std::string& world) { m_last_world = world; } private: const int m_id; diff --git a/src/supertux/savegame.hpp b/src/supertux/savegame.hpp index a36b64623b9..d972007f362 100644 --- a/src/supertux/savegame.hpp +++ b/src/supertux/savegame.hpp @@ -75,11 +75,11 @@ class Savegame final public: Savegame(Profile& profile, const std::string& world_name); - Profile& get_profile() const { return m_profile; } + inline Profile& get_profile() const { return m_profile; } std::string get_filename() const; /** Returns content of (tux ...) entry */ - PlayerStatus& get_player_status() const { return *m_player_status; } + inline PlayerStatus& get_player_status() const { return *m_player_status; } std::string get_title() const; diff --git a/src/supertux/screen_manager.cpp b/src/supertux/screen_manager.cpp index e53cfcbfdc8..63d8a6b2b09 100644 --- a/src/supertux/screen_manager.cpp +++ b/src/supertux/screen_manager.cpp @@ -103,9 +103,9 @@ struct ScreenManager::FPS_Stats max_us = 0; } - float get_fps() const { return last_fps; } - float get_fps_min() const { return last_fps_min; } - float get_fps_max() const { return last_fps_max; } + inline float get_fps() const { return last_fps; } + inline float get_fps_min() const { return last_fps_min; } + inline float get_fps_max() const { return last_fps_max; } // This returns the highest measured delay between two frames from the // previous and current 0.5 s measuring intervals @@ -191,18 +191,6 @@ ScreenManager::quit(std::unique_ptr screen_fade) m_actions.emplace_back(Action::QUIT_ACTION); } -void -ScreenManager::set_speed(float speed) -{ - m_speed = speed; -} - -float -ScreenManager::get_speed() const -{ - return m_speed; -} - void ScreenManager::on_window_resize() { diff --git a/src/supertux/screen_manager.hpp b/src/supertux/screen_manager.hpp index 1b1de08c359..9104d6ae106 100644 --- a/src/supertux/screen_manager.hpp +++ b/src/supertux/screen_manager.hpp @@ -49,8 +49,8 @@ class ScreenManager final : public Currenton void run(); void quit(std::unique_ptr fade = {}); - void set_speed(float speed); - float get_speed() const; + inline void set_speed(float speed) { m_speed = speed; } + inline float get_speed() const { return m_speed; } bool has_pending_fadeout() const; void on_window_resize(); @@ -62,7 +62,7 @@ class ScreenManager final : public Currenton void loop_iter(); - const std::vector>& get_screen_stack() { return m_screen_stack; } + inline const std::vector>& get_screen_stack() { return m_screen_stack; } private: struct FPS_Stats; diff --git a/src/supertux/sector.cpp b/src/supertux/sector.cpp index 023812f4d9d..8fe37eab86b 100644 --- a/src/supertux/sector.cpp +++ b/src/supertux/sector.cpp @@ -343,18 +343,6 @@ Sector::calculate_foremost_layer(bool including_transparent) const return layer; } -int -Sector::get_foremost_opaque_layer() const -{ - return m_foremost_opaque_layer; -} - -int -Sector::get_foremost_layer() const -{ - return m_foremost_layer; -} - TileSet* Sector::get_tileset() const { @@ -700,18 +688,6 @@ Sector::change_solid_tiles(uint32_t old_tile_id, uint32_t new_tile_id) } } -void -Sector::set_gravity(float gravity) -{ - m_gravity = gravity; -} - -float -Sector::get_gravity() const -{ - return m_gravity; -} - Player* Sector::get_nearest_player(const Vector& pos) const { @@ -888,18 +864,18 @@ Sector::get_camera() const return get_singleton_by_type(); } -std::vector -Sector::get_players() const -{ - return m_level.get_players(); -} - DisplayEffect& Sector::get_effect() const { return get_singleton_by_type(); } +std::vector +Sector::get_players() const +{ + return m_level.get_players(); +} + void Sector::register_class(ssq::VM& vm) diff --git a/src/supertux/sector.hpp b/src/supertux/sector.hpp index e5208f99440..8263d528d49 100644 --- a/src/supertux/sector.hpp +++ b/src/supertux/sector.hpp @@ -82,7 +82,7 @@ class Sector final : public Base::Sector std::string get_exposed_class_name() const override { return "Sector"; } - Level& get_level() const { return m_level; } + inline Level& get_level() const { return m_level; } TileSet* get_tileset() const override; bool in_worldmap() const override; @@ -193,8 +193,8 @@ class Sector final : public Base::Sector Rectf get_active_region() const; - int get_foremost_opaque_layer() const; - int get_foremost_layer() const; + inline int get_foremost_opaque_layer() const { return m_foremost_opaque_layer; } + inline int get_foremost_layer() const { return m_foremost_layer; } /** returns the editor size (in tiles) of a sector */ Size get_editor_size() const; @@ -210,18 +210,19 @@ class Sector final : public Base::Sector * Sets the sector's gravity. * @param float $gravity */ - void set_gravity(float gravity); + inline void set_gravity(float gravity) { m_gravity = gravity; } /** * @scripting * Returns the sector's gravity. * @param float $gravity */ - float get_gravity() const; + inline float get_gravity() const { return m_gravity; } Camera& get_camera() const; - std::vector get_players() const; DisplayEffect& get_effect() const; - TextObject& get_text_object() const { return m_text_object; } + inline TextObject& get_text_object() const { return m_text_object; } + + std::vector get_players() const; Vector get_spawn_point_position(const std::string& spawnpoint); diff --git a/src/supertux/sector_base.hpp b/src/supertux/sector_base.hpp index c8b768cc297..5b8f8901338 100644 --- a/src/supertux/sector_base.hpp +++ b/src/supertux/sector_base.hpp @@ -42,10 +42,10 @@ class Sector : public GameObjectManager virtual TileSet* get_tileset() const = 0; virtual bool in_worldmap() const = 0; - void set_name(const std::string& name) { m_name = name; } - const std::string& get_name() const { return m_name; } + inline void set_name(const std::string& name) { m_name = name; } + inline const std::string& get_name() const { return m_name; } - void set_init_script(const std::string& init_script) { m_init_script = init_script; } + inline void set_init_script(const std::string& init_script) { m_init_script = init_script; } void run_script(const std::string& script, const std::string& sourcename); protected: diff --git a/src/supertux/statistics.hpp b/src/supertux/statistics.hpp index 640056b53d4..7b7de6b6497 100644 --- a/src/supertux/statistics.hpp +++ b/src/supertux/statistics.hpp @@ -78,7 +78,7 @@ class Statistics final /** unserialize statistics object from squirrel table "statistics" */ void unserialize_from_squirrel(const ssq::Table& table); - const Preferences& get_preferences() const { return m_preferences; } + inline const Preferences& get_preferences() const { return m_preferences; } void add_preferences_to_menu(Menu& menu); void draw_worldmap_info(DrawingContext& context, float target_time); /**< draw worldmap stat HUD */ @@ -95,11 +95,11 @@ class Statistics final void update(const Statistics& stats); /**< Given another Statistics object finds the best of each one */ bool completed(const float target_time) const; /* Check if stats match total stats */ - int get_coins() const { return m_coins; } - int get_badguys() const { return m_badguys; } - int get_secrets() const { return m_secrets; } - float get_time() const { return m_time; } - Status get_status() const { return m_status; } + inline int get_coins() const { return m_coins; } + inline int get_badguys() const { return m_badguys; } + inline int get_secrets() const { return m_secrets; } + inline float get_time() const { return m_time; } + inline Status get_status() const { return m_status; } void increment_coins() { m_coins++; check_coins(); } void increment_badguys() { m_badguys++; check_badguys(); } diff --git a/src/supertux/tile.hpp b/src/supertux/tile.hpp index 47a14c60471..4c859ed4bb2 100644 --- a/src/supertux/tile.hpp +++ b/src/supertux/tile.hpp @@ -112,11 +112,11 @@ class Tile final SurfacePtr get_current_surface() const; SurfacePtr get_current_editor_surface() const; - uint32_t get_attributes() const { return m_attributes; } - int get_data() const { return m_data; } + inline uint32_t get_attributes() const { return m_attributes; } + inline int get_data() const { return m_data; } /** Checks the SLOPE attribute. Returns "true" if set, "false" otherwise. */ - bool is_slope() const { return (m_attributes & SLOPE) != 0; } + inline bool is_slope() const { return (m_attributes & SLOPE) != 0; } /** Determine the solidity of a tile. This version behaves correctly for unisolid tiles by taking position and movement of the object @@ -130,7 +130,7 @@ class Tile final unisolid tiles. To determine the *current* solidity of unisolid tiles, use the "is_solid" method that takes position and movement into account (see above). */ - bool is_solid() const { return (m_attributes & SOLID) != 0; } + inline bool is_solid() const { return (m_attributes & SOLID) != 0; } /** Determines whether the tile's attributes are important to calculate the collisions. The tile may be unisolid and therefore @@ -138,12 +138,12 @@ class Tile final bool is_collisionful(const Rectf& tile_bbox, const Rectf& position, const Vector& movement) const; /** Checks the UNISOLID attribute. Returns "true" if set, "false" otherwise. */ - bool is_unisolid() const { return (m_attributes & UNISOLID) != 0; } + inline bool is_unisolid() const { return (m_attributes & UNISOLID) != 0; } - bool is_deprecated() const { return m_deprecated; } + inline bool is_deprecated() const { return m_deprecated; } - const std::string& get_object_name() const { return m_object_name; } - const std::string& get_object_data() const { return m_object_data; } + inline const std::string& get_object_name() const { return m_object_name; } + inline const std::string& get_object_data() const { return m_object_data; } private: /** Returns zero if a unisolid tile is non-solid due to the movement diff --git a/src/supertux/timer.hpp b/src/supertux/timer.hpp index b0102180a5e..cfb8a228fa3 100644 --- a/src/supertux/timer.hpp +++ b/src/supertux/timer.hpp @@ -45,12 +45,12 @@ class Timer final void resume(); /** returns the period of the timer or 0 if it isn't started */ - float get_period() const { return m_period; } - float get_timeleft() const { return m_period - (g_game_time - m_cycle_start); } - float get_timegone() const { return g_game_time - m_cycle_start; } - float get_progress() const { return get_timegone() / get_period(); } - bool started() const { return (m_period != 0 && get_timeleft() > 0); } - bool paused() const { return m_cycle_pause != 0; } + inline float get_period() const { return m_period; } + inline float get_timeleft() const { return m_period - (g_game_time - m_cycle_start); } + inline float get_timegone() const { return g_game_time - m_cycle_start; } + inline float get_progress() const { return get_timegone() / get_period(); } + inline bool started() const { return (m_period != 0 && get_timeleft() > 0); } + inline bool paused() const { return m_cycle_pause != 0; } private: float m_period; diff --git a/src/supertux/world.hpp b/src/supertux/world.hpp index 05afb7b9bd4..18d1d557571 100644 --- a/src/supertux/world.hpp +++ b/src/supertux/world.hpp @@ -38,17 +38,17 @@ class World final public: std::string get_basename() const; - const std::string& get_basedir() const { return m_basedir; } - const std::string& get_title() const { return m_title; } - const std::string& get_description() const { return m_description; } + inline const std::string& get_basedir() const { return m_basedir; } + inline const std::string& get_title() const { return m_title; } + inline const std::string& get_description() const { return m_description; } - bool hide_from_contribs() const { return m_hide_from_contribs && !g_config->developer_mode; } + inline bool hide_from_contribs() const { return m_hide_from_contribs && !g_config->developer_mode; } - bool is_levelset() const { return m_is_levelset; } - bool is_worldmap() const { return !m_is_levelset; } + inline bool is_levelset() const { return m_is_levelset; } + inline bool is_worldmap() const { return !m_is_levelset; } - const std::string& get_contrib_type() const { return m_contrib_type; } - const std::string& get_title_level() const { return m_title_level; } + inline const std::string& get_contrib_type() const { return m_contrib_type; } + inline const std::string& get_title_level() const { return m_title_level; } std::string get_worldmap_filename() const; diff --git a/src/trigger/door.hpp b/src/trigger/door.hpp index 7b095c33157..c6f6ac06e73 100644 --- a/src/trigger/door.hpp +++ b/src/trigger/door.hpp @@ -43,10 +43,10 @@ class Door final : public SpritedTrigger virtual void on_flip(float height) override; - bool is_locked() const { return m_locked; } + inline bool is_locked() const { return m_locked; } void unlock(); - Color get_lock_color() const { return m_lock_color; } + inline Color get_lock_color() const { return m_lock_color; } private: enum DoorState { diff --git a/src/trigger/secretarea_trigger.hpp b/src/trigger/secretarea_trigger.hpp index 8473b06da0f..bd7b998a5ce 100644 --- a/src/trigger/secretarea_trigger.hpp +++ b/src/trigger/secretarea_trigger.hpp @@ -43,7 +43,7 @@ class SecretAreaTrigger final : public Trigger virtual void event(Player& player, EventType type) override; virtual void draw(DrawingContext& context) override; - const std::string& get_fade_tilemap_name() const { return fade_tilemap; } + inline const std::string& get_fade_tilemap_name() const { return fade_tilemap; } private: Timer message_timer; diff --git a/src/util/reader_collection.hpp b/src/util/reader_collection.hpp index 14e5ad793db..6089fdfcb53 100644 --- a/src/util/reader_collection.hpp +++ b/src/util/reader_collection.hpp @@ -35,8 +35,8 @@ class ReaderCollection final std::vector get_objects() const; - const ReaderDocument& get_doc() const { return m_doc; } - const sexp::Value& get_sexp() const { return m_sx; } + inline const ReaderDocument& get_doc() const { return m_doc; } + inline const sexp::Value& get_sexp() const { return m_sx; } private: const ReaderDocument& m_doc; diff --git a/src/util/reader_document.hpp b/src/util/reader_document.hpp index 8438dda5841..d970a03e5e0 100644 --- a/src/util/reader_document.hpp +++ b/src/util/reader_document.hpp @@ -42,7 +42,7 @@ class ReaderDocument final /** Returns the directory of the document */ std::string get_directory() const; - const sexp::Value& get_sexp() const { return m_sx; } + inline const sexp::Value& get_sexp() const { return m_sx; } private: std::string m_filename; diff --git a/src/util/reader_iterator.hpp b/src/util/reader_iterator.hpp index 66b9481d482..27f2bf9b7bb 100644 --- a/src/util/reader_iterator.hpp +++ b/src/util/reader_iterator.hpp @@ -54,7 +54,7 @@ class ReaderIterator final ReaderMapping as_mapping() const; const sexp::Value& get_sexp() const; - const ReaderDocument& get_doc() const { return m_doc; } + inline const ReaderDocument& get_doc() const { return m_doc; } private: const ReaderDocument& m_doc; diff --git a/src/util/reader_mapping.hpp b/src/util/reader_mapping.hpp index 02a4af3d9aa..71f3f021356 100644 --- a/src/util/reader_mapping.hpp +++ b/src/util/reader_mapping.hpp @@ -82,8 +82,8 @@ class ReaderMapping final } } - const sexp::Value& get_sexp() const { return m_sx; } - const ReaderDocument& get_doc() const { return m_doc; } + inline const sexp::Value& get_sexp() const { return m_sx; } + inline const ReaderDocument& get_doc() const { return m_doc; } private: /** Returns pointer to (key value) */ diff --git a/src/util/reader_object.hpp b/src/util/reader_object.hpp index a77e9db0e03..ad62989c96c 100644 --- a/src/util/reader_object.hpp +++ b/src/util/reader_object.hpp @@ -36,8 +36,8 @@ class ReaderObject final ReaderMapping get_mapping() const; ReaderCollection get_collection() const; - const ReaderDocument& get_doc() const { return m_doc; } - const sexp::Value& get_sexp() const { return m_sx; } + inline const ReaderDocument& get_doc() const { return m_doc; } + inline const sexp::Value& get_sexp() const { return m_sx; } private: const ReaderDocument& m_doc; diff --git a/src/video/bitmap_font.hpp b/src/video/bitmap_font.hpp index 81d68483eda..9a8832b5500 100644 --- a/src/video/bitmap_font.hpp +++ b/src/video/bitmap_font.hpp @@ -47,7 +47,7 @@ class BitmapFont final : public Font BitmapFont(GlyphWidth glyph_width, const std::string& fontfile, int shadowsize = 2); ~BitmapFont() override; - int get_shadow_size() const { return shadowsize; } + inline int get_shadow_size() const { return shadowsize; } /** returns the width of a given text. (Note that I won't add a normal * get_width function here, as we might switch to variable width fonts in the diff --git a/src/video/canvas.hpp b/src/video/canvas.hpp index aee91aa2489..8ed28d0c2da 100644 --- a/src/video/canvas.hpp +++ b/src/video/canvas.hpp @@ -98,7 +98,7 @@ class Canvas final void clear(); void render(Renderer& renderer, Filter filter); - DrawingContext& get_context() { return m_context; } + inline DrawingContext& get_context() { return m_context; } private: Vector apply_translate(const Vector& pos) const; diff --git a/src/video/color.hpp b/src/video/color.hpp index 8490e133c95..84e5f57e0b4 100644 --- a/src/video/color.hpp +++ b/src/video/color.hpp @@ -38,7 +38,7 @@ class Color final { } - Color validate() const { return Color(r, g, b, a); } + inline Color validate() const { return Color(r, g, b, a); } CalculateColor operator+(const CalculateColor& o) const { return CalculateColor(r + o.r, g + o.g, b + o.b, a + o.a); } CalculateColor operator-(const CalculateColor& o) const { return CalculateColor(r - o.r, g - o.g, b - o.b, a - o.a); } diff --git a/src/video/drawing_context.cpp b/src/video/drawing_context.cpp index 66bbd62b9fc..7cdf12782f9 100644 --- a/src/video/drawing_context.cpp +++ b/src/video/drawing_context.cpp @@ -44,9 +44,10 @@ DrawingContext::~DrawingContext() } void -DrawingContext::set_ambient_color(Color ambient_color) +DrawingContext::clear() { - m_ambient_color = ambient_color; + m_lightmap_canvas.clear(); + m_colormap_canvas.clear(); } Rectf @@ -58,61 +59,17 @@ DrawingContext::get_cliprect() const get_translation().y + static_cast(transform().viewport.get_height()) / transform().scale); } -void -DrawingContext::set_flip(Flip flip) +Canvas& +DrawingContext::get_canvas(DrawingTarget target) { - transform().flip = flip; -} - -Flip -DrawingContext::get_flip() const -{ - return transform().flip; -} - -void -DrawingContext::set_alpha(float alpha) -{ - transform().alpha = alpha; -} + switch (target) + { + case DrawingTarget::LIGHTMAP: + return light(); -float -DrawingContext::get_alpha() const -{ - return transform().alpha; -} - -DrawingTransform& -DrawingContext::transform() -{ - assert(!m_transform_stack.empty()); - return m_transform_stack.back(); -} - -const DrawingTransform& -DrawingContext::transform() const -{ - assert(!m_transform_stack.empty()); - return m_transform_stack.back(); -} - -void -DrawingContext::push_transform() -{ - m_transform_stack.push_back(transform()); -} - -void -DrawingContext::pop_transform() -{ - m_transform_stack.pop_back(); - assert(!m_transform_stack.empty()); -} - -const Rect& -DrawingContext::get_viewport() const -{ - return transform().viewport; + default: + return color(); + } } float @@ -133,6 +90,12 @@ DrawingContext::get_size() const return Vector(get_width(), get_height()) * transform().scale; } +bool +DrawingContext::use_lightmap() const +{ + return !m_overlay && m_ambient_color != Color::WHITE; +} + bool DrawingContext::perspective_scale(float speed_x, float speed_y) { diff --git a/src/video/drawing_context.hpp b/src/video/drawing_context.hpp index 737e7b8d16d..e21b746b2d9 100644 --- a/src/video/drawing_context.hpp +++ b/src/video/drawing_context.hpp @@ -48,75 +48,67 @@ class DrawingContext final /** Returns the visible area in world coordinates */ Rectf get_cliprect() const; - Canvas& color() { return m_colormap_canvas; } - Canvas& light() { assert(!m_overlay); return m_lightmap_canvas; } - Canvas& get_canvas(DrawingTarget target) { - switch (target) - { - case DrawingTarget::LIGHTMAP: - return light(); - - default: - return color(); - } - } - - void set_ambient_color(Color ambient_color); - Color get_ambient_color() const { return m_ambient_color; } + inline Canvas& color() { return m_colormap_canvas; } + inline Canvas& light() { assert(!m_overlay); return m_lightmap_canvas; } + Canvas& get_canvas(DrawingTarget target); - void push_transform(); - void pop_transform(); - DrawingTransform& transform(); - const DrawingTransform& transform() const; + inline void set_ambient_color(Color ambient_color) { m_ambient_color = ambient_color; } + inline Color get_ambient_color() const { return m_ambient_color; } - const Vector& get_translation() const - { return transform().translation; } + inline void push_transform() + { + m_transform_stack.push_back(transform()); + } + inline void pop_transform() + { + m_transform_stack.pop_back(); + assert(!m_transform_stack.empty()); + } + inline DrawingTransform& transform() + { + assert(!m_transform_stack.empty()); + return m_transform_stack.back(); + } + inline const DrawingTransform& transform() const + { + assert(!m_transform_stack.empty()); + return m_transform_stack.back(); + } - void set_translation(const Vector& newtranslation) - { transform().translation = newtranslation; } + inline const Vector& get_translation() const { return transform().translation; } + inline void set_translation(const Vector& translation) { transform().translation = translation; } - float get_scale() const { return transform().scale; } - void scale(float scale) { transform().scale *= scale; } + inline float get_scale() const { return transform().scale; } + inline void scale(float scale) { transform().scale *= scale; } /** Recalculates the scaling factor for parallax layers.*/ bool perspective_scale(float speed_x, float speed_y); /** Apply that flip in the next draws (flips are listed on surface.h). */ - void set_flip(Flip flip); - Flip get_flip() const; + inline void set_flip(Flip flip) { transform().flip = flip; } + inline Flip get_flip() const { return transform().flip; } /** apply that alpha in the next draws (1.0 means fully opaque) */ - void set_alpha(float alpha); - float get_alpha() const; + inline void set_alpha(float alpha) { transform().alpha = alpha; } + inline float get_alpha() const { return transform().alpha; } /** For position extrapolation at high frame rates: real time since last game update step */ - void set_time_offset(float time_offset) { m_time_offset = time_offset; } - float get_time_offset() const { return m_time_offset; } - - void clear() - { - m_lightmap_canvas.clear(); - m_colormap_canvas.clear(); - } + inline void set_time_offset(float time_offset) { m_time_offset = time_offset; } + inline float get_time_offset() const { return m_time_offset; } - void set_viewport(const Rect& viewport) - { - transform().viewport = viewport; - } + void clear(); - const Rect& get_viewport() const; + inline void set_viewport(const Rect& viewport) { transform().viewport = viewport; } + inline const Rect& get_viewport() const { return transform().viewport; } float get_width() const; float get_height() const; Vector get_size() const; - Rectf get_rect() const { return Rectf(Vector(0, 0), get_size()); } + inline Rectf get_rect() const { return Rectf(Vector(0, 0), get_size()); } - bool use_lightmap() const - { - return !m_overlay && m_ambient_color != Color::WHITE; - } + bool use_lightmap() const; - bool is_overlay() const { return m_overlay; } + inline bool is_overlay() const { return m_overlay; } private: VideoSystem& m_video_system; diff --git a/src/video/gl/gl33core_context.hpp b/src/video/gl/gl33core_context.hpp index 39b5daf2e4e..64623081435 100644 --- a/src/video/gl/gl33core_context.hpp +++ b/src/video/gl/gl33core_context.hpp @@ -54,9 +54,9 @@ class GL33CoreContext final : public GLContext virtual bool supports_framebuffer() const override { return true; } - GLProgram& get_program() const { return *m_program; } - GLVertexArrays& get_vertex_arrays() const { return *m_vertex_arrays; } - GLTexture& get_white_texture() const { return *m_white_texture; } + inline GLProgram& get_program() const { return *m_program; } + inline GLVertexArrays& get_vertex_arrays() const { return *m_vertex_arrays; } + inline GLTexture& get_white_texture() const { return *m_white_texture; } private: GLVideoSystem& m_video_system; diff --git a/src/video/gl/gl_framebuffer.hpp b/src/video/gl/gl_framebuffer.hpp index 36d9a2a377a..b925903ad17 100644 --- a/src/video/gl/gl_framebuffer.hpp +++ b/src/video/gl/gl_framebuffer.hpp @@ -31,7 +31,7 @@ class GLFramebuffer final GLFramebuffer(/*GLVideoSystem& video_system,*/ GLTexture& texture); ~GLFramebuffer(); - GLuint get_handle() const { return m_handle; } + inline GLuint get_handle() const { return m_handle; } private: //GLVideoSystem& m_video_system; diff --git a/src/video/gl/gl_program.hpp b/src/video/gl/gl_program.hpp index e62a20b1260..a217734e2f5 100644 --- a/src/video/gl/gl_program.hpp +++ b/src/video/gl/gl_program.hpp @@ -32,20 +32,20 @@ class GLProgram final void bind(); void validate(); - GLuint get_handle() const { return m_program; } + inline GLuint get_handle() const { return m_program; } - GLint get_backbuffer_location() const { return check_valid(m_backbuffer_location, "backbuffer"); } - GLint get_fragcoord2uv_location() const { return check_valid(m_fragcoord2uv_location, "fragcoord2uv"); } - GLint get_diffuse_texture_location() const { return check_valid(m_diffuse_texture_location, "diffuse_texture"); } - GLint get_displacement_texture_location() const { return check_valid(m_displacement_texture_location, "displacement_texture"); } - GLint get_framebuffer_texture_location() const { return check_valid(m_framebuffer_texture_location, "framebuffer_texture"); } - GLint get_game_time_location() const { return check_valid(m_game_time_location, "game_time"); } - GLint get_modelviewprojection_location() const { return check_valid(m_modelviewprojection_location, "modelviewprojection"); } - GLint get_animate_location() const { return check_valid(m_animate_location, "animate"); } - GLint get_displacement_animate_location() const { return check_valid(m_displacement_animate_location, "displacement_animate"); } - GLint get_position_location() const { return check_valid(m_position_location, "position"); } - GLint get_texcoord_location() const { return check_valid(m_texcoord_location, "texcoord"); } - GLint get_diffuse_location() const { return check_valid(m_diffuse_location, "diffuse"); } + inline GLint get_backbuffer_location() const { return check_valid(m_backbuffer_location, "backbuffer"); } + inline GLint get_fragcoord2uv_location() const { return check_valid(m_fragcoord2uv_location, "fragcoord2uv"); } + inline GLint get_diffuse_texture_location() const { return check_valid(m_diffuse_texture_location, "diffuse_texture"); } + inline GLint get_displacement_texture_location() const { return check_valid(m_displacement_texture_location, "displacement_texture"); } + inline GLint get_framebuffer_texture_location() const { return check_valid(m_framebuffer_texture_location, "framebuffer_texture"); } + inline GLint get_game_time_location() const { return check_valid(m_game_time_location, "game_time"); } + inline GLint get_modelviewprojection_location() const { return check_valid(m_modelviewprojection_location, "modelviewprojection"); } + inline GLint get_animate_location() const { return check_valid(m_animate_location, "animate"); } + inline GLint get_displacement_animate_location() const { return check_valid(m_displacement_animate_location, "displacement_animate"); } + inline GLint get_position_location() const { return check_valid(m_position_location, "position"); } + inline GLint get_texcoord_location() const { return check_valid(m_texcoord_location, "texcoord"); } + inline GLint get_diffuse_location() const { return check_valid(m_diffuse_location, "diffuse"); } private: bool get_link_status() const; diff --git a/src/video/gl/gl_texture.hpp b/src/video/gl/gl_texture.hpp index 1975236301f..dc982d3054c 100644 --- a/src/video/gl/gl_texture.hpp +++ b/src/video/gl/gl_texture.hpp @@ -42,13 +42,13 @@ class GLTexture final : public Texture virtual int get_image_width() const override { return m_image_width; } virtual int get_image_height() const override { return m_image_height; } - void set_handle(GLuint handle) { m_handle = handle; } - const GLuint &get_handle() const { return m_handle; } + inline void set_handle(GLuint handle) { m_handle = handle; } + inline const GLuint &get_handle() const { return m_handle; } - const Sampler& get_sampler() const { return m_sampler; } + inline const Sampler& get_sampler() const { return m_sampler; } - void set_image_width(int width) { m_image_width = width; } - void set_image_height(int height) { m_image_height = height; } + inline void set_image_width(int width) { m_image_width = width; } + inline void set_image_height(int height) { m_image_height = height; } private: void set_texture_params(); diff --git a/src/video/gl/gl_video_system.hpp b/src/video/gl/gl_video_system.hpp index 50706f36a74..31629249e5b 100644 --- a/src/video/gl/gl_video_system.hpp +++ b/src/video/gl/gl_video_system.hpp @@ -58,7 +58,7 @@ class GLVideoSystem final : public SDLBaseVideoSystem virtual SDLSurfacePtr make_screenshot() override; - GLContext& get_context() const { return *m_context; } + inline GLContext& get_context() const { return *m_context; } private: void create_gl_window(); diff --git a/src/video/paint_style.hpp b/src/video/paint_style.hpp index 6abd0117cf4..738ca174732 100644 --- a/src/video/paint_style.hpp +++ b/src/video/paint_style.hpp @@ -52,10 +52,10 @@ class PaintStyle final return *this; } - const Color& get_color() const { return m_color; } - const float& get_alpha() const { return m_alpha; } - const Blend& get_blend() const { return m_blend; } - const Flip& get_flip() const { return m_flip; } + inline const Color& get_color() const { return m_color; } + inline const float& get_alpha() const { return m_alpha; } + inline const Blend& get_blend() const { return m_blend; } + inline const Flip& get_flip() const { return m_flip; } private: Color m_color; diff --git a/src/video/sampler.hpp b/src/video/sampler.hpp index ce17cefc722..cf2ec5ebfc3 100644 --- a/src/video/sampler.hpp +++ b/src/video/sampler.hpp @@ -29,10 +29,10 @@ class Sampler final Sampler& operator=(const Sampler&) = default; - GLenum get_filter() const { return m_filter; } - GLenum get_wrap_s() const { return m_wrap_s; } - GLenum get_wrap_t() const { return m_wrap_t; } - Vector get_animate() const { return m_animate; } + inline GLenum get_filter() const { return m_filter; } + inline GLenum get_wrap_s() const { return m_wrap_s; } + inline GLenum get_wrap_t() const { return m_wrap_t; } + inline Vector get_animate() const { return m_animate; } private: GLenum m_filter; diff --git a/src/video/sdl/sdl_screen_renderer.hpp b/src/video/sdl/sdl_screen_renderer.hpp index 3ebaa3a69ef..57d55699ecb 100644 --- a/src/video/sdl/sdl_screen_renderer.hpp +++ b/src/video/sdl/sdl_screen_renderer.hpp @@ -43,7 +43,7 @@ class SDLScreenRenderer final : public Renderer virtual TexturePtr get_texture() const override { return {}; } void flip(); - SDL_Renderer* get_sdl_renderer() const { return m_renderer; } + inline SDL_Renderer* get_sdl_renderer() const { return m_renderer; } private: SDLVideoSystem& m_video_system; diff --git a/src/video/sdl/sdl_texture.hpp b/src/video/sdl/sdl_texture.hpp index e36e8571a57..d47eb91836e 100644 --- a/src/video/sdl/sdl_texture.hpp +++ b/src/video/sdl/sdl_texture.hpp @@ -38,8 +38,8 @@ class SDLTexture final : public Texture virtual int get_image_width() const override { return m_width; } virtual int get_image_height() const override { return m_height; } - SDL_Texture *get_texture() const { return m_texture; } - const Sampler& get_sampler() const { return m_sampler; } + inline SDL_Texture *get_texture() const { return m_texture; } + inline const Sampler& get_sampler() const { return m_sampler; } private: SDL_Texture* m_texture; diff --git a/src/video/surface.hpp b/src/video/surface.hpp index 320831508d2..e9d0c043d75 100644 --- a/src/video/surface.hpp +++ b/src/video/surface.hpp @@ -51,11 +51,11 @@ class Surface final TexturePtr get_texture() const; TexturePtr get_displacement_texture() const; - Rect get_region() const { return m_region; } + inline Rect get_region() const { return m_region; } int get_width() const; int get_height() const; - Flip get_flip() const { return m_flip; } - const std::string& get_filename() const { return m_source_filename; } + inline Flip get_flip() const { return m_flip; } + inline const std::string& get_filename() const { return m_source_filename; } private: const TexturePtr m_diffuse_texture; diff --git a/src/video/surface_batch.hpp b/src/video/surface_batch.hpp index f1cedd6b11a..dcca8c702bd 100644 --- a/src/video/surface_batch.hpp +++ b/src/video/surface_batch.hpp @@ -35,11 +35,11 @@ class SurfaceBatch void draw(const Rectf& dstrect, float angle = 0.0f); void draw(const Rectf& srcrect, const Rectf& dstrect, float angle = 0.0f); - std::vector move_srcrects() { return std::move(m_srcrects); } - std::vector move_dstrects() { return std::move(m_dstrects); } - std::vector move_angles() { return std::move(m_angles); } + inline std::vector move_srcrects() { return std::move(m_srcrects); } + inline std::vector move_dstrects() { return std::move(m_dstrects); } + inline std::vector move_angles() { return std::move(m_angles); } - Color get_color() const { return m_color; } + inline Color get_color() const { return m_color; } private: SurfacePtr m_surface; diff --git a/src/video/texture.hpp b/src/video/texture.hpp index 69b14dc7c7f..059ffcb2eef 100644 --- a/src/video/texture.hpp +++ b/src/video/texture.hpp @@ -53,7 +53,7 @@ class Texture virtual int get_image_width() const = 0; virtual int get_image_height() const = 0; - const Sampler& get_sampler() const { return m_sampler; } + inline const Sampler& get_sampler() const { return m_sampler; } protected: Sampler m_sampler; diff --git a/src/video/texture_manager.hpp b/src/video/texture_manager.hpp index 240e37cb431..bf1f8a90898 100644 --- a/src/video/texture_manager.hpp +++ b/src/video/texture_manager.hpp @@ -59,7 +59,7 @@ class TextureManager final : public Currenton void debug_print(std::ostream& out) const; - bool last_load_successful() const { return m_load_successful; } + inline bool last_load_successful() const { return m_load_successful; } private: const SDL_Surface& get_surface(const std::string& filename); diff --git a/src/video/ttf_font.hpp b/src/video/ttf_font.hpp index 7555d963d7f..bfff3b1dd56 100644 --- a/src/video/ttf_font.hpp +++ b/src/video/ttf_font.hpp @@ -49,10 +49,10 @@ class TTFFont final : public Font virtual Rectf draw_text(Canvas& canvas, const std::string& text, const Vector& pos, FontAlignment alignment, int layer, const Color& color) override; - int get_shadow_size() const { return m_shadow_size; } - int get_border() const { return m_border; } + inline int get_shadow_size() const { return m_shadow_size; } + inline int get_border() const { return m_border; } - TTF_Font* get_ttf_font() const { return m_font; } + inline TTF_Font* get_ttf_font() const { return m_font; } private: TTF_Font* m_font; diff --git a/src/video/ttf_surface.hpp b/src/video/ttf_surface.hpp index 5864e5ce3a8..01e8cd3cf5f 100644 --- a/src/video/ttf_surface.hpp +++ b/src/video/ttf_surface.hpp @@ -37,8 +37,8 @@ class TTFSurface final public: TTFSurface(const SurfacePtr& surface, const Vector& offset); - SurfacePtr get_surface() { return m_surface; } - Vector get_offset() const { return m_offset; } + inline SurfacePtr get_surface() { return m_surface; } + inline Vector get_offset() const { return m_offset; } int get_width() const; int get_height() const; diff --git a/src/video/viewport.hpp b/src/video/viewport.hpp index edf7274a96e..121e0f3cec7 100644 --- a/src/video/viewport.hpp +++ b/src/video/viewport.hpp @@ -31,10 +31,10 @@ class Viewport final Viewport(const Rect& rect, const Vector& scale); /** The size of the viewport in window coordinates */ - Rect get_rect() const { return m_rect; } + inline Rect get_rect() const { return m_rect; } /** The amount by which the content of the viewport is scaled */ - Vector get_scale() const { return m_scale; } + inline Vector get_scale() const { return m_scale; } /** The width of the resulting logical screen */ int get_screen_width() const; diff --git a/src/worldmap/camera.hpp b/src/worldmap/camera.hpp index 8066552f297..6be86126a1f 100644 --- a/src/worldmap/camera.hpp +++ b/src/worldmap/camera.hpp @@ -32,9 +32,9 @@ class Camera void update(float dt_sec); void pan(); - bool is_panning() const { return m_panning; } + inline bool is_panning() const { return m_panning; } - Vector get_offset() const { return m_camera_offset; } + inline Vector get_offset() const { return m_camera_offset; } private: Vector get_camera_pos_for_tux() const; diff --git a/src/worldmap/level_tile.cpp b/src/worldmap/level_tile.cpp index 9bccae009a2..c7c42fb59f9 100644 --- a/src/worldmap/level_tile.cpp +++ b/src/worldmap/level_tile.cpp @@ -132,20 +132,6 @@ LevelTile::update_sprite_action() m_sprite->set_action((m_sprite->has_action("perfect") && m_perfect) ? "perfect" : "solved"); } -void -LevelTile::set_solved(bool v) -{ - m_solved = v; - update_sprite_action(); -} - -void -LevelTile::set_perfect(bool v) -{ - m_perfect = v; - update_sprite_action(); -} - ObjectSettings LevelTile::get_settings() { diff --git a/src/worldmap/level_tile.hpp b/src/worldmap/level_tile.hpp index 59cc80a7539..f4310ba6a94 100644 --- a/src/worldmap/level_tile.hpp +++ b/src/worldmap/level_tile.hpp @@ -39,24 +39,24 @@ class LevelTile final : public WorldMapObject virtual ObjectSettings get_settings() override; - void set_solved(bool v); - bool is_solved() const { return m_solved; } + inline void set_solved(bool v) { m_solved = v; update_sprite_action(); } + inline bool is_solved() const { return m_solved; } - void set_perfect(bool v); - bool is_perfect() const { return m_perfect; } + inline void set_perfect(bool v) { m_perfect = v; update_sprite_action(); } + inline bool is_perfect() const { return m_perfect; } - Statistics& get_statistics() { return m_statistics; } - const Statistics& get_statistics() const { return m_statistics; } + inline Statistics& get_statistics() { return m_statistics; } + inline const Statistics& get_statistics() const { return m_statistics; } void update_sprite_action(); - const std::string& get_title() const { return m_title; } - const std::string& get_level_filename() const { return m_level_filename; } - const std::string& get_basedir() const { return m_basedir; } - Color get_title_color() const { return m_title_color; } - const std::string& get_extro_script() const { return m_extro_script; } - float get_target_time() const { return m_target_time; } - bool is_auto_play() const { return m_auto_play; } + inline const std::string& get_title() const { return m_title; } + inline const std::string& get_level_filename() const { return m_level_filename; } + inline const std::string& get_basedir() const { return m_basedir; } + inline Color get_title_color() const { return m_title_color; } + inline const std::string& get_extro_script() const { return m_extro_script; } + inline float get_target_time() const { return m_target_time; } + inline bool is_auto_play() const { return m_auto_play; } private: void load_level_information(); diff --git a/src/worldmap/spawn_point.hpp b/src/worldmap/spawn_point.hpp index 108eaa915d7..ab51c7af220 100644 --- a/src/worldmap/spawn_point.hpp +++ b/src/worldmap/spawn_point.hpp @@ -32,9 +32,9 @@ class SpawnPoint final public: SpawnPoint(const ReaderMapping& mapping); - const std::string& get_name() const { return m_name; } - Vector get_pos() const { return m_pos; } - Direction get_auto_dir() const { return m_auto_dir; } + inline const std::string& get_name() const { return m_name; } + inline Vector get_pos() const { return m_pos; } + inline Direction get_auto_dir() const { return m_auto_dir; } private: std::string m_name; diff --git a/src/worldmap/special_tile.hpp b/src/worldmap/special_tile.hpp index 902d37c835c..cc4634f3ed4 100644 --- a/src/worldmap/special_tile.hpp +++ b/src/worldmap/special_tile.hpp @@ -41,14 +41,14 @@ class SpecialTile final : public WorldMapObject virtual ObjectSettings get_settings() override; - const std::string& get_map_message() const { return m_map_message; } - bool is_passive_message() const { return m_passive_message; } - const std::string& get_script() const { return m_script; } + inline const std::string& get_map_message() const { return m_map_message; } + inline bool is_passive_message() const { return m_passive_message; } + inline const std::string& get_script() const { return m_script; } - bool get_apply_action_north() const { return m_apply_action_north; } + inline bool get_apply_action_north() const { return m_apply_action_north; } bool get_apply_action_east() const { return m_apply_action_east; } - bool get_apply_action_south() const { return m_apply_action_south; } - bool get_apply_action_west() const { return m_apply_action_west; } + inline bool get_apply_action_south() const { return m_apply_action_south; } + inline bool get_apply_action_west() const { return m_apply_action_west; } private: /** Message to show in the Map */ diff --git a/src/worldmap/sprite_change.hpp b/src/worldmap/sprite_change.hpp index 4fa4fda3292..b4a15b6d8bd 100644 --- a/src/worldmap/sprite_change.hpp +++ b/src/worldmap/sprite_change.hpp @@ -59,7 +59,7 @@ class SpriteChange final : public WorldMapObject */ SpritePtr clone_sprite() const; - bool change_on_touch() const { return m_change_on_touch; } + inline bool change_on_touch() const { return m_change_on_touch; } private: /** should Tux's sprite change when the tile has been completely entered, diff --git a/src/worldmap/teleporter.hpp b/src/worldmap/teleporter.hpp index 39c7ec8253e..1b2cc889ffa 100644 --- a/src/worldmap/teleporter.hpp +++ b/src/worldmap/teleporter.hpp @@ -37,11 +37,11 @@ class Teleporter final : public WorldMapObject virtual ObjectSettings get_settings() override; - const std::string& get_worldmap() const { return m_worldmap; } - const std::string& get_sector() const { return m_sector; } - const std::string& get_spawnpoint() const { return m_spawnpoint; } - bool is_automatic() const { return m_automatic; } - const std::string& get_message() const { return m_message; } + inline const std::string& get_worldmap() const { return m_worldmap; } + inline const std::string& get_sector() const { return m_sector; } + inline const std::string& get_spawnpoint() const { return m_spawnpoint; } + inline bool is_automatic() const { return m_automatic; } + inline const std::string& get_message() const { return m_message; } private: /** Worldmap filename (relative to data root) to teleport to. Leave empty to use current word */ diff --git a/src/worldmap/tux.cpp b/src/worldmap/tux.cpp index e0236c37429..95422dc9e07 100644 --- a/src/worldmap/tux.cpp +++ b/src/worldmap/tux.cpp @@ -174,24 +174,6 @@ Tux::stop() m_moving = false; } -void -Tux::set_direction(Direction dir) -{ - m_input_direction = dir; -} - -void -Tux::set_ghost_mode(bool enabled) -{ - m_ghost_mode = enabled; -} - -bool -Tux::get_ghost_mode() const -{ - return m_ghost_mode; -} - void Tux::try_start_walking() { diff --git a/src/worldmap/tux.hpp b/src/worldmap/tux.hpp index 4347fd3d1ac..b7e1db57b93 100644 --- a/src/worldmap/tux.hpp +++ b/src/worldmap/tux.hpp @@ -43,17 +43,17 @@ class Tux final : public GameObject void setup(); /**< called prior to first update */ - void set_direction(Direction dir); + inline void set_direction(Direction dir) { m_input_direction = dir; } - void set_ghost_mode(bool enabled); - bool get_ghost_mode() const; + inline void set_ghost_mode(bool enabled) { m_ghost_mode = enabled; } + inline bool get_ghost_mode() const { return m_ghost_mode; } - bool is_moving() const { return m_moving; } + inline bool is_moving() const { return m_moving; } Vector get_pos() const; Vector get_axis() const; - Vector get_tile_pos() const { return m_tile_pos; } - void set_initial_pos(const Vector& pos) { m_initial_tile_pos = pos / 32.f; } - void set_tile_pos(const Vector& pos) { m_tile_pos = pos; } + inline Vector get_tile_pos() const { return m_tile_pos; } + inline void set_initial_pos(const Vector& pos) { m_initial_tile_pos = pos / 32.f; } + inline void set_tile_pos(const Vector& pos) { m_tile_pos = pos; } void process_special_tile(SpecialTile* special_tile); diff --git a/src/worldmap/worldmap.cpp b/src/worldmap/worldmap.cpp index bd82a613242..cdade6c622a 100644 --- a/src/worldmap/worldmap.cpp +++ b/src/worldmap/worldmap.cpp @@ -268,19 +268,6 @@ WorldMap::set_levels_solved(bool solved, bool perfect) } } -void -WorldMap::set_passive_message(const std::string& message, float time) -{ - m_passive_message = message; - m_passive_message_timer.start(time); -} - -void -WorldMap::set_initial_spawnpoint(const std::string& spawnpoint) -{ - m_force_spawnpoint = spawnpoint; -} - WorldMapSector* WorldMap::get_sector(const std::string& name) const diff --git a/src/worldmap/worldmap.hpp b/src/worldmap/worldmap.hpp index 37e345f76e1..c33724d6392 100644 --- a/src/worldmap/worldmap.hpp +++ b/src/worldmap/worldmap.hpp @@ -69,20 +69,24 @@ class WorldMap final : public Currenton void set_levels_solved(bool solved, bool perfect); /** Sets the passive message with specific time **/ - void set_passive_message(const std::string& message, float time); + inline void set_passive_message(const std::string& message, float time) + { + m_passive_message = message; + m_passive_message_timer.start(time); + } /** Sets the initial spawnpoint to be forced on next setup */ - void set_initial_spawnpoint(const std::string& spawnpoint); + inline void set_initial_spawnpoint(const std::string& spawnpoint) { m_force_spawnpoint = spawnpoint; } - const std::string& get_title() const { return m_name; } - Savegame& get_savegame() const { return m_savegame; } - const std::string& get_levels_path() const { return m_levels_path; } + inline const std::string& get_title() const { return m_name; } + inline Savegame& get_savegame() const { return m_savegame; } + inline const std::string& get_levels_path() const { return m_levels_path; } WorldMapSector* get_sector(const std::string& name) const; WorldMapSector* get_sector(int index) const; void add_sector(std::unique_ptr sector); - WorldMapSector& get_sector() const { return *m_sector; } + inline WorldMapSector& get_sector() const { return *m_sector; } void set_sector(const std::string& name, const std::string& spawnpoint = "", bool perform_full_setup = true); diff --git a/src/worldmap/worldmap_object.hpp b/src/worldmap/worldmap_object.hpp index 9803e576d0a..d83d896e956 100644 --- a/src/worldmap/worldmap_object.hpp +++ b/src/worldmap/worldmap_object.hpp @@ -52,7 +52,7 @@ class WorldMapObject : public MovingSprite virtual ObjectSettings get_settings() override; virtual void move_to(const Vector& pos) override; - Vector get_tile_pos() const { return { m_tile_x, m_tile_y }; } + inline Vector get_tile_pos() const { return { m_tile_x, m_tile_y }; } private: void initialize(); diff --git a/src/worldmap/worldmap_sector.hpp b/src/worldmap/worldmap_sector.hpp index 3668cfd8ffe..11859f64505 100644 --- a/src/worldmap/worldmap_sector.hpp +++ b/src/worldmap/worldmap_sector.hpp @@ -161,9 +161,9 @@ class WorldMapSector final : public Base::Sector void set_title_level(const std::string& filename); TileSet* get_tileset() const override; - WorldMap& get_worldmap() const { return m_parent; } - Camera& get_camera() const { return *m_camera; } - Tux& get_tux() const { return *m_tux; } + inline WorldMap& get_worldmap() const { return m_parent; } + inline Camera& get_camera() const { return *m_camera; } + inline Tux& get_tux() const { return *m_tux; } Vector get_tux_pos() const; protected: