Skip to content

Commit

Permalink
Granito: Fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Vankata453 committed Apr 27, 2024
1 parent d5cac86 commit c6b1a95
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/badguy/granito.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions src/badguy/granito_big.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/badguy/granito_big.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c6b1a95

Please sign in to comment.