From c6b1a9541fc252356ed3d7b6762db1633e172272 Mon Sep 17 00:00:00 2001 From: Vankata453 <78196474+Vankata453@users.noreply.github.com> Date: Sat, 27 Apr 2024 22:25:55 +0300 Subject: [PATCH] Granito: Fix compilation --- src/badguy/granito.cpp | 4 +++- src/badguy/granito_big.cpp | 6 +++--- src/badguy/granito_big.hpp | 10 +++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/badguy/granito.cpp b/src/badguy/granito.cpp index a01a513ccc1..96785293edc 100644 --- a/src/badguy/granito.cpp +++ b/src/badguy/granito.cpp @@ -29,7 +29,9 @@ Granito::Granito(const ReaderMapping& reader, const std::string& sprite_name, in m_original_state(STATE_STAND), m_has_waved(false), m_stepped_on(false), - m_airborne(false) + m_airborne(false), + m_detect_script(), + m_carried_script() { parse_type(reader); diff --git a/src/badguy/granito_big.cpp b/src/badguy/granito_big.cpp index d89a4509513..a9b22b60ef8 100644 --- a/src/badguy/granito_big.cpp +++ b/src/badguy/granito_big.cpp @@ -86,7 +86,7 @@ GranitoBig::carry(Granito* granito) void GranitoBig::eject() { - if (m_carrying == nullptr) + if (!m_carrying) return; m_carrying->walk_for(1.5f); @@ -95,9 +95,9 @@ GranitoBig::eject() } std::string -GranitoBig::get_carrying_name() +GranitoBig::get_carrying_name() const { - return m_carrying != nullptr ? m_carrying->get_name() : ""; + return m_carrying ? m_carrying->get_name() : ""; } bool diff --git a/src/badguy/granito_big.hpp b/src/badguy/granito_big.hpp index 0d2ffe26586..44e8749b86a 100644 --- a/src/badguy/granito_big.hpp +++ b/src/badguy/granito_big.hpp @@ -48,26 +48,26 @@ class GranitoBig final : public Granito virtual GameObjectTypes get_types() const override; void carry(Granito* granito); - Granito* get_carrying() { return m_carrying; } + Granito* get_carrying() const { return m_carrying; } /** * @scripting * @description This function tells the Granito being carried to - * unglue itself to the Big Granito, by jumping and walking off. + * unglue itself from the Big Granito, by jumping and walking off. */ virtual void eject() override; /** * @scripting - * @description Gets the Granito being carried by the Big Granito. + * @description Gets the name of the Granito being carried by the Big Granito. */ - std::string get_carrying_name(); + std::string get_carrying_name() const; // The following functions are unimplemented for Big Granito. virtual void wave() override {} virtual void jump() override {} virtual void sit() override {} - virtual GranitoBig* get_carrier() override { return nullptr; } + virtual GranitoBig* get_carrier() const override { return nullptr; } public: Granito* m_carrying;