From: Ingo Ruhnke Date: Mon, 25 Aug 2014 01:18:50 +0000 (+0200) Subject: Added const some member function qualifiers in Controller X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=8c2c897b61746b63d0c31815fa33cd016dc0e7ba;p=supertux.git Added const some member function qualifiers in Controller --- diff --git a/src/control/controller.cpp b/src/control/controller.cpp index a25c39bdc..686ccb36c 100644 --- a/src/control/controller.cpp +++ b/src/control/controller.cpp @@ -59,19 +59,19 @@ Controller::set_control(Control control, bool value) } bool -Controller::hold(Control control) +Controller::hold(Control control) const { return controls[control]; } bool -Controller::pressed(Control control) +Controller::pressed(Control control) const { return !oldControls[control] && controls[control]; } bool -Controller::released(Control control) +Controller::released(Control control) const { return oldControls[control] && !controls[control]; } diff --git a/src/control/controller.hpp b/src/control/controller.hpp index 8d8543e6a..ab9decd61 100644 --- a/src/control/controller.hpp +++ b/src/control/controller.hpp @@ -51,11 +51,11 @@ public: void set_control(Control control, bool value); /** returns true if the control is pressed down */ - bool hold(Control control); + bool hold(Control control) const; /** returns true if the control has just been pressed down this frame */ - bool pressed(Control control); + bool pressed(Control control) const; /** returns true if the control has just been released this frame */ - bool released(Control control); + bool released(Control control) const; virtual void reset(); virtual void update();